Files
HomerandClaude Opus 5.5 4f09bc41bb
CI / check (push) Canceled after 0s
LLeMbas for Android 0.1.0 (alpha, unreleased): the first commit
A native client for a LLeMbas instance on the server's /api/v2, and the
phone's digital assistant.

- Sign in by device code; the token sealed in the Android Keystore; several
  instances.
- Chats and agent chats: the list, a chat with its reply streaming as JSON
  server-sent events (reconnecting, whole blocks), thinking, tool calls,
  steered messages, the plan, jobs, stop, edit, regenerate, continue, the
  model, effort and Plan mode, attachments and dictation.
- Cards in a sheet, answered as the page's form says it; first answer wins.
- Notifications through UnifiedPush, no Google services; an approval can be
  answered from its notification.
- The digital assistant: a VoiceInteractionService with its session (a sheet
  over the current app, "Include screen" off by default), a recognition
  service through the instance's speech-to-text, the lock-screen path that
  asks to unlock before sending, a Quick Settings tile and an Ask shortcut.
- Share to LLeMbas; Moria and Shire from the server's tokens; nine
  languages; a self-updater in the `full` flavour, none in `fdroid`.

Generated and pinned from the server, each checked in CI: the theme
(tokens.lock.json), the contract (contract/lock.json, server 2124ba9), the
strings and the icons. Built and tested only on GitHub Actions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 13:44:30 +00:00

132 lines
4.3 KiB
Kotlin

import java.util.Properties
plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
alias(libs.plugins.kotlin.compose)
alias(libs.plugins.kotlin.serialization)
}
// The release key is never in the repository. CI writes it from secrets into a file named by
// LEMBAS_KEYSTORE; a build without one is unsigned (debug builds use the debug key as always).
val releaseKey: Properties? =
System.getenv("LEMBAS_KEYSTORE")?.takeIf { it.isNotBlank() }?.let {
Properties().apply {
setProperty("file", it)
setProperty("password", System.getenv("LEMBAS_KEYSTORE_PASSWORD") ?: "")
setProperty("alias", System.getenv("LEMBAS_KEY_ALIAS") ?: "release")
setProperty("keyPassword", System.getenv("LEMBAS_KEY_PASSWORD") ?: "")
}
}
android {
namespace = "eu.llembas.android"
compileSdk = 36
defaultConfig {
applicationId = "eu.llembas.android"
minSdk = 29
targetSdk = 36
// The one source of the version. versionCode is derived from it, so the two cannot
// drift: 0.1.0 -> 100, 1.2.3 -> 10203.
versionName = "0.1.0"
versionCode = versionName!!.split(".").map { it.toInt() }.let { (a, b, c) ->
a * 10000 + b * 100 + c
}
}
signingConfigs {
releaseKey?.let { key ->
create("release") {
storeFile = file(key.getProperty("file"))
storePassword = key.getProperty("password")
keyAlias = key.getProperty("alias")
keyPassword = key.getProperty("keyPassword")
}
}
}
buildTypes {
release {
isMinifyEnabled = true
isShrinkResources = true
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
signingConfig = signingConfigs.findByName("release")
}
debug {
applicationIdSuffix = ".debug"
versionNameSuffix = "-debug"
}
}
// `full` updates itself from llembas.eu; `fdroid` has no updater, because F-Droid updates it.
flavorDimensions += "distribution"
productFlavors {
create("full") {
dimension = "distribution"
buildConfigField("boolean", "SELF_UPDATE", "true")
}
create("fdroid") {
dimension = "distribution"
buildConfigField("boolean", "SELF_UPDATE", "false")
}
}
buildFeatures {
compose = true
buildConfig = true
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
dependenciesInfo {
// No Google-signed dependency blob in the APK: F-Droid refuses it, and nobody reads it.
includeInApk = false
includeInBundle = false
}
testOptions {
unitTests.isReturnDefaultValues = true
}
sourceSets {
// The server's contract, pinned by scripts/fetch-contract.py, read by the unit tests.
getByName("test").resources.srcDir(rootProject.file("contract"))
}
}
kotlin {
jvmToolchain(17)
}
dependencies {
implementation(libs.androidx.core.ktx)
implementation(libs.androidx.activity.compose)
implementation(libs.androidx.lifecycle.runtime.compose)
implementation(libs.androidx.lifecycle.viewmodel.compose)
implementation(libs.androidx.lifecycle.service)
implementation(libs.androidx.navigation.compose)
implementation(libs.androidx.datastore.preferences)
implementation(libs.androidx.browser)
implementation(platform(libs.compose.bom))
implementation(libs.compose.ui)
implementation(libs.compose.ui.tooling.preview)
implementation(libs.compose.material3)
implementation(libs.compose.material.icons)
implementation(libs.okhttp)
implementation(libs.okhttp.sse)
implementation(libs.kotlinx.serialization.json)
implementation(libs.kotlinx.coroutines.android)
implementation(libs.markwon.core)
implementation(libs.markwon.tables)
implementation(libs.markwon.strikethrough)
implementation(libs.unifiedpush.connector)
testImplementation(libs.junit)
testImplementation(libs.kotlinx.coroutines.test)
testImplementation(libs.okhttp.mockwebserver)
}