daef7ea190
Helper functions (matrix-mas capability group): - mas_client_register_bash_infra: register/sync OAuth clients via mas-cli - mas_syn2mas_migration_bash_infra: dry-run + apply user migration to MAS - synapse_msc3861_enable_go_infra: edit homeserver.yaml MSC3861 block (with diff) - wellknown_oidc_patch_go_infra: patch well-known JSON with msc2965.authentication - synapse_login_flows_check_go_infra: health-check post-migration login flows Flows + issues for custom Matrix clients (PC + Android): - 0010 matrix-client-pc: Wails + React+Mantine (issues 0147-0153) - 0011 matrix-client-android: Kotlin + Compose (issues 0154-0161) - 0162 enable MAS as auth provider (Synapse delegate) — EXECUTED on VPS - 0163 custom admin panel propio (sustituye synapse-admin) Production state (organic-machine.com): - Synapse migrated SQLite -> Postgres - MSC3861 active, password_config disabled - 21 users + 41 access_tokens migrated via syn2mas - 4 MAS clients registered (element, matrix_pc, matrix_android, admin_panel) - synapse-admin container removed + Coolify route deleted - well-known patched with org.matrix.msc2965.authentication Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
3.4 KiB
3.4 KiB
id, title, status, priority, created, related_flows, related_issues, dependencies, tags
| id | title | status | priority | created | related_flows | related_issues | dependencies | tags | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0154 | matrix-client-android scaffold: Kotlin + Compose + login MAS | pending | high | 2026-05-24 |
|
|
|
|
Objetivo
Crear projects/element_agents/apps/matrix_client_android/ con init_kotlin_app (pipeline ya existente del registry). Configurar Compose + Material 3 + tema propio. Implementar login MAS OIDC via Chrome Custom Tabs. Tokens persistidos en EncryptedSharedPreferences. Resultado: APK debug que abre Custom Tab al MAS, retorna con token y muestra perfil del usuario.
Tareas
./fn run init_kotlin_app matrix_client_android— usa pipeline existente del registry (ver issues completados 0073-0078).- Sub-repo Gitea:
git init -b master+ creardataforge/matrix_client_android+ push inicial. Antes de salir del worktree (verapps_subrepo.md). app.mdcon frontmatter:lang: kotlin,framework: jetpack-compose,dir_path: projects/element_agents/apps/matrix_client_android.tags: [matrix, android, kotlin, compose].uses_functions: [](irlo rellenando issue a issue).
build.gradle.kts:compileSdk = 34,minSdk = 28,targetSdk = 34.- Compose BOM
2024.x. matrix-rust-sdkKotlin bindings (org.matrix.rustcomponents:sdk-android:0.x).androidx.security:security-cryptopara EncryptedSharedPreferences.androidx.browser:browserpara Chrome Custom Tabs.
- Login MAS:
LoginActivitycon boton "Sign in with Matrix".- Generar PKCE code_verifier + state.
- Abrir Chrome Custom Tab a
<mas_url>/oauth/authorize?.... MainActivitycon intent-filter paramatrix-client-android://callbackredirect.- Intercambiar code -> access_token + refresh_token.
- Guardar en EncryptedSharedPreferences (
SecurityCryptoUserPrefs).
HomeScreenCompose conText("Hola @<userId>")+ boton Logout.- Tema Material 3 propio (paleta accent acorde a flow 0010 cliente PC para coherencia).
- Test instrumented:
LoginInstrumentedTestque mocka MAS y verifica flow callback -> token saved.
Funciones del registry a crear
matrix_client_kotlin_infra— facade sobrematrix-rust-sdk(init, login, sync, logout).mas_oidc_kotlin_infra— Chrome Custom Tabs + PKCE + callback handler.encrypted_prefs_kotlin_core— wrapper EncryptedSharedPreferences (idempotente, generic put/get).LoginScreen_kotlin_ui— Compose screen Material 3.HomeScreen_kotlin_ui— Compose screen perfil + logout.
Acceptance
./gradlew assembleDebugproduce APK valido.- APK instala en Android 9+ y arranca.
- Login: boton -> Custom Tab MAS -> consent -> callback -> perfil visible.
- Token persiste entre re-aperturas (no re-login si vigente).
app.mdcon frontmatter completo + 5uses_functions.- Sub-repo
dataforge/matrix_client_androidcon commit inicial. - Test instrumented
LoginInstrumentedTestpasa en emulator API 31.
Notas
- Chrome Custom Tabs > WebView para OAuth (security: comparte cookies con browser principal del user, mejor UX).
- Refresh token: implementar refresh proactivo 5min antes de expiry (corutina + WorkManager periodic).
- Gotcha conocido (ver issue 0074):
local.propertiesconsdk.dirobligatorio en setup nuevo. El scaffolder lo crea. - Gotcha (issue 0075): Material 3 sin AppCompat — usar
MaterialThemedirectamente, noTheme.AppCompat.*.