From ab0d6245dfa327a9adfe6509fdd7f9b62e1bd3d5 Mon Sep 17 00:00:00 2001
From: Vic <10308169+VictoriousRaptor@users.noreply.github.com>
Date: Sun, 12 Feb 2023 01:58:53 +0800
Subject: [PATCH] Auto reload all bookmarks when finish editing
---
.../Languages/en.xaml | 1 -
.../Main.cs | 17 ++++++----
.../Views/CustomBrowserSetting.xaml | 6 ++--
.../Views/CustomBrowserSetting.xaml.cs | 33 +++++++++----------
4 files changed, 29 insertions(+), 28 deletions(-)
diff --git a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Languages/en.xaml b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Languages/en.xaml
index 5aee14838..d3d7cc947 100644
--- a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Languages/en.xaml
+++ b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Languages/en.xaml
@@ -27,5 +27,4 @@
Browser EngineIf you are not using Chrome, Firefox or Edge, or you are using their portable version, you need to add bookmarks data directory and select correct browser engine to make this plugin work.For example: Brave's engine is Chromium; and its default bookmarks data location is: "%LOCALAPPDATA%\BraveSoftware\Brave-Browser\UserData". For Firefox engine, the bookmarks directory is the folder contains the places.sqlite file.
- After changing these values, close all setting windows and press F5 when Flow Launcher is open to reload the plug-in.
\ No newline at end of file
diff --git a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Main.cs b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Main.cs
index d072a362d..d9a719272 100644
--- a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Main.cs
+++ b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Main.cs
@@ -17,16 +17,16 @@ namespace Flow.Launcher.Plugin.BrowserBookmark
{
public class Main : ISettingProvider, IPlugin, IReloadable, IPluginI18n, IContextMenu, IDisposable
{
- private PluginInitContext context;
+ private static PluginInitContext context;
- private List cachedBookmarks = new List();
-
- private Settings _settings { get; set; }
+ private static List cachedBookmarks = new List();
+ private static Settings _settings;
+
public void Init(PluginInitContext context)
{
- this.context = context;
-
+ Main.context = context;
+
_settings = context.API.LoadSettingJsonStorage();
cachedBookmarks = BookmarkLoader.LoadAllBookmarks(_settings);
@@ -136,6 +136,11 @@ namespace Flow.Launcher.Plugin.BrowserBookmark
}
public void ReloadData()
+ {
+ ReloadAllBookmarks();
+ }
+
+ public static void ReloadAllBookmarks()
{
cachedBookmarks.Clear();
diff --git a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Views/CustomBrowserSetting.xaml b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Views/CustomBrowserSetting.xaml
index a8ecb54f9..392c9e0a7 100644
--- a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Views/CustomBrowserSetting.xaml
+++ b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Views/CustomBrowserSetting.xaml
@@ -39,7 +39,7 @@