remove legalchecker from wallet ctors
MODIFY
WalletWasabi.Fluent/ViewModels/AddWallet/LegalDocumentsViewModel.cs
WalletWasabi.Fluent/ViewModels/AddWallet/LegalDocumentsViewModel.cs
@@ -31,7 +31,7 @@ namespace WalletWasabi.Fluent.ViewModels.AddWallet
.Subscribe(content => IsBusy = content is null);
}
- private LegalChecker LegalChecker { get; }
+ public LegalChecker LegalChecker { get; }
protected override void OnNavigatedTo(bool inStack, CompositeDisposable disposables)
{

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
@@ -19,7 +18,7 @@ namespace WalletWasabi.Fluent.ViewModels.Login
[AutoNotify] private bool _isPasswordNeeded;
[AutoNotify] private string _walletName;
- public LoginViewModel(WalletViewModelBase walletViewModelBase, LegalChecker legalChecker)
+ public LoginViewModel(WalletViewModelBase walletViewModelBase)
{
WalletViewModelBase = walletViewModelBase;
KeyManager = walletViewModelBase.Wallet.KeyManager;
@@ -52,7 +51,10 @@ namespace WalletWasabi.Fluent.ViewModels.Login
if (!IsPasswordIncorrect)
{
- if (legalChecker.TryGetNewLegalDocs(out _))
+
+ var legalChecker = (await NavigationManager.MaterialiseViewModel(LegalDocumentsViewModel.MetaData) as LegalDocumentsViewModel)?.LegalChecker;
+
+ if (legalChecker is { } lc && lc.TryGetNewLegalDocs(out _))
{
var legalDocs = new TermsAndConditionsViewModel(legalChecker, LoginWallet);
Navigate(NavigationTarget.DialogScreen).To(legalDocs);

MODIFY
WalletWasabi.Fluent/ViewModels/MainViewModel.cs
WalletWasabi.Fluent/ViewModels/MainViewModel.cs
using System;
-using System.IO;
using System.Reactive.Concurrency;
using NBitcoin;
using ReactiveUI;
@@ -15,7 +14,6 @@ using WalletWasabi.Fluent.ViewModels.Search;
using WalletWasabi.Fluent.ViewModels.Settings;
using WalletWasabi.Fluent.ViewModels.TransactionBroadcasting;
using WalletWasabi.Fluent.ViewModels.HelpAndSupport;
-using WalletWasabi.Fluent.ViewModels.Login;
using WalletWasabi.Fluent.ViewModels.OpenDirectory;
namespace WalletWasabi.Fluent.ViewModels

MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/ClosedWalletViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/ClosedWalletViewModel.cs
@@ -2,14 +2,11 @@ using System;
using System.Collections.ObjectModel;
using System.Reactive.Disposables;
using System.Threading.Tasks;
-using WalletWasabi.Fluent.ViewModels.AddWallet;
using WalletWasabi.Fluent.ViewModels.NavBar;
-using WalletWasabi.Fluent.ViewModels.Navigation;
using WalletWasabi.Fluent.ViewModels.Wallets.HardwareWallet;
using WalletWasabi.Fluent.ViewModels.Wallets.WatchOnlyWallet;
using WalletWasabi.Logging;
using WalletWasabi.Nito.AsyncEx;
-using WalletWasabi.Services;
using WalletWasabi.Wallets;
namespace WalletWasabi.Fluent.ViewModels.Wallets
@@ -18,18 +15,15 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets
{
[AutoNotify] private ObservableCollection<NavBarItemViewModel> _items;
- protected ClosedWalletViewModel(WalletManager walletManager, Wallet wallet, LegalChecker legalChecker)
- : base(wallet, legalChecker)
+ protected ClosedWalletViewModel(WalletManager walletManager, Wallet wallet)
+ : base(wallet)
{
WalletManager = walletManager;
- LegalChecker = legalChecker;
_items = new ObservableCollection<NavBarItemViewModel>();
}
public WalletManager WalletManager { get; }
- private LegalChecker LegalChecker { get; }
-
public override string IconName => "web_asset_regular";
protected override void OnNavigatedTo(bool inStack, CompositeDisposable disposable)
@@ -60,13 +54,13 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets
}
}
- public static WalletViewModelBase Create(WalletManager walletManager, Wallet wallet, LegalChecker legalChecker)
+ public static WalletViewModelBase Create(WalletManager 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(WalletManager walletManager, Wallet wallet, LegalChecker legalChecker) : base(walletManager, wallet, legalChecker)
+ internal ClosedHardwareWalletViewModel(WalletManager walletManager, Wallet wallet) : base(walletManager, wallet)
{
}
}

MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/HardwareWallet/HardwareWalletViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/HardwareWallet/HardwareWalletViewModel.cs
using WalletWasabi.Gui;
-using WalletWasabi.Services;
using WalletWasabi.Wallets;
namespace WalletWasabi.Fluent.ViewModels.Wallets.HardwareWallet
{
public class HardwareWalletViewModel : WalletViewModel
{
- internal HardwareWalletViewModel(UiConfig uiConfig, Wallet wallet, LegalChecker legalChecker) : base(uiConfig, wallet, legalChecker)
+ internal HardwareWalletViewModel(UiConfig uiConfig, Wallet wallet) : base(uiConfig, wallet)
{
}
}

MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/WalletViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/WalletViewModel.cs
@@ -2,25 +2,20 @@ using NBitcoin;
using ReactiveUI;
using Splat;
using System;
-using System.Collections;
-using System.Collections.ObjectModel;
using System.Reactive;
using System.Reactive.Disposables;
using System.Reactive.Linq;
-using WalletWasabi.Fluent.ViewModels.Wallets.Actions;
using WalletWasabi.Fluent.ViewModels.Wallets.HardwareWallet;
using WalletWasabi.Fluent.ViewModels.Wallets.WatchOnlyWallet;
using WalletWasabi.Gui;
using WalletWasabi.Logging;
using WalletWasabi.Wallets;
-using WalletWasabi.Gui.ViewModels;
-using WalletWasabi.Services;
namespace WalletWasabi.Fluent.ViewModels.Wallets
{
public partial class WalletViewModel : WalletViewModelBase
{
- protected WalletViewModel(UiConfig uiConfig, Wallet wallet, LegalChecker legalChecker) : base(wallet, legalChecker)
+ protected WalletViewModel(UiConfig uiConfig, Wallet wallet) : base(wallet)
{
Disposables = Disposables is null ? new CompositeDisposable() : throw new NotSupportedException($"Cannot open {GetType().Name} before closing it.");
@@ -54,13 +49,13 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets
public override string IconName => "web_asset_regular";
- public static WalletViewModel Create(UiConfig uiConfig, Wallet wallet, LegalChecker legalChecker)
+ public static WalletViewModel Create(UiConfig uiConfig, Wallet wallet)
{
return wallet.KeyManager.IsHardwareWallet
- ? new HardwareWalletViewModel(uiConfig, wallet, legalChecker)
+ ? new HardwareWalletViewModel(uiConfig, wallet)
: wallet.KeyManager.IsWatchOnly
- ? new WatchOnlyWalletViewModel(uiConfig, wallet, legalChecker)
- : new WalletViewModel(uiConfig, wallet, legalChecker);
+ ? new WatchOnlyWalletViewModel(uiConfig, wallet)
+ : new WalletViewModel(uiConfig, wallet);
}
}
}

MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/WalletViewModelBase.cs
WalletWasabi.Fluent/ViewModels/Wallets/WalletViewModelBase.cs
@@ -6,7 +6,6 @@ using System.Reactive.Linq;
using WalletWasabi.Fluent.ViewModels.Login;
using WalletWasabi.Fluent.ViewModels.NavBar;
using WalletWasabi.Helpers;
-using WalletWasabi.Services;
using WalletWasabi.Wallets;
namespace WalletWasabi.Fluent.ViewModels.Wallets
@@ -19,7 +18,7 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets
private bool _disposedValue;
private string _title;
- protected WalletViewModelBase(Wallet wallet, LegalChecker legalChecker)
+ protected WalletViewModelBase(Wallet wallet)
{
Wallet = Guard.NotNull(nameof(wallet), wallet);
@@ -41,7 +40,7 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets
{
if (!Wallet.IsLoggedIn)
{
- Navigate().To(new LoginViewModel(this, legalChecker));
+ Navigate().To(new LoginViewModel(this));
}
else
{

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(WalletManager walletManager, Wallet wallet, LegalChecker legalChecker) : base(walletManager, wallet, legalChecker)
+ internal ClosedWatchOnlyWalletViewModel(WalletManager walletManager, Wallet wallet) : base(walletManager, wallet)
{
}
}

MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/WatchOnlyWallet/WatchOnlyWalletViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/WatchOnlyWallet/WatchOnlyWalletViewModel.cs
using WalletWasabi.Gui;
-using WalletWasabi.Services;
using WalletWasabi.Wallets;
namespace WalletWasabi.Fluent.ViewModels.Wallets.WatchOnlyWallet
{
public class WatchOnlyWalletViewModel : WalletViewModel
{
- internal WatchOnlyWalletViewModel(UiConfig uiConfig, Wallet wallet, LegalChecker legalChecker) : base(uiConfig, wallet, legalChecker)
+ internal WatchOnlyWalletViewModel(UiConfig uiConfig, Wallet wallet) : base(uiConfig, wallet)
{
}
}

remove legalchecker from wallet ctors