more metadata.
MODIFY
WalletWasabi.Fluent.Generators/NavigationMetaDataGenerator.cs
WalletWasabi.Fluent.Generators/NavigationMetaDataGenerator.cs
@@ -23,6 +23,14 @@ namespace WalletWasabi.Fluent
Bottom
}
+ public enum NavigationTarget
+ {
+ Default = 0,
+ HomeScreen = 1,
+ DialogScreen = 2,
+ DialogHost = 3
+ }
+
public sealed class NavigationMetaData
{
public bool Searchable { get; init; } = true;
@@ -40,6 +48,8 @@ namespace WalletWasabi.Fluent
public string[] Keywords { get; init; }
public NavBarPosition NavBarPosition { get; init; }
+
+ public NavigationTarget NavigationTarget { get; init; }
}
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
@@ -64,6 +74,8 @@ namespace WalletWasabi.Fluent
public string[] Keywords { get; set; }
public NavBarPosition NavBarPosition {get; set; }
+
+ public NavigationTarget NavigationTarget { get; set; }
}
}";
@@ -117,7 +129,7 @@ namespace WalletWasabi.Fluent
foreach (var namedTypeSymbol in namedTypeSymbols)
{
- var classSource = ProcessClass(namedTypeSymbol, attributeSymbol, metadataSymbol);
+ var classSource = ProcessClass(compilation, namedTypeSymbol, attributeSymbol, metadataSymbol);
if (classSource is not null)
{
context.AddSource($"{namedTypeSymbol.Name}_NavigationMetaData.cs", SourceText.From(classSource, Encoding.UTF8));
@@ -125,7 +137,7 @@ namespace WalletWasabi.Fluent
}
}
- private static string? ProcessClass(INamedTypeSymbol classSymbol, ISymbol attributeSymbol, ISymbol metadataSymbol)
+ private static string? ProcessClass(Compilation compilation, INamedTypeSymbol classSymbol, ISymbol attributeSymbol, ISymbol metadataSymbol)
{
if (!classSymbol.ContainingSymbol.Equals(classSymbol.ContainingNamespace,
SymbolEqualityComparer.Default))
@@ -176,6 +188,43 @@ namespace {namespaceName}
source.AppendLine($@" public static void RegisterLazy(Func<RoutableViewModel> createInstance) => NavigationManager.RegisterLazy(MetaData, createInstance);");
source.AppendLine($@" public static void Register(RoutableViewModel createInstance) => NavigationManager.Register(MetaData, createInstance);");
+ var routeableClass = compilation.GetTypeByMetadataName("WalletWasabi.Fluent.ViewModels.Navigation.RoutableViewModel");
+
+ if (routeableClass is { })
+ {
+ bool addRouteableMetaData = false;
+ var baseType = classSymbol.BaseType;
+ while (true)
+ {
+ if (baseType is null)
+ {
+ break;
+ }
+
+ if (SymbolEqualityComparer.Default.Equals(baseType, routeableClass))
+ {
+ addRouteableMetaData = true;
+ break;
+ }
+
+ baseType = baseType.BaseType;
+ }
+
+ if (addRouteableMetaData)
+ {
+ if (attributeData.NamedArguments.Any(x => x.Key == "NavigationTarget"))
+ {
+ source.AppendLine(
+ $@" public override NavigationTarget DefaultTarget => MetaData.NavigationTarget;");
+ }
+
+ if (attributeData.NamedArguments.Any(x => x.Key == "IconName"))
+ {
+ source.AppendLine($@" public override string IconName => MetaData.IconName;");
+ }
+ }
+ }
+
source.Append($@" }}
}}");

MODIFY
WalletWasabi.Fluent/ViewModels/AboutViewModel.cs
WalletWasabi.Fluent/ViewModels/AboutViewModel.cs
@@ -19,7 +19,8 @@ namespace WalletWasabi.Fluent.ViewModels
Order = 4,
Category = "General",
Keywords = new[] { "About", "Software", "Version", "Source", "Code", "Github", "Status", "Stats", "Tor", "Onion", "Bug", "Report", "FAQ", "Questions,", "Docs", "Documentation", "Link", "Links", "Help" },
- NavBarPosition = NavBarPosition.None)]
+ NavBarPosition = NavBarPosition.None,
+ NavigationTarget = NavigationTarget.DialogScreen)]
public partial class AboutViewModel : RoutableViewModel
{
public AboutViewModel()
@@ -39,8 +40,6 @@ namespace WalletWasabi.Fluent.ViewModels
.Subscribe(ex => Logger.LogError(ex));
}
- public override NavigationTarget DefaultTarget => NavigationTarget.DialogScreen;
-
public ICommand AboutAdvancedInfoDialogCommand { get; }
public ReactiveCommand<string, Unit> OpenBrowserCommand { get; }

