pull/28/head
haroon amjad 2 months ago
parent 3a649bca35
commit d87562caf5

@ -65,7 +65,7 @@ class RequestUtils {
required String? deviceToken,
required bool patientOutSA,
required String? loginTokenID,
required RegistrationDataModelPayload registeredData,
RegistrationDataModelPayload? registeredData,
int? patientId,
required String nationIdText,
required String countryCode,

@ -82,7 +82,7 @@ class AuthenticationViewModel extends ChangeNotifier {
String errorMsg = '';
final FocusNode myFocusNode = FocusNode();
var healthId;
int getDeviceLastLogin =1;
int getDeviceLastLogin = 1;
Future<void> onLoginPressed() async {
try {
@ -297,12 +297,11 @@ class AuthenticationViewModel extends ChangeNotifier {
} else if (apiResponse.messageStatus == 1) {
if (apiResponse.data['isSMSSent']) {
_appState.setAppAuthToken = apiResponse.data['LogInTokenID'];
await sendActivationCode(
await sendActivationCode(
otpTypeEnum: otpTypeEnum,
phoneNumber: phoneNumberController.text,
nationalIdOrFileNumber: nationalIdController.text,
);
} else {
if (apiResponse.data['IsAuthenticated']) {
await checkActivationCode(
@ -310,7 +309,6 @@ class AuthenticationViewModel extends ChangeNotifier {
onWrongActivationCode: (String? message) {},
activationCode: null, //todo silent login case halded on the repo itself..
);
}
}
}
@ -325,10 +323,13 @@ class AuthenticationViewModel extends ChangeNotifier {
selectedLoginType: otpTypeEnum.toInt(),
zipCode: selectedCountrySignup.countryCode,
nationalId: int.parse(nationalIdOrFileNumber),
isFileNo: isPatientHasFile(request: payload),
// isFileNo: isPatientHasFile(request: payload),
isFileNo: false,
patientId: 0,
isForRegister: checkIsUserComingForRegister(request: payload),
patientOutSA: isPatientOutsideSA(request: payload),
isForRegister: false,
// isForRegister: checkIsUserComingForRegister(request: payload),
patientOutSA: selectedCountrySignup.countryCode == CountryEnum.saudiArabia ? false : true,
// patientOutSA: isPatientOutsideSA(request: payload),
payload: payload);
// TODO: GET APP SMS SIGNATURE HERE
@ -373,19 +374,25 @@ class AuthenticationViewModel extends ChangeNotifier {
required OTPTypeEnum otpTypeEnum,
required Function(String? message) onWrongActivationCode,
}) async {
bool isForRegister = (_appState.getUserRegistrationPayload.healthId != null || _appState.getUserRegistrationPayload.patientOutSa == true);
final request = RequestUtils.getCommonRequestWelcome(
phoneNumber: phoneNumberController.text,
otpTypeEnum: otpTypeEnum,
deviceToken: _appState.deviceToken,
patientOutSA: _appState.getUserRegistrationPayload.projectOutSa == 1 ? true : false,
// patientOutSA: _appState.getUserRegistrationPayload.projectOutSa == 1 ? true : false,
patientOutSA: isForRegister
? _appState.getUserRegistrationPayload.projectOutSa == 1
? true
: false
: _appState.getSelectDeviceByImeiRespModelElement!.outSa!,
loginTokenID: _appState.appAuthToken,
registeredData: _appState.getUserRegistrationPayload,
registeredData: isForRegister ? _appState.getUserRegistrationPayload : null,
nationIdText: nationalIdController.text,
countryCode: selectedCountrySignup.countryCode,
loginType: loginTypeEnum.toInt)
.toJson();
LoaderBottomSheet.showLoader();
bool isForRegister = (_appState.getUserRegistrationPayload.healthId != null || _appState.getUserRegistrationPayload.patientOutSa == true);
if (isForRegister) {
if (_appState.getUserRegistrationPayload.patientOutSa == 0) request['DOB'] = _appState.getUserRegistrationPayload.dob;
request['HealthId'] = _appState.getUserRegistrationPayload.healthId;

Loading…
Cancel
Save