summaryrefslogtreecommitdiff
path: root/app/src
diff options
context:
space:
mode:
Diffstat (limited to 'app/src')
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderAPI.java7
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderApiManagerBase.java6
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderManager.java2
3 files changed, 14 insertions, 1 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderAPI.java b/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderAPI.java
index ed30c454..bb6f5e01 100644
--- a/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderAPI.java
+++ b/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderAPI.java
@@ -30,6 +30,7 @@ import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import java.util.concurrent.TimeoutException;
+import se.leap.bitmaskclient.base.models.Provider;
import se.leap.bitmaskclient.base.utils.PreferenceHelper;
import se.leap.bitmaskclient.providersetup.connectivity.OkHttpClientGenerator;
import se.leap.bitmaskclient.tor.TorServiceCommand;
@@ -177,6 +178,12 @@ public class ProviderAPI extends JobIntentService implements ProviderApiManagerB
}
}
+ @Override
+ public void saveProvider(Provider p) {
+ ProviderManager pm = ProviderManager.getInstance(this.getAssets(), this.getExternalFilesDir(null));
+ pm.add(p);
+ pm.saveCustomProvidersToFile();
+ }
private ProviderApiManager initApiManager() {
diff --git a/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderApiManagerBase.java b/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderApiManagerBase.java
index 1f737b0c..ae55f81c 100644
--- a/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderApiManagerBase.java
+++ b/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderApiManagerBase.java
@@ -170,6 +170,7 @@ public abstract class ProviderApiManagerBase {
void stopTorService();
int getTorHttpTunnelPort();
boolean hasNetworkConnection();
+ void saveProvider(Provider p);
}
private final ProviderApiServiceCallback serviceCallback;
@@ -295,6 +296,7 @@ public abstract class ProviderApiManagerBase {
ProviderObservable.getInstance().setProviderForDns(provider);
result = updateVpnCertificate(provider);
if (result.getBoolean(BROADCAST_RESULT_KEY)) {
+ serviceCallback.saveProvider(provider);
ProviderSetupObservable.updateProgress(DOWNLOADED_VPN_CERTIFICATE);
sendToReceiverOrBroadcast(receiver, CORRECTLY_DOWNLOADED_VPN_CERTIFICATE, result, provider);
} else {
@@ -362,6 +364,10 @@ public abstract class ProviderApiManagerBase {
}
}
+ private void saveCustomProvider() {
+
+ }
+
protected boolean startTorProxy() throws InterruptedException, IllegalStateException, TimeoutException {
if (EipStatus.getInstance().isDisconnected() &&
PreferenceHelper.getUseSnowflake() &&
diff --git a/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderManager.java b/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderManager.java
index 38198f89..39f117ea 100644
--- a/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderManager.java
+++ b/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderManager.java
@@ -225,7 +225,7 @@ public class ProviderManager {
defaultProviderURLs.clear();
}
- void saveCustomProvidersToFile() {
+ public void saveCustomProvidersToFile() {
try {
deleteLegacyCustomProviders();