Skip to content

Commit 8e8bf1f

Browse files
authored
Merge branch 'dev' into quickswitch
2 parents aa06ab5 + b924a79 commit 8e8bf1f

File tree

4 files changed

+40
-27
lines changed

4 files changed

+40
-27
lines changed

.github/workflows/dotnet.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616

1717
runs-on: windows-latest
1818
env:
19-
FlowVersion: 1.19.5
19+
FlowVersion: 1.20.2
2020
NUGET_CERT_REVOCATION_MODE: offline
2121
BUILD_NUMBER: ${{ github.run_number }}
2222
steps:

Flow.Launcher.Core/Flow.Launcher.Core.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
<PackageReference Include="FSharp.Core" Version="9.0.201" />
5858
<PackageReference Include="Meziantou.Framework.Win32.Jobs" Version="3.4.0" />
5959
<PackageReference Include="Microsoft.IO.RecyclableMemoryStream" Version="3.0.1" />
60+
<PackageReference Include="SemanticVersioning" Version="3.0.0" />
6061
<PackageReference Include="squirrel.windows" Version="1.5.2" NoWarn="NU1701" />
6162
<PackageReference Include="StreamJsonRpc" Version="2.21.10" />
6263
</ItemGroup>

Flow.Launcher.Core/Updater.cs

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,9 @@ public async Task UpdateAppAsync(bool silentUpdate = true)
4949
// UpdateApp CheckForUpdate will return value only if the app is squirrel installed
5050
var newUpdateInfo = await updateManager.CheckForUpdate().NonNull().ConfigureAwait(false);
5151

52-
var newReleaseVersion = Version.Parse(newUpdateInfo.FutureReleaseEntry.Version.ToString());
53-
var currentVersion = Version.Parse(Constant.Version);
52+
var newReleaseVersion =
53+
SemanticVersioning.Version.Parse(newUpdateInfo.FutureReleaseEntry.Version.ToString());
54+
var currentVersion = SemanticVersioning.Version.Parse(Constant.Version);
5455

5556
_api.LogInfo(ClassName, $"Future Release <{Formatted(newUpdateInfo.FutureReleaseEntry)}>");
5657

@@ -71,10 +72,13 @@ public async Task UpdateAppAsync(bool silentUpdate = true)
7172

