summaryrefslogtreecommitdiff
path: root/app/src/main/java/se/leap/bitmaskclient/ProviderSetupFailedDialog.java
diff options
context:
space:
mode:
authorcyBerta <cyberta@riseup.net>2019-05-21 11:54:20 +0200
committercyBerta <cyberta@riseup.net>2019-05-21 11:54:20 +0200
commitcaadb236f39b4b6139a697eec57aa2796595422f (patch)
treec6b53be2133d74feb7d982e59d73cc4d29e4b6e7 /app/src/main/java/se/leap/bitmaskclient/ProviderSetupFailedDialog.java
parent5fd9cd738f26797cf16576bf4011852c9f3052a8 (diff)
* show error dialog if provider is misconfigured and has not allowed registration nor anonymous usage
* always download provider.json, Use preseeded provider.json only to check if the client can connect with preseeded certificate. Keeps the provider.json updated if provider changes it's config * Tests for both cases
Diffstat (limited to 'app/src/main/java/se/leap/bitmaskclient/ProviderSetupFailedDialog.java')
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/ProviderSetupFailedDialog.java40
1 files changed, 13 insertions, 27 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/ProviderSetupFailedDialog.java b/app/src/main/java/se/leap/bitmaskclient/ProviderSetupFailedDialog.java
index 71b67df1..e2f3e173 100644
--- a/app/src/main/java/se/leap/bitmaskclient/ProviderSetupFailedDialog.java
+++ b/app/src/main/java/se/leap/bitmaskclient/ProviderSetupFailedDialog.java
@@ -48,6 +48,9 @@ public class ProviderSetupFailedDialog extends DialogFragment {
private Provider provider;
+ /**
+ * Represent error types that need different error handling actions
+ */
public enum DOWNLOAD_ERRORS {
DEFAULT,
ERROR_CORRUPTED_PROVIDER_JSON,
@@ -103,42 +106,25 @@ public class ProviderSetupFailedDialog extends DialogFragment {
public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setMessage(reasonToFail)
- .setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int id) {
- interfaceWithConfigurationWizard.cancelSettingUpProvider();
- }
- });
+ .setNegativeButton(R.string.cancel, (dialog, id)
+ -> interfaceWithConfigurationWizard.cancelSettingUpProvider());
switch (downloadError) {
case ERROR_CORRUPTED_PROVIDER_JSON:
- builder.setPositiveButton(R.string.update_provider_details, new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- interfaceWithConfigurationWizard.updateProviderDetails();
- }
- });
+ builder.setPositiveButton(R.string.update_provider_details, (dialog, which)
+ -> interfaceWithConfigurationWizard.updateProviderDetails());
break;
case ERROR_CERTIFICATE_PINNING:
case ERROR_INVALID_CERTIFICATE:
- builder.setPositiveButton(R.string.update_certificate, new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- interfaceWithConfigurationWizard.updateProviderDetails();
- }
- });
+ builder.setPositiveButton(R.string.update_certificate, (dialog, which)
+ -> interfaceWithConfigurationWizard.updateProviderDetails());
break;
case ERROR_NEW_URL_NO_VPN_PROVIDER:
- builder.setPositiveButton(R.string.retry, new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int id) {
- interfaceWithConfigurationWizard.addAndSelectNewProvider(provider.getMainUrlString());
- }
- });
+ builder.setPositiveButton(R.string.retry, (dialog, id)
+ -> interfaceWithConfigurationWizard.addAndSelectNewProvider(provider.getMainUrlString()));
break;
default:
- builder.setPositiveButton(R.string.retry, new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int id) {
- interfaceWithConfigurationWizard.retrySetUpProvider(provider);
- }
- });
+ builder.setPositiveButton(R.string.retry, (dialog, id)
+ -> interfaceWithConfigurationWizard.retrySetUpProvider(provider));
break;
}