session management update

merge-requests/994/merge
Elham Rababh 4 years ago
parent e242aa19bc
commit c30d6bebd8

@ -40,11 +40,17 @@ class BaseAppClient {
try { try {
Map profile = await sharedPref.getObj(DOCTOR_PROFILE); Map profile = await sharedPref.getObj(DOCTOR_PROFILE);
String token = await sharedPref.getString(TOKEN); String token = await sharedPref.getString(TOKEN);
// String doctorID = await sharedPref.getString(DOCTOR_ID);
// if(doctorID != null)
// body['DoctorID'] = int.parse(doctorID);
if (profile != null) { if (profile != null) {
DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile);
if (body['DoctorID'] == null) if (body['DoctorID'] == null) {
body['DoctorID'] = doctorProfile?.doctorID; body['DoctorID'] = doctorProfile?.doctorID;
if (body['DoctorID'] == "") body['DoctorID'] = null;
}
if (body['DoctorID'] == "")
body['DoctorID'] = null;
if (body['EditedBy'] == null) if (body['EditedBy'] == null)
body['EditedBy'] = doctorProfile?.doctorID; body['EditedBy'] = doctorProfile?.doctorID;
if (body['ProjectID'] == null) { if (body['ProjectID'] == null) {
@ -63,7 +69,6 @@ class BaseAppClient {
if (body['TokenID'] == null) { if (body['TokenID'] == null) {
body['TokenID'] = token ?? ''; body['TokenID'] = token ?? '';
} }
// body['TokenID'] = "@dm!n" ?? '';
if (!isFallLanguage) { if (!isFallLanguage) {
String lang = await sharedPref.getString(APP_Language); String lang = await sharedPref.getString(APP_Language);
@ -73,7 +78,6 @@ class BaseAppClient {
body['LanguageID'] = 2; body['LanguageID'] = 2;
} }
body['stamp'] = DateTime.now().toIso8601String(); body['stamp'] = DateTime.now().toIso8601String();
// if(!body.containsKey("IPAdress"))
body['IPAdress'] = IP_ADDRESS; body['IPAdress'] = IP_ADDRESS;
if (body['VersionID'] == null) { if (body['VersionID'] == null) {
body['VersionID'] = VERSION_ID; body['VersionID'] = VERSION_ID;

@ -434,7 +434,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 = 6.7; const VERSION_ID = 8.3;
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;

@ -142,7 +142,6 @@ class AuthenticationService extends BaseService {
Future insertDeviceImei(InsertIMEIDetailsModel insertIMEIDetailsModel) async { Future insertDeviceImei(InsertIMEIDetailsModel insertIMEIDetailsModel) async {
hasError = false; hasError = false;
// insertIMEIDetailsModel.tokenID = "@dm!n";
_insertDeviceImeiRes = {}; _insertDeviceImeiRes = {};
try { try {
await baseAppClient.post(INSERT_DEVICE_IMEI, await baseAppClient.post(INSERT_DEVICE_IMEI,

@ -102,9 +102,9 @@ class AuthenticationViewModel extends BaseViewModel {
insertIMEIDetailsModel.titleDescriptionN = insertIMEIDetailsModel.titleDescriptionN =
profileInfo['Title_DescriptionN']; profileInfo['Title_DescriptionN'];
insertIMEIDetailsModel.projectID = await sharedPref.getInt(PROJECT_ID); insertIMEIDetailsModel.projectID = await sharedPref.getInt(PROJECT_ID);
insertIMEIDetailsModel.doctorID = loggedIn != null // insertIMEIDetailsModel.doctorID = loggedIn != null
? loggedIn['List_MemberInformation'][0]['MemberID'] // ? loggedIn['List_MemberInformation'][0]['MemberID']
: user.doctorID; // : user.doctorID;
insertIMEIDetailsModel.outSA = insertIMEIDetailsModel.outSA =
loggedIn != null ? loggedIn['PatientOutSA'] : user.outSA; loggedIn != null ? loggedIn['PatientOutSA'] : user.outSA;
insertIMEIDetailsModel.vidaAuthTokenID = insertIMEIDetailsModel.vidaAuthTokenID =
@ -174,6 +174,7 @@ class AuthenticationViewModel extends BaseViewModel {
loginDoctorID: loggedUser.listMemberInformation[0].employeeID, loginDoctorID: loggedUser.listMemberInformation[0].employeeID,
otpSendType: authMethodType.getTypeIdService().toString(), otpSendType: authMethodType.getTypeIdService().toString(),
); );
await sharedPref.setString(DOCTOR_ID, (loggedUser.listMemberInformation[0].employeeID).toString());
await _authService.sendActivationCodeForDoctorApp(activationCodeModel); await _authService.sendActivationCodeForDoctorApp(activationCodeModel);
if (_authService.hasError) { if (_authService.hasError) {
error = _authService.error; error = _authService.error;
@ -189,6 +190,7 @@ class AuthenticationViewModel extends BaseViewModel {
Future checkActivationCodeForDoctorApp( Future checkActivationCodeForDoctorApp(
{String activationCode, bool isSilentLogin = false}) async { {String activationCode, bool isSilentLogin = false}) async {
setState(ViewState.BusyLocal); setState(ViewState.BusyLocal);
CheckActivationCodeRequestModel checkActivationCodeForDoctorApp = CheckActivationCodeRequestModel checkActivationCodeForDoctorApp =
new CheckActivationCodeRequestModel( new CheckActivationCodeRequestModel(
zipCode: loggedUser != null ? loggedUser.zipCode : user.zipCode, zipCode: loggedUser != null ? loggedUser.zipCode : user.zipCode,
@ -208,9 +210,7 @@ class AuthenticationViewModel extends BaseViewModel {
: user.projectID.toString(), : user.projectID.toString(),
oTPSendType: await sharedPref.getInt(OTP_TYPE), oTPSendType: await sharedPref.getInt(OTP_TYPE),
iMEI: localToken, iMEI: localToken,
loginDoctorID: userInfo.userID != null loginDoctorID: loggedUser.listMemberInformation[0].employeeID,
? int.parse(userInfo.userID)
: user.editedBy,
// loggedUser.listMemberInformation[0].employeeID, // loggedUser.listMemberInformation[0].employeeID,
isForSilentLogin: isSilentLogin, isForSilentLogin: isSilentLogin,
generalid: "Cs2020@2016\$2958"); generalid: "Cs2020@2016\$2958");

@ -59,7 +59,8 @@ class DashboardViewModel extends BaseViewModel {
_firebaseMessaging.getToken().then((String token) async { _firebaseMessaging.getToken().then((String token) async {
if (token != '') { if (token != '') {
// DEVICE_TOKEN = token; // DEVICE_TOKEN = token;
authProvider.insertDeviceImei(token); ///TODO Elham* return back
// authProvider.insertDeviceImei(token);
} }
}); });
} }

Loading…
Cancel
Save