fix: resolve CI lint error and coroutines opt-in warnings

- Collect ConcordSession.state via collectAsStateWithLifecycle instead of
  reading StateFlow.value in composition (fixes StateFlowValueCalledInComposition
  lint error in GroupBottomBarEntries.kt).
- Add @OptIn(ExperimentalCoroutinesApi::class) for testScheduler.advanceTimeBy
  and runCurrent usages in ResourceUsageLedgerTest and RelayAuthPromptBusTest.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Wx8SvzsWsru7rEQ1KcbSCW
This commit is contained in:
Claude
2026-07-15 21:13:23 +00:00
parent 000d01c44e
commit 0d58d94ef4
3 changed files with 7 additions and 6 deletions
@@ -46,6 +46,7 @@ import com.vitorpamplona.amethyst.ui.screen.loggedIn.chats.publicChannels.concor
import com.vitorpamplona.amethyst.ui.stringRes
import com.vitorpamplona.quartz.nip01Core.relay.normalizer.RelayUrlNormalizer
import com.vitorpamplona.quartz.nip29RelayGroups.GroupId
import kotlinx.coroutines.flow.MutableStateFlow
/**
* The resolved presentation of a pinned chat/group [BottomBarEntry] — enough to render its avatar in
@@ -153,12 +154,8 @@ fun rememberConcordEntryDisplay(
val communities by account.concordChannelList.liveCommunities.collectAsStateWithLifecycle()
val session = remember(entry.communityId, revision) { account.concordSessions.sessionFor(entry.communityId) }
val metadata =
session
?.state
?.value
.takeIf { revision >= 0 }
?.metadata
val state by (session?.state ?: remember { MutableStateFlow(null) }).collectAsStateWithLifecycle()
val metadata = state.takeIf { revision >= 0 }?.metadata
val fallbackName = remember(communities, entry.communityId) { communities.firstOrNull { it.id == entry.communityId }?.name?.ifBlank { null } }
val label = metadata?.name?.takeIf { it.isNotBlank() } ?: fallbackName ?: stringRes(R.string.concord_home_title)
@@ -21,6 +21,7 @@
package com.vitorpamplona.amethyst.service.relayClient.authCommand.model
import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.async
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.test.runCurrent
@@ -70,6 +71,7 @@ class RelayAuthPromptBusTest {
assertEquals(UserAuthChoice.DISMISS, bus.requestDecision(relay, emptyList()))
}
@OptIn(ExperimentalCoroutinesApi::class)
@Test
fun retainsPromptForALateSubscriberSoItIsNotLost() =
runTest {
@@ -27,6 +27,7 @@ import com.vitorpamplona.quartz.nip01Core.signers.NostrSigner
import com.vitorpamplona.quartz.nip57Zaps.LnZapPrivateEvent
import com.vitorpamplona.quartz.nip57Zaps.LnZapRequestEvent
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.test.runTest
import org.junit.Assert.assertEquals
@@ -142,6 +143,7 @@ class ResourceUsageAccountantTest {
assertEquals(12L, store.allDays()[200]?.get("x"))
}
@OptIn(ExperimentalCoroutinesApi::class)
@Test
fun hookAddsAreDrainedInPlaceAndNeverRearmTheFlushLoop() =
runTest {