Skip to content

Commit 60770da

Browse files
authored
Merge pull request #3671 from Flow-Launcher/release_notes
Release Notes Window
2 parents b0c3b71 + ad24aef commit 60770da

File tree

17 files changed

+1272
-59
lines changed

17 files changed

+1272
-59
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: 2 additions & 1 deletion
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";
@@ -64,6 +63,7 @@ public string Language
6463
OnPropertyChanged();
6564
}
6665
}
66+
private string _theme = Constant.DefaultTheme;
6767
public string Theme
6868
{
6969
get => _theme;
@@ -79,6 +79,7 @@ public string Theme
7979
}
8080
public bool UseDropShadowEffect { get; set; } = true;
8181
public BackdropTypes BackdropType{ get; set; } = BackdropTypes.None;
82+
public string ReleaseNotesVersion { get; set; } = string.Empty;
8283

8384
/* Appearance Settings. It should be separated from the setting later.*/
8485
public double WindowHeightSize { get; set; } = 42;

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: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,13 @@
365365
<system:String x:Key="LogLevelINFO">Info</system:String>
366366
<system:String x:Key="settingWindowFontTitle">Setting Window Font</system:String>
367367

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

Flow.Launcher/MainWindow.xaml.cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,9 @@ private void OnLoaded(object sender, RoutedEventArgs _)
121121
// Set First Launch to false
122122
_settings.FirstLaunch = false;
123123

124+
// Update release notes version
125+
_settings.ReleaseNotesVersion = Constant.Version;
126+
124127
// Set Backdrop Type to Acrylic for Windows 11 when First Launch. Default is None
125128
if (Win32Helper.IsBackdropSupported()) _settings.BackdropType = BackdropTypes.Acrylic;
126129

@@ -132,6 +135,25 @@ private void OnLoaded(object sender, RoutedEventArgs _)
132135
welcomeWindow.Show();
133136
}
134137

138+
if (_settings.ReleaseNotesVersion != Constant.Version)
139+
{
140+
// Update release notes version
141+
_settings.ReleaseNotesVersion = Constant.Version;
142+
143+
// Display message box with button
144+
App.API.ShowMsgWithButton(
145+
string.Format(App.API.GetTranslation("appUpdateTitle"), Constant.Version),
146+
App.API.GetTranslation("appUpdateButtonContent"),
147+
() =>
148+
{
149+
Application.Current.Dispatcher.Invoke(() =>
150+
{
151+
var releaseNotesWindow = new ReleaseNotesWindow();
152+
releaseNotesWindow.Show();
153+
});
154+
});
155+
}
156+
135157
// Initialize place holder
136158
SetupPlaceholderText();
137159
_viewModel.PlaceholderText = _settings.PlaceholderText;

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>

Flow.Launcher/MsgWithButton.xaml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
<Window
2+
x:Class="Flow.Launcher.MsgWithButton"
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">
14+
<Window.Triggers>
15+
<EventTrigger RoutedEvent="Window.Loaded">
16+
<BeginStoryboard>
17+
<Storyboard>
18+
<DoubleAnimation
19+
x:Name="showAnimation"
20+
AccelerationRatio="0.2"
21+
Storyboard.TargetProperty="Top"
22+
Duration="0:0:0.3" />
23+
</Storyboard>
24+
</BeginStoryboard>
25+
</EventTrigger>
26+
</Window.Triggers>
27+
28+
<StackPanel Orientation="Vertical">
29+
<Grid
30+
Margin="5"
31+
HorizontalAlignment="Stretch"
32+
VerticalAlignment="Stretch">
33+
<Grid.ColumnDefinitions>
34+
<ColumnDefinition Width="32" />
35+
<ColumnDefinition />
36+
<ColumnDefinition Width="2.852" />
37+
<ColumnDefinition Width="13.148" />
38+
</Grid.ColumnDefinitions>
39+
<Image
40+
x:Name="imgIco"
41+
Width="32"
42+
Height="32"
43+
Margin="0 9"
44+
HorizontalAlignment="Left" />
45+
<Grid
46+
Grid.Column="1"
47+
Margin="5 0 0 0"
48+
HorizontalAlignment="Stretch"
49+
VerticalAlignment="Stretch">
50+
<Grid.RowDefinitions>
51+
<RowDefinition />
52+
<RowDefinition />
53+
</Grid.RowDefinitions>
54+
<TextBlock
55+
x:Name="tbTitle"
56+
FontSize="16"
57+
FontWeight="Medium"
58+
Foreground="#37392c">
59+
Title
60+
</TextBlock>
61+
<TextBlock
62+
x:Name="tbSubTitle"
63+
Grid.Row="1"
64+
Foreground="#8e94a4">
65+
sdfdsf
66+
</TextBlock>
67+
</Grid>
68+
<Image
69+
x:Name="imgClose"
70+
Grid.Column="2"
71+
Grid.ColumnSpan="2"
72+
Width="16"
73+
HorizontalAlignment="Right"
74+
VerticalAlignment="Top"
75+
Cursor="Hand" />
76+
</Grid>
77+
<Button
78+
x:Name="btn"
79+
Margin="5 0 5 5"
80+
HorizontalAlignment="Stretch"
81+
Content="fwafaw"
82+
Foreground="#dcdcdc" />
83+
</StackPanel>
84+
</Window>

0 commit comments

Comments
 (0)