Files
fn_registry/dev/issues/0155-matrix-client-android-rooms-timeline.md
egutierrez daef7ea190 feat(matrix): MAS migration helpers + 2 flows + 15 issues + capability group
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>
2026-05-24 22:53:33 +02:00

64 lines
2.9 KiB
Markdown

---
id: "0155"
title: "matrix-client-android rooms list + timeline Compose"
status: pending
priority: high
created: 2026-05-24
related_flows: ["0011"]
related_issues: ["0154", "0156"]
dependencies: ["0154"]
tags: [matrix, android, compose, sync, timeline, rooms]
---
## Objetivo
UI Compose con `Scaffold` que muestre sidebar drawer con rooms y panel principal con timeline. Sync via `matrix-rust-sdk` (corrutinas + Flow). `LazyColumn` virtualizado para timeline (perf con miles de mensajes). Swipe-to-react en mensajes. Optimistic UI al enviar (en issue 0156).
## Tareas
1. ViewModels:
- `RoomsViewModel(matrixClient)` — expone `StateFlow<List<RoomSummary>>`. Ordenado por `lastActivity`.
- `TimelineViewModel(matrixClient, roomId)` — expone `StateFlow<List<TimelineEvent>>` + `loadMore()`.
- Persistencia local con Room DB (`androidx.room`) — store rooms + last sync token.
2. Compose:
- `MainScreen` con `ModalNavigationDrawer`:
- Drawer: `RoomList` (LazyColumn con `RoomItem`: avatar, name, last preview, unread badge).
- Content: `TimelineScreen(roomId)`.
- `TimelineScreen`:
- `LazyColumn` con `reverseLayout = true` (mensajes recientes abajo).
- `key = { it.eventId }` para evitar re-composiciones.
- `LaunchedEffect` con `LazyListState` -> al llegar al top, `viewModel.loadMore()`.
- `EventBubble` composables segun tipo (text, image, file, redacted).
- `Avatar` composable reusable con cache de imagenes (`Coil`).
3. Sync engine:
- `MatrixSyncService` (corrutina supervisor scope) que mantiene `client.syncStream()`.
- Si pasa a background sin call activa, sync se pausa hasta que vuelve foreground (lifecycle-aware).
- Errores de red: backoff exponencial (1s, 2s, 4s ... 60s max).
4. Tests:
- Instrumented `RoomsListTest` — 3 rooms aparecen en drawer.
- Instrumented `TimelinePaginationTest` — scroll-up carga 50 msgs anteriores.
## Funciones del registry a crear
- `matrix_room_summary_kotlin_infra` — extract `RoomSummary` de matrix-rust-sdk.
- `matrix_timeline_kotlin_infra` — Flow de eventos paginados.
- `RoomListScreen_kotlin_ui` — Compose drawer rooms.
- `TimelineScreen_kotlin_ui` — Compose timeline virtualizado.
- `EventBubble_kotlin_ui` — composable burbuja msg.
## Acceptance
- [ ] Drawer lista rooms del usuario test.
- [ ] Click en room muestra timeline ultimos 50 msgs.
- [ ] Swipe arriba carga msgs anteriores sin gap.
- [ ] Msg enviado desde PC (Wails) aparece en Android en <2s.
- [ ] Avion mode + restore: sync resume, no msgs perdidos.
- [ ] Cerrar app + reopen: state restaurado desde Room DB, no full re-sync.
## Notas
- `matrix-rust-sdk` ya gestiona persistencia interna (SQLite + crypto store). Room DB local solo para datos UI-rapidos (room summaries, unread counters).
- Read receipts: TBD otro issue.
- DMs detectados via `m.direct` account data.
- Spaces: `RoomItem` con icono diferente, colapsable.