Move initialized flag

This commit is contained in:
Vic 2023-06-17 00:42:21 +08:00
parent 6d64abd21a
commit e46df28fdd

View file

@ -33,8 +33,6 @@ namespace Flow.Launcher.Plugin.BrowserBookmark
_settings = context.API.LoadSettingJsonStorage<Settings>(); _settings = context.API.LoadSettingJsonStorage<Settings>();
LoadBookmarksIfEnabled(); LoadBookmarksIfEnabled();
initialized = true;
} }
private static void LoadBookmarksIfEnabled() private static void LoadBookmarksIfEnabled()
@ -42,12 +40,12 @@ namespace Flow.Launcher.Plugin.BrowserBookmark
if (context.CurrentPluginMetadata.Disabled) if (context.CurrentPluginMetadata.Disabled)
{ {
// Don't load or monitor files if disabled // Don't load or monitor files if disabled
// Note: It doesn't start loading or monitoring if enabled later, you need to manually reload data
return; return;
} }
cachedBookmarks = BookmarkLoader.LoadAllBookmarks(_settings); cachedBookmarks = BookmarkLoader.LoadAllBookmarks(_settings);
_ = MonitorRefreshQueueAsync(); _ = MonitorRefreshQueueAsync();
initialized = true;
} }
public List<Result> Query(Query query) public List<Result> Query(Query query)
@ -55,7 +53,6 @@ namespace Flow.Launcher.Plugin.BrowserBookmark
if (!initialized) if (!initialized)
{ {
LoadBookmarksIfEnabled(); LoadBookmarksIfEnabled();
initialized = true;
} }
string param = query.Search.TrimStart(); string param = query.Search.TrimStart();
@ -140,10 +137,6 @@ namespace Flow.Launcher.Plugin.BrowserBookmark
{ {
return; return;
} }
if (context.CurrentPluginMetadata.Disabled)
{
return;
}
if (Watchers.Any(x => x.Path.Equals(directory, StringComparison.OrdinalIgnoreCase))) if (Watchers.Any(x => x.Path.Equals(directory, StringComparison.OrdinalIgnoreCase)))
{ {
return; return;