From c30d6bebd86323c9b3eaa236611939373f2abdc1 Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Sun, 24 Apr 2022 13:50:35 +0300 Subject: [PATCH] session management update --- lib/client/base_app_client.dart | 12 ++++++++---- lib/config/config.dart | 2 +- lib/core/service/authentication_service.dart | 1 - lib/core/viewModel/authentication_view_model.dart | 12 ++++++------ lib/core/viewModel/dashboard_view_model.dart | 3 ++- 5 files changed, 17 insertions(+), 13 deletions(-) diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index 8cd2692e..4b5b5ccf 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -40,11 +40,17 @@ class BaseAppClient { try { Map profile = await sharedPref.getObj(DOCTOR_PROFILE); String token = await sharedPref.getString(TOKEN); + // String doctorID = await sharedPref.getString(DOCTOR_ID); + // if(doctorID != null) + // body['DoctorID'] = int.parse(doctorID); if (profile != null) { DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); - if (body['DoctorID'] == null) + if (body['DoctorID'] == null) { body['DoctorID'] = doctorProfile?.doctorID; - if (body['DoctorID'] == "") body['DoctorID'] = null; + + } + if (body['DoctorID'] == "") + body['DoctorID'] = null; if (body['EditedBy'] == null) body['EditedBy'] = doctorProfile?.doctorID; if (body['ProjectID'] == null) { @@ -63,7 +69,6 @@ class BaseAppClient { if (body['TokenID'] == null) { body['TokenID'] = token ?? ''; } - // body['TokenID'] = "@dm!n" ?? ''; if (!isFallLanguage) { String lang = await sharedPref.getString(APP_Language); @@ -73,7 +78,6 @@ class BaseAppClient { body['LanguageID'] = 2; } body['stamp'] = DateTime.now().toIso8601String(); - // if(!body.containsKey("IPAdress")) body['IPAdress'] = IP_ADDRESS; if (body['VersionID'] == null) { body['VersionID'] = VERSION_ID; diff --git a/lib/config/config.dart b/lib/config/config.dart index 12ec7ca7..7864a598 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -434,7 +434,7 @@ const TRANSACTION_NO = 0; const LANGUAGE_ID = 2; const STAMP = '2020-04-27T12:17:17.721Z'; const IP_ADDRESS = '9.9.9.9'; -const VERSION_ID = 6.7; +const VERSION_ID = 8.3; const CHANNEL = 9; const SESSION_ID = 'BlUSkYymTt'; const IS_LOGIN_FOR_DOCTOR_APP = true; diff --git a/lib/core/service/authentication_service.dart b/lib/core/service/authentication_service.dart index 4de0a7e4..6b5510a9 100644 --- a/lib/core/service/authentication_service.dart +++ b/lib/core/service/authentication_service.dart @@ -142,7 +142,6 @@ class AuthenticationService extends BaseService { Future insertDeviceImei(InsertIMEIDetailsModel insertIMEIDetailsModel) async { hasError = false; - // insertIMEIDetailsModel.tokenID = "@dm!n"; _insertDeviceImeiRes = {}; try { await baseAppClient.post(INSERT_DEVICE_IMEI, diff --git a/lib/core/viewModel/authentication_view_model.dart b/lib/core/viewModel/authentication_view_model.dart index 3dde37c7..af0c0cb3 100644 --- a/lib/core/viewModel/authentication_view_model.dart +++ b/lib/core/viewModel/authentication_view_model.dart @@ -102,9 +102,9 @@ class AuthenticationViewModel extends BaseViewModel { insertIMEIDetailsModel.titleDescriptionN = profileInfo['Title_DescriptionN']; insertIMEIDetailsModel.projectID = await sharedPref.getInt(PROJECT_ID); - insertIMEIDetailsModel.doctorID = loggedIn != null - ? loggedIn['List_MemberInformation'][0]['MemberID'] - : user.doctorID; + // insertIMEIDetailsModel.doctorID = loggedIn != null + // ? loggedIn['List_MemberInformation'][0]['MemberID'] + // : user.doctorID; insertIMEIDetailsModel.outSA = loggedIn != null ? loggedIn['PatientOutSA'] : user.outSA; insertIMEIDetailsModel.vidaAuthTokenID = @@ -174,6 +174,7 @@ class AuthenticationViewModel extends BaseViewModel { loginDoctorID: loggedUser.listMemberInformation[0].employeeID, otpSendType: authMethodType.getTypeIdService().toString(), ); + await sharedPref.setString(DOCTOR_ID, (loggedUser.listMemberInformation[0].employeeID).toString()); await _authService.sendActivationCodeForDoctorApp(activationCodeModel); if (_authService.hasError) { error = _authService.error; @@ -189,6 +190,7 @@ class AuthenticationViewModel extends BaseViewModel { Future checkActivationCodeForDoctorApp( {String activationCode, bool isSilentLogin = false}) async { setState(ViewState.BusyLocal); + CheckActivationCodeRequestModel checkActivationCodeForDoctorApp = new CheckActivationCodeRequestModel( zipCode: loggedUser != null ? loggedUser.zipCode : user.zipCode, @@ -208,9 +210,7 @@ class AuthenticationViewModel extends BaseViewModel { : user.projectID.toString(), oTPSendType: await sharedPref.getInt(OTP_TYPE), iMEI: localToken, - loginDoctorID: userInfo.userID != null - ? int.parse(userInfo.userID) - : user.editedBy, + loginDoctorID: loggedUser.listMemberInformation[0].employeeID, // loggedUser.listMemberInformation[0].employeeID, isForSilentLogin: isSilentLogin, generalid: "Cs2020@2016\$2958"); diff --git a/lib/core/viewModel/dashboard_view_model.dart b/lib/core/viewModel/dashboard_view_model.dart index 0343eaa4..82de3ca3 100644 --- a/lib/core/viewModel/dashboard_view_model.dart +++ b/lib/core/viewModel/dashboard_view_model.dart @@ -59,7 +59,8 @@ class DashboardViewModel extends BaseViewModel { _firebaseMessaging.getToken().then((String token) async { if (token != '') { // DEVICE_TOKEN = token; - authProvider.insertDeviceImei(token); + ///TODO Elham* return back + // authProvider.insertDeviceImei(token); } }); }