Move Tor settings to General settings
MODIFY
WalletWasabi.Fluent/ViewModels/MainViewModel.cs
WalletWasabi.Fluent/ViewModels/MainViewModel.cs
@@ -217,13 +217,6 @@ public partial class MainViewModel : ViewModelBase
return _settingsPage;
});
- TorSettingsTabViewModel.RegisterLazy(
- () =>
- {
- _settingsPage.SelectedTab = 1;
- return _settingsPage;
- });
-
BitcoinTabSettingsViewModel.RegisterLazy(
() =>
{

MODIFY
WalletWasabi.Fluent/ViewModels/SearchBar/Sources/SettingsSource.cs
WalletWasabi.Fluent/ViewModels/SearchBar/Sources/SettingsSource.cs
@@ -30,8 +30,8 @@ public class SettingsSource : ISearchItemSource
new NonActionableSearchItem(new Setting<GeneralSettingsTabViewModel, bool>(_settingsPage.GeneralSettingsTab, b => b.AutoPaste), "Auto paste addresses", "Settings", new List<string>(), "nav_settings_regular") { IsDefault = false },
new NonActionableSearchItem(new Setting<GeneralSettingsTabViewModel, bool>(_settingsPage.GeneralSettingsTab, b => b.HideOnClose), "Run in background when closed", "Settings", new List<string>() { "hide", "tray" }, "nav_settings_regular") { IsDefault = false },
new NonActionableSearchItem(new Setting<GeneralSettingsTabViewModel, bool>(_settingsPage.GeneralSettingsTab, b => b.RunOnSystemStartup), "Run Wasabi when computer starts", "Settings", new List<string>() { "startup", "boot" }, "nav_settings_regular") { IsDefault = false },
- new NonActionableSearchItem(new Setting<TorSettingsTabViewModel, bool>(_settingsPage.TorSettingsTab, b => b.UseTor), "Network anonymization (Tor)", "Settings", new List<string>(), "nav_settings_regular") { IsDefault = false },
- new NonActionableSearchItem(new Setting<TorSettingsTabViewModel, bool>(_settingsPage.TorSettingsTab, b => b.TerminateTorOnExit), "Terminate Tor when Wasabi shuts down", "Settings", new List<string>(), "nav_settings_regular") { IsDefault = false },
+ new NonActionableSearchItem(new Setting<GeneralSettingsTabViewModel, bool>(_settingsPage.GeneralSettingsTab, b => b.UseTor), "Network anonymization (Tor)", "Settings", new List<string>(), "nav_settings_regular") { IsDefault = false },
+ new NonActionableSearchItem(new Setting<GeneralSettingsTabViewModel, bool>(_settingsPage.GeneralSettingsTab, b => b.TerminateTorOnExit), "Terminate Tor when Wasabi shuts down", "Settings", new List<string>(), "nav_settings_regular") { IsDefault = false },
new NonActionableSearchItem(new Setting<BitcoinTabSettingsViewModel, bool>(_settingsPage.BitcoinTabSettings, b => b.StartLocalBitcoinCoreOnStartup), "Start local Bitcoin core on startup", "Settings", new List<string>(), "nav_settings_regular") { IsDefault = false },
new NonActionableSearchItem(new Setting<BitcoinTabSettingsViewModel, bool>(_settingsPage.BitcoinTabSettings, b => b.StopLocalBitcoinCoreOnShutdown), "Stop local Bitcoin core on shutdown", "Settings", new List<string>(), "nav_settings_regular") { IsDefault = false },
};

MODIFY
WalletWasabi.Fluent/ViewModels/Settings/GeneralSettingsTabViewModel.cs
WalletWasabi.Fluent/ViewModels/Settings/GeneralSettingsTabViewModel.cs
@@ -6,7 +6,6 @@ using WalletWasabi.Fluent.Helpers;
using WalletWasabi.Fluent.Models;
using WalletWasabi.Logging;
using System.Windows.Input;
-using DynamicData;
namespace WalletWasabi.Fluent.ViewModels.Settings;
@@ -30,6 +29,8 @@ public partial class GeneralSettingsTabViewModel : SettingsTabViewModelBase
[AutoNotify] private FeeDisplayUnit _selectedFeeDisplayUnit;
[AutoNotify] private bool _runOnSystemStartup;
[AutoNotify] private bool _hideOnClose;
+ [AutoNotify] private bool _useTor;
+ [AutoNotify] private bool _terminateTorOnExit;
public GeneralSettingsTabViewModel()
{
@@ -42,6 +43,8 @@ public partial class GeneralSettingsTabViewModel : SettingsTabViewModelBase
_selectedFeeDisplayUnit = Enum.IsDefined(typeof(FeeDisplayUnit), Services.UiConfig.FeeDisplayUnit)
? (FeeDisplayUnit)Services.UiConfig.FeeDisplayUnit
: FeeDisplayUnit.Satoshis;
+ _useTor = Services.Config.UseTor;
+ _terminateTorOnExit = Services.Config.TerminateTorOnExit;
this.WhenAnyValue(x => x.DarkModeEnabled)
.Skip(1)
@@ -91,6 +94,14 @@ public partial class GeneralSettingsTabViewModel : SettingsTabViewModelBase
.ObserveOn(RxApp.TaskpoolScheduler)
.Skip(1)
.Subscribe(x => Services.UiConfig.HideOnClose = x);
+
+ this.WhenAnyValue(
+ x => x.UseTor,
+ x => x.TerminateTorOnExit)
+ .ObserveOn(RxApp.TaskpoolScheduler)
+ .Throttle(TimeSpan.FromMilliseconds(ThrottleTime))
+ .Skip(1)
+ .Subscribe(_ => Save());
}
public ICommand StartupCommand { get; }
@@ -100,5 +111,7 @@ public partial class GeneralSettingsTabViewModel : SettingsTabViewModelBase
protected override void EditConfigOnSave(Config config)
{
+ config.UseTor = UseTor;
+ config.TerminateTorOnExit = TerminateTorOnExit;
}
}

