Commit 9065d45b authored by Leonardo Aramaki's avatar Leonardo Aramaki

Implement removing a selected roomId from a specific server

parent e893780a
...@@ -189,4 +189,15 @@ public class RocketChatCache { ...@@ -189,4 +189,15 @@ public class RocketChatCache {
getSharedPreferences().registerOnSharedPreferenceChangeListener(listener); getSharedPreferences().registerOnSharedPreferenceChangeListener(listener);
}, BackpressureStrategy.LATEST); }, BackpressureStrategy.LATEST);
} }
public void removeSelectedRoomId(String currentHostname) {
try {
JSONObject selectedRoomIdJsonObject = getSelectedRoomIdJsonObject();
selectedRoomIdJsonObject.remove(currentHostname);
setString(KEY_SELECTED_ROOM_ID, selectedRoomIdJsonObject.toString());
} catch (JSONException e) {
Logger.report(e);
RCLog.e(e);
}
}
} }
...@@ -279,6 +279,7 @@ public class MethodCallHelper { ...@@ -279,6 +279,7 @@ public class MethodCallHelper {
newHostname = serverList.get(0).getHostname(); newHostname = serverList.get(0).getHostname();
} }
rocketChatCache.removeHostname(currentHostname); rocketChatCache.removeHostname(currentHostname);
rocketChatCache.removeSelectedRoomId(currentHostname);
rocketChatCache.setSelectedServerHostname(newHostname); rocketChatCache.setSelectedServerHostname(newHostname);
return null; return null;
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment