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>();
LoadBookmarksIfEnabled();
initialized = true;
}
private static void LoadBookmarksIfEnabled()
@ -42,12 +40,12 @@ namespace Flow.Launcher.Plugin.BrowserBookmark
if (context.CurrentPluginMetadata.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;
}
cachedBookmarks = BookmarkLoader.LoadAllBookmarks(_settings);
_ = MonitorRefreshQueueAsync();
initialized = true;
}
public List<Result> Query(Query query)
@ -55,7 +53,6 @@ namespace Flow.Launcher.Plugin.BrowserBookmark
if (!initialized)
{
LoadBookmarksIfEnabled();
initialized = true;
}
string param = query.Search.TrimStart();
@ -140,10 +137,6 @@ namespace Flow.Launcher.Plugin.BrowserBookmark
{
return;
}
if (context.CurrentPluginMetadata.Disabled)
{
return;
}
if (Watchers.Any(x => x.Path.Equals(directory, StringComparison.OrdinalIgnoreCase)))
{
return;