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() {
341341 public Person getYou () {
342342 return you ;
343343 }
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+ }
344357 public void createNewRealm () {
345358 SharedPreferences .Editor editor = this .globalSettings .edit ();
346359 currentRealm = serverStringSet .size ();
Original file line number Diff line number Diff line change @@ -51,10 +51,13 @@ protected void onPostExecute(String result) {
5151 JSONObject obj = new JSONObject (result );
5252
5353 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+ }
5861 return ;
5962 }
6063 } catch (JSONException e ) {
You can’t perform that action at this time.
0 commit comments