fix bug if click authenticate now
This commit is contained in:
parent
ed18f8c312
commit
b9b4444028
1 changed files with 16 additions and 12 deletions
|
|
@ -58,7 +58,7 @@ class _MihPackageTileState extends State<MihPackageTile> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<bool> authenticateUser() async {
|
Future<bool> isUserAuthenticated() async {
|
||||||
final bool canAuthWithBio = await _auth.canCheckBiometrics;
|
final bool canAuthWithBio = await _auth.canCheckBiometrics;
|
||||||
final bool canAuthenticate =
|
final bool canAuthenticate =
|
||||||
canAuthWithBio || await _auth.isDeviceSupported();
|
canAuthWithBio || await _auth.isDeviceSupported();
|
||||||
|
|
@ -96,12 +96,12 @@ class _MihPackageTileState extends State<MihPackageTile> {
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
size: 100,
|
size: 100,
|
||||||
),
|
),
|
||||||
alertTitle: "Biometric Authentication Error",
|
alertTitle: "Biometric Authentication Required",
|
||||||
alertBody: Column(
|
alertBody: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
"Hi there! To jump into the MIH Home Package, you'll need to authenticate yourself with your phones biometrics, please set up biometric authentication (like fingerprint, face ID, pattern or pin) on your device first.\n\nIf you have already set up biometric authentication, press \"Authenticate now\" to try again or press \"Set Up Authentication\" to go to your device settings.",
|
"Hi there! To jump into the ${widget.appName} Package, you'll need to authenticate yourself with your devices biometrics, please set up biometric authentication (like fingerprint, face ID, pattern or pin) on your device first.\n\nIf you have already set up biometric authentication, press \"Authenticate now\" to try again or press \"Set Up Authentication\" to go to your device settings.",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 15,
|
fontSize: 15,
|
||||||
color: MihColors.getSecondaryColor(
|
color: MihColors.getSecondaryColor(
|
||||||
|
|
@ -168,6 +168,18 @@ class _MihPackageTileState extends State<MihPackageTile> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> authenticateUser() async {
|
||||||
|
if (widget.authenticateUser != null &&
|
||||||
|
widget.authenticateUser! &&
|
||||||
|
!kIsWeb) {
|
||||||
|
if (await isUserAuthenticated()) {
|
||||||
|
widget.onTap();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
widget.onTap();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return Container(
|
||||||
|
|
@ -177,15 +189,7 @@ class _MihPackageTileState extends State<MihPackageTile> {
|
||||||
// height: widget.iconSize + widget.iconSize / 3,
|
// height: widget.iconSize + widget.iconSize / 3,
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
if (widget.authenticateUser != null &&
|
authenticateUser();
|
||||||
widget.authenticateUser! &&
|
|
||||||
!kIsWeb) {
|
|
||||||
if (await authenticateUser()) {
|
|
||||||
widget.onTap();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
widget.onTap();
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
onLongPress: null, // Do this later
|
onLongPress: null, // Do this later
|
||||||
child: Column(
|
child: Column(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue