Skip to content

Commit 52e7299

Browse files
Change context and settings to non static
1 parent 009ee3d commit 52e7299

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

Flow.Launcher.Test/Plugins/ExplorerTest.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ public void GivenQuery_WhenActionKeywordForFileContentSearchExists_ThenFileConte
176176
var searchManager = new SearchManager(new Settings(), new PluginInitContext());
177177

178178
// When
179-
var result = SearchManager.IsFileContentSearch(query.ActionKeyword);
179+
var result = searchManager.IsFileContentSearch(query.ActionKeyword);
180180

181181
// Then
182182
Assert.IsTrue(result,
@@ -193,6 +193,7 @@ public void GivenQuery_WhenActionKeywordForFileContentSearchExists_ThenFileConte
193193
[TestCase(@"c:\>*", true)]
194194
[TestCase(@"c:\>", true)]
195195
[TestCase(@"c:\SomeLocation\SomeOtherLocation\>", true)]
196+
[TestCase(@"c:\SomeLocation\SomeOtherLocation", true)]
196197
public void WhenGivenQuerySearchString_ThenShouldIndicateIfIsLocationPathString(string querySearchString, bool expectedResult)
197198
{
198199
// When, Given

Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ namespace Flow.Launcher.Plugin.Explorer.Search
1313
{
1414
public class SearchManager
1515
{
16-
internal static PluginInitContext Context;
16+
internal PluginInitContext Context;
1717

18-
internal static Settings Settings;
18+
internal Settings Settings;
1919

2020
public SearchManager(Settings settings, PluginInitContext context)
2121
{
@@ -144,7 +144,7 @@ private bool ActionKeywordMatch(Query query, Settings.ActionKeyword allowedActio
144144
};
145145
}
146146

147-
private static List<Result> EverythingContentSearchResult(Query query)
147+
private List<Result> EverythingContentSearchResult(Query query)
148148
{
149149
return new List<Result>()
150150
{
@@ -236,7 +236,7 @@ private async Task<List<Result>> PathSearchAsync(Query query, CancellationToken
236236
return results.ToList();
237237
}
238238

239-
public static bool IsFileContentSearch(string actionKeyword) => actionKeyword == Settings.FileContentSearchActionKeyword;
239+
public bool IsFileContentSearch(string actionKeyword) => actionKeyword == Settings.FileContentSearchActionKeyword;
240240

241241

242242
private bool UseWindowsIndexForDirectorySearch(string locationPath)

Plugins/Flow.Launcher.Plugin.Explorer/Search/WindowsIndex/WindowsIndexSearchManager.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,18 +97,18 @@ public IAsyncEnumerable<SearchResult> EnumerateAsync(string path, string search,
9797

9898
private IAsyncEnumerable<SearchResult> HandledEngineNotAvailableExceptionAsync()
9999
{
100-
if (!SearchManager.Settings.WarnWindowsSearchServiceOff)
100+
if (!Settings.WarnWindowsSearchServiceOff)
101101
return AsyncEnumerable.Empty<SearchResult>();
102102

103-
var api = SearchManager.Context.API;
103+
var api = Main.Context.API;
104104

105105
throw new EngineNotAvailableException(
106106
"Windows Index",
107107
api.GetTranslation("plugin_explorer_windowsSearchServiceFix"),
108108
api.GetTranslation("plugin_explorer_windowsSearchServiceNotRunning"),
109109
c =>
110110
{
111-
SearchManager.Settings.WarnWindowsSearchServiceOff = false;
111+
Settings.WarnWindowsSearchServiceOff = false;
112112

113113
// Clears the warning message so user is not mistaken that it has not worked
114114
api.ChangeQuery(string.Empty);

0 commit comments

Comments
 (0)