Commit b3b7629c authored by Nguyen Cong's avatar Nguyen Cong

move keepAliveServer back to onResume(), release subscription

parent 117d7489
...@@ -36,7 +36,6 @@ abstract class AbstractAuthedActivity extends AbstractFragmentActivity { ...@@ -36,7 +36,6 @@ abstract class AbstractAuthedActivity extends AbstractFragmentActivity {
if (savedInstanceState == null) { if (savedInstanceState == null) {
handleIntent(getIntent()); handleIntent(getIntent());
} }
ConnectivityManager.getInstance(getApplicationContext()).keepAliveServer();
updateHostnameIfNeeded(rocketChatCache.getSelectedServerHostname()); updateHostnameIfNeeded(rocketChatCache.getSelectedServerHostname());
updateRoomIdIfNeeded(rocketChatCache.getSelectedRoomId()); updateRoomIdIfNeeded(rocketChatCache.getSelectedRoomId());
...@@ -154,6 +153,8 @@ abstract class AbstractAuthedActivity extends AbstractFragmentActivity { ...@@ -154,6 +153,8 @@ abstract class AbstractAuthedActivity extends AbstractFragmentActivity {
super.onResume(); super.onResume();
subscribeToConfigChanges(); subscribeToConfigChanges();
ConnectivityManager.getInstance(getApplicationContext()).keepAliveServer();
} }
@Override @Override
......
...@@ -49,10 +49,18 @@ public class MainActivity extends AbstractAuthedActivity implements MainContract ...@@ -49,10 +49,18 @@ public class MainActivity extends AbstractAuthedActivity implements MainContract
setupSidebar(); setupSidebar();
} }
@Override
protected void onResume() {
super.onResume();
if (presenter != null && presenter instanceof MainPresenter) {
((MainPresenter)presenter).bindViewOnly(this);
}
}
@Override @Override
protected void onPause() { protected void onPause() {
if (presenter != null) { if (presenter != null) {
// presenter.release(); presenter.release();
} }
super.onPause(); super.onPause();
......
...@@ -44,6 +44,13 @@ public class MainPresenter extends BasePresenter<MainContract.View> ...@@ -44,6 +44,13 @@ public class MainPresenter extends BasePresenter<MainContract.View>
this.rocketChatCache = rocketChatCache; this.rocketChatCache = rocketChatCache;
} }
public void bindViewOnly(@NonNull MainContract.View view) {
super.bindView(view);
subscribeToUnreadCount();
subscribeToSession();
setUserOnline();
}
@Override @Override
public void bindView(@NonNull MainContract.View view) { public void bindView(@NonNull MainContract.View view) {
super.bindView(view); super.bindView(view);
......
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