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