summaryrefslogtreecommitdiff
path: root/app/src/main/java/se/leap/bitmaskclient/StartActivity.java
diff options
context:
space:
mode:
authorcyBerta <cyberta@riseup.net>2018-01-17 18:15:38 +0100
committercyBerta <cyberta@riseup.net>2018-01-17 18:16:08 +0100
commitac06bd8dc7045a1f61c47dda79622c3b4908a3c4 (patch)
treee1fe45583a77416392f45419d78dcf2105cd27af /app/src/main/java/se/leap/bitmaskclient/StartActivity.java
parent20582f79321627257d1b66b22af791e9e22817fd (diff)
#8811 set vpn option to top of navigation drawer, minor ux improvements
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);
+ }
+
}