Skip to content

Commit

Permalink
fix: version.kt
Browse files Browse the repository at this point in the history
  • Loading branch information
septs committed Jun 4, 2024
1 parent 87a29d7 commit 1b8c1a3
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions app/src/main/java/app/septs/euiccprobe/Version.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,17 @@ object Version {
}

fun getFirmwareVersion(): String? {
val properties = SystemProperties.getAll()
return properties["ro.mi.os.version.code"]?.let { "HyperOS $it" }
?: properties["ro.miui.ui.version.name"]?.let { "MIUI $it" }
?: properties["ro.build.version.oneui"]?.let { "OneUI $it" }
val fields = listOf(
Pair("ro.mi.os.version.code", "HyperOS"),
Pair("ro.miui.ui.version.name", "MIUI"),
Pair("ro.build.version.oneui", "OneUI"),
)
for (pair in fields) {
val version = SystemProperties[pair.first]
if (version.isNotEmpty()) {
return "${pair.second} $version"
}
}
return null
}
}

0 comments on commit 1b8c1a3

Please sign in to comment.