From 297eef95588097d8829848bd4016d8088df13fa2 Mon Sep 17 00:00:00 2001 From: Aamir Muhammad Date: Tue, 12 Aug 2025 14:39:03 +0300 Subject: [PATCH] fixes --- .../reports/problems/problems-report.html | 2 +- lib/config/config.dart | 4 +- lib/config/localized_values.dart | 2 +- .../ExceptionBottomSheet.dart | 4 +- lib/pages/login/register_new.dart | 112 ++++++++++++++---- lib/pages/login/welcome.dart | 3 +- lib/theme/colors.dart | 1 + lib/uitl/utils.dart | 2 +- 8 files changed, 97 insertions(+), 33 deletions(-) diff --git a/android/build/reports/problems/problems-report.html b/android/build/reports/problems/problems-report.html index a33c3daa..bb369a92 100644 --- a/android/build/reports/problems/problems-report.html +++ b/android/build/reports/problems/problems-report.html @@ -650,7 +650,7 @@ code + .copy-button { diff --git a/lib/config/config.dart b/lib/config/config.dart index e425c27d..fb64f682 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -21,8 +21,8 @@ var PACKAGES_ORDERS = '/api/orders'; var PACKAGES_ORDER_HISTORY = '/api/orders/items'; var PACKAGES_TAMARA_OPT = '/api/orders/paymentoptions/tamara'; // var BASE_URL = 'http://10.50.100.198:2018/'; - var BASE_URL = 'https://uat.hmgwebservices.com/'; -// var BASE_URL = 'https://hmgwebservices.com/'; + // var BASE_URL = 'https://uat.hmgwebservices.com/'; +var BASE_URL = 'https://hmgwebservices.com/'; // var BASE_URL = 'http://10.201.204.103/'; // var BASE_URL = 'https://orash.cloudsolutions.com.sa/'; // var BASE_URL = 'https://vidauat.cloudsolutions.com.sa/'; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 90384560..7bb585d1 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -2334,7 +2334,7 @@ const Map localizedValues = { "prepareToElevate": {"en": "Prepared to elevate your health and well-being?", "ar": "هل أنت مستعد لتحسين صحتك ورفاهتك؟"}, "alreadyHaveAccount": {"en": "Already have an account?", "ar": "هل لديك حساب بالفعل؟"}, "loginNow": {"en": "Login Now", "ar": "تسجيل الدخول الآن"}, - "guest": {"en": "Guest", "ar":"ضيف"}, + "guest": {"en": "Guest", "ar":"زائر"}, "switchAccount": {"en": "Switch Account", "ar":"تبديل الحساب"}, "allSet": {"en": "All Set! Now you can login with Face ID or Biometric", "ar":"جاهز! الآن يمكنك تسجيل الدخول باستخدام Face ID / Biometric أو البصمة"}, "enableQuickLogin": {"en": "Enable Quick Login", "ar":"تمكين تسجيل الدخول السريع"}, diff --git a/lib/new_ui/exception_widget/ExceptionBottomSheet.dart b/lib/new_ui/exception_widget/ExceptionBottomSheet.dart index 635cee27..af734520 100644 --- a/lib/new_ui/exception_widget/ExceptionBottomSheet.dart +++ b/lib/new_ui/exception_widget/ExceptionBottomSheet.dart @@ -95,8 +95,8 @@ class _ExceptionBottomSheetState extends State { child: CustomButton( text: widget.showCancel ? TranslationBase.of(context).confirm : TranslationBase.of(context).ok, onPressed: widget.onOkPressed, - backgroundColor: CustomColors.bgRedColor, - borderColor: CustomColors.bgRedBorderColor, + backgroundColor: CustomColors.bgGreenColor, + borderColor: CustomColors.bgGreenColor, textColor: Colors.white, icon: "assets/images/svg/confirm.svg", ), diff --git a/lib/pages/login/register_new.dart b/lib/pages/login/register_new.dart index 44d25f84..e73d4645 100644 --- a/lib/pages/login/register_new.dart +++ b/lib/pages/login/register_new.dart @@ -74,7 +74,7 @@ class _RegisterNew extends State { CheckUserStatusResponse? nHICData; final int loginType = LoginType.loginType; - late String mobileNo; + String mobileNo = ''; var loginTokenID; // String countryCode = '966'; @@ -322,6 +322,18 @@ class _RegisterNew extends State { // Utils.showErrorToast(TranslationBase.of(context).pleaseEnterNationalId); return; } + if (nationalIDorFile != null && !Utils.validateIqama(nationalIDorFile.text)) { + context.showBottomSheet( + child: ExceptionBottomSheet( + message: "Please enter correct national id", + showCancel: false, + onOkPressed: () { + Navigator.of(context).pop(); + }, + ), + ); + return; + } if (selectedCountry == null || selectedCountry.countryCode.isEmpty) { context.showBottomSheet( child: ExceptionBottomSheet( @@ -384,8 +396,33 @@ class _RegisterNew extends State { child: CustomButton( text: TranslationBase.of(context).sendOTPSMS, onPressed: () { - int? val = Utils.onOtpBtnPressed(OTPType.sms, mobileNo, context); - registerUser(val); + if (mobileNo.isEmpty) { + context.showBottomSheet( + child: ExceptionBottomSheet( + message: "Please enter mobile number", + showCancel: false, + onOkPressed: () { + Navigator.of(context).pop(); + }, + ), + ); + } + // + // else if (mobileNo.length < 8) { + // context.showBottomSheet( + // child: ExceptionBottomSheet( + // message: "Please enter correct mobile number", + // showCancel: false, + // onOkPressed: () { + // Navigator.of(context).pop(); + // }, + // ), + // ); + // } + + else { + registerUser(1); + } }, backgroundColor: CustomColors.bgRedColor, borderColor: CustomColors.bgRedBorderColor, @@ -414,8 +451,31 @@ class _RegisterNew extends State { child: CustomButton( text: TranslationBase.of(context).sendOTPWHATSAPP, onPressed: () { - int? val = Utils.onOtpBtnPressed(OTPType.whatsapp, mobileNo, context); - registerUser(val); + if (mobileNo.isEmpty) { + context.showBottomSheet( + child: ExceptionBottomSheet( + message: "Please enter mobile number", + showCancel: false, + onOkPressed: () { + Navigator.of(context).pop(); + }, + ), + ); + } else if (mobileNo.length < 9) { + context.showBottomSheet( + child: ExceptionBottomSheet( + message: "Please enter correct mobile number", + showCancel: false, + onOkPressed: () { + Navigator.of(context).pop(); + }, + ), + ); + } else { + registerUser(4); + } + // int? val = Utils.onOtpBtnPressed(OTPType.whatsapp, mobileNo, context); + // registerUser(val); }, backgroundColor: Colors.white, borderColor: Color(0xFF2E3039), @@ -555,22 +615,24 @@ class _RegisterNew extends State { checkPatientForRegistration({required CheckPatientForRegistration registrationData, type}) { int languageID = Provider.of(context, listen: false).isArabic ? 1 : 2; GifLoaderDialogUtils.showMyDialog(context); - authService.checkPatientForRegisteration(registrationData, languageID).then((response) => { - // Keep loader active, continue to next step - checkUserStatus(response, registrationData, type) - }).catchError((err) { + authService + .checkPatientForRegisteration(registrationData, languageID) + .then((response) => { + // Keep loader active, continue to next step + checkUserStatus(response, registrationData, type) + }) + .catchError((err) { GifLoaderDialogUtils.hideDialog(context); - - context.showBottomSheet( - child: ExceptionBottomSheet( - showCancel: true, - message: err, - onOkPressed: () { - Navigator.of(context).pop(); - Navigator.of(context).push(FadePage(page: RegisterNew())); - }, - ), - ); + // context.showBottomSheet( + // child: ExceptionBottomSheet( + // showCancel: true, + // message: err, + // onOkPressed: () { + // Navigator.of(context).pop(); + // Navigator.of(context).push(FadePage(page: RegisterNew())); + // }, + // ), + // ); }); } @@ -580,12 +642,13 @@ class _RegisterNew extends State { var nRequest = request.toJson(); nRequest['LogInTokenID'] = response['LogInTokenID']; if (response['hasFile'] == true) { + GifLoaderDialogUtils.hideDialog(context); context.showBottomSheet( child: ExceptionBottomSheet( message: response['ErrorEndUserMessage'], showCancel: true, onOkPressed: () { - AlertDialogBox.closeAlertDialog(context); + // AlertDialogBox.closeAlertDialog(context); sharedPref.setObject(REGISTER_DATA_FOR_LOGIIN, nRequest); setState(() { isSkipRegistration = true; @@ -604,7 +667,7 @@ class _RegisterNew extends State { sharedPref.setObject(REGISTER_DATA_FOR_LOGIIN, nRequest); sharedPref.setString(LOGIN_TOKEN_ID, response['LogInTokenID']); if (request.patientOutSA == 0) { - this.chekUserData(response['LogInTokenID'], type); // ظ ; + this.chekUserData(response['LogInTokenID'], type); } else { sendActivationCode(type, response['LogInTokenID'], null, isSkipRegistration); } @@ -613,6 +676,7 @@ class _RegisterNew extends State { GifLoaderDialogUtils.hideDialog(context); // if (response['ErrorCode'] == '-986') { //AppToast.showErrorToast(message: response); + GifLoaderDialogUtils.hideDialog(context); context.showBottomSheet( child: ExceptionBottomSheet( message: response, @@ -694,13 +758,13 @@ class _RegisterNew extends State { request.patientIdentificationID = nationalIDorFile.text; } request.isHijri = isHijri ?? 0; - + if (skipRegistration) { // Keep existing loader active, don't show new one var req = getCommonRequest(type: type); req.logInTokenID = ""; var request = CheckPatientAuthenticationReq.fromJson(req.toJson()); - + authService.checkPatientAuthentication(request).then((value) async { if (value['isSMSSent']) { sharedPref.setString(LOGIN_TOKEN_ID, value['LogInTokenID']); diff --git a/lib/pages/login/welcome.dart b/lib/pages/login/welcome.dart index 001483c1..f2a540ec 100644 --- a/lib/pages/login/welcome.dart +++ b/lib/pages/login/welcome.dart @@ -80,7 +80,7 @@ class _WelcomeLogin extends State { late ToDoCountProviderModel toDoProvider; - late int selectedOption =1; + late int selectedOption = 1; bool onlySMSBox = false; @@ -90,7 +90,6 @@ class _WelcomeLogin extends State { late int isHijri; var healthId; - @override void initState() { isLoading = true; diff --git a/lib/theme/colors.dart b/lib/theme/colors.dart index 009b6874..3815cbe9 100644 --- a/lib/theme/colors.dart +++ b/lib/theme/colors.dart @@ -32,6 +32,7 @@ class CustomColors { static const Color bgRedColor = Color(0xFFED1C2B); static const Color bgRedBorderColor = Color(0xFFED1C2B); static const Color bgRedLightColor = Color(0xFFFEE9EA); + static const Color bgGreenColor = Color(0xFF18C273); diff --git a/lib/uitl/utils.dart b/lib/uitl/utils.dart index 78c97885..affd6d5f 100644 --- a/lib/uitl/utils.dart +++ b/lib/uitl/utils.dart @@ -81,7 +81,7 @@ enum MaritalStatusType { single, married, divorced, widowed } class Utils { static int? onOtpBtnPressed(OTPType type, String? phoneNumber, BuildContext context) { - if (phoneNumber == null || phoneNumber.isEmpty) { + if (phoneNumber == null || phoneNumber.isEmpty || phoneNumber.length < 9) { context.showBottomSheet( child: ExceptionBottomSheet( message: "Please enter your phone number.",