|
|
|
@ -212,56 +212,6 @@ class AuthenticationRepoImp implements AuthenticationRepo {
|
|
|
|
int? patientID,
|
|
|
|
int? patientID,
|
|
|
|
int? loginType}) async {
|
|
|
|
int? loginType}) async {
|
|
|
|
AppState appState = getIt.get<AppState>();
|
|
|
|
AppState appState = getIt.get<AppState>();
|
|
|
|
// if (isRegister) {
|
|
|
|
|
|
|
|
// newRequest["activationCode"] = activationCode ?? "0000";
|
|
|
|
|
|
|
|
// newRequest["isSilentLogin"] = activationCode != null ? false : true;
|
|
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
|
|
// newRequest.activationCode = activationCode ?? "0000";
|
|
|
|
|
|
|
|
// newRequest.isSilentLogin = activationCode != null ? false : true;
|
|
|
|
|
|
|
|
// newRequest.projectOutSA = newRequest.zipCode == '966' ? false : true;
|
|
|
|
|
|
|
|
// newRequest.isDentalAllowedBackend = false;
|
|
|
|
|
|
|
|
// newRequest.forRegisteration = newRequest.isRegister ?? false;
|
|
|
|
|
|
|
|
// newRequest.isRegister = false;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// Map<String, dynamic> familyRequest = {};
|
|
|
|
|
|
|
|
// if (isFormFamilyFile) {
|
|
|
|
|
|
|
|
// AppState appState = getIt.get<AppState>();
|
|
|
|
|
|
|
|
// familyRequest = {};
|
|
|
|
|
|
|
|
// familyRequest['PatientShareRequestID'] = patientShareRequestID;
|
|
|
|
|
|
|
|
// familyRequest['ResponseID'] = responseID;
|
|
|
|
|
|
|
|
// familyRequest['Status'] = 3;
|
|
|
|
|
|
|
|
// familyRequest["PatientID"] = appState.getAuthenticatedUser()!.patientId ?? 0;
|
|
|
|
|
|
|
|
// familyRequest["LogInTokenID"] = appState.getFamilyFileTokenID;
|
|
|
|
|
|
|
|
// familyRequest["activationCode"] = activationCode ?? "0000";
|
|
|
|
|
|
|
|
// familyRequest["PatientMobileNumber"] = newRequest.patientMobileNumber;
|
|
|
|
|
|
|
|
// familyRequest["PatientIdentificationID"] = newRequest.patientIdentificationID;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// Map<String, dynamic> switchRequest = {};
|
|
|
|
|
|
|
|
// if (isSwitchUser) {
|
|
|
|
|
|
|
|
// switchRequest = newRequest.toJson();
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// switchRequest['PatientID'] = responseID;
|
|
|
|
|
|
|
|
// switchRequest['IsSilentLogin'] = true;
|
|
|
|
|
|
|
|
// switchRequest['LogInTokenID'] = null;
|
|
|
|
|
|
|
|
// switchRequest['SearchType'] = 2;
|
|
|
|
|
|
|
|
// if (loginType != 0) {
|
|
|
|
|
|
|
|
// switchRequest['SuperUser'] = patientID;
|
|
|
|
|
|
|
|
// switchRequest['DeviceToken'] = null;
|
|
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
|
|
// switchRequest["LoginType"] = 2;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// if (appState.getSuperUserID == responseID) {
|
|
|
|
|
|
|
|
// // switchRequest['LoginType'] = 3;
|
|
|
|
|
|
|
|
// switchRequest['PatientIdentificationID'] = "";
|
|
|
|
|
|
|
|
// // switchRequest['ProjectOutSA'] = newRequest.zipCode == '966' ? false : true;
|
|
|
|
|
|
|
|
// switchRequest.remove('NationalID');
|
|
|
|
|
|
|
|
// switchRequest.remove('isDentalAllowedBackend');
|
|
|
|
|
|
|
|
// switchRequest.remove('ProjectOutSA');
|
|
|
|
|
|
|
|
// switchRequest.remove('ForRegisteration');
|
|
|
|
|
|
|
|
// appState.setSuperUserID = null;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (isRegister) {
|
|
|
|
if (isRegister) {
|
|
|
|
newRequest["activationCode"] = activationCode ?? "0000";
|
|
|
|
newRequest["activationCode"] = activationCode ?? "0000";
|
|
|
|
@ -330,19 +280,38 @@ class AuthenticationRepoImp implements AuthenticationRepo {
|
|
|
|
? ApiConsts.checkActivationCodeOthers
|
|
|
|
? ApiConsts.checkActivationCodeOthers
|
|
|
|
: ApiConsts.checkActivationCode;
|
|
|
|
: ApiConsts.checkActivationCode;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Store the payload in AppState
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
GenericApiModel<dynamic>? apiResponse;
|
|
|
|
GenericApiModel<dynamic>? apiResponse;
|
|
|
|
Failure? failure;
|
|
|
|
Failure? failure;
|
|
|
|
|
|
|
|
|
|
|
|
await apiClient.post(
|
|
|
|
// Determine the payload to send
|
|
|
|
endpoint,
|
|
|
|
final requestBody = isFormFamilyFile
|
|
|
|
body: isFormFamilyFile
|
|
|
|
|
|
|
|
? familyRequest
|
|
|
|
? familyRequest
|
|
|
|
: isRegister
|
|
|
|
: isRegister
|
|
|
|
? newRequest
|
|
|
|
? newRequest
|
|
|
|
: isSwitchUser
|
|
|
|
: isSwitchUser
|
|
|
|
? switchRequest
|
|
|
|
? switchRequest
|
|
|
|
: newRequest.toJson(),
|
|
|
|
: newRequest.toJson();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!isSwitchUser) {
|
|
|
|
|
|
|
|
print("Initial Super User Payload");
|
|
|
|
|
|
|
|
appState.addUserSwitchPayload(requestBody, isSuperUser: true);
|
|
|
|
|
|
|
|
} else if (isSwitchUser) {
|
|
|
|
|
|
|
|
print("Switch Into First Family File");
|
|
|
|
|
|
|
|
appState.addUserSwitchPayload(requestBody, isSuperUser: false);
|
|
|
|
|
|
|
|
} else if (appState.getSuperUserID == responseID) {
|
|
|
|
|
|
|
|
print("Switching Back to Super User");
|
|
|
|
|
|
|
|
// appState.addUserSwitchPayload(requestBody, isSuperUser: true);
|
|
|
|
|
|
|
|
} else if (isSwitchUser && appState.getSuperUserID == responseID) {
|
|
|
|
|
|
|
|
print("Switching Into Child User 1");
|
|
|
|
|
|
|
|
// appState.addUserSwitchPayload(requestBody);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await apiClient.post(
|
|
|
|
|
|
|
|
endpoint,
|
|
|
|
|
|
|
|
body: requestBody,
|
|
|
|
onFailure: (error, statusCode, {messageStatus, failureType}) {
|
|
|
|
onFailure: (error, statusCode, {messageStatus, failureType}) {
|
|
|
|
failure = failureType;
|
|
|
|
failure = failureType;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|