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,
children: [
if (!isNeedVerifyWithFaceIDAndBiometrics) getButton(3),
if (!isNeedVerifyWithFaceIDAndBiometrics) getButton(2),
getButton(4),
if (!isNeedVerifyWithFaceIDAndBiometrics) getButton(4),
getButton(2),
getButton(1),
],
)
@ -195,13 +195,13 @@ class _VerifyLastLoginScreenState extends State<VerifyLastLoginScreen> {
String getVerificationType(int type) {
if (type == 1) {
LocaleKeys.sms.tr();
return LocaleKeys.sms.tr();
} else if (type == 2) {
return LocaleKeys.fingerPrint.tr();
return LocaleKeys.whatsapp.tr();
} else if (type == 3) {
return LocaleKeys.face.tr();
} else if (type == 4) {
return LocaleKeys.whatsapp.tr();
return LocaleKeys.fingerPrint.tr();
}
return "";
}
@ -221,7 +221,7 @@ class _VerifyLastLoginScreenState extends State<VerifyLastLoginScreen> {
}
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");
return InkWell(
onTap: isDisable
@ -232,19 +232,19 @@ class _VerifyLastLoginScreenState extends State<VerifyLastLoginScreen> {
// isMoreOption = true;
});
} else {
if (_flag == 2 || _flag == 3) {
if (_flag == 3 || _flag == 4) {
bool authenticateWithFaceAndTouchID = await loginWithFaceIDAndBiometrics();
if (!authenticateWithFaceAndTouchID) {
return;
} else {
if (mobileLoginInfoListModel!.loginType == 2 || mobileLoginInfoListModel!.loginType == 3) {
if (mobileLoginInfoListModel!.loginType == 3 || mobileLoginInfoListModel!.loginType == 4) {
// bool authenticateWithFaceAndTouchID = await loginWithFaceIDAndBiometrics();
// if (!authenticateWithFaceAndTouchID) {
// return;
// } else {
// performApiCall(_title, _icon, _flag, isDirectLogin: true);
// }
performApiCall(_title, _icon, _flag, isDirectLogin: true);
performApiCall(_title, _icon, _flag, _flag, isDirectLogin: true);
} else {
isNeedVerifyWithFaceIDAndBiometrics = true;
selectedFlag = _flag;
@ -255,9 +255,9 @@ class _VerifyLastLoginScreenState extends State<VerifyLastLoginScreen> {
}
} else {
if (isNeedVerifyWithFaceIDAndBiometrics)
performApiCall(_title, _icon, selectedFlag);
performApiCall(_title, _icon, selectedFlag, _flag);
else
performApiCall(_title, _icon, _flag);
performApiCall(_title, _icon, _flag, _flag);
}
}
},
@ -290,11 +290,11 @@ class _VerifyLastLoginScreenState extends State<VerifyLastLoginScreen> {
case 1:
return _loginOptionButton(LocaleKeys.verifyThroughSMS.tr(), 'assets/images/login/verify_sms.svg', flag, null);
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:
return _loginOptionButton(LocaleKeys.verifyThroughFace.tr(), 'assets/images/login/verify_face.svg', flag, BiometricType.face.index);
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:
return const SizedBox();
}
@ -311,7 +311,7 @@ class _VerifyLastLoginScreenState extends State<VerifyLastLoginScreen> {
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 {
if (isDirectLogin)
setState(() {
@ -322,14 +322,14 @@ class _VerifyLastLoginScreenState extends State<VerifyLastLoginScreen> {
await LoginApiClient().checkMobileAppVersion();
await LoginApiClient().memberLogin(AppState().getUserName!, AppState().password!);
if (!isDirectLogin)
BasicMemberInformationModel? memberInformationModel = await LoginApiClient()
.mohemmSendActivationCodeByOTPNotificationType(checkBiometricIsAvailable(BiometricType.fingerprint) ? 1 : 0, AppState().memberLoginList?.pMOBILENUMBER, _flag, AppState().getUserName);
BasicMemberInformationModel? memberInformationModel =
await LoginApiClient().mohemmSendActivationCodeByOTPNotificationType(0, AppState().memberLoginList?.pMOBILENUMBER, sendVerificationFlat, AppState().getUserName);
if (isDirectLogin) performDirectApiCall(_title, _icon, _flag, "");
if (!isDirectLogin) Utils.hideLoading(context);
if (!isDirectLogin)
OtpDialog(
context,
_flag,
sendVerificationFlat,
int.tryParse(AppState().memberLoginList?.pMOBILENUMBER ?? ""),
(value) async {
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/privilege_list_model.dart';
// WhatsApp 4
// WhatsApp 2
// SMS 1
// Face ID 3
// Finger Print 2
// Finger Print 4
class VerifyLoginScreen extends StatefulWidget {
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) {
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(
onTap: isDisable
? null
@ -550,9 +550,9 @@ class _VerifyLoginScreenState extends State<VerifyLoginScreen> {
}
} else {
if (isNeedVerifyWithFaceIDAndBiometrics)
performApiCall(_title, _icon, selectedFlag);
performApiCall(_title, _icon, selectedFlag,_flag);
else
performApiCall(_title, _icon, _flag);
performApiCall(_title, _icon, _flag,_flag);
}
}
},
@ -606,17 +606,17 @@ class _VerifyLoginScreenState extends State<VerifyLoginScreen> {
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 {
Utils.showLoading(context);
await LoginApiClient().checkMobileAppVersion();
await LoginApiClient().memberLogin(AppState().getUserName!, AppState().password!);
BasicMemberInformationModel? memberInformationModel = await LoginApiClient()
.mohemmSendActivationCodeByOTPNotificationType(0, AppState().memberLoginList?.pMOBILENUMBER, _flag, AppState().getUserName);
.mohemmSendActivationCodeByOTPNotificationType(0, AppState().memberLoginList?.pMOBILENUMBER, sendVerificationFlat, AppState().getUserName);
Utils.hideLoading(context);
OtpDialog(
context,
_flag,
sendVerificationFlat,
int.tryParse(AppState().memberLoginList?.pMOBILENUMBER ?? ""),
(value) async {
Utils.showLoading(context);

Loading…
Cancel
Save