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