Better if-else nesting
MODIFY
WalletWasabi.Fluent/ViewModels/Login/LoginViewModel.cs
WalletWasabi.Fluent/ViewModels/Login/LoginViewModel.cs
@@ -70,13 +70,17 @@ public partial class LoginViewModel : RoutableViewModel
if (legalResult)
{
var km = closedWalletViewModel.Wallet.KeyManager;
+ bool shouldSelectProfile = !km.IsCoinjoinProfileSelected && km.AutoCoinJoin;
+ bool isProfileSelected = false;
// This should be impossible, this is just a sanity check
- if (!km.IsCoinjoinProfileSelected && km.AutoCoinJoin)
+ if (shouldSelectProfile)
{
- DialogResult<bool> isProfileSelected = await NavigateDialogAsync(new CoinJoinProfilesViewModel(closedWalletViewModel.Wallet.KeyManager, false), NavigationTarget.DialogScreen);
+ DialogResult<bool> profileDialogResult = await NavigateDialogAsync(new CoinJoinProfilesViewModel(closedWalletViewModel.Wallet.KeyManager, false), NavigationTarget.DialogScreen);
+ isProfileSelected = profileDialogResult.Result;
+ }
- if (isProfileSelected.Result)
+ if (isProfileSelected || !shouldSelectProfile)
{
LoginWallet(closedWalletViewModel);
}
@@ -86,11 +90,6 @@ public partial class LoginViewModel : RoutableViewModel
}
}
else
- {
- LoginWallet(closedWalletViewModel);
- }
- }
- else
{
wallet.Logout();
ErrorMessage = "You must accept the Terms and Conditions!";

Better if-else nesting