Skip to content

Commit 30669e8

Browse files
committed
Further cleanups
1 parent 13c70a9 commit 30669e8

File tree

10 files changed

+22
-20
lines changed

10 files changed

+22
-20
lines changed

Flow.Launcher.Core/Plugin/PluginManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public static void LoadPlugins(PluginsSettings settings)
109109
/// Call initialize for all plugins
110110
/// </summary>
111111
/// <returns>return the list of failed to init plugins or null for none</returns>
112-
public static async Task InitializePlugins(IPublicAPI api)
112+
public static async Task InitializePluginsAsync(IPublicAPI api)
113113
{
114114
API = api;
115115
var failedPlugins = new ConcurrentQueue<PluginPair>();

Flow.Launcher.Test/Plugins/ExplorerTest.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using Flow.Launcher.Plugin;
1+
using Flow.Launcher.Plugin;
22
using Flow.Launcher.Plugin.Explorer;
33
using Flow.Launcher.Plugin.Explorer.Search;
44
using Flow.Launcher.Plugin.Explorer.Search.DirectoryInfo;
@@ -19,10 +19,12 @@ namespace Flow.Launcher.Test.Plugins
1919
[TestFixture]
2020
public class ExplorerTest
2121
{
22+
#pragma warning disable CS1998 // async method with no await (more readable to leave it async to match the tested signature)
2223
private async Task<List<Result>> MethodWindowsIndexSearchReturnsZeroResultsAsync(Query dummyQuery, string dummyString, CancellationToken dummyToken)
2324
{
2425
return new List<Result>();
2526
}
27+
#pragma warning restore CS1998
2628

2729
private List<Result> MethodDirectoryInfoClassSearchReturnsTwoResults(Query dummyQuery, string dummyString, CancellationToken token)
2830
{
@@ -151,7 +153,7 @@ public void GivenWindowsIndexSearch_WhenSearchAllFoldersAndFiles_ThenQueryShould
151153
}
152154

153155
[TestCase]
154-
public async Task GivenTopLevelDirectorySearch_WhenIndexSearchNotRequired_ThenSearchMethodShouldContinueDirectoryInfoClassSearch()
156+
public async Task GivenTopLevelDirectorySearch_WhenIndexSearchNotRequired_ThenSearchMethodShouldContinueDirectoryInfoClassSearchAsync()
155157
{
156158
// Given
157159
var searchManager = new SearchManager(new Settings(), new PluginInitContext());
@@ -172,7 +174,7 @@ public async Task GivenTopLevelDirectorySearch_WhenIndexSearchNotRequired_ThenSe
172174
}
173175

174176
[TestCase]
175-
public async Task GivenTopLevelDirectorySearch_WhenIndexSearchNotRequired_ThenSearchMethodShouldNotContinueDirectoryInfoClassSearch()
177+
public async Task GivenTopLevelDirectorySearch_WhenIndexSearchNotRequired_ThenSearchMethodShouldNotContinueDirectoryInfoClassSearchAsync()
176178
{
177179
// Given
178180
var searchManager = new SearchManager(new Settings(), new PluginInitContext());

Flow.Launcher/App.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ await Stopwatch.NormalAsync("|App.OnStartup|Startup cost", async () =>
7474
Http.API = API;
7575
Http.Proxy = _settings.Proxy;
7676

77-
await PluginManager.InitializePlugins(API);
77+
await PluginManager.InitializePluginsAsync(API);
7878
var window = new MainWindow(_settings, _mainVM);
7979

8080
Log.Info($"|App.OnStartup|Dependencies Info:{ErrorReporting.DependenciesInfo()}");

Flow.Launcher/CustomQueryHotkeySetting.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public void UpdateItem(CustomPluginHotkey item)
8181
}
8282

8383
tbAction.Text = updateCustomHotkey.ActionKeyword;
84-
_ = ctlHotkey.SetHotkey(updateCustomHotkey.Hotkey, false);
84+
_ = ctlHotkey.SetHotkeyAsync(updateCustomHotkey.Hotkey, false);
8585
update = true;
8686
lblAdd.Text = InternationalizationManager.Instance.GetTranslation("update");
8787
}

Flow.Launcher/HotkeyControl.xaml.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,11 @@ private void TbHotkey_OnPreviewKeyDown(object sender, KeyEventArgs e)
6565
{
6666
await Task.Delay(500, token);
6767
if (!token.IsCancellationRequested)
68-
await SetHotkey(hotkeyModel);
68+
await SetHotkeyAsync(hotkeyModel);
6969
});
7070
}
7171

72-
public async Task SetHotkey(HotkeyModel keyModel, bool triggerValidate = true)
72+
public async Task SetHotkeyAsync(HotkeyModel keyModel, bool triggerValidate = true)
7373
{
7474
CurrentHotkey = keyModel;
7575

@@ -101,9 +101,9 @@ public async Task SetHotkey(HotkeyModel keyModel, bool triggerValidate = true)
101101
}
102102
}
103103

