[App] Add more info to build details dialog.

This commit is contained in:
Kuba Szczodrzyński 2021-04-03 22:22:18 +02:00
parent e7cb699bcf
commit fc4c297bef

View File

@ -56,9 +56,9 @@ class BuildManager(val app: App) : CoroutineScope {
} }
val versionBadge = when { val versionBadge = when {
isOfficial && isNightly -> isSigned && isNightly ->
"Nightly\n" + BuildConfig.VERSION_NAME.substringAfterLast('.') "Nightly\n" + BuildConfig.VERSION_NAME.substringAfterLast('.')
isOfficial && isDaily -> isSigned && isDaily ->
"Daily\n" + BuildConfig.VERSION_NAME.substringAfterLast('.') "Daily\n" + BuildConfig.VERSION_NAME.substringAfterLast('.')
isDebug -> isDebug ->
"Debug\n" + BuildConfig.VERSION_BASE "Debug\n" + BuildConfig.VERSION_BASE
@ -78,10 +78,21 @@ class BuildManager(val app: App) : CoroutineScope {
val fields = mapOf( val fields = mapOf(
R.string.build_version to BuildConfig.VERSION_BASE, R.string.build_version to BuildConfig.VERSION_BASE,
R.string.build_official to if (isOfficial) R.string.build_official to when {
yes.asColoredSpannable(mtrlGreen) isOfficial -> yes.asColoredSpannable(mtrlGreen)
else isSigned -> TextUtils.concat(
yes.asColoredSpannable(mtrlYellow),
when {
isNightly -> " (nightly build)"
isDaily -> " (daily build)"
else -> no.asColoredSpannable(mtrlYellow)
}
)
else -> TextUtils.concat(
no.asColoredSpannable(mtrlRed), no.asColoredSpannable(mtrlRed),
if (gitAuthor != null) " ($gitAuthor)" else ""
)
},
R.string.build_platform to when { R.string.build_platform to when {
isPlayRelease -> activity.getString(R.string.build_platform_play) isPlayRelease -> activity.getString(R.string.build_platform_play)
isApkRelease -> activity.getString(R.string.build_platform_apk) isApkRelease -> activity.getString(R.string.build_platform_apk)
@ -229,8 +240,10 @@ class BuildManager(val app: App) : CoroutineScope {
val validation = Signing.appCertificate + gitHash + gitRemotes?.join(";") val validation = Signing.appCertificate + gitHash + gitRemotes?.join(";")
// app already validated // app already validated
if (app.config.validation == validation.md5()) if (app.config.validation?.substringBefore(":") == validation.md5()){
gitAuthor = app.config.validation?.substringAfter(":")
return@launch return@launch
}
val dialog = MaterialAlertDialogBuilder(activity) val dialog = MaterialAlertDialogBuilder(activity)
.setTitle(R.string.please_wait) .setTitle(R.string.please_wait)
@ -251,7 +264,7 @@ class BuildManager(val app: App) : CoroutineScope {
} }
// release, unofficial, published build // release, unofficial, published build
app.config.validation = validation.md5() app.config.validation = validation.md5() + ":" + gitAuthor
invalidateBuild(activity, dialog, InvalidBuildReason.VALID) invalidateBuild(activity, dialog, InvalidBuildReason.VALID)
} }
} }