Commit 2545749d authored by Yusuke Iwaki's avatar Yusuke Iwaki

showServerConfigActivity only if app is foreground.

parent 0580f1a6
......@@ -26,6 +26,7 @@ import hugo.weaving.DebugLog;
public class MainActivity extends AbstractAuthedActivity {
private RealmObjectObserver<Session> sessionObserver;
private boolean isForeground;
@Override
protected int getLayoutContainerForFragment() {
......@@ -50,6 +51,18 @@ public class MainActivity extends AbstractAuthedActivity {
setUserOnlineIfServerAvailable();
}
@Override
protected void onResume() {
super.onResume();
isForeground = true;
}
@Override
protected void onPause() {
isForeground = false;
super.onPause();
}
@Override
protected void onStop() {
setUserAwayIfServerAvailable();
......@@ -134,7 +147,7 @@ public class MainActivity extends AbstractAuthedActivity {
.equalTo("tokenVerified", true)
.isNull("error"))
.setOnUpdateListener(session -> {
if (session == null) {
if (session == null && isForeground) {
LaunchUtil.showServerConfigActivity(this, serverConfigId);
}
});
......
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