OTP dialog new design

merge-requests/42/head
devmirza121 3 years ago
parent d1652ef04d
commit f06238a93f

Binary file not shown.

After

Width:  |  Height:  |  Size: 875 B

@ -493,6 +493,10 @@
"winnerSelectedRandomly": "سيتم اختيار الفائز عشوائياً من بين التصفيات.", "winnerSelectedRandomly": "سيتم اختيار الفائز عشوائياً من بين التصفيات.",
"fingersCrossed": "تشابك الاصابع!!!", "fingersCrossed": "تشابك الاصابع!!!",
"congrats": "مبروك !!!", "congrats": "مبروك !!!",
"allQuestionsCorrect": "لقد أجبت على جميع الأسئلة بشكل صحيح." "allQuestionsCorrect": "لقد أجبت على جميع الأسئلة بشكل صحيح.",
"otp": "OTP",
"verification": "تَحَقّق",
"resend": "إعادة إرسال",
"codeExpire": "انتهت صلاحية رمز التحقق"
} }

@ -493,5 +493,9 @@
"winnerSelectedRandomly": "The winner will be selected randomly among the qualifiers.", "winnerSelectedRandomly": "The winner will be selected randomly among the qualifiers.",
"fingersCrossed": "Fingers Crossed!!!", "fingersCrossed": "Fingers Crossed!!!",
"congrats": "Congratulations!!!", "congrats": "Congratulations!!!",
"allQuestionsCorrect": "You have answered all questions correct" "allQuestionsCorrect": "You have answered all questions correct",
"otp": "OTP",
"verification": "Verification",
"resend": "Resend",
"codeExpire": "The verification code has been expired"
} }

