diff --git a/mobile/src/main/java/be/mygod/vpnhotspot/RepeaterService.kt b/mobile/src/main/java/be/mygod/vpnhotspot/RepeaterService.kt index 8af0afb3..57a0eae4 100644 --- a/mobile/src/main/java/be/mygod/vpnhotspot/RepeaterService.kt +++ b/mobile/src/main/java/be/mygod/vpnhotspot/RepeaterService.kt @@ -43,13 +43,12 @@ class RepeaterService : Service(), WifiP2pManager.ChannelListener, SharedPrefere private var groups: Collection = emptyList() fun startWps(pin: String? = null) { - if (!active) return - val wps = WpsInfo() - if (pin == null) wps.setup = WpsInfo.PBC else { - wps.setup = WpsInfo.KEYPAD - wps.pin = pin - } - p2pManager.startWps(channel, wps, object : WifiP2pManager.ActionListener { + if (active) p2pManager.startWps(channel, WpsInfo().apply { + setup = if (pin == null) WpsInfo.PBC else { + this.pin = pin + WpsInfo.KEYPAD + } + }, object : WifiP2pManager.ActionListener { override fun onSuccess() = Toast.makeText(this@RepeaterService, if (pin == null) R.string.repeater_wps_success_pbc else R.string.repeater_wps_success_keypad, Toast.LENGTH_SHORT).show() diff --git a/mobile/src/main/java/be/mygod/vpnhotspot/manage/TetherManager.kt b/mobile/src/main/java/be/mygod/vpnhotspot/manage/TetherManager.kt index 27933436..31a37162 100644 --- a/mobile/src/main/java/be/mygod/vpnhotspot/manage/TetherManager.kt +++ b/mobile/src/main/java/be/mygod/vpnhotspot/manage/TetherManager.kt @@ -25,7 +25,7 @@ import be.mygod.vpnhotspot.util.setPaddingStart import com.crashlytics.android.Crashlytics import java.lang.reflect.InvocationTargetException -abstract class TetherManager private constructor(protected val parent: TetheringFragment) : Manager(), +sealed class TetherManager(protected val parent: TetheringFragment) : Manager(), TetheringManager.OnStartTetheringCallback { class ViewHolder(val binding: ListitemInterfaceBinding) : RecyclerView.ViewHolder(binding.root), View.OnClickListener {