From b37f1a6e56e2f68aa524d627384e59d9a85bc697 Mon Sep 17 00:00:00 2001 From: Vitor Pamplona Date: Fri, 5 Jun 2026 18:57:41 -0400 Subject: [PATCH] fix(dm): make the commons DM feed UI compile for iOS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The DM history widgets extracted into commons were never compiled for the commons iOS target, which hid two Kotlin/Native-only breaks: - RelayReachMarker: `toSortedMap(compareBy { it.ordinal })` + a destructured `(state, list)` Map.Entry inside an inline @Composable lambda don't type-infer on Native. Rewrite as `.entries.sortedBy { it.key.ordinal }` with explicit `entry.key` / `entry.value`. - DmHistoryLoadingCard referenced RelayPagingProgress, which sat in quartz's jvmAndroid source set — visible to commonMain only when building JVM/Android, not iOS. It's a pure data class, so move it to quartz commonMain. commons:compileKotlinIosArm64 now succeeds; JVM/Android unaffected and the DM test suite is still green (26/26). Co-Authored-By: Claude Opus 4.8 (1M context) --- .../amethyst/commons/ui/feeds/RelayReachMarker.kt | 10 ++++++++-- .../relay/client/paging/RelayPagingProgress.kt | 0 2 files changed, 8 insertions(+), 2 deletions(-) rename quartz/src/{jvmAndroid => commonMain}/kotlin/com/vitorpamplona/quartz/nip01Core/relay/client/paging/RelayPagingProgress.kt (100%) diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/ui/feeds/RelayReachMarker.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/ui/feeds/RelayReachMarker.kt index a136bdbd09..c955c154b5 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/ui/feeds/RelayReachMarker.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/ui/feeds/RelayReachMarker.kt @@ -212,11 +212,17 @@ private fun RelayReachMarker(entries: List) { fontWeight = FontWeight.Medium, maxLines = 1, ) + // Present states in enum order. Written with an explicit `sortedBy` + `entry.key`/`entry.value` + // (not `toSortedMap(compareBy { it.ordinal })` + a destructured `(state, list)`) because + // Kotlin/Native's Compose compiler can't infer those inside this inline @Composable lambda + // (commons iOS). entries .groupBy { it.state } - .toSortedMap(compareBy { it.ordinal }) .entries - .forEachIndexed { index, (state, list) -> + .sortedBy { it.key.ordinal } + .forEachIndexed { index, entry -> + val state = entry.key + val list = entry.value if (index > 0) { Text("·", color = MaterialTheme.colorScheme.onSurfaceVariant, fontSize = 11.sp) } diff --git a/quartz/src/jvmAndroid/kotlin/com/vitorpamplona/quartz/nip01Core/relay/client/paging/RelayPagingProgress.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/client/paging/RelayPagingProgress.kt similarity index 100% rename from quartz/src/jvmAndroid/kotlin/com/vitorpamplona/quartz/nip01Core/relay/client/paging/RelayPagingProgress.kt rename to quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/client/paging/RelayPagingProgress.kt