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() {
base::scoped_nsobject<LAContext> context([[LAContext alloc] init]);
if (![context
canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics
error:nil])
LAPolicy auth_policy = LAPolicyDeviceOwnerAuthenticationWithBiometrics;
if (@available(macOS 10.15, *))
auth_policy = LAPolicyDeviceOwnerAuthenticationWithBiometricsOrWatch;
if (![context canEvaluatePolicy:auth_policy error:nil])
return false;
if (@available(macOS 10.13.2, *))
return [context biometryType] == LABiometryTypeTouchID;