Skip to content
This repository was archived by the owner on Jul 25, 2024. It is now read-only.

Commit d106288

Browse files
committed
Save realm Position on logout so as to save the new realm to that position.
1 parent 1ed4fd2 commit d106288

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

app/src/main/java/com/zulip/android/ZulipActivity.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,9 @@ public void onClick(
566566
break;
567567
case R.id.logout:
568568
logout();
569+
SharedPreferences.Editor editor = app.settings.edit();
570+
editor.putInt("loggedOut", app.currentRealm);
571+
editor.apply();
569572
break;
570573
case R.id.legal:
571574
openLegal();

app/src/main/java/com/zulip/android/ZulipApp.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,13 @@ public void setLoggedInApiKeyAndEmail(String apiKey, String email) {
308308
}
309309
public void saveServer(String server, String name) {
310310
SharedPreferences.Editor globalEditor = this.globalSettings.edit();
311-
serverStringSet.add(name);
311+
int position = settings.getInt("loggedOut", -1);
312+
if (position != -1) {
313+
serverStringSet.remove(position);
314+
serverStringSet.add(position, name);
315+
} else {
316+
serverStringSet.add(name);
317+
}
312318
globalEditor.putStringSet(GLOBAL_SETTINGS_REALMS, new HashSet<String>(serverStringSet));
313319
globalEditor.apply();
314320

0 commit comments

Comments
 (0)