Files
tern-android/app/build.gradle.kts
T
Mateusz PstruchaandClaude Opus 5.5 d7ee8b7c46
CI / build (push) Successful in 10m25s
Release / apk (push) Successful in 4m14s
Build the Android client with UnifiedPush notifications
The mail client from android-client-spec.md on AGP 9.4 / Kotlin 2.4 /
compileSdk 37: sign-in and first-run (account, then notifications),
adaptive list-detail with a modal or permanent drawer, swipe to archive
or delete, a locked-down WebView for HTML mail with remote images
blocked per message, reply/reply-all/compose with drafts and an outbox,
and Material You theming with the brand palette as fallback.

Mail is cached in Room and kept current by delta sync over
/api/events. UnifiedPush (connector only, no FCM) delivers the server's
content-free wake-ups; a WorkManager job syncs and raises one
MessagingStyle notification per thread with Archive and Mark read, and
drops notifications for threads read elsewhere. Settings shows push
state, picks a distributor and sends a test push.

The session token is encrypted with a Keystore key, backups are off,
release builds are HTTPS-only (trusting user-installed CAs). CI now
pins platform 37 / build-tools 36 and runs unit tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-23 21:03:11 +02:00

117 lines
4.4 KiB
Kotlin

plugins {
id("com.android.application")
id("org.jetbrains.kotlin.plugin.compose")
id("org.jetbrains.kotlin.plugin.serialization")
id("com.google.devtools.ksp")
}
// Release signing and versioning come from the environment so CI can supply
// them without a keystore or credentials ever living in the repo. All absent
// locally, which is fine: debug builds use the standard debug keystore, and
// an unsigned release build still produces an APK to inspect.
val keystorePath: String? = System.getenv("TERN_KEYSTORE_PATH")
val buildVersionName: String = System.getenv("TERN_VERSION_NAME") ?: "0.1.0"
val buildVersionCode: Int = System.getenv("TERN_VERSION_CODE")?.toInt() ?: 1
android {
namespace = "pl.mtps.tern"
compileSdk = 37
defaultConfig {
applicationId = "pl.mtps.tern"
// GrapheneOS/modern-Pixel-only target (android-client-spec.md §1) —
// no need to support old platform versions for a from-scratch app.
minSdk = 29
targetSdk = 36
versionCode = buildVersionCode
versionName = buildVersionName
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
signingConfigs {
if (keystorePath != null) {
create("release") {
storeFile = file(keystorePath)
storePassword = System.getenv("TERN_KEYSTORE_PASSWORD")
keyAlias = System.getenv("TERN_KEY_ALIAS")
keyPassword = System.getenv("TERN_KEY_PASSWORD")
}
}
}
buildTypes {
release {
// Null when no keystore is configured — AGP then leaves the APK
// unsigned rather than falling back to the debug key, which would
// quietly produce an undistributable "release" build.
signingConfig = signingConfigs.findByName("release")
isMinifyEnabled = true
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
buildFeatures {
compose = true
}
packaging {
resources {
excludes += "/META-INF/{AL2.0,LGPL2.1}"
}
}
}
ksp {
arg("room.schemaLocation", "$projectDir/schemas")
}
dependencies {
val composeBom = platform("androidx.compose:compose-bom:2026.09.00")
implementation(composeBom)
implementation("androidx.core:core-ktx:1.19.0")
implementation("androidx.core:core-splashscreen:1.2.0") // Android 12+ SplashScreen API (§6)
implementation("androidx.activity:activity-compose:1.13.0")
implementation("androidx.lifecycle:lifecycle-runtime-compose:2.11.0")
implementation("androidx.lifecycle:lifecycle-viewmodel-compose:2.11.0")
implementation("androidx.lifecycle:lifecycle-process:2.11.0")
implementation("androidx.compose.ui:ui")
implementation("androidx.compose.ui:ui-graphics")
implementation("androidx.compose.ui:ui-tooling-preview")
implementation("androidx.compose.material3:material3")
implementation("androidx.compose.material3.adaptive:adaptive:1.3.0")
implementation("androidx.compose.material3.adaptive:adaptive-layout:1.3.0")
implementation("androidx.compose.material3.adaptive:adaptive-navigation:1.3.0")
implementation("androidx.compose.material:material-icons-extended")
// Local cache (§6 of the server spec, §7 here): Room, not a hand-rolled store.
implementation("androidx.room:room-runtime:2.8.5")
implementation("androidx.room:room-ktx:2.8.5")
ksp("androidx.room:room-compiler:2.8.5")
implementation("androidx.datastore:datastore-preferences:1.2.1")
// Push-triggered sync runs as WorkManager jobs (§9).
implementation("androidx.work:work-runtime-ktx:2.11.2")
implementation("com.squareup.okhttp3:okhttp:5.3.2")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.11.0")
// UnifiedPush (§5): the connector only — never the embedded FCM
// distributor, which would bring Firebase in.
implementation("org.unifiedpush.android:connector:3.3.5")
debugImplementation("androidx.compose.ui:ui-tooling")
debugImplementation("androidx.compose.ui:ui-test-manifest")
testImplementation("junit:junit:4.13.2")
androidTestImplementation(composeBom)
androidTestImplementation("androidx.test.ext:junit:1.3.0")
androidTestImplementation("androidx.compose.ui:ui-test-junit4")
}