add error message if auth is not set up already

This commit is contained in:
2025-04-15 13:32:34 +02:00
parent 1743744c6d
commit f1cfbe7713
4 changed files with 58 additions and 1 deletions

View File

@@ -4,11 +4,13 @@ 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_components/mih_app_alert.dart';
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_icons.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';
import 'package:supertokens_flutter/supertokens.dart';
import 'package:app_settings/app_settings.dart';
class BiometricCheck extends StatefulWidget {
final bool personalSelected;
@@ -92,7 +94,8 @@ class _BiometricCheckState extends State<BiometricCheck> {
}
// print("Authenticated: $didBioAuth");
} catch (error) {
print(error);
print("Auth Error: $error");
authErrorPopUp();
}
}
// else {
@@ -118,6 +121,49 @@ class _BiometricCheckState extends State<BiometricCheck> {
// }
}
void authErrorPopUp() {
Widget alertpopUp = MihAppAlert(
alertIcon: Icon(
Icons.fingerprint,
color: MzanziInnovationHub.of(context)!.theme.errorColor(),
size: 100,
),
alertTitle: "Biometric Authentication Error",
alertBody: Column(
children: [
Text(
"Hi there! To jump into the MIH Home Package, you'll need to set up biometric authentication (like fingerprint or face ID) on your device first. It looks like it's not quite ready yet.\n\nPlease head over to your device's settings to enable it, or press the button below to start the set up process now.",
style: TextStyle(
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
),
),
const SizedBox(height: 20),
SizedBox(
width: 300,
child: MIHButton(
onTap: () {
AppSettings.openAppSettings(
type: AppSettingsType.security,
);
},
buttonText: "Set Up Authentication",
buttonColor:
MzanziInnovationHub.of(context)!.theme.successColor(),
textColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
),
)
],
),
alertColour: MzanziInnovationHub.of(context)!.theme.errorColor(),
);
showDialog(
context: context,
builder: (context) {
return alertpopUp;
},
);
}
MIHBody getBody() {
return MIHBody(
borderOn: false,