summaryrefslogtreecommitdiff
path: root/src/de/blinkt/openvpn/api/ExternalAppDatabase.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/de/blinkt/openvpn/api/ExternalAppDatabase.java')
-rw-r--r--src/de/blinkt/openvpn/api/ExternalAppDatabase.java57
1 files changed, 0 insertions, 57 deletions
diff --git a/src/de/blinkt/openvpn/api/ExternalAppDatabase.java b/src/de/blinkt/openvpn/api/ExternalAppDatabase.java
deleted file mode 100644
index 02c369b1..00000000
--- a/src/de/blinkt/openvpn/api/ExternalAppDatabase.java
+++ /dev/null
@@ -1,57 +0,0 @@
-package de.blinkt.openvpn.api;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import android.content.Context;
-import android.content.SharedPreferences;
-import android.content.SharedPreferences.Editor;
-import android.preference.PreferenceManager;
-
-public class ExternalAppDatabase {
-
- Context mContext;
-
- public ExternalAppDatabase(Context c) {
- mContext =c;
- }
-
- private final String PREFERENCES_KEY = "PREFERENCES_KEY";
-
- boolean isAllowed(String packagename) {
- Set<String> allowedapps = getExtAppList();
-
- return allowedapps.contains(packagename);
-
- }
-
- public Set<String> getExtAppList() {
- SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(mContext);
- return prefs.getStringSet(PREFERENCES_KEY, new HashSet<String>());
- }
-
- void addApp(String packagename)
- {
- Set<String> allowedapps = getExtAppList();
- allowedapps.add(packagename);
- saveExtAppList(allowedapps);
- }
-
- private void saveExtAppList( Set<String> allowedapps) {
- SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(mContext);
- Editor prefedit = prefs.edit();
- prefedit.putStringSet(PREFERENCES_KEY, allowedapps);
- prefedit.apply();
- }
-
- public void clearAllApiApps() {
- saveExtAppList(new HashSet<String>());
- }
-
- public void removeApp(String packagename) {
- Set<String> allowedapps = getExtAppList();
- allowedapps.remove(packagename);
- saveExtAppList(allowedapps);
- }
-
-}