diff options
author | cyBerta <cyberta@riseup.net> | 2021-11-09 23:33:55 +0100 |
---|---|---|
committer | cyBerta <cyberta@riseup.net> | 2021-11-09 23:33:55 +0100 |
commit | 7cd76c3eb08f89be94642a57eca7d929d8d72c6d (patch) | |
tree | bdac4e2805168ef0fc19b944dc655b8ab09d347e | |
parent | 21927a346f6b2e948da254e8d1dbca7e0a49aa91 (diff) |
check tor preferences before initiating a tor service connection
-rw-r--r-- | app/src/main/java/se/leap/bitmaskclient/base/utils/PreferenceHelper.java | 4 | ||||
-rw-r--r-- | app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderAPI.java | 2 |
2 files changed, 5 insertions, 1 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 7bbd032e..06fb25e9 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 @@ -165,6 +165,10 @@ public class PreferenceHelper { return preferences.getBoolean(USE_TOR, true); } + public static Boolean getUseTor(Context context) { + return getBoolean(context, USE_TOR, true); + } + public static void saveBattery(Context context, boolean isEnabled) { putBoolean(context, DEFAULT_SHARED_PREFS_BATTERY_SAVER, isEnabled); } diff --git a/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderAPI.java b/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderAPI.java index c45d7ae9..94d3e0de 100644 --- a/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderAPI.java +++ b/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderAPI.java @@ -212,7 +212,7 @@ public class ProviderAPI extends JobIntentService implements ProviderApiManagerB * @throws IllegalStateException thrown if this method was not called from a background thread */ private void initTorServiceConnection(Context context) throws InterruptedException, IllegalStateException { - if (PreferenceHelper.getUseBridges(context)) { + if (PreferenceHelper.getUseTor(context)) { if (torServiceConnection == null) { Log.d(TAG, "serviceConnection is still null"); if (!TorService.hasClientTransportPlugin()) { |