Merge branch 'master' into haroon_dev

pull/30/head
haroon amjad 2 months ago
commit 1c39b26fcc

@ -65,7 +65,7 @@ class RequestUtils {
required String? deviceToken, required String? deviceToken,
required bool patientOutSA, required bool patientOutSA,
required String? loginTokenID, required String? loginTokenID,
RegistrationDataModelPayload? registeredData, RegistrationDataModelPayload? registeredData,
int? patientId, int? patientId,
required String nationIdText, required String nationIdText,
required String countryCode, required String countryCode,
@ -85,7 +85,12 @@ class RequestUtils {
request.logInTokenID = loginTokenID ?? ""; request.logInTokenID = loginTokenID ?? "";
if (registeredData != null) { 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.patientID = registeredData.patientId ?? 0;
request.patientIdentificationID = request.nationalID = (registeredData.patientIdentificationId ?? 0); request.patientIdentificationID = request.nationalID = (registeredData.patientIdentificationId ?? 0);
request.dob = registeredData.dob; request.dob = registeredData.dob;
@ -95,9 +100,11 @@ class RequestUtils {
request.patientID = patientId ?? int.parse(nationIdText); request.patientID = patientId ?? int.parse(nationIdText);
request.patientIdentificationID = request.nationalID = 0; request.patientIdentificationID = request.nationalID = 0;
request.searchType = 2; request.searchType = 2;
//TODO: Issue HEre is Not Login
} else { } else {
request.patientID = 0; request.patientID = 0;
request.searchType = 1; request.searchType = 1;
//TODO: Issue HEre is Not Login
request.patientIdentificationID = request.nationalID = (nationIdText.isNotEmpty ? int.parse(nationIdText) : 0); request.patientIdentificationID = request.nationalID = (nationIdText.isNotEmpty ? int.parse(nationIdText) : 0);
} }
request.isRegister = false; request.isRegister = false;

@ -297,11 +297,7 @@ class AuthenticationViewModel extends ChangeNotifier {
} else if (apiResponse.messageStatus == 1) { } else if (apiResponse.messageStatus == 1) {
if (apiResponse.data['isSMSSent']) { if (apiResponse.data['isSMSSent']) {
_appState.setAppAuthToken = apiResponse.data['LogInTokenID']; _appState.setAppAuthToken = apiResponse.data['LogInTokenID'];
await sendActivationCode( await sendActivationCode(otpTypeEnum: otpTypeEnum, phoneNumber: phoneNumberController.text, nationalIdOrFileNumber: nationalIdController.text, isForRegister: false);
otpTypeEnum: otpTypeEnum,
phoneNumber: phoneNumberController.text,
nationalIdOrFileNumber: nationalIdController.text,
);
} else { } else {
if (apiResponse.data['IsAuthenticated']) { if (apiResponse.data['IsAuthenticated']) {
await checkActivationCode( await checkActivationCode(
@ -316,21 +312,23 @@ class AuthenticationViewModel extends ChangeNotifier {
); );
} }
Future<void> sendActivationCode({required OTPTypeEnum otpTypeEnum, required String nationalIdOrFileNumber, required String phoneNumber, dynamic payload}) async { Future<void> sendActivationCode({required OTPTypeEnum otpTypeEnum, required String nationalIdOrFileNumber, required String phoneNumber, required bool isForRegister, dynamic payload}) async {
var request = RequestUtils.getCommonRequestSendActivationCode( var request = RequestUtils.getCommonRequestSendActivationCode(
otpTypeEnum: otpTypeEnum, otpTypeEnum: otpTypeEnum,
mobileNumber: phoneNumber, mobileNumber: phoneNumber,
selectedLoginType: otpTypeEnum.toInt(), selectedLoginType: otpTypeEnum.toInt(),
zipCode: selectedCountrySignup.countryCode, zipCode: selectedCountrySignup.countryCode,
nationalId: int.parse(nationalIdOrFileNumber), nationalId: int.parse(nationalIdOrFileNumber),
// isFileNo: isPatientHasFile(request: payload), isFileNo: isForRegister ? isPatientHasFile(request: payload) : false,
isFileNo: false, patientId: 0,
patientId: 0, isForRegister: isForRegister,
isForRegister: false, patientOutSA: isForRegister
// isForRegister: checkIsUserComingForRegister(request: payload), ? isPatientOutsideSA(request: payload)
patientOutSA: selectedCountrySignup.countryCode == CountryEnum.saudiArabia ? false : true, : selectedCountrySignup.countryCode == CountryEnum.saudiArabia
// patientOutSA: isPatientOutsideSA(request: payload), ? false
payload: payload); : true,
payload: payload,
);
// TODO: GET APP SMS SIGNATURE HERE // TODO: GET APP SMS SIGNATURE HERE
request.sMSSignature = "enKTDcqbOVd"; request.sMSSignature = "enKTDcqbOVd";
@ -385,7 +383,11 @@ class AuthenticationViewModel extends ChangeNotifier {
? _appState.getUserRegistrationPayload.projectOutSa == 1 ? _appState.getUserRegistrationPayload.projectOutSa == 1
? true ? true
: false : false
: _appState.getSelectDeviceByImeiRespModelElement!.outSa!, : _appState.getSelectDeviceByImeiRespModelElement != null
? _appState.getSelectDeviceByImeiRespModelElement!.outSa!
: selectedCountrySignup == CountryEnum.saudiArabia
? false
: true,
loginTokenID: _appState.appAuthToken, loginTokenID: _appState.appAuthToken,
registeredData: isForRegister ? _appState.getUserRegistrationPayload : null, registeredData: isForRegister ? _appState.getUserRegistrationPayload : null,
nationIdText: nationalIdController.text, nationIdText: nationalIdController.text,
@ -674,10 +676,12 @@ class AuthenticationViewModel extends ChangeNotifier {
if (isPatientOutsideSA(request: response)) { if (isPatientOutsideSA(request: response)) {
print("=======OUT SA======="); print("=======OUT SA=======");
sendActivationCode( sendActivationCode(
otpTypeEnum: OTPTypeEnumExtension.fromInt(request["OTP_SendType"]), otpTypeEnum: OTPTypeEnumExtension.fromInt(request["OTP_SendType"]),
nationalIdOrFileNumber: request["PatientIdentificationID"].toString(), nationalIdOrFileNumber: request["PatientIdentificationID"].toString(),
phoneNumber: request["PatientMobileNumber"].toString(), phoneNumber: request["PatientMobileNumber"].toString(),
payload: request); payload: request,
isForRegister: true,
);
} else { } else {
print("=======IN SA======="); print("=======IN SA=======");
chekUserNHICData(request: request); chekUserNHICData(request: request);
@ -715,10 +719,12 @@ class AuthenticationViewModel extends ChangeNotifier {
if (apiResponse.data is Map) { if (apiResponse.data is Map) {
setNHICData(apiResponse.data, request); setNHICData(apiResponse.data, request);
sendActivationCode( sendActivationCode(
otpTypeEnum: OTPTypeEnumExtension.fromInt(request["OTP_SendType"]), otpTypeEnum: OTPTypeEnumExtension.fromInt(request["OTP_SendType"]),
nationalIdOrFileNumber: request["PatientIdentificationID"].toString(), nationalIdOrFileNumber: request["PatientIdentificationID"].toString(),
phoneNumber: request["PatientMobileNumber"].toString(), phoneNumber: request["PatientMobileNumber"].toString(),
payload: request); payload: request,
isForRegister: true,
);
} }
}); });

@ -1,6 +1,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get_it/get_it.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/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/core/utils/utils.dart';
import 'package:hmg_patient_app_new/services/navigation_service.dart'; import 'package:hmg_patient_app_new/services/navigation_service.dart';
@ -15,7 +17,7 @@ class LoaderBottomSheet {
showModalBottomSheet( showModalBottomSheet(
context: _navService.navigatorKey.currentContext!, context: _navService.navigatorKey.currentContext!,
isDismissible: false, isDismissible: ApiConsts.appEnvironmentType == AppEnvironmentTypeEnum.uat ? true : false,
enableDrag: false, enableDrag: false,
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
builder: (_) { builder: (_) {

Loading…
Cancel
Save