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 class Updater
|
||||||
{
|
{
|
||||||
public string GitHubRepository { get; init; }
|
public string GitHubReleaseRepository { get; }
|
||||||
|
public string GitHubPrereleaseRepository { get; }
|
||||||
|
|
||||||
private static readonly string ClassName = nameof(Updater);
|
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;
|
private readonly IPublicAPI _api;
|
||||||
|
|
||||||
public Updater(IPublicAPI publicAPI, string gitHubRepository)
|
public Updater(Settings settings, IPublicAPI publicAPI, string gitHubReleaseRepository, string gitHubPrereleaseRepository)
|
||||||
{
|
{
|
||||||
|
_settings = settings;
|
||||||
_api = publicAPI;
|
_api = publicAPI;
|
||||||
GitHubRepository = gitHubRepository;
|
GitHubReleaseRepository = gitHubReleaseRepository;
|
||||||
|
GitHubPrereleaseRepository = gitHubPrereleaseRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
private SemaphoreSlim UpdateLock { get; } = new SemaphoreSlim(1);
|
private SemaphoreSlim UpdateLock { get; } = new SemaphoreSlim(1);
|
||||||
|
|
|
||||||
|
|
@ -175,6 +175,8 @@ namespace Flow.Launcher.Infrastructure.UserSettings
|
||||||
public double? SettingWindowLeft { get; set; } = null;
|
public double? SettingWindowLeft { get; set; } = null;
|
||||||
public WindowState SettingWindowState { get; set; } = WindowState.Normal;
|
public WindowState SettingWindowState { get; set; } = WindowState.Normal;
|
||||||
|
|
||||||
|
public bool PrereleaseUpdateSource { get; set; }
|
||||||
|
|
||||||
private bool _showPlaceholder { get; set; } = true;
|
private bool _showPlaceholder { get; set; } = true;
|
||||||
public bool ShowPlaceholder
|
public bool ShowPlaceholder
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,11 @@ namespace Flow.Launcher
|
||||||
.UseContentRoot(AppContext.BaseDirectory)
|
.UseContentRoot(AppContext.BaseDirectory)
|
||||||
.ConfigureServices(services => services
|
.ConfigureServices(services => services
|
||||||
.AddSingleton(_ => _settings)
|
.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<Portable>()
|
||||||
.AddSingleton<IAlphabet, PinyinAlphabet>()
|
.AddSingleton<IAlphabet, PinyinAlphabet>()
|
||||||
.AddSingleton<StringMatcher>()
|
.AddSingleton<StringMatcher>()
|
||||||
|
|
|
||||||
|
|
@ -171,6 +171,18 @@
|
||||||
</Content>
|
</Content>
|
||||||
</ItemGroup>
|
</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>
|
<ItemGroup>
|
||||||
<None Update="Resources\dev.ico">
|
<None Update="Resources\dev.ico">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<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="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="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="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="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="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>
|
<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>
|
// <auto-generated>
|
||||||
// This code was generated by a tool.
|
// This code was generated by a tool.
|
||||||
// Runtime Version:4.0.30319.42000
|
// Runtime Version:4.0.30319.42000
|
||||||
|
|
@ -12,7 +12,7 @@ namespace Flow.Launcher.Properties {
|
||||||
|
|
||||||
|
|
||||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
[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 {
|
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||||
|
|
||||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||||
|
|
@ -31,5 +31,14 @@ namespace Flow.Launcher.Properties {
|
||||||
return ((string)(this["GithubRepo"]));
|
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">
|
<Setting Name="GithubRepo" Type="System.String" Scope="Application">
|
||||||
<Value Profile="(Default)">https://github.com/Flow-Launcher/Flow.Launcher</Value>
|
<Value Profile="(Default)">https://github.com/Flow-Launcher/Flow.Launcher</Value>
|
||||||
</Setting>
|
</Setting>
|
||||||
|
<Setting Name="PrereleaseRepo" Type="System.String" Scope="Application">
|
||||||
|
<Value Profile="(Default)">https://github.com/Flow-Launcher/Prereleases</Value>
|
||||||
|
</Setting>
|
||||||
</Settings>
|
</Settings>
|
||||||
</SettingsFile>
|
</SettingsFile>
|
||||||
|
|
@ -53,6 +53,16 @@ public partial class SettingsPaneAboutViewModel : BaseModel
|
||||||
|
|
||||||
public string ActivatedTimes => Localize.about_activate_times(_settings.ActivateTimes);
|
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> { }
|
public class LogLevelData : DropdownDataGeneric<LOGLEVEL> { }
|
||||||
|
|
||||||
public List<LogLevelData> LogLevels { get; } =
|
public List<LogLevelData> LogLevels { get; } =
|
||||||
|
|
|
||||||
|
|
@ -36,10 +36,6 @@
|
||||||
</ui:SettingsCard.HeaderIcon>
|
</ui:SettingsCard.HeaderIcon>
|
||||||
|
|
||||||
<ikw:SimpleStackPanel Orientation="Horizontal" Spacing="12">
|
<ikw:SimpleStackPanel Orientation="Horizontal" Spacing="12">
|
||||||
<Button
|
|
||||||
x:Name="UpdateAppButton"
|
|
||||||
Command="{Binding UpdateAppCommand}"
|
|
||||||
Content="{DynamicResource checkUpdates}" />
|
|
||||||
<Button
|
<Button
|
||||||
Height="{Binding ElementName=UpdateAppButton, Path=ActualHeight}"
|
Height="{Binding ElementName=UpdateAppButton, Path=ActualHeight}"
|
||||||
Command="{Binding OpenSponsorPageCommand}"
|
Command="{Binding OpenSponsorPageCommand}"
|
||||||
|
|
@ -49,6 +45,20 @@
|
||||||
</ikw:SimpleStackPanel>
|
</ikw:SimpleStackPanel>
|
||||||
</ui:SettingsCard>
|
</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 Margin="0 4 0 0" Header="{DynamicResource releaseNotes}">
|
||||||
<ui:SettingsCard.HeaderIcon>
|
<ui:SettingsCard.HeaderIcon>
|
||||||
<ui:FontIcon Glyph="" />
|
<ui:FontIcon Glyph="" />
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
<Window
|
<Window
|
||||||
x:Class="Flow.Launcher.SettingWindow"
|
x:Class="Flow.Launcher.SettingWindow"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue