Make AutoCoinJoin independent of Profile
MODIFY
WalletWasabi.Fluent/ViewModels/CoinJoinProfiles/CoinJoinProfileViewModelBase.cs
WalletWasabi.Fluent/ViewModels/CoinJoinProfiles/CoinJoinProfileViewModelBase.cs
@@ -6,8 +6,6 @@ public abstract class CoinJoinProfileViewModelBase : ViewModelBase
public abstract string Description { get; }
- public virtual bool AutoCoinjoin { get; } = true;
-
public virtual int AnonScoreTarget { get; } = 5;
public abstract int FeeRateMedianTimeFrameHours { get; }

MODIFY
WalletWasabi.Fluent/ViewModels/CoinJoinProfiles/CoinJoinProfilesViewModel.cs
WalletWasabi.Fluent/ViewModels/CoinJoinProfiles/CoinJoinProfilesViewModel.cs
@@ -15,12 +15,15 @@ namespace WalletWasabi.Fluent.ViewModels.CoinJoinProfiles;
public partial class CoinJoinProfilesViewModel : DialogViewModelBase<bool>
{
[AutoNotify] private CoinJoinProfileViewModelBase? _selectedProfile;
+ [AutoNotify] private bool _autoCoinJoin;
public CoinJoinProfilesViewModel(KeyManager keyManager, bool isNewWallet)
{
NextCommand = ReactiveCommand.Create(() => OnNext(keyManager, isNewWallet));
EnableBack = true;
+ AutoCoinJoin = keyManager.AutoCoinJoin;
+
Profiles = new()
{
new EconomicCoinJoinProfileViewModel(),
@@ -39,13 +42,13 @@ public partial class CoinJoinProfilesViewModel : DialogViewModelBase<bool>
if (_selectedProfile is PrivateCoinJoinProfileViewModel p)
{
Profiles.Remove(p);
- _selectedProfile = new CustomPrivateCoinJoinProfileViewModel(keyManager.AnonScoreTarget, keyManager.FeeRateMedianTimeFrameHours);
+ _selectedProfile = new PrivateCoinJoinProfileViewModel(keyManager.AnonScoreTarget);
Profiles.Add(_selectedProfile);
}
if (_selectedProfile is null && keyManager.CoinjoinProfile is { })
{
- SelectedManualProfile = new ManualCoinJoinProfileViewModel(keyManager.AutoCoinJoin, keyManager.AnonScoreTarget, keyManager.FeeRateMedianTimeFrameHours);
+ SelectedManualProfile = new ManualCoinJoinProfileViewModel(keyManager.AnonScoreTarget, keyManager.FeeRateMedianTimeFrameHours);
}
}
@@ -65,10 +68,11 @@ public partial class CoinJoinProfilesViewModel : DialogViewModelBase<bool>
var dialogResult = await NavigateDialogAsync(dialog, NavigationTarget.CompactDialogScreen);
- if (dialogResult.Result is ManualCoinJoinProfileViewModel profile)
+ if (dialogResult.Result is ManualCoinJoinProfileDialogViewModel.ManualCoinJoinProfileDialogViewModelResult result)
{
SelectedProfile = null;
- SelectedManualProfile = profile;
+ SelectedManualProfile = result.Profile;
+ AutoCoinJoin = result.AutoCoinJoin;
}
}
@@ -76,7 +80,7 @@ public partial class CoinJoinProfilesViewModel : DialogViewModelBase<bool>
{
var selected = SelectedProfile ?? SelectedManualProfile ?? Profiles.First();
- keyManager.AutoCoinJoin = selected.AutoCoinjoin;
+ keyManager.AutoCoinJoin = AutoCoinJoin;
keyManager.SetAnonScoreTarget(selected.AnonScoreTarget, toFile: false);
keyManager.SetFeeRateMedianTimeFrame(selected.FeeRateMedianTimeFrameHours, toFile: false);
keyManager.IsCoinjoinProfileSelected = true;

MODIFY
WalletWasabi.Fluent/ViewModels/CoinJoinProfiles/ManualCoinJoinProfileViewModel.cs
WalletWasabi.Fluent/ViewModels/CoinJoinProfiles/ManualCoinJoinProfileViewModel.cs
@@ -2,9 +2,8 @@ namespace WalletWasabi.Fluent.ViewModels.CoinJoinProfiles;
public class ManualCoinJoinProfileViewModel : CoinJoinProfileViewModelBase
{
- public ManualCoinJoinProfileViewModel(bool autoCoinjoin, int anonScoreTarget, int feeRateMedianTimeFrameHours)
+ public ManualCoinJoinProfileViewModel(int anonScoreTarget, int feeRateMedianTimeFrameHours)
{
- AutoCoinjoin = autoCoinjoin;
AnonScoreTarget = anonScoreTarget;
FeeRateMedianTimeFrameHours = feeRateMedianTimeFrameHours;
}
@@ -13,8 +12,6 @@ public class ManualCoinJoinProfileViewModel : CoinJoinProfileViewModelBase
public override string Description => "";
- public override bool AutoCoinjoin { get; }
-
public override int AnonScoreTarget { get; }
public override int FeeRateMedianTimeFrameHours { get; }

MODIFY
WalletWasabi.Fluent/ViewModels/CoinJoinProfiles/PrivateCoinJoinProfileViewModel.cs
WalletWasabi.Fluent/ViewModels/CoinJoinProfiles/PrivateCoinJoinProfileViewModel.cs
@@ -4,11 +4,21 @@ namespace WalletWasabi.Fluent.ViewModels.CoinJoinProfiles;
internal class PrivateCoinJoinProfileViewModel : CoinJoinProfileViewModelBase
{
+ public PrivateCoinJoinProfileViewModel(int anonScoreTarget)
+ {
+ AnonScoreTarget = anonScoreTarget;
+ }
+
+ public PrivateCoinJoinProfileViewModel()
+ {
+ AnonScoreTarget = GetRandom(50, 101);
+ }
+
public override string Title => "Maximize Privacy";
public override string Description => "Choice of the paranoid. Optimizes for privacy at all costs.";
- public override int AnonScoreTarget { get; } = GetRandom(50, 101);
+ public override int AnonScoreTarget { get; }
public override int FeeRateMedianTimeFrameHours => 0;

MODIFY
WalletWasabi.Fluent/ViewModels/Dialogs/ManualCoinJoinProfileDialogViewModel.cs
WalletWasabi.Fluent/ViewModels/Dialogs/ManualCoinJoinProfileDialogViewModel.cs
@@ -9,7 +9,7 @@ using WalletWasabi.Models;
namespace WalletWasabi.Fluent.ViewModels.Dialogs;
[NavigationMetaData(Title = "Coinjoin Settings")]
-public partial class ManualCoinJoinProfileDialogViewModel : DialogViewModelBase<ManualCoinJoinProfileViewModel?>
+public partial class ManualCoinJoinProfileDialogViewModel : DialogViewModelBase<ManualCoinJoinProfileDialogViewModel.ManualCoinJoinProfileDialogViewModelResult?>
{
[AutoNotify] private bool _autoCoinjoin;
[AutoNotify] private int _anonScoreTarget;
@@ -42,7 +42,7 @@ public partial class ManualCoinJoinProfileDialogViewModel : DialogViewModelBase<
var target = AnonScoreTarget;
var hours = (int)Math.Floor(SelectedTimeFrame.TimeFrame.TotalHours);
- Close(DialogResultKind.Normal, new ManualCoinJoinProfileViewModel(auto, target, hours));
+ Close(DialogResultKind.Normal, new ManualCoinJoinProfileDialogViewModelResult(AutoCoinjoin, new ManualCoinJoinProfileViewModel(target, hours)));
});
}
@@ -53,4 +53,8 @@ public partial class ManualCoinJoinProfileDialogViewModel : DialogViewModelBase<
return Name;
}
}
+
+ public record ManualCoinJoinProfileDialogViewModelResult(bool AutoCoinJoin, ManualCoinJoinProfileViewModel Profile)
+ {
+ }
}

MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/WalletSettingsViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/WalletSettingsViewModel.cs
@@ -60,9 +60,9 @@ public partial class WalletSettingsViewModel : RoutableViewModel
if (_wallet.KeyManager.IsCoinjoinProfileSelected)
{
- AutoCoinJoin = !AutoCoinJoin;
_wallet.KeyManager.AutoCoinJoin = AutoCoinJoin;
_wallet.KeyManager.ToFile();
+ this.RaisePropertyChanged(nameof(AutoCoinJoin));
}
else
{

Make AutoCoinJoin independent of Profile