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

Commit

Permalink
Save realm Position on logout so as to save the new realm to that pos…
Browse files Browse the repository at this point in the history
…ition.
  • Loading branch information
kunall17 committed Apr 18, 2016
1 parent 1ed4fd2 commit d106288
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions app/src/main/java/com/zulip/android/ZulipActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,9 @@ public void onClick(
break;
case R.id.logout:
logout();
SharedPreferences.Editor editor = app.settings.edit();
editor.putInt("loggedOut", app.currentRealm);
editor.apply();
break;
case R.id.legal:
openLegal();
Expand Down
8 changes: 7 additions & 1 deletion app/src/main/java/com/zulip/android/ZulipApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,13 @@ public void setLoggedInApiKeyAndEmail(String apiKey, String email) {
}
public void saveServer(String server, String name) {
SharedPreferences.Editor globalEditor = this.globalSettings.edit();
serverStringSet.add(name);
int position = settings.getInt("loggedOut", -1);
if (position != -1) {
serverStringSet.remove(position);
serverStringSet.add(position, name);
} else {
serverStringSet.add(name);
}
globalEditor.putStringSet(GLOBAL_SETTINGS_REALMS, new HashSet<String>(serverStringSet));
globalEditor.apply();

Expand Down

0 comments on commit d106288

Please sign in to comment.