summaryrefslogtreecommitdiff
path: root/app/src/main/java/se
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java/se')
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/ConfigHelper.java10
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/Dashboard.java10
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/ProviderListBaseActivity.java (renamed from app/src/main/java/se/leap/bitmaskclient/BaseConfigurationWizard.java)9
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/StartActivity.java5
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java4
5 files changed, 20 insertions, 18 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/ConfigHelper.java b/app/src/main/java/se/leap/bitmaskclient/ConfigHelper.java
index f93fb36c..3713e198 100644
--- a/app/src/main/java/se/leap/bitmaskclient/ConfigHelper.java
+++ b/app/src/main/java/se/leap/bitmaskclient/ConfigHelper.java
@@ -285,12 +285,12 @@ public class ConfigHelper {
return getProviderName(null, provider);
}
- public static String getProviderName(SharedPreferences preferences) {
+ public static String getProviderName(@Nullable SharedPreferences preferences) {
return getProviderName(preferences,null);
}
- public static String getProviderName(SharedPreferences preferences, @Nullable String provider) {
- if (provider == null) {
+ public static String getProviderName(@Nullable SharedPreferences preferences, @Nullable String provider) {
+ if (provider == null && preferences != null) {
provider = preferences.getString(Provider.KEY, "");
}
try {
@@ -315,8 +315,8 @@ public class ConfigHelper {
return getProviderDomain(null, provider);
}
- public static String getProviderDomain(SharedPreferences preferences, @Nullable String provider) {
- if (provider == null) {
+ public static String getProviderDomain(@Nullable SharedPreferences preferences, @Nullable String provider) {
+ if (provider == null && preferences != null) {
provider = preferences.getString(Provider.KEY, "");
}
try {
diff --git a/app/src/main/java/se/leap/bitmaskclient/Dashboard.java b/app/src/main/java/se/leap/bitmaskclient/Dashboard.java
index 5ccb48b5..cb781009 100644
--- a/app/src/main/java/se/leap/bitmaskclient/Dashboard.java
+++ b/app/src/main/java/se/leap/bitmaskclient/Dashboard.java
@@ -232,7 +232,7 @@ public class Dashboard extends ButterKnifeActivity {
private void handleConfigureAlwaysOn(Intent intent) {
intent.removeExtra(APP_ACTION_CONFIGURE_ALWAYS_ON_PROFILE);
Log.d(TAG, "start Configuration wizard!");
- startActivityForResult(new Intent(this, ConfigurationWizard.class), REQUEST_CODE_CONFIGURE_LEAP);
+ startActivityForResult(new Intent(this, ProviderListActivity.class), REQUEST_CODE_CONFIGURE_LEAP);
}
private void prepareEIP(Bundle savedInstanceState) {
@@ -255,7 +255,7 @@ public class Dashboard extends ButterKnifeActivity {
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);
+ startActivityForResult(new Intent(this, ProviderListActivity.class), REQUEST_CODE_CONFIGURE_LEAP);
}
@SuppressLint("CommitPrefEdits")
private void providerToPreferences(Provider provider) {
@@ -273,7 +273,7 @@ public class Dashboard extends ButterKnifeActivity {
.setPositiveButton(getResources().getString(R.string.setup_error_configure_button), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
- startActivityForResult(new Intent(Dashboard.this, ConfigurationWizard.class), REQUEST_CODE_CONFIGURE_LEAP);
+ startActivityForResult(new Intent(Dashboard.this, ProviderListActivity.class), REQUEST_CODE_CONFIGURE_LEAP);
}
})
.setNegativeButton(getResources().getString(R.string.setup_error_close_button), new DialogInterface.OnClickListener() {
@@ -416,7 +416,7 @@ public class Dashboard extends ButterKnifeActivity {
clearDataOfLastProvider();
switching_provider = false;
- startActivityForResult(new Intent(this, ConfigurationWizard.class), REQUEST_CODE_SWITCH_PROVIDER);
+ startActivityForResult(new Intent(this, ProviderListActivity.class), REQUEST_CODE_SWITCH_PROVIDER);
}
private void clearDataOfLastProvider() {
@@ -441,7 +441,7 @@ public class Dashboard extends ButterKnifeActivity {
preferenceEditor.apply();
switching_provider = false;
- startActivityForResult(new Intent(this, ConfigurationWizard.class), REQUEST_CODE_SWITCH_PROVIDER);
+ startActivityForResult(new Intent(this, ProviderListActivity.class), REQUEST_CODE_SWITCH_PROVIDER);
}
private static class DashboardReceiver implements ProviderAPIResultReceiver.Receiver{
diff --git a/app/src/main/java/se/leap/bitmaskclient/BaseConfigurationWizard.java b/app/src/main/java/se/leap/bitmaskclient/ProviderListBaseActivity.java
index ec4bbaec..f60b5cc7 100644
--- a/app/src/main/java/se/leap/bitmaskclient/BaseConfigurationWizard.java
+++ b/app/src/main/java/se/leap/bitmaskclient/ProviderListBaseActivity.java
@@ -62,7 +62,7 @@ import static se.leap.bitmaskclient.ProviderAPI.RESULT_KEY;
/**
* abstract base Activity that builds and shows the list of known available providers.
- * The implementation of BaseConfigurationWizard differ in that they may or may not allow to bypass
+ * The implementation of ProviderListBaseActivity differ in that they may or may not allow to bypass
* secure download mechanisms including certificate validation.
* <p/>
* It also allows the user to enter custom providers with a button.
@@ -71,7 +71,7 @@ import static se.leap.bitmaskclient.ProviderAPI.RESULT_KEY;
* @author cyberta
*/
-public abstract class BaseConfigurationWizard extends ConfigWizardBaseActivity
+public abstract class ProviderListBaseActivity extends ConfigWizardBaseActivity
implements NewProviderDialog.NewProviderDialogInterface, DownloadFailedDialog.DownloadFailedDialogInterface, ProviderAPIResultReceiver.Receiver {
@InjectView(R.id.provider_list)
@@ -82,7 +82,7 @@ public abstract class BaseConfigurationWizard extends ConfigWizardBaseActivity
private ProviderManager providerManager;
protected Intent mConfigState = new Intent(PROVIDER_NOT_SET);
- final public static String TAG = ConfigurationWizard.class.getSimpleName();
+ final public static String TAG = ProviderListActivity.class.getSimpleName();
final private static String ACTIVITY_STATE = "ACTIVITY STATE";
@@ -461,6 +461,9 @@ public abstract class BaseConfigurationWizard extends ConfigWizardBaseActivity
case PROVIDER_NOK:
handleProviderSetupFailed(resultData);
break;
+ }
+ } else {
+ switch (resultCode) {
case CORRECTLY_DOWNLOADED_CERTIFICATE:
handleCorrectlyDownloadedCertificate();
break;
diff --git a/app/src/main/java/se/leap/bitmaskclient/StartActivity.java b/app/src/main/java/se/leap/bitmaskclient/StartActivity.java
index 61e65f2d..f5991538 100644
--- a/app/src/main/java/se/leap/bitmaskclient/StartActivity.java
+++ b/app/src/main/java/se/leap/bitmaskclient/StartActivity.java
@@ -17,7 +17,6 @@ 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.PROVIDER_CONFIGURED;
import static se.leap.bitmaskclient.Constants.REQUEST_CODE_CONFIGURE_LEAP;
import static se.leap.bitmaskclient.Constants.SHARED_PREFERENCES;
@@ -56,7 +55,7 @@ public class StartActivity extends Activity {
case FIRST:
storeAppVersion();
// TODO start ProfileCreation & replace below code
- // (new Intent(getActivity(), ConfigurationWizard.class), Constants.REQUEST_CODE_SWITCH_PROVIDER);
+ // (new Intent(getActivity(), ProviderListActivity.class), Constants.REQUEST_CODE_SWITCH_PROVIDER);
break;
case UPGRADE:
@@ -165,7 +164,7 @@ public class StartActivity extends Activity {
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);
+ startActivityForResult(new Intent(this, ProviderListActivity.class), REQUEST_CODE_CONFIGURE_LEAP);
}
@Override
diff --git a/app/src/main/java/se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java b/app/src/main/java/se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java
index aae1e1ea..ebfb3ba7 100644
--- a/app/src/main/java/se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java
+++ b/app/src/main/java/se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java
@@ -27,7 +27,7 @@ import android.widget.ListView;
import android.widget.Toast;
import se.leap.bitmaskclient.ConfigHelper;
-import se.leap.bitmaskclient.ConfigurationWizard;
+import se.leap.bitmaskclient.ProviderListActivity;
import se.leap.bitmaskclient.R;
import se.leap.bitmaskclient.VpnFragment;
import se.leap.bitmaskclient.fragments.AboutFragment;
@@ -304,7 +304,7 @@ public class NavigationDrawerFragment extends Fragment {
// TODO STOP VPN
// if (provider.hasEIP()) eip_fragment.stopEipIfPossible();
preferences.edit().clear().apply();
- startActivityForResult(new Intent(getActivity(), ConfigurationWizard.class), REQUEST_CODE_SWITCH_PROVIDER);
+ startActivityForResult(new Intent(getActivity(), ProviderListActivity.class), REQUEST_CODE_SWITCH_PROVIDER);
break;
case 1:
mTitle = getString(R.string.log_fragment_title);