forked from yaso_meth/mih-project
Merge pull request #71 from yaso-meth/BUG-Bio-Auth-when-no-fingerprint-on-phone
BUG-Bio-Auth-when-no-fingerprint-on-phone
This commit is contained in:
@@ -4,6 +4,7 @@ import 'package:Mzansi_Innovation_Hub/mih_components/mih_layout/mih_action.dart'
|
||||
import 'package:Mzansi_Innovation_Hub/mih_components/mih_layout/mih_body.dart';
|
||||
import 'package:Mzansi_Innovation_Hub/mih_components/mih_layout/mih_header.dart';
|
||||
import 'package:Mzansi_Innovation_Hub/mih_components/mih_layout/mih_layout_builder.dart';
|
||||
import 'package:Mzansi_Innovation_Hub/mih_components/mih_package/mih_app_alert.dart';
|
||||
import 'package:Mzansi_Innovation_Hub/mih_packages/mih_home/mih_profile_getter.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:local_auth/local_auth.dart';
|
||||
@@ -68,8 +69,10 @@ class _BiometricCheckState extends State<BiometricCheck> {
|
||||
|
||||
void authenticateUser() async {
|
||||
final bool canAuthWithBio = await _auth.canCheckBiometrics;
|
||||
// print("Biomentric Available: $canAuthWithBio");
|
||||
if (canAuthWithBio) {
|
||||
final bool canAuthenticate =
|
||||
canAuthWithBio || await _auth.isDeviceSupported();
|
||||
print("Auth Available: $canAuthenticate");
|
||||
if (canAuthenticate) {
|
||||
try {
|
||||
final bool didBioAuth = await _auth.authenticate(
|
||||
localizedReason: "Authenticate to access MIH",
|
||||
@@ -84,9 +87,48 @@ class _BiometricCheckState extends State<BiometricCheck> {
|
||||
}
|
||||
// print("Authenticated: $didBioAuth");
|
||||
} catch (error) {
|
||||
print(error);
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return MihAppAlert(
|
||||
alertIcon: Icon(
|
||||
Icons.warning,
|
||||
color: MzanziInnovationHub.of(context)!.theme.errorColor(),
|
||||
),
|
||||
alertTitle: "Biometric Error",
|
||||
alertBody: Text(
|
||||
error.toString(),
|
||||
style: TextStyle(
|
||||
color: MzanziInnovationHub.of(context)!.theme.errorColor(),
|
||||
),
|
||||
),
|
||||
alertColour: MzanziInnovationHub.of(context)!.theme.errorColor(),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
// else {
|
||||
// showDialog(
|
||||
// context: context,
|
||||
// builder: (context) {
|
||||
// return MihAppAlert(
|
||||
// alertIcon: Icon(
|
||||
// Icons.warning,
|
||||
// color: MzanziInnovationHub.of(context)!.theme.errorColor(),
|
||||
// ),
|
||||
// alertTitle: "Biometric Error",
|
||||
// alertBody: Text(
|
||||
// "Auth not allowed",
|
||||
// style: TextStyle(
|
||||
// color: MzanziInnovationHub.of(context)!.theme.errorColor(),
|
||||
// ),
|
||||
// ),
|
||||
// alertColour: MzanziInnovationHub.of(context)!.theme.errorColor(),
|
||||
// );
|
||||
// },
|
||||
// );
|
||||
// }
|
||||
}
|
||||
|
||||
MIHBody getBody() {
|
||||
|
||||
@@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||
# In Windows, build-name is used as the major, minor, and patch parts
|
||||
# of the product and file versions while build-number is used as the build suffix.
|
||||
version: 1.0.4+21
|
||||
version: 1.0.5+22
|
||||
|
||||
environment:
|
||||
sdk: '>=3.5.3 <4.0.0'
|
||||
|
||||
Reference in New Issue
Block a user