Skip to content

"Release Channel" Function #2017

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 15 commits into
base: dev
Choose a base branch
from
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
16 changes: 12 additions & 4 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 @@ -102,7 +110,7 @@
{
_api.LogException(ClassName, $"Error Occurred", e);
}

if (!silentUpdate)
_api.ShowMsg(_api.GetTranslation("update_flowlauncher_fail"),
_api.GetTranslation("update_flowlauncher_check_connection"));
Expand Down Expand Up @@ -138,7 +146,7 @@
var latest = releases.Where(r => !r.Prerelease).OrderByDescending(r => r.PublishedAt).First();
var latestUrl = latest.HtmlUrl.Replace("/tag/", "/download/");

var client = new WebClient

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

View workflow job for this annotation

GitHub Actions / build

'WebClient.WebClient()' is obsolete: 'WebRequest, HttpWebRequest, ServicePoint, and WebClient are obsolete. Use HttpClient instead.' (https://aka.ms/dotnet-warnings/SYSLIB0014)
{
Proxy = Http.WebProxy
};
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 @@ -134,6 +134,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 @@ -60,7 +60,7 @@
var storage = new FlowLauncherJsonStorage<Settings>();
_settings = storage.Load();
_settings.SetStorage(storage);
_settings.WMPInstalled = WindowsMediaPlayerHelper.IsWindowsMediaPlayerInstalled();

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

View workflow job for this annotation

GitHub Actions / Check Spelling

`WMP` is not a recognized word. (unrecognized-spelling)
}
catch (Exception e)
{
Expand All @@ -75,7 +75,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 @@ -103,7 +107,7 @@
.AddTransient<SelectBrowserViewModel>()
.AddTransient<SelectFileManagerViewModel>()
).Build();
Ioc.Default.ConfigureServices(host.Services);

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

View workflow job for this annotation

GitHub Actions / Check Spelling

`Ioc` is not a recognized word. (unrecognized-spelling)
}
catch (Exception e)
{
Expand All @@ -114,9 +118,9 @@
// Initialize the public API and Settings first
try
{
API = Ioc.Default.GetRequiredService<IPublicAPI>();

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

View workflow job for this annotation

GitHub Actions / Check Spelling

`Ioc` is not a recognized word. (unrecognized-spelling)
_settings.Initialize();
_mainVM = Ioc.Default.GetRequiredService<MainViewModel>();

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

View workflow job for this annotation

GitHub Actions / Check Spelling

`Ioc` is not a recognized word. (unrecognized-spelling)
}
catch (Exception e)
{
Expand Down Expand Up @@ -173,7 +177,7 @@

Notification.Install();

Ioc.Default.GetRequiredService<Portable>().PreStartCleanUpAfterPortabilityUpdate();

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

View workflow job for this annotation

GitHub Actions / Check Spelling

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

API.LogInfo(ClassName, "Begin Flow Launcher startup ----------------------------------------------------");
API.LogInfo(ClassName, $"Runtime info:{ErrorReporting.RuntimeInfo()}");
Expand All @@ -198,7 +202,7 @@
// Change language after all plugins are initialized because we need to update plugin title based on their api
await Ioc.Default.GetRequiredService<Internationalization>().InitializeLanguageAsync();

await imageLoadertask;

Check warning on line 205 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 All @@ -224,7 +228,7 @@
});
}

#pragma warning restore VSTHRD100 // Avoid async void methods

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

View workflow job for this annotation

GitHub Actions / Check Spelling

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

/// <summary>
/// Check startup only for Release
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 @@ -123,6 +123,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 @@ -356,6 +356,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 @@ -55,7 +55,17 @@
App.API.GetTranslation("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 List<LogLevelData> LogLevels { get; } =
Expand Down Expand Up @@ -116,8 +126,8 @@
private void AskClearCacheFolderConfirmation()
{
var confirmResult = App.API.ShowMsgBox(
App.API.GetTranslation("clearcachefolderMessage"),

Check warning on line 129 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)
App.API.GetTranslation("clearcachefolder"),

Check warning on line 130 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 @@ -125,7 +135,7 @@
{
if (!ClearCacheFolder())
{
App.API.ShowMsgBox(App.API.GetTranslation("clearfolderfailMessage"));

Check warning on line 138 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
14 changes: 10 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 @@
Icon="&#xe946;"
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}"
Expand All @@ -54,6 +50,16 @@
</StackPanel>
</cc:Card>

<cc:Card Title="{DynamicResource updateSource}" Icon="&#xE777;">
<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="&#xe8fd;">
<Button Command="{Binding OpenReleaseNotesCommand}" Content="{DynamicResource releaseNotes}" />
</cc:Card>
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