remember the used labels
MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/Send/LabelSelectionViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/Send/LabelSelectionViewModel.cs
@@ -3,6 +3,7 @@ using System.Linq;
using NBitcoin;
using ReactiveUI;
using WalletWasabi.Blockchain.Analysis.Clustering;
+using WalletWasabi.Blockchain.TransactionOutputs;
using WalletWasabi.Fluent.Models;
namespace WalletWasabi.Fluent.ViewModels.Wallets.Send;
@@ -89,4 +90,24 @@ public class LabelSelectionViewModel : ViewModelBase
this.RaisePropertyChanged(nameof(LabelsWhiteList));
this.RaisePropertyChanged(nameof(LabelsBlackList));
}
+
+ public void SetUsedLabel(IEnumerable<SmartCoin>? usedCoins)
+ {
+ if (usedCoins is null)
+ {
+ return;
+ }
+
+ var usedPockets = AllPocket.Where(pocket => pocket.Coins.Any(usedCoins.Contains)).ToArray();
+ var notUsedPockets = AllPocket.Except(usedPockets);
+ var notUsedPocketsLabels = SmartLabel.Merge(notUsedPockets.Select(x => x.Labels));
+ var notUsedLabelViewModels = AllLabelViewModel.Where(x => notUsedPocketsLabels.Contains(x.Value)).ToArray();
+
+ foreach (LabelViewModel label in notUsedLabelViewModels)
+ {
+ label.Swap();
+ }
+
+ OnSelectionChanged();
+ }
}

MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/Send/PrivacyControlViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/Send/PrivacyControlViewModel.cs
@@ -17,12 +17,14 @@ public partial class PrivacyControlViewModel : DialogViewModelBase<IEnumerable<S
private readonly Wallet _wallet;
private readonly TransactionInfo _transactionInfo;
private readonly bool _isSilent;
+ private readonly IEnumerable<SmartCoin>? _usedCoins;
- public PrivacyControlViewModel(Wallet wallet, TransactionInfo transactionInfo, bool isSilent)
+ public PrivacyControlViewModel(Wallet wallet, TransactionInfo transactionInfo, IEnumerable<SmartCoin>? usedCoins, bool isSilent)
{
_wallet = wallet;
_transactionInfo = transactionInfo;
_isSilent = isSilent;
+ _usedCoins = usedCoins;
LabelSelection = new LabelSelectionViewModel(_transactionInfo.Amount);
@@ -44,6 +46,7 @@ public partial class PrivacyControlViewModel : DialogViewModelBase<IEnumerable<S
private void InitializeLabels()
{
LabelSelection.Reset(_wallet.Coins.GetPockets(_wallet.ServiceConfiguration.MinAnonScoreTarget).Select(x => new Pocket(x)).ToArray());
+ LabelSelection.SetUsedLabel(_usedCoins);
}
protected override void OnNavigatedTo(bool isInHistory, CompositeDisposable disposables)

MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/Send/TransactionPreviewViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/Send/TransactionPreviewViewModel.cs
@@ -158,10 +158,13 @@ public partial class TransactionPreviewViewModel : RoutableViewModel
}
private void UpdateTransaction(TransactionSummaryViewModel summary, BuildTransactionResult transaction)
+ {
+ if (!summary.IsPreview)
{
_transaction = transaction;
+ }
- summary.UpdateTransaction(_transaction);
+ summary.UpdateTransaction(transaction);
DisplayedTransactionSummary = summary;
}
@@ -194,7 +197,7 @@ public partial class TransactionPreviewViewModel : RoutableViewModel
private async Task OnChangePocketsAsync()
{
var selectPocketsDialog =
- await NavigateDialogAsync(new PrivacyControlViewModel(_wallet, _info, false));
+ await NavigateDialogAsync(new PrivacyControlViewModel(_wallet, _info, _transaction?.SpentCoins, false));
if (selectPocketsDialog.Kind == DialogResultKind.Normal && selectPocketsDialog.Result is { })
{
@@ -209,7 +212,7 @@ public partial class TransactionPreviewViewModel : RoutableViewModel
if (!_info.Coins.Any())
{
var privacyControlDialogResult =
- await NavigateDialogAsync(new PrivacyControlViewModel(_wallet, _info, isSilent: true));
+ await NavigateDialogAsync(new PrivacyControlViewModel(_wallet, _info, _transaction?.SpentCoins, isSilent: true));
if (privacyControlDialogResult.Kind == DialogResultKind.Normal &&
privacyControlDialogResult.Result is { } coins)
{
@@ -329,7 +332,7 @@ public partial class TransactionPreviewViewModel : RoutableViewModel
if (wallet.Coins.TotalAmount() > transactionInfo.Amount)
{
var privacyControlDialogResult = await NavigateDialogAsync(
- new PrivacyControlViewModel(wallet, transactionInfo, isSilent: false),
+ new PrivacyControlViewModel(wallet, transactionInfo, _transaction?.SpentCoins, isSilent: false),
NavigationTarget.DialogScreen);
if (privacyControlDialogResult.Kind == DialogResultKind.Normal &&
@@ -367,7 +370,7 @@ public partial class TransactionPreviewViewModel : RoutableViewModel
}
var privacyControlDialogResult = await NavigateDialogAsync(
- new PrivacyControlViewModel(wallet, transactionInfo, isSilent: false),
+ new PrivacyControlViewModel(wallet, transactionInfo, _transaction?.SpentCoins, isSilent: false),
NavigationTarget.DialogScreen);
if (privacyControlDialogResult.Kind == DialogResultKind.Normal &&
privacyControlDialogResult.Result is { })

remember the used labels