|
|
|
|
@ -368,11 +368,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,
|
|
|
|
|
isForRegister: false);
|
|
|
|
|
await sendActivationCode(otpTypeEnum: otpTypeEnum, phoneNumber: phoneNumberController.text, nationalIdOrFileNumber: nationalIdController.text, isForRegister: false);
|
|
|
|
|
} else {
|
|
|
|
|
if (apiResponse.data['IsAuthenticated']) {
|
|
|
|
|
await checkActivationCode(
|
|
|
|
|
@ -434,10 +430,7 @@ class AuthenticationViewModel extends ChangeNotifier {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
final resultEither = await _authenticationRepo.sendActivationCodeRepo(
|
|
|
|
|
sendActivationCodeReq: request,
|
|
|
|
|
isRegister: checkIsUserComingForRegister(request: payload),
|
|
|
|
|
languageID: 'er',
|
|
|
|
|
isFormFamilyFile: isFormFamilyFile);
|
|
|
|
|
sendActivationCodeReq: request, isRegister: checkIsUserComingForRegister(request: payload), languageID: 'er', isFormFamilyFile: isFormFamilyFile);
|
|
|
|
|
|
|
|
|
|
resultEither.fold(
|
|
|
|
|
(failure) async => await _errorHandlerService.handleError(failure: failure),
|
|
|
|
|
@ -514,9 +507,7 @@ class AuthenticationViewModel extends ChangeNotifier {
|
|
|
|
|
bool isSwitchUser = false,
|
|
|
|
|
int? patientID,
|
|
|
|
|
}) async {
|
|
|
|
|
bool isForRegister = (_appState.getUserRegistrationPayload.healthId != null ||
|
|
|
|
|
_appState.getUserRegistrationPayload.patientOutSa == true ||
|
|
|
|
|
_appState.getUserRegistrationPayload.patientOutSa == 1);
|
|
|
|
|
bool isForRegister = (_appState.getUserRegistrationPayload.healthId != null || _appState.getUserRegistrationPayload.patientOutSa == true || _appState.getUserRegistrationPayload.patientOutSa == 1);
|
|
|
|
|
MyAppointmentsViewModel myAppointmentsVM = getIt<MyAppointmentsViewModel>();
|
|
|
|
|
|
|
|
|
|
if (isSwitchUser && _appState.getSuperUserID == null) {
|
|
|
|
|
@ -558,8 +549,7 @@ class AuthenticationViewModel extends ChangeNotifier {
|
|
|
|
|
request["ForRegisteration"] = _appState.getUserRegistrationPayload.isRegister;
|
|
|
|
|
request["isRegister"] = false;
|
|
|
|
|
|
|
|
|
|
final resultEither =
|
|
|
|
|
await _authenticationRepo.checkActivationCodeRepo(newRequest: request, activationCode: activationCode.toString(), isRegister: true);
|
|
|
|
|
final resultEither = await _authenticationRepo.checkActivationCodeRepo(newRequest: request, activationCode: activationCode.toString(), isRegister: true);
|
|
|
|
|
|
|
|
|
|
LoaderBottomSheet.hideLoader();
|
|
|
|
|
|
|
|
|
|
@ -633,7 +623,9 @@ class AuthenticationViewModel extends ChangeNotifier {
|
|
|
|
|
await medicalVm.getFamilyFiles(status: 0);
|
|
|
|
|
if (isFormFamilyFile) {
|
|
|
|
|
await medicalVm.getAllPendingRecordsByResponseId();
|
|
|
|
|
_navigationService.pushAndReplace(AppRoutes.medicalFilePage);
|
|
|
|
|
_navigationService.replaceAllRoutesAndNavigateToLandingWithMedicalAuth().whenComplete(() {
|
|
|
|
|
_navigationService.pushPageRoute(AppRoutes.medicalFilePage);
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
_navigationService.replaceAllRoutesAndNavigateToLanding();
|
|
|
|
|
}
|
|
|
|
|
@ -870,8 +862,7 @@ class AuthenticationViewModel extends ChangeNotifier {
|
|
|
|
|
: _appState.getAuthenticatedUser()!.mobileNumber)!;
|
|
|
|
|
nationalIdController.text = _appState.getAuthenticatedUser()!.patientIdentificationNo!;
|
|
|
|
|
onSuccess();
|
|
|
|
|
} else if ((loginTypeEnum == LoginTypeEnum.sms ||
|
|
|
|
|
loginTypeEnum == LoginTypeEnum.whatsapp && _appState.getSelectDeviceByImeiRespModelElement == null) &&
|
|
|
|
|
} else if ((loginTypeEnum == LoginTypeEnum.sms || loginTypeEnum == LoginTypeEnum.whatsapp && _appState.getSelectDeviceByImeiRespModelElement == null) &&
|
|
|
|
|
_appState.getAuthenticatedUser() != null) {
|
|
|
|
|
phoneNumberController.text = (_appState.getAuthenticatedUser()!.mobileNumber!.startsWith("0")
|
|
|
|
|
? _appState.getAuthenticatedUser()!.mobileNumber!.replaceFirst("0", "")
|
|
|
|
|
@ -928,8 +919,7 @@ class AuthenticationViewModel extends ChangeNotifier {
|
|
|
|
|
LoaderBottomSheet.showLoader();
|
|
|
|
|
// LoadingUtils.showFullScreenLoader(loadingText: "Setting up your medical file.\nMay take a moment.");
|
|
|
|
|
|
|
|
|
|
var request = RequestUtils.getUserSignupCompletionRequest(
|
|
|
|
|
fullName: nameController.text, emailAddress: emailController.text, gender: genderType, maritalStatus: maritalStatus);
|
|
|
|
|
var request = RequestUtils.getUserSignupCompletionRequest(fullName: nameController.text, emailAddress: emailController.text, gender: genderType, maritalStatus: maritalStatus);
|
|
|
|
|
|
|
|
|
|
final resultEither = await _authenticationRepo.registerUser(registrationPayloadDataModelRequest: request);
|
|
|
|
|
resultEither.fold((failure) async => await _errorHandlerService.handleError(failure: failure), (apiResponse) async {
|
|
|
|
|
@ -1059,8 +1049,7 @@ class AuthenticationViewModel extends ChangeNotifier {
|
|
|
|
|
biometricEnabled: loginType == 1 || loginType == 2 ? false : true,
|
|
|
|
|
firstNameN: _appState.getAuthenticatedUser()!.firstNameN,
|
|
|
|
|
lastNameN: _appState.getAuthenticatedUser()!.lastNameN,
|
|
|
|
|
zipCode:
|
|
|
|
|
_appState.getAuthenticatedUser()!.zipCode //selectedCountrySignup == CountryEnum.others ? '0': selectedCountrySignup.countryCode,
|
|
|
|
|
zipCode: _appState.getAuthenticatedUser()!.zipCode //selectedCountrySignup == CountryEnum.others ? '0': selectedCountrySignup.countryCode,
|
|
|
|
|
)
|
|
|
|
|
.toJson());
|
|
|
|
|
resultEither.fold((failure) async => await _errorHandlerService.handleError(failure: failure), (apiResponse) async {
|
|
|
|
|
|