From ad449ba23987636b4958a8ce9fd116f20cc6e222 Mon Sep 17 00:00:00 2001 From: Vitor Pamplona Date: Thu, 11 Jul 2024 11:34:40 -0400 Subject: [PATCH] Activates the top nav list building when deletion events are received as well --- .../amethyst/ui/navigation/AppTopBar.kt | 29 +++++++++++++++---- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/navigation/AppTopBar.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/navigation/AppTopBar.kt index af4a72742..2cda3572b 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/navigation/AppTopBar.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/navigation/AppTopBar.kt @@ -141,6 +141,7 @@ import com.vitorpamplona.ammolite.relays.Client import com.vitorpamplona.ammolite.relays.RelayPool import com.vitorpamplona.quartz.events.ChatroomKey import com.vitorpamplona.quartz.events.ContactListEvent +import com.vitorpamplona.quartz.events.DeletionEvent import com.vitorpamplona.quartz.events.MuteListEvent import com.vitorpamplona.quartz.events.PeopleListEvent import kotlinx.collections.immutable.ImmutableList @@ -325,7 +326,10 @@ private fun DvmTopBar( model = it, contentDescription = null, contentScale = ContentScale.Crop, - modifier = Modifier.size(Size34dp).clip(shape = CircleShape), + modifier = + Modifier + .size(Size34dp) + .clip(shape = CircleShape), ) } ?: run { NoteAuthorPicture(baseNote = appDefinitionNote, size = Size34dp, accountViewModel = accountViewModel) } @@ -700,11 +704,26 @@ class FollowListViewModel( LocalCache.live.newEventBundles.transformLatest { newNotes -> val hasNewList = newNotes.any { - it.event?.pubKey() == account.userProfile().pubkeyHex && + val noteEvent = it.event + + noteEvent?.pubKey() == account.userProfile().pubkeyHex && ( - it.event is PeopleListEvent || - it.event is MuteListEvent || - it.event is ContactListEvent + ( + noteEvent is PeopleListEvent || + noteEvent is MuteListEvent || + noteEvent is ContactListEvent + ) || + ( + noteEvent is DeletionEvent && + ( + noteEvent.deleteEvents().any { + LocalCache.getNoteIfExists(it)?.event is PeopleListEvent + } || + noteEvent.deleteAddresses().any { + it.kind == PeopleListEvent.KIND + } + ) + ) ) }