Add Viewing of T&Cs.
MODIFY
WalletWasabi.Fluent/ViewModels/AddWallet/TermsAndConditionsViewModel.cs
WalletWasabi.Fluent/ViewModels/AddWallet/TermsAndConditionsViewModel.cs
+using System.IO;
using System.Reactive;
using System.Windows.Input;
using ReactiveUI;
using WalletWasabi.Fluent.ViewModels.Dialogs;
+using WalletWasabi.Legal;
namespace WalletWasabi.Fluent.ViewModels.AddWallet
{
- public class LegalDocumentsViewModel : DialogViewModelBase<Unit>
+ public class LegalDocumentsViewModel : RoutableViewModel
{
public LegalDocumentsViewModel(NavigationStateViewModel navigationState, NavigationTarget navigationTarget, string content) :
base(navigationState, navigationTarget)
{
+ Content = content;
}
- protected override void OnDialogClosed()
- {
- }
+ public ICommand NextCommand => BackCommand;
+
+ public string Content { get; }
}
public class TermsAndConditionsViewModel : DialogViewModelBase<bool>
{
private bool _isAgreed;
- public TermsAndConditionsViewModel(NavigationStateViewModel navigationState) : base(navigationState, NavigationTarget.DialogScreen)
+ public TermsAndConditionsViewModel(NavigationStateViewModel navigationState, LegalDocuments legalDocuments) : base(navigationState, NavigationTarget.DialogScreen)
{
ViewTermsCommand = ReactiveCommand.CreateFromTask(
async () =>
{
+ var content = await File.ReadAllTextAsync(legalDocuments.FilePath);
+
var legalDocs = new LegalDocumentsViewModel(
navigationState,
NavigationTarget.DialogScreen,
- "Lorem ipsum dolar ipsamet");
-
- navigationState.DialogScreen.Invoke().Router.Navigate.Execute(legalDocs);
+ content);
- var result = await legalDocs.GetDialogResultAsync();
+ legalDocs.Navigate();
});
NextCommand = ReactiveCommand.Create(

MODIFY
WalletWasabi.Fluent/ViewModels/AddWalletPageViewModel.cs
WalletWasabi.Fluent/ViewModels/AddWalletPageViewModel.cs
@@ -13,6 +13,7 @@ using WalletWasabi.Fluent.ViewModels.AddWallet;
using WalletWasabi.Gui.Validation;
using WalletWasabi.Models;
using WalletWasabi.Fluent.ViewModels.NavBar;
+using WalletWasabi.Legal;
namespace WalletWasabi.Fluent.ViewModels
{
@@ -21,13 +22,13 @@ namespace WalletWasabi.Fluent.ViewModels
private string _walletName = "";
private bool _optionsEnabled;
- public AddWalletPageViewModel(NavigationStateViewModel navigationState, WalletManager walletManager,
+ public AddWalletPageViewModel(NavigationStateViewModel navigationState, LegalDocuments legalDocuments, WalletManager walletManager,
BitcoinStore store, Network network) : base(navigationState, NavigationTarget.DialogScreen)
{
Title = "Add Wallet";
OpenCommand = ReactiveCommand.CreateFromTask(
- async () => await ShowTermsAndConditionsAsync());
+ async () => await ShowTermsAndConditionsAsync(legalDocuments));
this.WhenAnyValue(x => x.WalletName)
.Select(x => !string.IsNullOrWhiteSpace(x))
@@ -75,9 +76,9 @@ namespace WalletWasabi.Fluent.ViewModels
this.ValidateProperty(x => x.WalletName, errors => ValidateWalletName(errors, walletManager, WalletName));
}
- private async Task ShowTermsAndConditionsAsync()
+ private async Task ShowTermsAndConditionsAsync(LegalDocuments legalDocuments)
{
- var termsAndConditions = new TermsAndConditionsViewModel(NavigationState);
+ var termsAndConditions = new TermsAndConditionsViewModel(NavigationState, legalDocuments);
termsAndConditions.Navigate();

MODIFY
WalletWasabi.Fluent/ViewModels/MainViewModel.cs
WalletWasabi.Fluent/ViewModels/MainViewModel.cs
@@ -39,7 +39,7 @@ namespace WalletWasabi.Fluent.ViewModels
var walletManager = new WalletManagerViewModel(navigationState, global.WalletManager, global.UiConfig);
- var addWalletPage = new AddWalletPageViewModel(navigationState, global.WalletManager, global.BitcoinStore, global.Network);
+ var addWalletPage = new AddWalletPageViewModel(navigationState, global.LegalDocuments, global.WalletManager, global.BitcoinStore, global.Network);
_navBar = new NavBarViewModel(navigationState, Router, walletManager, addWalletPage);

ADD
WalletWasabi.Fluent/Views/AddWallet/LegalDocumentsView.axaml
+<UserControl xmlns="https://github.com/avaloniaui"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:c="clr-namespace:WalletWasabi.Fluent.Controls"
+ mc:Ignorable="d"
+ xmlns:behaviors="clr-namespace:WalletWasabi.Fluent.Behaviors;assembly=WalletWasabi.Fluent"
+ xmlns:i="clr-namespace:Avalonia.Xaml.Interactivity;assembly=Avalonia.Xaml.Interactivity"
+ d:DesignWidth="600" d:DesignHeight="500"
+ x:Class="WalletWasabi.Fluent.Views.AddWallet.LegalDocumentsView">
+ <c:ContentArea Title="Terms and Conditions"
+ Caption="Please read the small print."
+ EnableNext="True" NextContent="Continue" FocusNext="True">
+ <ScrollViewer HorizontalScrollBarVisibility="Disabled">
+ <TextBlock TextWrapping="Wrap" Text="{Binding Content}" />
+ </ScrollViewer>
+ </c:ContentArea>
+</UserControl>
\ No newline at end of file

ADD
WalletWasabi.Fluent/Views/AddWallet/LegalDocumentsView.axaml.cs
+using Avalonia.Markup.Xaml;
+using Avalonia.ReactiveUI;
+using WalletWasabi.Fluent.ViewModels.AddWallet;
+
+namespace WalletWasabi.Fluent.Views.AddWallet
+{
+ public class LegalDocumentsView : ReactiveUserControl<LegalDocumentsViewModel>
+ {
+ public LegalDocumentsView()
+ {
+ InitializeComponent();
+ }
+
+ private void InitializeComponent()
+ {
+ AvaloniaXamlLoader.Load(this);
+ }
+ }
+}

MODIFY
WalletWasabi.Fluent/Views/AddWallet/TermsAndConditionsView.axaml
WalletWasabi.Fluent/Views/AddWallet/TermsAndConditionsView.axaml
<CheckBox IsChecked="{Binding IsAgreed}">
<StackPanel Orientation="Horizontal">
<TextBlock Text="I agree to the " />
- <Button Classes="plain" Content="Terms and Conditions" />
+ <Button Classes="plain" Content="Terms and Conditions" Command="{Binding ViewTermsCommand}" />
</StackPanel>
</CheckBox>
</c:ContentArea>

RENAME
WalletWasabi.Fluent/Views/AddWallet/TermsAndConditionsView.xaml.cs
WalletWasabi.Fluent/Views/AddWallet/TermsAndConditionsView.axaml.cs
Add Viewing of T&Cs.