mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-08 19:59:29 +00:00
bio fix
This commit is contained in:
parent
412e3fdf07
commit
3573f70004
1 changed files with 26 additions and 97 deletions
|
@ -46,115 +46,44 @@ class Biometrics {
|
||||||
final canCheckBiometrics = await localAuth.canCheckBiometrics;
|
final canCheckBiometrics = await localAuth.canCheckBiometrics;
|
||||||
final isDeviceSupported = await localAuth.isDeviceSupported();
|
final isDeviceSupported = await localAuth.isDeviceSupported();
|
||||||
|
|
||||||
//todo: check if print needed
|
|
||||||
// debugPrint("canCheckBiometrics: $canCheckBiometrics");
|
// debugPrint("canCheckBiometrics: $canCheckBiometrics");
|
||||||
// debugPrint("isDeviceSupported: $isDeviceSupported");
|
// debugPrint("isDeviceSupported: $isDeviceSupported");
|
||||||
|
|
||||||
if (canCheckBiometrics && isDeviceSupported) {
|
if (canCheckBiometrics && isDeviceSupported) {
|
||||||
final List<BiometricType> availableSystems =
|
List<BiometricType> availableSystems =
|
||||||
await localAuth.getAvailableBiometrics();
|
await localAuth.getAvailableBiometrics();
|
||||||
|
|
||||||
//todo: check if print needed
|
Logging.instance.log(
|
||||||
// debugPrint("availableSystems: $availableSystems");
|
"Bio availableSystems: $availableSystems",
|
||||||
|
level: LogLevel.Info,
|
||||||
|
);
|
||||||
|
|
||||||
//TODO properly handle caught exceptions
|
//TODO properly handle caught exceptions
|
||||||
if (availableSystems.contains(BiometricType.strong)) {
|
try {
|
||||||
try {
|
final bool didAuthenticate = await localAuth.authenticate(
|
||||||
final bool didAuthenticate = await localAuth.authenticate(
|
localizedReason: localizedReason,
|
||||||
localizedReason: localizedReason,
|
options: const AuthenticationOptions(
|
||||||
options: const AuthenticationOptions(
|
stickyAuth: true,
|
||||||
stickyAuth: true,
|
biometricOnly: true,
|
||||||
biometricOnly: true,
|
),
|
||||||
|
authMessages: <AuthMessages>[
|
||||||
|
AndroidAuthMessages(
|
||||||
|
biometricHint: "",
|
||||||
|
cancelButton: cancelButtonText,
|
||||||
|
signInTitle: title,
|
||||||
),
|
),
|
||||||
authMessages: <AuthMessages>[
|
],
|
||||||
AndroidAuthMessages(
|
);
|
||||||
biometricHint: "",
|
|
||||||
cancelButton: cancelButtonText,
|
|
||||||
signInTitle: title,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
|
|
||||||
if (didAuthenticate) {
|
if (didAuthenticate) {
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
Logging.instance.log(
|
|
||||||
"local_auth exception caught in Biometrics.authenticate(), e: $e",
|
|
||||||
level: LogLevel.Error,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
} catch (e) {
|
||||||
|
Logging.instance.log(
|
||||||
|
"local_auth exception caught in Biometrics.authenticate(), e: $e",
|
||||||
|
level: LogLevel.Error,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (Platform.isIOS) {
|
|
||||||
// if (availableSystems.contains(BiometricType.face)) {
|
|
||||||
// try {
|
|
||||||
// final bool didAuthenticate = await localAuth.authenticate(
|
|
||||||
// localizedReason: localizedReason,
|
|
||||||
// options: const AuthenticationOptions(
|
|
||||||
// stickyAuth: true,
|
|
||||||
// biometricOnly: true,
|
|
||||||
// ),
|
|
||||||
// );
|
|
||||||
//
|
|
||||||
// if (didAuthenticate) {
|
|
||||||
// return true;
|
|
||||||
// }
|
|
||||||
// } catch (e) {
|
|
||||||
// Logging.instance.log(
|
|
||||||
// "local_auth exception caught in Biometrics.authenticate(), e: $e",
|
|
||||||
// level: LogLevel.Error,
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
// } else if (availableSystems.contains(BiometricType.fingerprint)) {
|
|
||||||
// try {
|
|
||||||
// final bool didAuthenticate = await localAuth.authenticate(
|
|
||||||
// localizedReason: localizedReason,
|
|
||||||
// options: const AuthenticationOptions(
|
|
||||||
// stickyAuth: true,
|
|
||||||
// biometricOnly: true,
|
|
||||||
// ),
|
|
||||||
// );
|
|
||||||
//
|
|
||||||
// if (didAuthenticate) {
|
|
||||||
// return true;
|
|
||||||
// }
|
|
||||||
// } catch (e) {
|
|
||||||
// Logging.instance.log(
|
|
||||||
// "local_auth exception caught in Biometrics.authenticate(), e: $e",
|
|
||||||
// level: LogLevel.Error,
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// } else if (Platform.isAndroid) {
|
|
||||||
// if (availableSystems.contains(BiometricType.fingerprint)) {
|
|
||||||
// try {
|
|
||||||
// final bool didAuthenticate = await localAuth.authenticate(
|
|
||||||
// localizedReason: localizedReason,
|
|
||||||
// options: const AuthenticationOptions(
|
|
||||||
// stickyAuth: true,
|
|
||||||
// biometricOnly: true,
|
|
||||||
// ),
|
|
||||||
// authMessages: <AuthMessages>[
|
|
||||||
// AndroidAuthMessages(
|
|
||||||
// biometricHint: "",
|
|
||||||
// cancelButton: cancelButtonText,
|
|
||||||
// signInTitle: title,
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// );
|
|
||||||
//
|
|
||||||
// if (didAuthenticate) {
|
|
||||||
// return true;
|
|
||||||
// }
|
|
||||||
// } catch (e) {
|
|
||||||
// Logging.instance.log(
|
|
||||||
// "local_auth exception caught in Biometrics.authenticate(), e: $e",
|
|
||||||
// level: LogLevel.Error,
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// authentication failed
|
// authentication failed
|
||||||
|
|
Loading…
Reference in a new issue