mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 03:48:56 +00:00
Added update history
This commit is contained in:
1 parent
ede29aa9f9
commit
5d01665d6e
11 files changed
+195
-74
No files matched your search
@@ -16,6 +16,7 @@ using Artemis.UI.Services.Updating;
|
||||
using Artemis.UI.Shared;
|
||||
using Artemis.UI.Shared.Providers;
|
||||
using Artemis.UI.Shared.Services;
|
||||
using Artemis.UI.Shared.Services.Builders;
|
||||
using Avalonia.Threading;
|
||||
using DryIoc;
|
||||
using DynamicData;
|
||||
@@ -162,14 +163,25 @@ public class GeneralTabViewModel : ActivatableViewModelBase
|
||||
|
||||
private async Task ExecuteCheckForUpdate(CancellationToken cancellationToken)
|
||||
{
|
||||
// If an update was available a popup was shown, no need to continue
|
||||
if (await _updateService.CheckForUpdate())
|
||||
return;
|
||||
try
|
||||
{
|
||||
// If an update was available a popup was shown, no need to continue
|
||||
if (await _updateService.CheckForUpdate())
|
||||
return;
|
||||
|
||||
_notificationService.CreateNotification()
|
||||
.WithTitle("No update available")
|
||||
.WithMessage("You are running the latest version in your current channel")
|
||||
.Show();
|
||||
_notificationService.CreateNotification()
|
||||
.WithTitle("No update available")
|
||||
.WithMessage("You are running the latest version in your current channel")
|
||||
.Show();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_notificationService.CreateNotification()
|
||||
.WithTitle("Failed to check for update")
|
||||
.WithMessage(e.Message)
|
||||
.WithSeverity(NotificationSeverity.Warning)
|
||||
.Show();
|
||||
}
|
||||
}
|
||||
|
||||
private async Task ExecuteShowSetupWizard()
|
||||
|
||||
@@ -9,6 +9,14 @@
|
||||
mc:Ignorable="d" d:DesignWidth="1000" d:DesignHeight="1400"
|
||||
x:Class="Artemis.UI.Screens.Settings.ReleasesTabView"
|
||||
x:DataType="settings:ReleasesTabViewModel">
|
||||
<UserControl.Styles>
|
||||
<Style Selector="avalonia|MaterialIcon.status-icon">
|
||||
<Setter Property="Width" Value="20" />
|
||||
<Setter Property="Height" Value="20" />
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource SystemAccentColorLight1}" />
|
||||
</Style>
|
||||
</UserControl.Styles>
|
||||
<Panel>
|
||||
<StackPanel VerticalAlignment="Center" MaxWidth="300" Spacing="15" IsVisible="{CompiledBinding Loading}">
|
||||
<TextBlock TextAlignment="Center">Loading releases...</TextBlock>
|
||||
@@ -16,9 +24,10 @@
|
||||
</StackPanel>
|
||||
<Panel IsVisible="{CompiledBinding !Loading}">
|
||||
<StackPanel VerticalAlignment="Center" Spacing="15" IsVisible="{CompiledBinding !ReleaseViewModels.Count}">
|
||||
<TextBlock TextAlignment="Center"
|
||||
TextWrapping="Wrap"
|
||||
Text="{CompiledBinding Channel, StringFormat='Found no releases for the \'{0}\' channel.'}"></TextBlock>
|
||||
<TextBlock TextAlignment="Center"
|
||||
TextWrapping="Wrap"
|
||||
Text="{CompiledBinding Channel, StringFormat='Found no releases for the \'{0}\' channel.'}">
|
||||
</TextBlock>
|
||||
<controls:HyperlinkButton NavigateUri="https://wiki.artemis-rgb.com/en/channels"
|
||||
HorizontalAlignment="Center">
|
||||
Learn more about channels on the wiki
|
||||
@@ -31,20 +40,15 @@
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate x:DataType="updating:ReleaseViewModel">
|
||||
<Panel>
|
||||
<Grid Margin="4" IsVisible="{CompiledBinding IsCurrentVersion}" RowDefinitions="*,*" ColumnDefinitions="*,Auto">
|
||||
<TextBlock Grid.Row="0" Grid.Column="0" Text="{CompiledBinding Version}" VerticalAlignment="Center" IsVisible="{CompiledBinding IsCurrentVersion}"
|
||||
FontWeight="SemiBold" />
|
||||
<Grid Margin="4" IsVisible="{CompiledBinding ShowStatusIndicator}" RowDefinitions="*,*" ColumnDefinitions="*,Auto">
|
||||
<TextBlock Grid.Row="0" Grid.Column="0" Text="{CompiledBinding Version}" VerticalAlignment="Center" FontWeight="SemiBold" />
|
||||
<TextBlock Grid.Row="1" Grid.Column="0" Text="{CompiledBinding CreatedAt, StringFormat={}{0:g}}" VerticalAlignment="Center" Classes="subtitle" FontSize="13" />
|
||||
<avalonia:MaterialIcon Grid.Row="0"
|
||||
Grid.Column="1"
|
||||
Grid.RowSpan="2"
|
||||
Kind="CheckCircle"
|
||||
ToolTip.Tip="Currently installed"
|
||||
Foreground="{DynamicResource SystemAccentColorLight3}"
|
||||
Width="20"
|
||||
Height="20" />
|
||||
<avalonia:MaterialIcon Classes="status-icon" Grid.Row="0" Grid.Column="1" Grid.RowSpan="2" Kind="CheckCircle" ToolTip.Tip="Current version"
|
||||
IsVisible="{CompiledBinding IsCurrentVersion}" />
|
||||
<avalonia:MaterialIcon Classes="status-icon" Grid.Row="0" Grid.Column="1" Grid.RowSpan="2" Kind="History" ToolTip.Tip="Previous version"
|
||||
IsVisible="{CompiledBinding IsPreviousVersion}" />
|
||||
</Grid>
|
||||
<StackPanel Margin="4" IsVisible="{CompiledBinding !IsCurrentVersion}">
|
||||
<StackPanel Margin="4" IsVisible="{CompiledBinding !ShowStatusIndicator}">
|
||||
<TextBlock Text="{CompiledBinding Version}" VerticalAlignment="Center" />
|
||||
<TextBlock Text="{CompiledBinding CreatedAt, StringFormat={}{0:g}}" VerticalAlignment="Center" Classes="subtitle" FontSize="13" />
|
||||
</StackPanel>
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:settings="clr-namespace:Artemis.UI.Screens.Settings"
|
||||
xmlns:updating="clr-namespace:Artemis.UI.Screens.Settings.Updating"
|
||||
xmlns:avalonia="clr-namespace:Markdown.Avalonia;assembly=Markdown.Avalonia"
|
||||
xmlns:mdc="clr-namespace:Markdown.Avalonia.Controls;assembly=Markdown.Avalonia"
|
||||
@@ -55,7 +54,7 @@
|
||||
</Style>
|
||||
</UserControl.Styles>
|
||||
|
||||
<Grid RowDefinitions="Auto,*" IsVisible="{CompiledBinding !Loading}" Classes="fade-in">
|
||||
<Grid RowDefinitions="Auto,*" IsVisible="{CompiledBinding Commit, Converter={x:Static StringConverters.IsNotNullOrEmpty}}" Classes="fade-in">
|
||||
<Border Grid.Row="0" Classes="card" Margin="0 0 0 10">
|
||||
<StackPanel>
|
||||
<Grid ColumnDefinitions="*,Auto">
|
||||
|
||||
@@ -25,11 +25,10 @@ public class ReleaseViewModel : ActivatableViewModelBase
|
||||
private readonly IUpdateService _updateService;
|
||||
private readonly Platform _updatePlatform;
|
||||
private readonly IUpdatingClient _updatingClient;
|
||||
private readonly IWindowService _windowService;
|
||||
private CancellationTokenSource? _installerCts;
|
||||
private string _changelog = string.Empty;
|
||||
private string _commit = string.Empty;
|
||||
private string _shortCommit = string.Empty;
|
||||
private string? _changelog;
|
||||
private string? _commit;
|
||||
private string? _shortCommit;
|
||||
private long _fileSize;
|
||||
private bool _installationAvailable;
|
||||
private bool _installationFinished;
|
||||
@@ -43,14 +42,12 @@ public class ReleaseViewModel : ActivatableViewModelBase
|
||||
ILogger logger,
|
||||
IUpdatingClient updatingClient,
|
||||
INotificationService notificationService,
|
||||
IUpdateService updateService,
|
||||
IWindowService windowService)
|
||||
IUpdateService updateService)
|
||||
{
|
||||
_logger = logger;
|
||||
_updatingClient = updatingClient;
|
||||
_notificationService = notificationService;
|
||||
_updateService = updateService;
|
||||
_windowService = windowService;
|
||||
|
||||
if (OperatingSystem.IsWindows())
|
||||
_updatePlatform = Platform.Windows;
|
||||
@@ -97,19 +94,19 @@ public class ReleaseViewModel : ActivatableViewModelBase
|
||||
public DateTimeOffset CreatedAt { get; }
|
||||
public ReleaseInstaller ReleaseInstaller { get; }
|
||||
|
||||
public string Changelog
|
||||
public string? Changelog
|
||||
{
|
||||
get => _changelog;
|
||||
set => RaiseAndSetIfChanged(ref _changelog, value);
|
||||
}
|
||||
|
||||
public string Commit
|
||||
public string? Commit
|
||||
{
|
||||
get => _commit;
|
||||
set => RaiseAndSetIfChanged(ref _commit, value);
|
||||
}
|
||||
|
||||
public string ShortCommit
|
||||
public string? ShortCommit
|
||||
{
|
||||
get => _shortCommit;
|
||||
set => RaiseAndSetIfChanged(ref _shortCommit, value);
|
||||
@@ -146,7 +143,9 @@ public class ReleaseViewModel : ActivatableViewModelBase
|
||||
}
|
||||
|
||||
public bool IsCurrentVersion => Version == Constants.CurrentVersion;
|
||||
|
||||
public bool IsPreviousVersion => Version == _updateService.PreviousVersion;
|
||||
public bool ShowStatusIndicator => IsCurrentVersion || IsPreviousVersion;
|
||||
|
||||
public void NavigateToSource()
|
||||
{
|
||||
Utilities.OpenUrl($"https://github.com/Artemis-RGB/Artemis/commit/{Commit}");
|
||||
@@ -159,14 +158,20 @@ public class ReleaseViewModel : ActivatableViewModelBase
|
||||
{
|
||||
InstallationInProgress = true;
|
||||
await ReleaseInstaller.InstallAsync(_installerCts.Token);
|
||||
_updateService.QueueUpdate();
|
||||
_updateService.QueueUpdate(Version);
|
||||
InstallationFinished = true;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
if (_installerCts.IsCancellationRequested)
|
||||
return;
|
||||
_windowService.ShowExceptionDialog("Failed to install update", e);
|
||||
|
||||
_logger.Warning(e, "Failed to install update through UI");
|
||||
_notificationService.CreateNotification()
|
||||
.WithTitle("Failed to install update")
|
||||
.WithMessage(e.Message)
|
||||
.WithSeverity(NotificationSeverity.Warning)
|
||||
.Show();
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user