This repository was archived by the owner on Jul 25, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +20
-4
lines changed
app/src/main/java/com/zulip/android Expand file tree Collapse file tree 2 files changed +20
-4
lines changed Original file line number Diff line number Diff line change @@ -341,6 +341,19 @@ public SharedPreferences getSettings() {
341
341
public Person getYou () {
342
342
return you ;
343
343
}
344
+ public void saveServerName (String serverName ) {
345
+ String username =null ;
346
+ try {
347
+ username = you .getEmail ();
348
+ } catch (Exception e ) {
349
+ //SQL Exception can occur if name is not updated!
350
+ ZLog .logException (e );
351
+ }
352
+ Editor globalEditor = this .globalSettings .edit ();
353
+ serverStringSet .add ((username != null ) ? serverName + " - " + username : serverName );
354
+ globalEditor .putStringSet (GLOBAL_SETTINGS_REALMS , new HashSet <String >(serverStringSet ));
355
+ globalEditor .apply ();
356
+ }
344
357
public void createNewRealm () {
345
358
SharedPreferences .Editor editor = this .globalSettings .edit ();
346
359
currentRealm = serverStringSet .size ();
Original file line number Diff line number Diff line change @@ -51,10 +51,13 @@ protected void onPostExecute(String result) {
51
51
JSONObject obj = new JSONObject (result );
52
52
53
53
if (obj .getString ("result" ).equals ("success" )) {
54
- this .app .setLoggedInApiKey (obj .getString ("api_key" ));
55
- this .context .openHome ();
56
- callback .onTaskComplete (result , obj );
57
-
54
+ if (startedFromAddRealm ) {
55
+ } else {
56
+ this .app .setServerURL (serverURL );
57
+ this .app .setLoggedInApiKey (obj .getString ("api_key" ));
58
+ ZulipApp .get ().saveServerName (realmName );
59
+ this .context .openHome ();
60
+ }
58
61
return ;
59
62
}
60
63
} catch (JSONException e ) {
You can’t perform that action at this time.
0 commit comments