Prompt Extension update if ext-lib is updated

Co-authored-by: arkon <arkon@users.noreply.github.com>
This commit is contained in:
AntsyLich
2022-10-28 16:37:59 +06:00
committed by arkon
parent 3e86cb094b
commit e1ab1fdb65
4 changed files with 32 additions and 16 deletions
@@ -100,7 +100,7 @@ internal class ExtensionGithubApi {
private fun List<ExtensionJsonObject>.toExtensions(): List<Extension.Available> {
return this
.filter {
val libVersion = it.version.substringBeforeLast('.').toDouble()
val libVersion = it.extractLibVersion()
libVersion >= ExtensionLoader.LIB_VERSION_MIN && libVersion <= ExtensionLoader.LIB_VERSION_MAX
}
.map {
@@ -109,6 +109,7 @@ internal class ExtensionGithubApi {
pkgName = it.pkg,
versionName = it.version,
versionCode = it.code,
libVersion = it.extractLibVersion(),
lang = it.lang,
isNsfw = it.nsfw == 1,
hasReadme = it.hasReadme == 1,
@@ -142,6 +143,10 @@ internal class ExtensionGithubApi {
REPO_URL_PREFIX
}
}
private fun ExtensionJsonObject.extractLibVersion(): Double {
return version.substringBeforeLast('.').toDouble()
}
}
private const val REPO_URL_PREFIX = "https://raw.githubusercontent.com/tachiyomiorg/tachiyomi-extensions/repo/"