Skip to content

Commit a05e099

Browse files
authored
Release 2.0.1 (#3998)
1 parent e093092 commit a05e099

File tree

140 files changed

+1855
-1325
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

140 files changed

+1855
-1325
lines changed

Flow.Launcher.Core/ExternalPlugins/CommunityPluginSource.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,17 @@ public async Task<List<UserPlugin>> FetchAsync(CancellationToken token)
7373
return null;
7474
}
7575
}
76+
catch (OperationCanceledException) when (token.IsCancellationRequested)
77+
{
78+
API.LogDebug(ClassName, $"Fetching from {ManifestFileUrl} was cancelled by caller.");
79+
return null;
80+
}
81+
catch (TaskCanceledException)
82+
{
83+
// Likely an HttpClient timeout or external cancellation not requested by our token
84+
API.LogWarn(ClassName, $"Fetching from {ManifestFileUrl} timed out.");
85+
return null;
86+
}
7687
catch (Exception e)
7788
{
7889
if (e is HttpRequestException or WebException or SocketException || e.InnerException is TimeoutException)

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@
5555

5656
<ItemGroup>
5757
<PackageReference Include="Droplex" Version="1.7.0" />
58-
<PackageReference Include="FSharp.Core" Version="9.0.300" />
59-
<PackageReference Include="Meziantou.Framework.Win32.Jobs" Version="3.4.3" />
58+
<PackageReference Include="FSharp.Core" Version="9.0.303" />
59+
<PackageReference Include="Meziantou.Framework.Win32.Jobs" Version="3.4.4" />
6060
<PackageReference Include="Microsoft.IO.RecyclableMemoryStream" Version="3.0.1" />
6161
<PackageReference Include="SemanticVersioning" Version="3.0.0" />
6262
<PackageReference Include="squirrel.windows" Version="1.5.2" NoWarn="NU1701" />

Flow.Launcher.Core/Plugin/JsonRPCPluginSettings.cs

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public class JsonRPCPluginSettings : ISavable
2727

2828
private JsonStorage<ConcurrentDictionary<string, object?>> _storage = null!;
2929

30+
private static readonly double MainGridColumn0MaxWidthRatio = 0.6;
3031
private static readonly Thickness SettingPanelMargin = (Thickness)Application.Current.FindResource("SettingPanelMargin");
3132
private static readonly Thickness SettingPanelItemLeftMargin = (Thickness)Application.Current.FindResource("SettingPanelItemLeftMargin");
3233
private static readonly Thickness SettingPanelItemTopBottomMargin = (Thickness)Application.Current.FindResource("SettingPanelItemTopBottomMargin");
@@ -156,7 +157,7 @@ public Control CreateSettingPanel()
156157
{
157158
if (!NeedCreateSettingPanel()) return null!;
158159

159-
// Create main grid with two columns (Column 1: Auto, Column 2: *)
160+
// Create main grid with two columns (Column 0: Auto, Column 1: *)
160161
var mainPanel = new Grid { Margin = SettingPanelMargin, VerticalAlignment = VerticalAlignment.Center };
161162
mainPanel.ColumnDefinitions.Add(new ColumnDefinition()
162163
{
@@ -200,7 +201,7 @@ public Control CreateSettingPanel()
200201
{
201202
Text = attributes.Label,
202203
VerticalAlignment = VerticalAlignment.Center,
203-
TextWrapping = TextWrapping.WrapWithOverflow
204+
TextWrapping = TextWrapping.Wrap
204205
};
205206

206207
// Create a text block for description
@@ -211,7 +212,7 @@ public Control CreateSettingPanel()
211212
{
212213
Text = attributes.Description,
213214
VerticalAlignment = VerticalAlignment.Center,
214-
TextWrapping = TextWrapping.WrapWithOverflow
215+
TextWrapping = TextWrapping.Wrap
215216
};
216217

217218
desc.SetResourceReference(TextBlock.StyleProperty, "SettingPanelTextBlockDescriptionStyle"); // for theme change
@@ -247,7 +248,8 @@ public Control CreateSettingPanel()
247248
VerticalAlignment = VerticalAlignment.Center,
248249
Margin = SettingPanelItemLeftTopBottomMargin,
249250
Text = Settings[attributes.Name] as string ?? string.Empty,
250-
ToolTip = attributes.Description
251+
ToolTip = attributes.Description,
252+
TextWrapping = TextWrapping.Wrap
251253
};
252254

253255
textBox.TextChanged += (_, _) =>
@@ -269,7 +271,8 @@ public Control CreateSettingPanel()
269271
VerticalAlignment = VerticalAlignment.Center,
270272
Margin = SettingPanelItemLeftMargin,
271273
Text = Settings[attributes.Name] as string ?? string.Empty,
272-
ToolTip = attributes.Description
274+
ToolTip = attributes.Description,
275+
TextWrapping = TextWrapping.Wrap
273276
};
274277

275278
textBox.TextChanged += (_, _) =>
@@ -333,7 +336,7 @@ public Control CreateSettingPanel()
333336
HorizontalAlignment = HorizontalAlignment.Stretch,
334337
VerticalAlignment = VerticalAlignment.Center,
335338
Margin = SettingPanelItemLeftTopBottomMargin,
336-
TextWrapping = TextWrapping.WrapWithOverflow,
339+
TextWrapping = TextWrapping.Wrap,
337340
AcceptsReturn = true,
338341
Text = Settings[attributes.Name] as string ?? string.Empty,
339342
ToolTip = attributes.Description
@@ -488,13 +491,37 @@ Settings[attributes.Name] is bool isChecked
488491
rowCount++;
489492
}
490493

494+
mainPanel.SizeChanged += MainPanel_SizeChanged;
495+
491496
// Wrap the main grid in a user control
492497
return new UserControl()
493498
{
494499
Content = mainPanel
495500
};
496501
}
497502

