summaryrefslogtreecommitdiff
path: root/app/src/main/java/se/leap/bitmaskclient/eip
diff options
context:
space:
mode:
authorakuma <n3k0@pc.localdomain>2019-08-09 00:00:36 +0200
committerakuma <n3k0@pc.localdomain>2019-08-09 00:00:36 +0200
commit302f41085f460e67934166a3da55fa746eeaf7e2 (patch)
tree20c81b6b698dec420294118289792ef551e95691 /app/src/main/java/se/leap/bitmaskclient/eip
parent303dd2a0e498fac87144b2d7ac930b27fe1bc7e8 (diff)
Select Apps option
Diffstat (limited to 'app/src/main/java/se/leap/bitmaskclient/eip')
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/eip/Gateway.java12
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java2
2 files changed, 12 insertions, 2 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/eip/Gateway.java b/app/src/main/java/se/leap/bitmaskclient/eip/Gateway.java
index 55ade1ae..77666378 100644
--- a/app/src/main/java/se/leap/bitmaskclient/eip/Gateway.java
+++ b/app/src/main/java/se/leap/bitmaskclient/eip/Gateway.java
@@ -16,6 +16,9 @@
*/
package se.leap.bitmaskclient.eip;
+import android.content.Context;
+import android.content.SharedPreferences;
+
import com.google.gson.Gson;
import org.json.JSONException;
@@ -23,9 +26,12 @@ import org.json.JSONObject;
import java.io.IOException;
import java.io.StringReader;
+import java.util.HashSet;
+import java.util.Set;
import de.blinkt.openvpn.VpnProfile;
import de.blinkt.openvpn.core.ConfigParser;
+import se.leap.bitmaskclient.BitmaskApp;
/**
* Gateway provides objects defining gateways and their metadata.
@@ -52,7 +58,7 @@ public class Gateway {
* Build a gateway object from a JSON OpenVPN gateway definition in eip-service.json
* and create a VpnProfile belonging to it.
*/
- public Gateway(JSONObject eip_definition, JSONObject secrets, JSONObject gateway) {
+ public Gateway(JSONObject eip_definition, JSONObject secrets, JSONObject gateway, Context context) {
this.gateway = gateway;
this.secrets = secrets;
@@ -62,7 +68,11 @@ public class Gateway {
mName = locationAsName(eip_definition);
mVpnProfile = createVPNProfile();
+ System.out.println("###########" + mName + "###########");
mVpnProfile.mName = mName;
+
+ SharedPreferences allow_apps = context.getSharedPreferences("BITMASK", Context.MODE_MULTI_PROCESS);
+ mVpnProfile.mAllowedAppsVpn = new HashSet<String>(allow_apps.getStringSet("ALLOW_APPS", new HashSet<String>()));
}
private JSONObject getGeneralConfiguration(JSONObject eip_definition) {
diff --git a/app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java b/app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java
index 060843fd..8edf81ef 100644
--- a/app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java
+++ b/app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java
@@ -93,7 +93,7 @@ public class GatewaysManager {
JSONObject gw = gatewaysDefined.getJSONObject(i);
if (isOpenVpnGateway(gw)) {
JSONObject secrets = secretsConfiguration();
- Gateway aux = new Gateway(eipDefinition, secrets, gw);
+ Gateway aux = new Gateway(eipDefinition, secrets, gw, context);
if (!gateways.contains(aux)) {
addGateway(aux);
}