|
|
|
@ -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: false,
|
|
|
|
isForRegister: isForRegister,
|
|
|
|
// isForRegister: checkIsUserComingForRegister(request: payload),
|
|
|
|
patientOutSA: isForRegister
|
|
|
|
patientOutSA: selectedCountrySignup.countryCode == CountryEnum.saudiArabia ? false : true,
|
|
|
|
? isPatientOutsideSA(request: payload)
|
|
|
|
// patientOutSA: isPatientOutsideSA(request: payload),
|
|
|
|
: selectedCountrySignup.countryCode == CountryEnum.saudiArabia
|
|
|
|
payload: payload);
|
|
|
|
? false
|
|
|
|
|
|
|
|
: 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,
|
|
|
|
@ -677,7 +679,9 @@ class AuthenticationViewModel extends ChangeNotifier {
|
|
|
|
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);
|
|
|
|
@ -718,7 +722,9 @@ class AuthenticationViewModel extends ChangeNotifier {
|
|
|
|
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,
|
|
|
|
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|