summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcyBerta <cyberta@riseup.net>2019-07-19 18:39:57 +0200
committercyBerta <cyberta@riseup.net>2019-08-02 01:49:37 +0200
commit1a27e86bb86e70830dc79a210b0efb80fffbb5c7 (patch)
treeb3602cede9d51f32812bc0c560f45486c23d5b95
parentbddfee15cbf8f67c9d808ea32dd7740cdeb1d5c2 (diff)
add shared preferences for pluggable transport usage
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/Constants.java1
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/utils/PreferenceHelper.java17
2 files changed, 18 insertions, 0 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/Constants.java b/app/src/main/java/se/leap/bitmaskclient/Constants.java
index 7503d29f..0bc3c944 100644
--- a/app/src/main/java/se/leap/bitmaskclient/Constants.java
+++ b/app/src/main/java/se/leap/bitmaskclient/Constants.java
@@ -13,6 +13,7 @@ public interface Constants {
String ALWAYS_ON_SHOW_DIALOG = "DIALOG.ALWAYS_ON_SHOW_DIALOG";
String CLEARLOG = "clearlogconnect";
String LAST_USED_PROFILE = "last_used_profile";
+ String USE_PLUGGABLE_TRANSPORTS = "usePluggableTransports";
//////////////////////////////////////////////
diff --git a/app/src/main/java/se/leap/bitmaskclient/utils/PreferenceHelper.java b/app/src/main/java/se/leap/bitmaskclient/utils/PreferenceHelper.java
index f5cf590b..09d941f5 100644
--- a/app/src/main/java/se/leap/bitmaskclient/utils/PreferenceHelper.java
+++ b/app/src/main/java/se/leap/bitmaskclient/utils/PreferenceHelper.java
@@ -29,6 +29,7 @@ import static se.leap.bitmaskclient.Constants.PROVIDER_EIP_DEFINITION;
import static se.leap.bitmaskclient.Constants.PROVIDER_PRIVATE_KEY;
import static se.leap.bitmaskclient.Constants.PROVIDER_VPN_CERTIFICATE;
import static se.leap.bitmaskclient.Constants.SHARED_PREFERENCES;
+import static se.leap.bitmaskclient.Constants.USE_PLUGGABLE_TRANSPORTS;
/**
* Created by cyberta on 18.03.18.
@@ -210,6 +211,22 @@ public class PreferenceHelper {
apply();
}
+ public static boolean getUsePluggableTransports(Context context) {
+ if (context == null) {
+ return false;
+ }
+ SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
+ return preferences.getBoolean(USE_PLUGGABLE_TRANSPORTS, false);
+ }
+
+ public static void usePluggableTransports(Context context, boolean isEnabled) {
+ if (context == null) {
+ return;
+ }
+ SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
+ preferences.edit().putBoolean(USE_PLUGGABLE_TRANSPORTS, isEnabled).apply();
+ }
+
public static void saveBattery(Context context, boolean isEnabled) {
if (context == null) {
return;