Skip to content

Commit

Permalink
Disable win hello settings if not available
Browse files Browse the repository at this point in the history
  • Loading branch information
timokoessler committed Sep 18, 2024
1 parent c25bb81 commit c2ba55f
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions Guard.WPF/Views/Pages/Settings.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ public Settings()
WinHelloSwitch.Checked += (sender, e) => EnableWinHello();
WinHelloSwitch.Unchecked += (sender, e) => DisableWinHello();

CheckWindowsHelloAvailability();

ScreenRecordingSwitch.IsChecked = SettingsManager.Settings.PreventRecording;
ScreenRecordingSwitch.Checked += (sender, e) =>
{
Expand Down Expand Up @@ -504,5 +506,22 @@ private void WebAuthn_Button_Click(object sender, RoutedEventArgs e)

mainWindow.Navigate(typeof(WebAuthnPage), true);
}

private async void CheckWindowsHelloAvailability()
{
if (!Auth.IsLoginEnabled())
{
// Switch already disabled
return;
}

var supported = await WindowsHello.IsAvailable();
if (!supported)
{
ignoreWinHelloSwitchEvents = true;
WinHelloSwitch.IsEnabled = false;
ignoreWinHelloSwitchEvents = false;
}
}
}
}

0 comments on commit c2ba55f

Please sign in to comment.