diff options
Diffstat (limited to 'app')
15 files changed, 34 insertions, 32 deletions
diff --git a/app/build.gradle b/app/build.gradle index b28d9f35..bf3f53a7 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -5,7 +5,7 @@ apply plugin: 'com.android.application' android { compileSdkVersion 26 - buildToolsVersion '26.0.0' + buildToolsVersion '26.0.2' defaultConfig { applicationId "se.leap.bitmaskclient" diff --git a/app/src/androidTest/java/se/leap/bitmaskclient/test/BaseTestDashboardFragment.java b/app/src/androidTest/java/se/leap/bitmaskclient/test/BaseTestDashboardFragment.java index 956049dc..e187d424 100644 --- a/app/src/androidTest/java/se/leap/bitmaskclient/test/BaseTestDashboardFragment.java +++ b/app/src/androidTest/java/se/leap/bitmaskclient/test/BaseTestDashboardFragment.java @@ -7,7 +7,7 @@ import android.view.View; import com.robotium.solo.Solo; -import se.leap.bitmaskclient.ConfigurationWizard; +import se.leap.bitmaskclient.ProviderListActivity; import se.leap.bitmaskclient.Dashboard; import se.leap.bitmaskclient.R; @@ -43,7 +43,7 @@ public abstract class BaseTestDashboardFragment extends ActivityInstrumentationT void tapSwitchProvider() { solo.clickOnMenuItem(solo.getString(R.string.switch_provider_menu_option)); - solo.waitForActivity(ConfigurationWizard.class); + solo.waitForActivity(ProviderListActivity.class); } private void useRegistered() { diff --git a/app/src/androidTest/java/se/leap/bitmaskclient/test/TestConfigurationWizard.java b/app/src/androidTest/java/se/leap/bitmaskclient/test/TestProviderListActivity.java index c0d3aab1..4ab705e7 100644 --- a/app/src/androidTest/java/se/leap/bitmaskclient/test/TestConfigurationWizard.java +++ b/app/src/androidTest/java/se/leap/bitmaskclient/test/TestProviderListActivity.java @@ -7,15 +7,15 @@ import com.robotium.solo.Solo; import java.io.IOException; -import se.leap.bitmaskclient.ConfigurationWizard; +import se.leap.bitmaskclient.ProviderListActivity; import se.leap.bitmaskclient.R; -public class TestConfigurationWizard extends ActivityInstrumentationTestCase2<ConfigurationWizard> { +public class TestProviderListActivity extends ActivityInstrumentationTestCase2<ProviderListActivity> { private Solo solo; - public TestConfigurationWizard() { - super(ConfigurationWizard.class); + public TestProviderListActivity() { + super(ProviderListActivity.class); } diff --git a/app/src/insecure/java/se/leap/bitmaskclient/ConfigurationWizard.java b/app/src/insecure/java/se/leap/bitmaskclient/ProviderListActivity.java index b5ce824f..034c9752 100644 --- a/app/src/insecure/java/se/leap/bitmaskclient/ConfigurationWizard.java +++ b/app/src/insecure/java/se/leap/bitmaskclient/ProviderListActivity.java @@ -34,7 +34,7 @@ import se.leap.bitmaskclient.ProviderListContent.ProviderItem; * @author parmegv * @author cyberta */ -public class ConfigurationWizard extends BaseConfigurationWizard { +public class ProviderListActivity extends ProviderListBaseActivity { @Override protected void onItemSelectedLogic() { diff --git a/app/src/insecure/java/se/leap/bitmaskclient/ProviderListContent.java b/app/src/insecure/java/se/leap/bitmaskclient/ProviderListContent.java index c8dfc092..88e31c9a 100644 --- a/app/src/insecure/java/se/leap/bitmaskclient/ProviderListContent.java +++ b/app/src/insecure/java/se/leap/bitmaskclient/ProviderListContent.java @@ -20,7 +20,7 @@ import java.util.*; import java.net.*; /** - * Models the provider list shown in the ConfigurationWizard. + * Models the provider list shown in the ProviderListActivity. * * @author parmegv */ diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index c0ab2c75..2ffb54f4 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -93,7 +93,7 @@ android:label="@string/title_activity_main" /> <activity - android:name=".ConfigurationWizard" + android:name=".ProviderListActivity" android:label="@string/configuration_wizard_title" /> <activity 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); diff --git a/app/src/main/res/layout-xlarge/configuration_wizard_activity.xml b/app/src/main/res/layout-xlarge/configuration_wizard_activity.xml index f82377cb..581b0c9a 100644 --- a/app/src/main/res/layout-xlarge/configuration_wizard_activity.xml +++ b/app/src/main/res/layout-xlarge/configuration_wizard_activity.xml @@ -3,7 +3,7 @@ android:id="@+id/configuration_wizard_layout" android:layout_width="match_parent" android:layout_height="match_parent" - tools:context=".ConfigurationWizard" + tools:context=".ProviderListActivity" style="@style/BitmaskActivity" > <ListView diff --git a/app/src/main/res/layout/configuration_wizard_activity.xml b/app/src/main/res/layout/configuration_wizard_activity.xml index 25da8612..e22d9047 100644 --- a/app/src/main/res/layout/configuration_wizard_activity.xml +++ b/app/src/main/res/layout/configuration_wizard_activity.xml @@ -3,7 +3,7 @@ android:id="@+id/configuration_wizard_layout" android:layout_width="match_parent" android:layout_height="match_parent" - tools:context=".ConfigurationWizard" + tools:context=".ProviderListActivity" style="@style/BitmaskActivity" > <include layout="@layout/loading_screen" /> diff --git a/app/src/production/java/se/leap/bitmaskclient/ConfigurationWizard.java b/app/src/production/java/se/leap/bitmaskclient/ProviderListActivity.java index 53bc8f0b..8c008024 100644 --- a/app/src/production/java/se/leap/bitmaskclient/ConfigurationWizard.java +++ b/app/src/production/java/se/leap/bitmaskclient/ProviderListActivity.java @@ -30,7 +30,7 @@ import java.net.URL; * @author parmegv * @author cyberta */ -public class ConfigurationWizard extends BaseConfigurationWizard { +public class ProviderListActivity extends ProviderListBaseActivity { @Override diff --git a/app/src/production/java/se/leap/bitmaskclient/ProviderListContent.java b/app/src/production/java/se/leap/bitmaskclient/ProviderListContent.java index 6466e769..d9e1d1a9 100644 --- a/app/src/production/java/se/leap/bitmaskclient/ProviderListContent.java +++ b/app/src/production/java/se/leap/bitmaskclient/ProviderListContent.java @@ -20,7 +20,7 @@ import java.util.*; import java.net.*; /** - * Models the provider list shown in the ConfigurationWizard. + * Models the provider list shown in the ProviderListActivity. * * @author parmegv */ |