@ -29,6 +29,7 @@ class MyColors {
static const Color darkWhiteColor = Color(0xffE0E0E0); static const Color darkWhiteColor = Color(0xffE0E0E0);
static const Color redColor = Color(0xffD02127); static const Color redColor = Color(0xffD02127);
static const Color pinkColor = Color(0xffEBA9A9); static const Color pinkColor = Color(0xffEBA9A9);
static const Color pinkDarkColor = Color(0xffe3797d);
static const Color yellowColor = Color(0xffF4E31C); static const Color yellowColor = Color(0xffF4E31C);
static const Color orange = Color(0xFFCC9B14); static const Color orange = Color(0xFFCC9B14);
static const Color yellowFavColor = Color(0xffEAC321); static const Color yellowFavColor = Color(0xffEAC321);

@ -7,7 +7,9 @@ import 'package:mohem_flutter_app/classes/colors.dart';
import 'package:mohem_flutter_app/extensions/int_extensions.dart'; import 'package:mohem_flutter_app/extensions/int_extensions.dart';
import 'package:mohem_flutter_app/extensions/string_extensions.dart'; import 'package:mohem_flutter_app/extensions/string_extensions.dart';
import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; import 'package:mohem_flutter_app/generated/locale_keys.g.dart';
import 'package:mohem_flutter_app/widgets/button/default_button.dart';
import 'package:mohem_flutter_app/widgets/otp_widget.dart'; import 'package:mohem_flutter_app/widgets/otp_widget.dart';
import 'package:sizer/sizer.dart';
class OtpDialog { class OtpDialog {
final int type; final int type;
@ -15,6 +17,7 @@ class OtpDialog {
final Function(String) onSuccess; final Function(String) onSuccess;
final Function onFailure; final Function onFailure;
final BuildContext context; final BuildContext context;
final Function onResendCode;
int remainingTime = 120; int remainingTime = 120;
@ -24,13 +27,7 @@ class OtpDialog {
static bool? _loading; static bool? _loading;
OtpDialog( OtpDialog(this.context, this.type, this.mobileNo, this.onSuccess, this.onFailure, {required this.onResendCode});
this.context,
this.type,
this.mobileNo,
this.onSuccess,
this.onFailure,
);
GlobalKey? verifyAccountForm = GlobalKey<FormState>(); GlobalKey? verifyAccountForm = GlobalKey<FormState>();
@ -69,7 +66,7 @@ class OtpDialog {
// projectProvider = Provider.of(context); // projectProvider = Provider.of(context);
return Dialog( return Dialog(
backgroundColor: Colors.white, backgroundColor: Colors.white,
shape: const RoundedRectangleBorder(), shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)),
insetPadding: const EdgeInsets.only(left: 21, right: 21), insetPadding: const EdgeInsets.only(left: 21, right: 21),
child: StatefulBuilder(builder: (context, setState) { child: StatefulBuilder(builder: (context, setState) {
if (displayTime == '') { if (displayTime == '') {
@ -77,14 +74,10 @@ class OtpDialog {
} }
return Container( return Container(
padding: EdgeInsets.only(left: 21, right: 18, top: 39, bottom: 59), padding: EdgeInsets.all(21),
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
SvgPicture.asset( SvgPicture.asset(
type == 1 type == 1
@ -97,17 +90,10 @@ class OtpDialog {
height: 50, height: 50,
width: 50, width: 50,
), ),
IconButton( 12.height,
padding: EdgeInsets.zero, LocaleKeys.otp.tr().toText14(),
icon: const Icon(Icons.close), LocaleKeys.verification.tr().toText24(isBold: true),
constraints: const BoxConstraints(), 6.height,
onPressed: () {
stopTimer = true;
onFailure();
})
],
),
22.height,
(LocaleKeys.pleaseEnterTheVerificationCodeSentTo.tr() + ' xxxxxxxx' + mobileNo.toString().substring(mobileNo.toString().length - 3)).toText16(), (LocaleKeys.pleaseEnterTheVerificationCodeSentTo.tr() + ' xxxxxxxx' + mobileNo.toString().substring(mobileNo.toString().length - 3)).toText16(),
18.height, 18.height,
Directionality( Directionality(
@ -132,8 +118,25 @@ class OtpDialog {
), ),
), ),
), ),
30.height, 10.height,
RichText( stopTimer
? Row(
children: [
Expanded(
child: LocaleKeys.codeExpire.tr().toText16(
color: MyColors.redColor,
),
),
12.width,
Image.asset(
"assets/icons/ic_alarm.png",
width: 20,
height: 20,
color: MyColors.redColor,
),
],
)
: RichText(
text: TextSpan( text: TextSpan(
text: LocaleKeys.theVerificationCodeWillExpireIn.tr() + '\n', text: LocaleKeys.theVerificationCodeWillExpireIn.tr() + '\n',
style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: MyColors.darkTextColor, letterSpacing: -0.48), style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: MyColors.darkTextColor, letterSpacing: -0.48),
@ -145,6 +148,26 @@ class OtpDialog {
], ],
), ),
), ),
18.height,
DefaultButton(
stopTimer ? LocaleKeys.resend.tr() : LocaleKeys.cancel.tr(),
() async {
if (stopTimer) {
hideSMSBox(context);
onResendCode();
} else {
stopTimer = true;
// onFailure();
hideSMSBox(context);
}
},
colors: stopTimer
? null
: [
MyColors.pinkDarkColor,
MyColors.pinkDarkColor,
],
),
], ],
), ),
); );
@ -208,7 +231,9 @@ class OtpDialog {
if (remainingTime > 0) { if (remainingTime > 0) {
startTimer(setState); startTimer(setState);
} else { } else {
Navigator.pop(context); setState(() {
stopTimer = true;
});
} }
}); });
} }

@ -509,7 +509,11 @@ class CodegenLoader extends AssetLoader{
"winnerSelectedRandomly": "سيتم اختيار الفائز عشوائياً من بين التصفيات.", "winnerSelectedRandomly": "سيتم اختيار الفائز عشوائياً من بين التصفيات.",
"fingersCrossed": "تشابك الاصابع!!!", "fingersCrossed": "تشابك الاصابع!!!",
"congrats": "مبروك !!!", "congrats": "مبروك !!!",
"allQuestionsCorrect": "لقد أجبت على جميع الأسئلة بشكل صحيح." "allQuestionsCorrect": "لقد أجبت على جميع الأسئلة بشكل صحيح.",
"otp": "OTP",
"verification": "تَحَقّق",
"resend": "إعادة إرسال",
"codeExpire": "انتهت صلاحية رمز التحقق"
}; };
static const Map<String,dynamic> en_US = { static const Map<String,dynamic> en_US = {
"mohemm": "Mohemm", "mohemm": "Mohemm",
@ -1006,7 +1010,11 @@ static const Map<String,dynamic> en_US = {
"winnerSelectedRandomly": "The winner will be selected randomly among the qualifiers.", "winnerSelectedRandomly": "The winner will be selected randomly among the qualifiers.",
"fingersCrossed": "Fingers Crossed!!!", "fingersCrossed": "Fingers Crossed!!!",
"congrats": "Congratulations!!!", "congrats": "Congratulations!!!",
"allQuestionsCorrect": "You have answered all questions correct" "allQuestionsCorrect": "You have answered all questions correct",
"otp": "OTP",
"verification": "Verification",
"resend": "Resend",
"codeExpire": "The verification code has been expired"
}; };
static const Map<String, Map<String,dynamic>> mapLocales = {"ar_SA": ar_SA, "en_US": en_US}; static const Map<String, Map<String,dynamic>> mapLocales = {"ar_SA": ar_SA, "en_US": en_US};
} }

