From 09efb04a8f0451ffc031e6abe6042522d6ef1ef2 Mon Sep 17 00:00:00 2001 From: hayaksi1 <193020925+hayaksi1@users.noreply.github.com> Date: Mon, 10 Aug 2026 10:59:22 +0300 Subject: [PATCH] Hold the revealed event ids in a plain set The store no longer needs a mutableStateSetOf: an ordinary Set kept in a mutableStateOf does the same job, and matches DefaultMediaPreviewConfigStateStore. The Compose state itself has to stay. TimelineProtectionPresenter derives ProtectionState from the store inside a derivedStateOf, so the set must be a snapshot object for a reveal to invalidate it and reach the timeline. Backing it with a plain mutableSetOf leaves the presenter with nothing to observe and it stops emitting after ShowContent. --- .../impl/timeline/protection/TimelineProtectionStore.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/protection/TimelineProtectionStore.kt b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/protection/TimelineProtectionStore.kt index fe0c753fac..019f4eabd6 100644 --- a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/protection/TimelineProtectionStore.kt +++ b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/protection/TimelineProtectionStore.kt @@ -7,7 +7,7 @@ package io.element.android.features.messages.impl.timeline.protection -import androidx.compose.runtime.mutableStateSetOf +import androidx.compose.runtime.mutableStateOf import dev.zacsweers.metro.ContributesBinding import dev.zacsweers.metro.SingleIn import io.element.android.libraries.di.SessionScope @@ -21,11 +21,11 @@ interface TimelineProtectionStore { @ContributesBinding(SessionScope::class) @SingleIn(SessionScope::class) class DefaultTimelineProtectionStore : TimelineProtectionStore { - private val allowedEvents = mutableStateSetOf() + private val allowedEvents = mutableStateOf(emptySet()) - override val allowedEventIds: Set = allowedEvents + override val allowedEventIds: Set get() = allowedEvents.value override fun allowEvent(eventId: EventId) { - allowedEvents += eventId + allowedEvents.value = allowedEvents.value + eventId } }