handel fingerprint auth error

merge-requests/1/merge
Elham Rababah 6 years ago
parent c71fe22248
commit 5bee9d1984

@ -11,6 +11,7 @@ import '../../routes.dart';
import '../../util/dr_app_shared_pref.dart';
import '../../util/dr_app_toast_msg.dart';
import '../../widgets/shared/dr_app_circular_progress_Indeicator.dart';
import 'package:local_auth/error_codes.dart' as auth_error;
DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
DrAppToastMsg toastMsg = DrAppToastMsg();
@ -55,7 +56,7 @@ class _KnownUserLoginState extends State<KnownUserLogin> {
sharedPref.getObj('loggedUser').then((userInfo) {
_loggedUser = userInfo;
});
sharedPref.getString('platformImei').then((imei){
sharedPref.getString('platformImei').then((imei) {
_platformImei = imei;
});
}
@ -64,23 +65,19 @@ class _KnownUserLoginState extends State<KnownUserLogin> {
void initState() {
super.initState();
_loggedUserFuture = getSharedPref();
}
@override
Widget build(BuildContext context) {
AuthProvider authProv = Provider.of<AuthProvider>(context);
var imeiModel = {'IMEI': _platformImei};
_loginTypeFuture = authProv.selectDeviceImei(imeiModel);
var imeiModel = {'IMEI': _platformImei};
_loginTypeFuture = authProv.selectDeviceImei(imeiModel);
return FutureBuilder(
future: Future.wait([_loggedUserFuture ,_loginTypeFuture]),
future: Future.wait([_loggedUserFuture, _loginTypeFuture]),
builder: (BuildContext context, AsyncSnapshot snapshot) {
_loginTypeFuture.then((res) {
_loginType =
2; //res['SELECTDeviceIMEIbyIMEI_List'][0]['LogInType'];
}).catchError((err) {
print('${err}');
});
@ -318,6 +315,13 @@ class _KnownUserLoginState extends State<KnownUserLogin> {
availableBiometrics = await auth.getAvailableBiometrics();
} on PlatformException catch (e) {
print(e);
if (e.code == auth_error.notAvailable) {
showErorrMsg("Auth Methods Not Available");
} else if (e.code == auth_error.passcodeNotSet) {
showErorrMsg("Auth Methods Not passcodeNotSet");
} else if (e.code == auth_error.permanentlyLockedOut) {
showErorrMsg("Auth Methods Not permanentlyLockedOut");
}
}
if (!mounted) return;
@ -333,4 +337,4 @@ class _KnownUserLoginState extends State<KnownUserLogin> {
showErorrMsg(localMsg) {
toastMsg.showErrorToast(localMsg);
}
}
}

Loading…
Cancel
Save