1
1
package com .zulip .android ;
2
2
3
3
import java .sql .SQLException ;
4
+ import java .util .ArrayList ;
5
+ import java .util .HashSet ;
6
+ import java .util .List ;
4
7
import java .util .Map ;
5
8
import java .util .Queue ;
9
+ import java .util .Set ;
6
10
import java .util .concurrent .ConcurrentHashMap ;
7
11
import java .util .concurrent .ConcurrentLinkedQueue ;
8
12
@@ -57,6 +61,15 @@ public class ZulipApp extends Application {
57
61
public static ZulipApp get () {
58
62
return instance ;
59
63
}
64
+ private final static String GLOBAL_SETTINGS = "HumbugActivity" ;
65
+ private final static String SERVER_SETTINGS = "serverSettings" ;
66
+ private final static String GLOBAL_SETTINGS_CURRENT = "currentRealm" ;
67
+ private static final String GLOBAL_SETTINGS_REALMS = "REALMS" ;
68
+
69
+ public int currentRealm = 0 ;
70
+
71
+ public List <String > serverStringSet ;
72
+ private SharedPreferences globalSettings ;
60
73
61
74
@ Override
62
75
public void onCreate () {
@@ -65,13 +78,11 @@ public void onCreate() {
65
78
66
79
// This used to be from HumbugActivity.getPreferences, so we keep that
67
80
// file name.
68
- this .settings = getSharedPreferences ("HumbugActivity" ,
69
- Context .MODE_PRIVATE );
70
81
71
- max_message_id = settings . getInt ( "max_message_id" , - 1 );
72
- eventQueueId = settings . getString ( "eventQueueId" , null );
73
- lastEventId = settings . getInt ( "lastEventId" , - 1 );
74
- pointer = settings . getInt ( "pointer" , - 1 );
82
+ globalSettings = getSharedPreferences ( GLOBAL_SETTINGS , Context . MODE_PRIVATE );
83
+ currentRealm = globalSettings . getInt ( GLOBAL_SETTINGS_CURRENT , currentRealm );
84
+ serverStringSet = new ArrayList < String >( globalSettings . getStringSet ( GLOBAL_SETTINGS_REALMS , new HashSet < String >()) );
85
+
75
86
76
87
if (BuildHelper .shouldLogToCrashlytics ()) {
77
88
Crashlytics .start (this );
0 commit comments