diff --git a/lib/core/utils/request_utils.dart b/lib/core/utils/request_utils.dart index fc9815d..00bfc94 100644 --- a/lib/core/utils/request_utils.dart +++ b/lib/core/utils/request_utils.dart @@ -65,7 +65,7 @@ class RequestUtils { required String? deviceToken, required bool patientOutSA, required String? loginTokenID, - RegistrationDataModelPayload? registeredData, + RegistrationDataModelPayload? registeredData, int? patientId, required String nationIdText, required String countryCode, @@ -85,7 +85,12 @@ class RequestUtils { request.logInTokenID = loginTokenID ?? ""; if (registeredData != null) { - request.searchType = registeredData.searchType ?? 1; + //TODO: Issue Here if Not Signup + request.searchType = registeredData.searchType != null + ? registeredData.searchType + : fileNo + ? 1 + : 2; request.patientID = registeredData.patientId ?? 0; request.patientIdentificationID = request.nationalID = (registeredData.patientIdentificationId ?? 0); request.dob = registeredData.dob; @@ -95,9 +100,11 @@ class RequestUtils { request.patientID = patientId ?? int.parse(nationIdText); request.patientIdentificationID = request.nationalID = 0; request.searchType = 2; + //TODO: Issue HEre is Not Login } else { request.patientID = 0; request.searchType = 1; + //TODO: Issue HEre is Not Login request.patientIdentificationID = request.nationalID = (nationIdText.isNotEmpty ? int.parse(nationIdText) : 0); } request.isRegister = false; diff --git a/lib/features/authentication/authentication_view_model.dart b/lib/features/authentication/authentication_view_model.dart index 2c6cad8..b2464f6 100644 --- a/lib/features/authentication/authentication_view_model.dart +++ b/lib/features/authentication/authentication_view_model.dart @@ -297,11 +297,7 @@ class AuthenticationViewModel extends ChangeNotifier { } else if (apiResponse.messageStatus == 1) { if (apiResponse.data['isSMSSent']) { _appState.setAppAuthToken = apiResponse.data['LogInTokenID']; - await sendActivationCode( - otpTypeEnum: otpTypeEnum, - phoneNumber: phoneNumberController.text, - nationalIdOrFileNumber: nationalIdController.text, - ); + await sendActivationCode(otpTypeEnum: otpTypeEnum, phoneNumber: phoneNumberController.text, nationalIdOrFileNumber: nationalIdController.text, isForRegister: false); } else { if (apiResponse.data['IsAuthenticated']) { await checkActivationCode( @@ -316,21 +312,23 @@ class AuthenticationViewModel extends ChangeNotifier { ); } - Future sendActivationCode({required OTPTypeEnum otpTypeEnum, required String nationalIdOrFileNumber, required String phoneNumber, dynamic payload}) async { + Future sendActivationCode({required OTPTypeEnum otpTypeEnum, required String nationalIdOrFileNumber, required String phoneNumber, required bool isForRegister, dynamic payload}) async { var request = RequestUtils.getCommonRequestSendActivationCode( - otpTypeEnum: otpTypeEnum, - mobileNumber: phoneNumber, - selectedLoginType: otpTypeEnum.toInt(), - zipCode: selectedCountrySignup.countryCode, - nationalId: int.parse(nationalIdOrFileNumber), - // isFileNo: isPatientHasFile(request: payload), - isFileNo: false, - patientId: 0, - isForRegister: false, - // isForRegister: checkIsUserComingForRegister(request: payload), - patientOutSA: selectedCountrySignup.countryCode == CountryEnum.saudiArabia ? false : true, - // patientOutSA: isPatientOutsideSA(request: payload), - payload: payload); + otpTypeEnum: otpTypeEnum, + mobileNumber: phoneNumber, + selectedLoginType: otpTypeEnum.toInt(), + zipCode: selectedCountrySignup.countryCode, + nationalId: int.parse(nationalIdOrFileNumber), + isFileNo: isForRegister ? isPatientHasFile(request: payload) : false, + patientId: 0, + isForRegister: isForRegister, + patientOutSA: isForRegister + ? isPatientOutsideSA(request: payload) + : selectedCountrySignup.countryCode == CountryEnum.saudiArabia + ? false + : true, + payload: payload, + ); // TODO: GET APP SMS SIGNATURE HERE request.sMSSignature = "enKTDcqbOVd"; @@ -385,7 +383,11 @@ class AuthenticationViewModel extends ChangeNotifier { ? _appState.getUserRegistrationPayload.projectOutSa == 1 ? true : false - : _appState.getSelectDeviceByImeiRespModelElement!.outSa!, + : _appState.getSelectDeviceByImeiRespModelElement != null + ? _appState.getSelectDeviceByImeiRespModelElement!.outSa! + : selectedCountrySignup == CountryEnum.saudiArabia + ? false + : true, loginTokenID: _appState.appAuthToken, registeredData: isForRegister ? _appState.getUserRegistrationPayload : null, nationIdText: nationalIdController.text, @@ -674,10 +676,12 @@ class AuthenticationViewModel extends ChangeNotifier { if (isPatientOutsideSA(request: response)) { print("=======OUT SA======="); sendActivationCode( - otpTypeEnum: OTPTypeEnumExtension.fromInt(request["OTP_SendType"]), - nationalIdOrFileNumber: request["PatientIdentificationID"].toString(), - phoneNumber: request["PatientMobileNumber"].toString(), - payload: request); + otpTypeEnum: OTPTypeEnumExtension.fromInt(request["OTP_SendType"]), + nationalIdOrFileNumber: request["PatientIdentificationID"].toString(), + phoneNumber: request["PatientMobileNumber"].toString(), + payload: request, + isForRegister: true, + ); } else { print("=======IN SA======="); chekUserNHICData(request: request); @@ -715,10 +719,12 @@ class AuthenticationViewModel extends ChangeNotifier { if (apiResponse.data is Map) { setNHICData(apiResponse.data, request); sendActivationCode( - otpTypeEnum: OTPTypeEnumExtension.fromInt(request["OTP_SendType"]), - nationalIdOrFileNumber: request["PatientIdentificationID"].toString(), - phoneNumber: request["PatientMobileNumber"].toString(), - payload: request); + otpTypeEnum: OTPTypeEnumExtension.fromInt(request["OTP_SendType"]), + nationalIdOrFileNumber: request["PatientIdentificationID"].toString(), + phoneNumber: request["PatientMobileNumber"].toString(), + payload: request, + isForRegister: true, + ); } }); diff --git a/lib/widgets/loader/bottomsheet_loader.dart b/lib/widgets/loader/bottomsheet_loader.dart index 61f7f43..57dfa01 100644 --- a/lib/widgets/loader/bottomsheet_loader.dart +++ b/lib/widgets/loader/bottomsheet_loader.dart @@ -1,6 +1,8 @@ import 'package:flutter/material.dart'; import 'package:get_it/get_it.dart'; +import 'package:hmg_patient_app_new/core/api_consts.dart'; import 'package:hmg_patient_app_new/core/dependencies.dart'; +import 'package:hmg_patient_app_new/core/enums.dart'; import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:hmg_patient_app_new/services/navigation_service.dart'; @@ -15,7 +17,7 @@ class LoaderBottomSheet { showModalBottomSheet( context: _navService.navigatorKey.currentContext!, - isDismissible: false, + isDismissible: ApiConsts.appEnvironmentType == AppEnvironmentTypeEnum.uat ? true : false, enableDrag: false, backgroundColor: Colors.transparent, builder: (_) {