Skip to content

Commit d84eff7

Browse files
committed
Remove unneccessary api, rename storage api, and update comment
1 parent dea26c6 commit d84eff7

File tree

11 files changed

+16
-26
lines changed

11 files changed

+16
-26
lines changed

Flow.Launcher.Plugin/IPublicAPI.cs

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -165,30 +165,20 @@ public interface IPublicAPI
165165
void LogException(string className, string message, Exception e, [CallerMemberName] string methodName = "");
166166

167167
/// <summary>
168-
/// Load JsonStorage for current plugin. This is the method used to load settings from json in Flow.
168+
/// Load JsonStorage for current plugin's setting. This is the method used to load settings from json in Flow.
169169
/// When the file is not exist, it will create a new instance for the specific type.
170170
/// </summary>
171171
/// <typeparam name="T">Type for deserialization</typeparam>
172172
/// <returns></returns>
173-
T LoadJsonStorage<T>() where T : new();
173+
T LoadSettingJsonStorage<T>() where T : new();
174174

175175
/// <summary>
176-
/// Save JsonStorage for current plugin. This is the method used to save settings to json in Flow.Launcher
176+
/// Save JsonStorage for current plugin's setting. This is the method used to save settings to json in Flow.Launcher
177177
/// This method will save the original instance loaded with LoadJsonStorage.
178+
/// This API call is for manually Save. Flow will automatically save all setting that has registered.
178179
/// </summary>
179180
/// <typeparam name="T">Type for Serialization</typeparam>
180181
/// <returns></returns>
181-
void SaveJsonStorage<T>() where T : new();
182-
183-
/// <summary>
184-
/// Save JsonStorage for current plugin. This is the method used to save settings to json in Flow.Launcher
185-
/// This method will override the original class instance loaded from LoadJsonStorage
186-
/// This method allows registering a type with provided instance so that it won't create a new one.
187-
/// Only use it when you would like to create a new instance of the type instance and overwrite the original one
188-
/// stored before.
189-
/// </summary>
190-
/// <typeparam name="T">Type for Serialization</typeparam>
191-
/// <returns></returns>
192-
void SaveJsonStorage<T>(T settings) where T : new();
182+
void SaveSettingJsonStorage<T>() where T : new();
193183
}
194184
}

Flow.Launcher/PublicAPIInstance.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ private void SaveAllJsonStorage()
145145
}
146146
}
147147

148-
public T LoadJsonStorage<T>() where T : new()
148+
public T LoadSettingJsonStorage<T>() where T : new()
149149
{
150150
var type = typeof(T);
151151
if (!_pluginJsonStorages.ContainsKey(type))
@@ -154,7 +154,7 @@ private void SaveAllJsonStorage()
154154
return ((PluginJsonStorage<T>) _pluginJsonStorages[type]).Load();
155155
}
156156

157-
public void SaveJsonStorage<T>() where T : new()
157+
public void SaveSettingJsonStorage<T>() where T : new()
158158
{
159159
var type = typeof(T);
160160
if (!_pluginJsonStorages.ContainsKey(type))

Plugins/Flow.Launcher.Plugin.BrowserBookmark/Main.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public void Init(PluginInitContext context)
2424
{
2525
this.context = context;
2626

27-
_settings = context.API.LoadJsonStorage<Settings>();
27+
_settings = context.API.LoadSettingJsonStorage<Settings>();
2828

2929
cachedBookmarks = Bookmarks.LoadAllBookmarks();
3030
}

Plugins/Flow.Launcher.Plugin.Calculator/Main.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public class Main : IPlugin, IPluginI18n, ISettingProvider
3333
public void Init(PluginInitContext context)
3434
{
3535
Context = context;
36-
_settings = context.API.LoadJsonStorage<Settings>();
36+
_settings = context.API.LoadSettingJsonStorage<Settings>();
3737
_viewModel = new SettingsViewModel(_settings);
3838

3939
MagesEngine = new Engine(new Configuration

Plugins/Flow.Launcher.Plugin.Explorer/Main.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public async Task InitAsync(PluginInitContext context)
3232
{
3333
Context = context;
3434

35-
Settings = context.API.LoadJsonStorage<Settings>();
35+
Settings = context.API.LoadSettingJsonStorage<Settings>();
3636

3737
viewModel = new SettingsViewModel(context, Settings);
3838

Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public SettingsViewModel(PluginInitContext context, Settings settings)
2222

2323
public void Save()
2424
{
25-
Context.API.SaveJsonStorage<Settings>();
25+
Context.API.SaveSettingJsonStorage<Settings>();
2626
}
2727

2828
internal void RemoveLinkFromQuickAccess(AccessLink selectedRow) => Settings.QuickAccessLinks.Remove(selectedRow);

Plugins/Flow.Launcher.Plugin.PluginsManager/Main.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public Control CreateSettingPanel()
3434
public Task InitAsync(PluginInitContext context)
3535
{
3636
Context = context;
37-
Settings = context.API.LoadJsonStorage<Settings>();
37+
Settings = context.API.LoadSettingJsonStorage<Settings>();
3838
viewModel = new SettingsViewModel(context, Settings);
3939
contextMenu = new ContextMenu(Context);
4040
pluginManager = new PluginsManager(Context, Settings);

Plugins/Flow.Launcher.Plugin.Program/Main.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public async Task InitAsync(PluginInitContext context)
6969
{
7070
_context = context;
7171

72-
_settings = context.API.LoadJsonStorage<Settings>();
72+
_settings = context.API.LoadSettingJsonStorage<Settings>();
7373

7474
await Task.Yield();
7575

Plugins/Flow.Launcher.Plugin.Shell/Main.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ public void Init(PluginInitContext context)
272272
{
273273
this.context = context;
274274
context.API.GlobalKeyboardEvent += API_GlobalKeyboardEvent;
275-
_settings = context.API.LoadJsonStorage<Settings>();
275+
_settings = context.API.LoadSettingJsonStorage<Settings>();
276276
}
277277

278278
bool API_GlobalKeyboardEvent(int keyevent, int vkcode, SpecialKeyState state)

Plugins/Flow.Launcher.Plugin.Url/Main.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ public void Init(PluginInitContext context)
118118
{
119119
this.context = context;
120120

121-
_settings = context.API.LoadJsonStorage<Settings>();
121+
_settings = context.API.LoadSettingJsonStorage<Settings>();
122122
}
123123

124124
public string GetTranslatedPluginTitle()

0 commit comments

Comments
 (0)