Removed CJ settings from Wallet settings
MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/WalletSettingsViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/WalletSettingsViewModel.cs
-using System.Linq;
using System.Reactive.Disposables;
using System.Reactive.Linq;
-using System.Threading.Tasks;
using System.Windows.Input;
using NBitcoin;
using ReactiveUI;
using WalletWasabi.Blockchain.Keys;
using WalletWasabi.Fluent.Validation;
-using WalletWasabi.Fluent.ViewModels.CoinJoinProfiles;
-using WalletWasabi.Fluent.ViewModels.Dialogs.Base;
using WalletWasabi.Fluent.ViewModels.Navigation;
-using WalletWasabi.Models;
using WalletWasabi.Wallets;
namespace WalletWasabi.Fluent.ViewModels.Wallets;
@@ -18,11 +13,8 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets;
public partial class WalletSettingsViewModel : RoutableViewModel
{
[AutoNotify] private bool _preferPsbtWorkflow;
- [AutoNotify] private bool _autoCoinJoin;
[AutoNotify] private int _anonScoreTarget;
[AutoNotify] private string _plebStopThreshold;
- [AutoNotify] private string? _selectedCoinjoinProfileName;
- [AutoNotify] private bool _isCoinjoinProfileSelected;
private Wallet _wallet;
@@ -31,7 +23,6 @@ public partial class WalletSettingsViewModel : RoutableViewModel
_wallet = walletViewModelBase.Wallet;
Title = $"{_wallet.WalletName} - Wallet Settings";
_preferPsbtWorkflow = _wallet.KeyManager.PreferPsbtWorkflow;
- _autoCoinJoin = _wallet.KeyManager.AutoCoinJoin;
IsHardwareWallet = _wallet.KeyManager.IsHardwareWallet;
IsWatchOnly = _wallet.KeyManager.IsWatchOnly;
_plebStopThreshold = _wallet.KeyManager.PlebStopThreshold?.ToString() ?? KeyManager.DefaultPlebStopThreshold.ToString();
@@ -51,30 +42,6 @@ public partial class WalletSettingsViewModel : RoutableViewModel
walletViewModelBase.RaisePropertyChanged(nameof(walletViewModelBase.PreferPsbtWorkflow));
});
- SetAutoCoinJoin = ReactiveCommand.CreateFromTask(async () =>
- {
- if (_wallet.KeyManager.IsCoinjoinProfileSelected)
- {
- AutoCoinJoin = !AutoCoinJoin;
- }
- else
- {
- await NavigateDialogAsync(new CoinJoinProfilesViewModel(_wallet.KeyManager, false), NavigationTarget.DialogScreen);
- }
-
- if (_wallet.KeyManager.IsCoinjoinProfileSelected)
- {
- _wallet.KeyManager.AutoCoinJoin = AutoCoinJoin;
- _wallet.KeyManager.ToFile();
- }
- else
- {
- AutoCoinJoin = false;
- }
- });
-
- SelectCoinjoinProfileCommand = ReactiveCommand.CreateFromTask(SelectCoinjoinProfileAsync);
-
_anonScoreTarget = _wallet.KeyManager.AnonScoreTarget;
this.WhenAnyValue(x => x.AnonScoreTarget)
@@ -82,21 +49,6 @@ public partial class WalletSettingsViewModel : RoutableViewModel
.Throttle(TimeSpan.FromMilliseconds(1000))
.Skip(1)
.Subscribe(_ => _wallet.KeyManager.SetAnonScoreTarget(AnonScoreTarget));
-
- this.ValidateProperty(x => x.PlebStopThreshold, ValidatePlebStopThreshold);
-
- this.WhenAnyValue(x => x.PlebStopThreshold)
- .Skip(1)
- .Throttle(TimeSpan.FromMilliseconds(1000))
- .ObserveOn(RxApp.TaskpoolScheduler)
- .Subscribe(x =>
- {
- if (Money.TryParse(x, out Money result) && result != _wallet.KeyManager.PlebStopThreshold)
- {
- _wallet.KeyManager.PlebStopThreshold = result;
- _wallet.KeyManager.ToFile();
- }
- });
}
public bool IsHardwareWallet { get; }
@@ -105,51 +57,11 @@ public partial class WalletSettingsViewModel : RoutableViewModel
public override sealed string Title { get; protected set; }
- public ICommand SetAutoCoinJoin { get; }
-
- public ICommand SelectCoinjoinProfileCommand { get; }
-
public ICommand VerifyRecoveryWordsCommand { get; }
protected override void OnNavigatedTo(bool isInHistory, CompositeDisposable disposables)
{
base.OnNavigatedTo(isInHistory, disposables);
- PlebStopThreshold = _wallet.KeyManager.PlebStopThreshold.ToString();
AnonScoreTarget = _wallet.KeyManager.AnonScoreTarget;
-
- IsCoinjoinProfileSelected = _wallet.KeyManager.IsCoinjoinProfileSelected;
- SelectedCoinjoinProfileName =
- (_wallet.KeyManager.IsCoinjoinProfileSelected, CoinJoinProfilesViewModel.IdentifySelectedProfile(_wallet.KeyManager)) switch
- {
- (true, CoinJoinProfileViewModelBase x) => x.Title,
- (false, _) => "None",
- _ => "Unknown"
- };
- }
-
- private async Task SelectCoinjoinProfileAsync()
- {
- await NavigateDialogAsync(new CoinJoinProfilesViewModel(_wallet.KeyManager, false), NavigationTarget.DialogScreen);
- AutoCoinJoin = _wallet.KeyManager.AutoCoinJoin;
- }
-
- private void ValidatePlebStopThreshold(IValidationErrors errors) =>
- ValidatePlebStopThreshold(errors, PlebStopThreshold);
-
- private static void ValidatePlebStopThreshold(IValidationErrors errors, string plebStopThreshold)
- {
- if (string.IsNullOrWhiteSpace(plebStopThreshold) || string.IsNullOrEmpty(plebStopThreshold))
- {
- return;
- }
-
- if (plebStopThreshold.Contains(',', StringComparison.InvariantCultureIgnoreCase))
- {
- errors.Add(ErrorSeverity.Error, "Use decimal point instead of comma.");
- }
- else if (!decimal.TryParse(plebStopThreshold, out _))
- {
- errors.Add(ErrorSeverity.Error, "Invalid coinjoin threshold.");
- }
}
}

