Detect miui
parent
e8f9d22128
commit
74fe786c00
@ -0,0 +1,18 @@
|
||||
package org.koitharu.kotatsu.core.os
|
||||
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import org.jetbrains.annotations.Blocking
|
||||
import org.koitharu.kotatsu.parsers.util.suspendlazy.suspendLazy
|
||||
import java.io.InputStreamReader
|
||||
|
||||
object RomCompat {
|
||||
|
||||
val isMiui = suspendLazy<Boolean>(Dispatchers.IO) {
|
||||
getProp("ro.miui.ui.version.name").isNotEmpty()
|
||||
}
|
||||
|
||||
@Blocking
|
||||
private fun getProp(propName: String) = Runtime.getRuntime().exec("getprop $propName").inputStream.use {
|
||||
it.reader().use(InputStreamReader::readText).trim()
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue