Commit 78a69c45 authored by Yusuke Iwaki's avatar Yusuke Iwaki

separate session-changed logic.

parent 2824b15b
...@@ -149,7 +149,11 @@ public class MainActivity extends AbstractAuthedActivity { ...@@ -149,7 +149,11 @@ public class MainActivity extends AbstractAuthedActivity {
.createObjectObserver(realm -> .createObjectObserver(realm ->
Session.queryDefaultSession(realm) Session.queryDefaultSession(realm)
.isNotNull(Session.TOKEN)) .isNotNull(Session.TOKEN))
.setOnUpdateListener(session -> { .setOnUpdateListener(this::onSessionChanged);
sessionObserver.sub();
}
private void onSessionChanged(@Nullable Session session) {
if (session == null) { if (session == null) {
if (isForeground) { if (isForeground) {
LaunchUtil.showLoginActivity(this, serverConfigId); LaunchUtil.showLoginActivity(this, serverConfigId);
...@@ -178,8 +182,6 @@ public class MainActivity extends AbstractAuthedActivity { ...@@ -178,8 +182,6 @@ public class MainActivity extends AbstractAuthedActivity {
} else { } else {
tipViewManager.updateStatus(StatusTicker.STATUS_DISMISS, null); tipViewManager.updateStatus(StatusTicker.STATUS_DISMISS, null);
} }
});
sessionObserver.sub();
} }
private void updateSidebarMainFragment() { private void updateSidebarMainFragment() {
......
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