MODIFY
WalletWasabi.Fluent/ViewModels/AddWallet/AddWalletPageViewModel.cs
WalletWasabi.Fluent/ViewModels/AddWallet/AddWalletPageViewModel.cs
@@ -27,7 +27,8 @@ namespace WalletWasabi.Fluent.ViewModels.AddWallet
Category = "General",
Keywords = new[] { "Wallet", "Add", "Create", "Recover", "Import", "Connect", "Hardware", "ColdCard", "Trezor", "Ledger" },
IconName = "add_circle_regular",
- NavBarPosition = NavBarPosition.Bottom)]
+ NavBarPosition = NavBarPosition.Bottom,
+ NavigationTarget = NavigationTarget.DialogScreen)]
public partial class AddWalletPageViewModel : NavBarItemViewModel
{
[AutoNotify] private string _walletName = "";
@@ -91,8 +92,6 @@ namespace WalletWasabi.Fluent.ViewModels.AddWallet
this.ValidateProperty(x => x.WalletName, errors => ValidateWalletName(errors, walletManager, WalletName));
}
- public override NavigationTarget DefaultTarget => NavigationTarget.DialogScreen;
-
protected override void OnNavigatedTo(bool inStack, CompositeDisposable disposable)
{
base.OnNavigatedTo(inStack, disposable);
@@ -138,8 +137,6 @@ namespace WalletWasabi.Fluent.ViewModels.AddWallet
}
}
- public override string IconName => "add_circle_regular";
-
public ICommand CreateWalletCommand { get; }
public ICommand RecoverWalletCommand { get; }
public ICommand ImportWalletCommand { get; }

MODIFY
WalletWasabi.Fluent/ViewModels/AddWallet/LegalDocumentsViewModel.cs
WalletWasabi.Fluent/ViewModels/AddWallet/LegalDocumentsViewModel.cs
@@ -8,7 +8,8 @@ namespace WalletWasabi.Fluent.ViewModels.AddWallet
Order = 3,
Category = "General",
Keywords = new[] { "View", "Legal", "Docs", "Documentation", "Terms", "Conditions", "Help" },
- IconName = "info_regular")]
+ IconName = "info_regular",
+ NavigationTarget = NavigationTarget.DialogScreen)]
public partial class LegalDocumentsViewModel : RoutableViewModel
{
public LegalDocumentsViewModel(string content)
@@ -18,8 +19,6 @@ namespace WalletWasabi.Fluent.ViewModels.AddWallet
NextCommand = BackCommand;
}
- public override NavigationTarget DefaultTarget => NavigationTarget.DialogScreen;
-
public string Content { get; }
}
}
\ No newline at end of file

MODIFY
WalletWasabi.Fluent/ViewModels/HomePageViewModel.cs
WalletWasabi.Fluent/ViewModels/HomePageViewModel.cs
@@ -47,8 +47,6 @@ namespace WalletWasabi.Fluent.ViewModels
() => IoHelpers.OpenFolderInFileExplorer(walletManager.Model.WalletDirectories.WalletsDir));
}
- public override string IconName => MetaData.IconName;
-
public ReadOnlyObservableCollection<NavBarItemViewModel> Items => _items;
public ReactiveCommand<Unit, Unit> OpenWalletsFolderCommand { get; }

