mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Add prerelease combo box
This commit is contained in:
parent
75397f11c6
commit
35594be2f0
4 changed files with 29 additions and 7 deletions
|
|
@ -25,14 +25,16 @@ namespace Flow.Launcher.Core
|
|||
public string GitHubReleaseRepository { get; }
|
||||
public string GitHubPrereleaseRepository { get; }
|
||||
|
||||
public bool UpdateToPrerelease { get; set; }
|
||||
public bool UpdateToPrerelease => _settings.PrereleaseUpdateSource;
|
||||
|
||||
public string GitHubRepository => UpdateToPrerelease ? GitHubPrereleaseRepository : GitHubReleaseRepository;
|
||||
|
||||
private readonly Settings _settings;
|
||||
private readonly IPublicAPI _api;
|
||||
|
||||
public Updater(IPublicAPI publicAPI, string gitHubReleaseRepository, string gitHubPrereleaseRepository)
|
||||
public Updater(Settings settings, IPublicAPI publicAPI, string gitHubReleaseRepository, string gitHubPrereleaseRepository)
|
||||
{
|
||||
_settings = settings;
|
||||
_api = publicAPI;
|
||||
GitHubReleaseRepository = gitHubReleaseRepository;
|
||||
GitHubPrereleaseRepository = gitHubPrereleaseRepository;
|
||||
|
|
|
|||
|
|
@ -55,7 +55,11 @@ namespace Flow.Launcher
|
|||
.UseContentRoot(AppContext.BaseDirectory)
|
||||
.ConfigureServices(services => services
|
||||
.AddSingleton(_ => _settings)
|
||||
.AddSingleton(sp => new Updater(sp.GetRequiredService<IPublicAPI>(), Launcher.Properties.Settings.Default.GithubRepo, Launcher.Properties.Settings.Default.PrereleaseRepo))
|
||||
.AddSingleton(sp => new Updater(
|
||||
_settings,
|
||||
sp.GetRequiredService<IPublicAPI>(),
|
||||
Launcher.Properties.Settings.Default.GithubRepo,
|
||||
Launcher.Properties.Settings.Default.PrereleaseRepo))
|
||||
.AddSingleton<Portable>()
|
||||
.AddSingleton<SettingWindowViewModel>()
|
||||
.AddSingleton<IAlphabet, PinyinAlphabet>()
|
||||
|
|
|
|||
|
|
@ -45,6 +45,16 @@ public partial class SettingsPaneAboutViewModel : BaseModel
|
|||
_settings.ActivateTimes
|
||||
);
|
||||
|
||||
public int PrereleaseSelectedIndex
|
||||
{
|
||||
get => _settings.PrereleaseUpdateSource ? 1 : 0;
|
||||
set
|
||||
{
|
||||
_settings.PrereleaseUpdateSource = value == 1;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public SettingsPaneAboutViewModel(Settings settings, Updater updater)
|
||||
{
|
||||
_settings = settings;
|
||||
|
|
|
|||
|
|
@ -31,10 +31,6 @@
|
|||
Icon=""
|
||||
Sub="{DynamicResource version}">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Button
|
||||
Margin="0 0 10 0"
|
||||
Command="{Binding UpdateAppCommand}"
|
||||
Content="{DynamicResource checkUpdates}" />
|
||||
<Button Padding="0" Style="{StaticResource AccentButtonStyle}">
|
||||
<Hyperlink
|
||||
NavigateUri="{Binding SponsorPage}"
|
||||
|
|
@ -49,6 +45,16 @@
|
|||
</StackPanel>
|
||||
</cc:Card>
|
||||
|
||||
<cc:Card Title="{DynamicResource updateSource}">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<ComboBox Margin="0 0 10 0" SelectedIndex="{Binding PrereleaseSelectedIndex}">
|
||||
<ComboBoxItem Content="{DynamicResource release}" />
|
||||
<ComboBoxItem Content="{DynamicResource prerelease}" />
|
||||
</ComboBox>
|
||||
<Button Command="{Binding UpdateAppCommand}" Content="{DynamicResource checkUpdates}" />
|
||||
</StackPanel>
|
||||
</cc:Card>
|
||||
|
||||
<cc:Card Title="{DynamicResource releaseNotes}" Icon="">
|
||||
<cc:HyperLink Text="{DynamicResource releaseNotes}" Uri="{Binding ReleaseNotes}" />
|
||||
</cc:Card>
|
||||
|
|
|
|||
Loading…
Reference in a new issue