Tweak the app updater logic and add FOSS build support (#1843)

This commit is contained in:
AntsyLich
2025-03-18 19:36:16 +06:00
committed by GitHub
parent 7028b8673a
commit 28093935d8
11 changed files with 85 additions and 75 deletions

View File

@@ -123,7 +123,7 @@ object AboutScreen : Screen() {
versionName = result.release.version,
changelogInfo = result.release.info,
releaseLink = result.release.releaseLink,
downloadLink = result.release.getDownloadLink(),
downloadLink = result.release.downloadLink,
)
navigator.push(updateScreen)
},

View File

@@ -2,6 +2,7 @@ package eu.kanade.tachiyomi.data.updater
import android.content.Context
import eu.kanade.tachiyomi.BuildConfig
import eu.kanade.tachiyomi.util.system.isFossBuildType
import eu.kanade.tachiyomi.util.system.isPreviewBuildType
import tachiyomi.core.common.util.lang.withIOContext
import tachiyomi.domain.release.interactor.GetApplicationRelease
@@ -20,6 +21,7 @@ class AppUpdateChecker {
return withIOContext {
val result = getApplicationRelease.await(
GetApplicationRelease.Arguments(
isFossBuildType,
isPreviewBuildType,
BuildConfig.COMMIT_COUNT.toInt(),
BuildConfig.VERSION_NAME,

View File

@@ -38,7 +38,7 @@ internal class AppUpdateNotifier(private val context: Context) {
fun promptUpdate(release: Release) {
val updateIntent = NotificationReceiver.downloadAppUpdatePendingBroadcast(
context,
release.getDownloadLink(),
release.downloadLink,
release.version,
)

View File

@@ -312,7 +312,7 @@ class MainActivity : BaseActivity() {
versionName = result.release.version,
changelogInfo = result.release.info,
releaseLink = result.release.releaseLink,
downloadLink = result.release.getDownloadLink(),
downloadLink = result.release.downloadLink,
)
navigator.push(updateScreen)
}

View File

@@ -18,3 +18,6 @@ val isPreviewBuildType: Boolean
val isReleaseBuildType: Boolean
inline get() = BuildConfig.BUILD_TYPE == "release"
val isFossBuildType: Boolean
inline get() = BuildConfig.BUILD_TYPE == "foss"