From 302f41085f460e67934166a3da55fa746eeaf7e2 Mon Sep 17 00:00:00 2001 From: akuma Date: Fri, 9 Aug 2019 00:00:36 +0200 Subject: Select Apps option --- app/src/main/java/se/leap/bitmaskclient/eip/Gateway.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'app/src/main/java/se/leap/bitmaskclient/eip/Gateway.java') 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(allow_apps.getStringSet("ALLOW_APPS", new HashSet())); } private JSONObject getGeneralConfiguration(JSONObject eip_definition) { -- cgit v1.2.3 From 2e1c94d3f51dc6d667435b2a2bbd81a036d57bae Mon Sep 17 00:00:00 2001 From: akuma Date: Sun, 8 Sep 2019 20:40:29 +0200 Subject: New icon and text for Excluded Apps. Using PreferenceHelper. Test done. --- app/src/main/java/se/leap/bitmaskclient/eip/Gateway.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'app/src/main/java/se/leap/bitmaskclient/eip/Gateway.java') 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 77666378..09b33845 100644 --- a/app/src/main/java/se/leap/bitmaskclient/eip/Gateway.java +++ b/app/src/main/java/se/leap/bitmaskclient/eip/Gateway.java @@ -32,6 +32,7 @@ import java.util.Set; import de.blinkt.openvpn.VpnProfile; import de.blinkt.openvpn.core.ConfigParser; import se.leap.bitmaskclient.BitmaskApp; +import se.leap.bitmaskclient.utils.PreferenceHelper; /** * Gateway provides objects defining gateways and their metadata. @@ -71,8 +72,14 @@ public class Gateway { System.out.println("###########" + mName + "###########"); mVpnProfile.mName = mName; - SharedPreferences allow_apps = context.getSharedPreferences("BITMASK", Context.MODE_MULTI_PROCESS); - mVpnProfile.mAllowedAppsVpn = new HashSet(allow_apps.getStringSet("ALLOW_APPS", new HashSet())); + Set excludedAppsVpn = PreferenceHelper.getExcludedApps(context); + if (excludedAppsVpn != null) { + mVpnProfile.mAllowedAppsVpn = new HashSet<>(excludedAppsVpn); + } + else { + mVpnProfile.mAllowedAppsVpn = null; + } + } private JSONObject getGeneralConfiguration(JSONObject eip_definition) { -- cgit v1.2.3