Skip to content

Commit 35594be

Browse files
committed
Add prerelease combo box
1 parent 75397f1 commit 35594be

File tree

4 files changed

+29
-7
lines changed

4 files changed

+29
-7
lines changed

Flow.Launcher.Core/Updater.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,16 @@ public class Updater
2525
public string GitHubReleaseRepository { get; }
2626
public string GitHubPrereleaseRepository { get; }
2727

28-
public bool UpdateToPrerelease { get; set; }
28+
public bool UpdateToPrerelease => _settings.PrereleaseUpdateSource;
2929

3030
public string GitHubRepository => UpdateToPrerelease ? GitHubPrereleaseRepository : GitHubReleaseRepository;
3131

32+
private readonly Settings _settings;
3233
private readonly IPublicAPI _api;
3334

34-
public Updater(IPublicAPI publicAPI, string gitHubReleaseRepository, string gitHubPrereleaseRepository)
35+
public Updater(Settings settings, IPublicAPI publicAPI, string gitHubReleaseRepository, string gitHubPrereleaseRepository)
3536
{
37+
_settings = settings;
3638
_api = publicAPI;
3739
GitHubReleaseRepository = gitHubReleaseRepository;
3840
GitHubPrereleaseRepository = gitHubPrereleaseRepository;

Flow.Launcher/App.xaml.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,11 @@ public App()
5555
.UseContentRoot(AppContext.BaseDirectory)
5656
.ConfigureServices(services => services
5757
.AddSingleton(_ => _settings)
58-
.AddSingleton(sp => new Updater(sp.GetRequiredService<IPublicAPI>(), Launcher.Properties.Settings.Default.GithubRepo, Launcher.Properties.Settings.Default.PrereleaseRepo))
58+
.AddSingleton(sp => new Updater(
59+
_settings,
60+
sp.GetRequiredService<IPublicAPI>(),
61+
Launcher.Properties.Settings.Default.GithubRepo,
62+
Launcher.Properties.Settings.Default.PrereleaseRepo))
5963
.AddSingleton<Portable>()
6064
.AddSingleton<SettingWindowViewModel>()
6165
.AddSingleton<IAlphabet, PinyinAlphabet>()

Flow.Launcher/SettingPages/ViewModels/SettingsPaneAboutViewModel.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,16 @@ public string LogFolderSize
4545
_settings.ActivateTimes
4646
);
4747

48+
public int PrereleaseSelectedIndex
49+
{
50+
get => _settings.PrereleaseUpdateSource ? 1 : 0;
51+
set
52+
{
53+
_settings.PrereleaseUpdateSource = value == 1;
54+
OnPropertyChanged();
55+
}
56+
}
57+
4858
public SettingsPaneAboutViewModel(Settings settings, Updater updater)
4959
{
5060
_settings = settings;

Flow.Launcher/SettingPages/Views/SettingsPaneAbout.xaml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,6 @@
3131
Icon="&#xe946;"
3232
Sub="{DynamicResource version}">
3333
<StackPanel Orientation="Horizontal">
34-
<Button
35-
Margin="0 0 10 0"
36-
Command="{Binding UpdateAppCommand}"
37-
Content="{DynamicResource checkUpdates}" />
3834
<Button Padding="0" Style="{StaticResource AccentButtonStyle}">
3935
<Hyperlink
4036
NavigateUri="{Binding SponsorPage}"
@@ -49,6 +45,16 @@
4945
</StackPanel>
5046
</cc:Card>
5147

48+
<cc:Card Title="{DynamicResource updateSource}">
49+
<StackPanel Orientation="Horizontal">
50+
<ComboBox Margin="0 0 10 0" SelectedIndex="{Binding PrereleaseSelectedIndex}">
51+
<ComboBoxItem Content="{DynamicResource release}" />
52+
<ComboBoxItem Content="{DynamicResource prerelease}" />
53+
</ComboBox>
54+
<Button Command="{Binding UpdateAppCommand}" Content="{DynamicResource checkUpdates}" />
55+
</StackPanel>
56+
</cc:Card>
57+
5258
<cc:Card Title="{DynamicResource releaseNotes}" Icon="&#xe8fd;">
5359
<cc:HyperLink Text="{DynamicResource releaseNotes}" Uri="{Binding ReleaseNotes}" />
5460
</cc:Card>

0 commit comments

Comments
 (0)