MODIFY
WalletWasabi.Fluent/ViewModels/Settings/SettingsPageViewModel.cs
WalletWasabi.Fluent/ViewModels/Settings/SettingsPageViewModel.cs
@@ -27,7 +27,6 @@ public partial class SettingsPageViewModel : NavBarItemViewModel
_selectedTab = 0;
GeneralSettingsTab = new GeneralSettingsTabViewModel();
- TorSettingsTab = new TorSettingsTabViewModel();
BitcoinTabSettings = new BitcoinTabSettingsViewModel();
RestartCommand = ReactiveCommand.Create(AppLifetimeHelper.Restart);
@@ -36,7 +35,6 @@ public partial class SettingsPageViewModel : NavBarItemViewModel
public ICommand RestartCommand { get; }
public GeneralSettingsTabViewModel GeneralSettingsTab { get; }
- public TorSettingsTabViewModel TorSettingsTab { get; }
public BitcoinTabSettingsViewModel BitcoinTabSettings { get; }
private void OnRestartNeeded(object? sender, RestartNeededEventArgs e)

DELETE
WalletWasabi.Fluent/ViewModels/Settings/TorSettingsTabViewModel.cs
-using System.Reactive.Linq;
-using ReactiveUI;
-
-namespace WalletWasabi.Fluent.ViewModels.Settings;
-
-[NavigationMetaData(
- Title = "Tor",
- Caption = "Manage Tor settings",
- Order = 2,
- Category = "Settings",
- Keywords = new[]
- {
- "Settings", "Network", "Anonymization", "Tor", "Terminate", "Wasabi", "Shutdown"
- },
- IconName = "settings_network_regular")]
-public partial class TorSettingsTabViewModel : SettingsTabViewModelBase
-{
- [AutoNotify] private bool _useTor;
- [AutoNotify] private bool _terminateTorOnExit;
-
- public TorSettingsTabViewModel()
- {
- _useTor = Services.Config.UseTor;
- _terminateTorOnExit = Services.Config.TerminateTorOnExit;
-
- this.WhenAnyValue(
- x => x.UseTor,
- x => x.TerminateTorOnExit)
- .ObserveOn(RxApp.TaskpoolScheduler)
- .Throttle(TimeSpan.FromMilliseconds(ThrottleTime))
- .Skip(1)
- .Subscribe(_ => Save());
- }
-
- protected override void EditConfigOnSave(Config config)
- {
- config.UseTor = UseTor;
- config.TerminateTorOnExit = TerminateTorOnExit;
- }
-}

MODIFY
WalletWasabi.Fluent/Views/Settings/GeneralSettingsTabView.axaml
WalletWasabi.Fluent/Views/Settings/GeneralSettingsTabView.axaml
</ComboBox.ItemTemplate>
</ComboBox>
</StackPanel>
+
+ <DockPanel>
+ <TextBlock Text="Network anonymization (Tor)" />
+ <ToggleSwitch IsChecked="{Binding UseTor}" />
+ </DockPanel>
+
+ <DockPanel IsVisible="{Binding UseTor}">
+ <TextBlock Text="Terminate Tor when Wasabi shuts down" />
+ <ToggleSwitch IsChecked="{Binding TerminateTorOnExit}" />
+ </DockPanel>
+
</StackPanel>
</UserControl>

MODIFY
WalletWasabi.Fluent/Views/Settings/SettingsPageView.axaml
WalletWasabi.Fluent/Views/Settings/SettingsPageView.axaml
<v:GeneralSettingsTabView DataContext="{Binding GeneralSettingsTab}" />
</TabItem>
- <TabItem Header="Tor">
- <v:TorSettingsTabView DataContext="{Binding TorSettingsTab}" />
- </TabItem>
-
<TabItem Header="Bitcoin">
<v:BitcoinTabSettingsView DataContext="{Binding BitcoinTabSettings}" />
</TabItem>

DELETE
WalletWasabi.Fluent/Views/Settings/TorSettingsTabView.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:settings="using:WalletWasabi.Fluent.ViewModels.Settings"
- mc:Ignorable="d" d:DesignWidth="428" d:DesignHeight="371"
- x:DataType="settings:TorSettingsTabViewModel"
- x:Class="WalletWasabi.Fluent.Views.Settings.TorSettingsTabView"
- x:CompileBindings="True">
- <StackPanel Classes="settingsLayout">
-
- <DockPanel>
- <TextBlock Text="Network anonymization (Tor)" />
- <ToggleSwitch IsChecked="{Binding UseTor}" />
- </DockPanel>
-
- <DockPanel IsVisible="{Binding UseTor}">
- <TextBlock Text="Terminate Tor when Wasabi shuts down" />
- <ToggleSwitch IsChecked="{Binding TerminateTorOnExit}" />
- </DockPanel>
- </StackPanel>
-</UserControl>

DELETE
WalletWasabi.Fluent/Views/Settings/TorSettingsTabView.axaml.cs
-using Avalonia.Controls;
-using Avalonia.Markup.Xaml;
-
-namespace WalletWasabi.Fluent.Views.Settings;
-
-public class TorSettingsTabView : UserControl
-{
- public TorSettingsTabView()
- {
- InitializeComponent();
- }
-
- private void InitializeComponent()
- {
- AvaloniaXamlLoader.Load(this);
- }
-}

Move Tor settings to General settings