Receive Address - Edit Label - Suggestions
MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/Labels/SuggestionLabelsViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/Labels/SuggestionLabelsViewModel.cs
+using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Reactive;
@@ -18,12 +19,12 @@ public partial class SuggestionLabelsViewModel : ViewModelBase
[AutoNotify] private bool _isCurrentTextValid;
- public SuggestionLabelsViewModel(int topSuggestionsCount)
+ public SuggestionLabelsViewModel(int topSuggestionsCount, IEnumerable<string>? labels = null)
{
_sourceLabels = new SourceList<SuggestionLabelViewModel>();
_topSuggestions = new ObservableCollectionExtended<string>();
_suggestions = new ObservableCollectionExtended<string>();
- _labels = new ObservableCollectionExtended<string>();
+ _labels = new ObservableCollectionExtended<string>(labels ?? new List<string>());
UpdateLabels();
CreateSuggestions(topSuggestionsCount);

MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/Receive/AddressLabelEditViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/Receive/AddressLabelEditViewModel.cs
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
using System.Reactive.Linq;
using ReactiveUI;
using WalletWasabi.Blockchain.Analysis.Clustering;
using WalletWasabi.Blockchain.Keys;
using WalletWasabi.Fluent.ViewModels.Navigation;
+using WalletWasabi.Fluent.ViewModels.Wallets.Labels;
namespace WalletWasabi.Fluent.ViewModels.Wallets.Receive;
[NavigationMetaData(Title = "Edit Labels")]
public partial class AddressLabelEditViewModel : RoutableViewModel
{
- [AutoNotify] private ObservableCollection<string> _labels;
[AutoNotify] private SmartLabel? _finalLabel;
[AutoNotify] private bool _isCurrentTextValid;
- public AddressLabelEditViewModel(ReceiveAddressesViewModel owner, HdPubKey hdPubKey, KeyManager keyManager, HashSet<string> suggestions)
+ public AddressLabelEditViewModel(ReceiveAddressesViewModel owner, HdPubKey hdPubKey, KeyManager keyManager)
{
- Suggestions = suggestions;
- _labels = new(hdPubKey.Label);
+ SuggestionLabels = new SuggestionLabelsViewModel(3, hdPubKey.Label);
SetupCancel(enableCancel: true, enableCancelOnEscape: true, enableCancelOnPressed: true);
- Labels
+ SuggestionLabels.Labels
.WhenAnyValue(x => x.Count)
.ObserveOn(RxApp.MainThreadScheduler)
- .Subscribe(_ => FinalLabel = new SmartLabel(Labels));
+ .Subscribe(_ => FinalLabel = new SmartLabel(SuggestionLabels.Labels));
var canExecute =
this.WhenAnyValue(x => x.FinalLabel, x => x.IsCurrentTextValid)
@@ -50,5 +47,5 @@ public partial class AddressLabelEditViewModel : RoutableViewModel
canExecute);
}
- public HashSet<string> Suggestions { get; }
+ public SuggestionLabelsViewModel SuggestionLabels { get; }
}

MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/Receive/ReceiveAddressesViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/Receive/ReceiveAddressesViewModel.cs
@@ -22,12 +22,10 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets.Receive;
[NavigationMetaData(Title = "Receive Addresses")]
public partial class ReceiveAddressesViewModel : RoutableViewModel
{
- private readonly HashSet<string> _suggestions;
private ObservableCollection<AddressViewModel> _addresses;
- public ReceiveAddressesViewModel(Wallet wallet, HashSet<string> suggestions)
+ public ReceiveAddressesViewModel(Wallet wallet)
{
- _suggestions = suggestions;
Wallet = wallet;
Network = wallet.Network;
_addresses = new ObservableCollection<AddressViewModel>();
@@ -150,6 +148,6 @@ public partial class ReceiveAddressesViewModel : RoutableViewModel
public void NavigateToAddressEdit(HdPubKey hdPubKey, KeyManager keyManager)
{
- Navigate(NavigationTarget.CompactDialogScreen).To(new AddressLabelEditViewModel(this, hdPubKey, keyManager, _suggestions));
+ Navigate(NavigationTarget.CompactDialogScreen).To(new AddressLabelEditViewModel(this, hdPubKey, keyManager));
}
}

MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/Receive/ReceiveViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/Receive/ReceiveViewModel.cs
@@ -68,7 +68,7 @@ public partial class ReceiveViewModel : RoutableViewModel
private void OnShowExistingAddresses()
{
- Navigate().To(new ReceiveAddressesViewModel(_wallet, SuggestionLabels.Suggestions.ToHashSet()));
+ Navigate().To(new ReceiveAddressesViewModel(_wallet));
}
protected override void OnNavigatedTo(bool isInHistory, CompositeDisposable disposable)

MODIFY
WalletWasabi.Fluent/Views/Wallets/Receive/AddressLabelEditView.axaml
WalletWasabi.Fluent/Views/Wallets/Receive/AddressLabelEditView.axaml
Height="280">
<c:TagsBox x:Name="LabelTagBox"
TagSeparator=","
- Items="{Binding Labels}"
- Suggestions="{Binding Suggestions}"
+ Items="{Binding SuggestionLabels.Labels}"
+ Suggestions="{Binding SuggestionLabels.Suggestions}"
SuggestionsAreCaseSensitive="True"
RestrictInputToSuggestions="False"
VerticalAlignment="Top"

Receive Address - Edit Label - Suggestions