Skip to content
This repository was archived by the owner on Jul 25, 2024. It is now read-only.

Commit 72da75c

Browse files
committed
Added SharedPreferences to store the realms
This GlobalSettings will store all the info about the saved realms.
1 parent 0e5ebec commit 72da75c

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

app/src/main/java/com/zulip/android/ZulipApp.java

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,16 @@ public class ZulipApp extends Application {
6060
private Set<String> mutedTopics;
6161
private static final String MUTED_TOPIC_KEY = "mutedTopics";
6262

63+
private final static String GLOBAL_SETTINGS = "HumbugActivity";
64+
private final static String SERVER_SETTINGS = "serverSettings";
65+
private final static String GLOBAL_SETTINGS_CURRENT = "currentRealm";
66+
private static final String GLOBAL_SETTINGS_REALMS = "REALMS";
67+
68+
69+
public int currentRealm = 0;
70+
71+
public HashSet serverStringSet;
72+
private SharedPreferences globalSettings;
6373
/**
6474
* Handler to manage batching of unread messages
6575
*/
@@ -98,13 +108,10 @@ public void onCreate() {
98108

99109
// This used to be from HumbugActivity.getPreferences, so we keep that
100110
// file name.
101-
this.settings = getSharedPreferences("HumbugActivity",
102-
Context.MODE_PRIVATE);
111+
globalSettings = getSharedPreferences(GLOBAL_SETTINGS, Context.MODE_PRIVATE);
112+
currentRealm = globalSettings.getInt(GLOBAL_SETTINGS_CURRENT, currentRealm);
113+
serverStringSet = new HashSet<String>(globalSettings.getStringSet(GLOBAL_SETTINGS_REALMS, new HashSet<String>()));
103114

104-
max_message_id = settings.getInt("max_message_id", -1);
105-
eventQueueId = settings.getString("eventQueueId", null);
106-
lastEventId = settings.getInt("lastEventId", -1);
107-
pointer = settings.getInt("pointer", -1);
108115

109116

110117
this.api_key = settings.getString(API_KEY, null);

0 commit comments

Comments
 (0)