|
1 | 1 | package com.zulip.android;
|
2 | 2 |
|
3 | 3 | import java.sql.SQLException;
|
| 4 | +import java.util.ArrayList; |
| 5 | +import java.util.List; |
4 | 6 | import java.util.Map;
|
5 | 7 | import java.util.Queue;
|
6 | 8 | import java.util.HashSet;
|
@@ -46,6 +48,16 @@ public class ZulipApp extends Application {
|
46 | 48 | Set<String> mutedTopics;
|
47 | 49 | private static final String MUTED_TOPIC_KEY = "mutedTopics";
|
48 | 50 |
|
| 51 | + private final static String GLOBAL_SETTINGS = "HumbugActivity"; |
| 52 | + private final static String SERVER_SETTINGS = "serverSettings"; |
| 53 | + private final static String GLOBAL_SETTINGS_CURRENT = "currentRealm"; |
| 54 | + private static final String GLOBAL_SETTINGS_REALMS = "REALMS"; |
| 55 | + |
| 56 | + |
| 57 | + public int currentRealm = 0; |
| 58 | + |
| 59 | + public List<String> serverStringSet; |
| 60 | + private SharedPreferences globalSettings; |
49 | 61 | /**
|
50 | 62 | * Handler to manage batching of unread messages
|
51 | 63 | */
|
@@ -83,13 +95,10 @@ public void onCreate() {
|
83 | 95 |
|
84 | 96 | // This used to be from HumbugActivity.getPreferences, so we keep that
|
85 | 97 | // file name.
|
86 |
| - this.settings = getSharedPreferences("HumbugActivity", |
87 |
| - Context.MODE_PRIVATE); |
| 98 | + globalSettings = getSharedPreferences(GLOBAL_SETTINGS, Context.MODE_PRIVATE); |
| 99 | + currentRealm = globalSettings.getInt(GLOBAL_SETTINGS_CURRENT, currentRealm); |
| 100 | + serverStringSet = new ArrayList<String>(globalSettings.getStringSet(GLOBAL_SETTINGS_REALMS, new HashSet<String>())); |
88 | 101 |
|
89 |
| - max_message_id = settings.getInt("max_message_id", -1); |
90 |
| - eventQueueId = settings.getString("eventQueueId", null); |
91 |
| - lastEventId = settings.getInt("lastEventId", -1); |
92 |
| - pointer = settings.getInt("pointer", -1); |
93 | 102 |
|
94 | 103 | if (BuildHelper.shouldLogToCrashlytics()) {
|
95 | 104 | Crashlytics.start(this);
|
|
0 commit comments