7273
if (DataLocation.PortableDataLocationInUse())
7374
{
74-
var targetDestination = updateManager.RootAppDirectory + $"\\app-{newReleaseVersion}\\{DataLocation.PortableFolderName}";
75+
var targetDestination = updateManager.RootAppDirectory +
76+
$"\\app-{newReleaseVersion}\\{DataLocation.PortableFolderName}";
7577
FilesFolders.CopyAll(DataLocation.PortableDataPath, targetDestination, (s) => _api.ShowMsgBox(s));
76-
if (!FilesFolders.VerifyBothFolderFilesEqual(DataLocation.PortableDataPath, targetDestination, (s) => _api.ShowMsgBox(s)))
77-
_api.ShowMsgBox(string.Format(_api.GetTranslation("update_flowlauncher_fail_moving_portable_user_profile_data"),
78+
if (!FilesFolders.VerifyBothFolderFilesEqual(DataLocation.PortableDataPath, targetDestination,
79+
(s) => _api.ShowMsgBox(s)))
80+
_api.ShowMsgBox(string.Format(
81+
_api.GetTranslation("update_flowlauncher_fail_moving_portable_user_profile_data"),
7882
DataLocation.PortableDataPath,
7983
targetDestination));
8084
}
@@ -87,22 +91,25 @@ public async Task UpdateAppAsync(bool silentUpdate = true)
8791

8892
_api.LogInfo(ClassName, $"Update success:{newVersionTips}");
8993

90-
if (_api.ShowMsgBox(newVersionTips, _api.GetTranslation("update_flowlauncher_new_update"), MessageBoxButton.YesNo) == MessageBoxResult.Yes)
94+
if (_api.ShowMsgBox(newVersionTips, _api.GetTranslation("update_flowlauncher_new_update"),
95+
MessageBoxButton.YesNo) == MessageBoxResult.Yes)
9196
{
9297
UpdateManager.RestartApp(Constant.ApplicationFileName);
9398
}
9499
}
95100
catch (Exception e)
96101
{
97-
if (e is HttpRequestException or WebException or SocketException || e.InnerException is TimeoutException)
102+
if (e is HttpRequestException or WebException or SocketException ||
103+
e.InnerException is TimeoutException)
98104
{
99-
_api.LogException(ClassName, $"Check your connection and proxy settings to github-cloud.s3.amazonaws.com.", e);
105+
_api.LogException(ClassName,
106+
$"Check your connection and proxy settings to github-cloud.s3.amazonaws.com.", e);
100107
}
101108
else
102109
{
103110
_api.LogException(ClassName, $"Error Occurred", e);
104111
}
105-
112+
106113
if (!silentUpdate)
107114
_api.ShowMsg(_api.GetTranslation("update_flowlauncher_fail"),
108115
_api.GetTranslation("update_flowlauncher_check_connection"));
@@ -116,14 +123,11 @@ public async Task UpdateAppAsync(bool silentUpdate = true)
116123
[UsedImplicitly]
117124
private class GithubRelease
118125
{
119-
[JsonPropertyName("prerelease")]
120-
public bool Prerelease { get; [UsedImplicitly] set; }
126+
[JsonPropertyName("prerelease")] public bool Prerelease { get; [UsedImplicitly] set; }
121127

122-
[JsonPropertyName("published_at")]
123-
public DateTime PublishedAt { get; [UsedImplicitly] set; }
128+
[JsonPropertyName("published_at")] public DateTime PublishedAt { get; [UsedImplicitly] set; }
124129

125-
[JsonPropertyName("html_url")]
126-
public string HtmlUrl { get; [UsedImplicitly] set; }
130+
[JsonPropertyName("html_url")] public string HtmlUrl { get; [UsedImplicitly] set; }
127131
}
128132

129133
// https://github.com/Squirrel/Squirrel.Windows/blob/master/src/Squirrel/UpdateManager.Factory.cs
@@ -138,10 +142,7 @@ private static async Task<UpdateManager> GitHubUpdateManagerAsync(string reposit
138142
var latest = releases.Where(r => !r.Prerelease).OrderByDescending(r => r.PublishedAt).First();
139143
var latestUrl = latest.HtmlUrl.Replace("/tag/", "/download/");
140144

141-
var client = new WebClient
142-
{
143-
Proxy = Http.WebProxy
144-
};
145+
var client = new WebClient { Proxy = Http.WebProxy };
145146
var downloader = new FileDownloader(client);
146147

147148
var manager = new UpdateManager(latestUrl, urlDownloader: downloader);
@@ -158,10 +159,7 @@ private string NewVersionTips(string version)
158159

159160
private static string Formatted<T>(T t)
160161
{
161-
var formatted = JsonSerializer.Serialize(t, new JsonSerializerOptions
162-
{
163-
WriteIndented = true
164-
});
162+
var formatted = JsonSerializer.Serialize(t, new JsonSerializerOptions { WriteIndented = true });
165163

166164
return formatted;
167165
}

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

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,19 @@ public List<Result> Query(Query query)
7070
return _themeSelector.Query(query);
7171
}
7272

73-
var commands = Commands();
73+
var commands = Commands(query);
7474
var results = new List<Result>();
75+
var isEmptyQuery = string.IsNullOrWhiteSpace(query.Search);
7576
foreach (var c in commands)
7677
{
7778
var command = _settings.Commands.First(x => x.Key == c.Title);
7879
c.Title = command.Name;
7980
c.SubTitle = command.Description;
81+
if (isEmptyQuery)
82+
{
83+
results.Add(c);
84+
continue;
85+
}
8086

8187
// Match from localized title & localized subtitle & keyword
8288
var titleMatch = _context.API.FuzzySearch(query.Search, c.Title);
@@ -188,7 +194,7 @@ private static unsafe bool EnableShutdownPrivilege()
188194
}
189195
}
190196

191-
private List<Result> Commands()
197+
private List<Result> Commands(Query query)
192198
{
193199
var results = new List<Result>();
194200
var recycleBinFolder = "shell:RecycleBinFolder";
@@ -491,7 +497,15 @@ private List<Result> Commands()
491497
Glyph = new GlyphInfo (FontFamily:"/Resources/#Segoe Fluent Icons", Glyph:"\ue790"),
492498
Action = c =>
493499
{
494-
_context.API.ChangeQuery($"{ThemeSelector.Keyword} ");
500+
if (string.IsNullOrEmpty(query.ActionKeyword))
501+
{
502+
_context.API.ChangeQuery($"{ThemeSelector.Keyword}{Plugin.Query.ActionKeywordSeparator}");
503+
}
504+
else
505+
{
506+
_context.API.ChangeQuery($"{query.ActionKeyword}{Plugin.Query.ActionKeywordSeparator}{ThemeSelector.Keyword}{Plugin.Query.ActionKeywordSeparator}");
507+
508+
}
495509
return false;
496510
}
497511
}

0 commit comments

Comments
 (0)