summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/firewall/FirewallManager.java6
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/fragments/TetheringDialog.java10
2 files changed, 15 insertions, 1 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/firewall/FirewallManager.java b/app/src/main/java/se/leap/bitmaskclient/firewall/FirewallManager.java
index a7cb2253..ce402ef8 100644
--- a/app/src/main/java/se/leap/bitmaskclient/firewall/FirewallManager.java
+++ b/app/src/main/java/se/leap/bitmaskclient/firewall/FirewallManager.java
@@ -19,6 +19,7 @@ package se.leap.bitmaskclient.firewall;
import android.content.Context;
import de.blinkt.openvpn.core.VpnStatus;
+import se.leap.bitmaskclient.tethering.TetheringState;
import se.leap.bitmaskclient.utils.PreferenceHelper;
@@ -81,4 +82,9 @@ public class FirewallManager implements FirewallCallback {
task.execute();
}
+ public void configureTethering(TetheringState state) {
+ ConfigureTetheringTask task = new ConfigureTetheringTask(this);
+ task.execute(state);
+ }
+
}
diff --git a/app/src/main/java/se/leap/bitmaskclient/fragments/TetheringDialog.java b/app/src/main/java/se/leap/bitmaskclient/fragments/TetheringDialog.java
index 1d125245..a8f96986 100644
--- a/app/src/main/java/se/leap/bitmaskclient/fragments/TetheringDialog.java
+++ b/app/src/main/java/se/leap/bitmaskclient/fragments/TetheringDialog.java
@@ -27,7 +27,9 @@ import butterknife.ButterKnife;
import butterknife.InjectView;
import se.leap.bitmaskclient.R;
import se.leap.bitmaskclient.eip.EipCommand;
+import se.leap.bitmaskclient.firewall.FirewallManager;
import se.leap.bitmaskclient.tethering.TetheringObservable;
+import se.leap.bitmaskclient.tethering.TetheringState;
import se.leap.bitmaskclient.utils.PreferenceHelper;
import se.leap.bitmaskclient.views.IconCheckboxEntry;
@@ -137,7 +139,13 @@ public class TetheringDialog extends AppCompatDialogFragment implements Observer
PreferenceHelper.wifiTethering(getContext(), dataset[0].checked);
PreferenceHelper.usbTethering(getContext(), dataset[1].checked);
PreferenceHelper.bluetoothTethering(getContext(), dataset[2].checked);
- EipCommand.configureTethering(getContext());
+ FirewallManager firewallManager = new FirewallManager(getContext().getApplicationContext());
+ TetheringState runningTethering = TetheringObservable.getInstance().getTetheringState();
+ TetheringState vpnTethering = new TetheringState();
+ vpnTethering.isWifiTetheringEnabled = runningTethering.isWifiTetheringEnabled && dataset[0].checked;
+ vpnTethering.isUsbTetheringEnabled = runningTethering.isUsbTetheringEnabled && dataset[1].checked;
+ vpnTethering.isBluetoothTetheringEnabled = runningTethering.isBluetoothTetheringEnabled && dataset[2].checked;
+ firewallManager.configureTethering(vpnTethering);
})
.setNegativeButton(R.string.cancel, (dialog, id) -> dialog.cancel());
return builder.create();