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