mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Merge fe9669721f into 24f6c90f72
This commit is contained in:
commit
ad1cd7e3f0
10 changed files with 72 additions and 11 deletions
|
|
@ -21,16 +21,24 @@ namespace Flow.Launcher.Core
|
|||
{
|
||||
public class Updater
|
||||
{
|
||||
public string GitHubRepository { get; init; }
|
||||
public string GitHubReleaseRepository { get; }
|
||||
public string GitHubPrereleaseRepository { get; }
|
||||
|
||||
private static readonly string ClassName = nameof(Updater);
|
||||
|
||||
public bool UpdateToPrerelease => _settings.PrereleaseUpdateSource;
|
||||
|
||||
public string GitHubRepository => UpdateToPrerelease ? GitHubPrereleaseRepository : GitHubReleaseRepository;
|
||||
|
||||
private readonly Settings _settings;
|
||||
private readonly IPublicAPI _api;
|
||||
|
||||
public Updater(IPublicAPI publicAPI, string gitHubRepository)
|
||||
public Updater(Settings settings, IPublicAPI publicAPI, string gitHubReleaseRepository, string gitHubPrereleaseRepository)
|
||||
{
|
||||
_settings = settings;
|
||||
_api = publicAPI;
|
||||
GitHubRepository = gitHubRepository;
|
||||
GitHubReleaseRepository = gitHubReleaseRepository;
|
||||
GitHubPrereleaseRepository = gitHubPrereleaseRepository;
|
||||
}
|
||||
|
||||
private SemaphoreSlim UpdateLock { get; } = new SemaphoreSlim(1);
|
||||
|
|
|
|||
|
|
@ -175,6 +175,8 @@ namespace Flow.Launcher.Infrastructure.UserSettings
|
|||
public double? SettingWindowLeft { get; set; } = null;
|
||||
public WindowState SettingWindowState { get; set; } = WindowState.Normal;
|
||||
|
||||
public bool PrereleaseUpdateSource { get; set; }
|
||||
|
||||
private bool _showPlaceholder { get; set; } = true;
|
||||
public bool ShowPlaceholder
|
||||
{
|
||||
|
|
|
|||
|
|
@ -70,7 +70,11 @@ namespace Flow.Launcher
|
|||
.UseContentRoot(AppContext.BaseDirectory)
|
||||
.ConfigureServices(services => services
|
||||
.AddSingleton(_ => _settings)
|
||||
.AddSingleton(sp => new Updater(sp.GetRequiredService<IPublicAPI>(), Launcher.Properties.Settings.Default.GithubRepo))
|
||||
.AddSingleton(sp => new Updater(
|
||||
_settings,
|
||||
sp.GetRequiredService<IPublicAPI>(),
|
||||
Launcher.Properties.Settings.Default.GithubRepo,
|
||||
Launcher.Properties.Settings.Default.PrereleaseRepo))
|
||||
.AddSingleton<Portable>()
|
||||
.AddSingleton<IAlphabet, PinyinAlphabet>()
|
||||
.AddSingleton<StringMatcher>()
|
||||
|
|
|
|||
|
|
@ -171,6 +171,18 @@
|
|||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="Properties\Settings.Designer.cs">
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
</Compile>
|
||||
<None Update="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="Resources\dev.ico">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
|
|
|
|||
|
|
@ -473,6 +473,9 @@
|
|||
<system:String x:Key="clearcachefolderMessage">Are you sure you want to delete all caches?</system:String>
|
||||
<system:String x:Key="clearfolderfailMessage">Failed to clear part of folders and files. Please see log file for more information</system:String>
|
||||
<system:String x:Key="welcomewindow">Wizard</system:String>
|
||||
<system:String x:Key="updateSource">Release Channel</system:String>
|
||||
<system:String x:Key="release">Stable</system:String>
|
||||
<system:String x:Key="prerelease">Pre-release</system:String>
|
||||
<system:String x:Key="userdatapath">User Data Location</system:String>
|
||||
<system:String x:Key="userdatapathToolTip">User settings and installed plugins are saved in the user data folder. This location may vary depending on whether it's in portable mode or not.</system:String>
|
||||
<system:String x:Key="userdatapathButton">Open Folder</system:String>
|
||||
|
|
|
|||
13
Flow.Launcher/Properties/Settings.Designer.cs
generated
13
Flow.Launcher/Properties/Settings.Designer.cs
generated
|
|
@ -1,4 +1,4 @@
|
|||
//------------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
|
|
@ -12,7 +12,7 @@ namespace Flow.Launcher.Properties {
|
|||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.4.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.13.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
|
@ -31,5 +31,14 @@ namespace Flow.Launcher.Properties {
|
|||
return ((string)(this["GithubRepo"]));
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("https://github.com/Flow-Launcher/Prereleases")]
|
||||
public string PrereleaseRepo {
|
||||
get {
|
||||
return ((string)(this["PrereleaseRepo"]));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,5 +5,8 @@
|
|||
<Setting Name="GithubRepo" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)">https://github.com/Flow-Launcher/Flow.Launcher</Value>
|
||||
</Setting>
|
||||
<Setting Name="PrereleaseRepo" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)">https://github.com/Flow-Launcher/Prereleases</Value>
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
||||
|
|
@ -52,6 +52,16 @@ public partial class SettingsPaneAboutViewModel : BaseModel
|
|||
};
|
||||
|
||||
public string ActivatedTimes => Localize.about_activate_times(_settings.ActivateTimes);
|
||||
|
||||
public int PrereleaseSelectedIndex
|
||||
{
|
||||
get => _settings.PrereleaseUpdateSource ? 1 : 0;
|
||||
set
|
||||
{
|
||||
_settings.PrereleaseUpdateSource = value == 1;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public class LogLevelData : DropdownDataGeneric<LOGLEVEL> { }
|
||||
|
||||
|
|
|
|||
|
|
@ -36,10 +36,6 @@
|
|||
</ui:SettingsCard.HeaderIcon>
|
||||
|
||||
<ikw:SimpleStackPanel Orientation="Horizontal" Spacing="12">
|
||||
<Button
|
||||
x:Name="UpdateAppButton"
|
||||
Command="{Binding UpdateAppCommand}"
|
||||
Content="{DynamicResource checkUpdates}" />
|
||||
<Button
|
||||
Height="{Binding ElementName=UpdateAppButton, Path=ActualHeight}"
|
||||
Command="{Binding OpenSponsorPageCommand}"
|
||||
|
|
@ -49,6 +45,20 @@
|
|||
</ikw:SimpleStackPanel>
|
||||
</ui:SettingsCard>
|
||||
|
||||
<ui:SettingsCard Margin="0 4 0 0" Header="{DynamicResource updateSource}">
|
||||
<ui:SettingsCard.HeaderIcon>
|
||||
<ui:FontIcon Glyph="" />
|
||||
</ui:SettingsCard.HeaderIcon>
|
||||
|
||||
<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>
|
||||
</ui:SettingsCard>
|
||||
|
||||
<ui:SettingsCard Margin="0 4 0 0" Header="{DynamicResource releaseNotes}">
|
||||
<ui:SettingsCard.HeaderIcon>
|
||||
<ui:FontIcon Glyph="" />
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<Window
|
||||
<Window
|
||||
x:Class="Flow.Launcher.SettingWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
|
|
|
|||
Loading…
Reference in a new issue