Implement client limiting and MAC address filtering

This commit is contained in:
Mygod
2020-07-04 05:43:24 +08:00
parent 46d0544df2
commit 278f3f143b
6 changed files with 133 additions and 13 deletions

View File

@@ -1,7 +1,9 @@
package be.mygod.vpnhotspot.manage
import android.annotation.TargetApi
import android.content.ClipData
import android.content.Intent
import android.net.MacAddress
import android.os.Build
import android.provider.Settings
import android.view.View
@@ -161,6 +163,14 @@ sealed class TetherManager(protected val parent: TetheringFragment) : Manager(),
capability = maxSupportedClients to supportedFeatures
data.notifyChange()
}
override fun onBlockedClientConnecting(client: MacAddress, blockedReason: Int) {
SmartSnackbar.make(parent.getString(R.string.tethering_manage_wifi_client_blocked, client,
WifiApManager.clientBlockLookup(blockedReason, true))).apply {
action(R.string.tethering_manage_wifi_copy_mac) {
app.clipboard.setPrimaryClip(ClipData.newPlainText(null, client.toString()))
}
}.show()
}
override val title get() = parent.getString(R.string.tethering_manage_wifi)
override val tetherType get() = TetherType.WIFI