fix: alpha update message
This commit is contained in:
parent
126bc6134e
commit
4b413b78fe
1 changed files with 18 additions and 16 deletions
|
@ -126,23 +126,25 @@ object AppUpdater {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun compareVersion(version: String): Boolean {
|
private fun compareVersion(version: String): Boolean {
|
||||||
if (BuildConfig.BUILD_TYPE == "debug" || BuildConfig.BUILD_TYPE == "alpha") {
|
return when (BuildConfig.BUILD_TYPE) {
|
||||||
return BuildConfig.VERSION_NAME != version
|
"debug" -> BuildConfig.VERSION_NAME != version
|
||||||
} else {
|
"alpha" -> false
|
||||||
fun toDouble(list: List<String>): Double {
|
else -> {
|
||||||
return list.mapIndexed { i: Int, s: String ->
|
fun toDouble(list: List<String>): Double {
|
||||||
when (i) {
|
return list.mapIndexed { i: Int, s: String ->
|
||||||
0 -> s.toDouble() * 100
|
when (i) {
|
||||||
1 -> s.toDouble() * 10
|
0 -> s.toDouble() * 100
|
||||||
2 -> s.toDouble()
|
1 -> s.toDouble() * 10
|
||||||
else -> s.toDoubleOrNull() ?: 0.0
|
2 -> s.toDouble()
|
||||||
}
|
else -> s.toDoubleOrNull() ?: 0.0
|
||||||
}.sum()
|
}
|
||||||
}
|
}.sum()
|
||||||
|
}
|
||||||
|
|
||||||
val new = toDouble(version.split("."))
|
val new = toDouble(version.split("."))
|
||||||
val curr = toDouble(BuildConfig.VERSION_NAME.split("."))
|
val curr = toDouble(BuildConfig.VERSION_NAME.split("."))
|
||||||
return new > curr
|
new > curr
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue