diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/RelayInformationScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/RelayInformationScreen.kt index 9bb4a6934..528e6ea8f 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/RelayInformationScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/RelayInformationScreen.kt @@ -145,7 +145,6 @@ import com.vitorpamplona.quartz.experimental.trustedAssertions.list.TrustProvide import com.vitorpamplona.quartz.experimental.zapPolls.PollNoteEvent import com.vitorpamplona.quartz.nip01Core.core.HexKey import com.vitorpamplona.quartz.nip01Core.metadata.MetadataEvent -import com.vitorpamplona.quartz.nip01Core.relay.client.NostrClient import com.vitorpamplona.quartz.nip01Core.relay.client.stats.ErrorDebugMessage import com.vitorpamplona.quartz.nip01Core.relay.client.stats.IRelayDebugMessage import com.vitorpamplona.quartz.nip01Core.relay.client.stats.NoticeDebugMessage @@ -345,10 +344,9 @@ fun RelayInformationBody( accountViewModel: AccountViewModel, nav: INav, ) { - val nostrClient = remember { Amethyst.instance.client as? NostrClient } - val activeReqs = remember(relay) { nostrClient?.activeRequests(relay) ?: emptyMap() } - val activeCounts = remember(relay) { nostrClient?.activeCounts(relay) ?: emptyMap() } - val activeOutbox = remember(relay) { nostrClient?.activeOutboxCache(relay) ?: emptySet() } + val activeReqs = remember(relay) { accountViewModel.account.client.activeRequests(relay) } + val activeCounts = remember(relay) { accountViewModel.account.client.activeCounts(relay) } + val activeOutbox = remember(relay) { accountViewModel.account.client.activeOutboxCache(relay) } val usedBy = remember(relay) { diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/client/INostrClient.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/client/INostrClient.kt index 05c25ddcf..668c1ff98 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/client/INostrClient.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/client/INostrClient.kt @@ -21,6 +21,7 @@ package com.vitorpamplona.quartz.nip01Core.relay.client import com.vitorpamplona.quartz.nip01Core.core.Event +import com.vitorpamplona.quartz.nip01Core.core.HexKey import com.vitorpamplona.quartz.nip01Core.relay.client.listeners.IRelayClientListener import com.vitorpamplona.quartz.nip01Core.relay.client.reqs.IRequestListener import com.vitorpamplona.quartz.nip01Core.relay.client.single.IRelayClient @@ -78,6 +79,12 @@ interface INostrClient { fun getReqFiltersOrNull(subId: String): Map>? fun getCountFiltersOrNull(subId: String): Map>? + + fun activeRequests(url: NormalizedRelayUrl): Map> + + fun activeCounts(url: NormalizedRelayUrl): Map> + + fun activeOutboxCache(url: NormalizedRelayUrl): Set } object EmptyNostrClient : INostrClient { @@ -123,4 +130,10 @@ object EmptyNostrClient : INostrClient { override fun getReqFiltersOrNull(subId: String): Map>? = null override fun getCountFiltersOrNull(subId: String): Map>? = null + + override fun activeRequests(url: NormalizedRelayUrl): Map> = emptyMap() + + override fun activeCounts(url: NormalizedRelayUrl): Map> = emptyMap() + + override fun activeOutboxCache(url: NormalizedRelayUrl): Set = emptySet() } diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/client/NostrClient.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/client/NostrClient.kt index 768588d6c..8d40797e3 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/client/NostrClient.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/client/NostrClient.kt @@ -313,11 +313,11 @@ class NostrClient( listeners = listeners.minus(listener) } - fun activeRequests(url: NormalizedRelayUrl): Map> = activeRequests.activeFiltersFor(url) + override fun activeRequests(url: NormalizedRelayUrl): Map> = activeRequests.activeFiltersFor(url) - fun activeCounts(url: NormalizedRelayUrl): Map> = activeCounts.activeFiltersFor(url) + override fun activeCounts(url: NormalizedRelayUrl): Map> = activeCounts.activeFiltersFor(url) - fun activeOutboxCache(url: NormalizedRelayUrl): Set = eventOutbox.activeOutboxCacheFor(url) + override fun activeOutboxCache(url: NormalizedRelayUrl): Set = eventOutbox.activeOutboxCacheFor(url) override fun getReqFiltersOrNull(subId: String): Map>? = activeRequests.getSubscriptionFiltersOrNull(subId)