Merge branch 'master' into development_aamir

# Conflicts:
#	lib/classes/consts.dart
merge-requests/55/head
Aamir Muhammad 2 years ago
commit ca4c9584b9

@ -1,7 +1,7 @@
class ApiConsts { class ApiConsts {
//static String baseUrl = "http://10.200.204.20:2801/"; // Local server //static String baseUrl = "http://10.200.204.20:2801/"; // Local server
static String baseUrl = "https://uat.hmgwebservices.com"; // UAT server static String baseUrl = "https://uat.hmgwebservices.com"; // UAT server
//static String baseUrl = "https://hmgwebservices.com"; // Live server // static String baseUrl = "https://hmgwebservices.com"; // Live server
static String baseUrlServices = baseUrl + "/Services/"; // server static String baseUrlServices = baseUrl + "/Services/"; // server
// static String baseUrlServices = "https://api.cssynapses.com/tangheem/"; // Live server // static String baseUrlServices = "https://api.cssynapses.com/tangheem/"; // Live server
static String utilitiesRest = baseUrlServices + "Utilities.svc/REST/"; static String utilitiesRest = baseUrlServices + "Utilities.svc/REST/";

@ -11,10 +11,12 @@ 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'; import 'package:sizer/sizer.dart';
final ValueNotifier<String> otpFieldClear = ValueNotifier<String>("");
class OtpDialog { class OtpDialog {
final int type; final int type;
final int? mobileNo; final int? mobileNo;
final Function(String) onSuccess; final Function(String, TextEditingController _pinPutController) onSuccess;
final Function onFailure; final Function onFailure;
final BuildContext context; final BuildContext context;
final Function onResendCode; final Function onResendCode;
@ -96,6 +98,13 @@ class OtpDialog {
6.height, 6.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,
ValueListenableBuilder<String>(
builder: (BuildContext context, String value, Widget? child) {
// This builder will only get called when the _counter
// is updated.
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Directionality( Directionality(
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
child: Center( child: Center(
@ -148,6 +157,11 @@ class OtpDialog {
], ],
), ),
), ),
],
);
},
valueListenable: otpFieldClear,
),
18.height, 18.height,
DefaultButton( DefaultButton(
stopTimer ? LocaleKeys.resend.tr() : LocaleKeys.cancel.tr(), stopTimer ? LocaleKeys.resend.tr() : LocaleKeys.cancel.tr(),
@ -238,14 +252,15 @@ class OtpDialog {
}); });
} }
static void hideSMSBox(context) { void hideSMSBox(context) {
Navigator.pop(context); onFailure();
} }
void _onOtpCallBack(String otpCode, bool? isAutofill) { void _onOtpCallBack(String otpCode, bool? isAutofill) {
if (otpCode.length == 4) { if (otpCode.length == 4) {
stopTimer = true; // stopTimer = true;
onSuccess(otpCode); otpFieldClear.value = otpCode;
onSuccess(otpCode, _pinPutController);
} }
} }