@ -480,5 +480,9 @@ abstract class LocaleKeys {
static const fingersCrossed = 'fingersCrossed'; static const fingersCrossed = 'fingersCrossed';
static const congrats = 'congrats'; static const congrats = 'congrats';
static const allQuestionsCorrect = 'allQuestionsCorrect'; static const allQuestionsCorrect = 'allQuestionsCorrect';
static const otp = 'otp';
static const verification = 'verification';
static const resend = 'resend';
static const codeExpire = 'codeExpire';
} }

@ -65,6 +65,9 @@ class _ForgotPasswordScreenState extends State<ForgotPasswordScreen> {
() => { () => {
Navigator.pop(context), Navigator.pop(context),
}, },
onResendCode: () {
performForgotPassword();
},
).displayDialog(context); ).displayDialog(context);
} catch (ex) { } catch (ex) {
print(ex); print(ex);

@ -57,30 +57,21 @@ class _VerifyLastLoginScreenState extends State<VerifyLastLoginScreen> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
mobileLoginInfoListModel ??= ModalRoute.of(context)!.settings.arguments mobileLoginInfoListModel ??= ModalRoute.of(context)!.settings.arguments as GetMobileLoginInfoListModel;
as GetMobileLoginInfoListModel; String empName = AppState().isArabic(context) ? AppState().memberInformationList!.eMPLOYEEDISPLAYNAMEAr! : AppState().memberInformationList!.eMPLOYEEDISPLAYNAMEEn!;
String empName = AppState().isArabic(context)
? AppState().memberInformationList!.eMPLOYEEDISPLAYNAMEAr!
: AppState().memberInformationList!.eMPLOYEEDISPLAYNAMEEn!;
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
automaticallyImplyLeading: false, automaticallyImplyLeading: false,
title: (mobileLoginInfoListModel?.businessCardPrivilege ?? false) title: (mobileLoginInfoListModel?.businessCardPrivilege ?? false)
? LocaleKeys.viewBusinessCard ? LocaleKeys.viewBusinessCard.tr().toText12(color: MyColors.textMixColor, isUnderLine: true).onPress(() {
.tr()
.toText12(color: MyColors.textMixColor, isUnderLine: true)
.onPress(() {
showMDialog(context, child: BusinessCardDialog()); showMDialog(context, child: BusinessCardDialog());
}) })
: null, : null,
actions: [ actions: [
Center( Center(
child: LocaleKeys.employeeDigitalID child: LocaleKeys.employeeDigitalID.tr().toText12(color: MyColors.textMixColor, isUnderLine: true).onPress(() {
.tr()
.toText12(color: MyColors.textMixColor, isUnderLine: true)
.onPress(() {
showMDialog(context, child: EmployeeDigitialIdDialog()); showMDialog(context, child: EmployeeDigitialIdDialog());
})), })),
21.width 21.width
@ -99,12 +90,9 @@ class _VerifyLastLoginScreenState extends State<VerifyLastLoginScreen> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
LocaleKeys.welcomeBack.tr().toText12(), LocaleKeys.welcomeBack.tr().toText12(),
mobileLoginInfoListModel!.employeeName! mobileLoginInfoListModel!.employeeName!.toText24(isBold: true),
.toText24(isBold: true),
10.height, 10.height,
LocaleKeys.wouldYouLikeToLoginWithCurrentUsername LocaleKeys.wouldYouLikeToLoginWithCurrentUsername.tr().toText16(),
.tr()
.toText16(),
Container( Container(
height: 72, height: 72,
margin: const EdgeInsets.only(top: 23, bottom: 23), margin: const EdgeInsets.only(top: 23, bottom: 23),
@ -126,42 +114,26 @@ class _VerifyLastLoginScreenState extends State<VerifyLastLoginScreen> {
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
LocaleKeys.lastLoginDetails.tr().toText16(), LocaleKeys.lastLoginDetails.tr().toText16(),
DateUtil.formatDateToDate( DateUtil.formatDateToDate(DateUtil.convertStringToDate(mobileLoginInfoListModel!.editedOn!), false).toText12(),
DateUtil.convertStringToDate(
mobileLoginInfoListModel!.editedOn!),
false)
.toText12(),
], ],
), ),
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
LocaleKeys.verificationType LocaleKeys.verificationType.tr().toText10(color: MyColors.grey57Color),
.tr() getVerificationType(mobileLoginInfoListModel!.loginType!).toText12(),
.toText10(color: MyColors.grey57Color),
getVerificationType(
mobileLoginInfoListModel!.loginType!)
.toText12(),
Expanded(child: SizedBox()), Expanded(child: SizedBox()),
DateUtil.formatDateToTime( DateUtil.formatDateToTime(DateUtil.convertStringToDate(mobileLoginInfoListModel!.editedOn!)).toText12(),
DateUtil.convertStringToDate(
mobileLoginInfoListModel!.editedOn!))
.toText12(),
], ],
) )
], ],
), ),
), ),
LocaleKeys.pleaseVerify.tr().toText16(), LocaleKeys.pleaseVerify.tr().toText16(),
if (isNeedVerifyWithFaceIDAndBiometrics) if (isNeedVerifyWithFaceIDAndBiometrics) LocaleKeys.pleaseVerifyForBio.tr().toText12(),
LocaleKeys.pleaseVerifyForBio.tr().toText12(),
GridView( GridView(
gridDelegate: gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2, crossAxisSpacing: 13, mainAxisSpacing: 9),
const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
crossAxisSpacing: 13,
mainAxisSpacing: 9),
physics: const NeverScrollableScrollPhysics(), physics: const NeverScrollableScrollPhysics(),
padding: const EdgeInsets.only(top: 9), padding: const EdgeInsets.only(top: 9),
shrinkWrap: true, shrinkWrap: true,
@ -214,9 +186,7 @@ class _VerifyLastLoginScreenState extends State<VerifyLastLoginScreen> {
DefaultButton( DefaultButton(
LocaleKeys.useAnotherAccount.tr(), LocaleKeys.useAnotherAccount.tr(),
() { () {
Navigator.pushNamedAndRemoveUntil( Navigator.pushNamedAndRemoveUntil(context, AppRoutes.login, (Route<dynamic> route) => false, arguments: false);
context, AppRoutes.login, (Route<dynamic> route) => false,
arguments: false);
}, },
).insideContainer, ).insideContainer,
], ],
@ -248,19 +218,11 @@ class _VerifyLastLoginScreenState extends State<VerifyLastLoginScreen> {
} }
Future<bool> loginWithFaceIDAndBiometrics() async { Future<bool> loginWithFaceIDAndBiometrics() async {
IOSAuthMessages iosStrings = const IOSAuthMessages( IOSAuthMessages iosStrings =
cancelButton: 'cancel', const IOSAuthMessages(cancelButton: 'cancel', goToSettingsButton: 'settings', goToSettingsDescription: 'Please set up your Touch ID.', lockOut: 'Please reenable your Touch ID');
goToSettingsButton: 'settings',
goToSettingsDescription: 'Please set up your Touch ID.',
lockOut: 'Please reenable your Touch ID');
bool authenticated = false; bool authenticated = false;
try { try {
authenticated = await auth.authenticate( authenticated = await auth.authenticate(localizedReason: 'Scan your fingerprint to authenticate', useErrorDialogs: true, stickyAuth: true, biometricOnly: true, iOSAuthStrings: iosStrings);
localizedReason: 'Scan your fingerprint to authenticate',
useErrorDialogs: true,
stickyAuth: true,
biometricOnly: true,
iOSAuthStrings: iosStrings);
} on PlatformException catch (e) { } on PlatformException catch (e) {
print(e); print(e);
Utils.hideLoading(context); Utils.hideLoading(context);
@ -269,11 +231,8 @@ class _VerifyLastLoginScreenState extends State<VerifyLastLoginScreen> {
return authenticated; return authenticated;
} }
Widget _loginOptionButton( Widget _loginOptionButton(String _title, String _icon, int _flag, int? _loginIndex) {
String _title, String _icon, int _flag, int? _loginIndex) { bool isDisable = ((_flag == 3 && !checkBiometricIsAvailable(BiometricType.face)) || (_flag == 4 && !checkBiometricIsAvailable(BiometricType.fingerprint)));
bool isDisable = ((_flag == 3 &&
!checkBiometricIsAvailable(BiometricType.face)) ||
(_flag == 4 && !checkBiometricIsAvailable(BiometricType.fingerprint)));
return InkWell( return InkWell(
onTap: isDisable onTap: isDisable
? null ? null
@ -284,21 +243,18 @@ class _VerifyLastLoginScreenState extends State<VerifyLastLoginScreen> {
}); });
} else { } else {
if (_flag == 3 || _flag == 4) { if (_flag == 3 || _flag == 4) {
bool authenticateWithFaceAndTouchID = bool authenticateWithFaceAndTouchID = await loginWithFaceIDAndBiometrics();
await loginWithFaceIDAndBiometrics();
if (!authenticateWithFaceAndTouchID) { if (!authenticateWithFaceAndTouchID) {
return; return;
} else { } else {
if (mobileLoginInfoListModel!.loginType == 3 || if (mobileLoginInfoListModel!.loginType == 3 || mobileLoginInfoListModel!.loginType == 4) {
mobileLoginInfoListModel!.loginType == 4) {
// bool authenticateWithFaceAndTouchID = await loginWithFaceIDAndBiometrics(); // bool authenticateWithFaceAndTouchID = await loginWithFaceIDAndBiometrics();
// if (!authenticateWithFaceAndTouchID) { // if (!authenticateWithFaceAndTouchID) {
// return; // return;
// } else { // } else {
// performApiCall(_title, _icon, _flag, isDirectLogin: true); // performApiCall(_title, _icon, _flag, isDirectLogin: true);
// } // }
performApiCall(_title, _icon, _flag, _flag, performApiCall(_title, _icon, _flag, _flag, isDirectLogin: true);
isDirectLogin: true);
} else { } else {
isNeedVerifyWithFaceIDAndBiometrics = true; isNeedVerifyWithFaceIDAndBiometrics = true;
selectedFlag = _flag; selectedFlag = _flag;
@ -316,8 +272,7 @@ class _VerifyLastLoginScreenState extends State<VerifyLastLoginScreen> {
} }
}, },
child: Container( child: Container(
padding: padding: const EdgeInsets.only(left: 20, right: 20, bottom: 15, top: 28),
const EdgeInsets.only(left: 20, right: 20, bottom: 15, top: 28),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15), borderRadius: BorderRadius.circular(15),
color: isDisable ? Colors.grey.withOpacity(0.3) : Colors.white, color: isDisable ? Colors.grey.withOpacity(0.3) : Colors.white,
@ -343,23 +298,13 @@ class _VerifyLastLoginScreenState extends State<VerifyLastLoginScreen> {
Widget getButton(int flag) { Widget getButton(int flag) {
switch (flag) { switch (flag) {
case 1: case 1:
return _loginOptionButton(LocaleKeys.verifyThroughSMS.tr(), return _loginOptionButton(LocaleKeys.verifyThroughSMS.tr(), 'assets/images/login/verify_sms.svg', flag, null);
'assets/images/login/verify_sms.svg', flag, null);
case 2: case 2:
return _loginOptionButton(LocaleKeys.verifyThroughWhatsapp.tr(), return _loginOptionButton(LocaleKeys.verifyThroughWhatsapp.tr(), 'assets/images/login/verify_whatsapp.svg', flag, null);
'assets/images/login/verify_whatsapp.svg', flag, null);
case 3: case 3:
return _loginOptionButton( return _loginOptionButton(LocaleKeys.verifyThroughFace.tr(), 'assets/images/login/verify_face.svg', flag, BiometricType.face.index);
LocaleKeys.verifyThroughFace.tr(),
'assets/images/login/verify_face.svg',
flag,
BiometricType.face.index);
case 4: case 4:
return _loginOptionButton( return _loginOptionButton(LocaleKeys.verifyThroughFingerprint.tr(), 'assets/images/login/verify_thumb.svg', flag, BiometricType.fingerprint.index);
LocaleKeys.verifyThroughFingerprint.tr(),
'assets/images/login/verify_thumb.svg',
flag,
BiometricType.fingerprint.index);
default: default:
return const SizedBox(); return const SizedBox();
} }
@ -376,9 +321,7 @@ class _VerifyLastLoginScreenState extends State<VerifyLastLoginScreen> {
return isAvailable; return isAvailable;
} }
Future<void> performApiCall( Future<void> performApiCall(String _title, String _icon, int _flag, int sendVerificationFlat, {bool isDirectLogin = false}) async {
String _title, String _icon, int _flag, int sendVerificationFlat,
{bool isDirectLogin = false}) async {
try { try {
if (isDirectLogin) if (isDirectLogin)
setState(() { setState(() {
@ -387,16 +330,10 @@ class _VerifyLastLoginScreenState extends State<VerifyLastLoginScreen> {
else else
Utils.showLoading(context); Utils.showLoading(context);
await LoginApiClient().checkMobileAppVersion(); await LoginApiClient().checkMobileAppVersion();
await LoginApiClient() await LoginApiClient().memberLogin(AppState().getUserName!, AppState().password!);
.memberLogin(AppState().getUserName!, AppState().password!);
if (!isDirectLogin) if (!isDirectLogin)
BasicMemberInformationModel? memberInformationModel = BasicMemberInformationModel? memberInformationModel =
await LoginApiClient() await LoginApiClient().mohemmSendActivationCodeByOTPNotificationType(0, AppState().memberLoginList?.pMOBILENUMBER, sendVerificationFlat, AppState().getUserName);
.mohemmSendActivationCodeByOTPNotificationType(
0,
AppState().memberLoginList?.pMOBILENUMBER,
sendVerificationFlat,
AppState().getUserName);
if (isDirectLogin) performDirectApiCall(_title, _icon, _flag, ""); if (isDirectLogin) performDirectApiCall(_title, _icon, _flag, "");
if (!isDirectLogin) Utils.hideLoading(context); if (!isDirectLogin) Utils.hideLoading(context);
if (!isDirectLogin) if (!isDirectLogin)
@ -411,6 +348,9 @@ class _VerifyLastLoginScreenState extends State<VerifyLastLoginScreen> {
() => { () => {
Navigator.pop(context), Navigator.pop(context),
}, },
onResendCode: () {
performApiCall(_title, _icon, _flag, sendVerificationFlat, isDirectLogin: isDirectLogin);
},
).displayDialog(context); ).displayDialog(context);
} catch (ex) { } catch (ex) {
Utils.hideLoading(context); Utils.hideLoading(context);
@ -418,34 +358,26 @@ class _VerifyLastLoginScreenState extends State<VerifyLastLoginScreen> {
} }
} }
Future<void> performDirectApiCall( Future<void> performDirectApiCall(String _title, String _icon, int _flag, String value, {bool isDirectLogin = false}) async {
String _title, String _icon, int _flag, String value,
{bool isDirectLogin = false}) async {
try { try {
GenericResponseModel? genericResponseModel = await LoginApiClient() GenericResponseModel? genericResponseModel = await LoginApiClient().checkActivationCode(false, AppState().memberLoginList?.pMOBILENUMBER, value, AppState().getUserName);
.checkActivationCode(false, AppState().memberLoginList?.pMOBILENUMBER, GenericResponseModel? genericResponseModel1 = await LoginApiClient().insertMobileLoginInfoNEW(
value, AppState().getUserName);
GenericResponseModel? genericResponseModel1 = await LoginApiClient()
.insertMobileLoginInfoNEW(
AppState().memberLoginList?.pEMAILADDRESS ?? "", AppState().memberLoginList?.pEMAILADDRESS ?? "",
genericResponseModel?.pSESSIONID ?? 0, genericResponseModel?.pSESSIONID ?? 0,
genericResponseModel?.memberInformationList![0].eMPLOYEENAME ?? genericResponseModel?.memberInformationList![0].eMPLOYEENAME ?? "",
"",
_flag, _flag,
AppState().memberLoginList?.pMOBILENUMBER ?? "", AppState().memberLoginList?.pMOBILENUMBER ?? "",
AppState().getUserName!, AppState().getUserName!,
mobileLoginInfoListModel!.deviceToken!, mobileLoginInfoListModel!.deviceToken!,
Platform.isAndroid ? "android" : "ios"); Platform.isAndroid ? "android" : "ios");
AppState().setMemberInformationListModel = AppState().setMemberInformationListModel = genericResponseModel!.memberInformationList?.first;
genericResponseModel!.memberInformationList?.first;
if (genericResponseModel?.errorMessage != null) { if (genericResponseModel?.errorMessage != null) {
Utils.showToast(genericResponseModel?.errorMessage ?? ""); Utils.showToast(genericResponseModel?.errorMessage ?? "");
// Navigator.pop(context); // Navigator.pop(context);
} }
Utils.hideLoading(context); Utils.hideLoading(context);
Navigator.pop(context); Navigator.pop(context);
Navigator.pushNamedAndRemoveUntil( Navigator.pushNamedAndRemoveUntil(context, AppRoutes.dashboard, (Route<dynamic> route) => false);
context, AppRoutes.dashboard, (Route<dynamic> route) => false);
} catch (ex) { } catch (ex) {
Utils.hideLoading(context); Utils.hideLoading(context);
Utils.handleException(ex, context, null); Utils.handleException(ex, context, null);

@ -511,7 +511,6 @@ class _VerifyLoginScreenState extends State<VerifyLoginScreen> {
// } // }
// //
Future<bool> loginWithFaceIDAndBiometrics() async { Future<bool> loginWithFaceIDAndBiometrics() async {
IOSAuthMessages iosStrings = IOSAuthMessages iosStrings =
const IOSAuthMessages(cancelButton: 'cancel', goToSettingsButton: 'settings', goToSettingsDescription: 'Please set up your Touch ID.', lockOut: 'Please reenable your Touch ID'); const IOSAuthMessages(cancelButton: 'cancel', goToSettingsButton: 'settings', goToSettingsDescription: 'Please set up your Touch ID.', lockOut: 'Please reenable your Touch ID');
@ -611,8 +610,8 @@ class _VerifyLoginScreenState extends State<VerifyLoginScreen> {
Utils.showLoading(context); Utils.showLoading(context);
await LoginApiClient().checkMobileAppVersion(); await LoginApiClient().checkMobileAppVersion();
await LoginApiClient().memberLogin(AppState().getUserName!, AppState().password!); await LoginApiClient().memberLogin(AppState().getUserName!, AppState().password!);
BasicMemberInformationModel? memberInformationModel = await LoginApiClient() BasicMemberInformationModel? memberInformationModel =
.mohemmSendActivationCodeByOTPNotificationType(0, AppState().memberLoginList?.pMOBILENUMBER, sendVerificationFlat, AppState().getUserName); await LoginApiClient().mohemmSendActivationCodeByOTPNotificationType(0, AppState().memberLoginList?.pMOBILENUMBER, sendVerificationFlat, AppState().getUserName);
Utils.hideLoading(context); Utils.hideLoading(context);
OtpDialog( OtpDialog(
context, context,
@ -633,8 +632,6 @@ class _VerifyLoginScreenState extends State<VerifyLoginScreen> {
Platform.isAndroid ? "android" : "ios"); Platform.isAndroid ? "android" : "ios");
if (genericResponseModel?.errorMessage != null) { if (genericResponseModel?.errorMessage != null) {
Utils.showToast(genericResponseModel?.errorMessage ?? ""); Utils.showToast(genericResponseModel?.errorMessage ?? "");
} else { } else {
AppState().setPrivilegeListModel = genericResponseModel!.privilegeList ?? []; AppState().setPrivilegeListModel = genericResponseModel!.privilegeList ?? [];
AppState().setMemberInformationListModel = genericResponseModel.memberInformationList?.first; AppState().setMemberInformationListModel = genericResponseModel.memberInformationList?.first;
@ -662,6 +659,9 @@ class _VerifyLoginScreenState extends State<VerifyLoginScreen> {
() => { () => {
Navigator.pop(context), Navigator.pop(context),
}, },
onResendCode: () {
performApiCall(_title, _icon, _flag, sendVerificationFlat);
},
).displayDialog(context); ).displayDialog(context);
} catch (ex) { } catch (ex) {
Utils.hideLoading(context); Utils.hideLoading(context);

Loading…
Cancel
Save