summaryrefslogtreecommitdiff
path: root/app/src/main/java/se
diff options
context:
space:
mode:
authorcyBerta <cyberta@riseup.net>2024-12-07 03:27:14 +0100
committercyberta <cyberta@riseup.net>2024-12-11 00:09:34 +0000
commitc3032f4cd83c94655c86351b578a829df3a6180b (patch)
tree0ce5751e2e22bc3d8ddb32c49a23e2493db97920 /app/src/main/java/se
parent3bcba785be239093ee469fd99efb197ca1d1f246 (diff)
implement provider setup progress event handling for v5
Diffstat (limited to 'app/src/main/java/se')
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderApiManagerV5.java11
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderSetupObservable.java3
2 files changed, 11 insertions, 3 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderApiManagerV5.java b/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderApiManagerV5.java
index 404ded0a..926b1545 100644
--- a/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderApiManagerV5.java
+++ b/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderApiManagerV5.java
@@ -18,8 +18,10 @@ import static se.leap.bitmaskclient.providersetup.ProviderAPI.QUIETLY_UPDATE_VPN
import static se.leap.bitmaskclient.providersetup.ProviderAPI.SET_UP_PROVIDER;
import static se.leap.bitmaskclient.providersetup.ProviderAPI.UPDATE_INVALID_VPN_CERTIFICATE;
import static se.leap.bitmaskclient.providersetup.ProviderSetupFailedDialog.DOWNLOAD_ERRORS.ERROR_INVALID_CERTIFICATE;
-import static se.leap.bitmaskclient.providersetup.ProviderSetupObservable.DOWNLOADED_EIP_SERVICE_JSON;
-import static se.leap.bitmaskclient.providersetup.ProviderSetupObservable.DOWNLOADED_PROVIDER_JSON;
+import static se.leap.bitmaskclient.providersetup.ProviderSetupObservable.DOWNLOADED_V5_BRIDGES;
+import static se.leap.bitmaskclient.providersetup.ProviderSetupObservable.DOWNLOADED_V5_SERVICE_JSON;
+import static se.leap.bitmaskclient.providersetup.ProviderSetupObservable.DOWNLOADED_V5_GATEWAYS;
+import static se.leap.bitmaskclient.providersetup.ProviderSetupObservable.DOWNLOADED_VPN_CERTIFICATE;
import static se.leap.bitmaskclient.tor.TorStatusObservable.TorStatus.OFF;
import android.content.res.Resources;
@@ -178,7 +180,7 @@ public class ProviderApiManagerV5 extends ProviderApiManagerBase implements IPro
String serviceJson = bm.getService();
Log.d(TAG, "service Json reponse: " + serviceJson);
provider.setService(serviceJson);
- ProviderSetupObservable.updateProgress(DOWNLOADED_EIP_SERVICE_JSON);
+ ProviderSetupObservable.updateProgress(DOWNLOADED_V5_SERVICE_JSON);
} catch (Exception e) {
Log.w(TAG, "failed to fetch service.json: " + e.getMessage());
e.printStackTrace();
@@ -190,6 +192,7 @@ public class ProviderApiManagerV5 extends ProviderApiManagerBase implements IPro
String gatewaysJson = bm.getAllGateways("", "", "");
Log.d(TAG, "gateways Json reponse: " + gatewaysJson);
provider.setGateways(gatewaysJson);
+ ProviderSetupObservable.updateProgress(DOWNLOADED_V5_GATEWAYS);
} catch (Exception e) {
Log.w(TAG, "failed to fetch gateways: " + e.getMessage());
e.printStackTrace();
@@ -201,6 +204,7 @@ public class ProviderApiManagerV5 extends ProviderApiManagerBase implements IPro
String bridgesJson = bm.getAllBridges("", "", "", "");
Log.d(TAG, "bridges Json reponse: " + bridgesJson);
provider.setBridges(bridgesJson);
+ ProviderSetupObservable.updateProgress(DOWNLOADED_V5_BRIDGES);
} catch (Exception e) {
Log.w(TAG, "failed to fetch bridges: " + e.getMessage());
e.printStackTrace();
@@ -211,6 +215,7 @@ public class ProviderApiManagerV5 extends ProviderApiManagerBase implements IPro
String cert = bm.getOpenVPNCert();
currentDownload = loadCredentials(provider, cert);
currentDownload = validateCertificateForProvider(currentDownload, provider);
+ ProviderSetupObservable.updateProgress(DOWNLOADED_VPN_CERTIFICATE);
} catch (Exception e) {
return eventSender.setErrorResult(currentDownload, R.string.error_json_exception_user_message, null);
}
diff --git a/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderSetupObservable.java b/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderSetupObservable.java
index 237f5bd2..d57e1739 100644
--- a/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderSetupObservable.java
+++ b/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderSetupObservable.java
@@ -38,6 +38,9 @@ public class ProviderSetupObservable {
private boolean canceled = false;
public static final int DOWNLOADED_PROVIDER_JSON = 20;
public static final int DOWNLOADED_CA_CERT = 40;
+ public static final int DOWNLOADED_V5_SERVICE_JSON = 40;
+ public static final int DOWNLOADED_V5_GATEWAYS = 60;
+ public static final int DOWNLOADED_V5_BRIDGES = 80;
public static final int DOWNLOADED_EIP_SERVICE_JSON = 60;
public static final int DOWNLOADED_GEOIP_JSON = 80;
public static final int DOWNLOADED_VPN_CERTIFICATE = 100;