Skip to content

Commit 2b1cd93

Browse files
authored
Merge branch 'dev' into merge_back_release
2 parents 7ae91b1 + 566b7d3 commit 2b1cd93

32 files changed

+2123
-217
lines changed

Flow.Launcher.Infrastructure/Http/Http.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,5 +220,18 @@ public static async Task<HttpResponseMessage> SendAsync(HttpRequestMessage reque
220220
return new HttpResponseMessage(HttpStatusCode.InternalServerError);
221221
}
222222
}
223+
224+
public static async Task<string> GetStringAsync(string url, CancellationToken token = default)
225+
{
226+
try
227+
{
228+
Log.Debug(ClassName, $"Url <{url}>");
229+
return await client.GetStringAsync(url, token);
230+
}
231+
catch (System.Exception e)
232+
{
233+
return string.Empty;
234+
}
235+
}
223236
}
224237
}

Flow.Launcher.Infrastructure/UserSettings/Settings.cs

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ public void Save()
3333
_storage.Save();
3434
}
3535

36-
private string _theme = Constant.DefaultTheme;
3736
public string Hotkey { get; set; } = $"{KeyConstant.Alt} + {KeyConstant.Space}";
3837
public string OpenResultModifiers { get; set; } = KeyConstant.Alt;
3938
public string ColorScheme { get; set; } = "System";
@@ -60,16 +59,20 @@ public string Language
6059
get => _language;
6160
set
6261
{
63-
_language = value;
64-
OnPropertyChanged();
62+
if (_language != value)
63+
{
64+
_language = value;
65+
OnPropertyChanged();
66+
}
6567
}
6668
}
69+
private string _theme = Constant.DefaultTheme;
6770
public string Theme
6871
{
6972
get => _theme;
7073
set
7174
{
72-
if (value != _theme)
75+
if (_theme != value)
7376
{
7477
_theme = value;
7578
OnPropertyChanged();
@@ -79,6 +82,7 @@ public string Theme
7982
}
8083
public bool UseDropShadowEffect { get; set; } = true;
8184
public BackdropTypes BackdropType{ get; set; } = BackdropTypes.None;
85+
public string ReleaseNotesVersion { get; set; } = string.Empty;
8286

8387
/* Appearance Settings. It should be separated from the setting later.*/
8488
public double WindowHeightSize { get; set; } = 42;
@@ -297,9 +301,12 @@ public SearchPrecisionScore QuerySearchPrecision
297301
get => _querySearchPrecision;
298302
set
299303
{
300-
_querySearchPrecision = value;
301-
if (_stringMatcher != null)
302-
_stringMatcher.UserSettingSearchPrecision = value;
304+
if (_querySearchPrecision != value)
305+
{
306+
_querySearchPrecision = value;
307+
if (_stringMatcher != null)
308+
_stringMatcher.UserSettingSearchPrecision = value;
309+
}
303310
}
304311
}
305312

@@ -366,13 +373,30 @@ public bool HideNotifyIcon
366373
get => _hideNotifyIcon;
367374
set
368375
{
369-
_hideNotifyIcon = value;
370-
OnPropertyChanged();
376+
if (_hideNotifyIcon != value)
377+
{
378+
_hideNotifyIcon = value;
379+
OnPropertyChanged();
380+
}
371381
}
372382
}
373383
public bool LeaveCmdOpen { get; set; }
374384
public bool HideWhenDeactivated { get; set; } = true;
375385

386+
private bool _showAtTopmost = true;
387+
public bool ShowAtTopmost
388+
{
389+
get => _showAtTopmost;
390+
set
391+
{
392+
if (_showAtTopmost != value)
393+
{
394+
_showAtTopmost = value;
395+
OnPropertyChanged();
396+
}
397+
}
398+
}
399+
376400
public bool SearchQueryResultsWithDelay { get; set; }
377401
public int SearchDelayTime { get; set; } = 150;
378402

Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,15 @@ public interface IPublicAPI
8484
/// <param name="subTitle">Optional message subtitle</param>
8585
void ShowMsgError(string title, string subTitle = "");
8686

