switch family member with super user

pull/76/head
Sultan khan 1 month ago
parent 318441c77f
commit e2188b5a69

@ -28,7 +28,9 @@ abstract class AuthenticationRepo {
int? patientShareRequestID, int? patientShareRequestID,
int? responseID, int? responseID,
bool isSwitchUser = false, bool isSwitchUser = false,
int? patientID}); int? patientID,
int? loginType
});
Future<Either<Failure, GenericApiModel<dynamic>>> checkIfUserAgreed({required dynamic commonAuthanticatedRequest}); Future<Either<Failure, GenericApiModel<dynamic>>> checkIfUserAgreed({required dynamic commonAuthanticatedRequest});
@ -192,6 +194,7 @@ class AuthenticationRepoImp implements AuthenticationRepo {
int? responseID, int? responseID,
bool isSwitchUser = false, bool isSwitchUser = false,
int? patientID, int? patientID,
int? loginType
}) async { }) async {
if (isRegister) { if (isRegister) {
newRequest["activationCode"] = activationCode ?? "0000"; newRequest["activationCode"] = activationCode ?? "0000";
@ -215,12 +218,19 @@ class AuthenticationRepoImp implements AuthenticationRepo {
Map<String, dynamic> switchRequest = {}; Map<String, dynamic> switchRequest = {};
if (isSwitchUser) { if (isSwitchUser) {
switchRequest = newRequest.toJson(); switchRequest = newRequest.toJson();
switchRequest['SuperUser'] = patientID;
switchRequest['PatientID'] = responseID; switchRequest['PatientID'] = responseID;
switchRequest['IsSilentLogin'] = true; switchRequest['IsSilentLogin'] = true;
switchRequest['LogInTokenID'] = null; switchRequest['LogInTokenID'] = null;
switchRequest['DeviceToken'] = null;
switchRequest['SearchType'] = 2; switchRequest['SearchType'] = 2;
if(loginType != 0) {
switchRequest['SuperUser'] = patientID;
switchRequest['DeviceToken'] = null;
}else{
switchRequest['LoginType'] = 2;
}
} }
final endpoint = isFormFamilyFile final endpoint = isFormFamilyFile

@ -247,7 +247,7 @@ class AuthenticationViewModel extends ChangeNotifier {
await selectDeviceImei(onSuccess: (dynamic respData) async { await selectDeviceImei(onSuccess: (dynamic respData) async {
try { try {
if (respData != null) { if (respData != null) {
dynamic data = SelectDeviceByImeiRespModelElement.fromJson(respData.toJson()); dynamic data = await SelectDeviceByImeiRespModelElement.fromJson(respData.toJson());
_appState.setSelectDeviceByImeiRespModelElement(data); _appState.setSelectDeviceByImeiRespModelElement(data);
LoaderBottomSheet.hideLoader(); LoaderBottomSheet.hideLoader();
@ -440,7 +440,8 @@ class AuthenticationViewModel extends ChangeNotifier {
dynamic patientShareRequestID, dynamic patientShareRequestID,
dynamic responseID, dynamic responseID,
bool isSwitchUser =false, bool isSwitchUser =false,
int? patientID int? patientID,
}) async { }) 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);
@ -515,7 +516,8 @@ class AuthenticationViewModel extends ChangeNotifier {
patientShareRequestID: patientShareRequestID, patientShareRequestID: patientShareRequestID,
responseID: responseID, responseID: responseID,
isSwitchUser: isSwitchUser, isSwitchUser: isSwitchUser,
patientID: patientID patientID: patientID,
loginType: _appState.superUserID != null ? 0 : 2,
); );
resultEither.fold( resultEither.fold(

@ -275,7 +275,9 @@ class MedicalFileViewModel extends ChangeNotifier {
? phoneNumber.replaceFirst("0", "") ? phoneNumber.replaceFirst("0", "")
: phoneNumber; : phoneNumber;
await authVM.checkActivationCode(activationCode: '0000', otpTypeEnum: OTPTypeEnum.sms, onWrongActivationCode: (String? str) {}, responseID: responseID, isFormFamilyFile:false, isSwitchUser: true, patientID: patientID);
await authVM.checkActivationCode(activationCode: '0000', otpTypeEnum: OTPTypeEnum.sms, onWrongActivationCode: (String? str) {}, responseID: responseID, isFormFamilyFile:false, isSwitchUser: true, patientID: patientID, );
} }

Loading…
Cancel
Save