MODIFY
WalletWasabi.Fluent/ViewModels/MainViewModel.cs
WalletWasabi.Fluent/ViewModels/MainViewModel.cs
@@ -148,7 +148,7 @@ namespace WalletWasabi.Fluent.ViewModels
return _settingsPage;
});
- BitcoinTabViewModel.RegisterLazy(
+ BitcoinTabSettingsViewModel.RegisterLazy(
() =>
{
_settingsPage.SelectedTab = 3;

MODIFY
WalletWasabi.Fluent/ViewModels/NavBar/NavBarItemViewModel.cs
WalletWasabi.Fluent/ViewModels/NavBar/NavBarItemViewModel.cs
@@ -41,8 +41,6 @@ namespace WalletWasabi.Fluent.ViewModels.NavBar
public NavBarItemViewModel? Parent { get; set; }
- public abstract string IconName { get; }
-
public NavBarItemSelectionMode SelectionMode { get; protected set; }
public bool IsSelected

MODIFY
WalletWasabi.Fluent/ViewModels/Navigation/NavigationState.cs
WalletWasabi.Fluent/ViewModels/Navigation/NavigationState.cs
@@ -3,14 +3,6 @@ using WalletWasabi.Fluent.ViewModels.Dialogs;
namespace WalletWasabi.Fluent.ViewModels.Navigation
{
- public enum NavigationTarget
- {
- Default = 0,
- HomeScreen = 1,
- DialogScreen = 2,
- DialogHost = 3
- }
-
public class NavigationState
{
private NavigationState(INavigationStack<RoutableViewModel> homeScreenNavigation, INavigationStack<RoutableViewModel> dialogScreenNavigation, Func<IDialogHost> dialogHost)

MODIFY
WalletWasabi.Fluent/ViewModels/Navigation/RoutableViewModel.cs
WalletWasabi.Fluent/ViewModels/Navigation/RoutableViewModel.cs
@@ -24,6 +24,8 @@ namespace WalletWasabi.Fluent.ViewModels.Navigation
CancelCommand = ReactiveCommand.Create(() => Navigate().Clear());
}
+ public virtual string IconName => "navigation_regular";
+
public ICommand? NextCommand { get; protected set; }
public ICommand BackCommand { get; protected set; }

MODIFY
WalletWasabi.Fluent/ViewModels/Search/SearchPageViewModel.cs
WalletWasabi.Fluent/ViewModels/Search/SearchPageViewModel.cs
@@ -13,6 +13,7 @@ namespace WalletWasabi.Fluent.ViewModels.Search
{
[NavigationMetaData(
Title = "Search",
+ IconName = "search_regular",
Searchable = false,
NavBarPosition = NavBarPosition.Bottom)]
public partial class SearchPageViewModel : NavBarItemViewModel
@@ -30,8 +31,6 @@ namespace WalletWasabi.Fluent.ViewModels.Search
_categorySources = new Dictionary<SearchCategory, SourceList<SearchItemViewModel>>();
}
- public override string IconName => "search_regular";
-
public ReadOnlyObservableCollection<SearchResult> SearchResults => _searchResults!;
public void Initialise()

RENAME
WalletWasabi.Fluent/ViewModels/Settings/BitcoinTabViewModel.cs
WalletWasabi.Fluent/ViewModels/Settings/BitcoinTabSettingsViewModel.cs
@@ -22,7 +22,7 @@ namespace WalletWasabi.Fluent.ViewModels.Settings
"Settings", "Bitcoin", "Network", "Main", "TestNet", "RegTest", "Run", "Knots", "Startup", "P2P", "Endpoint"
},
IconName = "settings_bitcoin_regular")]
- public partial class BitcoinTabViewModel : SettingsTabViewModelBase
+ public partial class BitcoinTabSettingsViewModel : SettingsTabViewModelBase
{
[AutoNotify] private Network _network;
[AutoNotify] private bool _startLocalBitcoinCoreOnStartup;
@@ -30,7 +30,7 @@ namespace WalletWasabi.Fluent.ViewModels.Settings
[AutoNotify] private bool _stopLocalBitcoinCoreOnShutdown;
[AutoNotify] private string _bitcoinP2PEndPoint;
- public BitcoinTabViewModel(Config config, UiConfig uiConfig) : base(config, uiConfig)
+ public BitcoinTabSettingsViewModel(Config config, UiConfig uiConfig) : base(config, uiConfig)
{
this.ValidateProperty(x => x.BitcoinP2PEndPoint, ValidateBitcoinP2PEndPoint);

MODIFY
WalletWasabi.Fluent/ViewModels/Settings/SettingsPageViewModel.cs
WalletWasabi.Fluent/ViewModels/Settings/SettingsPageViewModel.cs
@@ -28,15 +28,13 @@ namespace WalletWasabi.Fluent.ViewModels.Settings
GeneralSettingsTab = new GeneralSettingsTabViewModel(config, uiConfig);
PrivacySettingsTab = new PrivacySettingsTabViewModel(config, uiConfig);
NetworkSettingsTab = new NetworkSettingsTabViewModel(config, uiConfig);
- BitcoinTab = new BitcoinTabViewModel(config, uiConfig);
+ BitcoinTabSettings = new BitcoinTabSettingsViewModel(config, uiConfig);
}
public GeneralSettingsTabViewModel GeneralSettingsTab { get; }
public PrivacySettingsTabViewModel PrivacySettingsTab { get; }
public NetworkSettingsTabViewModel NetworkSettingsTab { get; }
- public BitcoinTabViewModel BitcoinTab { get; }
-
- public override string IconName => "settings_regular";
+ public BitcoinTabSettingsViewModel BitcoinTabSettings { get; }
private void OnRestartNeeded(object? sender, RestartNeededEventArgs e)
{

MODIFY
WalletWasabi.Fluent/Views/Settings/BitcoinSettingsView.xaml
WalletWasabi.Fluent/Views/Settings/BitcoinSettingsView.xaml
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:settings="clr-namespace:WalletWasabi.Fluent.ViewModels.Settings"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
- x:DataType="settings:BitcoinTabViewModel"
+ x:DataType="settings:BitcoinTabSettingsViewModel"
x:Class="WalletWasabi.Fluent.Views.Settings.BitCoinSettingsView"
x:CompileBindings="True">
<StackPanel Spacing="20" MinWidth="360" MaxWidth="650" HorizontalAlignment="Left" Orientation="Vertical">

MODIFY
WalletWasabi.Fluent/Views/Settings/SettingsPageView.xaml
WalletWasabi.Fluent/Views/Settings/SettingsPageView.xaml
</TabItem>
<TabItem Header="Bitcoin">
- <v:BitCoinSettingsView DataContext="{Binding BitcoinTab}" />
+ <v:BitCoinSettingsView DataContext="{Binding BitcoinTabSettings}" />
</TabItem>
</TabControl>
</DockPanel>

more metadata.