87+
/// <summary>
88+
/// Show the error message using Flow's standard error icon.
89+
/// </summary>
90+
/// <param name="title">Message title</param>
91+
/// <param name="buttonText">Message button content</param>
92+
/// <param name="buttonAction">Message button action</param>
93+
/// <param name="subTitle">Optional message subtitle</param>
94+
void ShowMsgErrorWithButton(string title, string buttonText, Action buttonAction, string subTitle = "");
95+
8796
/// <summary>
8897
/// Show the MainWindow when hiding
8998
/// </summary>
@@ -127,6 +136,27 @@ public interface IPublicAPI
127136
/// <param name="useMainWindowAsOwner">when true will use main windows as the owner</param>
128137
void ShowMsg(string title, string subTitle, string iconPath, bool useMainWindowAsOwner = true);
129138

139+
/// <summary>
140+
/// Show message box with button
141+
/// </summary>
142+
/// <param name="title">Message title</param>
143+
/// <param name="buttonText">Message button content</param>
144+
/// <param name="buttonAction">Message button action</param>
145+
/// <param name="subTitle">Message subtitle</param>
146+
/// <param name="iconPath">Message icon path (relative path to your plugin folder)</param>
147+
void ShowMsgWithButton(string title, string buttonText, Action buttonAction, string subTitle = "", string iconPath = "");
148+
149+
/// <summary>
150+
/// Show message box with button
151+
/// </summary>
152+
/// <param name="title">Message title</param>
153+
/// <param name="buttonText">Message button content</param>
154+
/// <param name="buttonAction">Message button action</param>
155+
/// <param name="subTitle">Message subtitle</param>
156+
/// <param name="iconPath">Message icon path (relative path to your plugin folder)</param>
157+
/// <param name="useMainWindowAsOwner">when true will use main windows as the owner</param>
158+
void ShowMsgWithButton(string title, string buttonText, Action buttonAction, string subTitle, string iconPath, bool useMainWindowAsOwner = true);
159+
130160
/// <summary>
131161
/// Open setting dialog
132162
/// </summary>