503+
private void MainPanel_SizeChanged(object sender, SizeChangedEventArgs e)
504+
{
505+
if (sender is not Grid grid) return;
506+
507+
var workingWidth = grid.ActualWidth;
508+
509+
if (workingWidth <= 0) return;
510+
511+
var constrainedWidth = MainGridColumn0MaxWidthRatio * workingWidth;
512+
513+
// Set MaxWidth of column 0 and its children
514+
// We must set MaxWidth of its children to make text wrapping work correctly
515+
grid.ColumnDefinitions[0].MaxWidth = constrainedWidth;
516+
foreach (var child in grid.Children)
517+
{
518+
if (child is FrameworkElement element && Grid.GetColumn(element) == 0 && Grid.GetColumnSpan(element) == 1)
519+
{
520+
element.MaxWidth = constrainedWidth;
521+
}
522+
}
523+
}
524+
498525
private static bool NeedSaveInSettings(string type)
499526
{
500527
return type != "textBlock" && type != "separator" && type != "hyperlink";

Flow.Launcher.Core/Resource/Internationalization.cs

Lines changed: 37 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Collections.Generic;
33
using System.Globalization;
44
using System.IO;
@@ -14,7 +14,7 @@
1414

1515
namespace Flow.Launcher.Core.Resource
1616
{
17-
public class Internationalization
17+
public class Internationalization : IDisposable
1818
{
1919
private static readonly string ClassName = nameof(Internationalization);
2020

@@ -30,6 +30,7 @@ public class Internationalization
3030
private readonly List<string> _languageDirectories = [];
3131
private readonly List<ResourceDictionary> _oldResources = [];
3232
private static string SystemLanguageCode;
33+
private readonly SemaphoreSlim _langChangeLock = new(1, 1);
3334

3435
public Internationalization(Settings settings)
3536
{
@@ -185,20 +186,33 @@ private static Language GetLanguageByLanguageCode(string languageCode)
185186

186187
private async Task ChangeLanguageAsync(Language language, bool updateMetadata = true)
187188
{
188-
// Remove old language files and load language
189-
RemoveOldLanguageFiles();
190-
if (language != AvailableLanguages.English)
189+
await _langChangeLock.WaitAsync();
190+
191+
try
191192
{
192-
LoadLanguage(language);
193-
}
193+
// Remove old language files and load language
194+
RemoveOldLanguageFiles();
195+
if (language != AvailableLanguages.English)
196+
{
197+
LoadLanguage(language);
198+
}
194199

195-
// Change culture info
196-
ChangeCultureInfo(language.LanguageCode);
200+
// Change culture info
201+
ChangeCultureInfo(language.LanguageCode);
197202

198-
if (updateMetadata)
203+
if (updateMetadata)
204+
{
205+
// Raise event for plugins after culture is set
206+
await Task.Run(UpdatePluginMetadataTranslations);
207+
}
208+
}
209+
catch (Exception e)
199210
{
200-
// Raise event for plugins after culture is set
201-
await Task.Run(UpdatePluginMetadataTranslations);
211+
API.LogException(ClassName, $"Failed to change language to <{language.LanguageCode}>", e);
212+
}
213+
finally
214+
{
215+
_langChangeLock.Release();
202216
}
203217
}
204218

@@ -257,6 +271,7 @@ private void RemoveOldLanguageFiles()
257271
{
258272
dicts.Remove(r);
259273
}
274+
_oldResources.Clear();
260275
}
261276

262277
private void LoadLanguage(Language language)
@@ -368,5 +383,15 @@ public static void UpdatePluginMetadataTranslations()
368383
}
369384

370385
#endregion
386+
387+
#region IDisposable
388+
389+
public void Dispose()
390+
{
391+
RemoveOldLanguageFiles();
392+
_langChangeLock.Dispose();
393+
}
394+
395+
#endregion
371396
}
372397
}

