Convert `HighestCoinJoinClientState` to a method
MODIFY
WalletWasabi.Fluent/ViewModels/ApplicationViewModel.cs
WalletWasabi.Fluent/ViewModels/ApplicationViewModel.cs
@@ -83,7 +83,7 @@ public class ApplicationViewModel : ViewModelBase, ICanShutdownProvider
if (cjManager is { })
{
- return cjManager.HighestCoinJoinClientState switch
+ return cjManager.GetHighestCoinJoinClientState() switch
{
CoinJoinClientState.InCriticalPhase => false,
CoinJoinClientState.Idle or CoinJoinClientState.InProgress => true,

MODIFY
WalletWasabi/Services/SleepInhibitor.cs
WalletWasabi/Services/SleepInhibitor.cs
@@ -64,7 +64,8 @@ public class SleepInhibitor : PeriodicRunner
protected override async Task ActionAsync(CancellationToken cancel)
{
- switch (CoinJoinManager.HighestCoinJoinClientState)
+ var highestCoinJoinClientState = CoinJoinManager.GetHighestCoinJoinClientState();
+ switch (highestCoinJoinClientState)
{
case CoinJoinClientState.Idle:
Logger.LogTrace("Computer idle state is allowed again.");
@@ -76,7 +77,7 @@ public class SleepInhibitor : PeriodicRunner
break;
default:
- throw new NotSupportedException($"Unsupported {CoinJoinManager.HighestCoinJoinClientState} value.");
+ throw new NotSupportedException($"Unsupported {highestCoinJoinClientState} value.");
}
}

MODIFY
WalletWasabi/WabiSabi/Client/CoinJoinManager.cs
WalletWasabi/WabiSabi/Client/CoinJoinManager.cs
@@ -45,9 +45,7 @@ public class CoinJoinManager : BackgroundService
public event EventHandler<StatusChangedEventArgs>? StatusChanged;
- public CoinJoinClientState HighestCoinJoinClientState
- {
- get
+ public CoinJoinClientState GetHighestCoinJoinClientState()
{
var inProgress = TrackedCoinJoins.Values.Where(wtd => !wtd.IsCompleted).ToImmutableArray();
@@ -60,7 +58,6 @@ public class CoinJoinManager : BackgroundService
? CoinJoinClientState.InCriticalPhase
: CoinJoinClientState.InProgress;
}
- }
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{

Convert `HighestCoinJoinClientState` to a method