Use CI update channel by default for snapshots (#1223)

* Use CI update channel by default for snapshots

And use build time as initial update time.

* Fix build time
This commit is contained in:
FooIbar authored and GitHub committed 2024-05-19 20:25:59 +08:00
1 parent e402587f8f
commit 3068aab681
5 files changed
+9 -13

No files matched your search

+2 -9
View File
@@ -1,8 +1,6 @@
import com.mikepenz.aboutlibraries.plugin.DuplicateMode.MERGE
import com.mikepenz.aboutlibraries.plugin.DuplicateRule.GROUP
import java.time.Instant
import java.time.ZoneOffset
import java.time.format.DateTimeFormatter
val isRelease: Boolean
get() = gradle.startParameter.taskNames.any { it.contains("Release") }
@@ -50,11 +48,6 @@ android {
commandLine = "git rev-parse --short=7 HEAD".split(' ')
}.standardOutput.asText.get().trim()
val buildTime by lazy {
val formatter = DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm").withZone(ZoneOffset.UTC)
formatter.format(Instant.now())
}
val repoName = providers.exec {
commandLine = "git remote get-url origin".split(' ')
}.standardOutput.asText.get().trim().removePrefix("https://github.com/").removePrefix("git@github.com:")
@@ -164,11 +157,11 @@ android {
isShrinkResources = true
proguardFiles("proguard-rules.pro")
signingConfig = signConfig
buildConfigField("String", "BUILD_TIME", "\"$buildTime\"")
buildConfigField("long", "BUILD_TIME", "${Instant.now().epochSecond}")
}
debug {
applicationIdSuffix = ".debug"
buildConfigField("String", "BUILD_TIME", "\"\"")
buildConfigField("long", "BUILD_TIME", "0")
lint {
abortOnError = false
}
@@ -146,7 +146,7 @@ object Settings : DataStorePreferences(null) {
var appLinkVerifyTip by boolPref("app_link_verify_tip", false)
var enabledSecurity by boolPref("enable_secure", false)
var backupBeforeUpdate by boolPref("backup_before_update", true)
var useCIUpdateChannel by boolPref("ci_update_channel", false)
var useCIUpdateChannel by boolPref("ci_update_channel", "SNAPSHOT" in BuildConfig.VERSION_NAME)
var mediaScan by boolPref("media_scan", false).observed { updateWhenKeepMediaStatusChanges() }
var hasDefaultDownloadLabel by boolPref("has_default_download_label", false)
var saveParseErrorBody by boolPref("save_parse_error_body", true)
@@ -168,7 +168,7 @@ object Settings : DataStorePreferences(null) {
var recentToplist by stringPref("recent_toplist", "11")
var userAgent by stringPref("user_agent", CHROME_USER_AGENT)
var defaultDownloadLabel by stringOrNullPref("default_download_label", null)
var lastUpdateTime by longPref("last_update_time", 0)
var lastUpdateTime by longPref("last_update_time", BuildConfig.BUILD_TIME)
// Tachiyomi Reader
var newReader by boolPref("new_compose_reader", false)
@@ -59,7 +59,7 @@ private const val RELEASE_URL = "$REPO_URL/releases"
@Composable
@Stable
private fun versionCode() = "${BuildConfig.VERSION_NAME} (${BuildConfig.COMMIT_SHA})\n" + stringResource(R.string.settings_about_build_time, BuildConfig.BUILD_TIME)
private fun versionCode() = "${BuildConfig.VERSION_NAME} (${BuildConfig.COMMIT_SHA})\n" + stringResource(R.string.settings_about_build_time, AppConfig.buildTime)
@Composable
@Stable
@@ -18,6 +18,7 @@ package com.hippo.ehviewer.util
import android.os.Build
import android.os.Environment
import com.hippo.ehviewer.BuildConfig
import com.hippo.ehviewer.client.parser.ParserUtils
import com.hippo.unifile.UniFile
import com.hippo.unifile.asUniFile
import java.io.File
@@ -38,6 +39,8 @@ object AppConfig {
fun matchVariant(name: String) = name.contains(BuildConfig.FLAVOR) && name.contains(abi)
val buildTime = ParserUtils.formatDate(BuildConfig.BUILD_TIME * 1000)
private val externalAppDir: File?
get() {
if (Environment.MEDIA_MOUNTED == Environment.getExternalStorageState()) {
@@ -26,7 +26,7 @@ object Crash {
writer.write("VersionName=${BuildConfig.VERSION_NAME}\n")
writer.write("VersionCode=${BuildConfig.VERSION_CODE}\n")
writer.write("CommitSha=${BuildConfig.COMMIT_SHA}\n")
writer.write("BuildTime=${BuildConfig.BUILD_TIME}\n")
writer.write("BuildTime=${AppConfig.buildTime}\n")
writer.write("\n")
// Device info