Commit e387dbcf authored by Yusuke Iwaki's avatar Yusuke Iwaki

fix "Authenticationg..." back press process.

parent ac6b09ce
...@@ -163,10 +163,10 @@ public class ServerConfigActivity extends AbstractFragmentActivity { ...@@ -163,10 +163,10 @@ public class ServerConfigActivity extends AbstractFragmentActivity {
} }
@Override protected void onBackPresseNotHandled() { @Override protected void onBackPresseNotHandled() {
if (ServerConfig.hasActiveConnection()) { if (ServerConfig.hasLoginRequiredConnection()) {
super.onBackPresseNotHandled();
} else {
moveTaskToBack(true); moveTaskToBack(true);
} else {
super.onBackPresseNotHandled();
} }
} }
} }
...@@ -30,9 +30,10 @@ public class ServerConfig extends RealmObject { ...@@ -30,9 +30,10 @@ public class ServerConfig extends RealmObject {
return realm.where(ServerConfig.class).isNotNull("token"); return realm.where(ServerConfig.class).isNotNull("token");
} }
public static boolean hasActiveConnection() { public static boolean hasLoginRequiredConnection() {
ServerConfig config = ServerConfig config =
RealmHelper.executeTransactionForRead(realm -> queryActiveConnections(realm).findFirst()); RealmHelper.executeTransactionForRead(realm ->
queryLoginRequiredConnections(realm).findFirst());
return config != null; return config != null;
} }
......
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