ReactionSummaryEvents -> ReactionSummaryEvent
This commit is contained in:
parent
f327461358
commit
dd7c9dee78
8 changed files with 17 additions and 17 deletions
|
|
@ -30,7 +30,7 @@ import io.element.android.features.messages.impl.timeline.aTimelineItemList
|
|||
import io.element.android.features.messages.impl.timeline.aTimelineState
|
||||
import io.element.android.features.messages.impl.timeline.components.customreaction.CustomReactionEvent
|
||||
import io.element.android.features.messages.impl.timeline.components.customreaction.CustomReactionState
|
||||
import io.element.android.features.messages.impl.timeline.components.reactionsummary.ReactionSummaryEvents
|
||||
import io.element.android.features.messages.impl.timeline.components.reactionsummary.ReactionSummaryEvent
|
||||
import io.element.android.features.messages.impl.timeline.components.reactionsummary.ReactionSummaryState
|
||||
import io.element.android.features.messages.impl.timeline.components.receipt.bottomsheet.ReadReceiptBottomSheetEvents
|
||||
import io.element.android.features.messages.impl.timeline.components.receipt.bottomsheet.ReadReceiptBottomSheetState
|
||||
|
|
@ -187,7 +187,7 @@ fun aUserEventPermissions(
|
|||
|
||||
fun aReactionSummaryState(
|
||||
target: ReactionSummaryState.Summary? = null,
|
||||
eventSink: (ReactionSummaryEvents) -> Unit = {}
|
||||
eventSink: (ReactionSummaryEvent) -> Unit = {}
|
||||
) = ReactionSummaryState(
|
||||
target = target,
|
||||
eventSink = eventSink,
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ import io.element.android.features.messages.impl.timeline.aTimelineItemEvent
|
|||
import io.element.android.features.messages.impl.timeline.aTimelineState
|
||||
import io.element.android.features.messages.impl.timeline.components.customreaction.CustomReactionBottomSheet
|
||||
import io.element.android.features.messages.impl.timeline.components.customreaction.CustomReactionEvent
|
||||
import io.element.android.features.messages.impl.timeline.components.reactionsummary.ReactionSummaryEvents
|
||||
import io.element.android.features.messages.impl.timeline.components.reactionsummary.ReactionSummaryEvent
|
||||
import io.element.android.features.messages.impl.timeline.components.reactionsummary.ReactionSummaryView
|
||||
import io.element.android.features.messages.impl.timeline.components.receipt.bottomsheet.ReadReceiptBottomSheet
|
||||
import io.element.android.features.messages.impl.timeline.components.receipt.bottomsheet.ReadReceiptBottomSheetEvents
|
||||
|
|
@ -187,7 +187,7 @@ fun MessagesView(
|
|||
|
||||
fun onEmojiReactionLongClick(emoji: String, event: TimelineItem.Event) {
|
||||
if (event.eventId == null) return
|
||||
state.reactionSummaryState.eventSink(ReactionSummaryEvents.ShowReactionSummary(event.eventId, event.reactionsState.reactions, emoji))
|
||||
state.reactionSummaryState.eventSink(ReactionSummaryEvent.ShowReactionSummary(event.eventId, event.reactionsState.reactions, emoji))
|
||||
}
|
||||
|
||||
fun onMoreReactionsClick(event: TimelineItem.Event) {
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ package io.element.android.features.messages.impl.timeline.components.reactionsu
|
|||
import io.element.android.features.messages.impl.timeline.model.AggregatedReaction
|
||||
import io.element.android.libraries.matrix.api.core.EventId
|
||||
|
||||
sealed interface ReactionSummaryEvents {
|
||||
data object Clear : ReactionSummaryEvents
|
||||
data class ShowReactionSummary(val eventId: EventId, val reactions: List<AggregatedReaction>, val selectedKey: String) : ReactionSummaryEvents
|
||||
sealed interface ReactionSummaryEvent {
|
||||
data object Clear : ReactionSummaryEvent
|
||||
data class ShowReactionSummary(val eventId: EventId, val reactions: List<AggregatedReaction>, val selectedKey: String) : ReactionSummaryEvent
|
||||
}
|
||||
|
|
@ -37,14 +37,14 @@ class ReactionSummaryPresenter(
|
|||
}
|
||||
val targetWithAvatars = populateSenderAvatars(members = membersState.roomMembers().orEmpty().toImmutableList(), summary = target.value)
|
||||
|
||||
fun handleEvent(event: ReactionSummaryEvents) {
|
||||
fun handleEvent(event: ReactionSummaryEvent) {
|
||||
when (event) {
|
||||
is ReactionSummaryEvents.ShowReactionSummary -> target.value = ReactionSummaryState.Summary(
|
||||
is ReactionSummaryEvent.ShowReactionSummary -> target.value = ReactionSummaryState.Summary(
|
||||
reactions = event.reactions.toImmutableList(),
|
||||
selectedKey = event.selectedKey,
|
||||
selectedEventId = event.eventId
|
||||
)
|
||||
ReactionSummaryEvents.Clear -> target.value = null
|
||||
ReactionSummaryEvent.Clear -> target.value = null
|
||||
}
|
||||
}
|
||||
return ReactionSummaryState(
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ import kotlinx.collections.immutable.ImmutableList
|
|||
|
||||
data class ReactionSummaryState(
|
||||
val target: Summary?,
|
||||
val eventSink: (ReactionSummaryEvents) -> Unit
|
||||
val eventSink: (ReactionSummaryEvent) -> Unit
|
||||
) {
|
||||
data class Summary(
|
||||
val reactions: ImmutableList<AggregatedReaction>,
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ fun ReactionSummaryView(
|
|||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
fun onDismiss() {
|
||||
state.eventSink(ReactionSummaryEvents.Clear)
|
||||
state.eventSink(ReactionSummaryEvent.Clear)
|
||||
}
|
||||
|
||||
if (state.target != null) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue