add auto paste
MODIFY
WalletWasabi.Fluent/ViewModels/WalletManagerViewModel.cs
WalletWasabi.Fluent/ViewModels/WalletManagerViewModel.cs
@@ -27,6 +27,7 @@ namespace WalletWasabi.Fluent.ViewModels
private readonly Dictionary<Wallet, WalletViewModelBase> _walletDictionary;
private readonly Dictionary<WalletViewModelBase, List<NavBarItemViewModel>> _walletActionsDictionary;
private readonly ReadOnlyObservableCollection<NavBarItemViewModel> _items;
+ private readonly UiConfig _uiConfig;
private readonly TransactionBroadcaster _transactionBroadcaster;
private NavBarItemViewModel? _currentSelection;
[AutoNotify] private WalletViewModelBase? _selectedWallet;
@@ -47,6 +48,7 @@ namespace WalletWasabi.Fluent.ViewModels
_actions = new ObservableCollection<NavBarItemViewModel>();
_wallets = new ObservableCollection<WalletViewModelBase>();
_loggedInAndSelectedAlwaysFirst = true;
+ _uiConfig = uiConfig;
_transactionBroadcaster = broadcaster;
static Func<WalletViewModelBase, bool> SelectedWalletFilter(WalletViewModelBase? selected)
@@ -266,7 +268,7 @@ namespace WalletWasabi.Fluent.ViewModels
if (wallet.KeyManager.IsHardwareWallet || !wallet.KeyManager.IsWatchOnly)
{
- actions.Add(new SendViewModel(walletViewModel, _transactionBroadcaster));
+ actions.Add(new SendViewModel(walletViewModel, _transactionBroadcaster, _uiConfig));
}
actions.Add(new ReceiveViewModel(walletViewModel, WalletManager, BitcoinStore));

MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/Send/SendViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/Send/SendViewModel.cs
@@ -24,6 +24,7 @@ using WalletWasabi.Fluent.Validation;
using WalletWasabi.Fluent.ViewModels.Dialogs;
using WalletWasabi.Fluent.ViewModels.NavBar;
using WalletWasabi.Fluent.ViewModels.Navigation;
+using WalletWasabi.Gui;
using WalletWasabi.Gui.Converters;
using WalletWasabi.Helpers;
using WalletWasabi.Logging;
@@ -62,14 +63,16 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets.Send
private bool _parsingUrl;
private bool _updatingCurrentValue;
private double _lastXAxisCurrentValue;
+ private bool _isAutoPasteEnabled;
- public SendViewModel(WalletViewModel walletVm, TransactionBroadcaster broadcaster) : base(NavigationMode.Normal)
+ public SendViewModel(WalletViewModel walletVm, TransactionBroadcaster broadcaster, UiConfig uiConfig) : base(NavigationMode.Normal)
{
_to = "";
_owner = walletVm;
_transactionInfo = new TransactionInfo();
_labels = new ObservableCollection<string>();
_lastXAxisCurrentValue = _xAxisCurrentValue;
+ _isAutoPasteEnabled = uiConfig.Autocopy;
ExchangeRate = walletVm.Wallet.Synchronizer.UsdExchangeRate;
PriorLabels = new();
@@ -103,6 +106,7 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets.Send
EnableBack = true;
PasteCommand = ReactiveCommand.CreateFromTask(async () => await OnPaste());
+ AutoPasteCommand = ReactiveCommand.CreateFromTask(async () => await OnAutoPaste());
var nextCommandCanExecute =
this.WhenAnyValue(x => x.Labels, x => x.AmountBtc, x => x.To, x => x.XAxisCurrentValue).Select(_ => Unit.Default)
@@ -122,6 +126,16 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets.Send
public ICommand PasteCommand { get; }
+ public ICommand AutoPasteCommand { get; }
+
+ private async Task OnAutoPaste()
+ {
+ if (string.IsNullOrEmpty(To) && _isAutoPasteEnabled)
+ {
+ await OnPaste();
+ }
+ }
+
private async Task OnPaste()
{
var text = await Application.Current.Clipboard.GetTextAsync();

MODIFY
WalletWasabi.Fluent/Views/Wallets/Send/SendView.axaml
WalletWasabi.Fluent/Views/Wallets/Send/SendView.axaml
Watermark="(e.g. Bitcoin address or PayJoin URL)">
<i:Interaction.Behaviors>
<behaviors:FocusOnAttachedBehavior />
- <behaviors:ExecuteCommandOnClickBehavior Command="{Binding PasteCommand}" />
+ <behaviors:ExecuteCommandOnClickBehavior Command="{Binding AutoPasteCommand}" />
</i:Interaction.Behaviors>
<TextBox.InnerRightContent>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" Spacing="10" Margin="10 0">

add auto paste