mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-04-01 00:18:30 +02:00
Fixes crash when the relay url of a user is duplicated.
This commit is contained in:
parent
75e45f37b2
commit
6c81fbbcf9
@ -45,6 +45,7 @@ import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
||||
import com.vitorpamplona.amethyst.ui.theme.DividerThickness
|
||||
import com.vitorpamplona.amethyst.ui.theme.FeedPadding
|
||||
import com.vitorpamplona.ammolite.relays.BundledUpdate
|
||||
import com.vitorpamplona.quartz.encoders.RelayUrlFormatter
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.asStateFlow
|
||||
@ -74,9 +75,10 @@ class RelayFeedViewModel :
|
||||
val beingUsedSet = currentUser?.relaysBeingUsed?.keys ?: emptySet()
|
||||
|
||||
val newRelaysFromRecord =
|
||||
currentUser?.latestContactList?.relays()?.entries?.mapNotNull {
|
||||
if (it.key !in beingUsedSet) {
|
||||
RelayInfo(it.key, 0, 0)
|
||||
currentUser?.latestContactList?.relays()?.entries?.mapNotNullTo(HashSet()) {
|
||||
val url = RelayUrlFormatter.normalize(it.key)
|
||||
if (url !in beingUsedSet) {
|
||||
RelayInfo(url, 0, 0)
|
||||
} else {
|
||||
null
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user