Rename preview build type to nightly and label FOSS builds (#3760)
Assisted-by: Claude:claude-opus-5
This commit is contained in:
@@ -99,7 +99,7 @@ android {
|
||||
|
||||
matchingFallbacks.addAll(commonMatchingFallbacks)
|
||||
}
|
||||
create("preview") {
|
||||
create("nightly") {
|
||||
initWith(release)
|
||||
|
||||
applicationIdSuffix = ".debug"
|
||||
@@ -121,7 +121,7 @@ android {
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
getByName("preview").res.directories.add("src/debug/res")
|
||||
getByName("nightly").res.directories.add("src/debug/res")
|
||||
getByName("benchmark").res.directories.add("src/debug/res")
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,8 @@ import eu.kanade.tachiyomi.ui.more.NewUpdateScreen
|
||||
import eu.kanade.tachiyomi.util.CrashLogUtil
|
||||
import eu.kanade.tachiyomi.util.lang.toDateTimestampString
|
||||
import eu.kanade.tachiyomi.util.system.copyToClipboard
|
||||
import eu.kanade.tachiyomi.util.system.isPreviewBuildType
|
||||
import eu.kanade.tachiyomi.util.system.isFossBuildType
|
||||
import eu.kanade.tachiyomi.util.system.isNightlyBuildType
|
||||
import eu.kanade.tachiyomi.util.system.toast
|
||||
import eu.kanade.tachiyomi.util.system.updaterEnabled
|
||||
import kotlinx.coroutines.launch
|
||||
@@ -250,8 +251,8 @@ object AboutScreen : Screen() {
|
||||
}
|
||||
}
|
||||
}
|
||||
isPreviewBuildType -> {
|
||||
"Beta r${BuildConfig.COMMIT_COUNT}".let {
|
||||
isNightlyBuildType -> {
|
||||
"Nightly r${BuildConfig.COMMIT_COUNT}".let {
|
||||
if (withBuildDate) {
|
||||
"$it (${BuildConfig.COMMIT_SHA}, ${getFormattedBuildTime()})"
|
||||
} else {
|
||||
@@ -260,7 +261,8 @@ object AboutScreen : Screen() {
|
||||
}
|
||||
}
|
||||
else -> {
|
||||
"Stable ${BuildConfig.VERSION_NAME}".let {
|
||||
val channel = if (isFossBuildType) "FOSS" else "Stable"
|
||||
"$channel v${BuildConfig.VERSION_NAME}".let {
|
||||
if (withBuildDate) {
|
||||
"$it (${getFormattedBuildTime()})"
|
||||
} else {
|
||||
|
||||
@@ -2,7 +2,7 @@ package eu.kanade.tachiyomi.data.updater
|
||||
|
||||
import eu.kanade.tachiyomi.BuildConfig
|
||||
import eu.kanade.tachiyomi.util.system.isFossBuildType
|
||||
import eu.kanade.tachiyomi.util.system.isPreviewBuildType
|
||||
import eu.kanade.tachiyomi.util.system.isNightlyBuildType
|
||||
import tachiyomi.core.common.util.lang.withIOContext
|
||||
import tachiyomi.domain.release.interactor.GetApplicationRelease
|
||||
import uy.kohesive.injekt.injectLazy
|
||||
@@ -21,7 +21,7 @@ class AppUpdateChecker {
|
||||
val result = getApplicationRelease.await(
|
||||
GetApplicationRelease.Arguments(
|
||||
isFossBuildType,
|
||||
isPreviewBuildType,
|
||||
isNightlyBuildType,
|
||||
BuildConfig.COMMIT_COUNT.toInt(),
|
||||
BuildConfig.VERSION_NAME,
|
||||
GITHUB_REPO,
|
||||
@@ -35,7 +35,7 @@ class AppUpdateChecker {
|
||||
}
|
||||
|
||||
val GITHUB_REPO: String by lazy {
|
||||
if (isPreviewBuildType) {
|
||||
if (isNightlyBuildType) {
|
||||
"mihonapp/mihon-preview"
|
||||
} else {
|
||||
"mihonapp/mihon"
|
||||
@@ -43,7 +43,7 @@ val GITHUB_REPO: String by lazy {
|
||||
}
|
||||
|
||||
val RELEASE_TAG: String by lazy {
|
||||
if (isPreviewBuildType) {
|
||||
if (isNightlyBuildType) {
|
||||
"r${BuildConfig.COMMIT_COUNT}"
|
||||
} else {
|
||||
"v${BuildConfig.VERSION_NAME}"
|
||||
|
||||
@@ -13,8 +13,8 @@ val updaterEnabled: Boolean
|
||||
val isDebugBuildType: Boolean
|
||||
inline get() = BuildConfig.BUILD_TYPE == "debug"
|
||||
|
||||
val isPreviewBuildType: Boolean
|
||||
inline get() = BuildConfig.BUILD_TYPE == "preview"
|
||||
val isNightlyBuildType: Boolean
|
||||
inline get() = BuildConfig.BUILD_TYPE == "nightly"
|
||||
|
||||
val isReleaseBuildType: Boolean
|
||||
inline get() = BuildConfig.BUILD_TYPE == "release"
|
||||
|
||||
@@ -11,7 +11,7 @@ class GetApplicationRelease(
|
||||
|
||||
// Check if latest version is different from current version
|
||||
val isNewVersion = isNewVersion(
|
||||
arguments.isPreview,
|
||||
arguments.isNightly,
|
||||
arguments.commitCount,
|
||||
arguments.versionName,
|
||||
release.version,
|
||||
@@ -23,15 +23,15 @@ class GetApplicationRelease(
|
||||
}
|
||||
|
||||
private fun isNewVersion(
|
||||
isPreview: Boolean,
|
||||
isNightly: Boolean,
|
||||
commitCount: Int,
|
||||
versionName: String,
|
||||
versionTag: String,
|
||||
): Boolean {
|
||||
// Removes prefixes like "r" or "v"
|
||||
val newVersion = versionTag.replace("[^\\d.]".toRegex(), "")
|
||||
return if (isPreview) {
|
||||
// Preview builds: based on releases in "mihonapp/mihon-preview" repo
|
||||
return if (isNightly) {
|
||||
// Nightly builds: based on releases in "mihonapp/mihon-preview" repo
|
||||
// tagged as something like "r1234"
|
||||
newVersion.toInt() > commitCount
|
||||
} else {
|
||||
@@ -54,7 +54,7 @@ class GetApplicationRelease(
|
||||
|
||||
data class Arguments(
|
||||
val isFoss: Boolean,
|
||||
val isPreview: Boolean,
|
||||
val isNightly: Boolean,
|
||||
val commitCount: Int,
|
||||
val versionName: String,
|
||||
val repository: String,
|
||||
|
||||
+4
-4
@@ -22,7 +22,7 @@ class GetApplicationReleaseTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `When has update but is preview expect new update`() = runTest {
|
||||
fun `When has update but is nightly expect new update`() = runTest {
|
||||
val release = Release(
|
||||
"r2000",
|
||||
"info",
|
||||
@@ -35,7 +35,7 @@ class GetApplicationReleaseTest {
|
||||
val result = getApplicationRelease.await(
|
||||
GetApplicationRelease.Arguments(
|
||||
isFoss = false,
|
||||
isPreview = true,
|
||||
isNightly = true,
|
||||
commitCount = 1000,
|
||||
versionName = "",
|
||||
repository = "test",
|
||||
@@ -61,7 +61,7 @@ class GetApplicationReleaseTest {
|
||||
val result = getApplicationRelease.await(
|
||||
GetApplicationRelease.Arguments(
|
||||
isFoss = false,
|
||||
isPreview = false,
|
||||
isNightly = false,
|
||||
commitCount = 0,
|
||||
versionName = "v1.0.0",
|
||||
repository = "test",
|
||||
@@ -87,7 +87,7 @@ class GetApplicationReleaseTest {
|
||||
val result = getApplicationRelease.await(
|
||||
GetApplicationRelease.Arguments(
|
||||
isFoss = false,
|
||||
isPreview = false,
|
||||
isNightly = false,
|
||||
commitCount = 0,
|
||||
versionName = "v2.0.0",
|
||||
repository = "test",
|
||||
|
||||
Reference in New Issue
Block a user