From f0bc096738fad891a571b17bf0be282f8ee56808 Mon Sep 17 00:00:00 2001 From: yaso Date: Mon, 3 Feb 2025 12:38:19 +0200 Subject: [PATCH 1/3] Auth if no finger print avalable --- .../authentication/biometric_check.dart | 47 +++++++++++++++++-- 1 file changed, 44 insertions(+), 3 deletions(-) diff --git a/Frontend/lib/mih_packages/authentication/biometric_check.dart b/Frontend/lib/mih_packages/authentication/biometric_check.dart index 60e59e9f..b69d06c0 100644 --- a/Frontend/lib/mih_packages/authentication/biometric_check.dart +++ b/Frontend/lib/mih_packages/authentication/biometric_check.dart @@ -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 { 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,8 +87,46 @@ class _BiometricCheckState extends State { } // 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(), + ); + }, + ); } } From 8af6d5282a0ce5436b5764afe9e7f46346f330fd Mon Sep 17 00:00:00 2001 From: yaso Date: Mon, 3 Feb 2025 13:35:19 +0200 Subject: [PATCH 2/3] remove error message pop up --- .../authentication/biometric_check.dart | 41 ++++++++++--------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/Frontend/lib/mih_packages/authentication/biometric_check.dart b/Frontend/lib/mih_packages/authentication/biometric_check.dart index b69d06c0..2c948e26 100644 --- a/Frontend/lib/mih_packages/authentication/biometric_check.dart +++ b/Frontend/lib/mih_packages/authentication/biometric_check.dart @@ -107,27 +107,28 @@ class _BiometricCheckState extends State { }, ); } - } 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(), - ); - }, - ); } + // 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() { From e162c1697fe297b239e63543cde65af2008cef02 Mon Sep 17 00:00:00 2001 From: yaso Date: Mon, 3 Feb 2025 13:35:32 +0200 Subject: [PATCH 3/3] version update to 1.0.5+22 --- Frontend/pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Frontend/pubspec.yaml b/Frontend/pubspec.yaml index 51e0de24..52e6a5e7 100644 --- a/Frontend/pubspec.yaml +++ b/Frontend/pubspec.yaml @@ -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'