Skip to content

Commit 1ce3150

Browse files
committed
Merge remote-tracking branch 'upstream/dev' into PluginStore
2 parents e784ea6 + 13917d1 commit 1ce3150

29 files changed

+494
-342
lines changed

Flow.Launcher.Core/Updater.cs

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
using Flow.Launcher.Infrastructure.UserSettings;
1717
using Flow.Launcher.Plugin;
1818
using System.Text.Json.Serialization;
19+
using System.Threading;
1920

2021
namespace Flow.Launcher.Core
2122
{
@@ -28,21 +29,21 @@ public Updater(string gitHubRepository)
2829
GitHubRepository = gitHubRepository;
2930
}
3031

31-
public async Task UpdateApp(IPublicAPI api, bool silentUpdate = true)
32+
private SemaphoreSlim UpdateLock { get; } = new SemaphoreSlim(1);
33+
34+
public async Task UpdateAppAsync(IPublicAPI api, bool silentUpdate = true)
3235
{
36+
await UpdateLock.WaitAsync();
3337
try
3438
{
35-
UpdateInfo newUpdateInfo;
36-
3739
if (!silentUpdate)
3840
api.ShowMsg(api.GetTranslation("pleaseWait"),
39-
api.GetTranslation("update_flowlauncher_update_check"));
41+
api.GetTranslation("update_flowlauncher_update_check"));
4042

4143
using var updateManager = await GitHubUpdateManager(GitHubRepository).ConfigureAwait(false);
4244

43-
4445
// UpdateApp CheckForUpdate will return value only if the app is squirrel installed
45-
newUpdateInfo = await updateManager.CheckForUpdate().NonNull().ConfigureAwait(false);
46+
var newUpdateInfo = await updateManager.CheckForUpdate().NonNull().ConfigureAwait(false);
4647

4748
var newReleaseVersion = Version.Parse(newUpdateInfo.FutureReleaseEntry.Version.ToString());
4849
var currentVersion = Version.Parse(Constant.Version);
@@ -58,7 +59,7 @@ public async Task UpdateApp(IPublicAPI api, bool silentUpdate = true)
5859

5960
if (!silentUpdate)
6061
api.ShowMsg(api.GetTranslation("update_flowlauncher_update_found"),
61-
api.GetTranslation("update_flowlauncher_updating"));
62+
api.GetTranslation("update_flowlauncher_updating"));
6263

6364
await updateManager.DownloadReleases(newUpdateInfo.ReleasesToApply).ConfigureAwait(false);
6465

@@ -70,8 +71,8 @@ public async Task UpdateApp(IPublicAPI api, bool silentUpdate = true)
7071
FilesFolders.CopyAll(DataLocation.PortableDataPath, targetDestination);
7172
if (!FilesFolders.VerifyBothFolderFilesEqual(DataLocation.PortableDataPath, targetDestination))
7273
MessageBox.Show(string.Format(api.GetTranslation("update_flowlauncher_fail_moving_portable_user_profile_data"),
73-
DataLocation.PortableDataPath,
74-
targetDestination));
74+
DataLocation.PortableDataPath,
75+
targetDestination));
7576
}
7677
else
7778
{
@@ -87,12 +88,15 @@ public async Task UpdateApp(IPublicAPI api, bool silentUpdate = true)
8788
UpdateManager.RestartApp(Constant.ApplicationFileName);
8889
}
8990
}
90-
catch (Exception e) when (e is HttpRequestException || e is WebException || e is SocketException || e.InnerException is TimeoutException)
91+
catch (Exception e) when (e is HttpRequestException or WebException or SocketException || e.InnerException is TimeoutException)
9192
{
9293
Log.Exception($"|Updater.UpdateApp|Check your connection and proxy settings to github-cloud.s3.amazonaws.com.", e);
9394
api.ShowMsg(api.GetTranslation("update_flowlauncher_fail"),
94-
api.GetTranslation("update_flowlauncher_check_connection"));
95-
return;
95+
api.GetTranslation("update_flowlauncher_check_connection"));
96+
}
97+
finally
98+
{
99+
UpdateLock.Release();
96100
}
97101
}
98102

@@ -115,13 +119,16 @@ private async Task<UpdateManager> GitHubUpdateManager(string repository)
115119
var uri = new Uri(repository);
116120
var api = $"https://api.github.com/repos{uri.AbsolutePath}/releases";
117121

118-
var jsonStream = await Http.GetStreamAsync(api).ConfigureAwait(false);
122+
await using var jsonStream = await Http.GetStreamAsync(api).ConfigureAwait(false);
119123

120124
var releases = await System.Text.Json.JsonSerializer.DeserializeAsync<List<GithubRelease>>(jsonStream).ConfigureAwait(false);
121125
var latest = releases.Where(r => !r.Prerelease).OrderByDescending(r => r.PublishedAt).First();
122126
var latestUrl = latest.HtmlUrl.Replace("/tag/", "/download/");
123-
124-
var client = new WebClient { Proxy = Http.WebProxy };
127+
128+
var client = new WebClient
129+
{
130+
Proxy = Http.WebProxy
131+
};
125132
var downloader = new FileDownloader(client);
126133

127134
var manager = new UpdateManager(latestUrl, urlDownloader: downloader);

