|
|
@ -33,48 +33,35 @@ enum APP_STATUS { LOADING, UNAUTHENTICATED, AUTHENTICATED }
|
|
|
|
AppSharedPreferences sharedPref = AppSharedPreferences();
|
|
|
|
AppSharedPreferences sharedPref = AppSharedPreferences();
|
|
|
|
AppGlobal appGlobal = AppGlobal();
|
|
|
|
AppGlobal appGlobal = AppGlobal();
|
|
|
|
|
|
|
|
|
|
|
|
const String INSERT_DEVICE_IMEI =
|
|
|
|
const String INSERT_DEVICE_IMEI = 'Services/Patients.svc/REST/Patient_INSERTDeviceIMEI';
|
|
|
|
'Services/Patients.svc/REST/Patient_INSERTDeviceIMEI';
|
|
|
|
const String SELECT_DEVICE_IMEI = 'Services/Patients.svc/REST/Patient_SELECTDeviceIMEIbyIMEI';
|
|
|
|
const String SELECT_DEVICE_IMEI =
|
|
|
|
const String CHECK_PATIENT_AUTH = 'Services/Authentication.svc/REST/CheckPatientAuthentication';
|
|
|
|
'Services/Patients.svc/REST/Patient_SELECTDeviceIMEIbyIMEI';
|
|
|
|
|
|
|
|
const String CHECK_PATIENT_AUTH =
|
|
|
|
|
|
|
|
'Services/Authentication.svc/REST/CheckPatientAuthentication';
|
|
|
|
|
|
|
|
const GET_MOBILE_INFO = 'Services/Authentication.svc/REST/GetMobileLoginInfo';
|
|
|
|
const GET_MOBILE_INFO = 'Services/Authentication.svc/REST/GetMobileLoginInfo';
|
|
|
|
const SEND_ACTIVATION_CODE =
|
|
|
|
const SEND_ACTIVATION_CODE = 'Services/Authentication.svc/REST/SendActivationCodebyOTPNotificationType';
|
|
|
|
'Services/Authentication.svc/REST/SendActivationCodebyOTPNotificationType';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const SEND_ACTIVATION_CODE_REGISTER =
|
|
|
|
const SEND_ACTIVATION_CODE_REGISTER = 'Services/Authentication.svc/REST/SendActivationCodebyOTPNotificationTypeForRegistration';
|
|
|
|
'Services/Authentication.svc/REST/SendActivationCodebyOTPNotificationTypeForRegistration';
|
|
|
|
const CHECK_ACTIVATION_CODE = 'Services/Authentication.svc/REST/CheckActivationCode';
|
|
|
|
const CHECK_ACTIVATION_CODE =
|
|
|
|
const CHECK_ACTIVATION_CODE_REGISTER = 'Services/Authentication.svc/REST/CheckActivationCodeForRegistration';
|
|
|
|
'Services/Authentication.svc/REST/CheckActivationCode';
|
|
|
|
|
|
|
|
const CHECK_ACTIVATION_CODE_REGISTER =
|
|
|
|
|
|
|
|
'Services/Authentication.svc/REST/CheckActivationCodeForRegistration';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const FORGOT_PASSWORD =
|
|
|
|
const FORGOT_PASSWORD = 'Services/Authentication.svc/REST/CheckActivationCodeForSendFileNo';
|
|
|
|
'Services/Authentication.svc/REST/CheckActivationCodeForSendFileNo';
|
|
|
|
const CHECK_PATIENT_FOR_REGISTRATION = "Services/Authentication.svc/REST/CheckPatientForRegisteration";
|
|
|
|
const CHECK_PATIENT_FOR_REGISTRATION =
|
|
|
|
|
|
|
|
"Services/Authentication.svc/REST/CheckPatientForRegisteration";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const CHECK_USER_STATUS = "Services/NHIC.svc/REST/GetPatientInfo";
|
|
|
|
const CHECK_USER_STATUS = "Services/NHIC.svc/REST/GetPatientInfo";
|
|
|
|
const REGISTER_USER = 'Services/Authentication.svc/REST/PatientRegistration';
|
|
|
|
const REGISTER_USER = 'Services/Authentication.svc/REST/PatientRegistration';
|
|
|
|
const LOGGED_IN_USER_URL =
|
|
|
|
const LOGGED_IN_USER_URL = 'Services/MobileNotifications.svc/REST/Insert_PatientMobileDeviceInfo';
|
|
|
|
'Services/MobileNotifications.svc/REST/Insert_PatientMobileDeviceInfo';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const FORGOT_PATIENT_ID =
|
|
|
|
const FORGOT_PATIENT_ID = 'Services/Authentication.svc/REST/SendPatientIDSMSByMobileNumber';
|
|
|
|
'Services/Authentication.svc/REST/SendPatientIDSMSByMobileNumber';
|
|
|
|
|
|
|
|
const DASHBOARD = 'Services/Patients.svc/REST/PatientDashboard';
|
|
|
|
const DASHBOARD = 'Services/Patients.svc/REST/PatientDashboard';
|
|
|
|
const PROFILE_SETTING = 'Services/Patients.svc/REST/GetPateintInfoForUpdate';
|
|
|
|
const PROFILE_SETTING = 'Services/Patients.svc/REST/GetPateintInfoForUpdate';
|
|
|
|
const SAVE_SETTING = 'Services/Patients.svc/REST/UpdatePateintInfo';
|
|
|
|
const SAVE_SETTING = 'Services/Patients.svc/REST/UpdatePateintInfo';
|
|
|
|
|
|
|
|
|
|
|
|
const DEACTIVATE_ACCOUNT =
|
|
|
|
const DEACTIVATE_ACCOUNT = 'Services/Patients.svc/REST/PatientAppleActivation_InsertUpdate';
|
|
|
|
'Services/Patients.svc/REST/PatientAppleActivation_InsertUpdate';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class AuthProvider with ChangeNotifier {
|
|
|
|
class AuthProvider with ChangeNotifier {
|
|
|
|
bool isLogin = false;
|
|
|
|
bool isLogin = false;
|
|
|
|
bool isLoading = true;
|
|
|
|
bool isLoading = true;
|
|
|
|
dynamic authenticatedUser;
|
|
|
|
dynamic authenticatedUser;
|
|
|
|
AuthenticatedUserObject authenticatedUserObject =
|
|
|
|
AuthenticatedUserObject authenticatedUserObject = locator<AuthenticatedUserObject>();
|
|
|
|
locator<AuthenticatedUserObject>();
|
|
|
|
|
|
|
|
var languageID;
|
|
|
|
var languageID;
|
|
|
|
|
|
|
|
|
|
|
|
AuthProvider() {
|
|
|
|
AuthProvider() {
|
|
|
@ -130,17 +117,14 @@ class AuthProvider with ChangeNotifier {
|
|
|
|
var lastLogin = lstLogin; //await sharedPref.getInt(
|
|
|
|
var lastLogin = lstLogin; //await sharedPref.getInt(
|
|
|
|
// LAST_LOGIN); //this.cs.sharedService.getStorage(AuthenticationService.LAST_LOGIN); //this.cs.sharedService.getSharedData(AuthenticationService.LAST_LOGIN, false);
|
|
|
|
// LAST_LOGIN); //this.cs.sharedService.getStorage(AuthenticationService.LAST_LOGIN); //this.cs.sharedService.getSharedData(AuthenticationService.LAST_LOGIN, false);
|
|
|
|
|
|
|
|
|
|
|
|
var request =
|
|
|
|
var request = AuthenticatedUser.fromJson(await sharedPref.getObject(USER_PROFILE));
|
|
|
|
AuthenticatedUser.fromJson(await sharedPref.getObject(USER_PROFILE));
|
|
|
|
|
|
|
|
var newRequest = INSERTDeviceIMEIRequest();
|
|
|
|
var newRequest = INSERTDeviceIMEIRequest();
|
|
|
|
|
|
|
|
|
|
|
|
var imei = await sharedPref.getString(PUSH_TOKEN);
|
|
|
|
var imei = await sharedPref.getString(PUSH_TOKEN);
|
|
|
|
// if (!request.) {
|
|
|
|
// if (!request.) {
|
|
|
|
newRequest.iMEI = imei; //imei!=null ? imei : '';
|
|
|
|
newRequest.iMEI = imei; //imei!=null ? imei : '';
|
|
|
|
newRequest.firstName =
|
|
|
|
newRequest.firstName = request.firstName ?? "" + " " + request.lastName! ?? "";
|
|
|
|
request.firstName ?? "" + " " + request.lastName! ?? "";
|
|
|
|
newRequest.firstNameN = request.firstNameN ?? "" + " " + request.lastNameN! ?? "";
|
|
|
|
newRequest.firstNameN =
|
|
|
|
|
|
|
|
request.firstNameN ?? "" + " " + request.lastNameN! ?? "";
|
|
|
|
|
|
|
|
newRequest.lastNameN = request.lastNameN ?? "";
|
|
|
|
newRequest.lastNameN = request.lastNameN ?? "";
|
|
|
|
newRequest.outSA = request.outSA == 1 ? true : false;
|
|
|
|
newRequest.outSA = request.outSA == 1 ? true : false;
|
|
|
|
newRequest.biometricEnabled = false;
|
|
|
|
newRequest.biometricEnabled = false;
|
|
|
@ -155,8 +139,7 @@ class AuthProvider with ChangeNotifier {
|
|
|
|
newRequest.tokenID = await sharedPref.getString(TOKEN);
|
|
|
|
newRequest.tokenID = await sharedPref.getString(TOKEN);
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
await new BaseAppClient().post(INSERT_DEVICE_IMEI,
|
|
|
|
await new BaseAppClient().post(INSERT_DEVICE_IMEI, onSuccess: (dynamic response, int statusCode) {
|
|
|
|
onSuccess: (dynamic response, int statusCode) {
|
|
|
|
|
|
|
|
localRes = response;
|
|
|
|
localRes = response;
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
throw error;
|
|
|
|
throw error;
|
|
|
@ -168,8 +151,8 @@ class AuthProvider with ChangeNotifier {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Future<SelectDeviceIMEIRES?> selectDeviceImei(imei,
|
|
|
|
Future<SelectDeviceIMEIRES?> selectDeviceImei(imei, {int languageID = 1}) async {
|
|
|
|
{int languageID = 1}) async {
|
|
|
|
SelectDeviceIMEIRES? selectDeviceIMEIRES;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
// SelectDeviceIMEIRES? localRes;
|
|
|
|
// SelectDeviceIMEIRES? localRes;
|
|
|
|
print(imei);
|
|
|
|
print(imei);
|
|
|
@ -177,21 +160,15 @@ class AuthProvider with ChangeNotifier {
|
|
|
|
request['IMEI'] = imei;
|
|
|
|
request['IMEI'] = imei;
|
|
|
|
request['LanguageID'] = languageID;
|
|
|
|
request['LanguageID'] = languageID;
|
|
|
|
|
|
|
|
|
|
|
|
await BaseAppClient().post(SELECT_DEVICE_IMEI,
|
|
|
|
await BaseAppClient().post(SELECT_DEVICE_IMEI, onSuccess: (dynamic response, int statusCode) async {
|
|
|
|
onSuccess: (dynamic response, int statusCode) async {
|
|
|
|
|
|
|
|
// localRes = Map();
|
|
|
|
// localRes = Map();
|
|
|
|
print(
|
|
|
|
print("Here response: ${response['Patient_SELECTDeviceIMEIbyIMEIList'][0]}");
|
|
|
|
"Here response: ${response['Patient_SELECTDeviceIMEIbyIMEIList'][0]}");
|
|
|
|
|
|
|
|
if (response['Patient_SELECTDeviceIMEIbyIMEIList'][0] != null) {
|
|
|
|
if (response['Patient_SELECTDeviceIMEIbyIMEIList'][0] != null) {
|
|
|
|
|
|
|
|
selectDeviceIMEIRES = SelectDeviceIMEIRES.fromJson(response['Patient_SELECTDeviceIMEIbyIMEIList'][0]);
|
|
|
|
sharedPref.setObject(
|
|
|
|
sharedPref.setObject(IMEI_USER_DATA, selectDeviceIMEIRES);
|
|
|
|
IMEI_USER_DATA,
|
|
|
|
|
|
|
|
SelectDeviceIMEIRES.fromJson(
|
|
|
|
|
|
|
|
response['Patient_SELECTDeviceIMEIbyIMEIList'][0]));
|
|
|
|
|
|
|
|
return SelectDeviceIMEIRES.fromJson(
|
|
|
|
|
|
|
|
response['Patient_SELECTDeviceIMEIbyIMEIList'][0]);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
print("ELSE TRIGERRED!!!!!!!!!");
|
|
|
|
print("ELSE TRIGERRED!!!!!!!!!");
|
|
|
|
|
|
|
|
selectDeviceIMEIRES = null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// await new BaseAppClient().post(SELECT_DEVICE_IMEI,
|
|
|
|
// await new BaseAppClient().post(SELECT_DEVICE_IMEI,
|
|
|
|
// onSuccess: (dynamic response, int statusCode) {
|
|
|
|
// onSuccess: (dynamic response, int statusCode) {
|
|
|
@ -207,21 +184,19 @@ class AuthProvider with ChangeNotifier {
|
|
|
|
print("in the error");
|
|
|
|
print("in the error");
|
|
|
|
// return Future.error(error);
|
|
|
|
// return Future.error(error);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return Future.value(selectDeviceIMEIRES);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Future<dynamic> checkPatientAuthentication(
|
|
|
|
Future<dynamic> checkPatientAuthentication(CheckPatientAuthenticationReq request) async {
|
|
|
|
CheckPatientAuthenticationReq request) async {
|
|
|
|
|
|
|
|
request.versionID = VERSION_ID;
|
|
|
|
request.versionID = VERSION_ID;
|
|
|
|
request.channel = CHANNEL;
|
|
|
|
request.channel = CHANNEL;
|
|
|
|
request.iPAdress = IP_ADDRESS;
|
|
|
|
request.iPAdress = IP_ADDRESS;
|
|
|
|
request.generalid = GENERAL_ID;
|
|
|
|
request.generalid = GENERAL_ID;
|
|
|
|
request.languageID = (languageID == 'ar' ? 1 : 2);
|
|
|
|
request.languageID = (languageID == 'ar' ? 1 : 2);
|
|
|
|
request.patientOutSA =
|
|
|
|
request.patientOutSA = (request.zipCode == '966' || request.zipCode == '+966') ? 0 : 1;
|
|
|
|
(request.zipCode == '966' || request.zipCode == '+966') ? 0 : 1;
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
dynamic localRes;
|
|
|
|
dynamic localRes;
|
|
|
|
await new BaseAppClient().post(CHECK_PATIENT_AUTH,
|
|
|
|
await new BaseAppClient().post(CHECK_PATIENT_AUTH, onSuccess: (dynamic response, int statusCode) {
|
|
|
|
onSuccess: (dynamic response, int statusCode) {
|
|
|
|
|
|
|
|
localRes = response;
|
|
|
|
localRes = response;
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
throw error;
|
|
|
|
throw error;
|
|
|
@ -245,8 +220,7 @@ class AuthProvider with ChangeNotifier {
|
|
|
|
// request.patientTypeID = request.patientType;
|
|
|
|
// request.patientTypeID = request.patientType;
|
|
|
|
// request.patientType = request.patientType;
|
|
|
|
// request.patientType = request.patientType;
|
|
|
|
dynamic localRes;
|
|
|
|
dynamic localRes;
|
|
|
|
await new BaseAppClient().post(GET_MOBILE_INFO,
|
|
|
|
await new BaseAppClient().post(GET_MOBILE_INFO, onSuccess: (dynamic response, int statusCode) {
|
|
|
|
onSuccess: (dynamic response, int statusCode) {
|
|
|
|
|
|
|
|
localRes = response;
|
|
|
|
localRes = response;
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
throw error;
|
|
|
|
throw error;
|
|
|
@ -266,8 +240,7 @@ class AuthProvider with ChangeNotifier {
|
|
|
|
request.isDentalAllowedBackend = false;
|
|
|
|
request.isDentalAllowedBackend = false;
|
|
|
|
|
|
|
|
|
|
|
|
dynamic localRes;
|
|
|
|
dynamic localRes;
|
|
|
|
await new BaseAppClient().post(SEND_ACTIVATION_CODE,
|
|
|
|
await new BaseAppClient().post(SEND_ACTIVATION_CODE, onSuccess: (dynamic response, int statusCode) {
|
|
|
|
onSuccess: (dynamic response, int statusCode) {
|
|
|
|
|
|
|
|
localRes = response;
|
|
|
|
localRes = response;
|
|
|
|
authenticatedUser = CheckActivationCode.fromJson(localRes);
|
|
|
|
authenticatedUser = CheckActivationCode.fromJson(localRes);
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
@ -287,8 +260,7 @@ class AuthProvider with ChangeNotifier {
|
|
|
|
request.isDentalAllowedBackend = false;
|
|
|
|
request.isDentalAllowedBackend = false;
|
|
|
|
|
|
|
|
|
|
|
|
dynamic localRes;
|
|
|
|
dynamic localRes;
|
|
|
|
await new BaseAppClient().post(SEND_ACTIVATION_CODE_REGISTER,
|
|
|
|
await new BaseAppClient().post(SEND_ACTIVATION_CODE_REGISTER, onSuccess: (dynamic response, int statusCode) {
|
|
|
|
onSuccess: (dynamic response, int statusCode) {
|
|
|
|
|
|
|
|
localRes = response;
|
|
|
|
localRes = response;
|
|
|
|
authenticatedUser = CheckActivationCode.fromJson(localRes);
|
|
|
|
authenticatedUser = CheckActivationCode.fromJson(localRes);
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
@ -311,13 +283,11 @@ class AuthProvider with ChangeNotifier {
|
|
|
|
neRequest.projectOutSA = neRequest.zipCode == '966' ? false : true;
|
|
|
|
neRequest.projectOutSA = neRequest.zipCode == '966' ? false : true;
|
|
|
|
neRequest.isDentalAllowedBackend = false;
|
|
|
|
neRequest.isDentalAllowedBackend = false;
|
|
|
|
// neRequest.deviceToken = null;
|
|
|
|
// neRequest.deviceToken = null;
|
|
|
|
neRequest.forRegisteration =
|
|
|
|
neRequest.forRegisteration = neRequest.isRegister != null ? neRequest.isRegister : false;
|
|
|
|
neRequest.isRegister != null ? neRequest.isRegister : false;
|
|
|
|
|
|
|
|
neRequest.isRegister = false;
|
|
|
|
neRequest.isRegister = false;
|
|
|
|
dynamic localRes;
|
|
|
|
dynamic localRes;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
await new BaseAppClient().post(CHECK_ACTIVATION_CODE,
|
|
|
|
await new BaseAppClient().post(CHECK_ACTIVATION_CODE, onSuccess: (dynamic response, int statusCode) {
|
|
|
|
onSuccess: (dynamic response, int statusCode) {
|
|
|
|
|
|
|
|
localRes = response; //CheckActivationCode.fromJson();
|
|
|
|
localRes = response; //CheckActivationCode.fromJson();
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
localRes = error;
|
|
|
|
localRes = error;
|
|
|
@ -345,13 +315,11 @@ class AuthProvider with ChangeNotifier {
|
|
|
|
neRequest.projectOutSA = neRequest.zipCode == '966' ? false : true;
|
|
|
|
neRequest.projectOutSA = neRequest.zipCode == '966' ? false : true;
|
|
|
|
neRequest.isDentalAllowedBackend = false;
|
|
|
|
neRequest.isDentalAllowedBackend = false;
|
|
|
|
// neRequest.deviceToken = null;
|
|
|
|
// neRequest.deviceToken = null;
|
|
|
|
neRequest.forRegisteration =
|
|
|
|
neRequest.forRegisteration = neRequest.isRegister != null ? neRequest.isRegister : false;
|
|
|
|
neRequest.isRegister != null ? neRequest.isRegister : false;
|
|
|
|
|
|
|
|
neRequest.isRegister = false;
|
|
|
|
neRequest.isRegister = false;
|
|
|
|
dynamic localRes;
|
|
|
|
dynamic localRes;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
await new BaseAppClient().post(CHECK_ACTIVATION_CODE_REGISTER,
|
|
|
|
await new BaseAppClient().post(CHECK_ACTIVATION_CODE_REGISTER, onSuccess: (dynamic response, int statusCode) {
|
|
|
|
onSuccess: (dynamic response, int statusCode) {
|
|
|
|
|
|
|
|
localRes = response; //CheckActivationCode.fromJson();
|
|
|
|
localRes = response; //CheckActivationCode.fromJson();
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
localRes = error;
|
|
|
|
localRes = error;
|
|
|
@ -371,8 +339,7 @@ class AuthProvider with ChangeNotifier {
|
|
|
|
return authenticatedUser;
|
|
|
|
return authenticatedUser;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Future<dynamic> checkPatientForRegisteration(
|
|
|
|
Future<dynamic> checkPatientForRegisteration(CheckPatientForRegistration request) async {
|
|
|
|
CheckPatientForRegistration request) async {
|
|
|
|
|
|
|
|
request.versionID = VERSION_ID;
|
|
|
|
request.versionID = VERSION_ID;
|
|
|
|
request.channel = CHANNEL;
|
|
|
|
request.channel = CHANNEL;
|
|
|
|
request.iPAdress = IP_ADDRESS;
|
|
|
|
request.iPAdress = IP_ADDRESS;
|
|
|
@ -383,8 +350,7 @@ class AuthProvider with ChangeNotifier {
|
|
|
|
// request.tokenID = '';
|
|
|
|
// request.tokenID = '';
|
|
|
|
dynamic localRes;
|
|
|
|
dynamic localRes;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
await new BaseAppClient().post(CHECK_PATIENT_FOR_REGISTRATION,
|
|
|
|
await new BaseAppClient().post(CHECK_PATIENT_FOR_REGISTRATION, onSuccess: (dynamic response, int statusCode) {
|
|
|
|
onSuccess: (dynamic response, int statusCode) {
|
|
|
|
|
|
|
|
localRes = response;
|
|
|
|
localRes = response;
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
localRes = error;
|
|
|
|
localRes = error;
|
|
|
@ -407,8 +373,7 @@ class AuthProvider with ChangeNotifier {
|
|
|
|
// request.tokenID = '';
|
|
|
|
// request.tokenID = '';
|
|
|
|
dynamic localRes;
|
|
|
|
dynamic localRes;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
await new BaseAppClient().post(CHECK_USER_STATUS,
|
|
|
|
await new BaseAppClient().post(CHECK_USER_STATUS, onSuccess: (dynamic response, int statusCode) {
|
|
|
|
onSuccess: (dynamic response, int statusCode) {
|
|
|
|
|
|
|
|
localRes = response;
|
|
|
|
localRes = response;
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
localRes = error;
|
|
|
|
localRes = error;
|
|
|
@ -434,9 +399,7 @@ class AuthProvider with ChangeNotifier {
|
|
|
|
final DateFormat dateFormat = DateFormat('MM/dd/yyyy');
|
|
|
|
final DateFormat dateFormat = DateFormat('MM/dd/yyyy');
|
|
|
|
final DateFormat dateFormat2 = DateFormat('dd/MM/yyyy');
|
|
|
|
final DateFormat dateFormat2 = DateFormat('dd/MM/yyyy');
|
|
|
|
if (nhic != null) {
|
|
|
|
if (nhic != null) {
|
|
|
|
requestN.dob = nhic['IsHijri']
|
|
|
|
requestN.dob = nhic['IsHijri'] ? nhic['DateOfBirth'] : dateFormat2.format(dateFormat.parse(nhic['DateOfBirth']));
|
|
|
|
? nhic['DateOfBirth']
|
|
|
|
|
|
|
|
: dateFormat2.format(dateFormat.parse(nhic['DateOfBirth']));
|
|
|
|
|
|
|
|
requestN.isHijri = nhic['IsHijri'] ? 1 : 0;
|
|
|
|
requestN.isHijri = nhic['IsHijri'] ? 1 : 0;
|
|
|
|
requestN.healthId = requestN.patientobject!.eHealthIDField!;
|
|
|
|
requestN.healthId = requestN.patientobject!.eHealthIDField!;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -447,8 +410,7 @@ class AuthProvider with ChangeNotifier {
|
|
|
|
|
|
|
|
|
|
|
|
dynamic localRes;
|
|
|
|
dynamic localRes;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
await new BaseAppClient().post(REGISTER_USER,
|
|
|
|
await new BaseAppClient().post(REGISTER_USER, onSuccess: (dynamic response, int statusCode) {
|
|
|
|
onSuccess: (dynamic response, int statusCode) {
|
|
|
|
|
|
|
|
localRes = response;
|
|
|
|
localRes = response;
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
localRes = error;
|
|
|
|
localRes = error;
|
|
|
@ -460,23 +422,17 @@ class AuthProvider with ChangeNotifier {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Future registeredAuthenticatedUser(
|
|
|
|
Future registeredAuthenticatedUser(AuthenticatedUser user, deviceToken, lat, long) async {
|
|
|
|
AuthenticatedUser user, deviceToken, lat, long) async {
|
|
|
|
|
|
|
|
var request = new RegisteredAuthenticatedUserRequest();
|
|
|
|
var request = new RegisteredAuthenticatedUserRequest();
|
|
|
|
request.deviceToken = deviceToken;
|
|
|
|
request.deviceToken = deviceToken;
|
|
|
|
request.voipToken =
|
|
|
|
request.voipToken = ""; //this.cs.sharedService.getSharedData(AuthenticationService.APNS_TOKEN, false);
|
|
|
|
""; //this.cs.sharedService.getSharedData(AuthenticationService.APNS_TOKEN, false);
|
|
|
|
|
|
|
|
request.deviceType = Platform.isIOS ? "1" : "2";
|
|
|
|
request.deviceType = Platform.isIOS ? "1" : "2";
|
|
|
|
request.patientMobileNumber = user.mobileNumber![0] == '0'
|
|
|
|
request.patientMobileNumber = user.mobileNumber![0] == '0' ? user.mobileNumber : '0' + user.mobileNumber!;
|
|
|
|
? user.mobileNumber
|
|
|
|
|
|
|
|
: '0' + user.mobileNumber!;
|
|
|
|
|
|
|
|
request.nationalID = user.patientIdentificationNo;
|
|
|
|
request.nationalID = user.patientIdentificationNo;
|
|
|
|
request.gender = user.gender;
|
|
|
|
request.gender = user.gender;
|
|
|
|
request.patientID = user.patientID;
|
|
|
|
request.patientID = user.patientID;
|
|
|
|
request.patientOutSA = user.outSA;
|
|
|
|
request.patientOutSA = user.outSA;
|
|
|
|
request.loginType = await sharedPref.getInt(LAST_LOGIN) != null
|
|
|
|
request.loginType = await sharedPref.getInt(LAST_LOGIN) != null ? await sharedPref.getInt(LAST_LOGIN) : 1;
|
|
|
|
? await sharedPref.getInt(LAST_LOGIN)
|
|
|
|
|
|
|
|
: 1;
|
|
|
|
|
|
|
|
request.mACAddress = '00:00:00:00:00:00';
|
|
|
|
request.mACAddress = '00:00:00:00:00:00';
|
|
|
|
request.latitude = lat;
|
|
|
|
request.latitude = lat;
|
|
|
|
request.longitude = long;
|
|
|
|
request.longitude = long;
|
|
|
@ -485,8 +441,7 @@ class AuthProvider with ChangeNotifier {
|
|
|
|
request.patientType = user.patientType;
|
|
|
|
request.patientType = user.patientType;
|
|
|
|
dynamic localRes;
|
|
|
|
dynamic localRes;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
await new BaseAppClient().post(LOGGED_IN_USER_URL,
|
|
|
|
await new BaseAppClient().post(LOGGED_IN_USER_URL, onSuccess: (dynamic response, int statusCode) {
|
|
|
|
onSuccess: (dynamic response, int statusCode) {
|
|
|
|
|
|
|
|
localRes = response;
|
|
|
|
localRes = response;
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
localRes = error;
|
|
|
|
localRes = error;
|
|
|
@ -512,8 +467,7 @@ class AuthProvider with ChangeNotifier {
|
|
|
|
|
|
|
|
|
|
|
|
dynamic localRes;
|
|
|
|
dynamic localRes;
|
|
|
|
|
|
|
|
|
|
|
|
await new BaseAppClient().post(FORGOT_PATIENT_ID,
|
|
|
|
await new BaseAppClient().post(FORGOT_PATIENT_ID, onSuccess: (response, statusCode) async {
|
|
|
|
onSuccess: (response, statusCode) async {
|
|
|
|
|
|
|
|
localRes = response;
|
|
|
|
localRes = response;
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
throw error;
|
|
|
|
throw error;
|
|
|
@ -531,8 +485,7 @@ class AuthProvider with ChangeNotifier {
|
|
|
|
|
|
|
|
|
|
|
|
dynamic localRes;
|
|
|
|
dynamic localRes;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
await new BaseAppClient().post(FORGOT_PASSWORD,
|
|
|
|
await new BaseAppClient().post(FORGOT_PASSWORD, onSuccess: (dynamic response, int statusCode) {
|
|
|
|
onSuccess: (dynamic response, int statusCode) {
|
|
|
|
|
|
|
|
localRes = response; //CheckActivationCode.fromJson();
|
|
|
|
localRes = response; //CheckActivationCode.fromJson();
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
localRes = error;
|
|
|
|
localRes = error;
|
|
|
@ -551,8 +504,7 @@ class AuthProvider with ChangeNotifier {
|
|
|
|
|
|
|
|
|
|
|
|
dynamic localRes;
|
|
|
|
dynamic localRes;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
await new BaseAppClient().post(DASHBOARD,
|
|
|
|
await new BaseAppClient().post(DASHBOARD, onSuccess: (dynamic response, int statusCode) {
|
|
|
|
onSuccess: (dynamic response, int statusCode) {
|
|
|
|
|
|
|
|
localRes = response; //CheckActivationCode.fromJson();
|
|
|
|
localRes = response; //CheckActivationCode.fromJson();
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
localRes = error;
|
|
|
|
localRes = error;
|
|
|
@ -569,8 +521,7 @@ class AuthProvider with ChangeNotifier {
|
|
|
|
getSettings() async {
|
|
|
|
getSettings() async {
|
|
|
|
dynamic localRes;
|
|
|
|
dynamic localRes;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
await new BaseAppClient().post(PROFILE_SETTING,
|
|
|
|
await new BaseAppClient().post(PROFILE_SETTING, onSuccess: (dynamic response, int statusCode) {
|
|
|
|
onSuccess: (dynamic response, int statusCode) {
|
|
|
|
|
|
|
|
localRes = response;
|
|
|
|
localRes = response;
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
localRes = error;
|
|
|
|
localRes = error;
|
|
|
@ -585,8 +536,7 @@ class AuthProvider with ChangeNotifier {
|
|
|
|
Future saveSettings(request) async {
|
|
|
|
Future saveSettings(request) async {
|
|
|
|
dynamic localRes;
|
|
|
|
dynamic localRes;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
await new BaseAppClient().post(SAVE_SETTING,
|
|
|
|
await new BaseAppClient().post(SAVE_SETTING, onSuccess: (dynamic response, int statusCode) {
|
|
|
|
onSuccess: (dynamic response, int statusCode) {
|
|
|
|
|
|
|
|
localRes = response;
|
|
|
|
localRes = response;
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
localRes = error;
|
|
|
|
localRes = error;
|
|
|
@ -601,8 +551,7 @@ class AuthProvider with ChangeNotifier {
|
|
|
|
Future deactivateAccount(request, bool isLogin) async {
|
|
|
|
Future deactivateAccount(request, bool isLogin) async {
|
|
|
|
dynamic localRes;
|
|
|
|
dynamic localRes;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
await new BaseAppClient().post(DEACTIVATE_ACCOUNT,
|
|
|
|
await new BaseAppClient().post(DEACTIVATE_ACCOUNT, onSuccess: (dynamic response, int statusCode) {
|
|
|
|
onSuccess: (dynamic response, int statusCode) {
|
|
|
|
|
|
|
|
localRes = response;
|
|
|
|
localRes = response;
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
localRes = error;
|
|
|
|
localRes = error;
|
|
|
@ -618,8 +567,7 @@ class AuthProvider with ChangeNotifier {
|
|
|
|
Future activateAccount(request) async {
|
|
|
|
Future activateAccount(request) async {
|
|
|
|
dynamic localRes;
|
|
|
|
dynamic localRes;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
await new BaseAppClient().post(DEACTIVATE_ACCOUNT,
|
|
|
|
await new BaseAppClient().post(DEACTIVATE_ACCOUNT, onSuccess: (dynamic response, int statusCode) {
|
|
|
|
onSuccess: (dynamic response, int statusCode) {
|
|
|
|
|
|
|
|
localRes = response;
|
|
|
|
localRes = response;
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
localRes = error;
|
|
|
|
localRes = error;
|
|
|
@ -636,10 +584,8 @@ class AuthProvider with ChangeNotifier {
|
|
|
|
await sharedPref.remove(LOGIN_TOKEN_ID);
|
|
|
|
await sharedPref.remove(LOGIN_TOKEN_ID);
|
|
|
|
await sharedPref.remove(PHARMACY_CUSTOMER_ID);
|
|
|
|
await sharedPref.remove(PHARMACY_CUSTOMER_ID);
|
|
|
|
await authenticatedUserObject.getUser();
|
|
|
|
await authenticatedUserObject.getUser();
|
|
|
|
Provider.of<ProjectViewModel>(AppGlobal.context, listen: false).isLogin =
|
|
|
|
Provider.of<ProjectViewModel>(AppGlobal.context, listen: false).isLogin = false;
|
|
|
|
false;
|
|
|
|
var model = Provider.of<ToDoCountProviderModel>(AppGlobal.context, listen: false);
|
|
|
|
var model =
|
|
|
|
|
|
|
|
Provider.of<ToDoCountProviderModel>(AppGlobal.context, listen: false);
|
|
|
|
|
|
|
|
model.setState(0, 0, false, null);
|
|
|
|
model.setState(0, 0, false, null);
|
|
|
|
Navigator.of(AppGlobal.context).pushReplacementNamed(HOME);
|
|
|
|
Navigator.of(AppGlobal.context).pushReplacementNamed(HOME);
|
|
|
|
}
|
|
|
|
}
|
|
|
|