ActionListEvents -> ActionListEvent

This commit is contained in:
Benoit Marty 2026-01-27 09:34:18 +01:00
parent 847766eb33
commit f7c7fdca9e
11 changed files with 77 additions and 77 deletions

View file

@ -52,7 +52,7 @@ import androidx.compose.ui.tooling.preview.PreviewParameter
import androidx.compose.ui.unit.dp
import io.element.android.compound.theme.ElementTheme
import io.element.android.features.messages.api.timeline.voicemessages.composer.VoiceMessageComposerEvent
import io.element.android.features.messages.impl.actionlist.ActionListEvents
import io.element.android.features.messages.impl.actionlist.ActionListEvent
import io.element.android.features.messages.impl.actionlist.ActionListView
import io.element.android.features.messages.impl.actionlist.model.TimelineItemAction
import io.element.android.features.messages.impl.crypto.historyvisible.HistoryVisibleStateView
@ -169,7 +169,7 @@ fun MessagesView(
Timber.v("OnMessageLongClicked= ${event.id}")
hidingKeyboard {
state.actionListState.eventSink(
ActionListEvents.ComputeForMessage(
ActionListEvent.ComputeForMessage(
event = event,
userEventPermissions = state.userEventPermissions,
)

View file

@ -11,10 +11,10 @@ package io.element.android.features.messages.impl.actionlist
import io.element.android.features.messages.impl.UserEventPermissions
import io.element.android.features.messages.impl.timeline.model.TimelineItem
sealed interface ActionListEvents {
data object Clear : ActionListEvents
sealed interface ActionListEvent {
data object Clear : ActionListEvent
data class ComputeForMessage(
val event: TimelineItem.Event,
val userEventPermissions: UserEventPermissions,
) : ActionListEvents
) : ActionListEvent
}

View file

@ -107,10 +107,10 @@ class DefaultActionListPresenter(
val isThreadsEnabled = featureFlagService.isFeatureEnabledFlow(FeatureFlags.Threads).collectAsState(false)
fun handleEvent(event: ActionListEvents) {
fun handleEvent(event: ActionListEvent) {
when (event) {
ActionListEvents.Clear -> target.value = ActionListState.Target.None
is ActionListEvents.ComputeForMessage -> localCoroutineScope.computeForMessage(
ActionListEvent.Clear -> target.value = ActionListState.Target.None
is ActionListEvent.ComputeForMessage -> localCoroutineScope.computeForMessage(
timelineItem = event.event,
usersEventPermissions = event.userEventPermissions,
isDeveloperModeEnabled = isDeveloperModeEnabled,

View file

@ -16,7 +16,7 @@ import kotlinx.collections.immutable.ImmutableList
data class ActionListState(
val target: Target,
val eventSink: (ActionListEvents) -> Unit,
val eventSink: (ActionListEvent) -> Unit,
) {
@Immutable
sealed interface Target {

View file

@ -192,7 +192,7 @@ open class ActionListStateProvider : PreviewParameterProvider<ActionListState> {
fun anActionListState(
target: ActionListState.Target = ActionListState.Target.None,
eventSink: (ActionListEvents) -> Unit = {},
eventSink: (ActionListEvent) -> Unit = {},
) = ActionListState(
target = target,
eventSink = eventSink

View file

@ -118,7 +118,7 @@ fun ActionListView(
) {
if (targetItem == null) return
sheetState.hide(coroutineScope) {
state.eventSink(ActionListEvents.Clear)
state.eventSink(ActionListEvent.Clear)
onSelectAction(itemAction, targetItem)
}
}
@ -126,7 +126,7 @@ fun ActionListView(
fun onEmojiReactionClick(emoji: String) {
if (targetItem == null) return
sheetState.hide(coroutineScope) {
state.eventSink(ActionListEvents.Clear)
state.eventSink(ActionListEvent.Clear)
onEmojiReactionClick(emoji, targetItem)
}
}
@ -134,19 +134,19 @@ fun ActionListView(
fun onCustomReactionClick() {
if (targetItem == null) return
sheetState.hide(coroutineScope) {
state.eventSink(ActionListEvents.Clear)
state.eventSink(ActionListEvent.Clear)
onCustomReactionClick(targetItem)
}
}
fun onDismiss() {
state.eventSink(ActionListEvents.Clear)
state.eventSink(ActionListEvent.Clear)
}
fun onVerifiedUserSendFailureClick() {
if (targetItem == null) return
sheetState.hide(coroutineScope) {
state.eventSink(ActionListEvents.Clear)
state.eventSink(ActionListEvent.Clear)
onVerifiedUserSendFailureClick(targetItem)
}
}

View file

@ -25,7 +25,7 @@ import androidx.compose.ui.tooling.preview.PreviewParameter
import androidx.compose.ui.unit.dp
import im.vector.app.features.analytics.plan.Interaction
import io.element.android.compound.tokens.generated.CompoundIcons
import io.element.android.features.messages.impl.actionlist.ActionListEvents
import io.element.android.features.messages.impl.actionlist.ActionListEvent
import io.element.android.features.messages.impl.actionlist.ActionListView
import io.element.android.features.messages.impl.actionlist.model.TimelineItemAction
import io.element.android.features.messages.impl.link.LinkEvents
@ -175,7 +175,7 @@ private fun PinnedMessagesListLoaded(
) {
fun onActionSelected(timelineItemAction: TimelineItemAction, event: TimelineItem.Event) {
state.actionListState.eventSink(
ActionListEvents.Clear
ActionListEvent.Clear
)
state.eventSink(
PinnedMessagesListEvents.HandleAction(
@ -187,7 +187,7 @@ private fun PinnedMessagesListLoaded(
fun onMessageLongClick(event: TimelineItem.Event) {
state.actionListState.eventSink(
ActionListEvents.ComputeForMessage(
ActionListEvent.ComputeForMessage(
event = event,
userEventPermissions = state.userEventPermissions,
)