Flow.Launcher/App.xaml.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,12 +129,12 @@ private void AutoUpdates()
129129
var timer = new Timer(1000 * 60 * 60 * 5);
130130
timer.Elapsed += async (s, e) =>
131131
{
132-
await _updater.UpdateApp(API);
132+
await _updater.UpdateAppAsync(API);
133133
};
134134
timer.Start();
135135

136136
// check updates on startup
137-
await _updater.UpdateApp(API);
137+
await _updater.UpdateAppAsync(API);
138138
}
139139
});
140140
}

Flow.Launcher/Converters/OpenResultHotkeyVisibilityConverter.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,10 @@ public class OpenResultHotkeyVisibilityConverter : IValueConverter
1616
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
1717
{
1818
var hotkeyNumber = int.MaxValue;
19-
20-
if (value is ListBoxItem listBoxItem)
21-
{
22-
ListBox listBox = ItemsControl.ItemsControlFromItemContainer(listBoxItem) as ListBox;
19+
20+
if (value is ListBoxItem listBoxItem
21+
&& ItemsControl.ItemsControlFromItemContainer(listBoxItem) is ListBox listBox)
2322
hotkeyNumber = listBox.ItemContainerGenerator.IndexFromContainer(listBoxItem) + 1;
24-
}
2523

2624
return hotkeyNumber <= MaxVisibleHotkeys ? Visibility.Visible : Visibility.Collapsed;
2725
}

Flow.Launcher/Converters/OrdinalConverter.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,9 @@ public class OrdinalConverter : IValueConverter
88
{
99
public object Convert(object value, System.Type targetType, object parameter, CultureInfo culture)
1010
{
11-
if (value is ListBoxItem listBoxItem)
12-
{
13-
ListBox listBox = ItemsControl.ItemsControlFromItemContainer(listBoxItem) as ListBox;
11+
if (value is ListBoxItem listBoxItem
12+
&& ItemsControl.ItemsControlFromItemContainer(listBoxItem) is ListBox listBox)
1413
return listBox.ItemContainerGenerator.IndexFromContainer(listBoxItem) + 1;
15-
}
1614

1715
return 0;
1816
}

Flow.Launcher/Languages/sk.xaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@
8282
<system:String x:Key="deleteCustomHotkeyWarning">Ste si istý, že chcete odstrániť klávesovú skratku {0} pre plugin?</system:String>
8383
<system:String x:Key="queryWindowShadowEffect">Tieňový efekt v poli vyhľadávania</system:String>
8484
<system:String x:Key="shadowEffectCPUUsage">Tieňový efekt významne využíva GPU. Neodporúča sa, ak je výkon počítača obmedzený.</system:String>
85+
<system:String x:Key="useGlyphUI">Použiť ikony Segoe Fluent</system:String>
86+
<system:String x:Key="useGlyphUIEffect">Použiť ikony Segoe Fluent, ak sú podporované</system:String>
8587

8688
<!--Setting Proxy-->
8789
<system:String x:Key="proxy">HTTP Proxy</system:String>
@@ -178,4 +180,4 @@
178180
<system:String x:Key="update_flowlauncher_update_files">Aktualizovať súbory</system:String>
179181
<system:String x:Key="update_flowlauncher_update_upadte_description">Aktualizovať popis</system:String>
180182

181-
</ResourceDictionary>
183+
</ResourceDictionary>

Flow.Launcher/ViewModel/SettingWindowViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public SettingWindowViewModel(Updater updater, IPortable portable)
4747

4848
public async void UpdateApp()
4949
{
50-
await _updater.UpdateApp(App.API, false);
50+
await _updater.UpdateAppAsync(App.API, false);
5151
}
5252

5353
public bool AutoUpdates

Plugins/Flow.Launcher.Plugin.BrowserBookmark/Bookmark.cs

Lines changed: 0 additions & 56 deletions
This file was deleted.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
using Flow.Launcher.Plugin.BrowserBookmark.Models;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.IO;
5+
using System.Linq;
6+
using System.Text.RegularExpressions;
7+
8+
namespace Flow.Launcher.Plugin.BrowserBookmark
9+
{
10+
public class ChromeBookmarkLoader : ChromiumBookmarkLoader
11+
{
12+
public override List<Bookmark> GetBookmarks()
13+
{
14+
return LoadChromeBookmarks();
15+
}
16+
17+
private List<Bookmark> LoadChromeBookmarks()
18+
{
19+
var bookmarks = new List<Bookmark>();
20+
String platformPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
21+
bookmarks.AddRange(LoadBookmarks(Path.Combine(platformPath, @"Google\Chrome\User Data"), "Google Chrome"));
22+
bookmarks.AddRange(LoadBookmarks(Path.Combine(platformPath, @"Google\Chrome SxS\User Data"), "Google Chrome Canary"));
23+
bookmarks.AddRange(LoadBookmarks(Path.Combine(platformPath, @"Chromium\User Data"), "Chromium"));
24+
return bookmarks;
25+
}
26+
}
27+
}

Plugins/Flow.Launcher.Plugin.BrowserBookmark/ChromeBookmarks.cs

Lines changed: 0 additions & 87 deletions
This file was deleted.

0 commit comments

Comments
 (0)