forked from yaso_meth/mih-project
Merge pull request #140 from yaso-meth/BUG--Auth-bug-if-no-auth-set
add error message if auth is not set up already
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
import FlutterMacOS
|
||||
import Foundation
|
||||
|
||||
import app_settings
|
||||
import device_info_plus
|
||||
import file_picker
|
||||
import flutter_tts
|
||||
@@ -20,6 +21,7 @@ import url_launcher_macos
|
||||
import webview_flutter_wkwebview
|
||||
|
||||
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
||||
AppSettingsPlugin.register(with: registry.registrar(forPlugin: "AppSettingsPlugin"))
|
||||
DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin"))
|
||||
FilePickerPlugin.register(with: registry.registrar(forPlugin: "FilePickerPlugin"))
|
||||
FlutterTtsPlugin.register(with: registry.registrar(forPlugin: "FlutterTtsPlugin"))
|
||||
|
||||
@@ -25,6 +25,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.0.3"
|
||||
app_settings:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: app_settings
|
||||
sha256: "3e46c561441e5820d3a25339bf8b51b9e45a5f686873851a20c257a530917795"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.1.1"
|
||||
archive:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
||||
@@ -75,6 +75,7 @@ dependencies:
|
||||
flutter_tts: ^4.2.2
|
||||
flutter_speed_dial: ^7.0.0
|
||||
share_plus: ^10.1.4
|
||||
app_settings: ^6.1.1
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
||||
Reference in New Issue
Block a user