From 449c3953ce79947554bbfd6ed0386d68aa9f04bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Parm=C3=A9nides=20GV?= Date: Wed, 22 Apr 2015 14:20:09 +0200 Subject: Avoid the check for a null provider. A provider can be asked if it's configured or not, so that we don't find more provider = null issues. I've created a DefaultedURL which links to https://example.net, so that we can initialize an URL. I use composition instead of inheritance, since URL class is final. --- app/src/debug/java/se/leap/bitmaskclient/ConfigurationWizard.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'app/src/debug/java/se/leap/bitmaskclient/ConfigurationWizard.java') diff --git a/app/src/debug/java/se/leap/bitmaskclient/ConfigurationWizard.java b/app/src/debug/java/se/leap/bitmaskclient/ConfigurationWizard.java index aac53a07..6ab08a06 100644 --- a/app/src/debug/java/se/leap/bitmaskclient/ConfigurationWizard.java +++ b/app/src/debug/java/se/leap/bitmaskclient/ConfigurationWizard.java @@ -97,8 +97,7 @@ public class ConfigurationWizard extends Activity outState.putInt(PROGRESSBAR_NUMBER, mProgressBar.getProgress()); if (progressbar_description != null) outState.putString(PROGRESSBAR_TEXT, progressbar_description.getText().toString()); - if (selected_provider != null) - outState.putParcelable(Provider.KEY, selected_provider); + outState.putParcelable(Provider.KEY, selected_provider); super.onSaveInstanceState(outState); } @@ -125,8 +124,7 @@ public class ConfigurationWizard extends Activity progress = savedInstanceState.getInt(PROGRESSBAR_NUMBER, -1); if (fragment_manager.findFragmentByTag(ProviderDetailFragment.TAG) == null && setting_up_provider) { - if (selected_provider != null) - onItemSelectedUi(); + onItemSelectedUi(); if (progress > 0) mProgressBar.setProgress(progress); } @@ -393,7 +391,7 @@ public class ConfigurationWizard extends Activity public void setUpProvider(boolean danger_on) { Intent provider_API_command = new Intent(this, ProviderAPI.class); Bundle parameters = new Bundle(); - parameters.putString(Provider.MAIN_URL, selected_provider.mainUrl().toString()); + parameters.putString(Provider.MAIN_URL, selected_provider.mainUrl().getUrl().toString()); parameters.putBoolean(ProviderItem.DANGER_ON, danger_on); parameters.putString(Provider.CA_CERT_FINGERPRINT, selected_provider.certificatePin()); -- cgit v1.2.3 From 8707f9e9a07f8c53955df14ef9b26d13a0eb60da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Parm=C3=A9nides=20GV?= Date: Mon, 27 Apr 2015 17:10:20 +0200 Subject: testEveryProvider also works --- app/src/debug/java/se/leap/bitmaskclient/ConfigurationWizard.java | 4 ---- 1 file changed, 4 deletions(-) (limited to 'app/src/debug/java/se/leap/bitmaskclient/ConfigurationWizard.java') diff --git a/app/src/debug/java/se/leap/bitmaskclient/ConfigurationWizard.java b/app/src/debug/java/se/leap/bitmaskclient/ConfigurationWizard.java index 6ab08a06..12a2b239 100644 --- a/app/src/debug/java/se/leap/bitmaskclient/ConfigurationWizard.java +++ b/app/src/debug/java/se/leap/bitmaskclient/ConfigurationWizard.java @@ -194,8 +194,6 @@ public class ConfigurationWizard extends Activity mProgressBar.incrementProgressBy(1); hideProgressBar(); - setResult(RESULT_OK); - showProviderDetails(); } } else if (resultCode == ProviderAPI.PROVIDER_NOK) { @@ -212,8 +210,6 @@ public class ConfigurationWizard extends Activity hideProgressBar(); showProviderDetails(); - - setResult(RESULT_OK); } else if (resultCode == ProviderAPI.INCORRECTLY_DOWNLOADED_CERTIFICATE) { hideProgressBar(); cancelSettingUpProvider(); -- cgit v1.2.3 From f008b5ec8e1c74968e4a605d2de5423edf91b854 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Parm=C3=A9nides=20GV?= Date: Wed, 29 Apr 2015 12:25:24 +0200 Subject: Creating a user session fragment. I've separated the user session management to it, and encapsulated ProviderAPICommand into its own class. Putting the fragment statically in dashboard.xml isn't working, Android complains about it being duplicated, so I'm going to add it dynamically. --- app/src/debug/java/se/leap/bitmaskclient/ConfigurationWizard.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'app/src/debug/java/se/leap/bitmaskclient/ConfigurationWizard.java') diff --git a/app/src/debug/java/se/leap/bitmaskclient/ConfigurationWizard.java b/app/src/debug/java/se/leap/bitmaskclient/ConfigurationWizard.java index 12a2b239..4a75b49c 100644 --- a/app/src/debug/java/se/leap/bitmaskclient/ConfigurationWizard.java +++ b/app/src/debug/java/se/leap/bitmaskclient/ConfigurationWizard.java @@ -40,6 +40,7 @@ import se.leap.bitmaskclient.ProviderAPIResultReceiver.Receiver; import se.leap.bitmaskclient.ProviderDetailFragment.ProviderDetailFragmentInterface; import se.leap.bitmaskclient.ProviderListContent.ProviderItem; import se.leap.bitmaskclient.eip.*; +import se.leap.bitmaskclient.userstatus.SessionDialog; /** * Activity that builds and shows the list of known available providers. @@ -201,8 +202,6 @@ public class ConfigurationWizard extends Activity preferences.edit().remove(Provider.KEY).apply(); setting_up_provider = false; - setResult(RESULT_CANCELED, mConfigState); - String reason_to_fail = resultData.getString(ProviderAPI.ERRORS); showDownloadFailedDialog(reason_to_fail); } else if (resultCode == ProviderAPI.CORRECTLY_DOWNLOADED_CERTIFICATE) { @@ -214,7 +213,6 @@ public class ConfigurationWizard extends Activity hideProgressBar(); cancelSettingUpProvider(); Toast.makeText(getApplicationContext(), R.string.provider_problem, Toast.LENGTH_LONG).show(); - setResult(RESULT_CANCELED, mConfigState); } else if (resultCode == AboutActivity.VIEWED) { // Do nothing, right now // I need this for CW to wait for the About activity to end before going back to Dashboard. -- cgit v1.2.3 From 9a54c425f6d96e1872899eabf78fb60082a8d234 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Parm=C3=A9nides=20GV?= Date: Wed, 29 Apr 2015 18:21:03 +0200 Subject: Functional. --- app/src/debug/java/se/leap/bitmaskclient/ConfigurationWizard.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'app/src/debug/java/se/leap/bitmaskclient/ConfigurationWizard.java') diff --git a/app/src/debug/java/se/leap/bitmaskclient/ConfigurationWizard.java b/app/src/debug/java/se/leap/bitmaskclient/ConfigurationWizard.java index 4a75b49c..2505d37b 100644 --- a/app/src/debug/java/se/leap/bitmaskclient/ConfigurationWizard.java +++ b/app/src/debug/java/se/leap/bitmaskclient/ConfigurationWizard.java @@ -165,8 +165,7 @@ public class ConfigurationWizard extends Activity } private void setUpProviderAPIResultReceiver() { - providerAPI_result_receiver = new ProviderAPIResultReceiver(new Handler()); - providerAPI_result_receiver.setReceiver(this); + providerAPI_result_receiver = new ProviderAPIResultReceiver(new Handler(), this); providerAPI_broadcast_receiver_update = new ProviderAPIBroadcastReceiver_Update(); IntentFilter update_intent_filter = new IntentFilter(ProviderAPI.UPDATE_PROGRESSBAR); -- cgit v1.2.3