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 minSdk = 21
targetSdk = 33 targetSdk = 33
versionCode = 61 versionCode = 62
versionName = "4.1.10" versionName = "4.2.0"
resValue("string", "app_version", "${defaultConfig.versionName}${versionNameSuffix ?: ""}") resValue("string", "app_version", "${defaultConfig.versionName}${versionNameSuffix ?: ""}")
resValue("string", "commit_hash", "git rev-parse --short HEAD".execute() ?: "") resValue("string", "commit_hash", "git rev-parse --short HEAD".execute() ?: "")

View file

@ -109,18 +109,19 @@ class InAppUpdater {
releases.sortedWith(compareBy { releases.sortedWith(compareBy {
versionRegex.find(it.name)?.groupValues?.get(2) versionRegex.find(it.name)?.groupValues?.get(2)
}).toList().lastOrNull()*/ }).toList().lastOrNull()*/
val found = val foundList =
response.filter { rel -> response.filter { rel ->
!rel.prerelease !rel.prerelease
}.sortedWith(compareBy { release -> }.sortedWith(compareBy { release ->
release.assets.filter { it.content_type == "application/vnd.android.package-archive" } release.assets.firstOrNull { it.content_type == "application/vnd.android.package-archive" }?.name?.let { it1 ->
.getOrNull(0)?.name?.let { it1 ->
versionRegex.find( versionRegex.find(
it1 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 foundAsset = found?.assets?.getOrNull(0)
val currentVersion = packageName?.let { val currentVersion = packageName?.let {
packageManager.getPackageInfo( packageManager.getPackageInfo(