CustomReactionEvents -> CustomReactionEvent
This commit is contained in:
parent
60b261cd61
commit
cca2fa5ccc
8 changed files with 24 additions and 24 deletions
|
|
@ -28,7 +28,7 @@ import io.element.android.features.messages.impl.pinned.banner.aLoadedPinnedMess
|
|||
import io.element.android.features.messages.impl.timeline.TimelineState
|
||||
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.CustomReactionEvents
|
||||
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.ReactionSummaryState
|
||||
|
|
@ -196,7 +196,7 @@ fun aReactionSummaryState(
|
|||
fun aCustomReactionState(
|
||||
target: CustomReactionState.Target = CustomReactionState.Target.None,
|
||||
recentEmojis: ImmutableList<String> = persistentListOf(),
|
||||
eventSink: (CustomReactionEvents) -> Unit = {},
|
||||
eventSink: (CustomReactionEvent) -> Unit = {},
|
||||
) = CustomReactionState(
|
||||
target = target,
|
||||
recentEmojis = recentEmojis,
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ import io.element.android.features.messages.impl.timeline.aTimelineItemDaySepara
|
|||
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.CustomReactionEvents
|
||||
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.ReactionSummaryView
|
||||
import io.element.android.features.messages.impl.timeline.components.receipt.bottomsheet.ReadReceiptBottomSheet
|
||||
|
|
@ -191,7 +191,7 @@ fun MessagesView(
|
|||
}
|
||||
|
||||
fun onMoreReactionsClick(event: TimelineItem.Event) {
|
||||
state.customReactionState.eventSink(CustomReactionEvents.ShowCustomReactionSheet(event))
|
||||
state.customReactionState.eventSink(CustomReactionEvent.ShowCustomReactionSheet(event))
|
||||
}
|
||||
|
||||
val expandableState = rememberExpandableBottomSheetLayoutState()
|
||||
|
|
@ -367,7 +367,7 @@ fun MessagesView(
|
|||
}
|
||||
},
|
||||
onCustomReactionClick = { event ->
|
||||
state.customReactionState.eventSink(CustomReactionEvents.ShowCustomReactionSheet(event))
|
||||
state.customReactionState.eventSink(CustomReactionEvent.ShowCustomReactionSheet(event))
|
||||
},
|
||||
onEmojiReactionClick = ::onEmojiReactionClick,
|
||||
onVerifiedUserSendFailureClick = { event ->
|
||||
|
|
|
|||
|
|
@ -35,13 +35,13 @@ fun CustomReactionBottomSheet(
|
|||
val target = state.target as? CustomReactionState.Target.Success
|
||||
|
||||
fun onDismiss() {
|
||||
state.eventSink(CustomReactionEvents.DismissCustomReactionSheet)
|
||||
state.eventSink(CustomReactionEvent.DismissCustomReactionSheet)
|
||||
}
|
||||
|
||||
fun onEmojiSelectedDismiss(emoji: Emoji) {
|
||||
if (target?.event == null) return
|
||||
sheetState.hide(coroutineScope) {
|
||||
state.eventSink(CustomReactionEvents.DismissCustomReactionSheet)
|
||||
state.eventSink(CustomReactionEvent.DismissCustomReactionSheet)
|
||||
onSelectEmoji(target.event.eventOrTransactionId, emoji)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ package io.element.android.features.messages.impl.timeline.components.customreac
|
|||
|
||||
import io.element.android.features.messages.impl.timeline.model.TimelineItem
|
||||
|
||||
sealed interface CustomReactionEvents {
|
||||
data class ShowCustomReactionSheet(val event: TimelineItem.Event) : CustomReactionEvents
|
||||
data object DismissCustomReactionSheet : CustomReactionEvents
|
||||
sealed interface CustomReactionEvent {
|
||||
data class ShowCustomReactionSheet(val event: TimelineItem.Event) : CustomReactionEvent
|
||||
data object DismissCustomReactionSheet : CustomReactionEvent
|
||||
}
|
||||
|
|
@ -54,10 +54,10 @@ class CustomReactionPresenter(
|
|||
target.value = CustomReactionState.Target.None
|
||||
}
|
||||
|
||||
fun handleEvent(event: CustomReactionEvents) {
|
||||
fun handleEvent(event: CustomReactionEvent) {
|
||||
when (event) {
|
||||
is CustomReactionEvents.ShowCustomReactionSheet -> handleShowCustomReactionSheet(event.event)
|
||||
is CustomReactionEvents.DismissCustomReactionSheet -> handleDismissCustomReactionSheet()
|
||||
is CustomReactionEvent.ShowCustomReactionSheet -> handleShowCustomReactionSheet(event.event)
|
||||
is CustomReactionEvent.DismissCustomReactionSheet -> handleDismissCustomReactionSheet()
|
||||
}
|
||||
}
|
||||
val event = (target.value as? CustomReactionState.Target.Success)?.event
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ data class CustomReactionState(
|
|||
val target: Target,
|
||||
val selectedEmoji: ImmutableSet<String>,
|
||||
val recentEmojis: ImmutableList<String>,
|
||||
val eventSink: (CustomReactionEvents) -> Unit,
|
||||
val eventSink: (CustomReactionEvent) -> Unit,
|
||||
) {
|
||||
sealed interface Target {
|
||||
data object None : Target
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue