This commit is contained in:
Your Name
2024-03-04 00:55:39 -06:00
parent ee32da95af
commit c7272190a8
80 changed files with 361 additions and 348 deletions

View File

@@ -220,6 +220,7 @@
<action android:name="hanson.xyz.vpnhotspotmod.WIFI_TETHER_STOP" />
<action android:name="hanson.xyz.vpnhotspotmod.BT_TETHER_START" />
<action android:name="hanson.xyz.vpnhotspotmod.BT_TETHER_STOP" />
<action android:name="android.net.conn.TETHER_STATE_CHANGED" />
</intent-filter>
</receiver>

View File

@@ -75,7 +75,7 @@ class MyBroadcastReceiver : BroadcastReceiver(), TetheringManager.StartTethering
for (startable in config.startables.values) startable.start(App.app)
}
TetheringManager.startTethering(TetheringManager.TETHERING_WIFI, false, this)
Toast.makeText(context, "Started tethering", Toast.LENGTH_SHORT).show()
}
if (intent.action.toString().contains("WIFI_TETHER_STOP")) {
TetheringManager.stopTethering(TetheringManager.TETHERING_WIFI)
@@ -83,11 +83,13 @@ class MyBroadcastReceiver : BroadcastReceiver(), TetheringManager.StartTethering
if (intent.action.toString().contains("android.net.conn.TETHER_STATE_CHANGED")) {
@Suppress("UNCHECKED_CAST")
val tetheredInterfaces = intent.getStringArrayListExtra("tetherArray")
Toast.makeText(context, "Tethering interfaces changed", Toast.LENGTH_SHORT).show()
tetheredInterfaces?.forEach { iface ->
Intent(context, TetheringService::class.java).apply {
putExtra(TetheringService.EXTRA_ADD_INTERFACES, arrayOf(iface))
context.startForegroundService(this)
}
Toast.makeText(context, "Monitoring service called for $iface", Toast.LENGTH_SHORT).show()
}
}
}