From 7cd76c3eb08f89be94642a57eca7d929d8d72c6d Mon Sep 17 00:00:00 2001 From: cyBerta Date: Tue, 9 Nov 2021 23:33:55 +0100 Subject: check tor preferences before initiating a tor service connection --- .../main/java/se/leap/bitmaskclient/base/utils/PreferenceHelper.java | 4 ++++ .../main/java/se/leap/bitmaskclient/providersetup/ProviderAPI.java | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'app/src/main') 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()) { -- cgit v1.2.3