chore: perform resharper cleanup

This commit is contained in:
achiez
2026-03-13 14:54:33 +02:00
parent da00fa5c96
commit 1ab2f99783
21 changed files with 127 additions and 124 deletions
+3 -3
View File
@@ -2,7 +2,6 @@ using System.Collections.Generic;
using System.Threading.Tasks; using System.Threading.Tasks;
using AutoUpdaterDotNET; using AutoUpdaterDotNET;
using MaterialDesignThemes.Wpf; using MaterialDesignThemes.Wpf;
using Microsoft.Win32;
using NebulaAuth.Model; using NebulaAuth.Model;
using NebulaAuth.Model.Entities; using NebulaAuth.Model.Entities;
using NebulaAuth.Model.Update; using NebulaAuth.Model.Update;
@@ -55,7 +54,7 @@ public static class DialogsController
} }
/// <summary> /// <summary>
/// Shows the SDA encryption password dialog for unlocking SDA-encrypted mafiles. /// Shows the SDA encryption password dialog for unlocking SDA-encrypted mafiles.
/// </summary> /// </summary>
/// <returns>The entered password if user clicked OK, otherwise null.</returns> /// <returns>The entered password if user clicked OK, otherwise null.</returns>
public static async Task<string?> ShowSdaPasswordDialog() public static async Task<string?> ShowSdaPasswordDialog()
@@ -73,6 +72,7 @@ public static class DialogsController
return null; return null;
} }
public static async Task<bool> ShowProxyManager() public static async Task<bool> ShowProxyManager()
{ {
var vm = new ProxyManagerVM(); var vm = new ProxyManagerVM();
@@ -163,7 +163,7 @@ public static class DialogsController
var content = msg == null ? new ConfirmCancelDialog() : new ConfirmCancelDialog(msg); var content = msg == null ? new ConfirmCancelDialog() : new ConfirmCancelDialog(msg);
var result = await DialogHost.Show(content); var result = await DialogHost.Show(content);
return result != null && (bool)result; return result != null && (bool) result;
} }
public static async Task<string?> ShowTextFieldDialog(string? title = null, string? msg = null) public static async Task<string?> ShowTextFieldDialog(string? title = null, string? msg = null)
+11 -8
View File
@@ -1,11 +1,11 @@
using AutoUpdaterDotNET; using System;
using NebulaAuth.Model;
using NebulaAuth.Model.Update;
using Newtonsoft.Json;
using System;
using System.IO; using System.IO;
using System.Net.Http; using System.Net.Http;
using System.Windows; using System.Windows;
using AutoUpdaterDotNET;
using NebulaAuth.Model;
using NebulaAuth.Model.Update;
using Newtonsoft.Json;
namespace NebulaAuth.Core; namespace NebulaAuth.Core;
@@ -13,6 +13,7 @@ public static class UpdateManager
{ {
private const string BASE_URL = private const string BASE_URL =
"https://raw.githubusercontent.com/achiez/NebulaAuth-Steam-Desktop-Authenticator-by-Achies/master/"; "https://raw.githubusercontent.com/achiez/NebulaAuth-Steam-Desktop-Authenticator-by-Achies/master/";
private const string UPDATE_URL = BASE_URL + "NebulaAuth/update.xml"; private const string UPDATE_URL = BASE_URL + "NebulaAuth/update.xml";
private const string CHANGELOG_BASE_URL = BASE_URL + "changelog/"; private const string CHANGELOG_BASE_URL = BASE_URL + "changelog/";
@@ -21,13 +22,14 @@ public static class UpdateManager
private static bool _isManualCheck; private static bool _isManualCheck;
public static bool HasPendingUpdate { get; private set; } public static bool HasPendingUpdate { get; private set; }
public static event Action? PendingUpdateDetected;
static UpdateManager() static UpdateManager()
{ {
AutoUpdater.CheckForUpdateEvent += HandleCheckForUpdateEvent; AutoUpdater.CheckForUpdateEvent += HandleCheckForUpdateEvent;
} }
public static event Action? PendingUpdateDetected;
public static void CheckForUpdates(bool manual = false) public static void CheckForUpdates(bool manual = false)
{ {
_isManualCheck = manual; _isManualCheck = manual;
@@ -62,7 +64,8 @@ public static class UpdateManager
if (isManual) if (isManual)
{ {
Application.Current.Dispatcher.Invoke(() => Application.Current.Dispatcher.Invoke(() =>
SnackbarController.SendSnackbar(LocManager.GetCommonOrDefault("Request error", "RequestError"))); SnackbarController.SendSnackbar(LocManager.GetCommonOrDefault("Request error",
"RequestError")));
} }
return; return;
@@ -81,7 +84,7 @@ public static class UpdateManager
return; return;
} }
var version = args.CurrentVersion.ToString(); var version = args.CurrentVersion;
var settings = UpdateSettings.Load(); var settings = UpdateSettings.Load();
if (!isManual && !settings.ShouldShow(version)) if (!isManual && !settings.ShouldShow(version))
+9 -8
View File
@@ -1,10 +1,4 @@
using MaterialDesignThemes.Wpf; using System;
using NebulaAuth.Core;
using NebulaAuth.Model;
using NebulaAuth.View.Dialogs;
using NebulaAuth.ViewModel;
using NebulaAuth.ViewModel.Other;
using System;
using System.Reflection; using System.Reflection;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows; using System.Windows;
@@ -13,6 +7,12 @@ using System.Windows.Input;
using System.Windows.Media; using System.Windows.Media;
using System.Windows.Media.Animation; using System.Windows.Media.Animation;
using System.Windows.Threading; using System.Windows.Threading;
using MaterialDesignThemes.Wpf;
using NebulaAuth.Core;
using NebulaAuth.Model;
using NebulaAuth.View.Dialogs;
using NebulaAuth.ViewModel;
using NebulaAuth.ViewModel.Other;
namespace NebulaAuth; namespace NebulaAuth;
@@ -55,12 +55,13 @@ public partial class MainWindow
private static ColorAnimationUsingKeyFrames BuildBlinkAnimation(Duration duration, string targetName) private static ColorAnimationUsingKeyFrames BuildBlinkAnimation(Duration duration, string targetName)
{ {
var anim = new ColorAnimationUsingKeyFrames { Duration = duration }; var anim = new ColorAnimationUsingKeyFrames {Duration = duration};
for (var i = 0; i <= 6; i++) for (var i = 0; i <= 6; i++)
{ {
var color = i % 2 == 0 ? Colors.DodgerBlue : Colors.OrangeRed; var color = i % 2 == 0 ? Colors.DodgerBlue : Colors.OrangeRed;
anim.KeyFrames.Add(new DiscreteColorKeyFrame(color, KeyTime.FromTimeSpan(TimeSpan.FromSeconds(i)))); anim.KeyFrames.Add(new DiscreteColorKeyFrame(color, KeyTime.FromTimeSpan(TimeSpan.FromSeconds(i))));
} }
Storyboard.SetTargetName(anim, targetName); Storyboard.SetTargetName(anim, targetName);
Storyboard.SetTargetProperty(anim, new PropertyPath(SolidColorBrush.ColorProperty)); Storyboard.SetTargetProperty(anim, new PropertyPath(SolidColorBrush.ColorProperty));
return anim; return anim;
+2 -2
View File
@@ -51,7 +51,7 @@ public static class Storage
await Task.Run(() => await Task.Run(() =>
{ {
return Parallel.ForEachAsync(files, return Parallel.ForEachAsync(files,
new ParallelOptions { CancellationToken = token, MaxDegreeOfParallelism = threadCount }, new ParallelOptions {CancellationToken = token, MaxDegreeOfParallelism = threadCount},
async (file, ct) => async (file, ct) =>
{ {
try try
@@ -241,7 +241,7 @@ public static class Storage
if (counter % 5 == 0) if (counter % 5 == 0)
{ {
progress?.Report(counter / (double)files.Count); progress?.Report(counter / (double) files.Count);
await Task.Delay(10); await Task.Delay(10);
} }
} }
@@ -54,7 +54,8 @@ public static class SDAEncryptionHelper
if (string.IsNullOrWhiteSpace(fileName)) if (string.IsNullOrWhiteSpace(fileName))
return null; return null;
var entries = sdaManifest.Entries.ToDictionary(x => Path.GetFileName(x.Filename), StringComparer.OrdinalIgnoreCase); var entries =
sdaManifest.Entries.ToDictionary(x => Path.GetFileName(x.Filename), StringComparer.OrdinalIgnoreCase);
return new Context(sdaManifest, entries, null); return new Context(sdaManifest, entries, null);
} }
@@ -86,7 +86,8 @@ public static class SDAEncryptor
} }
} }
public static bool TryDecryptData(string password, string passwordSalt, string IV, string encryptedData, [NotNullWhen(true)] out string? plaintext) public static bool TryDecryptData(string password, string passwordSalt, string IV, string encryptedData,
[NotNullWhen(true)] out string? plaintext)
{ {
plaintext = null; plaintext = null;
try try
+7 -13
View File
@@ -5,24 +5,18 @@ namespace NebulaAuth.Model.Update;
public class ChangelogEntry public class ChangelogEntry
{ {
[JsonProperty("version")] [JsonProperty("version")] public string Version { get; set; } = string.Empty;
public string Version { get; set; } = string.Empty;
[JsonProperty("date")] [JsonProperty("date")] public string Date { get; set; } = string.Empty;
public string Date { get; set; } = string.Empty;
[JsonProperty("changes")] [JsonProperty("changes")] public List<ChangeItem> Changes { get; set; } = new();
public List<ChangeItem> Changes { get; set; } = new();
} }
public class ChangeItem public class ChangeItem
{ {
[JsonProperty("type")] [JsonProperty("type")] public string Type { get; set; } = string.Empty;
public string Type { get; set; } = string.Empty;
[JsonProperty("text")] [JsonProperty("text")] public string Text { get; set; } = string.Empty;
public string Text { get; set; } = string.Empty;
[JsonProperty("link")] [JsonProperty("link")] public string? Link { get; set; }
public string? Link { get; set; } }
}
@@ -8,11 +8,9 @@ public class UpdateSettings
{ {
private static readonly string FilePath = Path.Combine("settings", "update.json"); private static readonly string FilePath = Path.Combine("settings", "update.json");
[JsonProperty("skippedVersion")] [JsonProperty("skippedVersion")] public string? SkippedVersion { get; set; }
public string? SkippedVersion { get; set; }
[JsonProperty("remindAfter")] [JsonProperty("remindAfter")] public DateTime? RemindAfter { get; set; }
public DateTime? RemindAfter { get; set; }
public static UpdateSettings Load() public static UpdateSettings Load()
{ {
@@ -56,4 +54,4 @@ public class UpdateSettings
if (RemindAfter.HasValue && DateTime.Now < RemindAfter.Value) return false; if (RemindAfter.HasValue && DateTime.Now < RemindAfter.Value) return false;
return true; return true;
} }
} }
+5 -5
View File
@@ -5,11 +5,11 @@
throwExceptions="true"> throwExceptions="true">
<targets> <targets>
<target xsi:type="File" <target xsi:type="File"
name="File" name="File"
fileName="${basedir}/logs/log-${shortdate}.log" fileName="${basedir}/logs/log-${shortdate}.log"
concurrentWrites="true" concurrentWrites="true"
keepFileOpen="false"> keepFileOpen="false">
<layout xsi:type='CompoundLayout'> <layout xsi:type='CompoundLayout'>
<layout xsi:type="JsonLayout" includeEventProperties="true" IncludeScopeProperties="true"> <layout xsi:type="JsonLayout" includeEventProperties="true" IncludeScopeProperties="true">
<attribute name="time" layout="${longdate}" /> <attribute name="time" layout="${longdate}" />
@@ -174,7 +174,8 @@
</Grid> </Grid>
</DataTemplate> </DataTemplate>
<DataTemplate DataType="{x:Type entities:MarketMultiConfirmation}"> <DataTemplate DataType="{x:Type entities:MarketMultiConfirmation}">
<Expander Padding="0" Background="Transparent" materialDesign:ExpanderAssist.ExpanderButtonPosition="Start" materialDesign:ExpanderAssist.HorizontalHeaderPadding="0" HorizontalAlignment="Stretch"> <Expander Padding="0" Background="Transparent" materialDesign:ExpanderAssist.ExpanderButtonPosition="Start"
materialDesign:ExpanderAssist.HorizontalHeaderPadding="0" HorizontalAlignment="Stretch">
<Expander.Header> <Expander.Header>
<Grid HorizontalAlignment="Stretch"> <Grid HorizontalAlignment="Stretch">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
@@ -236,7 +237,7 @@
<StackPanel Grid.Column="1" VerticalAlignment="Center"> <StackPanel Grid.Column="1" VerticalAlignment="Center">
<TextBlock TextWrapping="WrapWithOverflow" Text="{Binding ItemName}" /> <TextBlock TextWrapping="WrapWithOverflow" Text="{Binding ItemName}" />
</StackPanel> </StackPanel>
<TextBlock VerticalAlignment="Center" Grid.Column="2" HorizontalAlignment="Left" <TextBlock VerticalAlignment="Center" Grid.Column="2" HorizontalAlignment="Left"
@@ -68,4 +68,4 @@
</Grid> </Grid>
</Grid> </Grid>
</Grid> </Grid>
</UserControl> </UserControl>
@@ -6,4 +6,4 @@ public partial class SdaPasswordDialog
{ {
InitializeComponent(); InitializeComponent();
} }
} }
+60 -53
View File
@@ -57,57 +57,62 @@
<!-- JSON changelog items --> <!-- JSON changelog items -->
<materialDesign:Card Grid.Row="1" Padding="10"> <materialDesign:Card Grid.Row="1" Padding="10">
<ScrollViewer MaxHeight="350" VerticalScrollBarVisibility="Auto" <ScrollViewer MaxHeight="350" VerticalScrollBarVisibility="Auto"
Visibility="{Binding HasJsonChangelog, Converter={StaticResource BooleanToVisibilityConverter}}"> Visibility="{Binding HasJsonChangelog, Converter={StaticResource BooleanToVisibilityConverter}}">
<ItemsControl ItemsSource="{Binding Changelog.Changes}"> <ItemsControl ItemsSource="{Binding Changelog.Changes}">
<ItemsControl.ItemTemplate> <ItemsControl.ItemTemplate>
<DataTemplate> <DataTemplate>
<StackPanel> <StackPanel>
<StackPanel Orientation="Horizontal" Margin="0,6,0,6"> <StackPanel Orientation="Horizontal" Margin="0,6,0,6">
<Border CornerRadius="3" Padding="4,2,4,2" Margin="0,0,8,0" <Border CornerRadius="3" Padding="4,2,4,2" Margin="0,0,8,0"
VerticalAlignment="Center"> VerticalAlignment="Center">
<Border.Style> <Border.Style>
<Style TargetType="Border"> <Style TargetType="Border">
<Setter Property="Background" Value="{DynamicResource MaterialDesign.Brush.Primary}" /> <Setter Property="Background"
<Style.Triggers> Value="{DynamicResource MaterialDesign.Brush.Primary}" />
<DataTrigger Binding="{Binding Type}" Value="NEW"> <Style.Triggers>
<Setter Property="Background" Value="{DynamicResource SuccessBrush}" /> <DataTrigger Binding="{Binding Type}" Value="NEW">
</DataTrigger> <Setter Property="Background"
<DataTrigger Binding="{Binding Type}" Value="FIX"> Value="{DynamicResource SuccessBrush}" />
<Setter Property="Background" Value="{DynamicResource WarningBrush}" /> </DataTrigger>
</DataTrigger> <DataTrigger Binding="{Binding Type}" Value="FIX">
<DataTrigger Binding="{Binding Type}" Value="IMPROVEMENT"> <Setter Property="Background"
<Setter Property="Background" Value="{DynamicResource AccentBrush}" /> Value="{DynamicResource WarningBrush}" />
</DataTrigger> </DataTrigger>
<DataTrigger Binding="{Binding Type}" Value="SECURITY"> <DataTrigger Binding="{Binding Type}" Value="IMPROVEMENT">
<Setter Property="Background" Value="{DynamicResource ErrorBrush}" /> <Setter Property="Background"
</DataTrigger> Value="{DynamicResource AccentBrush}" />
</Style.Triggers> </DataTrigger>
</Style> <DataTrigger Binding="{Binding Type}" Value="SECURITY">
</Border.Style> <Setter Property="Background"
<TextBlock Text="{Binding Type}" FontSize="11" FontWeight="Bold" Value="{DynamicResource ErrorBrush}" />
Foreground="White" /> </DataTrigger>
</Border> </Style.Triggers>
<TextBlock Text="{Binding Text}" TextWrapping="Wrap" </Style>
VerticalAlignment="Center" FontSize="14" MaxWidth="420" /> </Border.Style>
<Button Style="{StaticResource MaterialDesignIconForegroundButton}" <TextBlock Text="{Binding Type}" FontSize="11" FontWeight="Bold"
Width="20" Height="20" Foreground="White" />
Padding="2" </Border>
Margin="4,0,0,0" <TextBlock Text="{Binding Text}" TextWrapping="Wrap"
VerticalAlignment="Center" VerticalAlignment="Center" FontSize="14" MaxWidth="420" />
Command="{Binding DataContext.OpenLinkCommand, RelativeSource={RelativeSource AncestorType=UserControl}}" <Button Style="{StaticResource MaterialDesignIconForegroundButton}"
CommandParameter="{Binding Link}" Width="20" Height="20"
ToolTip="Open Link" Padding="2"
Visibility="{Binding Link, Converter={StaticResource NullableToVisibilityConverter}}"> Margin="4,0,0,0"
<materialDesign:PackIcon Kind="OpenInNew" Width="14" Height="14" /> VerticalAlignment="Center"
</Button> Command="{Binding DataContext.OpenLinkCommand, RelativeSource={RelativeSource AncestorType=UserControl}}"
</StackPanel> CommandParameter="{Binding Link}"
<Separator Opacity="0.2" Margin="0,2,0,2"/> ToolTip="Open Link"
</StackPanel> Visibility="{Binding Link, Converter={StaticResource NullableToVisibilityConverter}}">
<materialDesign:PackIcon Kind="OpenInNew" Width="14" Height="14" />
</Button>
</StackPanel>
<Separator Opacity="0.2" Margin="0,2,0,2" />
</StackPanel>
</DataTemplate> </DataTemplate>
</ItemsControl.ItemTemplate> </ItemsControl.ItemTemplate>
</ItemsControl> </ItemsControl>
</ScrollViewer> </ScrollViewer>
</materialDesign:Card> </materialDesign:Card>
<!-- No changelog fallback --> <!-- No changelog fallback -->
<TextBlock Grid.Row="1" Text="{Tr UpdateDialog.NoChangelog}" FontSize="13" Opacity="0.6" <TextBlock Grid.Row="1" Text="{Tr UpdateDialog.NoChangelog}" FontSize="13" Opacity="0.6"
@@ -118,7 +123,8 @@
<Grid Grid.Row="3" Margin="12,6,12,14"> <Grid Grid.Row="3" Margin="12,6,12,14">
<!-- Normal buttons --> <!-- Normal buttons -->
<StackPanel Visibility="{Binding ShowRemindOptions, Converter={StaticResource InverseBooleanToVisibilityConverter}}"> <StackPanel
Visibility="{Binding ShowRemindOptions, Converter={StaticResource InverseBooleanToVisibilityConverter}}">
<Button Style="{StaticResource MaterialDesignRaisedButton}" <Button Style="{StaticResource MaterialDesignRaisedButton}"
Command="{Binding UpdateNowCommand}" Command="{Binding UpdateNowCommand}"
HorizontalAlignment="Stretch" HorizontalAlignment="Stretch"
@@ -141,7 +147,8 @@
</StackPanel> </StackPanel>
<!-- Remind later options --> <!-- Remind later options -->
<StackPanel Visibility="{Binding ShowRemindOptions, Converter={StaticResource BooleanToVisibilityConverter}}"> <StackPanel
Visibility="{Binding ShowRemindOptions, Converter={StaticResource BooleanToVisibilityConverter}}">
<TextBlock Text="{Tr UpdateDialog.RemindAfter}" Margin="0,0,0,8" FontSize="14" /> <TextBlock Text="{Tr UpdateDialog.RemindAfter}" Margin="0,0,0,8" FontSize="14" />
<WrapPanel> <WrapPanel>
<Button Style="{StaticResource MaterialDesignOutlinedButton}" Margin="0,0,4,4" <Button Style="{StaticResource MaterialDesignOutlinedButton}" Margin="0,0,4,4"
@@ -169,4 +176,4 @@
</Grid> </Grid>
</Grid> </Grid>
</UserControl> </UserControl>
@@ -6,4 +6,4 @@ public partial class UpdateDialog
{ {
InitializeComponent(); InitializeComponent();
} }
} }
+4 -4
View File
@@ -1,8 +1,8 @@
using MaterialDesignThemes.Wpf; using System.Diagnostics;
using NebulaAuth.Core;
using System.Diagnostics;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using MaterialDesignThemes.Wpf;
using NebulaAuth.Core;
namespace NebulaAuth.View; namespace NebulaAuth.View;
@@ -37,6 +37,6 @@ public partial class LinksView : UserControl
private void CheckForUpdates_Click(object sender, RoutedEventArgs e) private void CheckForUpdates_Click(object sender, RoutedEventArgs e)
{ {
DialogHost.Close(null); DialogHost.Close(null);
UpdateManager.CheckForUpdates(manual: true); UpdateManager.CheckForUpdates(true);
} }
} }
+1 -2
View File
@@ -42,7 +42,7 @@ public partial class MainVM : ObservableObject
new MaProxy(kvp.Key, kvp.Value))); new MaProxy(kvp.Key, kvp.Value)));
Storage.MaFiles.CollectionChanged += MaFilesOnCollectionChanged; Storage.MaFiles.CollectionChanged += MaFilesOnCollectionChanged;
QueryGroups(); QueryGroups();
UpdateManager.CheckForUpdates(manual: false); UpdateManager.CheckForUpdates(false);
} }
[RelayCommand] [RelayCommand]
@@ -70,7 +70,6 @@ public partial class MainVM : ObservableObject
ConfirmLoginCommand.NotifyCanExecuteChanged(); ConfirmLoginCommand.NotifyCanExecuteChanged();
RemoveProxyCommand.NotifyCanExecuteChanged(); RemoveProxyCommand.NotifyCanExecuteChanged();
} }
} }
@@ -77,7 +77,6 @@ public partial class MainVM //Confirmations
} }
private async Task SendConfirmation(Mafile mafile, Confirmation confirmation, bool confirm) private async Task SendConfirmation(Mafile mafile, Confirmation confirmation, bool confirm)
{ {
bool result; bool result;
+1 -1
View File
@@ -82,7 +82,7 @@ public partial class MainVM
private bool RemoveProxyCanExecute(Mafile? mafile) private bool RemoveProxyCanExecute(Mafile? mafile)
{ {
mafile ??= SelectedMafile; mafile ??= SelectedMafile;
return mafile is { Proxy: not null }; return mafile is {Proxy: not null};
} }
private void CheckProxyExist() private void CheckProxyExist()
@@ -4,9 +4,8 @@ namespace NebulaAuth.ViewModel.Other;
public partial class SdaPasswordDialogVM : ObservableObject public partial class SdaPasswordDialogVM : ObservableObject
{ {
[ObservableProperty]
[NotifyPropertyChangedFor(nameof(IsFormValid))]
private string _password = string.Empty;
public bool IsFormValid => !string.IsNullOrWhiteSpace(Password); public bool IsFormValid => !string.IsNullOrWhiteSpace(Password);
}
[ObservableProperty] [NotifyPropertyChangedFor(nameof(IsFormValid))]
private string _password = string.Empty;
}
+1 -2
View File
@@ -20,8 +20,7 @@ public partial class SettingsVM : ObservableObject
[ObservableProperty] private string? _renameResultText; [ObservableProperty] private string? _renameResultText;
[ObservableProperty] [ObservableProperty] [NotifyCanExecuteChangedFor(nameof(ApplyRenameSettingCommand))]
[NotifyCanExecuteChangedFor(nameof(ApplyRenameSettingCommand))]
private bool _useAccountNameAsMafileNamePreview; private bool _useAccountNameAsMafileNamePreview;
public SettingsVM() public SettingsVM()
@@ -5,6 +5,7 @@ using AutoUpdaterDotNET;
using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input; using CommunityToolkit.Mvvm.Input;
using MaterialDesignThemes.Wpf; using MaterialDesignThemes.Wpf;
using NebulaAuth.Core;
using NebulaAuth.Model.Update; using NebulaAuth.Model.Update;
namespace NebulaAuth.ViewModel.Other; namespace NebulaAuth.ViewModel.Other;
@@ -14,7 +15,7 @@ public partial class UpdateDialogVM : ObservableObject
public UpdateInfoEventArgs Args { get; } public UpdateInfoEventArgs Args { get; }
public ChangelogEntry? Changelog { get; } public ChangelogEntry? Changelog { get; }
public string? HtmlFallbackUrl { get; } public string? HtmlFallbackUrl { get; }
public string Version => Args.CurrentVersion.ToString(); public string Version => Args.CurrentVersion;
public bool HasJsonChangelog => Changelog?.Changes?.Count > 0; public bool HasJsonChangelog => Changelog?.Changes?.Count > 0;
[ObservableProperty] private bool _showRemindOptions; [ObservableProperty] private bool _showRemindOptions;
@@ -53,14 +54,14 @@ public partial class UpdateDialogVM : ObservableObject
"7D" => TimeSpan.FromDays(7), "7D" => TimeSpan.FromDays(7),
_ => TimeSpan.FromDays(1) _ => TimeSpan.FromDays(1)
}; };
Core.UpdateManager.SetRemindAfter(delay); UpdateManager.SetRemindAfter(delay);
DialogHost.Close(null); DialogHost.Close(null);
} }
[RelayCommand] [RelayCommand]
private void SkipVersion() private void SkipVersion()
{ {
Core.UpdateManager.SkipVersion(Version); UpdateManager.SkipVersion(Version);
DialogHost.Close(null); DialogHost.Close(null);
} }
@@ -68,6 +69,6 @@ public partial class UpdateDialogVM : ObservableObject
private void OpenLink(string url) private void OpenLink(string url)
{ {
if (string.IsNullOrEmpty(url)) return; if (string.IsNullOrEmpty(url)) return;
Process.Start(new ProcessStartInfo(url) { UseShellExecute = true }); Process.Start(new ProcessStartInfo(url) {UseShellExecute = true});
} }
} }