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