Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions Flow.Launcher.Core/Updater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,24 @@
{
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);
Expand Down Expand Up @@ -81,7 +89,7 @@
}
else
{
await updateManager.CreateUninstallerRegistryEntry().ConfigureAwait(false);

Check warning on line 92 in Flow.Launcher.Core/Updater.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`Uninstaller` is not a recognized word. (unrecognized-spelling)
}

var newVersionTips = NewVersionTips(newReleaseVersion.ToString());
Expand Down
2 changes: 2 additions & 0 deletions Flow.Launcher.Infrastructure/UserSettings/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@ public string SettingWindowFont
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
{
Expand Down
6 changes: 5 additions & 1 deletion Flow.Launcher/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
using Flow.Launcher.Plugin;
using Flow.Launcher.SettingPages.ViewModels;
using Flow.Launcher.ViewModel;
using iNKORE.UI.WPF.Modern.Common;

Check warning on line 25 in Flow.Launcher/App.xaml.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`NKORE` is not a recognized word. (unrecognized-spelling)
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.VisualStudio.Threading;
Expand Down Expand Up @@ -70,7 +70,11 @@
.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>()
Expand Down Expand Up @@ -229,7 +233,7 @@
// Update plugin titles after plugins are initialized with their api instances
Internationalization.UpdatePluginMetadataTranslations();

await imageLoadertask;

Check warning on line 236 in Flow.Launcher/App.xaml.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`Loadertask` is not a recognized word. (unrecognized-spelling)

_mainWindow = new MainWindow();

Expand Down
12 changes: 12 additions & 0 deletions Flow.Launcher/Flow.Launcher.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
3 changes: 3 additions & 0 deletions Flow.Launcher/Languages/en.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,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>
Expand Down
13 changes: 11 additions & 2 deletions Flow.Launcher/Properties/Settings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Flow.Launcher/Properties/Settings.settings
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,16 @@
};

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> { }

Expand Down Expand Up @@ -113,8 +123,8 @@
private void AskClearCacheFolderConfirmation()
{
var confirmResult = App.API.ShowMsgBox(
Localize.clearcachefolderMessage(),

Check warning on line 126 in Flow.Launcher/SettingPages/ViewModels/SettingsPaneAboutViewModel.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`clearcachefolder` is not a recognized word. (unrecognized-spelling)
Localize.clearcachefolder(),

Check warning on line 127 in Flow.Launcher/SettingPages/ViewModels/SettingsPaneAboutViewModel.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`clearcachefolder` is not a recognized word. (unrecognized-spelling)
MessageBoxButton.YesNo
);

Expand All @@ -122,7 +132,7 @@
{
if (!ClearCacheFolder())
{
App.API.ShowMsgBox(Localize.clearfolderfailMessage());

Check warning on line 135 in Flow.Launcher/SettingPages/ViewModels/SettingsPaneAboutViewModel.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`clearfolderfail` is not a recognized word. (unrecognized-spelling)
}
}
}
Expand Down
18 changes: 14 additions & 4 deletions Flow.Launcher/SettingPages/Views/SettingsPaneAbout.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand All @@ -49,6 +45,20 @@
</ikw:SimpleStackPanel>
</ui:SettingsCard>

<ui:SettingsCard Margin="0 4 0 0" Header="{DynamicResource updateSource}">
<ui:SettingsCard.HeaderIcon>
<ui:FontIcon Glyph="&#xE777;" />
</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="&#xe8fd;" />
Expand All @@ -60,7 +70,7 @@
<ui:SettingsCard
Margin="0 14 0 0"
Description="{DynamicResource userdatapathToolTip}"
Header="{DynamicResource userdatapath}">

Check warning on line 73 in Flow.Launcher/SettingPages/Views/SettingsPaneAbout.xaml

View workflow job for this annotation

GitHub Actions / Check Spelling

`userdatapath` is not a recognized word. (unrecognized-spelling)
<ui:SettingsCard.HeaderIcon>
<ui:FontIcon Glyph="&#xEC25;" />
</ui:SettingsCard.HeaderIcon>
Expand Down
2 changes: 1 addition & 1 deletion Flow.Launcher/SettingWindow.xaml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
Loading