Skip to content

Commit 062cd2a

Browse files
committed
Use ISavable instead of object
1 parent baef9dd commit 062cd2a

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

Flow.Launcher.Core/Plugin/JsonRPCPluginSettings.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
namespace Flow.Launcher.Core.Plugin
1414
{
15-
public class JsonRPCPluginSettings
15+
public class JsonRPCPluginSettings : ISavable
1616
{
1717
public required JsonRpcConfigurationModel? Configuration { get; init; }
1818

Flow.Launcher/PublicAPIInstance.cs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ public void LogError(string className, string message, [CallerMemberName] string
276276
public void LogException(string className, string message, Exception e, [CallerMemberName] string methodName = "") =>
277277
Log.Exception(className, message, e, methodName);
278278

279-
private readonly ConcurrentDictionary<Type, object> _pluginJsonStorages = new();
279+
private readonly ConcurrentDictionary<Type, ISavable> _pluginJsonStorages = new();
280280

281281
public void RemovePluginSettings(string assemblyName)
282282
{
@@ -294,9 +294,8 @@ public void RemovePluginSettings(string assemblyName)
294294

295295
public void SavePluginSettings()
296296
{
297-
foreach (var value in _pluginJsonStorages.Values)
297+
foreach (var savable in _pluginJsonStorages.Values)
298298
{
299-
var savable = value as ISavable;
300299
savable?.Save();
301300
}
302301
}
@@ -496,7 +495,7 @@ public Task ShowProgressBoxAsync(string caption, Func<Action<double>, Task> repo
496495
public bool SetCurrentTheme(ThemeData theme) =>
497496
Theme.ChangeTheme(theme.FileNameWithoutExtension);
498497

499-
private readonly ConcurrentDictionary<(string, string, Type), object> _pluginBinaryStorages = new();
498+
private readonly ConcurrentDictionary<(string, string, Type), ISavable> _pluginBinaryStorages = new();
500499

501500
public void RemovePluginCaches(string cacheDirectory)
502501
{
@@ -513,9 +512,8 @@ public void RemovePluginCaches(string cacheDirectory)
513512

514513
public void SavePluginCaches()
515514
{
516-
foreach (var value in _pluginBinaryStorages.Values)
515+
foreach (var savable in _pluginBinaryStorages.Values)
517516
{
518-
var savable = value as ISavable;
519517
savable?.Save();
520518
}
521519
}

0 commit comments

Comments
 (0)