summaryrefslogtreecommitdiff
path: root/app/src/main
diff options
context:
space:
mode:
authorcyBerta <cyberta@riseup.net>2022-07-25 17:23:47 +0200
committercyBerta <cyberta@riseup.net>2022-07-25 17:26:09 +0200
commit23a8e4fbd3a52ead9cc8e9a32724e6c750ee29a6 (patch)
tree735c662fd37258aee30956a961550ed48936aa85 /app/src/main
parent6bc3a79e6d09a8fa1857f1d502a87c1c0633be35 (diff)
client update check, removes current provider data on app update if calyx move to lilypad is expected
Diffstat (limited to 'app/src/main')
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/base/StartActivity.java13
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/base/models/FeatureVersionCode.java1
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/base/utils/PreferenceHelper.java14
3 files changed, 27 insertions, 1 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/base/StartActivity.java b/app/src/main/java/se/leap/bitmaskclient/base/StartActivity.java
index 1ea574ff..80056925 100644
--- a/app/src/main/java/se/leap/bitmaskclient/base/StartActivity.java
+++ b/app/src/main/java/se/leap/bitmaskclient/base/StartActivity.java
@@ -89,7 +89,6 @@ public class StartActivity extends Activity{
case UPGRADE:
executeUpgrade();
- // TODO show donation dialog
break;
}
@@ -158,6 +157,18 @@ public class StartActivity extends Activity{
}
}
+ if (hasNewFeature(FeatureVersionCode.CALYX_PROVIDER_LILYPAD_UPDATE) && (
+ getPackageName().equals("org.calyxinstitute.vpn") ||
+ ProviderObservable.getInstance().getCurrentProvider().getDomain().equals("calyx.net"))) {
+ // deletion of current configured provider so that a new provider setup is triggered
+ Provider provider = ProviderObservable.getInstance().getCurrentProvider();
+ if (provider != null && !provider.isDefault()) {
+ PreferenceHelper.deleteProviderDetailsFromPreferences(preferences, provider.getDomain());
+ PreferenceHelper.deleteCurrentProviderDetailsFromPreferences(preferences);
+ ProviderObservable.getInstance().updateProvider(new Provider());
+ }
+ }
+
// always check if manual gateway selection feature switch has been disabled
if (!BuildConfig.allow_manual_gateway_selection && PreferenceHelper.getPreferredCity(this) != null) {
PreferenceHelper.setPreferredCity(this, null);
diff --git a/app/src/main/java/se/leap/bitmaskclient/base/models/FeatureVersionCode.java b/app/src/main/java/se/leap/bitmaskclient/base/models/FeatureVersionCode.java
index 7b3f1888..95decb82 100644
--- a/app/src/main/java/se/leap/bitmaskclient/base/models/FeatureVersionCode.java
+++ b/app/src/main/java/se/leap/bitmaskclient/base/models/FeatureVersionCode.java
@@ -3,4 +3,5 @@ package se.leap.bitmaskclient.base.models;
public interface FeatureVersionCode {
int RENAMED_EIP_IN_PREFERENCES = 132;
int GEOIP_SERVICE = 148;
+ int CALYX_PROVIDER_LILYPAD_UPDATE = 163000;
}
diff --git a/app/src/main/java/se/leap/bitmaskclient/base/utils/PreferenceHelper.java b/app/src/main/java/se/leap/bitmaskclient/base/utils/PreferenceHelper.java
index 3a2cf754..22fe42ff 100644
--- a/app/src/main/java/se/leap/bitmaskclient/base/utils/PreferenceHelper.java
+++ b/app/src/main/java/se/leap/bitmaskclient/base/utils/PreferenceHelper.java
@@ -131,6 +131,20 @@ public class PreferenceHelper {
apply();
}
+ public static void deleteCurrentProviderDetailsFromPreferences(@NonNull SharedPreferences preferences) {
+ preferences.edit().
+ remove(Provider.KEY).
+ remove(Provider.CA_CERT).
+ remove(Provider.PROVIDER_IP).
+ remove(Provider.PROVIDER_API_IP).
+ remove(Provider.MAIN_URL).
+ remove(Provider.GEOIP_URL).
+ remove(PROVIDER_EIP_DEFINITION).
+ remove(PROVIDER_PRIVATE_KEY).
+ remove(PROVIDER_VPN_CERTIFICATE).
+ apply();
+ }
+
public static void setLastAppUpdateCheck(Context context) {
putLong(context, LAST_UPDATE_CHECK, System.currentTimeMillis());
}