|
|
|
|
@ -29,6 +29,7 @@ import 'package:hmg_patient_app_new/features/authentication/models/resp_models/c
|
|
|
|
|
import 'package:hmg_patient_app_new/features/authentication/models/resp_models/check_user_staus_nhic_response_model.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/features/authentication/models/resp_models/select_device_by_imei.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/features/medical_file/medical_file_repo.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/features/medical_file/medical_file_view_model.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/presentation/authentication/login.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/presentation/authentication/saved_login_screen.dart';
|
|
|
|
|
@ -389,8 +390,10 @@ class AuthenticationViewModel extends ChangeNotifier {
|
|
|
|
|
(failure) async => await _errorHandlerService.handleError(failure: failure),
|
|
|
|
|
(apiResponse) async {
|
|
|
|
|
int? patientShareRequestID = 0;
|
|
|
|
|
String? familyFileTokenID;
|
|
|
|
|
if (isFormFamilyFile) {
|
|
|
|
|
patientShareRequestID = apiResponse.data['PatientShareRequestID'];
|
|
|
|
|
familyFileTokenID = apiResponse.data['LogInTokenID'];
|
|
|
|
|
}
|
|
|
|
|
if (apiResponse.messageStatus == 2) {
|
|
|
|
|
LoaderBottomSheet.hideLoader();
|
|
|
|
|
@ -404,15 +407,15 @@ class AuthenticationViewModel extends ChangeNotifier {
|
|
|
|
|
LoaderBottomSheet.hideLoader();
|
|
|
|
|
if (!isComingFromResendOTP) {
|
|
|
|
|
navigateToOTPScreen(
|
|
|
|
|
otpTypeEnum: otpTypeEnum,
|
|
|
|
|
phoneNumber: phoneNumber,
|
|
|
|
|
isComingFromRegister: checkIsUserComingForRegister(request: payload),
|
|
|
|
|
payload: payload,
|
|
|
|
|
isFormFamilyFile: isFormFamilyFile,
|
|
|
|
|
isExcludedUser: isExcludedUser,
|
|
|
|
|
responseID: responseID,
|
|
|
|
|
patientShareRequestID: patientShareRequestID,
|
|
|
|
|
);
|
|
|
|
|
otpTypeEnum: otpTypeEnum,
|
|
|
|
|
phoneNumber: phoneNumber,
|
|
|
|
|
isComingFromRegister: checkIsUserComingForRegister(request: payload),
|
|
|
|
|
payload: payload,
|
|
|
|
|
isFormFamilyFile: isFormFamilyFile,
|
|
|
|
|
isExcludedUser: isExcludedUser,
|
|
|
|
|
responseID: responseID,
|
|
|
|
|
patientShareRequestID: patientShareRequestID,
|
|
|
|
|
familyFileTokenID: familyFileTokenID);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
// TODO: Handle isSMSSent false
|
|
|
|
|
@ -438,7 +441,8 @@ class AuthenticationViewModel extends ChangeNotifier {
|
|
|
|
|
Function()? onResendActivation,
|
|
|
|
|
bool isFormFamilyFile = false,
|
|
|
|
|
dynamic patientShareRequestID,
|
|
|
|
|
dynamic responseID}) async {
|
|
|
|
|
dynamic responseID,
|
|
|
|
|
String? familyFileTokenID}) async {
|
|
|
|
|
bool isForRegister = (_appState.getUserRegistrationPayload.healthId != null || _appState.getUserRegistrationPayload.patientOutSa == true || _appState.getUserRegistrationPayload.patientOutSa == 1);
|
|
|
|
|
|
|
|
|
|
final request = RequestUtils.getCommonRequestWelcome(
|
|
|
|
|
@ -510,7 +514,8 @@ class AuthenticationViewModel extends ChangeNotifier {
|
|
|
|
|
isRegister: false,
|
|
|
|
|
isFormFamilyFile: isFormFamilyFile,
|
|
|
|
|
patientShareRequestID: patientShareRequestID,
|
|
|
|
|
responseID: responseID);
|
|
|
|
|
responseID: responseID,
|
|
|
|
|
familyFileTokenID: familyFileTokenID);
|
|
|
|
|
|
|
|
|
|
resultEither.fold(
|
|
|
|
|
(failure) async => await _errorHandlerService.handleError(
|
|
|
|
|
@ -543,6 +548,18 @@ class AuthenticationViewModel extends ChangeNotifier {
|
|
|
|
|
// Navigator.popUntil(context, (route) => Utils.route(route, equalsTo: RegisterNew));
|
|
|
|
|
return;
|
|
|
|
|
} else {
|
|
|
|
|
if (isFormFamilyFile) {
|
|
|
|
|
_dialogService.showCommonBottomSheetWithoutH(
|
|
|
|
|
message: "Family File Added Successfully",
|
|
|
|
|
onOkPressed: () {
|
|
|
|
|
LoaderBottomSheet.showLoader();
|
|
|
|
|
MedicalFileViewModel medicalFileVM = GetIt.instance<MedicalFileViewModel>();
|
|
|
|
|
medicalFileVM.getFamilyFiles();
|
|
|
|
|
LoaderBottomSheet.hideLoader();
|
|
|
|
|
_navigationService.popUntilNamed(AppRoutes.medicalFilePage);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (activation.list != null && activation.list!.isNotEmpty) {
|
|
|
|
|
_appState.setAuthenticatedUser(activation.list!.first);
|
|
|
|
|
_appState.setPrivilegeModelList(activation.list!.first.listPrivilege!);
|
|
|
|
|
@ -630,7 +647,8 @@ class AuthenticationViewModel extends ChangeNotifier {
|
|
|
|
|
bool isFormFamilyFile = false,
|
|
|
|
|
bool isExcludedUser = false,
|
|
|
|
|
int? responseID,
|
|
|
|
|
int? patientShareRequestID}) async {
|
|
|
|
|
int? patientShareRequestID,
|
|
|
|
|
String? familyFileTokenID}) async {
|
|
|
|
|
_navigationService.pushToOtpScreen(
|
|
|
|
|
phoneNumber: phoneNumber,
|
|
|
|
|
isFormFamilyFile: isFormFamilyFile,
|
|
|
|
|
@ -641,6 +659,7 @@ class AuthenticationViewModel extends ChangeNotifier {
|
|
|
|
|
otpTypeEnum: otpTypeEnum,
|
|
|
|
|
responseID: responseID,
|
|
|
|
|
patientShareRequestID: patientShareRequestID,
|
|
|
|
|
familyFileTokenID: familyFileTokenID,
|
|
|
|
|
onWrongActivationCode: (String? value) {
|
|
|
|
|
onWrongActivationCode(message: value);
|
|
|
|
|
},
|
|
|
|
|
|