summaryrefslogtreecommitdiff
path: root/app/src/main
diff options
context:
space:
mode:
authorcyBerta <cyberta@riseup.net>2021-10-23 00:59:46 +0200
committercyBerta <cyberta@riseup.net>2021-10-23 00:59:46 +0200
commit62d2bdacec6c54f4453f1ad20425e99254998e9a (patch)
tree747403fdc550e54e6201fd464ccdc49d25bb5011 /app/src/main
parent1640f7bbfa53b84ebf539f027d5cc3c9ba441401 (diff)
rename usePluggableTransports prefrence to useBridges, start snowflake if useBridges is true
Diffstat (limited to 'app/src/main')
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/base/MainActivity.java2
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/base/fragments/GatewaySelectionFragment.java4
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/base/fragments/MainActivityErrorDialog.java11
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/base/fragments/NavigationDrawerFragment.java12
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/base/models/Constants.java2
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/base/utils/PreferenceHelper.java20
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/eip/EIP.java6
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java5
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderAPI.java2
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderApiManagerBase.java2
10 files changed, 34 insertions, 32 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/base/MainActivity.java b/app/src/main/java/se/leap/bitmaskclient/base/MainActivity.java
index 99f6826f..18ac8b7c 100644
--- a/app/src/main/java/se/leap/bitmaskclient/base/MainActivity.java
+++ b/app/src/main/java/se/leap/bitmaskclient/base/MainActivity.java
@@ -195,7 +195,7 @@ public class MainActivity extends AppCompatActivity implements EipSetupListener,
storeProviderInPreferences(preferences, provider);
ProviderObservable.getInstance().updateProvider(provider);
if (!provider.supportsPluggableTransports()) {
- PreferenceHelper.usePluggableTransports(this, false);
+ PreferenceHelper.useBridges(this, false);
}
navigationDrawerFragment.refresh();
diff --git a/app/src/main/java/se/leap/bitmaskclient/base/fragments/GatewaySelectionFragment.java b/app/src/main/java/se/leap/bitmaskclient/base/fragments/GatewaySelectionFragment.java
index 84024962..d1222cd7 100644
--- a/app/src/main/java/se/leap/bitmaskclient/base/fragments/GatewaySelectionFragment.java
+++ b/app/src/main/java/se/leap/bitmaskclient/base/fragments/GatewaySelectionFragment.java
@@ -56,7 +56,7 @@ import static android.view.View.VISIBLE;
import static se.leap.bitmaskclient.base.MainActivity.ACTION_SHOW_VPN_FRAGMENT;
import static se.leap.bitmaskclient.base.models.Constants.PREFERRED_CITY;
import static se.leap.bitmaskclient.base.models.Constants.SHARED_PREFERENCES;
-import static se.leap.bitmaskclient.base.models.Constants.USE_PLUGGABLE_TRANSPORTS;
+import static se.leap.bitmaskclient.base.models.Constants.USE_BRIDGES;
import static se.leap.bitmaskclient.base.utils.PreferenceHelper.getPreferredCity;
import static se.leap.bitmaskclient.base.utils.PreferenceHelper.setPreferredCity;
@@ -162,7 +162,7 @@ public class GatewaySelectionFragment extends Fragment implements SharedPreferen
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
- if (USE_PLUGGABLE_TRANSPORTS.equals(key)) {
+ if (USE_BRIDGES.equals(key)) {
locationListAdapter.updateData(gatewaysManager.getGatewayLocations());
setVpnButtonState();
} else if (PREFERRED_CITY.equals(key)) {
diff --git a/app/src/main/java/se/leap/bitmaskclient/base/fragments/MainActivityErrorDialog.java b/app/src/main/java/se/leap/bitmaskclient/base/fragments/MainActivityErrorDialog.java
index 4034bd04..86f8471c 100644
--- a/app/src/main/java/se/leap/bitmaskclient/base/fragments/MainActivityErrorDialog.java
+++ b/app/src/main/java/se/leap/bitmaskclient/base/fragments/MainActivityErrorDialog.java
@@ -18,7 +18,6 @@ package se.leap.bitmaskclient.base.fragments;
import android.app.Dialog;
import android.content.Context;
-import android.content.DialogInterface;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@@ -42,8 +41,8 @@ import static se.leap.bitmaskclient.eip.EIP.EIPErrors.UNKNOWN;
import static se.leap.bitmaskclient.eip.EIP.EIPErrors.valueOf;
import static se.leap.bitmaskclient.eip.EIP.ERRORS;
import static se.leap.bitmaskclient.eip.EIP.ERRORID;
-import static se.leap.bitmaskclient.base.utils.PreferenceHelper.getUsePluggableTransports;
-import static se.leap.bitmaskclient.base.utils.PreferenceHelper.usePluggableTransports;
+import static se.leap.bitmaskclient.base.utils.PreferenceHelper.getUseBridges;
+import static se.leap.bitmaskclient.base.utils.PreferenceHelper.useBridges;
/**
* Implements an error dialog for the main activity.
@@ -129,14 +128,14 @@ public class MainActivityErrorDialog extends DialogFragment {
EipCommand.startVPN(applicationContext, false);
});
} else if (provider.supportsPluggableTransports()) {
- if (getUsePluggableTransports(applicationContext)) {
+ if (getUseBridges(applicationContext)) {
builder.setPositiveButton(warning_option_try_ovpn, ((dialog, which) -> {
- usePluggableTransports(applicationContext, false);
+ useBridges(applicationContext, false);
EipCommand.startVPN(applicationContext, false);
}));
} else {
builder.setPositiveButton(warning_option_try_pt, ((dialog, which) -> {
- usePluggableTransports(applicationContext, true);
+ useBridges(applicationContext, true);
EipCommand.startVPN(applicationContext, false);
}));
}
diff --git a/app/src/main/java/se/leap/bitmaskclient/base/fragments/NavigationDrawerFragment.java b/app/src/main/java/se/leap/bitmaskclient/base/fragments/NavigationDrawerFragment.java
index f905a7d2..a13692a5 100644
--- a/app/src/main/java/se/leap/bitmaskclient/base/fragments/NavigationDrawerFragment.java
+++ b/app/src/main/java/se/leap/bitmaskclient/base/fragments/NavigationDrawerFragment.java
@@ -76,7 +76,7 @@ import static se.leap.bitmaskclient.base.models.Constants.PROVIDER_KEY;
import static se.leap.bitmaskclient.base.models.Constants.REQUEST_CODE_SWITCH_PROVIDER;
import static se.leap.bitmaskclient.base.models.Constants.SHARED_PREFERENCES;
import static se.leap.bitmaskclient.base.models.Constants.USE_IPv6_FIREWALL;
-import static se.leap.bitmaskclient.base.models.Constants.USE_PLUGGABLE_TRANSPORTS;
+import static se.leap.bitmaskclient.base.models.Constants.USE_BRIDGES;
import static se.leap.bitmaskclient.R.string.about_fragment_title;
import static se.leap.bitmaskclient.R.string.exclude_apps_fragment_title;
import static se.leap.bitmaskclient.R.string.log_fragment_title;
@@ -84,10 +84,10 @@ import static se.leap.bitmaskclient.base.utils.ConfigHelper.isDefaultBitmask;
import static se.leap.bitmaskclient.base.utils.PreferenceHelper.getPreferredCity;
import static se.leap.bitmaskclient.base.utils.PreferenceHelper.getSaveBattery;
import static se.leap.bitmaskclient.base.utils.PreferenceHelper.getShowAlwaysOnDialog;
-import static se.leap.bitmaskclient.base.utils.PreferenceHelper.getUsePluggableTransports;
+import static se.leap.bitmaskclient.base.utils.PreferenceHelper.getUseBridges;
import static se.leap.bitmaskclient.base.utils.PreferenceHelper.saveBattery;
import static se.leap.bitmaskclient.base.utils.PreferenceHelper.showExperimentalFeatures;
-import static se.leap.bitmaskclient.base.utils.PreferenceHelper.usePluggableTransports;
+import static se.leap.bitmaskclient.base.utils.PreferenceHelper.useBridges;
/**
* Fragment used for managing interactions for and presentation of a navigation drawer.
@@ -300,12 +300,12 @@ public class NavigationDrawerFragment extends Fragment implements SharedPreferen
IconSwitchEntry useBridges = drawerView.findViewById(R.id.bridges_switch);
if (ProviderObservable.getInstance().getCurrentProvider().supportsPluggableTransports()) {
useBridges.setVisibility(VISIBLE);
- useBridges.setChecked(getUsePluggableTransports(getContext()));
+ useBridges.setChecked(getUseBridges(getContext()));
useBridges.setOnCheckedChangeListener((buttonView, isChecked) -> {
if (!buttonView.isPressed()) {
return;
}
- usePluggableTransports(getContext(), isChecked);
+ useBridges(getContext(), isChecked);
if (VpnStatus.isVPNActive()) {
EipCommand.startVPN(getContext(), false);
closeDrawer();
@@ -675,7 +675,7 @@ public class NavigationDrawerFragment extends Fragment implements SharedPreferen
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
- if (key.equals(USE_PLUGGABLE_TRANSPORTS)) {
+ if (key.equals(USE_BRIDGES)) {
initUseBridgesEntry();
} else if (key.equals(USE_IPv6_FIREWALL)) {
initFirewallEntry();
diff --git a/app/src/main/java/se/leap/bitmaskclient/base/models/Constants.java b/app/src/main/java/se/leap/bitmaskclient/base/models/Constants.java
index f627a24e..d91880c6 100644
--- a/app/src/main/java/se/leap/bitmaskclient/base/models/Constants.java
+++ b/app/src/main/java/se/leap/bitmaskclient/base/models/Constants.java
@@ -32,7 +32,7 @@ public interface Constants {
String CLEARLOG = "clearlogconnect";
String LAST_USED_PROFILE = "last_used_profile";
String EXCLUDED_APPS = "excluded_apps";
- String USE_PLUGGABLE_TRANSPORTS = "usePluggableTransports";
+ String USE_BRIDGES = "usePluggableTransports";
String ALLOW_TETHERING_BLUETOOTH = "tethering_bluetooth";
String ALLOW_TETHERING_WIFI = "tethering_wifi";
String ALLOW_TETHERING_USB = "tethering_usb";
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 cbea2815..28242388 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
@@ -33,8 +33,7 @@ import static se.leap.bitmaskclient.base.models.Constants.RESTART_ON_UPDATE;
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_PLUGGABLE_TRANSPORTS;
-import static se.leap.bitmaskclient.base.models.Constants.USE_TOR;
+import static se.leap.bitmaskclient.base.models.Constants.USE_BRIDGES;
/**
* Created by cyberta on 18.03.18.
@@ -141,12 +140,17 @@ public class PreferenceHelper {
return getBoolean(context, RESTART_ON_UPDATE, false);
}
- public static boolean getUsePluggableTransports(Context context) {
- return getBoolean(context, USE_PLUGGABLE_TRANSPORTS, false);
+
+ public static boolean getUseBridges(SharedPreferences preferences) {
+ return preferences.getBoolean(USE_BRIDGES, false);
+ }
+
+ public static boolean getUseBridges(Context context) {
+ return getBoolean(context, USE_BRIDGES, false);
}
- public static void usePluggableTransports(Context context, boolean isEnabled) {
- putBoolean(context, USE_PLUGGABLE_TRANSPORTS, isEnabled);
+ public static void useBridges(Context context, boolean isEnabled) {
+ putBoolean(context, USE_BRIDGES, isEnabled);
}
public static void saveBattery(Context context, boolean isEnabled) {
@@ -213,7 +217,7 @@ public class PreferenceHelper {
putString(context, PREFERRED_CITY, city);
}
- public static Boolean useTor(SharedPreferences preferences) {
+ /* public static Boolean useTor(SharedPreferences preferences) {
return preferences.getBoolean(USE_TOR, true);
}
@@ -223,7 +227,7 @@ public class PreferenceHelper {
public static void setUseTor(Context context, boolean useTor) {
putBoolean(context, USE_TOR, useTor);
- }
+ }*/
public static JSONObject getEipDefinitionFromPreferences(SharedPreferences preferences) {
JSONObject result = new JSONObject();
diff --git a/app/src/main/java/se/leap/bitmaskclient/eip/EIP.java b/app/src/main/java/se/leap/bitmaskclient/eip/EIP.java
index 6919a532..dd9054f1 100644
--- a/app/src/main/java/se/leap/bitmaskclient/eip/EIP.java
+++ b/app/src/main/java/se/leap/bitmaskclient/eip/EIP.java
@@ -85,7 +85,7 @@ import static se.leap.bitmaskclient.base.models.Constants.PROVIDER_VPN_CERTIFICA
import static se.leap.bitmaskclient.base.models.Constants.SHARED_PREFERENCES;
import static se.leap.bitmaskclient.base.utils.ConfigHelper.ensureNotOnMainThread;
import static se.leap.bitmaskclient.base.utils.PreferenceHelper.getPreferredCity;
-import static se.leap.bitmaskclient.base.utils.PreferenceHelper.getUsePluggableTransports;
+import static se.leap.bitmaskclient.base.utils.PreferenceHelper.getUseBridges;
import static se.leap.bitmaskclient.eip.EIP.EIPErrors.ERROR_INVALID_PROFILE;
import static se.leap.bitmaskclient.eip.EIP.EIPErrors.ERROR_INVALID_VPN_CERTIFICATE;
import static se.leap.bitmaskclient.eip.EIP.EIPErrors.ERROR_VPN_PREPARE;
@@ -315,7 +315,7 @@ public final class EIP extends JobIntentService implements Observer {
*/
private void launchActiveGateway(Gateway gateway, int nClosestGateway, Bundle result) {
VpnProfile profile;
- Connection.TransportType transportType = getUsePluggableTransports(this) ? OBFS4 : OPENVPN;
+ Connection.TransportType transportType = getUseBridges(this) ? OBFS4 : OPENVPN;
if (gateway == null ||
(profile = gateway.getProfile(transportType)) == null) {
String preferredLocation = getPreferredCity(getApplicationContext());
@@ -537,7 +537,7 @@ public final class EIP extends JobIntentService implements Observer {
if (isManualGatewaySelection) {
return R.string.warning_no_more_gateways_manual_gw_selection;
} else if (ProviderObservable.getInstance().getCurrentProvider().supportsPluggableTransports()) {
- if (PreferenceHelper.getUsePluggableTransports(getApplicationContext())) {
+ if (PreferenceHelper.getUseBridges(getApplicationContext())) {
return R.string.warning_no_more_gateways_use_ovpn;
} else {
return R.string.warning_no_more_gateways_use_pt;
diff --git a/app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java b/app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java
index 77ecfc5f..05775d13 100644
--- a/app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java
+++ b/app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java
@@ -32,7 +32,6 @@ import java.io.IOException;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
@@ -53,7 +52,7 @@ import static se.leap.bitmaskclient.base.models.Constants.PROVIDER_PRIVATE_KEY;
import static se.leap.bitmaskclient.base.models.Constants.PROVIDER_VPN_CERTIFICATE;
import static se.leap.bitmaskclient.base.models.Constants.SORTED_GATEWAYS;
import static se.leap.bitmaskclient.base.utils.PreferenceHelper.getPreferredCity;
-import static se.leap.bitmaskclient.base.utils.PreferenceHelper.getUsePluggableTransports;
+import static se.leap.bitmaskclient.base.utils.PreferenceHelper.getUseBridges;
/**
* @author parmegv
@@ -82,7 +81,7 @@ public class GatewaysManager {
}
public Gateway select(int nClosest, String city) {
- Connection.TransportType transportType = getUsePluggableTransports(context) ? OBFS4 : OPENVPN;
+ Connection.TransportType transportType = getUseBridges(context) ? OBFS4 : OPENVPN;
if (presortedList.size() > 0) {
return getGatewayFromPresortedList(nClosest, transportType, city);
}
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 e818f587..ceb2f2b4 100644
--- a/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderAPI.java
+++ b/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderAPI.java
@@ -197,7 +197,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) {
- if (PreferenceHelper.useTor(context)) {
+ if (PreferenceHelper.getUseBridges(context)) {
try {
if (torServiceConnection == null) {
Log.d(TAG, "serviceConnection is still null");
diff --git a/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderApiManagerBase.java b/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderApiManagerBase.java
index 780ecaed..6e07e84b 100644
--- a/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderApiManagerBase.java
+++ b/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderApiManagerBase.java
@@ -296,7 +296,7 @@ public abstract class ProviderApiManagerBase {
}
protected boolean startTorProxy() throws InterruptedException, TimeoutException {
- if (PreferenceHelper.useTor(preferences) &&
+ if (PreferenceHelper.getUseBridges(preferences) &&
EipStatus.getInstance().isDisconnected() &&
serviceCallback.isConnectedToWifi()
) {