Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
jiangtian616 committed Jan 14, 2025
2 parents 3889424 + e73fc7d commit acf2754
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
12 changes: 9 additions & 3 deletions lib/src/pages/lock_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,10 @@ class _LockPageState extends State<LockPage> with WindowListener, WindowWidgetMi

Future<void> biometricAuth() async {
bool success = await LocalAuthentication().authenticate(
localizedReason: ' ',
/**
* @see [local_auth_windows example](https://github.com/flutter/packages/blob/main/packages/local_auth/local_auth_windows/example/lib/main.dart)
*/
localizedReason: GetPlatform.isWindows ? 'localizedReason'.tr : ' ',
authMessages: [
AndroidAuthMessages(
signInTitle: 'localizedReason'.tr,
Expand All @@ -121,9 +124,12 @@ class _LockPageState extends State<LockPage> with WindowListener, WindowWidgetMi
),
const WindowsAuthMessages(),
],
options: const AuthenticationOptions(
options: AuthenticationOptions(
stickyAuth: true,
biometricOnly: true,
/**
* @see [local_auth_windows](https://github.com/flutter/packages/blob/733869c981a3d0c649d904febc486b47ddb5f672/packages/local_auth/local_auth_windows/lib/local_auth_windows.dart#L54)
*/
biometricOnly: !GetPlatform.isWindows,
),
);

Expand Down
7 changes: 7 additions & 0 deletions lib/src/setting/security_setting.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ class SecuritySetting with JHLifeCircleBeanWithConfigStorage implements JHLifeCi
List<BiometricType> types = await LocalAuthentication().getAvailableBiometrics();
supportBiometricAuth = types.isNotEmpty;
log.debug('Init SecuritySetting.supportBiometricAuth: $supportBiometricAuth');
} else if (GetPlatform.isWindows) {
List<BiometricType> types = await LocalAuthentication().getAvailableBiometrics();
/**
* @see [local_auth_windows](https://github.com/flutter/packages/blob/733869c981a3d0c649d904febc486b47ddb5f672/packages/local_auth/local_auth_windows/lib/local_auth_windows.dart#L54)
*/
supportBiometricAuth = types.any((t) => t == BiometricType.strong);
log.debug('Init SecuritySetting.supportBiometricAuth: $supportBiometricAuth');
}
}

Expand Down

0 comments on commit acf2754

Please sign in to comment.