Flow.Launcher.Core/packages.lock.json

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@
1313
},
1414
"FSharp.Core": {
1515
"type": "Direct",
16-
"requested": "[9.0.300, )",
17-
"resolved": "9.0.300",
18-
"contentHash": "TVt2J7RCE1KCS2IaONF+p8/KIZ1eHNbW+7qmKF6hGoD4tXl+o07ja1mPtFjMqRa5uHMFaTrGTPn/m945WnDLiQ=="
16+
"requested": "[9.0.303, )",
17+
"resolved": "9.0.303",
18+
"contentHash": "6JlV8aD8qQvcmfoe/PMOxCHXc0uX4lR23u0fAyQtnVQxYULLoTZgwgZHSnRcuUHOvS3wULFWcwdnP1iwslH60g=="
1919
},
2020
"Meziantou.Framework.Win32.Jobs": {
2121
"type": "Direct",
22-
"requested": "[3.4.3, )",
23-
"resolved": "3.4.3",
24-
"contentHash": "REjInKnQ0OrhjjtSMPQtLtdURctCroB4L8Sd2gjTOYDysklvsdnrStx1tHS7uLv+fSyFF3aazZmo5Ka0v1oz/w=="
22+
"requested": "[3.4.4, )",
23+
"resolved": "3.4.4",
24+
"contentHash": "AivBzH5wM1NHBLehclim+o37SmireP7JxCRUoTilsc/h7LH9+YCPjb6Ig6y0khnQhFcO1P8RHYw4oiR15TGHUg=="
2525
},
2626
"Microsoft.IO.RecyclableMemoryStream": {
2727
"type": "Direct",
@@ -90,8 +90,8 @@
9090
},
9191
"JetBrains.Annotations": {
9292
"type": "Transitive",
93-
"resolved": "2024.3.0",
94-
"contentHash": "ox5pkeLQXjvJdyAB4b2sBYAlqZGLh3PjSnP1bQNVx72ONuTJ9+34/+Rq91Fc0dG29XG9RgZur9+NcP4riihTug=="
93+
"resolved": "2025.2.2",
94+
"contentHash": "0X56ZRizuHdrnPpgXjWV7f2tQO1FlQg5O1967OGKnI/4ZRNOK642J8L7brM1nYvrxTTU5TP1yRyXLRLaXLPQ8A=="
9595
},
9696
"MemoryPack": {
9797
"type": "Transitive",
@@ -199,21 +199,21 @@
199199
},
200200
"NLog": {
201201
"type": "Transitive",
202-
"resolved": "6.0.1",
203-
"contentHash": "qDWiqy8/xdpZKtHna/645KbalwP86N2NFJEzfqhcv+Si4V2iNaEfR/dCneuF/4+Dcwl3f7jHMXj3ndWYftV3Ug=="
202+
"resolved": "6.0.4",
203+
"contentHash": "Xr+lIk1ZlTTFXEqnxQVLxrDqZlt2tm5X+/AhJbaY2emb/dVtGDiU5QuEtj3gHtwV/SWlP/rJ922I/BPuOJXlRw=="
204204
},
205205
"NLog.OutputDebugString": {
206206
"type": "Transitive",
207-
"resolved": "6.0.1",
208-
"contentHash": "wwJCQLaHVzuRf8TsXB+EEdrzVvE3dnzCSMQMDgwkw3AXp8VSp3JSVF/Q/H0oEqggKgKhPs13hh3a7svyQr4s3A==",
207+
"resolved": "6.0.4",
208+
"contentHash": "TOP2Ap9BbE98B/l/TglnguowOD0rXo8B/20xAgvj9shO/kf6IJ5M4QMhVxq72mrneJ/ANhHY7Jcd+xJbzuI5PA==",
209209
"dependencies": {
210-
"NLog": "6.0.1"
210+
"NLog": "6.0.4"
211211
}
212212
},
213213
"SharpVectors.Wpf": {
214214
"type": "Transitive",
215-
"resolved": "1.8.4.2",
216-
"contentHash": "PNxLkMBJnV8A+6yH9OqOlhLJegvWP/dvh0rAJp2l0kcrR+rB4R2tQ9vhUqka+UilH4atN8T6zvjDOizVyfz2Ng=="
215+
"resolved": "1.8.5",
216+
"contentHash": "WURdBDq5AE8RjKV9pFS7lNkJe81gxja9SaMGE4URq9GJUZ6M+5DGUL0Lm3B0iYW2/Meyowaz4ffGsyW+RBSTtg=="
217217
},
218218
"Splat": {
219219
"type": "Transitive",
@@ -254,22 +254,22 @@
254254
"Ben.Demystifier": "[0.4.1, )",
255255
"BitFaster.Caching": "[2.5.4, )",
256256
"CommunityToolkit.Mvvm": "[8.4.0, )",
257-
"Flow.Launcher.Plugin": "[4.7.0, )",
257+
"Flow.Launcher.Plugin": "[5.0.0, )",
258258
"InputSimulator": "[1.0.4, )",
259259
"MemoryPack": "[1.21.4, )",
260260
"Microsoft.VisualStudio.Threading": "[17.14.15, )",
261261
"NHotkey.Wpf": "[3.0.0, )",
262-
"NLog": "[6.0.1, )",
263-
"NLog.OutputDebugString": "[6.0.1, )",
264-
"SharpVectors.Wpf": "[1.8.4.2, )",
262+
"NLog": "[6.0.4, )",
263+
"NLog.OutputDebugString": "[6.0.4, )",
264+
"SharpVectors.Wpf": "[1.8.5, )",
265265
"System.Drawing.Common": "[7.0.0, )",
266266
"ToolGood.Words.Pinyin": "[3.1.0.3, )"
267267
}
268268
},
269269
"flow.launcher.plugin": {
270270
"type": "Project",
271271
"dependencies": {
272-
"JetBrains.Annotations": "[2024.3.0, )"
272+
"JetBrains.Annotations": "[2025.2.2, )"
273273
}
274274
}
275275
}

