use ISavable and add obsolete message

This commit is contained in:
Jeremy Wu 2021-06-21 21:56:20 +10:00
parent 0387bfbb64
commit 644be7977c
6 changed files with 12 additions and 11 deletions

View file

@ -7,9 +7,9 @@ using System.Threading;
using System.Threading.Tasks;
using Flow.Launcher.Infrastructure;
using Flow.Launcher.Infrastructure.Logger;
using Flow.Launcher.Infrastructure.Storage;
using Flow.Launcher.Infrastructure.UserSettings;
using Flow.Launcher.Plugin;
using ISavable = Flow.Launcher.Plugin.ISavable;
namespace Flow.Launcher.Core.Plugin
{
@ -48,7 +48,7 @@ namespace Flow.Launcher.Core.Plugin
{
foreach (var plugin in AllPlugins)
{
var savable = plugin.Plugin as ISettingsSavable;
var savable = plugin.Plugin as ISavable;
savable?.Save();
}

View file

@ -1,10 +1,8 @@
using Flow.Launcher.Plugin;
using System;
namespace Flow.Launcher.Infrastructure.Storage
{
/// <summary>
/// Save plugin settings/cache,
/// todo should be merged into a abstract class intead of seperate interface
/// </summary>
public interface ISavable : ISettingsSavable { }
[Obsolete("Deprecated as of Flow Launcher v1.8.0, on 2021.06.21. " +
"This is used only for Everything plugin v1.4.9 or below backwards compatibility")]
public interface ISavable : Plugin.ISavable { }
}

View file

@ -88,5 +88,7 @@ namespace Flow.Launcher.Infrastructure.Storage
}
}
[Obsolete("Deprecated as of Flow Launcher v1.8.0, on 2021.06.21. " +
"This is used only for Everything plugin v1.4.9 or below backwards compatibility")]
public class JsonStrorage<T> : JsonStorage<T> where T : new() { }
}

View file

@ -5,7 +5,7 @@
/// Otherwise if LoadSettingJsonStorage or SaveSettingJsonStorage has been callded,
/// plugin settings will be automatically saved (see Flow.Launcher/PublicAPIInstance.SavePluginSettings) by Flow
/// </summary>
public interface ISettingsSavable
public interface ISavable
{
void Save();
}

View file

@ -20,10 +20,11 @@ using Flow.Launcher.Plugin.SharedCommands;
using Flow.Launcher.Storage;
using Flow.Launcher.Infrastructure.Logger;
using System.Threading.Channels;
using ISavable = Flow.Launcher.Plugin.ISavable;
namespace Flow.Launcher.ViewModel
{
public class MainViewModel : BaseModel, ISettingsSavable
public class MainViewModel : BaseModel, ISavable
{
#region Private Fields

View file

@ -13,7 +13,7 @@ using Stopwatch = Flow.Launcher.Infrastructure.Stopwatch;
namespace Flow.Launcher.Plugin.Program
{
public class Main : ISettingProvider, IAsyncPlugin, IPluginI18n, IContextMenu, ISettingsSavable, IAsyncReloadable
public class Main : ISettingProvider, IAsyncPlugin, IPluginI18n, IContextMenu, ISavable, IAsyncReloadable
{
internal static Win32[] _win32s { get; set; }
internal static UWP.Application[] _uwps { get; set; }