Commit fcce8693 authored by Leonardo Aramaki's avatar Leonardo Aramaki

Properly handling app resume cases when either the hostname or the MainPresenter is null

parent 6d3b0f34
......@@ -66,7 +66,14 @@ public class MainActivity extends AbstractAuthedActivity implements MainContract
@Override
protected void onResume() {
super.onResume();
if (presenter != null) {
if (hostname == null || presenter == null) {
hostname = new RocketChatCache(getApplicationContext()).getSelectedServerHostname();
if (hostname == null) {
showAddServerScreen();
} else {
onHostnameUpdated();
}
} else {
presenter.bindViewOnly(this);
presenter.loadSignedInServers(hostname);
}
......
......@@ -52,7 +52,7 @@ public class MethodCallHelper {
*/
public MethodCallHelper(Context context, String hostname) {
this.context = context.getApplicationContext();
this.realmHelper = RealmStore.get(hostname);
this.realmHelper = RealmStore.getOrCreate(hostname);
ddpClientRef = 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