Pharmacy intervention null error fix, Update to stores VersionID 9.7

update_flutter_3.16.0
haroon amjad 6 months ago
parent ce7f633a85
commit f365181888

@ -46,9 +46,7 @@ class BaseAppClient {
if (body == null || body['DoctorID'] == null) { if (body == null || body['DoctorID'] == null) {
body!['DoctorID'] = doctorProfile.doctorID.toString(); body!['DoctorID'] = doctorProfile.doctorID.toString();
} }
if (body['DoctorID'] == "") if (body['DoctorID'] == "") body['DoctorID'] = doctorProfile.doctorID; // changed from null; because create update episode not working
body['DoctorID'] = doctorProfile
.doctorID; // changed from null; because create update episode not working
if (body['EditedBy'] == null) body['EditedBy'] = doctorProfile.doctorID.toString(); if (body['EditedBy'] == null) body['EditedBy'] = doctorProfile.doctorID.toString();
if (body['ProjectID'] == null) { if (body['ProjectID'] == null) {
body['ProjectID'] = doctorProfile.projectID.toString(); body['ProjectID'] = doctorProfile.projectID.toString();
@ -94,21 +92,16 @@ class BaseAppClient {
body['IsLoginForDoctorApp'] = IS_LOGIN_FOR_DOCTOR_APP.toString(); body['IsLoginForDoctorApp'] = IS_LOGIN_FOR_DOCTOR_APP.toString();
body['PatientOutSA'] = body['PatientOutSA'] ?? '0'; // PATIENT_OUT_SA; body['PatientOutSA'] = body['PatientOutSA'] ?? '0'; // PATIENT_OUT_SA;
if (body['VidaAuthTokenID'] == null) { if (body['VidaAuthTokenID'] == null) {
body['VidaAuthTokenID'] = body['VidaAuthTokenID'] = await sharedPref.getString(VIDA_AUTH_TOKEN_ID);
await sharedPref.getString(VIDA_AUTH_TOKEN_ID);
} }
if (body['VidaRefreshTokenID'] == null) { if (body['VidaRefreshTokenID'] == null) {
body['VidaRefreshTokenID'] = body['VidaRefreshTokenID'] = await sharedPref.getString(VIDA_REFRESH_TOKEN_ID);
await sharedPref.getString(VIDA_REFRESH_TOKEN_ID);
} }
int? projectID = await sharedPref.getInt(PROJECT_ID); int? projectID = await sharedPref.getInt(PROJECT_ID);
if (projectID == 2 || projectID == 3) if (projectID == 2 || projectID == 3)
body['PatientOutSA'] = true; body['PatientOutSA'] = true;
else if ((body.containsKey('facilityId') && body['facilityId'] == 2 || else if ((body.containsKey('facilityId') && body['facilityId'] == 2 || body['facilityId'] == 3) || body['ProjectID'] == 2 || body['ProjectID'] == 3)
body['facilityId'] == 3) ||
body['ProjectID'] == 2 ||
body['ProjectID'] == 3)
body['PatientOutSA'] = 'true'; body['PatientOutSA'] = 'true';
else else
body['PatientOutSA'] = 'false'; body['PatientOutSA'] = 'false';
@ -135,27 +128,15 @@ class BaseAppClient {
var asd = json.encode(body); var asd = json.encode(body);
var asd2; var asd2;
if (await Utils.checkConnection()) { if (await Utils.checkConnection()) {
final response = await http.post(Uri.parse(url), final response = await http.post(Uri.parse(url), body: json.encode(body), headers: {'Content-Type': 'application/json', 'Accept': 'application/json'});
body: json.encode(body),
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json'
});
final int statusCode = response.statusCode; final int statusCode = response.statusCode;
if (statusCode < 200 || statusCode >= 400) { if (statusCode < 200 || statusCode >= 400) {
onFailure(Utils.generateContactAdminMsg(), statusCode); onFailure(Utils.generateContactAdminMsg(), statusCode);
if (body['DoctorID'] != null) if (body['DoctorID'] != null) postFailureResponse(doctorId: body['DoctorID'], url: url, request: json.encode(body), response: response.body, exception: "$statusCode");
postFailureResponse(
doctorId: body['DoctorID'],
url: url,
request: json.encode(body),
response: response.body,
exception: "$statusCode");
} else { } else {
var parsed = json.decode(response.body.toString()); var parsed = json.decode(response.body.toString());
if (parsed['ErrorType'] == 4) { if (parsed['ErrorType'] == 4) {
helpers.navigateToUpdatePage(parsed['ErrorEndUserMessage'], helpers.navigateToUpdatePage(parsed['ErrorEndUserMessage'], parsed['AndroidLink'], parsed['IOSLink']);
parsed['AndroidLink'], parsed['IOSLink']);
} }
if (parsed['IsAuthenticated'] != null && !parsed['IsAuthenticated']) { if (parsed['IsAuthenticated'] != null && !parsed['IsAuthenticated']) {
@ -163,19 +144,11 @@ class BaseAppClient {
if (parsed['ErrorCode'] == '699') { if (parsed['ErrorCode'] == '699') {
onSuccess(parsed, statusCode); onSuccess(parsed, statusCode);
} else { } else {
if (body['DoctorID'] != null) if (body['DoctorID'] != null) postFailureResponse(doctorId: body['DoctorID'], url: url, request: json.encode(body), response: response.body, exception: getError(parsed));
postFailureResponse(
doctorId: body['DoctorID'],
url: url,
request: json.encode(body),
response: response.body,
exception: getError(parsed));
onFailure(getError(parsed), statusCode); onFailure(getError(parsed), statusCode);
} }
} else if (!isAllowAny) { } else if (!isAllowAny) {
await Provider.of<AuthenticationViewModel>(AppGlobal.CONTEX, await Provider.of<AuthenticationViewModel>(AppGlobal.CONTEX, listen: false).logout();
listen: false)
.logout();
//todo nofailure is placed here and but have to handle the response here as well //todo nofailure is placed here and but have to handle the response here as well
Utils.showErrorToast('Your session expired Please login again'); Utils.showErrorToast('Your session expired Please login again');
locator<NavigationService>().pushNamedAndRemoveUntil(ROOT); locator<NavigationService>().pushNamedAndRemoveUntil(ROOT);
@ -185,13 +158,7 @@ class BaseAppClient {
} }
} else if (parsed['MessageStatus'] == 1) { } else if (parsed['MessageStatus'] == 1) {
if (!parsed['IsAuthenticated']) { if (!parsed['IsAuthenticated']) {
if (body['DoctorID'] != null) if (body['DoctorID'] != null) postFailureResponse(doctorId: body['DoctorID'], url: url, request: json.encode(body), response: response.body, exception: getError(parsed));
postFailureResponse(
doctorId: body['DoctorID'],
url: url,
request: json.encode(body),
response: response.body,
exception: getError(parsed));
onFailure(getError(parsed), statusCode); onFailure(getError(parsed), statusCode);
} else } else
onSuccess(parsed, statusCode); onSuccess(parsed, statusCode);
@ -206,12 +173,7 @@ class BaseAppClient {
} }
} }
if (body['DoctorID'] != null) { if (body['DoctorID'] != null) {
postFailureResponse( postFailureResponse(doctorId: body['DoctorID'], url: url, request: json.encode(body), response: response.body, exception: getError(parsed));
doctorId: body['DoctorID'],
url: url,
request: json.encode(body),
response: response.body,
exception: getError(parsed));
} }
onFailure(getError(parsed), statusCode); onFailure(getError(parsed), statusCode);
} }
@ -234,10 +196,7 @@ class BaseAppClient {
String url = BASE_URL + endPoint; String url = BASE_URL + endPoint;
try { try {
Map<String, String> headers = { Map<String, String> headers = {'Content-Type': 'application/json', 'Accept': 'application/json'};
'Content-Type': 'application/json',
'Accept': 'application/json'
};
String? token = await sharedPref.getString(TOKEN); String? token = await sharedPref.getString(TOKEN);
Map<String, dynamic>? profile = await sharedPref.getObj(DOCTOR_PROFILE); Map<String, dynamic>? profile = await sharedPref.getObj(DOCTOR_PROFILE);
@ -251,8 +210,7 @@ class BaseAppClient {
if (body!['DoctorID'] == 0) { if (body!['DoctorID'] == 0) {
body['DoctorID'] = null; body['DoctorID'] = null;
} }
var languageID = var languageID = await sharedPref.getStringWithDefaultValue(APP_Language, 'en');
await sharedPref.getStringWithDefaultValue(APP_Language, 'en');
body['SetupID'] = body!.containsKey('SetupID') body['SetupID'] = body!.containsKey('SetupID')
? body['SetupID'] != null ? body['SetupID'] != null
? body['SetupID'] ? body['SetupID']
@ -272,8 +230,7 @@ class BaseAppClient {
: PATIENT_OUT_SA_PATIENT_REQ; : PATIENT_OUT_SA_PATIENT_REQ;
if (body.containsKey('isDentalAllowedBackend')) { if (body.containsKey('isDentalAllowedBackend')) {
body['isDentalAllowedBackend'] = body['isDentalAllowedBackend'] = body.containsKey('isDentalAllowedBackend')
body.containsKey('isDentalAllowedBackend')
? body['isDentalAllowedBackend'] != null ? body['isDentalAllowedBackend'] != null
? body['isDentalAllowedBackend'] ? body['isDentalAllowedBackend']
: IS_DENTAL_ALLOWED_BACKEND : IS_DENTAL_ALLOWED_BACKEND
@ -298,11 +255,8 @@ class BaseAppClient {
: PATIENT_TYPE_ID : PATIENT_TYPE_ID
: PATIENT_TYPE_ID; : PATIENT_TYPE_ID;
body['TokenID'] = body['TokenID'] = body.containsKey('TokenID') ? body['TokenID'] ?? token : token;
body.containsKey('TokenID') ? body['TokenID'] ?? token : token; body['PatientID'] = body['PatientID'] != null ? body['PatientID'] : patient!.patientId ?? patient.patientMRN;
body['PatientID'] = body['PatientID'] != null
? body['PatientID']
: patient!.patientId ?? patient.patientMRN;
body['PatientOutSA'] = 0; //user['OutSA']; //TODO change it body['PatientOutSA'] = 0; //user['OutSA']; //TODO change it
body['SessionID'] = SESSION_ID; //getSe body['SessionID'] = SESSION_ID; //getSe
@ -329,8 +283,7 @@ class BaseAppClient {
var asd = json.encode(body); var asd = json.encode(body);
var asd2; var asd2;
if (await Utils.checkConnection()) { if (await Utils.checkConnection()) {
final response = await http.post(Uri.parse(url.trim()), final response = await http.post(Uri.parse(url.trim()), body: json.encode(body), headers: headers);
body: json.encode(body), headers: headers);
final int statusCode = response.statusCode; final int statusCode = response.statusCode;
print("statusCode :$statusCode"); print("statusCode :$statusCode");
if (statusCode < 200 || statusCode >= 400 || json == null) { if (statusCode < 200 || statusCode >= 400 || json == null) {
@ -342,8 +295,7 @@ class BaseAppClient {
onSuccess(parsed, statusCode); onSuccess(parsed, statusCode);
} else { } else {
if (parsed['ErrorType'] == 4) { if (parsed['ErrorType'] == 4) {
helpers.navigateToUpdatePage(parsed['ErrorEndUserMessage'], helpers.navigateToUpdatePage(parsed['ErrorEndUserMessage'], parsed['AndroidLink'], parsed['IOSLink']);
parsed['AndroidLink'], parsed['IOSLink']);
} }
if (parsed['IsAuthenticated'] == null) { if (parsed['IsAuthenticated'] == null) {
if (parsed['isSMSSent'] == true) { if (parsed['isSMSSent'] == true) {
@ -356,46 +308,24 @@ class BaseAppClient {
if (parsed != null) { if (parsed != null) {
onSuccess(parsed, statusCode); onSuccess(parsed, statusCode);
} else { } else {
if (body['DoctorID'] != null) if (body['DoctorID'] != null) postFailureResponse(doctorId: body['DoctorID'], url: url, request: json.encode(body), response: response.body, exception: getError(parsed));
postFailureResponse(
doctorId: body['DoctorID'],
url: url,
request: json.encode(body),
response: response.body,
exception: getError(parsed));
onFailure(getError(parsed), statusCode); onFailure(getError(parsed), statusCode);
} }
} }
} else if (parsed['MessageStatus'] == 1 || } else if (parsed['MessageStatus'] == 1 || parsed['SMSLoginRequired'] == true) {
parsed['SMSLoginRequired'] == true) {
onSuccess(parsed, statusCode); onSuccess(parsed, statusCode);
} else if (parsed['MessageStatus'] == 2 && } else if (parsed['MessageStatus'] == 2 && parsed['IsAuthenticated']) {
parsed['IsAuthenticated']) {
if (parsed['SameClinicApptList'] != null) { if (parsed['SameClinicApptList'] != null) {
onSuccess(parsed, statusCode); onSuccess(parsed, statusCode);
} else { } else {
if (parsed['message'] == null && if (parsed['message'] == null && parsed['ErrorEndUserMessage'] == null) {
parsed['ErrorEndUserMessage'] == null) {
if (parsed['ErrorSearchMsg'] == null) { if (parsed['ErrorSearchMsg'] == null) {
if (body['DoctorID'] != null) if (body['DoctorID'] != null)
postFailureResponse( postFailureResponse(doctorId: body['DoctorID'], url: url, request: json.encode(body), response: response.body, exception: "Server Error found with no available message");
doctorId: body['DoctorID'],
url: url,
request: json.encode(body),
response: response.body,
exception:
"Server Error found with no available message");
onFailure("Server Error found with no available message", onFailure("Server Error found with no available message", statusCode);
statusCode);
} else { } else {
if (body['DoctorID'] != null) if (body['DoctorID'] != null) postFailureResponse(doctorId: body['DoctorID'], url: url, request: json.encode(body), response: response.body, exception: parsed['ErrorSearchMsg']);
postFailureResponse(
doctorId: body['DoctorID'],
url: url,
request: json.encode(body),
response: response.body,
exception: parsed['ErrorSearchMsg']);
onFailure(parsed['ErrorSearchMsg'], statusCode); onFailure(parsed['ErrorSearchMsg'], statusCode);
} }
} else { } else {
@ -405,14 +335,8 @@ class BaseAppClient {
url: url, url: url,
request: json.encode(body), request: json.encode(body),
response: response.body, response: response.body,
exception: parsed['message'] ?? exception: parsed['message'] ?? parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage']);
parsed['ErrorEndUserMessage'] ?? onFailure(parsed['message'] ?? parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], statusCode);
parsed['ErrorMessage']);
onFailure(
parsed['message'] ??
parsed['ErrorEndUserMessage'] ??
parsed['ErrorMessage'],
statusCode);
} }
} }
} else { } else {
@ -420,28 +344,14 @@ class BaseAppClient {
onSuccess(parsed, statusCode); onSuccess(parsed, statusCode);
} else { } else {
if (parsed['message'] != null) { if (parsed['message'] != null) {
if (body['DoctorID'] != null) if (body['DoctorID'] != null) postFailureResponse(doctorId: body['DoctorID'], url: url, request: json.encode(body), response: response.body, exception: parsed['message']);
postFailureResponse(
doctorId: body['DoctorID'],
url: url,
request: json.encode(body),
response: response.body,
exception: parsed['message']);
onFailure(parsed['message'] ?? parsed['message'], statusCode); onFailure(parsed['message'] ?? parsed['message'], statusCode);
} else { } else {
if (body['DoctorID'] != null) if (body['DoctorID'] != null)
postFailureResponse( postFailureResponse(doctorId: body['DoctorID'], url: url, request: json.encode(body), response: response.body, exception: parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage']);
doctorId: body['DoctorID'],
url: url,
request: json.encode(body),
response: response.body,
exception: parsed['ErrorEndUserMessage'] ??
parsed['ErrorMessage']);
onFailure( onFailure(parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], statusCode);
parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'],
statusCode);
} }
} }
} }
@ -462,14 +372,9 @@ class BaseAppClient {
if (parsed["ValidationErrors"] != null) { if (parsed["ValidationErrors"] != null) {
error = parsed["ValidationErrors"]["StatusMessage"].toString() + "\n"; error = parsed["ValidationErrors"]["StatusMessage"].toString() + "\n";
if (parsed["ValidationErrors"]["ValidationErrors"] != null && if (parsed["ValidationErrors"]["ValidationErrors"] != null && parsed["ValidationErrors"]["ValidationErrors"].length != 0) {
parsed["ValidationErrors"]["ValidationErrors"].length != 0) { for (var i = 0; i < parsed["ValidationErrors"]["ValidationErrors"].length; i++) {
for (var i = 0; error = error! + parsed["ValidationErrors"]["ValidationErrors"][i]["Messages"][0] + "\n";
i < parsed["ValidationErrors"]["ValidationErrors"].length;
i++) {
error = error! +
parsed["ValidationErrors"]["ValidationErrors"][i]["Messages"][0] +
"\n";
} }
} }
} }
@ -479,10 +384,7 @@ class BaseAppClient {
return error; return error;
} }
get( get({required String endPoint, required Function(dynamic response, int statusCode) onSuccess, required Function(String error, int statusCode) onFailure}) async {
{required String endPoint,
required Function(dynamic response, int statusCode) onSuccess,
required Function(String error, int statusCode) onFailure}) async {
String token = await sharedPref.getString(TOKEN); String token = await sharedPref.getString(TOKEN);
String url = DOCTOR_ROTATION + endPoint + '&token=' + token; String url = DOCTOR_ROTATION + endPoint + '&token=' + token;
print(url); print(url);

@ -413,7 +413,7 @@ const TRANSACTION_NO = 0;
const LANGUAGE_ID = 2; const LANGUAGE_ID = 2;
const STAMP = '2020-04-27T12:17:17.721Z'; const STAMP = '2020-04-27T12:17:17.721Z';
const IP_ADDRESS = '9.9.9.9'; const IP_ADDRESS = '9.9.9.9';
const VERSION_ID = 9.6; const VERSION_ID = 9.7;
const CHANNEL = 9; const CHANNEL = 9;
const SESSION_ID = 'BlUSkYymTt'; const SESSION_ID = 'BlUSkYymTt';
const IS_LOGIN_FOR_DOCTOR_APP = true; const IS_LOGIN_FOR_DOCTOR_APP = true;

@ -11,7 +11,7 @@ description: A new Flutter project.
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at # Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.4.22+33 version: 1.4.24+1
environment: environment:

Loading…
Cancel
Save