104-
public async Task SetHotkey(string keyStr, bool triggerValidate = true)
104+
public async Task SetHotkeyAsync(string keyStr, bool triggerValidate = true)
105105
{
106-
_ = SetHotkey(new HotkeyModel(keyStr), triggerValidate);
106+
await SetHotkeyAsync(new HotkeyModel(keyStr), triggerValidate);
107107
}
108108

109109
private bool CheckHotkeyAvailability() => HotKeyMapper.CheckAvailability(CurrentHotkey);

Flow.Launcher/Resources/Pages/WelcomePage2.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ protected override void OnNavigatedTo(NavigationEventArgs e)
2727
tbMsgTextOriginal = HotkeyControl.tbMsg.Text;
2828
tbMsgForegroundColorOriginal = HotkeyControl.tbMsg.Foreground;
2929

30-
HotkeyControl.SetHotkey(new Infrastructure.Hotkey.HotkeyModel(Settings.Hotkey), false);
30+
HotkeyControl.SetHotkeyAsync(new Infrastructure.Hotkey.HotkeyModel(Settings.Hotkey), false);
3131
}
3232
private void HotkeyControl_OnGotFocus(object sender, RoutedEventArgs args)
3333
{

Flow.Launcher/SettingWindow.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ private void OnSelectDefaultBrowserClick(object sender, RoutedEventArgs e)
101101

102102
private void OnHotkeyControlLoaded(object sender, RoutedEventArgs e)
103103
{
104-
_ = HotkeyControl.SetHotkey(viewModel.Settings.Hotkey, false);
104+
_ = HotkeyControl.SetHotkeyAsync(viewModel.Settings.Hotkey, false);
105105
}
106106

107107
private void OnHotkeyControlFocused(object sender, RoutedEventArgs e)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public async Task<List<Result>> QueryAsync(Query query, CancellationToken token)
5555
//search could be url, no need ToLower() when passed in
5656
Settings.InstallCommand => await pluginManager.RequestInstallOrUpdate(query.SecondToEndSearch, token),
5757
Settings.UninstallCommand => pluginManager.RequestUninstall(query.SecondToEndSearch),
58-
Settings.UpdateCommand => await pluginManager.RequestUpdate(query.SecondToEndSearch, token),
58+
Settings.UpdateCommand => await pluginManager.RequestUpdateAsync(query.SecondToEndSearch, token),
5959
_ => pluginManager.GetDefaultHotKeys().Where(hotkey =>
6060
{
6161
hotkey.Score = StringMatcher.FuzzySearch(query.Search, hotkey.Title).Score;

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using Flow.Launcher.Core.ExternalPlugins;
1+
using Flow.Launcher.Core.ExternalPlugins;
22
using Flow.Launcher.Core.Plugin;
33
using Flow.Launcher.Infrastructure;
44
using Flow.Launcher.Infrastructure.Http;
@@ -109,7 +109,7 @@ internal List<Result> GetDefaultHotKeys()
109109
};
110110
}
111111

112-
internal async Task InstallOrUpdate(UserPlugin plugin)
112+
internal async Task InstallOrUpdateAsync(UserPlugin plugin)
113113
{
114114
if (PluginExists(plugin.ID))
115115
{
@@ -182,7 +182,7 @@ internal async Task InstallOrUpdate(UserPlugin plugin)
182182
Context.API.RestartApp();
183183
}
184184

185-
internal async ValueTask<List<Result>> RequestUpdate(string search, CancellationToken token)
185+
internal async ValueTask<List<Result>> RequestUpdateAsync(string search, CancellationToken token)
186186
{
187187
await UpdateManifestAsync(token);
188188

@@ -336,7 +336,7 @@ internal List<Result> InstallFromWeb(string url)
336336
}
337337

338338
Application.Current.MainWindow.Hide();
339-
_ = InstallOrUpdate(plugin);
339+
_ = InstallOrUpdateAsync(plugin);
340340

341341
return ShouldHideWindow;
342342
}
@@ -383,7 +383,7 @@ internal async ValueTask<List<Result>> RequestInstallOrUpdate(string search, Can
383383
}
384384

385385
Application.Current.MainWindow.Hide();
386-
_ = InstallOrUpdate(x); // No need to wait
386+
_ = InstallOrUpdateAsync(x); // No need to wait
387387
return ShouldHideWindow;
388388
},
389389
ContextData = x
@@ -502,4 +502,4 @@ private bool SameOrLesserPluginVersionExists(string metadataPath)
502502
&& newMetadata.Version.CompareTo(x.Metadata.Version) <= 0);
503503
}
504504
}
505-
}
505+
}

Plugins/Flow.Launcher.Plugin.Program/Programs/UWP.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ await Task.Run(() =>
407407
});
408408
}
409409

410-
private async void LaunchElevated()
410+
private void LaunchElevated()
411411
{
412412
string command = "shell:AppsFolder\\" + UniqueIdentifier;
413413
command = Environment.ExpandEnvironmentVariables(command.Trim());

0 commit comments

Comments
 (0)