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 {
//static String baseUrl = "http://10.200.204.20:2801/"; // Local 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 = "https://api.cssynapses.com/tangheem/"; // Live server
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:sizer/sizer.dart';
final ValueNotifier<String> otpFieldClear = ValueNotifier<String>("");
class OtpDialog {
final int type;
final int? mobileNo;
final Function(String) onSuccess;
final Function(String, TextEditingController _pinPutController) onSuccess;
final Function onFailure;
final BuildContext context;
final Function onResendCode;
@ -96,6 +98,13 @@ class OtpDialog {
6.height,
(LocaleKeys.pleaseEnterTheVerificationCodeSentTo.tr() + ' xxxxxxxx' + mobileNo.toString().substring(mobileNo.toString().length - 3)).toText16(),
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(
textDirection: TextDirection.ltr,
child: Center(
@ -148,6 +157,11 @@ class OtpDialog {
],
),
),
],
);
},
valueListenable: otpFieldClear,
),
18.height,
DefaultButton(
stopTimer ? LocaleKeys.resend.tr() : LocaleKeys.cancel.tr(),
@ -238,14 +252,15 @@ class OtpDialog {
});
}
static void hideSMSBox(context) {
Navigator.pop(context);
void hideSMSBox(context) {
onFailure();
}
void _onOtpCallBack(String otpCode, bool? isAutofill) {
if (otpCode.length == 4) {
stopTimer = true;
onSuccess(otpCode);
// stopTimer = true;
otpFieldClear.value = otpCode;
onSuccess(otpCode, _pinPutController);
}
}

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

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

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

@ -617,7 +617,7 @@ class _VerifyLoginScreenState extends State<VerifyLoginScreen> {
context,
sendVerificationFlat,
int.tryParse(AppState().memberLoginList?.pMOBILENUMBER ?? ""),
(value) async {
(value, TextEditingController _pinPutController) async {
Utils.showLoading(context);
try {
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);
} catch (ex) {
print(ex);
_pinPutController.clear();
otpFieldClear.value = "";
Utils.hideLoading(context);
Utils.handleException(ex, context, null);
}

Loading…
Cancel
Save