summaryrefslogtreecommitdiff
path: root/app/src/main/java/se/leap/bitmaskclient/base/utils
diff options
context:
space:
mode:
authorcyBerta <cyberta@riseup.net>2021-11-06 02:52:38 +0100
committercyBerta <cyberta@riseup.net>2021-11-06 02:52:38 +0100
commiteb434ae79f45dfd5c14c0901c414a287221442d4 (patch)
tree73b4c8553940127021f8e888a897f707d62b6281 /app/src/main/java/se/leap/bitmaskclient/base/utils
parent8a7b455f011842d17de687b7cbb2b6589b78ac3f (diff)
fix tor provider setup fallback mechanism
Diffstat (limited to 'app/src/main/java/se/leap/bitmaskclient/base/utils')
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/base/utils/PreferenceHelper.java20
1 files changed, 8 insertions, 12 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/base/utils/PreferenceHelper.java b/app/src/main/java/se/leap/bitmaskclient/base/utils/PreferenceHelper.java
index 663e339e..7bbd032e 100644
--- a/app/src/main/java/se/leap/bitmaskclient/base/utils/PreferenceHelper.java
+++ b/app/src/main/java/se/leap/bitmaskclient/base/utils/PreferenceHelper.java
@@ -35,6 +35,7 @@ import static se.leap.bitmaskclient.base.models.Constants.SHARED_PREFERENCES;
import static se.leap.bitmaskclient.base.models.Constants.SHOW_EXPERIMENTAL;
import static se.leap.bitmaskclient.base.models.Constants.USE_IPv6_FIREWALL;
import static se.leap.bitmaskclient.base.models.Constants.USE_BRIDGES;
+import static se.leap.bitmaskclient.base.models.Constants.USE_TOR;
/**
* Created by cyberta on 18.03.18.
@@ -152,11 +153,18 @@ public class PreferenceHelper {
public static void useBridges(Context context, boolean isEnabled) {
putBoolean(context, USE_BRIDGES, isEnabled);
+ putBoolean(context, USE_TOR, isEnabled);
if (!isEnabled) {
TorStatusObservable.setProxyPort(-1);
}
}
+ // in contrast to USE_BRIDGES, USE_TOR in enabled by default
+ // This way the initial provider setup can rely on tor as fallback circumvention mechanism
+ public static Boolean getUseTor(SharedPreferences preferences) {
+ return preferences.getBoolean(USE_TOR, true);
+ }
+
public static void saveBattery(Context context, boolean isEnabled) {
putBoolean(context, DEFAULT_SHARED_PREFS_BATTERY_SAVER, isEnabled);
}
@@ -221,18 +229,6 @@ public class PreferenceHelper {
putString(context, PREFERRED_CITY, city);
}
- /* public static Boolean useTor(SharedPreferences preferences) {
- return preferences.getBoolean(USE_TOR, true);
- }
-
- public static boolean useTor(Context context) {
- return getBoolean(context, USE_TOR, true);
- }
-
- public static void setUseTor(Context context, boolean useTor) {
- putBoolean(context, USE_TOR, useTor);
- }*/
-
public static JSONObject getEipDefinitionFromPreferences(SharedPreferences preferences) {
JSONObject result = new JSONObject();
try {