mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-11-10 20:16:45 +01:00
Fixes trusted relay lists incorrectly only using DM relays
This commit is contained in:
@@ -52,6 +52,9 @@ class AccountsTorStateConnector(
|
|||||||
listOf(MutableStateFlow(emptySet()))
|
listOf(MutableStateFlow(emptySet()))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (dmFlowReady.isEmpty()) {
|
||||||
|
emit(emptySet())
|
||||||
|
} else {
|
||||||
emitAll(
|
emitAll(
|
||||||
combine(dmFlowReady) {
|
combine(dmFlowReady) {
|
||||||
val dmRelays = mutableSetOf<NormalizedRelayUrl>()
|
val dmRelays = mutableSetOf<NormalizedRelayUrl>()
|
||||||
@@ -61,6 +64,7 @@ class AccountsTorStateConnector(
|
|||||||
dmRelays.toSet()
|
dmRelays.toSet()
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
}
|
||||||
}.onEach {
|
}.onEach {
|
||||||
torEvaluatorFlow.dmRelays.tryEmit(it)
|
torEvaluatorFlow.dmRelays.tryEmit(it)
|
||||||
}.stateIn(
|
}.stateIn(
|
||||||
@@ -74,22 +78,26 @@ class AccountsTorStateConnector(
|
|||||||
accountsCache.accounts
|
accountsCache.accounts
|
||||||
.debounce(200)
|
.debounce(200)
|
||||||
.transformLatest { snapshot ->
|
.transformLatest { snapshot ->
|
||||||
val dmFlows = snapshot.map { it.value.dmRelayList.flow }
|
val trustedRelayFlows = snapshot.map { it.value.trustedRelays.flow }
|
||||||
|
|
||||||
val dmFlowReady =
|
val trustedRelayFlowReady =
|
||||||
dmFlows.ifEmpty {
|
trustedRelayFlows.ifEmpty {
|
||||||
listOf(MutableStateFlow(emptySet()))
|
listOf(MutableStateFlow(emptySet()))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (trustedRelayFlowReady.isEmpty()) {
|
||||||
|
emit(emptySet())
|
||||||
|
} else {
|
||||||
emitAll(
|
emitAll(
|
||||||
combine(dmFlowReady) {
|
combine(trustedRelayFlowReady) {
|
||||||
val dmRelays = mutableSetOf<NormalizedRelayUrl>()
|
val trustedRelays = mutableSetOf<NormalizedRelayUrl>()
|
||||||
it.forEach {
|
it.forEach {
|
||||||
dmRelays.addAll(it)
|
trustedRelays.addAll(it)
|
||||||
}
|
}
|
||||||
dmRelays.toSet()
|
trustedRelays.toSet()
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
}
|
||||||
}.onEach {
|
}.onEach {
|
||||||
torEvaluatorFlow.trustedRelays.tryEmit(it)
|
torEvaluatorFlow.trustedRelays.tryEmit(it)
|
||||||
}.stateIn(
|
}.stateIn(
|
||||||
|
|||||||
Reference in New Issue
Block a user