feat: add support for unlocking with Apple Watch (#36935)

This commit is contained in:
Mikaël Barbero 2023-01-26 13:05:42 +01:00 committed by GitHub
parent c303135b02
commit 1486cbdf64
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -425,9 +425,10 @@ std::string SystemPreferences::GetSystemColor(gin_helper::ErrorThrower thrower,
bool SystemPreferences::CanPromptTouchID() { bool SystemPreferences::CanPromptTouchID() {
base::scoped_nsobject<LAContext> context([[LAContext alloc] init]); base::scoped_nsobject<LAContext> context([[LAContext alloc] init]);
if (![context LAPolicy auth_policy = LAPolicyDeviceOwnerAuthenticationWithBiometrics;
canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics if (@available(macOS 10.15, *))
error:nil]) auth_policy = LAPolicyDeviceOwnerAuthenticationWithBiometricsOrWatch;
if (![context canEvaluatePolicy:auth_policy error:nil])
return false; return false;
if (@available(macOS 10.13.2, *)) if (@available(macOS 10.13.2, *))
return [context biometryType] == LABiometryTypeTouchID; return [context biometryType] == LABiometryTypeTouchID;