11package com .zulip .android ;
22
33import java .sql .SQLException ;
4+ import java .util .ArrayList ;
5+ import java .util .HashSet ;
6+ import java .util .List ;
47import java .util .Map ;
58import java .util .Queue ;
9+ import java .util .Set ;
610import java .util .concurrent .ConcurrentHashMap ;
711import java .util .concurrent .ConcurrentLinkedQueue ;
812
@@ -57,6 +61,15 @@ public class ZulipApp extends Application {
5761 public static ZulipApp get () {
5862 return instance ;
5963 }
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 ;
6073
6174 @ Override
6275 public void onCreate () {
@@ -65,13 +78,11 @@ public void onCreate() {
6578
6679 // This used to be from HumbugActivity.getPreferences, so we keep that
6780 // file name.
68- this .settings = getSharedPreferences ("HumbugActivity" ,
69- Context .MODE_PRIVATE );
7081
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+
7586
7687 if (BuildHelper .shouldLogToCrashlytics ()) {
7788 Crashlytics .start (this );
0 commit comments