eliminate the need to pass the LoginAction and allow access as a dialog.
MODIFY
WalletWasabi.Fluent/ViewModels/AddWallet/TermsAndConditionsViewModel.cs
WalletWasabi.Fluent/ViewModels/AddWallet/TermsAndConditionsViewModel.cs
@@ -2,17 +2,18 @@ using System;
using System.Reactive.Linq;
using System.Windows.Input;
using ReactiveUI;
+using WalletWasabi.Fluent.ViewModels.Dialogs;
using WalletWasabi.Fluent.ViewModels.Navigation;
using WalletWasabi.Services;
namespace WalletWasabi.Fluent.ViewModels.AddWallet
{
[NavigationMetaData(Title = "Terms and conditions")]
- public partial class TermsAndConditionsViewModel : RoutableViewModel
+ public partial class TermsAndConditionsViewModel : DialogViewModelBase<bool>
{
[AutoNotify] private bool _isAgreed;
- public TermsAndConditionsViewModel(LegalChecker legalChecker, Action loginAction)
+ public TermsAndConditionsViewModel(LegalChecker legalChecker)
{
ViewTermsCommand = ReactiveCommand.Create(
() =>
@@ -28,10 +29,10 @@ namespace WalletWasabi.Fluent.ViewModels.AddWallet
async () =>
{
await legalChecker.AgreeAsync();
- Navigate().Clear();
- loginAction.Invoke();
+ Close(DialogResultKind.Normal, true);
},
- this.WhenAnyValue(x => x.IsAgreed).ObserveOn(RxApp.MainThreadScheduler));
+ this.WhenAnyValue(x => x.IsAgreed)
+ .ObserveOn(RxApp.MainThreadScheduler));
}
public ICommand ViewTermsCommand { get; }

MODIFY
WalletWasabi.Fluent/ViewModels/Dialogs/DialogViewModelBaseOfTResult.cs
WalletWasabi.Fluent/ViewModels/Dialogs/DialogViewModelBaseOfTResult.cs
@@ -28,11 +28,14 @@ namespace WalletWasabi.Fluent.ViewModels.Dialogs
CancelCommand = ReactiveCommand.Create(() => Close(DialogResultKind.Cancel));
}
- protected override void OnNavigatedFrom()
+ protected override void OnNavigatedFrom(bool isInHistory)
+ {
+ if (!isInHistory)
{
Close(DialogResultKind.Cancel);
+ }
- base.OnNavigatedFrom();
+ base.OnNavigatedFrom(isInHistory);
}
private void OnIsDialogOpenChanged(bool dialogState)

MODIFY
WalletWasabi.Fluent/ViewModels/Login/LoginViewModel.cs
WalletWasabi.Fluent/ViewModels/Login/LoginViewModel.cs
@@ -51,13 +51,18 @@ namespace WalletWasabi.Fluent.ViewModels.Login
if (!IsPasswordIncorrect)
{
-
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);
+ var legalDocs = new TermsAndConditionsViewModel(legalChecker);
+
+ var dialogResult = await NavigateDialog(legalDocs, NavigationTarget.DialogScreen);
+
+ if (dialogResult.Result is { } accepted)
+ {
+ LoginWallet();
+ }
}
else
{

MODIFY
WalletWasabi.Fluent/ViewModels/Navigation/RoutableViewModel.cs
WalletWasabi.Fluent/ViewModels/Navigation/RoutableViewModel.cs
@@ -52,9 +52,9 @@ namespace WalletWasabi.Fluent.ViewModels.Navigation
{
}
- private void DoNavigateFrom()
+ private void DoNavigateFrom(bool isInHistory)
{
- OnNavigatedFrom();
+ OnNavigatedFrom(isInHistory);
_currentDisposable?.Dispose();
_currentDisposable = null;
@@ -85,10 +85,10 @@ namespace WalletWasabi.Fluent.ViewModels.Navigation
void INavigatable.OnNavigatedFrom(bool isInHistory)
{
- DoNavigateFrom();
+ DoNavigateFrom(isInHistory);
}
- protected virtual void OnNavigatedFrom()
+ protected virtual void OnNavigatedFrom(bool isInHistory)
{
}

eliminate the need to pass the LoginAction and allow access as a dialog.