remove uiconfig restart needed hack
MODIFY
WalletWasabi.Fluent/ViewModels/Settings/BitcoinTabSettingsViewModel.cs
WalletWasabi.Fluent/ViewModels/Settings/BitcoinTabSettingsViewModel.cs
@@ -31,7 +31,7 @@ namespace WalletWasabi.Fluent.ViewModels.Settings
[AutoNotify] private string _bitcoinP2PEndPoint;
[AutoNotify] private string _dustThreshold;
- public BitcoinTabSettingsViewModel(Config config, UiConfig uiConfig) : base(config, uiConfig)
+ public BitcoinTabSettingsViewModel(Config config) : base(config)
{
this.ValidateProperty(x => x.BitcoinP2PEndPoint, ValidateBitcoinP2PEndPoint);
this.ValidateProperty(x => x.DustThreshold, ValidateDustThreshold);

MODIFY
WalletWasabi.Fluent/ViewModels/Settings/GeneralSettingsTabViewModel.cs
WalletWasabi.Fluent/ViewModels/Settings/GeneralSettingsTabViewModel.cs
@@ -28,7 +28,7 @@ namespace WalletWasabi.Fluent.ViewModels.Settings
[AutoNotify] private bool _customChangeAddress;
[AutoNotify] private FeeDisplayFormat _selectedFeeDisplayFormat;
- public GeneralSettingsTabViewModel(Config config, UiConfig uiConfig) : base(config, uiConfig)
+ public GeneralSettingsTabViewModel(Config config, UiConfig uiConfig) : base(config)
{
_darkModeEnabled = uiConfig.DarkModeEnabled;
_autoCopy = uiConfig.Autocopy;
@@ -44,7 +44,6 @@ namespace WalletWasabi.Fluent.ViewModels.Settings
x =>
{
uiConfig.DarkModeEnabled = x;
- // IsRestartNeeded(x);
Navigate(NavigationTarget.CompactDialogScreen).To(new ThemeChangeViewModel(x ? Theme.Dark : Theme.Light));
});

MODIFY
WalletWasabi.Fluent/ViewModels/Settings/NetworkSettingsTabViewModel.cs
WalletWasabi.Fluent/ViewModels/Settings/NetworkSettingsTabViewModel.cs
@@ -26,7 +26,7 @@ namespace WalletWasabi.Fluent.ViewModels.Settings
[AutoNotify] private bool _terminateTorOnExit;
[AutoNotify] private string _torSocks5EndPoint;
- public NetworkSettingsTabViewModel(Config config, UiConfig uiConfig) : base(config, uiConfig)
+ public NetworkSettingsTabViewModel(Config config) : base(config)
{
this.ValidateProperty(x => x.TorSocks5EndPoint, ValidateTorSocks5EndPoint);

MODIFY
WalletWasabi.Fluent/ViewModels/Settings/PrivacySettingsTabViewModel.cs
WalletWasabi.Fluent/ViewModels/Settings/PrivacySettingsTabViewModel.cs
@@ -18,7 +18,7 @@ namespace WalletWasabi.Fluent.ViewModels.Settings
[AutoNotify] private int _mediumPrivacyLevel;
[AutoNotify] private int _strongPrivacyLevel;
- public PrivacySettingsTabViewModel(Config config, UiConfig uiConfig) : base(config, uiConfig)
+ public PrivacySettingsTabViewModel(Config config) : base(config)
{
_minimalPrivacyLevel = config.PrivacyLevelSome;
_mediumPrivacyLevel = config.PrivacyLevelFine;

MODIFY
WalletWasabi.Fluent/ViewModels/Settings/SettingsPageViewModel.cs
WalletWasabi.Fluent/ViewModels/Settings/SettingsPageViewModel.cs
@@ -19,14 +19,12 @@ namespace WalletWasabi.Fluent.ViewModels.Settings
public SettingsPageViewModel(Config config, UiConfig uiConfig)
{
- Title = "Settings";
-
_selectedTab = 0;
GeneralSettingsTab = new GeneralSettingsTabViewModel(config, uiConfig);
- PrivacySettingsTab = new PrivacySettingsTabViewModel(config, uiConfig);
- NetworkSettingsTab = new NetworkSettingsTabViewModel(config, uiConfig);
- BitcoinTabSettings = new BitcoinTabSettingsViewModel(config, uiConfig);
+ PrivacySettingsTab = new PrivacySettingsTabViewModel(config);
+ NetworkSettingsTab = new NetworkSettingsTabViewModel(config);
+ BitcoinTabSettings = new BitcoinTabSettingsViewModel(config);
}
public GeneralSettingsTabViewModel GeneralSettingsTab { get; }

MODIFY
WalletWasabi.Fluent/ViewModels/Settings/SettingsTabViewModelBase.cs
WalletWasabi.Fluent/ViewModels/Settings/SettingsTabViewModelBase.cs
@@ -12,21 +12,16 @@ namespace WalletWasabi.Fluent.ViewModels.Settings
{
protected const int ThrottleTime = 500;
- protected SettingsTabViewModelBase(Config config, UiConfig uiConfig)
+ protected SettingsTabViewModelBase(Config config)
{
ConfigOnOpen = new Config(config.FilePath);
ConfigOnOpen.LoadFile();
-
- UiConfigOnOpen = new UiConfig(uiConfig.FilePath);
- UiConfigOnOpen.LoadFile();
}
public static event EventHandler<RestartNeededEventArgs>? RestartNeeded;
public static Config? ConfigOnOpen { get; set; }
- public static UiConfig? UiConfigOnOpen { get; set; }
-
private static object ConfigLock { get; } = new ();
protected void Save()
@@ -61,13 +56,9 @@ namespace WalletWasabi.Fluent.ViewModels.Settings
protected abstract void EditConfigOnSave(Config config);
- protected static void IsRestartNeeded(object? darkMode = null)
+ protected static void IsRestartNeeded()
{
- // When Avalonia improved the theme switching no need to check for UI Config changes,
- // because we can switch runtime, and it will be unnecessary to show the restart message.
- // TODO: Is theme switching without UI freeze working?
-
- if (UiConfigOnOpen is null || ConfigOnOpen is null)
+ if (ConfigOnOpen is null)
{
return;
}
@@ -75,26 +66,13 @@ namespace WalletWasabi.Fluent.ViewModels.Settings
var currentConfig = new Config(ConfigOnOpen.FilePath);
currentConfig.LoadFile();
- var currentUiConfig = new UiConfig(UiConfigOnOpen.FilePath);
- currentUiConfig.LoadFile();
-
- bool uiConfigChanged;
- if (darkMode is not null)
- {
- uiConfigChanged = UiConfigOnOpen.DarkModeEnabled != (bool) darkMode;
- }
- else
- {
- uiConfigChanged = !UiConfigOnOpen.AreDeepEqual(currentUiConfig);
- }
-
var configChanged = !ConfigOnOpen.AreDeepEqual(currentConfig);
RestartNeeded?.Invoke(
typeof(SettingsTabViewModelBase),
new RestartNeededEventArgs
{
- IsRestartNeeded = uiConfigChanged || configChanged
+ IsRestartNeeded = configChanged
});
}
}

remove uiconfig restart needed hack