Refine code

This commit is contained in:
Mygod
2020-12-17 12:00:59 -05:00
committed by GitHub
parent c64ce77939
commit 4eb16709ca

View File

@@ -57,9 +57,9 @@ class RepeaterService : Service(), CoroutineScope, WifiP2pManager.ChannelListene
@delegate:TargetApi(29) @delegate:TargetApi(29)
private val hasP2pValidateName by lazy { private val hasP2pValidateName by lazy {
val array = Build.VERSION.SECURITY_PATCH.split('-', limit = 3).map { it.toIntOrNull() } val array = Build.VERSION.SECURITY_PATCH.split('-', limit = 3)
val y = array.getOrNull(0) val y = array.getOrNull(0)?.toIntOrNull()
val m = array.getOrNull(1) val m = array.getOrNull(1)?.toIntOrNull()
y == null || y > 2020 || y == 2020 && (m == null || m >= 3) y == null || y > 2020 || y == 2020 && (m == null || m >= 3)
} }
val safeModeConfigurable get() = Build.VERSION.SDK_INT >= 29 && hasP2pValidateName val safeModeConfigurable get() = Build.VERSION.SDK_INT >= 29 && hasP2pValidateName