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_body.dart';
|
||||||
import 'package:Mzansi_Innovation_Hub/mih_components/mih_layout/mih_header.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_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:Mzansi_Innovation_Hub/mih_packages/mih_home/mih_profile_getter.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:local_auth/local_auth.dart';
|
import 'package:local_auth/local_auth.dart';
|
||||||
@@ -68,8 +69,10 @@ class _BiometricCheckState extends State<BiometricCheck> {
|
|||||||
|
|
||||||
void authenticateUser() async {
|
void authenticateUser() async {
|
||||||
final bool canAuthWithBio = await _auth.canCheckBiometrics;
|
final bool canAuthWithBio = await _auth.canCheckBiometrics;
|
||||||
// print("Biomentric Available: $canAuthWithBio");
|
final bool canAuthenticate =
|
||||||
if (canAuthWithBio) {
|
canAuthWithBio || await _auth.isDeviceSupported();
|
||||||
|
print("Auth Available: $canAuthenticate");
|
||||||
|
if (canAuthenticate) {
|
||||||
try {
|
try {
|
||||||
final bool didBioAuth = await _auth.authenticate(
|
final bool didBioAuth = await _auth.authenticate(
|
||||||
localizedReason: "Authenticate to access MIH",
|
localizedReason: "Authenticate to access MIH",
|
||||||
@@ -84,9 +87,48 @@ class _BiometricCheckState extends State<BiometricCheck> {
|
|||||||
}
|
}
|
||||||
// print("Authenticated: $didBioAuth");
|
// print("Authenticated: $didBioAuth");
|
||||||
} catch (error) {
|
} 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() {
|
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
|
# 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
|
# 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.
|
# 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:
|
environment:
|
||||||
sdk: '>=3.5.3 <4.0.0'
|
sdk: '>=3.5.3 <4.0.0'
|
||||||
|
|||||||
Reference in New Issue
Block a user