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