MODIFY
WalletWasabi.Fluent/Views/Wallets/WalletSettingsView.axaml
WalletWasabi.Fluent/Views/Wallets/WalletSettingsView.axaml
EnableNext="True" NextContent="Done"
EnableCancel="{Binding EnableCancel}"
EnableBack="{Binding EnableBack}">
+
<StackPanel Spacing="20" Margin="0 30">
- <!-- TODO: It is getting messy... A separate settings page should be created for HW wallets. -->
+
<StackPanel Classes="settingsLayout">
<DockPanel IsVisible="{Binding IsHardwareWallet}">
<TextBlock Text="PSBT workflow" />
<ToggleSwitch IsChecked="{Binding PreferPsbtWorkflow}" />
</DockPanel>
-
- <DockPanel IsVisible="{Binding !IsWatchOnly}">
- <TextBlock Text="Automatically start coinjoin" />
- <ToggleSwitch IsChecked="{Binding AutoCoinJoin, Mode=OneWay}" Command="{Binding SetAutoCoinJoin}" />
- </DockPanel>
-
- <StackPanel Spacing="10"
- ToolTip.Tip="Coinjoin will not automatically start if the non-private wallet balance is less than this."
- IsVisible="{Binding !IsWatchOnly}">
- <TextBlock Text="Auto-start coinjoin threshold" />
- <c:CurrencyEntryBox Text="{Binding PlebStopThreshold}" CurrencyCode="BTC" />
- </StackPanel>
-
- <DockPanel>
- <DockPanel.IsVisible>
- <MultiBinding Converter="{x:Static BoolConverters.And}">
- <Binding Path="IsCoinjoinProfileSelected" />
- <Binding Path="IsWatchOnly" Converter="{x:Static BoolConverters.Not}" />
- </MultiBinding>
- </DockPanel.IsVisible>
-
- <TextBlock Text="Coinjoin strategy:" VerticalAlignment="Center" DockPanel.Dock="Left" Margin="0" />
- <Button Content="Change" Command="{Binding SelectCoinjoinProfileCommand}" DockPanel.Dock="Right" />
- <TextBlock Text="{Binding SelectedCoinjoinProfileName}" VerticalAlignment="Center" MinWidth="120" Margin="10 0 10 0" />
- </DockPanel>
</StackPanel>
<Separator IsVisible="{Binding !IsWatchOnly}" />
</DockPanel>
</c:InfoMessage>
</StackPanel>
+
</StackPanel>
+
</c:ContentArea>
</UserControl>

Removed CJ settings from Wallet settings