Fix UpdateChecker Nullable
MODIFY
WalletWasabi/Services/UpdateChecker.cs
WalletWasabi/Services/UpdateChecker.cs
@@ -11,13 +11,10 @@ namespace WalletWasabi.Services
{
public class UpdateChecker : PeriodicRunner
{
- private UpdateStatus _updateStatus;
-
public UpdateChecker(TimeSpan period, WasabiSynchronizer synchronizer) : base(period)
{
- Synchronizer = Guard.NotNull(nameof(synchronizer), synchronizer);
+ Synchronizer = synchronizer;
WasabiClient = synchronizer.WasabiClient;
- UpdateStatus = new UpdateStatus(true, true, new Version(), 0);
Synchronizer.PropertyChanged += Synchronizer_PropertyChanged;
}
@@ -28,18 +25,7 @@ namespace WalletWasabi.Services
public WasabiSynchronizer Synchronizer { get; }
- public UpdateStatus UpdateStatus
- {
- get => _updateStatus;
- private set
- {
- if (value != _updateStatus)
- {
- _updateStatus = value;
- UpdateStatusChanged?.Invoke(this, value);
- }
- }
- }
+ public UpdateStatus UpdateStatus { get; set; } = new UpdateStatus(true, true, new Version(), 0);
private void Synchronizer_PropertyChanged(object? sender, PropertyChangedEventArgs e)
{
@@ -53,7 +39,12 @@ namespace WalletWasabi.Services
protected override async Task ActionAsync(CancellationToken cancel)
{
- UpdateStatus = await WasabiClient.CheckUpdatesAsync(cancel).ConfigureAwait(false);
+ var newUpdateStatus = await WasabiClient.CheckUpdatesAsync(cancel).ConfigureAwait(false);
+ if (newUpdateStatus != UpdateStatus)
+ {
+ UpdateStatus = newUpdateStatus;
+ UpdateStatusChanged?.Invoke(this, newUpdateStatus);
+ }
}
public override void Dispose()

Fix UpdateChecker Nullable