Make better logic for handling PIN hash and determining what screen lock type to use.
MODIFY
WalletWasabi.Gui/UiConfig.cs
WalletWasabi.Gui/UiConfig.cs
@@ -59,13 +59,6 @@ namespace WalletWasabi.Gui
set => this.RaiseAndSetIfChanged(ref _lockScreenActive, value);
}
- [JsonProperty(PropertyName = "LockScreenType")]
- public LockScreenType? LockScreenType
- {
- get => _lockScreenType;
- set => this.RaiseAndSetIfChanged(ref _lockScreenType, value);
- }
-
[JsonProperty(PropertyName = "LockScreenPinHash")]
public string LockScreenPinHash { get; internal set; }
@@ -80,7 +73,7 @@ namespace WalletWasabi.Gui
public UiConfig(WindowState windowState, double height, double width, int feeTarget,
int feeDisplayFormat, bool autocopy, bool lurkingWifeMode,
- bool LockScreenActive, string lockScreenPinHash, LockScreenType lockScreenType)
+ bool LockScreenActive, string lockScreenPinHash)
{
WindowState = Guard.NotNull(nameof(windowState), windowState);
Height = Guard.NotNull(nameof(height), height);
@@ -90,7 +83,6 @@ namespace WalletWasabi.Gui
Autocopy = Guard.NotNull(nameof(autocopy), autocopy);
LurkingWifeMode = Guard.NotNull(nameof(lurkingWifeMode), lurkingWifeMode);
LockScreenActive = Guard.NotNull(nameof(LockScreenActive), LockScreenActive);
- LockScreenType = Guard.NotNull(nameof(LockScreenType), lockScreenType);
LockScreenPinHash = Guard.NotNull(nameof(LockScreenPinHash), lockScreenPinHash);
}
@@ -119,7 +111,6 @@ namespace WalletWasabi.Gui
LurkingWifeMode = false;
LockScreenActive = false;
LockScreenPinHash = "";
- LockScreenType = Models.LockScreenType.SlideLock;
if (!File.Exists(FilePath))
{
@@ -147,7 +138,6 @@ namespace WalletWasabi.Gui
LurkingWifeMode = config.LurkingWifeMode ?? LurkingWifeMode;
LockScreenActive = config.LockScreenActive ?? LockScreenActive;
LockScreenPinHash = config.LockScreenPinHash ?? LockScreenPinHash;
- LockScreenType = config.LockScreenType ?? LockScreenType;
}
/// <inheritdoc />
@@ -203,11 +193,6 @@ namespace WalletWasabi.Gui
return true;
}
- if (LockScreenType != config.LockScreenType)
- {
- return true;
- }
-
if (LockScreenPinHash != config.LockScreenPinHash)
{
return true;

MODIFY
WalletWasabi.Gui/ViewModels/LockScreenViewModel.cs
WalletWasabi.Gui/ViewModels/LockScreenViewModel.cs
@@ -48,13 +48,23 @@ namespace WalletWasabi.Gui.ViewModels
.BindTo(Global.UiConfig, y => y.LockScreenActive)
.DisposeWith(Disposables);
- Global.UiConfig.WhenAnyValue(x => x.LockScreenType)
- .BindTo(this, y => y.ActiveLockScreen)
- .DisposeWith(Disposables);
-
Global.UiConfig.WhenAnyValue(x => x.LockScreenPinHash)
- .BindTo(this, y => y.PINHash)
+ .Subscribe(CheckLockScreenType)
.DisposeWith(Disposables);
}
+
+ private void CheckLockScreenType(string currentHash)
+ {
+ if (currentHash != string.Empty)
+ {
+ ActiveLockScreen = LockScreenType.PINLock;
+ }
+ else
+ {
+ ActiveLockScreen = default(LockScreenType);
+ }
+
+ PINHash = currentHash;
+ }
}
}
\ No newline at end of file

Make better logic for handling PIN hash and determining what screen lock type to use.