mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Further cleanups
This commit is contained in:
parent
13c70a9bb7
commit
30669e8c25
10 changed files with 22 additions and 20 deletions
|
|
@ -109,7 +109,7 @@ namespace Flow.Launcher.Core.Plugin
|
|||
/// Call initialize for all plugins
|
||||
/// </summary>
|
||||
/// <returns>return the list of failed to init plugins or null for none</returns>
|
||||
public static async Task InitializePlugins(IPublicAPI api)
|
||||
public static async Task InitializePluginsAsync(IPublicAPI api)
|
||||
{
|
||||
API = api;
|
||||
var failedPlugins = new ConcurrentQueue<PluginPair>();
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using Flow.Launcher.Plugin;
|
||||
using Flow.Launcher.Plugin;
|
||||
using Flow.Launcher.Plugin.Explorer;
|
||||
using Flow.Launcher.Plugin.Explorer.Search;
|
||||
using Flow.Launcher.Plugin.Explorer.Search.DirectoryInfo;
|
||||
|
|
@ -19,10 +19,12 @@ namespace Flow.Launcher.Test.Plugins
|
|||
[TestFixture]
|
||||
public class ExplorerTest
|
||||
{
|
||||
#pragma warning disable CS1998 // async method with no await (more readable to leave it async to match the tested signature)
|
||||
private async Task<List<Result>> MethodWindowsIndexSearchReturnsZeroResultsAsync(Query dummyQuery, string dummyString, CancellationToken dummyToken)
|
||||
{
|
||||
return new List<Result>();
|
||||
}
|
||||
#pragma warning restore CS1998
|
||||
|
||||
private List<Result> MethodDirectoryInfoClassSearchReturnsTwoResults(Query dummyQuery, string dummyString, CancellationToken token)
|
||||
{
|
||||
|
|
@ -151,7 +153,7 @@ namespace Flow.Launcher.Test.Plugins
|
|||
}
|
||||
|
||||
[TestCase]
|
||||
public async Task GivenTopLevelDirectorySearch_WhenIndexSearchNotRequired_ThenSearchMethodShouldContinueDirectoryInfoClassSearch()
|
||||
public async Task GivenTopLevelDirectorySearch_WhenIndexSearchNotRequired_ThenSearchMethodShouldContinueDirectoryInfoClassSearchAsync()
|
||||
{
|
||||
// Given
|
||||
var searchManager = new SearchManager(new Settings(), new PluginInitContext());
|
||||
|
|
@ -172,7 +174,7 @@ namespace Flow.Launcher.Test.Plugins
|
|||
}
|
||||
|
||||
[TestCase]
|
||||
public async Task GivenTopLevelDirectorySearch_WhenIndexSearchNotRequired_ThenSearchMethodShouldNotContinueDirectoryInfoClassSearch()
|
||||
public async Task GivenTopLevelDirectorySearch_WhenIndexSearchNotRequired_ThenSearchMethodShouldNotContinueDirectoryInfoClassSearchAsync()
|
||||
{
|
||||
// Given
|
||||
var searchManager = new SearchManager(new Settings(), new PluginInitContext());
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ namespace Flow.Launcher
|
|||
Http.API = API;
|
||||
Http.Proxy = _settings.Proxy;
|
||||
|
||||
await PluginManager.InitializePlugins(API);
|
||||
await PluginManager.InitializePluginsAsync(API);
|
||||
var window = new MainWindow(_settings, _mainVM);
|
||||
|
||||
Log.Info($"|App.OnStartup|Dependencies Info:{ErrorReporting.DependenciesInfo()}");
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ namespace Flow.Launcher
|
|||
}
|
||||
|
||||
tbAction.Text = updateCustomHotkey.ActionKeyword;
|
||||
_ = ctlHotkey.SetHotkey(updateCustomHotkey.Hotkey, false);
|
||||
_ = ctlHotkey.SetHotkeyAsync(updateCustomHotkey.Hotkey, false);
|
||||
update = true;
|
||||
lblAdd.Text = InternationalizationManager.Instance.GetTranslation("update");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,11 +65,11 @@ namespace Flow.Launcher
|
|||
{
|
||||
await Task.Delay(500, token);
|
||||
if (!token.IsCancellationRequested)
|
||||
await SetHotkey(hotkeyModel);
|
||||
await SetHotkeyAsync(hotkeyModel);
|
||||
});
|
||||
}
|
||||
|
||||
public async Task SetHotkey(HotkeyModel keyModel, bool triggerValidate = true)
|
||||
public async Task SetHotkeyAsync(HotkeyModel keyModel, bool triggerValidate = true)
|
||||
{
|
||||
CurrentHotkey = keyModel;
|
||||
|
||||
|
|
@ -101,9 +101,9 @@ namespace Flow.Launcher
|
|||
}
|
||||
}
|
||||
|
||||
public async Task SetHotkey(string keyStr, bool triggerValidate = true)
|
||||
public async Task SetHotkeyAsync(string keyStr, bool triggerValidate = true)
|
||||
{
|
||||
_ = SetHotkey(new HotkeyModel(keyStr), triggerValidate);
|
||||
await SetHotkeyAsync(new HotkeyModel(keyStr), triggerValidate);
|
||||
}
|
||||
|
||||
private bool CheckHotkeyAvailability() => HotKeyMapper.CheckAvailability(CurrentHotkey);
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ namespace Flow.Launcher.Resources.Pages
|
|||
tbMsgTextOriginal = HotkeyControl.tbMsg.Text;
|
||||
tbMsgForegroundColorOriginal = HotkeyControl.tbMsg.Foreground;
|
||||
|
||||
HotkeyControl.SetHotkey(new Infrastructure.Hotkey.HotkeyModel(Settings.Hotkey), false);
|
||||
HotkeyControl.SetHotkeyAsync(new Infrastructure.Hotkey.HotkeyModel(Settings.Hotkey), false);
|
||||
}
|
||||
private void HotkeyControl_OnGotFocus(object sender, RoutedEventArgs args)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ namespace Flow.Launcher
|
|||
|
||||
private void OnHotkeyControlLoaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
_ = HotkeyControl.SetHotkey(viewModel.Settings.Hotkey, false);
|
||||
_ = HotkeyControl.SetHotkeyAsync(viewModel.Settings.Hotkey, false);
|
||||
}
|
||||
|
||||
private void OnHotkeyControlFocused(object sender, RoutedEventArgs e)
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ namespace Flow.Launcher.Plugin.PluginsManager
|
|||
//search could be url, no need ToLower() when passed in
|
||||
Settings.InstallCommand => await pluginManager.RequestInstallOrUpdate(query.SecondToEndSearch, token),
|
||||
Settings.UninstallCommand => pluginManager.RequestUninstall(query.SecondToEndSearch),
|
||||
Settings.UpdateCommand => await pluginManager.RequestUpdate(query.SecondToEndSearch, token),
|
||||
Settings.UpdateCommand => await pluginManager.RequestUpdateAsync(query.SecondToEndSearch, token),
|
||||
_ => pluginManager.GetDefaultHotKeys().Where(hotkey =>
|
||||
{
|
||||
hotkey.Score = StringMatcher.FuzzySearch(query.Search, hotkey.Title).Score;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using Flow.Launcher.Core.ExternalPlugins;
|
||||
using Flow.Launcher.Core.ExternalPlugins;
|
||||
using Flow.Launcher.Core.Plugin;
|
||||
using Flow.Launcher.Infrastructure;
|
||||
using Flow.Launcher.Infrastructure.Http;
|
||||
|
|
@ -109,7 +109,7 @@ namespace Flow.Launcher.Plugin.PluginsManager
|
|||
};
|
||||
}
|
||||
|
||||
internal async Task InstallOrUpdate(UserPlugin plugin)
|
||||
internal async Task InstallOrUpdateAsync(UserPlugin plugin)
|
||||
{
|
||||
if (PluginExists(plugin.ID))
|
||||
{
|
||||
|
|
@ -182,7 +182,7 @@ namespace Flow.Launcher.Plugin.PluginsManager
|
|||
Context.API.RestartApp();
|
||||
}
|
||||
|
||||
internal async ValueTask<List<Result>> RequestUpdate(string search, CancellationToken token)
|
||||
internal async ValueTask<List<Result>> RequestUpdateAsync(string search, CancellationToken token)
|
||||
{
|
||||
await UpdateManifestAsync(token);
|
||||
|
||||
|
|
@ -336,7 +336,7 @@ namespace Flow.Launcher.Plugin.PluginsManager
|
|||
}
|
||||
|
||||
Application.Current.MainWindow.Hide();
|
||||
_ = InstallOrUpdate(plugin);
|
||||
_ = InstallOrUpdateAsync(plugin);
|
||||
|
||||
return ShouldHideWindow;
|
||||
}
|
||||
|
|
@ -383,7 +383,7 @@ namespace Flow.Launcher.Plugin.PluginsManager
|
|||
}
|
||||
|
||||
Application.Current.MainWindow.Hide();
|
||||
_ = InstallOrUpdate(x); // No need to wait
|
||||
_ = InstallOrUpdateAsync(x); // No need to wait
|
||||
return ShouldHideWindow;
|
||||
},
|
||||
ContextData = x
|
||||
|
|
@ -502,4 +502,4 @@ namespace Flow.Launcher.Plugin.PluginsManager
|
|||
&& newMetadata.Version.CompareTo(x.Metadata.Version) <= 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -407,7 +407,7 @@ namespace Flow.Launcher.Plugin.Program.Programs
|
|||
});
|
||||
}
|
||||
|
||||
private async void LaunchElevated()
|
||||
private void LaunchElevated()
|
||||
{
|
||||
string command = "shell:AppsFolder\\" + UniqueIdentifier;
|
||||
command = Environment.ExpandEnvironmentVariables(command.Trim());
|
||||
|
|
|
|||
Loading…
Reference in a new issue