get legalChecker form WalletManagerViewModel
MODIFY
WalletWasabi.Fluent/ViewModels/Login/LoginViewModel.cs
WalletWasabi.Fluent/ViewModels/Login/LoginViewModel.cs
@@ -6,7 +6,6 @@ using WalletWasabi.Fluent.ViewModels.AddWallet;
using WalletWasabi.Fluent.ViewModels.Login.PasswordFinder;
using WalletWasabi.Fluent.ViewModels.Navigation;
using WalletWasabi.Fluent.ViewModels.Wallets;
-using WalletWasabi.Services;
using WalletWasabi.Userfacing;
namespace WalletWasabi.Fluent.ViewModels.Login
@@ -22,12 +21,13 @@ namespace WalletWasabi.Fluent.ViewModels.Login
[AutoNotify] private bool _isPasswordNeeded;
[AutoNotify] private string _walletName;
- public LoginViewModel(WalletManagerViewModel walletManagerViewModel, ClosedWalletViewModel closedWalletVm, LegalChecker legalChecker)
+ public LoginViewModel(WalletManagerViewModel walletManagerViewModel, ClosedWalletViewModel closedWalletVm)
{
_walletManagerViewModel = walletManagerViewModel;
_closedWalletVm = closedWalletVm;
var wallet = _closedWalletVm.Wallet;
+ var legalChecker = walletManagerViewModel.LegalChecker;
KeyManager = wallet.KeyManager;
IsPasswordNeeded = !KeyManager.IsWatchOnly;

MODIFY
WalletWasabi.Fluent/ViewModels/WalletManagerViewModel.cs
WalletWasabi.Fluent/ViewModels/WalletManagerViewModel.cs
@@ -38,6 +38,7 @@ namespace WalletWasabi.Fluent.ViewModels
{
Model = walletManager;
BitcoinStore = bitcoinStore;
+ LegalChecker = legalChecker;
_walletDictionary = new Dictionary<Wallet, WalletViewModelBase>();
_walletActionsDictionary = new Dictionary<WalletViewModelBase, List<NavBarItemViewModel>>();
_actions = new ObservableCollection<NavBarItemViewModel>();
@@ -91,13 +92,13 @@ namespace WalletWasabi.Fluent.ViewModels
wallet =>
{
WalletViewModelBase vm = (wallet.State <= WalletState.Starting)
- ? ClosedWalletViewModel.Create(this, wallet, legalChecker)
+ ? ClosedWalletViewModel.Create(this, wallet)
: WalletViewModel.Create(uiConfig, wallet);
InsertWallet(vm);
});
- Dispatcher.UIThread.Post(() => LoadWallets(walletManager, legalChecker));
+ Dispatcher.UIThread.Post(() => LoadWallets(walletManager));
}
public ReadOnlyObservableCollection<NavBarItemViewModel> Items => _items;
@@ -106,6 +107,8 @@ namespace WalletWasabi.Fluent.ViewModels
public BitcoinStore BitcoinStore { get; }
+ public LegalChecker LegalChecker { get; }
+
public async Task<WalletViewModelBase?> LoadWalletAsync(ClosedWalletViewModel closedWalletViewModel)
{
var wallet = closedWalletViewModel.Wallet;
@@ -205,11 +208,11 @@ namespace WalletWasabi.Fluent.ViewModels
_walletDictionary.Remove(walletViewModel.Wallet);
}
- private void LoadWallets(WalletManager walletManager, LegalChecker legalChecker)
+ private void LoadWallets(WalletManager walletManager)
{
foreach (var wallet in walletManager.GetWallets())
{
- InsertWallet(ClosedWalletViewModel.Create(this, wallet, legalChecker));
+ InsertWallet(ClosedWalletViewModel.Create(this, wallet));
}
}

MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/ClosedWalletViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/ClosedWalletViewModel.cs
-using System;
using System.Collections.ObjectModel;
-using System.Reactive.Concurrency;
-using System.Reactive.Disposables;
-using System.Threading.Tasks;
using ReactiveUI;
using WalletWasabi.Fluent.ViewModels.Login;
using WalletWasabi.Fluent.ViewModels.NavBar;
using WalletWasabi.Fluent.ViewModels.Wallets.HardwareWallet;
using WalletWasabi.Fluent.ViewModels.Wallets.WatchOnlyWallet;
-using WalletWasabi.Logging;
-using WalletWasabi.Services;
using WalletWasabi.Wallets;
namespace WalletWasabi.Fluent.ViewModels.Wallets
@@ -18,7 +12,7 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets
{
[AutoNotify] private ObservableCollection<NavBarItemViewModel> _items;
- protected ClosedWalletViewModel(WalletManagerViewModel walletManagerViewModel, Wallet wallet, LegalChecker legalChecker)
+ protected ClosedWalletViewModel(WalletManagerViewModel walletManagerViewModel, Wallet wallet)
: base(wallet)
{
_items = new ObservableCollection<NavBarItemViewModel>();
@@ -27,20 +21,20 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets
{
if (!Wallet.IsLoggedIn)
{
- Navigate().To(new LoginViewModel(walletManagerViewModel, this, legalChecker));
+ Navigate().To(new LoginViewModel(walletManagerViewModel, this));
}
});
}
public override string IconName => "web_asset_regular";
- public static WalletViewModelBase Create(WalletManagerViewModel walletManager, Wallet wallet, LegalChecker legalChecker)
+ public static WalletViewModelBase Create(WalletManagerViewModel walletManager, Wallet wallet)
{
return wallet.KeyManager.IsHardwareWallet
- ? new ClosedHardwareWalletViewModel(walletManager, wallet, legalChecker)
+ ? new ClosedHardwareWalletViewModel(walletManager, wallet)
: wallet.KeyManager.IsWatchOnly
- ? new ClosedWatchOnlyWalletViewModel(walletManager, wallet, legalChecker)
- : new ClosedWalletViewModel(walletManager, wallet, legalChecker);
+ ? new ClosedWatchOnlyWalletViewModel(walletManager, wallet)
+ : new ClosedWalletViewModel(walletManager, wallet);
}
}
}

MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/HardwareWallet/ClosedHardwareWalletViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/HardwareWallet/ClosedHardwareWalletViewModel.cs
-using WalletWasabi.Services;
using WalletWasabi.Wallets;
namespace WalletWasabi.Fluent.ViewModels.Wallets.HardwareWallet
{
public class ClosedHardwareWalletViewModel : ClosedWalletViewModel
{
- internal ClosedHardwareWalletViewModel(WalletManagerViewModel walletManager, Wallet wallet, LegalChecker legalChecker) : base(walletManager, wallet, legalChecker)
+ internal ClosedHardwareWalletViewModel(WalletManagerViewModel walletManager, Wallet wallet) : base(walletManager, wallet)
{
}
}

MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/WatchOnlyWallet/ClosedWatchOnlyWalletViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/WatchOnlyWallet/ClosedWatchOnlyWalletViewModel.cs
-using WalletWasabi.Services;
using WalletWasabi.Wallets;
namespace WalletWasabi.Fluent.ViewModels.Wallets.WatchOnlyWallet
{
public class ClosedWatchOnlyWalletViewModel : ClosedWalletViewModel
{
- internal ClosedWatchOnlyWalletViewModel(WalletManagerViewModel walletManager, Wallet wallet, LegalChecker legalChecker) : base(walletManager, wallet, legalChecker)
+ internal ClosedWatchOnlyWalletViewModel(WalletManagerViewModel walletManager, Wallet wallet) : base(walletManager, wallet)
{
}
}

get legalChecker form WalletManagerViewModel