mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Merge pull request #3668 from Flow-Launcher/derive_class_save
Fix Derive Class Save Method Calling Issue
This commit is contained in:
commit
ba28621b84
5 changed files with 16 additions and 12 deletions
|
|
@ -12,7 +12,7 @@ using Flow.Launcher.Plugin;
|
|||
|
||||
namespace Flow.Launcher.Core.Plugin
|
||||
{
|
||||
public class JsonRPCPluginSettings
|
||||
public class JsonRPCPluginSettings : ISavable
|
||||
{
|
||||
public required JsonRpcConfigurationModel? Configuration { get; init; }
|
||||
|
||||
|
|
|
|||
|
|
@ -2,11 +2,13 @@
|
|||
using System.Threading.Tasks;
|
||||
using Flow.Launcher.Infrastructure.Logger;
|
||||
using Flow.Launcher.Infrastructure.UserSettings;
|
||||
using Flow.Launcher.Plugin;
|
||||
using Flow.Launcher.Plugin.SharedCommands;
|
||||
|
||||
namespace Flow.Launcher.Infrastructure.Storage
|
||||
{
|
||||
public class FlowLauncherJsonStorage<T> : JsonStorage<T> where T : new()
|
||||
// Expose ISaveable interface in derived class to make sure we are calling the new version of Save method
|
||||
public class FlowLauncherJsonStorage<T> : JsonStorage<T>, ISavable where T : new()
|
||||
{
|
||||
private static readonly string ClassName = "FlowLauncherJsonStorage";
|
||||
|
||||
|
|
|
|||
|
|
@ -1,11 +1,13 @@
|
|||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using Flow.Launcher.Infrastructure.Logger;
|
||||
using Flow.Launcher.Plugin;
|
||||
using Flow.Launcher.Plugin.SharedCommands;
|
||||
|
||||
namespace Flow.Launcher.Infrastructure.Storage
|
||||
{
|
||||
public class PluginBinaryStorage<T> : BinaryStorage<T> where T : new()
|
||||
// Expose ISaveable interface in derived class to make sure we are calling the new version of Save method
|
||||
public class PluginBinaryStorage<T> : BinaryStorage<T>, ISavable where T : new()
|
||||
{
|
||||
private static readonly string ClassName = "PluginBinaryStorage";
|
||||
|
||||
|
|
|
|||
|
|
@ -2,11 +2,13 @@
|
|||
using System.Threading.Tasks;
|
||||
using Flow.Launcher.Infrastructure.Logger;
|
||||
using Flow.Launcher.Infrastructure.UserSettings;
|
||||
using Flow.Launcher.Plugin;
|
||||
using Flow.Launcher.Plugin.SharedCommands;
|
||||
|
||||
namespace Flow.Launcher.Infrastructure.Storage
|
||||
{
|
||||
public class PluginJsonStorage<T> : JsonStorage<T> where T : new()
|
||||
// Expose ISaveable interface in derived class to make sure we are calling the new version of Save method
|
||||
public class PluginJsonStorage<T> : JsonStorage<T>, ISavable where T : new()
|
||||
{
|
||||
// Use assembly name to check which plugin is using this storage
|
||||
public readonly string AssemblyName;
|
||||
|
|
|
|||
|
|
@ -287,7 +287,7 @@ namespace Flow.Launcher
|
|||
public void LogException(string className, string message, Exception e, [CallerMemberName] string methodName = "") =>
|
||||
Log.Exception(className, message, e, methodName);
|
||||
|
||||
private readonly ConcurrentDictionary<Type, object> _pluginJsonStorages = new();
|
||||
private readonly ConcurrentDictionary<Type, ISavable> _pluginJsonStorages = new();
|
||||
|
||||
public void RemovePluginSettings(string assemblyName)
|
||||
{
|
||||
|
|
@ -305,10 +305,9 @@ namespace Flow.Launcher
|
|||
|
||||
public void SavePluginSettings()
|
||||
{
|
||||
foreach (var value in _pluginJsonStorages.Values)
|
||||
foreach (var savable in _pluginJsonStorages.Values)
|
||||
{
|
||||
var savable = value as ISavable;
|
||||
savable?.Save();
|
||||
savable.Save();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -507,7 +506,7 @@ namespace Flow.Launcher
|
|||
public bool SetCurrentTheme(ThemeData theme) =>
|
||||
Theme.ChangeTheme(theme.FileNameWithoutExtension);
|
||||
|
||||
private readonly ConcurrentDictionary<(string, string, Type), object> _pluginBinaryStorages = new();
|
||||
private readonly ConcurrentDictionary<(string, string, Type), ISavable> _pluginBinaryStorages = new();
|
||||
|
||||
public void RemovePluginCaches(string cacheDirectory)
|
||||
{
|
||||
|
|
@ -524,10 +523,9 @@ namespace Flow.Launcher
|
|||
|
||||
public void SavePluginCaches()
|
||||
{
|
||||
foreach (var value in _pluginBinaryStorages.Values)
|
||||
foreach (var savable in _pluginBinaryStorages.Values)
|
||||
{
|
||||
var savable = value as ISavable;
|
||||
savable?.Save();
|
||||
savable.Save();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue