Make NavigationTarget enum items more descriptive and add DialogHost item
MODIFY
WalletWasabi.Fluent/ViewModels/AddWallet/ConfirmRecoveryWordsViewModel.cs
WalletWasabi.Fluent/ViewModels/AddWallet/ConfirmRecoveryWordsViewModel.cs
@@ -18,7 +18,7 @@ namespace WalletWasabi.Fluent.ViewModels.AddWallet
private readonly SourceList<RecoveryWordViewModel> _confirmationWordsSourceList;
public ConfirmRecoveryWordsViewModel(NavigationStateViewModel navigationState, List<RecoveryWordViewModel> mnemonicWords, KeyManager keyManager, WalletManager walletManager)
- : base(navigationState, NavigationTarget.Dialog)
+ : base(navigationState, NavigationTarget.DialogScreen)
{
_confirmationWordsSourceList = new SourceList<RecoveryWordViewModel>();

MODIFY
WalletWasabi.Fluent/ViewModels/AddWallet/RecoverWalletViewModel.cs
WalletWasabi.Fluent/ViewModels/AddWallet/RecoverWalletViewModel.cs
@@ -27,7 +27,7 @@ namespace WalletWasabi.Fluent.ViewModels.AddWallet
NavigationStateViewModel navigationState,
string walletName,
Network network,
- WalletManager walletManager) : base(navigationState, NavigationTarget.Dialog)
+ WalletManager walletManager) : base(navigationState, NavigationTarget.DialogScreen)
{
Suggestions = new Mnemonic(Wordlist.English, WordCount.Twelve).WordList.GetWords();
@@ -79,7 +79,7 @@ namespace WalletWasabi.Fluent.ViewModels.AddWallet
{
var enterPassword = new EnterPasswordViewModel(
navigationState,
- NavigationTarget.Dialog,
+ NavigationTarget.DialogScreen,
"Type the password of the wallet to be able to recover and click Continue.");
navigationState.DialogScreen?.Invoke().Router.Navigate.Execute(enterPassword);
@@ -112,7 +112,7 @@ namespace WalletWasabi.Fluent.ViewModels.AddWallet
AdvancedOptionsInteraction.RegisterHandler(
async interaction =>
interaction.SetOutput(
- await new AdvancedRecoveryOptionsViewModel(navigationState, NavigationTarget.Dialog, interaction.Input).ShowDialogAsync()));
+ await new AdvancedRecoveryOptionsViewModel(navigationState, NavigationTarget.DialogHost, interaction.Input).ShowDialogAsync()));
}
public IObservable<bool> FinishCommandCanExecute { get; }

MODIFY
WalletWasabi.Fluent/ViewModels/AddWallet/RecoveryWordsViewModel.cs
WalletWasabi.Fluent/ViewModels/AddWallet/RecoveryWordsViewModel.cs
@@ -14,7 +14,7 @@ namespace WalletWasabi.Fluent.ViewModels.AddWallet
KeyManager keyManager,
Mnemonic mnemonic,
WalletManager walletManager)
- : base(navigationState, NavigationTarget.Dialog)
+ : base(navigationState, NavigationTarget.DialogScreen)
{
MnemonicWords = new List<RecoveryWordViewModel>();

MODIFY
WalletWasabi.Fluent/ViewModels/AddWalletPageViewModel.cs
WalletWasabi.Fluent/ViewModels/AddWalletPageViewModel.cs
@@ -24,7 +24,7 @@ namespace WalletWasabi.Fluent.ViewModels
private bool _optionsEnabled;
public AddWalletPageViewModel(NavigationStateViewModel navigationState, WalletManager walletManager,
- BitcoinStore store, Network network) : base(navigationState, NavigationTarget.Dialog)
+ BitcoinStore store, Network network) : base(navigationState, NavigationTarget.DialogScreen)
{
Title = "Add Wallet";
@@ -43,7 +43,7 @@ namespace WalletWasabi.Fluent.ViewModels
{
var enterPassword = new EnterPasswordViewModel(
navigationState,
- NavigationTarget.Dialog,
+ NavigationTarget.DialogScreen,
"Type the password of the wallet and click Continue.");
navigationState.DialogScreen?.Invoke().Router.Navigate.Execute(enterPassword);

MODIFY
WalletWasabi.Fluent/ViewModels/HomePageViewModel.cs
WalletWasabi.Fluent/ViewModels/HomePageViewModel.cs
@@ -13,7 +13,7 @@ namespace WalletWasabi.Fluent.ViewModels
{
private readonly ReadOnlyObservableCollection<NavBarItemViewModel> _items;
- public HomePageViewModel(NavigationStateViewModel navigationState, WalletManagerViewModel walletManager, AddWalletPageViewModel addWalletPage) : base(navigationState, NavigationTarget.Home)
+ public HomePageViewModel(NavigationStateViewModel navigationState, WalletManagerViewModel walletManager, AddWalletPageViewModel addWalletPage) : base(navigationState, NavigationTarget.HomeScreen)
{
Title = "Home";

MODIFY
WalletWasabi.Fluent/ViewModels/NavigationStateViewModel.cs
WalletWasabi.Fluent/ViewModels/NavigationStateViewModel.cs
@@ -7,8 +7,9 @@ namespace WalletWasabi.Fluent.ViewModels
public enum NavigationTarget
{
Default = 0,
- Home = 1,
- Dialog = 2
+ HomeScreen = 1,
+ DialogScreen = 2,
+ DialogHost = 3
}
public class NavigationStateViewModel
@@ -19,6 +20,7 @@ namespace WalletWasabi.Fluent.ViewModels
DialogScreen = dialogScreen;
DialogHost = dialogHost;
}
+
public Func<IScreen> HomeScreen { get; }
public Func<IScreen> DialogScreen { get; }
public Func<IDialogHost> DialogHost { get; }

MODIFY
WalletWasabi.Fluent/ViewModels/RoutableViewModel.cs
WalletWasabi.Fluent/ViewModels/RoutableViewModel.cs
@@ -24,7 +24,7 @@ namespace WalletWasabi.Fluent.ViewModels
public IScreen HostScreen => _navigationTarget switch
{
- NavigationTarget.Dialog => _navigationState.DialogScreen.Invoke(),
+ NavigationTarget.DialogScreen => _navigationState.DialogScreen.Invoke(),
_ => _navigationState.HomeScreen.Invoke(),
};
@@ -33,11 +33,11 @@ namespace WalletWasabi.Fluent.ViewModels
switch (_navigationTarget)
{
case NavigationTarget.Default:
- case NavigationTarget.Home:
+ case NavigationTarget.HomeScreen:
_navigationState.HomeScreen.Invoke().Router.Navigate.Execute(this);
break;
- case NavigationTarget.Dialog:
+ case NavigationTarget.DialogScreen:
_navigationState.DialogScreen.Invoke().Router.Navigate.Execute(this);
break;
}
@@ -48,11 +48,11 @@ namespace WalletWasabi.Fluent.ViewModels
switch (_navigationTarget)
{
case NavigationTarget.Default:
- case NavigationTarget.Home:
+ case NavigationTarget.HomeScreen:
_navigationState.HomeScreen.Invoke().Router.NavigateAndReset.Execute(this);
break;
- case NavigationTarget.Dialog:
+ case NavigationTarget.DialogScreen:
_navigationState.DialogScreen.Invoke().Router.NavigateAndReset.Execute(this);
break;
}
@@ -67,11 +67,11 @@ namespace WalletWasabi.Fluent.ViewModels
switch (_navigationTarget)
{
case NavigationTarget.Default:
- case NavigationTarget.Home:
+ case NavigationTarget.HomeScreen:
_navigationState.HomeScreen.Invoke().Router.NavigateBack.Execute();
break;
- case NavigationTarget.Dialog:
+ case NavigationTarget.DialogScreen:
_navigationState.DialogScreen.Invoke().Router.NavigateBack.Execute();
break;
}
@@ -82,11 +82,11 @@ namespace WalletWasabi.Fluent.ViewModels
switch (_navigationTarget)
{
case NavigationTarget.Default:
- case NavigationTarget.Home:
+ case NavigationTarget.HomeScreen:
_navigationState.HomeScreen.Invoke().Router.NavigationStack.Clear();
break;
- case NavigationTarget.Dialog:
+ case NavigationTarget.DialogScreen:
_navigationState.DialogScreen.Invoke().Router.NavigationStack.Clear();
break;
}

MODIFY
WalletWasabi.Fluent/ViewModels/SettingsPageViewModel.cs
WalletWasabi.Fluent/ViewModels/SettingsPageViewModel.cs
@@ -12,7 +12,7 @@ namespace WalletWasabi.Fluent.ViewModels
{
public class SettingsPageViewModel : NavBarItemViewModel
{
- public SettingsPageViewModel(NavigationStateViewModel navigationState) : base(navigationState, NavigationTarget.Home)
+ public SettingsPageViewModel(NavigationStateViewModel navigationState) : base(navigationState, NavigationTarget.HomeScreen)
{
Title = "Settings";
@@ -29,7 +29,7 @@ namespace WalletWasabi.Fluent.ViewModels
ConfirmSetting.RegisterHandler(
async interaction =>
{
- var x = new TestDialogViewModel(navigationState, NavigationTarget.Default, interaction.Input);
+ var x = new TestDialogViewModel(navigationState, NavigationTarget.DialogHost, interaction.Input);
var result = await x.ShowDialogAsync(navigationState.DialogHost());
interaction.SetOutput(result);
});

MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/WalletViewModelBase.cs
WalletWasabi.Fluent/ViewModels/Wallets/WalletViewModelBase.cs
@@ -16,7 +16,7 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets
private CompositeDisposable? _disposables;
private bool _disposedValue;
- protected WalletViewModelBase(NavigationStateViewModel navigationState, Wallet wallet) : base(navigationState, NavigationTarget.Home)
+ protected WalletViewModelBase(NavigationStateViewModel navigationState, Wallet wallet) : base(navigationState, NavigationTarget.HomeScreen)
{
Wallet = Guard.NotNull(nameof(wallet), wallet);

Make NavigationTarget enum items more descriptive and add DialogHost item