diff --git a/app/build.gradle.kts b/app/build.gradle.kts
index 608e64430..62d63d569 100644
--- a/app/build.gradle.kts
+++ b/app/build.gradle.kts
@@ -1,6 +1,5 @@
import com.mikepenz.aboutlibraries.plugin.DuplicateMode.MERGE
import com.mikepenz.aboutlibraries.plugin.DuplicateRule.GROUP
-import java.time.Instant
val isRelease: Boolean
get() = gradle.startParameter.taskNames.any { it.contains("Release") }
@@ -50,6 +49,10 @@ android {
commandLine = "git rev-parse --short=7 HEAD".split(' ')
}.standardOutput.asText.get().trim()
+ val commitTime = providers.exec {
+ commandLine = "git log -1 --format=%ct".split(' ')
+ }.standardOutput.asText.get().trim()
+
val repoName = providers.exec {
commandLine = "git remote get-url origin".split(' ')
}.standardOutput.asText.get().trim().removePrefix("https://github.com/").removePrefix("git@github.com:")
@@ -83,6 +86,7 @@ android {
)
buildConfigField("String", "RAW_VERSION_NAME", "\"$versionName${versionNameSuffix.orEmpty()}\"")
buildConfigField("String", "COMMIT_SHA", "\"$commitSha\"")
+ buildConfigField("long", "COMMIT_TIME", commitTime)
buildConfigField("String", "REPO_NAME", "\"$repoName\"")
buildConfigField("String", "CHROME_VERSION", "\"$chromeVersion\"")
ndk {
@@ -138,11 +142,9 @@ android {
isShrinkResources = true
proguardFiles("proguard-rules.pro")
signingConfig = signConfig
- buildConfigField("long", "BUILD_TIME", "${Instant.now().epochSecond}")
}
debug {
applicationIdSuffix = ".debug"
- buildConfigField("long", "BUILD_TIME", "0")
lint {
abortOnError = false
}
diff --git a/app/src/main/kotlin/com/hippo/ehviewer/Settings.kt b/app/src/main/kotlin/com/hippo/ehviewer/Settings.kt
index 7b06acf61..c038edefa 100644
--- a/app/src/main/kotlin/com/hippo/ehviewer/Settings.kt
+++ b/app/src/main/kotlin/com/hippo/ehviewer/Settings.kt
@@ -169,7 +169,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", BuildConfig.BUILD_TIME)
+ var lastUpdateTime by longPref("last_update_time", BuildConfig.COMMIT_TIME)
// Tachiyomi Reader
var newReader by boolPref("new_compose_reader", false)
diff --git a/app/src/main/kotlin/com/hippo/ehviewer/ui/settings/AboutScreen.kt b/app/src/main/kotlin/com/hippo/ehviewer/ui/settings/AboutScreen.kt
index 281e9e79d..8dad8d604 100644
--- a/app/src/main/kotlin/com/hippo/ehviewer/ui/settings/AboutScreen.kt
+++ b/app/src/main/kotlin/com/hippo/ehviewer/ui/settings/AboutScreen.kt
@@ -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, AppConfig.buildTime)
+private fun versionCode() = "${BuildConfig.VERSION_NAME} (${BuildConfig.COMMIT_SHA})\n" + stringResource(R.string.settings_about_commit_time, AppConfig.commitTime)
@Composable
@Stable
diff --git a/app/src/main/kotlin/com/hippo/ehviewer/util/AppConfig.kt b/app/src/main/kotlin/com/hippo/ehviewer/util/AppConfig.kt
index 3b8d0304f..7c49e60ad 100644
--- a/app/src/main/kotlin/com/hippo/ehviewer/util/AppConfig.kt
+++ b/app/src/main/kotlin/com/hippo/ehviewer/util/AppConfig.kt
@@ -39,7 +39,7 @@ object AppConfig {
fun matchVariant(name: String) = name.contains(BuildConfig.FLAVOR) && name.contains(abi)
- val buildTime = ParserUtils.formatDate(BuildConfig.BUILD_TIME * 1000)
+ val commitTime = ParserUtils.formatDate(BuildConfig.COMMIT_TIME * 1000)
val isSnapshot = "SNAPSHOT" in BuildConfig.VERSION_NAME
diff --git a/app/src/main/kotlin/com/hippo/ehviewer/util/Crash.kt b/app/src/main/kotlin/com/hippo/ehviewer/util/Crash.kt
index 69494305b..55e146162 100644
--- a/app/src/main/kotlin/com/hippo/ehviewer/util/Crash.kt
+++ b/app/src/main/kotlin/com/hippo/ehviewer/util/Crash.kt
@@ -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=${AppConfig.buildTime}\n")
+ writer.write("CommitTime=${AppConfig.commitTime}\n")
writer.write("\n")
// Device info
diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml
index 04c0d7bdf..f3abb74e2 100644
--- a/app/src/main/res/values-zh-rCN/strings.xml
+++ b/app/src/main/res/values-zh-rCN/strings.xml
@@ -383,7 +383,7 @@
源码
许可证
版本号
- 于 %s 构建
+ 于 %s 提交
检查更新
请稍候
diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml
index 7797f2258..8ad80555d 100644
--- a/app/src/main/res/values-zh-rTW/strings.xml
+++ b/app/src/main/res/values-zh-rTW/strings.xml
@@ -382,7 +382,7 @@
最新版本
原始碼
版本號碼
- 於 %s 建置
+ 於 %s 提交
檢查更新
授權條款
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 222f7bb2c..b1104b60c 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -427,7 +427,7 @@
Latest release
Source
Build version
- Built at %s
+ Committed at %s
Check for updates
License
Can\'t read the file