mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Change context and settings to non static
This commit is contained in:
parent
009ee3dc5c
commit
52e72992c2
3 changed files with 9 additions and 8 deletions
|
|
@ -176,7 +176,7 @@ namespace Flow.Launcher.Test.Plugins
|
||||||
var searchManager = new SearchManager(new Settings(), new PluginInitContext());
|
var searchManager = new SearchManager(new Settings(), new PluginInitContext());
|
||||||
|
|
||||||
// When
|
// When
|
||||||
var result = SearchManager.IsFileContentSearch(query.ActionKeyword);
|
var result = searchManager.IsFileContentSearch(query.ActionKeyword);
|
||||||
|
|
||||||
// Then
|
// Then
|
||||||
Assert.IsTrue(result,
|
Assert.IsTrue(result,
|
||||||
|
|
@ -193,6 +193,7 @@ namespace Flow.Launcher.Test.Plugins
|
||||||
[TestCase(@"c:\>*", true)]
|
[TestCase(@"c:\>*", true)]
|
||||||
[TestCase(@"c:\>", true)]
|
[TestCase(@"c:\>", true)]
|
||||||
[TestCase(@"c:\SomeLocation\SomeOtherLocation\>", true)]
|
[TestCase(@"c:\SomeLocation\SomeOtherLocation\>", true)]
|
||||||
|
[TestCase(@"c:\SomeLocation\SomeOtherLocation", true)]
|
||||||
public void WhenGivenQuerySearchString_ThenShouldIndicateIfIsLocationPathString(string querySearchString, bool expectedResult)
|
public void WhenGivenQuerySearchString_ThenShouldIndicateIfIsLocationPathString(string querySearchString, bool expectedResult)
|
||||||
{
|
{
|
||||||
// When, Given
|
// When, Given
|
||||||
|
|
|
||||||
|
|
@ -13,9 +13,9 @@ namespace Flow.Launcher.Plugin.Explorer.Search
|
||||||
{
|
{
|
||||||
public class SearchManager
|
public class SearchManager
|
||||||
{
|
{
|
||||||
internal static PluginInitContext Context;
|
internal PluginInitContext Context;
|
||||||
|
|
||||||
internal static Settings Settings;
|
internal Settings Settings;
|
||||||
|
|
||||||
public SearchManager(Settings settings, PluginInitContext context)
|
public SearchManager(Settings settings, PluginInitContext context)
|
||||||
{
|
{
|
||||||
|
|
@ -144,7 +144,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List<Result> EverythingContentSearchResult(Query query)
|
private List<Result> EverythingContentSearchResult(Query query)
|
||||||
{
|
{
|
||||||
return new List<Result>()
|
return new List<Result>()
|
||||||
{
|
{
|
||||||
|
|
@ -236,7 +236,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search
|
||||||
return results.ToList();
|
return results.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool IsFileContentSearch(string actionKeyword) => actionKeyword == Settings.FileContentSearchActionKeyword;
|
public bool IsFileContentSearch(string actionKeyword) => actionKeyword == Settings.FileContentSearchActionKeyword;
|
||||||
|
|
||||||
|
|
||||||
private bool UseWindowsIndexForDirectorySearch(string locationPath)
|
private bool UseWindowsIndexForDirectorySearch(string locationPath)
|
||||||
|
|
|
||||||
|
|
@ -97,10 +97,10 @@ namespace Flow.Launcher.Plugin.Explorer.Search.WindowsIndex
|
||||||
|
|
||||||
private IAsyncEnumerable<SearchResult> HandledEngineNotAvailableExceptionAsync()
|
private IAsyncEnumerable<SearchResult> HandledEngineNotAvailableExceptionAsync()
|
||||||
{
|
{
|
||||||
if (!SearchManager.Settings.WarnWindowsSearchServiceOff)
|
if (!Settings.WarnWindowsSearchServiceOff)
|
||||||
return AsyncEnumerable.Empty<SearchResult>();
|
return AsyncEnumerable.Empty<SearchResult>();
|
||||||
|
|
||||||
var api = SearchManager.Context.API;
|
var api = Main.Context.API;
|
||||||
|
|
||||||
throw new EngineNotAvailableException(
|
throw new EngineNotAvailableException(
|
||||||
"Windows Index",
|
"Windows Index",
|
||||||
|
|
@ -108,7 +108,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search.WindowsIndex
|
||||||
api.GetTranslation("plugin_explorer_windowsSearchServiceNotRunning"),
|
api.GetTranslation("plugin_explorer_windowsSearchServiceNotRunning"),
|
||||||
c =>
|
c =>
|
||||||
{
|
{
|
||||||
SearchManager.Settings.WarnWindowsSearchServiceOff = false;
|
Settings.WarnWindowsSearchServiceOff = false;
|
||||||
|
|
||||||
// Clears the warning message so user is not mistaken that it has not worked
|
// Clears the warning message so user is not mistaken that it has not worked
|
||||||
api.ChangeQuery(string.Empty);
|
api.ChangeQuery(string.Empty);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue