Refine code style
This commit is contained in:
@@ -11,7 +11,6 @@ import android.net.wifi.p2p.*
|
||||
import android.os.Build
|
||||
import android.os.Looper
|
||||
import android.provider.Settings
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.annotation.StringRes
|
||||
import androidx.core.content.edit
|
||||
import be.mygod.librootkotlinx.useParcel
|
||||
@@ -162,7 +161,8 @@ class RepeaterService : Service(), CoroutineScope, WifiP2pManager.ChannelListene
|
||||
RootManager.use { server ->
|
||||
if (deinitPending.getAndSet(false)) server.execute(RepeaterCommands.Deinit())
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
val groups = server.execute(RepeaterCommands.RequestPersistentGroupInfo()).value as List<WifiP2pGroup>
|
||||
val groups = server.execute(RepeaterCommands.RequestPersistentGroupInfo())
|
||||
.value as List<WifiP2pGroup>
|
||||
for (group in groups.filterUselessGroups()) {
|
||||
server.execute(RepeaterCommands.DeletePersistentGroup(group.networkId))?.value.print(group)
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@ import be.mygod.vpnhotspot.net.wifi.WifiDoubleLock
|
||||
import be.mygod.vpnhotspot.widget.SmartSnackbar
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import timber.log.Timber
|
||||
import java.net.NetworkInterface
|
||||
|
||||
abstract class RoutingManager(private val caller: Any, val downstream: String, private val forceWifi: Boolean = false) {
|
||||
companion object {
|
||||
@@ -17,8 +16,9 @@ abstract class RoutingManager(private val caller: Any, val downstream: String, p
|
||||
var masqueradeMode: Routing.MasqueradeMode
|
||||
@TargetApi(28) get() = app.pref.run {
|
||||
getString(KEY_MASQUERADE_MODE, null)?.let { return@run Routing.MasqueradeMode.valueOf(it) }
|
||||
if (getBoolean("service.masquerade", true)) // legacy settings
|
||||
Routing.MasqueradeMode.Simple else Routing.MasqueradeMode.None
|
||||
if (getBoolean("service.masquerade", true)) { // legacy settings
|
||||
Routing.MasqueradeMode.Simple
|
||||
} else Routing.MasqueradeMode.None
|
||||
}.let {
|
||||
// older app version enabled netd for everyone. should check again here
|
||||
if (Build.VERSION.SDK_INT >= 28 || it != Routing.MasqueradeMode.Netd) it
|
||||
|
||||
@@ -7,9 +7,7 @@ import android.net.wifi.SoftApConfiguration
|
||||
import android.net.wifi.WifiManager
|
||||
import android.os.Build
|
||||
import androidx.annotation.RequiresApi
|
||||
import be.mygod.vpnhotspot.App
|
||||
import be.mygod.vpnhotspot.App.Companion.app
|
||||
import be.mygod.vpnhotspot.net.TetheringManager
|
||||
import be.mygod.vpnhotspot.net.wifi.SoftApConfigurationCompat.Companion.toCompat
|
||||
import be.mygod.vpnhotspot.util.Services
|
||||
|
||||
|
||||
Reference in New Issue
Block a user