summaryrefslogtreecommitdiff
path: root/app/src/main/java/se/leap/bitmaskclient/EipServiceFragment.java
diff options
context:
space:
mode:
authorParménides GV <parmegv@sdf.org>2014-08-18 17:23:14 +0200
committerParménides GV <parmegv@sdf.org>2014-08-18 17:23:14 +0200
commit6960629a4eb858ae3aac5585662c1ebe3b147fbe (patch)
tree1600ce04104ad53205cb77b030bdaf56f8528876 /app/src/main/java/se/leap/bitmaskclient/EipServiceFragment.java
parenta9f82c66b962b9157f5033e82a6642541280de6b (diff)
Login if anonymous eip is not available.
Diffstat (limited to 'app/src/main/java/se/leap/bitmaskclient/EipServiceFragment.java')
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/EipServiceFragment.java25
1 files changed, 19 insertions, 6 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/EipServiceFragment.java b/app/src/main/java/se/leap/bitmaskclient/EipServiceFragment.java
index 09f9dbdb..c8a28c0a 100644
--- a/app/src/main/java/se/leap/bitmaskclient/EipServiceFragment.java
+++ b/app/src/main/java/se/leap/bitmaskclient/EipServiceFragment.java
@@ -119,12 +119,6 @@ public class EipServiceFragment extends Fragment implements StateListener, OnChe
}
}
- private boolean canStartEIP() {
- boolean certificateExists = !Dashboard.preferences.getString(EIP.CERTIFICATE, "").isEmpty();
- boolean isAllowedAnon = Dashboard.preferences.getBoolean(EIP.ALLOWED_ANON, false);
- return (isAllowedAnon || certificateExists) && !EIP.mIsStarting && !EIP.isConnected();
- }
-
private void handleSwitch(boolean isChecked) {
if(isChecked)
handleSwitchOn();
@@ -137,6 +131,25 @@ public class EipServiceFragment extends Fragment implements StateListener, OnChe
private void handleSwitchOn() {
if(canStartEIP())
startEipFromScratch();
+ else if(canLogInToStartEIP()) {
+ Log.d(TAG, "Can Log In to start EIP");
+ Dashboard dashboard = (Dashboard) getActivity();
+ dashboard.logInDialog(Bundle.EMPTY);
+ }
+ }
+
+ private boolean canStartEIP() {
+ boolean certificateExists = !Dashboard.preferences.getString(EIP.CERTIFICATE, "").isEmpty();
+ boolean isAllowedAnon = Dashboard.preferences.getBoolean(EIP.ALLOWED_ANON, false);
+ return (isAllowedAnon || certificateExists) && !EIP.mIsStarting && !EIP.isConnected();
+ }
+
+ private boolean canLogInToStartEIP() {
+ boolean isAllowedRegistered = Dashboard.preferences.getBoolean(EIP.ALLOWED_REGISTERED, false);
+ boolean isLoggedIn = Dashboard.preferences.getBoolean(EIP.AUTHED_EIP, false);
+ Log.d(TAG, "Allow registered? " + isAllowedRegistered);
+ Log.d(TAG, "Is logged in? " + isLoggedIn);
+ return isAllowedRegistered && !isLoggedIn && !EIP.mIsStarting && !EIP.isConnected();
}
private void handleSwitchOff() {