Login Flag issue fixed

merge-requests/12/head
devmirza121 3 years ago
parent 9412348cde
commit 599b8b8f4b

@ -128,8 +128,8 @@ class _VerifyLastLoginScreenState extends State<VerifyLastLoginScreen> {
shrinkWrap: true, shrinkWrap: true,
children: [ children: [
if (!isNeedVerifyWithFaceIDAndBiometrics) getButton(3), if (!isNeedVerifyWithFaceIDAndBiometrics) getButton(3),
if (!isNeedVerifyWithFaceIDAndBiometrics) getButton(2), if (!isNeedVerifyWithFaceIDAndBiometrics) getButton(4),
getButton(4), getButton(2),
getButton(1), getButton(1),
], ],
) )
@ -195,13 +195,13 @@ class _VerifyLastLoginScreenState extends State<VerifyLastLoginScreen> {
String getVerificationType(int type) { String getVerificationType(int type) {
if (type == 1) { if (type == 1) {
LocaleKeys.sms.tr(); return LocaleKeys.sms.tr();
} else if (type == 2) { } else if (type == 2) {
return LocaleKeys.fingerPrint.tr(); return LocaleKeys.whatsapp.tr();
} else if (type == 3) { } else if (type == 3) {
return LocaleKeys.face.tr(); return LocaleKeys.face.tr();
} else if (type == 4) { } else if (type == 4) {
return LocaleKeys.whatsapp.tr(); return LocaleKeys.fingerPrint.tr();
} }
return ""; return "";
} }
@ -221,7 +221,7 @@ class _VerifyLastLoginScreenState extends State<VerifyLastLoginScreen> {
} }
Widget _loginOptionButton(String _title, String _icon, int _flag, int? _loginIndex) { Widget _loginOptionButton(String _title, String _icon, int _flag, int? _loginIndex) {
bool isDisable = ((_flag == 3 && !checkBiometricIsAvailable(BiometricType.face)) || (_flag == 2 && !checkBiometricIsAvailable(BiometricType.fingerprint))); bool isDisable = ((_flag == 3 && !checkBiometricIsAvailable(BiometricType.face)) || (_flag == 4 && !checkBiometricIsAvailable(BiometricType.fingerprint)));
print("$_title:$isDisable"); print("$_title:$isDisable");
return InkWell( return InkWell(
onTap: isDisable onTap: isDisable
@ -232,19 +232,19 @@ class _VerifyLastLoginScreenState extends State<VerifyLastLoginScreen> {
// isMoreOption = true; // isMoreOption = true;
}); });
} else { } else {
if (_flag == 2 || _flag == 3) { if (_flag == 3 || _flag == 4) {
bool authenticateWithFaceAndTouchID = await loginWithFaceIDAndBiometrics(); bool authenticateWithFaceAndTouchID = await loginWithFaceIDAndBiometrics();
if (!authenticateWithFaceAndTouchID) { if (!authenticateWithFaceAndTouchID) {
return; return;
} else { } else {
if (mobileLoginInfoListModel!.loginType == 2 || mobileLoginInfoListModel!.loginType == 3) { if (mobileLoginInfoListModel!.loginType == 3 || 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, isDirectLogin: true); performApiCall(_title, _icon, _flag, _flag, isDirectLogin: true);
} else { } else {
isNeedVerifyWithFaceIDAndBiometrics = true; isNeedVerifyWithFaceIDAndBiometrics = true;
selectedFlag = _flag; selectedFlag = _flag;
@ -255,9 +255,9 @@ class _VerifyLastLoginScreenState extends State<VerifyLastLoginScreen> {
} }
} else { } else {
if (isNeedVerifyWithFaceIDAndBiometrics) if (isNeedVerifyWithFaceIDAndBiometrics)
performApiCall(_title, _icon, selectedFlag); performApiCall(_title, _icon, selectedFlag, _flag);
else else
performApiCall(_title, _icon, _flag); performApiCall(_title, _icon, _flag, _flag);
} }
} }
}, },
@ -290,11 +290,11 @@ class _VerifyLastLoginScreenState extends State<VerifyLastLoginScreen> {
case 1: case 1:
return _loginOptionButton(LocaleKeys.verifyThroughSMS.tr(), 'assets/images/login/verify_sms.svg', flag, null); return _loginOptionButton(LocaleKeys.verifyThroughSMS.tr(), 'assets/images/login/verify_sms.svg', flag, null);
case 2: case 2:
return _loginOptionButton(LocaleKeys.verifyThroughFingerprint.tr(), 'assets/images/login/verify_thumb.svg', flag, BiometricType.fingerprint.index); return _loginOptionButton(LocaleKeys.verifyThroughWhatsapp.tr(), 'assets/images/login/verify_whatsapp.svg', flag, null);
case 3: case 3:
return _loginOptionButton(LocaleKeys.verifyThroughFace.tr(), 'assets/images/login/verify_face.svg', flag, BiometricType.face.index); return _loginOptionButton(LocaleKeys.verifyThroughFace.tr(), 'assets/images/login/verify_face.svg', flag, BiometricType.face.index);
case 4: case 4:
return _loginOptionButton(LocaleKeys.verifyThroughWhatsapp.tr(), 'assets/images/login/verify_whatsapp.svg', flag, null); return _loginOptionButton(LocaleKeys.verifyThroughFingerprint.tr(), 'assets/images/login/verify_thumb.svg', flag, BiometricType.fingerprint.index);
default: default:
return const SizedBox(); return const SizedBox();
} }
@ -311,7 +311,7 @@ class _VerifyLastLoginScreenState extends State<VerifyLastLoginScreen> {
return isAvailable; return isAvailable;
} }
Future<void> performApiCall(String _title, String _icon, int _flag, {bool isDirectLogin = false}) async { Future<void> performApiCall(String _title, String _icon, int _flag, int sendVerificationFlat, {bool isDirectLogin = false}) async {
try { try {
if (isDirectLogin) if (isDirectLogin)
setState(() { setState(() {
@ -322,14 +322,14 @@ class _VerifyLastLoginScreenState extends State<VerifyLastLoginScreen> {
await LoginApiClient().checkMobileAppVersion(); await LoginApiClient().checkMobileAppVersion();
await LoginApiClient().memberLogin(AppState().getUserName!, AppState().password!); await LoginApiClient().memberLogin(AppState().getUserName!, AppState().password!);
if (!isDirectLogin) if (!isDirectLogin)
BasicMemberInformationModel? memberInformationModel = await LoginApiClient() BasicMemberInformationModel? memberInformationModel =
.mohemmSendActivationCodeByOTPNotificationType(checkBiometricIsAvailable(BiometricType.fingerprint) ? 1 : 0, AppState().memberLoginList?.pMOBILENUMBER, _flag, AppState().getUserName); await LoginApiClient().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)
OtpDialog( OtpDialog(
context, context,
_flag, sendVerificationFlat,
int.tryParse(AppState().memberLoginList?.pMOBILENUMBER ?? ""), int.tryParse(AppState().memberLoginList?.pMOBILENUMBER ?? ""),
(value) async { (value) async {
Utils.showLoading(context); Utils.showLoading(context);

@ -21,10 +21,10 @@ import 'package:mohem_flutter_app/models/generic_response_model.dart';
import 'package:mohem_flutter_app/models/member_information_list_model.dart'; import 'package:mohem_flutter_app/models/member_information_list_model.dart';
import 'package:mohem_flutter_app/models/privilege_list_model.dart'; import 'package:mohem_flutter_app/models/privilege_list_model.dart';
// WhatsApp 4 // WhatsApp 2
// SMS 1 // SMS 1
// Face ID 3 // Face ID 3
// Finger Print 2 // Finger Print 4
class VerifyLoginScreen extends StatefulWidget { class VerifyLoginScreen extends StatefulWidget {
VerifyLoginScreen({Key? key}) : super(key: key); VerifyLoginScreen({Key? key}) : super(key: key);
@ -527,7 +527,7 @@ class _VerifyLoginScreenState extends State<VerifyLoginScreen> {
} }
Widget _loginOptionButton(String _title, String _icon, int _flag, int? _loginIndex) { Widget _loginOptionButton(String _title, String _icon, int _flag, int? _loginIndex) {
bool isDisable = ((_flag == 3 && !checkBiometricIsAvailable(BiometricType.face)) || (_flag == 2 && !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
@ -550,9 +550,9 @@ class _VerifyLoginScreenState extends State<VerifyLoginScreen> {
} }
} else { } else {
if (isNeedVerifyWithFaceIDAndBiometrics) if (isNeedVerifyWithFaceIDAndBiometrics)
performApiCall(_title, _icon, selectedFlag); performApiCall(_title, _icon, selectedFlag,_flag);
else else
performApiCall(_title, _icon, _flag); performApiCall(_title, _icon, _flag,_flag);
} }
} }
}, },
@ -606,17 +606,17 @@ class _VerifyLoginScreenState extends State<VerifyLoginScreen> {
return isAvailable; return isAvailable;
} }
Future<void> performApiCall(String _title, String _icon, int _flag) async { Future<void> performApiCall(String _title, String _icon, int _flag,int sendVerificationFlat) async {
try { try {
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 = await LoginApiClient()
.mohemmSendActivationCodeByOTPNotificationType(0, AppState().memberLoginList?.pMOBILENUMBER, _flag, AppState().getUserName); .mohemmSendActivationCodeByOTPNotificationType(0, AppState().memberLoginList?.pMOBILENUMBER, sendVerificationFlat, AppState().getUserName);
Utils.hideLoading(context); Utils.hideLoading(context);
OtpDialog( OtpDialog(
context, context,
_flag, sendVerificationFlat,
int.tryParse(AppState().memberLoginList?.pMOBILENUMBER ?? ""), int.tryParse(AppState().memberLoginList?.pMOBILENUMBER ?? ""),
(value) async { (value) async {
Utils.showLoading(context); Utils.showLoading(context);

Loading…
Cancel
Save