Warn when using development build (#1248)

pull/1255/head
Oleksii Holub 4 months ago committed by GitHub
parent 520c06dceb
commit 429801183c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -15,9 +15,13 @@ public static class Program
public static string VersionString { get; } = Version.ToString(3);
public static bool IsDevelopmentBuild { get; } = Version.Major is <= 0 or >= 999;
public static string ProjectUrl { get; } = "https://github.com/Tyrrrz/DiscordChatExporter";
public static string DocumentationUrl { get; } = ProjectUrl + "/tree/master/.docs";
public static string ProjectReleasesUrl { get; } = $"{ProjectUrl}/releases";
public static string ProjectDocumentationUrl { get; } = ProjectUrl + "/tree/master/.docs";
public static AppBuilder BuildAvaloniaApp() =>
AppBuilder.Configure<App>().UsePlatformDetect().LogToTrace();

@ -102,7 +102,7 @@ public partial class DashboardViewModel : ViewModelBase
await _dialogManager.ShowDialogAsync(_viewModelManager.CreateSettingsViewModel());
[RelayCommand]
private void ShowHelp() => ProcessEx.StartShellExecute(Program.DocumentationUrl);
private void ShowHelp() => ProcessEx.StartShellExecute(Program.ProjectDocumentationUrl);
private bool CanPullGuilds() => !IsBusy && !string.IsNullOrWhiteSpace(Token);

@ -1,4 +1,5 @@
using System;
using System.Diagnostics;
using System.Threading.Tasks;
using Avalonia;
using CommunityToolkit.Mvvm.Input;
@ -46,6 +47,30 @@ public partial class MainViewModel(
ProcessEx.StartShellExecute("https://tyrrrz.me/ukraine?source=discordchatexporter");
}
private async Task ShowDevelopmentBuildMessageAsync()
{
if (!Program.IsDevelopmentBuild)
return;
// If debugging, the user is likely a developer
if (Debugger.IsAttached)
return;
var dialog = viewModelManager.CreateMessageBoxViewModel(
"Unstable build warning",
"""
You're using a development build of the application. These builds are not thoroughly tested and may contain bugs.
Auto-updates are disabled for development builds. If you want to switch to a stable release, please download it manually.
""",
"SEE RELEASES",
"CLOSE"
);
if (await dialogManager.ShowDialogAsync(dialog) == true)
ProcessEx.StartShellExecute(Program.ProjectReleasesUrl);
}
private async Task CheckForUpdatesAsync()
{
try
@ -80,6 +105,7 @@ public partial class MainViewModel(
private async Task InitializeAsync()
{
await ShowUkraineSupportMessageAsync();
await ShowDevelopmentBuildMessageAsync();
await CheckForUpdatesAsync();
}

Loading…
Cancel
Save