From 488a804c3060b3abbcbd24e6b832673d0abbb71f Mon Sep 17 00:00:00 2001 From: cyBerta Date: Sun, 6 Oct 2019 00:59:31 +0200 Subject: fix merge conflict related bug with excluding apps from vpn --- app/src/main/java/se/leap/bitmaskclient/eip/EIP.java | 2 +- app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java | 3 ++- .../se/leap/bitmaskclient/fragments/ExcludeAppsFragment.java | 9 ++++++--- 3 files changed, 9 insertions(+), 5 deletions(-) (limited to 'app/src/main/java/se/leap') diff --git a/app/src/main/java/se/leap/bitmaskclient/eip/EIP.java b/app/src/main/java/se/leap/bitmaskclient/eip/EIP.java index 474e639e..0246174e 100644 --- a/app/src/main/java/se/leap/bitmaskclient/eip/EIP.java +++ b/app/src/main/java/se/leap/bitmaskclient/eip/EIP.java @@ -295,7 +295,7 @@ public final class EIP extends JobIntentService implements Observer { * @return GatewaysManager */ private GatewaysManager gatewaysFromPreferences() { - GatewaysManager gatewaysManager = new GatewaysManager(preferences); + GatewaysManager gatewaysManager = new GatewaysManager(getApplicationContext(), preferences); gatewaysManager.configureFromPreferences(); return gatewaysManager; } 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 c7d7f86f..5da40977 100644 --- a/app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java +++ b/app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java @@ -52,8 +52,9 @@ public class GatewaysManager { private LinkedHashMap gateways = new LinkedHashMap<>(); private Type listType = new TypeToken>() {}.getType(); - GatewaysManager(SharedPreferences preferences) { + GatewaysManager(Context context, SharedPreferences preferences) { this.preferences = preferences; + this.context = context; } /** diff --git a/app/src/main/java/se/leap/bitmaskclient/fragments/ExcludeAppsFragment.java b/app/src/main/java/se/leap/bitmaskclient/fragments/ExcludeAppsFragment.java index 066c9636..63b3908d 100644 --- a/app/src/main/java/se/leap/bitmaskclient/fragments/ExcludeAppsFragment.java +++ b/app/src/main/java/se/leap/bitmaskclient/fragments/ExcludeAppsFragment.java @@ -103,16 +103,13 @@ public class ExcludeAppsFragment extends Fragment implements AdapterView.OnItemC if (isChecked) { Log.d("openvpn", "adding to allowed apps" + packageName); - apps.add(packageName); } else { Log.d("openvpn", "removing from allowed apps" + packageName); - apps.remove(packageName); } - PreferenceHelper.setExcludedApps(this.getContext(), apps); } @@ -259,6 +256,12 @@ public class ExcludeAppsFragment extends Fragment implements AdapterView.OnItemC super.onResume(); } + @Override + public void onDestroy() { + PreferenceHelper.setExcludedApps(this.getActivity().getApplicationContext(), apps); + super.onDestroy(); + } + @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); -- cgit v1.2.3