reduce nesting, remove TODO comment
MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/VerifyRecoveryWordsViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/VerifyRecoveryWordsViewModel.cs
@@ -20,8 +20,8 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets;
public partial class VerifyRecoveryWordsViewModel : RoutableViewModel
{
[AutoNotify] private IEnumerable<string>? _suggestions;
- [AutoNotify] private Mnemonic? _currentMnemonics;
[AutoNotify] private bool _isMnemonicsValid;
+ private Mnemonic? _currentMnemonics;
public VerifyRecoveryWordsViewModel(Wallet wallet)
{
@@ -31,7 +31,7 @@ public partial class VerifyRecoveryWordsViewModel : RoutableViewModel
.Select(x => x.Count is 12 or 15 or 18 or 21 or 24 ? new Mnemonic(GetTagsAsConcatString().ToLowerInvariant()) : default)
.Subscribe(x =>
{
- CurrentMnemonics = x;
+ _currentMnemonics = x;
IsMnemonicsValid = x is { IsValidChecksum: true };
this.RaisePropertyChanged(nameof(Mnemonics));
});
@@ -57,7 +57,7 @@ public partial class VerifyRecoveryWordsViewModel : RoutableViewModel
{
try
{
- if (!IsMnemonicsValid)
+ if (!IsMnemonicsValid || _currentMnemonics is not { } currentMnemonics)
{
await ShowErrorAsync();
@@ -65,11 +65,9 @@ public partial class VerifyRecoveryWordsViewModel : RoutableViewModel
return;
}
- if (_currentMnemonics is { })
- {
var saltSoup = wallet.Kitchen.SaltSoup();
- var recovered = KeyManager.Recover(_currentMnemonics, saltSoup, wallet.Network,
+ var recovered = KeyManager.Recover(currentMnemonics, saltSoup, wallet.Network,
wallet.KeyManager.SegwitAccountKeyPath,
null,
null,
@@ -83,15 +81,13 @@ public partial class VerifyRecoveryWordsViewModel : RoutableViewModel
else
{
await ShowErrorAsync();
-
Mnemonics.Clear();
}
}
- }
catch (Exception ex)
{
- // TODO navigate to error dialog.
Logger.LogError(ex);
+ await ShowErrorAsync(Title, ex.Message, "Wasabi was unable to verify the recovery words.");
}
}

reduce nesting, remove TODO comment