Flow.Launcher/App.xaml.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,8 @@ await API.StopwatchLogInfoAsync(ClassName, "Startup cost", async () =>
171171
Current.Resources["SettingWindowFont"] = new FontFamily(_settings.SettingWindowFont);
172172
Current.Resources["ContentControlThemeFontFamily"] = new FontFamily(_settings.SettingWindowFont);
173173

174+
Notification.Install();
175+
174176
Ioc.Default.GetRequiredService<Portable>().PreStartCleanUpAfterPortabilityUpdate();
175177

176178
API.LogInfo(ClassName, "Begin Flow Launcher startup ----------------------------------------------------");

Flow.Launcher/Flow.Launcher.csproj

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,11 @@
9090
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
9191
</PackageReference>
9292
<PackageReference Include="InputSimulator" Version="1.0.4" />
93+
<PackageReference Include="MdXaml" Version="1.27.0" />
94+
<PackageReference Include="MdXaml.AnimatedGif" Version="1.27.0" />
95+
<PackageReference Include="MdXaml.Html" Version="1.27.0" />
96+
<PackageReference Include="MdXaml.Plugins" Version="1.27.0" />
97+
<PackageReference Include="MdXaml.Svg" Version="1.27.0" />
9398
<!-- Do not upgrade Microsoft.Extensions.DependencyInjection and Microsoft.Extensions.Hosting since we are .Net7.0 -->
9499
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
95100
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" />

Flow.Launcher/Languages/en.xaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,8 @@
131131
<system:String x:Key="historyResultsForHomePage">Show History Results in Home Page</system:String>
132132
<system:String x:Key="historyResultsCountForHomePage">Maximum History Results Shown in Home Page</system:String>
133133
<system:String x:Key="homeToggleBoxToolTip">This can only be edited if plugin supports Home feature and Home Page is enabled.</system:String>
134+
<system:String x:Key="showAtTopmost">Show Search Window at Topmost</system:String>
135+
<system:String x:Key="showAtTopmostToolTip">Show search window above other windows</system:String>
134136

135137
<!-- Setting Plugin -->
136138
<system:String x:Key="searchplugin">Search Plugin</system:String>
@@ -365,6 +367,13 @@
365367
<system:String x:Key="LogLevelINFO">Info</system:String>
366368
<system:String x:Key="settingWindowFontTitle">Setting Window Font</system:String>
367369

370+
<!-- Release Notes Window -->
371+
<system:String x:Key="seeMoreReleaseNotes">See more release notes on GitHub</system:String>
372+
<system:String x:Key="checkNetworkConnectionTitle">Failed to fetch release notes</system:String>
373+
<system:String x:Key="checkNetworkConnectionSubTitle">Please check your network connection or ensure GitHub is accessible</system:String>
374+
<system:String x:Key="appUpdateTitle">Flow Launcher has been updated to {0}</system:String>
375+
<system:String x:Key="appUpdateButtonContent">Click here to view the release notes</system:String>
376+
368377
<!-- FileManager Setting Dialog -->
369378
<system:String x:Key="fileManagerWindow">Select File Manager</system:String>
370379
<system:String x:Key="fileManager_learnMore">Learn more</system:String>

Flow.Launcher/MainWindow.xaml.cs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ public MainWindow()
8484
_viewModel = Ioc.Default.GetRequiredService<MainViewModel>();
8585
DataContext = _viewModel;
8686

87+
Topmost = _settings.ShowAtTopmost;
88+
8789
InitializeComponent();
8890
UpdatePosition();
8991

@@ -121,6 +123,9 @@ private void OnLoaded(object sender, RoutedEventArgs _)
121123
// Set First Launch to false
122124
_settings.FirstLaunch = false;
123125

126+
// Update release notes version
127+
_settings.ReleaseNotesVersion = Constant.Version;
128+
124129
// Set Backdrop Type to Acrylic for Windows 11 when First Launch. Default is None
125130
if (Win32Helper.IsBackdropSupported()) _settings.BackdropType = BackdropTypes.Acrylic;
126131

@@ -132,6 +137,25 @@ private void OnLoaded(object sender, RoutedEventArgs _)
132137
welcomeWindow.Show();
133138
}
134139

140+
if (_settings.ReleaseNotesVersion != Constant.Version)
141+
{
142+
// Update release notes version
143+
_settings.ReleaseNotesVersion = Constant.Version;
144+
145+
// Display message box with button
146+
App.API.ShowMsgWithButton(
147+
string.Format(App.API.GetTranslation("appUpdateTitle"), Constant.Version),
148+
App.API.GetTranslation("appUpdateButtonContent"),
149+
() =>
150+
{
151+
Application.Current.Dispatcher.Invoke(() =>
152+
{
153+
var releaseNotesWindow = new ReleaseNotesWindow();
154+
releaseNotesWindow.Show();
155+
});
156+
});
157+
}
158+
135159
// Initialize place holder
136160
SetupPlaceholderText();
137161
_viewModel.PlaceholderText = _settings.PlaceholderText;
@@ -289,6 +313,9 @@ private void OnLoaded(object sender, RoutedEventArgs _)
289313
_viewModel.QueryResults();
290314
}
291315
break;
316+
case nameof(Settings.ShowAtTopmost):
317+
Topmost = _settings.ShowAtTopmost;
318+
break;
292319
}
293320
};
294321

Flow.Launcher/Msg.xaml

