Sync regular settings
MODIFY
WalletWasabi.Fluent/ViewModels/MainViewModel.cs
WalletWasabi.Fluent/ViewModels/MainViewModel.cs
@@ -176,7 +176,7 @@ public partial class MainViewModel : ViewModelBase
}
});
- var source = new CompositeSearchItemsSource(new TransactionsSource(), new ActionsSource(), new SettingsSource());
+ var source = new CompositeSearchItemsSource(new TransactionsSource(), new ActionsSource(), new SettingsSource(_settingsPage));
SearchBar = new SearchBarViewModel(source.Changes);
}

DELETE
WalletWasabi.Fluent/ViewModels/SearchBar/Settings/DarkThemeSetting.cs
-using System.Reactive;
-using System.Reactive.Linq;
-using System.Threading.Tasks;
-using ReactiveUI;
-using WalletWasabi.Fluent.Helpers;
-
-namespace WalletWasabi.Fluent.ViewModels.SearchBar.Settings;
-
-public class DarkThemeSetting : Setting<UiConfig, bool>
-{
- public DarkThemeSetting(UiConfig uiConfig) : base(uiConfig, config => config.DarkModeEnabled)
- {
- this.WhenAnyValue(x => x.Value)
- .SelectMany(b =>
- {
- return Observable.FromAsync(() =>
- {
- ThemeHelper.ApplyTheme(b ? Theme.Dark : Theme.Light);
- return Task.FromResult(Unit.Default);
- });
- })
- .Subscribe();
- }
-}
\ No newline at end of file

ADD
WalletWasabi.Fluent/ViewModels/SearchBar/Settings/PropertyChangedMessage.cs
+namespace WalletWasabi.Fluent.ViewModels.SearchBar.Settings;
+
+public class PropertyChangedMessage
+{
+ public string Name { get; }
+
+ public PropertyChangedMessage(string name)
+ {
+ Name = name;
+ }
+}
\ No newline at end of file

MODIFY
WalletWasabi.Fluent/ViewModels/SearchBar/Settings/Setting.cs
WalletWasabi.Fluent/ViewModels/SearchBar/Settings/Setting.cs
@@ -43,7 +43,11 @@ public class Setting<TTarget, TProperty> : ReactiveObject
Value = (TProperty?) pr.GetValue(target);
- SetValueCommand = ReactiveCommand.Create(() => pr.SetValue(target, Value));
+ SetValueCommand = ReactiveCommand.Create(() =>
+ {
+ pr.SetValue(target, Value);
+ MessageBus.Current.SendMessage(new PropertyChangedMessage(pr.Name));
+ });
this.WhenAnyValue(x => x.Value)
.ObserveOn(RxApp.TaskpoolScheduler)

MODIFY
WalletWasabi.Fluent/ViewModels/SearchBar/Settings/SettingSelector.cs
WalletWasabi.Fluent/ViewModels/SearchBar/Settings/SettingSelector.cs
@@ -7,6 +7,7 @@ namespace WalletWasabi.Fluent.ViewModels.SearchBar.Settings;
public class SettingSelector : IDataTemplate
{
+ // ReSharper disable once CollectionNeverUpdated.Global
public List<IDataTemplate> DataTemplates { get; set; } = new();
public IControl Build(object param)

MODIFY
WalletWasabi.Fluent/ViewModels/SearchBar/Sources/SettingsSource.cs
WalletWasabi.Fluent/ViewModels/SearchBar/Sources/SettingsSource.cs
@@ -10,26 +10,30 @@ namespace WalletWasabi.Fluent.ViewModels.SearchBar.Sources;
public class SettingsSource : ISearchItemSource
{
+ private readonly SettingsPageViewModel _settingsPage;
+
+ public SettingsSource(SettingsPageViewModel settingsPage)
+ {
+ _settingsPage = settingsPage;
+ }
+
public IObservable<IChangeSet<ISearchItem, ComposedKey>> Changes => GetSettingsItems()
.ToObservable()
.ToObservableChangeSet(x => x.Key);
- private static IEnumerable<ISearchItem> GetSettingsItems()
+ private IEnumerable<ISearchItem> GetSettingsItems()
{
- var torSettings = new TorSettingsTabViewModel();
- var btSettings = new BitcoinTabSettingsViewModel();
-
return new ISearchItem[]
{
- new NonActionableSearchItem(new DarkThemeSetting(Services.UiConfig), "Dark mode", "Appearance", new List<string> { "Black", "White", "Theme" }, "nav_settings_regular"){ IsDefault = false},
- new NonActionableSearchItem(new Setting<UiConfig, bool>(Services.UiConfig, b => b.Autocopy), "Auto copy addresses", "Settings", new List<string>(), "nav_settings_regular") { IsDefault = false },
- new NonActionableSearchItem(new Setting<UiConfig, bool>(Services.UiConfig, b => b.AutoPaste), "Auto paste addresses", "Settings", new List<string>(), "nav_settings_regular") { IsDefault = false },
- new NonActionableSearchItem(new Setting<UiConfig, bool>(Services.UiConfig, b => b.HideOnClose), "Run in background when closed", "Settings", new List<string>() { "hide", "tray" }, "nav_settings_regular") { IsDefault = false },
- new NonActionableSearchItem(new Setting<UiConfig, bool>(Services.UiConfig, 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>(torSettings, b => b.UseTor, true), "Network anonymization (Tor)", "Settings", new List<string>(), "nav_settings_regular") { IsDefault = false },
- new NonActionableSearchItem(new Setting<TorSettingsTabViewModel, bool>(torSettings, b => b.TerminateTorOnExit, true), "Terminate Tor when Wasabi shuts down", "Settings", new List<string>(), "nav_settings_regular") { IsDefault = false },
- new NonActionableSearchItem(new Setting<BitcoinTabSettingsViewModel, bool>(btSettings, b => b.StartLocalBitcoinCoreOnStartup), "Start local Bitcoin core on startup", "Settings", new List<string>(), "nav_settings_regular") { IsDefault = false },
- new NonActionableSearchItem(new Setting<BitcoinTabSettingsViewModel, bool>(btSettings, b => b.StopLocalBitcoinCoreOnShutdown), "Stop local Bitcoin core on shutdown", "Settings", new List<string>(), "nav_settings_regular") { IsDefault = false },
+ new NonActionableSearchItem(new Setting<GeneralSettingsTabViewModel, bool>(_settingsPage.GeneralSettingsTab, x => x.DarkModeEnabled), "Dark mode", "Appearance", new List<string> { "Black", "White", "Theme" }, "nav_settings_regular"){ IsDefault = false},
+ new NonActionableSearchItem(new Setting<GeneralSettingsTabViewModel, bool>(_settingsPage.GeneralSettingsTab, b => b.AutoCopy), "Auto copy addresses", "Settings", new List<string>(), "nav_settings_regular") { IsDefault = false },
+ 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, true), "Network anonymization (Tor)", "Settings", new List<string>(), "nav_settings_regular") { IsDefault = false },
+ new NonActionableSearchItem(new Setting<TorSettingsTabViewModel, bool>(_settingsPage.TorSettingsTab, b => b.TerminateTorOnExit, true), "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 },
};
}
}
\ No newline at end of file

MODIFY
WalletWasabi.Fluent/ViewModels/Settings/TorSettingsTabViewModel.cs
WalletWasabi.Fluent/ViewModels/Settings/TorSettingsTabViewModel.cs
using System.Reactive.Linq;
using ReactiveUI;
+using WalletWasabi.Fluent.ViewModels.SearchBar.Settings;
namespace WalletWasabi.Fluent.ViewModels.Settings;

Sync regular settings