summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorFup Duck <fupduck@sacknagel.com>2018-01-23 16:15:43 +0100
committerFup Duck <fupduck@sacknagel.com>2018-01-23 16:15:43 +0100
commitf18f51aa68bf3443d38163f1bd1d25a45ed14102 (patch)
treea1c905202584088b41c74e0b6480e3cbc5185c8a /app
parent26db3cd2398e0ae80fcc53e7933f2de747c074b4 (diff)
parent8333bd0ad9a6c4f6b07513d29ec8008e11a246dc (diff)
Merge branch '8819_config_wizard_design' into 8826_custom_provider
Diffstat (limited to 'app')
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/BaseConfigurationWizard.java12
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/ConfigWizardBaseActivity.java22
2 files changed, 26 insertions, 8 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/BaseConfigurationWizard.java b/app/src/main/java/se/leap/bitmaskclient/BaseConfigurationWizard.java
index cb52eb48..b5040cdc 100644
--- a/app/src/main/java/se/leap/bitmaskclient/BaseConfigurationWizard.java
+++ b/app/src/main/java/se/leap/bitmaskclient/BaseConfigurationWizard.java
@@ -432,15 +432,21 @@ public abstract class BaseConfigurationWizard extends ConfigWizardBaseActivity
int resultCode = intent.getIntExtra(RESULT_CODE, -1);
Log.d(TAG, "Broadcast resultCode: " + Integer.toString(resultCode));
+ Bundle resultData = intent.getParcelableExtra(RESULT_KEY);
+ String handledProvider = resultData.getString(Provider.KEY);
- if (getProviderName().equalsIgnoreCase(provider.getName()) &&
- getProviderDomain().equalsIgnoreCase(provider.getDomain())) {
+ String providerName = getProviderName(handledProvider);
+ String providerDomain = getProviderDomain(handledProvider);
+
+ if (providerName != null && providerName.equalsIgnoreCase(provider.getName()) &&
+ providerDomain != null &&
+ providerDomain.equalsIgnoreCase(provider.getDomain())) {
switch (resultCode) {
case PROVIDER_OK:
handleProviderSetUp();
break;
case PROVIDER_NOK:
- handleProviderSetupFailed((Bundle) intent.getParcelableExtra(RESULT_KEY));
+ handleProviderSetupFailed(resultData);
break;
case CORRECTLY_DOWNLOADED_CERTIFICATE:
handleCorrectlyDownloadedCertificate();
diff --git a/app/src/main/java/se/leap/bitmaskclient/ConfigWizardBaseActivity.java b/app/src/main/java/se/leap/bitmaskclient/ConfigWizardBaseActivity.java
index 98715c1a..1ad12042 100644
--- a/app/src/main/java/se/leap/bitmaskclient/ConfigWizardBaseActivity.java
+++ b/app/src/main/java/se/leap/bitmaskclient/ConfigWizardBaseActivity.java
@@ -5,7 +5,6 @@ import android.os.Bundle;
import android.support.annotation.DrawableRes;
import android.support.annotation.Nullable;
import android.support.annotation.StringRes;
-import android.support.v4.app.FragmentTransaction;
import android.support.v7.widget.AppCompatImageView;
import android.support.v7.widget.AppCompatTextView;
import android.view.View;
@@ -18,7 +17,6 @@ import org.json.JSONObject;
import java.util.Locale;
import butterknife.InjectView;
-import se.leap.bitmaskclient.userstatus.SessionDialog;
import static android.view.View.GONE;
import static android.view.View.VISIBLE;
@@ -91,13 +89,20 @@ public abstract class ConfigWizardBaseActivity extends ButterKnifeActivity {
}
protected String getProviderName() {
+ return getProviderName(null);
+ }
+
+ protected String getProviderName(@Nullable String provider) {
+ if (provider == null) {
+ provider = preferences.getString(Provider.KEY, "");
+ }
try {
- JSONObject providerJson = new JSONObject(preferences.getString(Provider.KEY, ""));
+ JSONObject providerJson = new JSONObject(provider);
String lang = Locale.getDefault().getLanguage();
return providerJson.getJSONObject(Provider.NAME).getString(lang);
} catch (JSONException e) {
try {
- JSONObject providerJson = new JSONObject(preferences.getString(Provider.KEY, ""));
+ JSONObject providerJson = new JSONObject(provider);
return providerJson.getJSONObject(Provider.NAME).getString("en");
} catch (JSONException e2) {
return null;
@@ -106,8 +111,15 @@ public abstract class ConfigWizardBaseActivity extends ButterKnifeActivity {
}
protected String getProviderDomain() {
+ return getProviderDomain(null);
+ }
+
+ protected String getProviderDomain(@Nullable String provider) {
+ if (provider == null) {
+ provider = preferences.getString(Provider.KEY, "");
+ }
try {
- JSONObject providerJson = new JSONObject(preferences.getString(Provider.KEY, ""));
+ JSONObject providerJson = new JSONObject(provider);
return providerJson.getString(Provider.DOMAIN);
} catch (JSONException e) {
return null;