@ -50,8 +50,9 @@ class _ForgotPasswordScreenState extends State<ForgotPasswordScreen> {
context, context,
1, 1,
int.tryParse(_basicMemberInformation?.pMOBILENUMBER ?? ""), int.tryParse(_basicMemberInformation?.pMOBILENUMBER ?? ""),
(value) async { (value,TextEditingController _pinPutController) async {
Utils.showLoading(context); Utils.showLoading(context);
try{
GenericResponseModel? genericResponseModel = await LoginApiClient().checkPublicActivationCode(value, employeeId.text); GenericResponseModel? genericResponseModel = await LoginApiClient().checkPublicActivationCode(value, employeeId.text);
if (genericResponseModel?.errorMessage != null) { if (genericResponseModel?.errorMessage != null) {
Utils.showToast(genericResponseModel?.errorMessage ?? ""); Utils.showToast(genericResponseModel?.errorMessage ?? "");
@ -61,6 +62,13 @@ class _ForgotPasswordScreenState extends State<ForgotPasswordScreen> {
await Navigator.pushNamed(context, AppRoutes.newPassword, arguments: employeeId.text); await Navigator.pushNamed(context, AppRoutes.newPassword, arguments: employeeId.text);
Navigator.pop(context); Navigator.pop(context);
Navigator.pop(context); Navigator.pop(context);
}catch(ex){
print(ex);
_pinPutController.clear();
otpFieldClear.value = "";
Utils.hideLoading(context);
Utils.handleException(ex, context, null);
}
}, },
() => { () => {
Navigator.pop(context), Navigator.pop(context),

@ -142,8 +142,8 @@ class _LoginScreenState extends State<LoginScreen> {
isAppOpenBySystem = (ModalRoute.of(context)!.settings.arguments ?? true) as bool; isAppOpenBySystem = (ModalRoute.of(context)!.settings.arguments ?? true) as bool;
if (!kReleaseMode) { if (!kReleaseMode) {
// username.text = "15444"; // Maha User // username.text = "15444"; // Maha User
// username.text = "15153"; // Tamer User username.text = "15153"; // Tamer User
// password.text = "Abcd@12345"; password.text = "Abcd@12345";
// username.text = "206535"; // Hashim User // username.text = "206535"; // Hashim User
// password.text = "Namira786"; // password.text = "Namira786";

@ -335,16 +335,16 @@ class _VerifyLastLoginScreenState extends State<VerifyLastLoginScreen> {
if (!isDirectLogin) if (!isDirectLogin)
BasicMemberInformationModel? memberInformationModel = BasicMemberInformationModel? memberInformationModel =
await LoginApiClient().mohemmSendActivationCodeByOTPNotificationType(0, AppState().memberLoginList?.pMOBILENUMBER, sendVerificationFlat, AppState().getUserName); await LoginApiClient().mohemmSendActivationCodeByOTPNotificationType(0, AppState().memberLoginList?.pMOBILENUMBER, sendVerificationFlat, AppState().getUserName);
if (isDirectLogin) performDirectApiCall(_title, _icon, _flag, ""); if (isDirectLogin) performDirectApiCall(_title, _icon, _flag, "", null);
if (!isDirectLogin) Utils.hideLoading(context); if (!isDirectLogin) Utils.hideLoading(context);
if (!isDirectLogin) if (!isDirectLogin)
OtpDialog( OtpDialog(
context, context,
sendVerificationFlat, sendVerificationFlat,
int.tryParse(AppState().memberLoginList?.pMOBILENUMBER ?? ""), int.tryParse(AppState().memberLoginList?.pMOBILENUMBER ?? ""),
(value) async { (value, TextEditingController _pinPutController) async {
Utils.showLoading(context); Utils.showLoading(context);
performDirectApiCall(_title, _icon, _flag, value); performDirectApiCall(_title, _icon, _flag, value, _pinPutController);
}, },
() => { () => {
Navigator.pop(context), Navigator.pop(context),
@ -359,7 +359,7 @@ class _VerifyLastLoginScreenState extends State<VerifyLastLoginScreen> {
} }
} }
Future<void> performDirectApiCall(String _title, String _icon, int _flag, String value, {bool isDirectLogin = false}) async { Future<void> performDirectApiCall(String _title, String _icon, int _flag, String value, TextEditingController? _pinPutController, {bool isDirectLogin = false}) async {
try { try {
GenericResponseModel? genericResponseModel = await LoginApiClient().checkActivationCode(false, AppState().memberLoginList?.pMOBILENUMBER, value, AppState().getUserName); GenericResponseModel? genericResponseModel = await LoginApiClient().checkActivationCode(false, AppState().memberLoginList?.pMOBILENUMBER, value, AppState().getUserName);
GenericResponseModel? genericResponseModel1 = await LoginApiClient().insertMobileLoginInfoNEW( GenericResponseModel? genericResponseModel1 = await LoginApiClient().insertMobileLoginInfoNEW(
@ -372,14 +372,18 @@ class _VerifyLastLoginScreenState extends State<VerifyLastLoginScreen> {
mobileLoginInfoListModel!.deviceToken!, mobileLoginInfoListModel!.deviceToken!,
Platform.isAndroid ? "android" : "ios"); Platform.isAndroid ? "android" : "ios");
AppState().setMemberInformationListModel = genericResponseModel!.memberInformationList?.first; AppState().setMemberInformationListModel = 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(context, AppRoutes.dashboard, (Route<dynamic> route) => false); Navigator.pushNamedAndRemoveUntil(context, AppRoutes.dashboard, (Route<dynamic> route) => false);
} catch (ex) { } catch (ex) {
if (_pinPutController != null) {
_pinPutController.clear();
otpFieldClear.value = "";
}
Utils.hideLoading(context); Utils.hideLoading(context);
Utils.handleException(ex, context, null); Utils.handleException(ex, context, null);
} }

@ -617,7 +617,7 @@ class _VerifyLoginScreenState extends State<VerifyLoginScreen> {
context, context,
sendVerificationFlat, sendVerificationFlat,
int.tryParse(AppState().memberLoginList?.pMOBILENUMBER ?? ""), int.tryParse(AppState().memberLoginList?.pMOBILENUMBER ?? ""),
(value) async { (value, TextEditingController _pinPutController) async {
Utils.showLoading(context); Utils.showLoading(context);
try { try {
GenericResponseModel? genericResponseModel = await LoginApiClient().checkActivationCode(true, AppState().memberLoginList?.pMOBILENUMBER, value, AppState().getUserName); GenericResponseModel? genericResponseModel = await LoginApiClient().checkActivationCode(true, AppState().memberLoginList?.pMOBILENUMBER, value, AppState().getUserName);
@ -652,6 +652,8 @@ class _VerifyLoginScreenState extends State<VerifyLoginScreen> {
Navigator.pushNamedAndRemoveUntil(context, AppRoutes.dashboard, (Route<dynamic> route) => false); Navigator.pushNamedAndRemoveUntil(context, AppRoutes.dashboard, (Route<dynamic> route) => false);
} catch (ex) { } catch (ex) {
print(ex); print(ex);
_pinPutController.clear();
otpFieldClear.value = "";
Utils.hideLoading(context); Utils.hideLoading(context);
Utils.handleException(ex, context, null); Utils.handleException(ex, context, null);
} }

Loading…
Cancel
Save