This commit is contained in:
Mygod
2019-02-01 15:33:47 +08:00
parent 13e4819511
commit 8682c9dd43
3 changed files with 6 additions and 5 deletions

View File

@@ -5,7 +5,6 @@ import android.content.Intent
import android.content.SharedPreferences import android.content.SharedPreferences
import android.content.res.Configuration import android.content.res.Configuration
import android.net.NetworkInfo import android.net.NetworkInfo
import android.net.wifi.WpsInfo
import android.net.wifi.p2p.WifiP2pDevice import android.net.wifi.p2p.WifiP2pDevice
import android.net.wifi.p2p.WifiP2pGroup import android.net.wifi.p2p.WifiP2pGroup
import android.net.wifi.p2p.WifiP2pInfo import android.net.wifi.p2p.WifiP2pInfo
@@ -68,13 +67,14 @@ class RepeaterService : Service(), WifiP2pManager.ChannelListener, SharedPrefere
val groupChanged = StickyEvent1 { group } val groupChanged = StickyEvent1 { group }
var thisDevice: WifiP2pDevice? = null var thisDevice: WifiP2pDevice? = null
@Deprecated("WPS was deprecated RIP")
fun startWps(pin: String? = null) { fun startWps(pin: String? = null) {
val channel = channel val channel = channel
if (channel == null) SmartSnackbar.make(R.string.repeater_failure_disconnected).show() if (channel == null) SmartSnackbar.make(R.string.repeater_failure_disconnected).show()
else if (active) p2pManager.startWps(channel, WpsInfo().apply { else @Suppress("DEPRECATION") if (active) p2pManager.startWps(channel, android.net.wifi.WpsInfo().apply {
setup = if (pin == null) WpsInfo.PBC else { setup = if (pin == null) android.net.wifi.WpsInfo.PBC else {
this.pin = pin this.pin = pin
WpsInfo.KEYPAD android.net.wifi.WpsInfo.KEYPAD
} }
}, object : WifiP2pManager.ActionListener { }, object : WifiP2pManager.ActionListener {
override fun onSuccess() = SmartSnackbar.make( override fun onSuccess() = SmartSnackbar.make(

View File

@@ -6,6 +6,7 @@
<string name="title_clients">已连设备</string> <string name="title_clients">已连设备</string>
<string name="title_settings">设置选项</string> <string name="title_settings">设置选项</string>
<string name="repeater_wps">WPS不安全</string>
<string name="repeater_wps_dialog_title">输入 PIN</string> <string name="repeater_wps_dialog_title">输入 PIN</string>
<string name="repeater_wps_dialog_pbc">一键加密</string> <string name="repeater_wps_dialog_pbc">一键加密</string>
<string name="repeater_wps_success_pbc">请在 2 分钟内在需要连接的设备上使用一键加密以连接到此中继。</string> <string name="repeater_wps_success_pbc">请在 2 分钟内在需要连接的设备上使用一键加密以连接到此中继。</string>

View File

@@ -15,7 +15,7 @@
<string name="title_clients">Clients</string> <string name="title_clients">Clients</string>
<string name="title_settings">Settings</string> <string name="title_settings">Settings</string>
<string name="repeater_wps">WPS</string> <string name="repeater_wps">WPS (insecure)</string>
<string name="repeater_wps_dialog_title">Enter PIN</string> <string name="repeater_wps_dialog_title">Enter PIN</string>
<string name="repeater_wps_dialog_pbc">Push Button</string> <string name="repeater_wps_dialog_pbc">Push Button</string>
<string name="repeater_wps_success_pbc">Please use WPS push button within the next 2 minutes to connect your <string name="repeater_wps_success_pbc">Please use WPS push button within the next 2 minutes to connect your