Flow.Launcher.Infrastructure/Flow.Launcher.Infrastructure.csproj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,24 +56,24 @@
5656
<PackageReference Include="Ben.Demystifier" Version="0.4.1" />
5757
<PackageReference Include="BitFaster.Caching" Version="2.5.4" />
5858
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
59-
<PackageReference Include="Fody" Version="6.9.2">
59+
<PackageReference Include="Fody" Version="6.9.3">
6060
<PrivateAssets>all</PrivateAssets>
6161
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
6262
</PackageReference>
6363
<PackageReference Include="InputSimulator" Version="1.0.4" />
6464
<PackageReference Include="MemoryPack" Version="1.21.4" />
6565
<PackageReference Include="Microsoft.VisualStudio.Threading" Version="17.14.15" />
66-
<PackageReference Include="Microsoft.Windows.CsWin32" Version="0.3.183">
66+
<PackageReference Include="Microsoft.Windows.CsWin32" Version="0.3.205">
6767
<PrivateAssets>all</PrivateAssets>
6868
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
6969
</PackageReference>
7070
<PackageReference Include="NHotkey.Wpf" Version="3.0.0" />
71-
<PackageReference Include="NLog" Version="6.0.1" />
72-
<PackageReference Include="NLog.OutputDebugString" Version="6.0.1" />
71+
<PackageReference Include="NLog" Version="6.0.4" />
72+
<PackageReference Include="NLog.OutputDebugString" Version="6.0.4" />
7373
<PackageReference Include="PropertyChanged.Fody" Version="4.1.0">
7474
<PrivateAssets>all</PrivateAssets>
7575
</PackageReference>
76-
<PackageReference Include="SharpVectors.Wpf" Version="1.8.4.2" />
76+
<PackageReference Include="SharpVectors.Wpf" Version="1.8.5" />
7777
<!-- Do not upgrade this to higher version since it can cause this issue on WinForm platform: -->
7878
<!-- PlatformNotSupportedException: SystemEvents is not supported on this platform. -->
7979
<PackageReference Include="System.Drawing.Common" Version="7.0.0" />

