Skip to content

Commit 9857868

Browse files
committed
Improve the preview
1 parent 37f3e25 commit 9857868

File tree

1 file changed

+23
-10
lines changed

1 file changed

+23
-10
lines changed

features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/actionlist/ActionListStateProvider.kt

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import io.element.android.features.messages.impl.timeline.model.event.aTimelineI
2323
import io.element.android.libraries.matrix.api.timeline.item.event.MessageShield
2424
import kotlinx.collections.immutable.ImmutableList
2525
import kotlinx.collections.immutable.persistentListOf
26+
import kotlinx.collections.immutable.toPersistentList
2627

2728
open class ActionListStateProvider : PreviewParameterProvider<ActionListState> {
2829
override val values: Sequence<ActionListState>
@@ -50,7 +51,9 @@ open class ActionListStateProvider : PreviewParameterProvider<ActionListState> {
5051
),
5152
displayEmojiReactions = true,
5253
verifiedUserSendFailure = VerifiedUserSendFailure.None,
53-
actions = aTimelineItemActionList(),
54+
actions = aTimelineItemActionList(
55+
copyAction = TimelineItemAction.CopyCaption,
56+
),
5457
)
5558
),
5659
anActionListState(
@@ -61,7 +64,9 @@ open class ActionListStateProvider : PreviewParameterProvider<ActionListState> {
6164
),
6265
displayEmojiReactions = true,
6366
verifiedUserSendFailure = VerifiedUserSendFailure.None,
64-
actions = aTimelineItemActionList(),
67+
actions = aTimelineItemActionList(
68+
copyAction = TimelineItemAction.CopyCaption,
69+
),
6570
)
6671
),
6772
anActionListState(
@@ -72,7 +77,9 @@ open class ActionListStateProvider : PreviewParameterProvider<ActionListState> {
7277
),
7378
displayEmojiReactions = true,
7479
verifiedUserSendFailure = VerifiedUserSendFailure.None,
75-
actions = aTimelineItemActionList(),
80+
actions = aTimelineItemActionList(
81+
copyAction = null,
82+
),
7683
)
7784
),
7885
anActionListState(
@@ -83,18 +90,22 @@ open class ActionListStateProvider : PreviewParameterProvider<ActionListState> {
8390
),
8491
displayEmojiReactions = true,
8592
verifiedUserSendFailure = VerifiedUserSendFailure.None,
86-
actions = aTimelineItemActionList(),
93+
actions = aTimelineItemActionList(
94+
copyAction = TimelineItemAction.CopyCaption,
95+
),
8796
)
8897
),
8998
anActionListState(
9099
target = ActionListState.Target.Success(
91100
event = aTimelineItemEvent(
92-
content = aTimelineItemVoiceContent(),
101+
content = aTimelineItemVoiceContent(caption = null),
93102
timelineItemReactions = reactionsState
94103
),
95104
displayEmojiReactions = true,
96105
verifiedUserSendFailure = VerifiedUserSendFailure.None,
97-
actions = aTimelineItemActionList(),
106+
actions = aTimelineItemActionList(
107+
copyAction = null,
108+
),
98109
)
99110
),
100111
anActionListState(
@@ -161,17 +172,19 @@ fun anActionListState(
161172
eventSink = eventSink
162173
)
163174

164-
fun aTimelineItemActionList(): ImmutableList<TimelineItemAction> {
165-
return persistentListOf(
175+
fun aTimelineItemActionList(
176+
copyAction: TimelineItemAction? = TimelineItemAction.CopyText
177+
): ImmutableList<TimelineItemAction> {
178+
return listOfNotNull(
166179
TimelineItemAction.Reply,
167180
TimelineItemAction.Forward,
168-
TimelineItemAction.CopyText,
181+
copyAction,
169182
TimelineItemAction.CopyLink,
170183
TimelineItemAction.Edit,
171184
TimelineItemAction.Redact,
172185
TimelineItemAction.ReportContent,
173186
TimelineItemAction.ViewSource,
174-
)
187+
).toPersistentList()
175188
}
176189

177190
fun aTimelineItemPollActionList(): ImmutableList<TimelineItemAction> {

0 commit comments

Comments
 (0)