Make PIN capitalization C#-i.
MODIFY
WalletWasabi.Gui/Controls/LockScreen/LockScreenViewModel.cs
WalletWasabi.Gui/Controls/LockScreen/LockScreenViewModel.cs
@@ -28,7 +28,7 @@ namespace WalletWasabi.Gui.Controls.LockScreen
}
private ObservableAsPropertyHelper<string> _pinHash;
- public string PINHash => _pinHash?.Value ?? default;
+ public string PinHash => _pinHash?.Value ?? default;
private bool _isLocked;
@@ -54,7 +54,7 @@ namespace WalletWasabi.Gui.Controls.LockScreen
.WhenAnyValue(x => x.LockScreenPinHash)
.ObserveOn(RxApp.MainThreadScheduler)
.Do(x => CheckLockScreenType(x))
- .ToProperty(this, x => x.PINHash);
+ .ToProperty(this, x => x.PinHash);
}
private void CheckLockScreenType(string currentHash)

MODIFY
WalletWasabi.Gui/Controls/LockScreen/PinLockScreenViewModel.cs
WalletWasabi.Gui/Controls/LockScreen/PinLockScreenViewModel.cs
@@ -65,7 +65,7 @@ namespace WalletWasabi.Gui.Controls.LockScreen
.Where(x => x != string.Empty)
.Do(x => WarningMessageVisible = false)
.DistinctUntilChanged()
- .Subscribe(CheckPIN)
+ .Subscribe(CheckPin)
.DisposeWith(Disposables);
_isLocked = _parentVM.WhenAnyValue(x => x.IsLocked)
@@ -74,9 +74,9 @@ namespace WalletWasabi.Gui.Controls.LockScreen
.DisposeWith(Disposables);
}
- private void CheckPIN(string input)
+ private void CheckPin(string input)
{
- if (_parentVM.PINHash == HashHelpers.GenerateSha256Hash(input))
+ if (_parentVM.PinHash == HashHelpers.GenerateSha256Hash(input))
{
_parentVM.IsLocked = false;
PinInput = string.Empty;

MODIFY
WalletWasabi.Gui/Models/LockScreenType.cs
WalletWasabi.Gui/Models/LockScreenType.cs
@@ -7,6 +7,6 @@ namespace WalletWasabi.Gui.Models
public enum LockScreenType
{
SlideLock,
- PINLock,
+ PinLock,
}
}

MODIFY
WalletWasabi.Gui/Tabs/SettingsView.xaml
WalletWasabi.Gui/Tabs/SettingsView.xaml
<controls:GroupBox Title="Screen Lock" TextBlock.FontSize="16" Padding="10" Margin="0 5 10 5">
<StackPanel Orientation="Vertical" Spacing="5">
<StackPanel Margin="0 10" Orientation="Horizontal" Spacing="5">
- <ToggleButton IsChecked="{Binding EnablePINEntry}" Content="{Binding EnablePINEntry, Converter={StaticResource BooleanStringConverter}, ConverterParameter=On:Off}" Margin="0 0 10 0" Command="{Binding EnablePINLockCommand}" />
+ <ToggleButton IsChecked="{Binding EnablePinEntry}" Content="{Binding EnablePinEntry, Converter={StaticResource BooleanStringConverter}, ConverterParameter=On:Off}" Margin="0 0 10 0" Command="{Binding EnablePinLockCommand}" />
<TextBlock VerticalAlignment="Center">Use PIN to unlock the screen.</TextBlock>
</StackPanel>
<StackPanel Orientation="Vertical" Spacing="5">
- <controls:NoparaPasswordBox Watermark="PIN" Password="{Binding OldPINPwdBox}" UseFloatingWatermark="True" />
- <controls:NoparaPasswordBox Watermark="Confirm PIN" Password="{Binding NewPINPwdBox}" UseFloatingWatermark="True" />
- <TextBlock Text="{Binding ConfirmPINWarningMessage}" Classes="warningMessage" Margin="0 0 3 0" />
+ <controls:NoparaPasswordBox Watermark="PIN" Password="{Binding OldPinPwdBox}" UseFloatingWatermark="True" />
+ <TextBlock Text="{Binding ConfirmPinWarningMessage}" Classes="warningMessage" Margin="0 0 3 0" />
</StackPanel>
</StackPanel>
</controls:GroupBox>

MODIFY
WalletWasabi.Gui/Tabs/SettingsViewModel.cs
WalletWasabi.Gui/Tabs/SettingsViewModel.cs
@@ -27,21 +27,20 @@ namespace WalletWasabi.Gui.Tabs
private bool _autocopy;
private bool _useTor;
private bool _isModified;
- private bool _enablePINLock;
+ private bool _enablePinLock;
private string _somePrivacyLevel;
private string _finePrivacyLevel;
private string _strongPrivacyLevel;
private string _dustThreshold;
- private string _oldPINPwdBox;
- private string _newPINPwdBox;
- private string _confirmPINWarningMessage;
+ private string _oldPinPwdBox;
+ private string _confirmPinWarningMessage;
- private Regex PINNumOnlyRegex { get; } = new Regex("^[0-9]+$");
+ private Regex PinNumOnlyRegex { get; } = new Regex("^[0-9]+$");
private AsyncLock ConfigLock { get; } = new AsyncLock();
public ReactiveCommand<Unit, Unit> OpenConfigFileCommand { get; }
public ReactiveCommand<Unit, Unit> LurkingWifeModeCommand { get; }
- public ReactiveCommand<Unit, Unit> EnablePINLockCommand { get; }
+ public ReactiveCommand<Unit, Unit> EnablePinLockCommand { get; }
public ReactiveCommand<Unit, Unit> TextBoxLostFocusCommand { get; }
public SettingsViewModel(Global global) : base(global, "Settings")
@@ -93,7 +92,7 @@ namespace WalletWasabi.Gui.Tabs
IsModified = await Global.Config.CheckFileChangeAsync();
- EnablePINEntry = Global.UiConfig.LockScreenPinHash != string.Empty;
+ EnablePinEntry = Global.UiConfig.LockScreenPinHash != string.Empty;
});
OpenConfigFileCommand = ReactiveCommand.Create(OpenConfigFile);
@@ -104,53 +103,37 @@ namespace WalletWasabi.Gui.Tabs
await Global.UiConfig.ToFileAsync();
});
- EnablePINLockCommand = ReactiveCommand.CreateFromTask(async () =>
+ EnablePinLockCommand = ReactiveCommand.CreateFromTask(async () =>
{
- if (_oldPINPwdBox != _newPINPwdBox)
+ if (_oldPinPwdBox == string.Empty)
{
- ConfirmPINWarningMessage = "Both PIN entries does not match.";
- EnablePINEntry = !EnablePINEntry;
+ ConfirmPinWarningMessage = "Both PIN entries must be filled out.";
+ EnablePinEntry = !EnablePinEntry;
return;
}
- if (_oldPINPwdBox == string.Empty ||
- _newPINPwdBox == string.Empty)
- {
- ConfirmPINWarningMessage = "Both PIN entries must be filled out.";
- EnablePINEntry = !EnablePINEntry;
- return;
- }
+ var uiConfigPinHash = Global.UiConfig.LockScreenPinHash;
+ var enteredPinHash = HashHelpers.GenerateSha256Hash(_oldPinPwdBox);
- if (!PINNumOnlyRegex.IsMatch(_newPINPwdBox))
+ if (EnablePinEntry)
{
- ConfirmPINWarningMessage = "PIN should only contain numbers.";
- EnablePINEntry = !EnablePINEntry;
- return;
- }
-
- var uiConfigPINHash = Global.UiConfig.LockScreenPinHash;
- var enteredPINHash = HashHelpers.GenerateSha256Hash(_newPINPwdBox);
-
- if (EnablePINEntry)
- {
- Global.UiConfig.LockScreenPinHash = enteredPINHash;
+ Global.UiConfig.LockScreenPinHash = enteredPinHash;
await Global.UiConfig.ToFileAsync();
}
else
{
- if (uiConfigPINHash != enteredPINHash)
+ if (uiConfigPinHash != enteredPinHash)
{
- ConfirmPINWarningMessage = "Wrong PIN.";
- EnablePINEntry = true;
+ ConfirmPinWarningMessage = "Wrong PIN.";
+ EnablePinEntry = true;
return;
}
Global.UiConfig.LockScreenPinHash = string.Empty;
await Global.UiConfig.ToFileAsync();
}
- OldPINPwdBox = string.Empty;
- NewPINPwdBox = string.Empty;
- ConfirmPINWarningMessage = string.Empty;
+ OldPinPwdBox = string.Empty;
+ ConfirmPinWarningMessage = string.Empty;
});
TextBoxLostFocusCommand = ReactiveCommand.Create(Save);
@@ -256,28 +239,22 @@ namespace WalletWasabi.Gui.Tabs
public bool LurkingWifeMode => Global.UiConfig.LurkingWifeMode is true;
- public bool EnablePINEntry
- {
- get => _enablePINLock;
- set => this.RaiseAndSetIfChanged(ref _enablePINLock, value);
- }
-
- public string OldPINPwdBox
+ public bool EnablePinEntry
{
- get => _oldPINPwdBox;
- set => this.RaiseAndSetIfChanged(ref _oldPINPwdBox, value);
+ get => _enablePinLock;
+ set => this.RaiseAndSetIfChanged(ref _enablePinLock, value);
}
- public string NewPINPwdBox
+ public string OldPinPwdBox
{
- get => _newPINPwdBox;
- set => this.RaiseAndSetIfChanged(ref _newPINPwdBox, value);
+ get => _oldPinPwdBox;
+ set => this.RaiseAndSetIfChanged(ref _oldPinPwdBox, value);
}
- public string ConfirmPINWarningMessage
+ public string ConfirmPinWarningMessage
{
- get => _confirmPINWarningMessage;
- set => this.RaiseAndSetIfChanged(ref _confirmPINWarningMessage, value);
+ get => _confirmPinWarningMessage;
+ set => this.RaiseAndSetIfChanged(ref _confirmPinWarningMessage, value);
}
private void Save()

Make PIN capitalization C#-i.