Lines changed: 56 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,76 @@
1-
<Window x:Class="Flow.Launcher.Msg"
2-
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3-
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4-
Background="#ebebeb"
5-
Topmost="True"
6-
SizeToContent="Height"
7-
ResizeMode="NoResize"
8-
WindowStyle="None"
9-
ShowInTaskbar="False"
10-
Title="Msg" Height="60" Width="420">
1+
<Window
2+
x:Class="Flow.Launcher.Msg"
3+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5+
Title="Msg"
6+
Width="420"
7+
Height="60"
8+
Background="#ebebeb"
9+
ResizeMode="NoResize"
10+
ShowInTaskbar="False"
11+
SizeToContent="Height"
12+
Topmost="True"
13+
WindowStyle="None">
1114
<Window.Triggers>
1215
<EventTrigger RoutedEvent="Window.Loaded">
1316
<BeginStoryboard>
1417
<Storyboard>
15-
<DoubleAnimation x:Name="showAnimation" Duration="0:0:0.3" Storyboard.TargetProperty="Top"
16-
AccelerationRatio="0.2" />
18+
<DoubleAnimation
19+
x:Name="showAnimation"
20+
AccelerationRatio="0.2"
21+
Storyboard.TargetProperty="Top"
22+
Duration="0:0:0.3" />
1723
</Storyboard>
1824
</BeginStoryboard>
1925
</EventTrigger>
20-
2126
</Window.Triggers>
22-
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="5">
27+
28+
<Grid
29+
Margin="5"
30+
HorizontalAlignment="Stretch"
31+
VerticalAlignment="Stretch">
2332
<Grid.ColumnDefinitions>
2433
<ColumnDefinition Width="32" />
2534
<ColumnDefinition />
2635
<ColumnDefinition Width="2.852" />
27-
<ColumnDefinition Width="13.148"/>
36+
<ColumnDefinition Width="13.148" />
2837
</Grid.ColumnDefinitions>
29-
<Image x:Name="imgIco" Width="32" Height="32" HorizontalAlignment="Left" Margin="0,9" />
30-
<Grid HorizontalAlignment="Stretch" Margin="5 0 0 0" Grid.Column="1" VerticalAlignment="Stretch">
38+
<Image
39+
x:Name="imgIco"
40+
Width="32"
41+
Height="32"
42+
Margin="0 9"
43+
HorizontalAlignment="Left" />
44+
<Grid
45+
Grid.Column="1"
46+
Margin="5 0 0 0"
47+
HorizontalAlignment="Stretch"
48+
VerticalAlignment="Stretch">
3149
<Grid.RowDefinitions>
3250
<RowDefinition />
3351
<RowDefinition />
3452
</Grid.RowDefinitions>
35-
<TextBlock x:Name="tbTitle" FontSize="16" Foreground="#37392c" FontWeight="Medium">Title</TextBlock>
36-
<TextBlock Grid.Row="1" Foreground="#8e94a4" x:Name="tbSubTitle">sdfdsf</TextBlock>
53+
<TextBlock
54+
x:Name="tbTitle"
55+
FontSize="16"
56+
FontWeight="Medium"
57+
Foreground="#37392c">
58+
Title
59+
</TextBlock>
60+
<TextBlock
61+
x:Name="tbSubTitle"
62+
Grid.Row="1"
63+
Foreground="#8e94a4">
64+
sdfdsf
65+
</TextBlock>
3766
</Grid>
38-
<Image x:Name="imgClose" Grid.Column="2" Cursor="Hand" Width="16" VerticalAlignment="Top"
39-
HorizontalAlignment="Right" Grid.ColumnSpan="2" />
67+
<Image
68+
x:Name="imgClose"
69+
Grid.Column="2"
70+
Grid.ColumnSpan="2"
71+
Width="16"
72+
HorizontalAlignment="Right"
73+
VerticalAlignment="Top"
74+
Cursor="Hand" />
4075
</Grid>
4176
</Window>

0 commit comments

Comments
 (0)