Flow.Launcher.Infrastructure/Image/ImageLoader.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public static class ImageLoader
2222
private static Lock storageLock { get; } = new();
2323
private static BinaryStorage<List<(string, bool)>> _storage;
2424
private static readonly ConcurrentDictionary<string, string> GuidToKey = new();
25-
private static IImageHashGenerator _hashGenerator;
25+
private static ImageHashGenerator _hashGenerator;
2626
private static readonly bool EnableImageHash = true;
2727
public static ImageSource Image => ImageCache[Constant.ImageIcon, false];
2828
public static ImageSource MissingImage => ImageCache[Constant.MissingImgIcon, false];
@@ -31,7 +31,7 @@ public static class ImageLoader
3131
public const int FullIconSize = 256;
3232
public const int FullImageSize = 320;
3333

34-
private static readonly string[] ImageExtensions = { ".png", ".jpg", ".jpeg", ".gif", ".bmp", ".tiff", ".ico" };
34+
private static readonly string[] ImageExtensions = [".png", ".jpg", ".jpeg", ".gif", ".bmp", ".tiff", ".ico"];
3535
private static readonly string SvgExtension = ".svg";
3636

3737
public static async Task InitializeAsync()
@@ -327,7 +327,7 @@ public static async ValueTask<ImageSource> LoadAsync(string path, bool loadFullI
327327
return img;
328328
}
329329

330-
private static ImageSource LoadFullImage(string path)
330+
private static BitmapImage LoadFullImage(string path)
331331
{
332332
BitmapImage image = new BitmapImage();
333333
image.BeginInit();
@@ -364,7 +364,7 @@ private static ImageSource LoadFullImage(string path)
364364
return image;
365365
}
366366

367-
private static ImageSource LoadSvgImage(string path, bool loadFullImage = false)
367+
private static RenderTargetBitmap LoadSvgImage(string path, bool loadFullImage = false)
368368
{
369369
// Set up drawing settings
370370
var desiredHeight = loadFullImage ? FullImageSize : SmallIconSize;

0 commit comments

Comments
 (0)