do not call suggestion creation twice
MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/Send/TransactionPreviewViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/Send/TransactionPreviewViewModel.cs
@@ -201,7 +201,7 @@ public partial class TransactionPreviewViewModel : RoutableViewModel
}
}
- private async Task OnChangePocketsAsync()
+ private async Task<bool> OnChangePocketsAsync()
{
var selectPocketsDialog =
await NavigateDialogAsync(new PrivacyControlViewModel(_wallet, _info, _transaction?.SpentCoins, false));
@@ -211,7 +211,11 @@ public partial class TransactionPreviewViewModel : RoutableViewModel
_info.Coins = selectPocketsDialog.Result;
await BuildAndUpdateAsync();
+
+ return true;
}
+
+ return false;
}
private async Task<bool> InitialiseTransactionAsync()
@@ -396,7 +400,7 @@ public partial class TransactionPreviewViewModel : RoutableViewModel
return null;
}
- private async Task<bool> NavigateConfirmLabelsDialog(BuildTransactionResult transaction)
+ private async Task<bool> NavigateConfirmLabelsDialogAsync(BuildTransactionResult transaction)
{
return (await NavigateDialogAsync(
new ConfirmLabelsDialogViewModel(
@@ -412,13 +416,20 @@ public partial class TransactionPreviewViewModel : RoutableViewModel
{
UpdateTransaction(CurrentTransactionSummary, initialTransaction);
- if (CurrentTransactionSummary.TransactionHasPockets && !await NavigateConfirmLabelsDialog(initialTransaction))
+ if (CurrentTransactionSummary.TransactionHasPockets && !await NavigateConfirmLabelsDialogAsync(initialTransaction))
{
- await OnChangePocketsAsync();
+ if (!await OnChangePocketsAsync())
+ {
+ // If the user chose to control their privacy, but cancelled the dialog, call suggestion creation manually. Otherwise BuildAndUpdate will call it.
+ await PrivacySuggestions.BuildPrivacySuggestionsAsync(_wallet, _info, _destination, initialTransaction, _isFixedAmount, _cancellationTokenSource.Token);
}
-
+ }
+ else
+ {
+ // If the user does not wish to control his/her privacy, call suggestion creation manually.
await PrivacySuggestions.BuildPrivacySuggestionsAsync(_wallet, _info, _destination, initialTransaction, _isFixedAmount, _cancellationTokenSource.Token);
}
+ }
else
{
Navigate().Back();

do not call suggestion creation twice