summaryrefslogtreecommitdiff
path: root/app/src/main
diff options
context:
space:
mode:
authorcyberta <cyberta@riseup.net>2020-01-25 14:01:18 -0600
committercyberta <cyberta@riseup.net>2020-01-25 14:01:18 -0600
commite29188b051aa57939e56d5fc9110eddb1d9a4bdf (patch)
treed49de8a5403d87e9e4092f0987a0480809ed9b0b /app/src/main
parentc5bb5c18a8884410580b589aa6e8f6aaca046764 (diff)
initiate configuring task
Diffstat (limited to 'app/src/main')
-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();