feat(release): m6 release mechanics — signed APK, R8, version guard, icons
All checks were successful
PR Checks / android-build (pull_request) Successful in 9m52s
All checks were successful
PR Checks / android-build (pull_request) Successful in 9m52s
Release-hardening pass (PLAN.md §9 M6, §10, §12). No architecture, data-flow, or endpoint changes; the app remains a pure API client. App icons (default brand assets): - New gateway-medallion launcher icon set (all densities, adaptive fg/bg, round, Play Store icon) + an RG notification icon staged for M7 push. - Replace the Image Asset wizard's default green-grid adaptive background with the deep-indigo brand fill (@color/ic_launcher_background #1B1033); recomposite the legacy square/round webps and the 512 Play icon over indigo so the whole set is coherent (the green never shipped). Restore the SPDX headers the wizard stripped; drop the orphaned placeholder foreground vector. No <monochrome> layer — the full-colour medallion has no clean silhouette, so themed mode falls back to the standard icon rather than a tinted blob. Version-mismatch guard (§3): - The connect probe now refuses a Runic Gateway backend whose API version this build can't speak (e.g. a future v2) with a clear "app out of date" message, instead of mis-rendering; lenient on a blank api (older backend). Decision logic extracted to a pure ConnectionRepository.evaluateVersion() with unit tests. Release build hardening (§7, §12): - Enable R8 full-mode minify + resource shrink for release (~31 MB debug -> 4.2 MB signed release). ProGuard keep-rules for kotlinx.serialization serializers + our wire DTOs, Retrofit service interfaces, and a -dontwarn for Tink's compile-only Error Prone annotations (EncryptedSharedPreferences). - Release signingConfig reads keystore material from a gitignored keystore.properties or env vars; absent -> unsigned (debug + PR gate unaffected). Keystore never in repo. - versionName/versionCode overridable via -P so the release tag + CI run number drive them (§10). CI: - release.yml: on a `v*` tag, build a SIGNED release APK (keystore from a base64 Gitea secret) and attach it + SHA256SUMS to a Gitea release; workflow_dispatch is a signing dry run. Mirrors pr-checks.yml's self-hosted-runner handling (apt JDK 17, explicit sdkmanager, in-step chmod +x gradlew). Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -36,6 +36,13 @@ class ConnectionRepository @Inject constructor(
|
||||
|
||||
/** Reachable and 2xx, but not a Runic Gateway backend (wrong version identity). */
|
||||
data object NotRunicGateway : ProbeResult
|
||||
|
||||
/**
|
||||
* A Runic Gateway backend, but speaking an API version this app build does
|
||||
* not support (§3 version guard) — refuse rather than mis-render. [serverApi]
|
||||
* is what the site reported; [supportedApi] is what this app speaks.
|
||||
*/
|
||||
data class VersionMismatch(val serverApi: String, val supportedApi: String) : ProbeResult
|
||||
data class ServerError(val status: Int) : ProbeResult
|
||||
data class Unreachable(val cause: Throwable) : ProbeResult
|
||||
}
|
||||
@@ -68,14 +75,15 @@ class ConnectionRepository @Inject constructor(
|
||||
?: return ProbeResult.InvalidUrl(ServerUrl.Reason.MALFORMED)
|
||||
|
||||
return when (val result = safeApiCall { api.probeStatus(statusUrl) }) {
|
||||
is ApiResult.Ok -> {
|
||||
if (!result.data.version.service.equals(RUNIC_SERVICE_ID, ignoreCase = true)) {
|
||||
ProbeResult.NotRunicGateway
|
||||
} else {
|
||||
is ApiResult.Ok -> when (val verdict = evaluateVersion(result.data.version)) {
|
||||
is VersionVerdict.Ok -> {
|
||||
prefs.setBaseUrl(normalized.toString())
|
||||
baseUrlHolder.set(normalized)
|
||||
ProbeResult.Success(result.data)
|
||||
}
|
||||
is VersionVerdict.NotRunicGateway -> ProbeResult.NotRunicGateway
|
||||
is VersionVerdict.Mismatch ->
|
||||
ProbeResult.VersionMismatch(serverApi = verdict.serverApi, supportedApi = SUPPORTED_API)
|
||||
}
|
||||
is ApiResult.HttpError -> ProbeResult.ServerError(result.status)
|
||||
is ApiResult.NetworkError -> ProbeResult.Unreachable(result.cause)
|
||||
@@ -93,7 +101,38 @@ class ConnectionRepository @Inject constructor(
|
||||
baseUrlHolder.set(null)
|
||||
}
|
||||
|
||||
private companion object {
|
||||
/** The pure outcome of inspecting a probed site's [VersionDto] (§3 version guard). */
|
||||
internal sealed interface VersionVerdict {
|
||||
data object Ok : VersionVerdict
|
||||
data object NotRunicGateway : VersionVerdict
|
||||
data class Mismatch(val serverApi: String) : VersionVerdict
|
||||
}
|
||||
|
||||
internal companion object {
|
||||
const val RUNIC_SERVICE_ID = "runic-gateway"
|
||||
|
||||
/** The backend API major version this app build speaks (matches `/public/version` `api`). */
|
||||
const val SUPPORTED_API = "v1"
|
||||
|
||||
/**
|
||||
* Decide whether a probed site is a Runic Gateway backend this app can talk
|
||||
* to. Pure (no I/O) so it is unit-testable without a live site. Lenient on a
|
||||
* blank `api` (an older backend that predates version surfacing); refuses only
|
||||
* an API version we positively know we can't parse (e.g. a future `v2`).
|
||||
*/
|
||||
fun evaluateVersion(
|
||||
version: com.runicgateway.app.data.api.dto.VersionDto,
|
||||
supportedApi: String = SUPPORTED_API,
|
||||
): VersionVerdict {
|
||||
if (!version.service.trim().equals(RUNIC_SERVICE_ID, ignoreCase = true)) {
|
||||
return VersionVerdict.NotRunicGateway
|
||||
}
|
||||
val serverApi = version.api.trim()
|
||||
return when {
|
||||
serverApi.isEmpty() -> VersionVerdict.Ok
|
||||
serverApi.equals(supportedApi, ignoreCase = true) -> VersionVerdict.Ok
|
||||
else -> VersionVerdict.Mismatch(serverApi)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,6 +107,7 @@ private fun errorMessage(error: ConnectError): String = when (error) {
|
||||
ConnectError.UnsupportedScheme -> stringResource(R.string.connect_error_scheme)
|
||||
ConnectError.Insecure -> stringResource(R.string.connect_error_insecure)
|
||||
ConnectError.NotRunicGateway -> stringResource(R.string.connect_error_not_runic)
|
||||
is ConnectError.VersionMismatch -> stringResource(R.string.connect_error_version, error.serverApi)
|
||||
ConnectError.Unreachable -> stringResource(R.string.connect_error_unreachable)
|
||||
is ConnectError.Server -> stringResource(R.string.connect_error_server, error.status)
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ class ConnectViewModel @Inject constructor(
|
||||
data object UnsupportedScheme : ConnectError
|
||||
data object Insecure : ConnectError
|
||||
data object NotRunicGateway : ConnectError
|
||||
data class VersionMismatch(val serverApi: String) : ConnectError
|
||||
data object Unreachable : ConnectError
|
||||
data class Server(val status: Int) : ConnectError
|
||||
}
|
||||
@@ -61,6 +62,7 @@ class ConnectViewModel @Inject constructor(
|
||||
}
|
||||
is ProbeResult.InvalidUrl -> fail(result.reason.toError())
|
||||
ProbeResult.NotRunicGateway -> fail(ConnectError.NotRunicGateway)
|
||||
is ProbeResult.VersionMismatch -> fail(ConnectError.VersionMismatch(result.serverApi))
|
||||
is ProbeResult.Unreachable -> fail(ConnectError.Unreachable)
|
||||
is ProbeResult.ServerError -> fail(ConnectError.Server(result.status))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user