summaryrefslogtreecommitdiff
path: root/src/de/blinkt/openvpn/ProfileManager.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/de/blinkt/openvpn/ProfileManager.java')
-rw-r--r--src/de/blinkt/openvpn/ProfileManager.java36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/de/blinkt/openvpn/ProfileManager.java b/src/de/blinkt/openvpn/ProfileManager.java
index b1321b97..5d498c67 100644
--- a/src/de/blinkt/openvpn/ProfileManager.java
+++ b/src/de/blinkt/openvpn/ProfileManager.java
@@ -14,12 +14,17 @@ import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
+import android.preference.PreferenceManager;
public class ProfileManager {
private static final String PREFS_NAME = "VPNList";
+ private static final String ONBOOTPROFILE = "onBootProfile";
+
+
+
private static ProfileManager instance;
private HashMap<String,VpnProfile> profiles=new HashMap<String, VpnProfile>();
@@ -47,6 +52,37 @@ public class ProfileManager {
return instance;
}
+ public static void onBootDelete(Context c) {
+ SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(c);
+ Editor prefsedit = prefs.edit();
+ prefsedit.putString(ONBOOTPROFILE, null);
+ prefsedit.apply();
+
+ }
+
+ public static void setOnBootProfile(Context c, VpnProfile bootprofile) {
+ SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(c);
+ Editor prefsedit = prefs.edit();
+
+ prefsedit.putString(ONBOOTPROFILE, bootprofile.getUUIDString());
+ prefsedit.apply();
+
+ }
+
+ public static VpnProfile getOnBootProfile(Context c) {
+ SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(c);
+
+ boolean useStartOnBoot = prefs.getBoolean("restartvpnonboot", false);
+
+
+ String mBootProfileUUID = prefs.getString(ONBOOTPROFILE,null);
+ if(useStartOnBoot && mBootProfileUUID!=null)
+ return get(c, mBootProfileUUID);
+ else
+ return null;
+ }
+
+
public Collection<VpnProfile> getProfiles() {