.
This commit is contained in:
@@ -30,6 +30,7 @@ public abstract class AppUtil {
|
||||
public static final String USER_DETAILS = "user_details";
|
||||
|
||||
public static final String USER_TOKEN = "user_token";
|
||||
public static final String PATIENT_UID = "patient_uid";
|
||||
|
||||
// util functions
|
||||
|
||||
@@ -124,16 +125,20 @@ public abstract class AppUtil {
|
||||
alertBuilder.create().show(); // Showing alert dialog
|
||||
}
|
||||
|
||||
public static void saveToken(String token, Context context){
|
||||
public static void saveUserCache(String token, int patient_uid, Context context){
|
||||
SharedPreferences sp = context.getSharedPreferences(USER_DETAILS, Context.MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = sp.edit();
|
||||
|
||||
editor.putString(USER_TOKEN, token);
|
||||
editor.putInt(PATIENT_UID, patient_uid);
|
||||
|
||||
editor.apply();
|
||||
|
||||
Log.d(TAG, "saveToken: user token saved successful");
|
||||
|
||||
// TODO: 17-07-2023 remove below line afterwards
|
||||
Log.d(TAG, "saveUserCache: " + token);
|
||||
|
||||
}
|
||||
|
||||
public static String getUserToken(Context context){
|
||||
@@ -141,4 +146,9 @@ public abstract class AppUtil {
|
||||
return sp.getString(USER_TOKEN, "");
|
||||
}
|
||||
|
||||
public static int getPatientUid(Context context){
|
||||
SharedPreferences sp = context.getSharedPreferences(USER_DETAILS, Context.MODE_PRIVATE);
|
||||
return sp.getInt(PATIENT_UID, -1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user