summaryrefslogtreecommitdiff
path: root/app/src/main/java/se/leap/bitmaskclient/StartActivity.java
diff options
context:
space:
mode:
authorFup Duck <fupduck@sacknagel.com>2018-01-21 18:01:26 +0100
committerFup Duck <fupduck@sacknagel.com>2018-01-21 18:01:26 +0100
commit6e45a5bcb4de152543b5dd5d9bd2027fb62f7375 (patch)
tree426b1e4ffe9578c106884ce6aef01d9dfa1ca56e /app/src/main/java/se/leap/bitmaskclient/StartActivity.java
parent3b6bc548f6197dfbd8a4e55524a3f6e0cdd224c0 (diff)
parentdf8b1fcf1ecc55f15229935294a337c897960ff4 (diff)
Merge remote-tracking branch '0xacab/0.9.8' into 8819_config_wizard_design
Diffstat (limited to 'app/src/main/java/se/leap/bitmaskclient/StartActivity.java')
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/StartActivity.java34
1 files changed, 31 insertions, 3 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/StartActivity.java b/app/src/main/java/se/leap/bitmaskclient/StartActivity.java
index 43d7f152..bb01ddc0 100644
--- a/app/src/main/java/se/leap/bitmaskclient/StartActivity.java
+++ b/app/src/main/java/se/leap/bitmaskclient/StartActivity.java
@@ -15,7 +15,9 @@ import java.lang.annotation.RetentionPolicy;
import de.blinkt.openvpn.core.VpnStatus;
import se.leap.bitmaskclient.userstatus.User;
+import static se.leap.bitmaskclient.Constants.APP_ACTION_CONFIGURE_ALWAYS_ON_PROFILE;
import static se.leap.bitmaskclient.Constants.PREFERENCES_APP_VERSION;
+import static se.leap.bitmaskclient.Constants.REQUEST_CODE_CONFIGURE_LEAP;
import static se.leap.bitmaskclient.Constants.SHARED_PREFERENCES;
/**
@@ -71,9 +73,8 @@ public class StartActivity extends Activity {
VpnStatus.initLogCache(getApplicationContext().getCacheDir());
User.init(getString(R.string.default_username));
- // go to Dashboard
- Intent intent = new Intent(this, MainActivity.class);
- startActivity(intent);
+ prepareEIP();
+
}
/**
@@ -141,4 +142,31 @@ public class StartActivity extends Activity {
preferences.edit().putInt(PREFERENCES_APP_VERSION, versionCode).apply();
}
+ private void prepareEIP() {
+ boolean provider_exists = ConfigHelper.providerInSharedPreferences(preferences);
+ if (provider_exists) {
+ Provider provider = ConfigHelper.getSavedProviderFromSharedPreferences(preferences);
+ if(!provider.isConfigured()) {
+ configureLeapProvider();
+ } else {
+ Log.d(TAG, "vpn provider is configured");
+
+ //buildDashboard(getIntent().getBooleanExtra(EIP_RESTART_ON_BOOT, false));
+// user_status_fragment.restoreSessionStatus(savedInstanceState);
+ Intent intent = new Intent(this, MainActivity.class);
+ intent.setAction(MainActivity.ACTION_SHOW_VPN_FRAGMENT);
+ startActivity(intent);
+ }
+ } else {
+ configureLeapProvider();
+ }
+ }
+
+ private void configureLeapProvider() {
+ if (getIntent().hasExtra(APP_ACTION_CONFIGURE_ALWAYS_ON_PROFILE)) {
+ getIntent().removeExtra(APP_ACTION_CONFIGURE_ALWAYS_ON_PROFILE);
+ }
+ startActivityForResult(new Intent(this, ConfigurationWizard.class), REQUEST_CODE_CONFIGURE_LEAP);
+ }
+
}