Skip to content

Commit 68f3f21

Browse files
committed
Improve code quality
1 parent 6cb1fbb commit 68f3f21

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ public class Main : ISettingProvider, IPlugin, IReloadable, IPluginI18n, IContex
1616
{
1717
private static readonly string ClassName = nameof(Main);
1818

19-
private static Main _instance;
20-
2119
internal static string _faviconCacheDir;
2220

2321
internal static PluginInitContext _context;
@@ -26,6 +24,8 @@ public class Main : ISettingProvider, IPlugin, IReloadable, IPluginI18n, IContex
2624

2725
private static List<Bookmark> _cachedBookmarks = new();
2826

27+
private static Main _instance;
28+
2929
private volatile bool _isInitialized = false;
3030

3131
private static readonly SemaphoreSlim _initializationSemaphore = new(1, 1);
@@ -174,13 +174,13 @@ private static void OnBookmarkFileChanged(object sender, FileSystemEventArgs e)
174174

175175
var newCts = _debounceTokenSource;
176176

177-
Task.Run(async () =>
177+
_ = Task.Run(async () =>
178178
{
179179
try
180180
{
181181
await Task.Delay(TimeSpan.FromSeconds(3), newCts.Token);
182182
_context.API.LogInfo(ClassName, "Bookmark file change detected. Reloading bookmarks after delay.");
183-
await ReloadAllBookmarks(false);
183+
await ReloadAllBookmarksAsync(false);
184184
}
185185
catch (TaskCanceledException)
186186
{
@@ -191,10 +191,10 @@ private static void OnBookmarkFileChanged(object sender, FileSystemEventArgs e)
191191

192192
public void ReloadData()
193193
{
194-
_ = ReloadAllBookmarks();
194+
_ = ReloadAllBookmarksAsync();
195195
}
196196

197-
public static async Task ReloadAllBookmarks(bool disposeFileWatchers = true)
197+
public static async Task ReloadAllBookmarksAsync(bool disposeFileWatchers = true)
198198
{
199199
try
200200
{

Plugins/Flow.Launcher.Plugin.BrowserBookmark/Views/SettingsControl.xaml.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public bool LoadChromeBookmark
2424
set
2525
{
2626
Settings.LoadChromeBookmark = value;
27-
_ = Main.ReloadAllBookmarks();
27+
_ = Main.ReloadAllBookmarksAsync();
2828
}
2929
}
3030

@@ -34,7 +34,7 @@ public bool LoadFirefoxBookmark
3434
set
3535
{
3636
Settings.LoadFirefoxBookmark = value;
37-
_ = Main.ReloadAllBookmarks();
37+
_ = Main.ReloadAllBookmarksAsync();
3838
}
3939
}
4040

@@ -44,7 +44,7 @@ public bool LoadEdgeBookmark
4444
set
4545
{
4646
Settings.LoadEdgeBookmark = value;
47-
_ = Main.ReloadAllBookmarks();
47+
_ = Main.ReloadAllBookmarksAsync();
4848
}
4949
}
5050

@@ -54,7 +54,7 @@ public bool EnableFavicons
5454
set
5555
{
5656
Settings.EnableFavicons = value;
57-
_ = Main.ReloadAllBookmarks();
57+
_ = Main.ReloadAllBookmarksAsync();
5858
OnPropertyChanged();
5959
}
6060
}
@@ -76,7 +76,7 @@ private void NewCustomBrowser(object sender, RoutedEventArgs e)
7676
if (window.ShowDialog() == true)
7777
{
7878
Settings.CustomChromiumBrowsers.Add(newBrowser);
79-
_ = Main.ReloadAllBookmarks();
79+
_ = Main.ReloadAllBookmarksAsync();
8080
}
8181
}
8282

@@ -85,7 +85,7 @@ private void DeleteCustomBrowser(object sender, RoutedEventArgs e)
8585
if (CustomBrowsers.SelectedItem is CustomBrowser selectedCustomBrowser)
8686
{
8787
Settings.CustomChromiumBrowsers.Remove(selectedCustomBrowser);
88-
_ = Main.ReloadAllBookmarks();
88+
_ = Main.ReloadAllBookmarksAsync();
8989
}
9090
}
9191

@@ -117,7 +117,7 @@ private void EditSelectedCustomBrowser()
117117
var result = window.ShowDialog() ?? false;
118118
if (result)
119119
{
120-
_ = Main.ReloadAllBookmarks();
120+
_ = Main.ReloadAllBookmarksAsync();
121121
}
122122
}
123123
}

0 commit comments

Comments
 (0)