mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-03-26 01:31:58 +01:00
Making sure an empty relay list uses the default list from Amethyst
This commit is contained in:
parent
15ab955a7d
commit
d1da863d3c
@ -2761,19 +2761,22 @@ class Account(
|
||||
// Takes a User's relay list and adds the types of feeds they are active for.
|
||||
fun activeRelays(): Array<RelaySetupInfo>? {
|
||||
val usersRelayList =
|
||||
userProfile().latestContactList?.relays()?.map {
|
||||
val url = RelayUrlFormatter.normalize(it.key)
|
||||
userProfile()
|
||||
.latestContactList
|
||||
?.relays()
|
||||
?.map {
|
||||
val url = RelayUrlFormatter.normalize(it.key)
|
||||
|
||||
val localFeedTypes =
|
||||
localRelays.firstOrNull { localRelay -> RelayUrlFormatter.normalize(localRelay.url) == url }?.feedTypes?.minus(setOf(FeedType.SEARCH, FeedType.WALLET_CONNECT))
|
||||
?: Constants.defaultRelays
|
||||
.filter { defaultRelay -> defaultRelay.url == url }
|
||||
.firstOrNull()
|
||||
?.feedTypes
|
||||
?: Constants.activeTypesGlobalChats
|
||||
val localFeedTypes =
|
||||
localRelays.firstOrNull { localRelay -> RelayUrlFormatter.normalize(localRelay.url) == url }?.feedTypes?.minus(setOf(FeedType.SEARCH, FeedType.WALLET_CONNECT))
|
||||
?: Constants.defaultRelays
|
||||
.filter { defaultRelay -> defaultRelay.url == url }
|
||||
.firstOrNull()
|
||||
?.feedTypes
|
||||
?: Constants.activeTypesGlobalChats
|
||||
|
||||
RelaySetupInfo(url, it.value.read, it.value.write, localFeedTypes)
|
||||
} ?: return null
|
||||
RelaySetupInfo(url, it.value.read, it.value.write, localFeedTypes)
|
||||
}?.ifEmpty { null } ?: return null
|
||||
|
||||
return usersRelayList.toTypedArray()
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user