mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-04 10:32:34 +00:00
Extract methods aMessageComposerModeEdit() and aMessageComposerModeReply()
This commit is contained in:
+21
-4
@@ -579,7 +579,7 @@ internal fun TextComposerEditPreview() = ElementPreview {
|
|||||||
ATextComposer(
|
ATextComposer(
|
||||||
TextEditorState.Rich(aRichTextEditorState(initialText = "A message", initialFocus = true)),
|
TextEditorState.Rich(aRichTextEditorState(initialText = "A message", initialFocus = true)),
|
||||||
voiceMessageState = VoiceMessageState.Idle,
|
voiceMessageState = VoiceMessageState.Idle,
|
||||||
composerMode = MessageComposerMode.Edit(EventId("$1234"), TransactionId("1234"), "Some text"),
|
composerMode = aMessageComposerModeEdit(),
|
||||||
enableVoiceMessages = true,
|
enableVoiceMessages = true,
|
||||||
)
|
)
|
||||||
}))
|
}))
|
||||||
@@ -592,7 +592,7 @@ internal fun MarkdownTextComposerEditPreview() = ElementPreview {
|
|||||||
ATextComposer(
|
ATextComposer(
|
||||||
TextEditorState.Markdown(aMarkdownTextEditorState(initialText = "A message", initialFocus = true)),
|
TextEditorState.Markdown(aMarkdownTextEditorState(initialText = "A message", initialFocus = true)),
|
||||||
voiceMessageState = VoiceMessageState.Idle,
|
voiceMessageState = VoiceMessageState.Idle,
|
||||||
composerMode = MessageComposerMode.Edit(EventId("$1234"), TransactionId("1234"), "Some text"),
|
composerMode = aMessageComposerModeEdit(),
|
||||||
enableVoiceMessages = true,
|
enableVoiceMessages = true,
|
||||||
)
|
)
|
||||||
}))
|
}))
|
||||||
@@ -604,9 +604,8 @@ internal fun TextComposerReplyPreview(@PreviewParameter(InReplyToDetailsProvider
|
|||||||
ATextComposer(
|
ATextComposer(
|
||||||
state = TextEditorState.Rich(aRichTextEditorState()),
|
state = TextEditorState.Rich(aRichTextEditorState()),
|
||||||
voiceMessageState = VoiceMessageState.Idle,
|
voiceMessageState = VoiceMessageState.Idle,
|
||||||
composerMode = MessageComposerMode.Reply(
|
composerMode = aMessageComposerModeReply(
|
||||||
replyToDetails = inReplyToDetails,
|
replyToDetails = inReplyToDetails,
|
||||||
hideImage = false,
|
|
||||||
),
|
),
|
||||||
enableVoiceMessages = true,
|
enableVoiceMessages = true,
|
||||||
)
|
)
|
||||||
@@ -718,3 +717,21 @@ fun aRichTextEditorState(
|
|||||||
initialMarkdown = initialMarkdown,
|
initialMarkdown = initialMarkdown,
|
||||||
initialFocus = initialFocus,
|
initialFocus = initialFocus,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
fun aMessageComposerModeEdit(
|
||||||
|
eventId: EventId? = EventId("$1234"),
|
||||||
|
transactionId: TransactionId? = TransactionId("1234"),
|
||||||
|
content: String = "Some text",
|
||||||
|
) = MessageComposerMode.Edit(
|
||||||
|
eventId = eventId,
|
||||||
|
transactionId = transactionId,
|
||||||
|
content = content
|
||||||
|
)
|
||||||
|
|
||||||
|
fun aMessageComposerModeReply(
|
||||||
|
replyToDetails: InReplyToDetails,
|
||||||
|
hideImage: Boolean = false,
|
||||||
|
) = MessageComposerMode.Reply(
|
||||||
|
replyToDetails = replyToDetails,
|
||||||
|
hideImage = hideImage,
|
||||||
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user