mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-09-27 03:57:21 +02:00
Fixes crash when the relay url of a user is duplicated.
This commit is contained in:
@@ -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.DividerThickness
|
||||||
import com.vitorpamplona.amethyst.ui.theme.FeedPadding
|
import com.vitorpamplona.amethyst.ui.theme.FeedPadding
|
||||||
import com.vitorpamplona.ammolite.relays.BundledUpdate
|
import com.vitorpamplona.ammolite.relays.BundledUpdate
|
||||||
|
import com.vitorpamplona.quartz.encoders.RelayUrlFormatter
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.flow.MutableStateFlow
|
import kotlinx.coroutines.flow.MutableStateFlow
|
||||||
import kotlinx.coroutines.flow.asStateFlow
|
import kotlinx.coroutines.flow.asStateFlow
|
||||||
@@ -74,9 +75,10 @@ class RelayFeedViewModel :
|
|||||||
val beingUsedSet = currentUser?.relaysBeingUsed?.keys ?: emptySet()
|
val beingUsedSet = currentUser?.relaysBeingUsed?.keys ?: emptySet()
|
||||||
|
|
||||||
val newRelaysFromRecord =
|
val newRelaysFromRecord =
|
||||||
currentUser?.latestContactList?.relays()?.entries?.mapNotNull {
|
currentUser?.latestContactList?.relays()?.entries?.mapNotNullTo(HashSet()) {
|
||||||
if (it.key !in beingUsedSet) {
|
val url = RelayUrlFormatter.normalize(it.key)
|
||||||
RelayInfo(it.key, 0, 0)
|
if (url !in beingUsedSet) {
|
||||||
|
RelayInfo(url, 0, 0)
|
||||||
} else {
|
} else {
|
||||||
null
|
null
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user