fixed the fucking updater 💀

This commit is contained in:
LagradOst 2023-09-18 22:28:26 +02:00
parent 0d2a19b350
commit 2ae5b6cefb
2 changed files with 9 additions and 8 deletions

View File

@ -58,8 +58,8 @@ android {
minSdk = 21
targetSdk = 33
versionCode = 61
versionName = "4.1.10"
versionCode = 62
versionName = "4.2.0"
resValue("string", "app_version", "${defaultConfig.versionName}${versionNameSuffix ?: ""}")
resValue("string", "commit_hash", "git rev-parse --short HEAD".execute() ?: "")

View File

@ -109,18 +109,19 @@ class InAppUpdater {
releases.sortedWith(compareBy {
versionRegex.find(it.name)?.groupValues?.get(2)
}).toList().lastOrNull()*/
val found =
val foundList =
response.filter { rel ->
!rel.prerelease
}.sortedWith(compareBy { release ->
release.assets.filter { it.content_type == "application/vnd.android.package-archive" }
.getOrNull(0)?.name?.let { it1 ->
release.assets.firstOrNull { it.content_type == "application/vnd.android.package-archive" }?.name?.let { it1 ->
versionRegex.find(
it1
)?.groupValues?.get(2)
)?.groupValues?.let {
it[3].toInt() * 100_000_000 + it[4].toInt() * 10_000 + it[5].toInt()
}
}
}).toList().lastOrNull()
}).toList()
val found = foundList.lastOrNull()
val foundAsset = found?.assets?.getOrNull(0)
val currentVersion = packageName?.let {
packageManager.getPackageInfo(