reformating

This commit is contained in:
Adam Brown 2021-11-23 18:22:47 +00:00
parent 70d25653c8
commit 6838e701b5
1 changed files with 7 additions and 7 deletions

View File

@ -405,7 +405,7 @@ class MessageComposerViewModel @AssistedInject constructor(
_viewEvents.post(MessageComposerViewEvents.MessageSent) _viewEvents.post(MessageComposerViewEvents.MessageSent)
popDraft() popDraft()
} }
is SendMode.Quote -> { is SendMode.Quote -> {
val messageContent = state.sendMode.timelineEvent.getLastMessageContent() val messageContent = state.sendMode.timelineEvent.getLastMessageContent()
val textMsg = messageContent?.body val textMsg = messageContent?.body
@ -426,7 +426,7 @@ class MessageComposerViewModel @AssistedInject constructor(
_viewEvents.post(MessageComposerViewEvents.MessageSent) _viewEvents.post(MessageComposerViewEvents.MessageSent)
popDraft() popDraft()
} }
is SendMode.Reply -> { is SendMode.Reply -> {
state.sendMode.timelineEvent.let { state.sendMode.timelineEvent.let {
room.replyToMessage(it, action.text.toString(), action.autoMarkdown) room.replyToMessage(it, action.text.toString(), action.autoMarkdown)
_viewEvents.post(MessageComposerViewEvents.MessageSent) _viewEvents.post(MessageComposerViewEvents.MessageSent)
@ -457,22 +457,22 @@ class MessageComposerViewModel @AssistedInject constructor(
// Create a sendMode from a draft and retrieve the TimelineEvent // Create a sendMode from a draft and retrieve the TimelineEvent
sendMode = when (currentDraft) { sendMode = when (currentDraft) {
is UserDraft.Regular -> SendMode.Regular(currentDraft.text, false) is UserDraft.Regular -> SendMode.Regular(currentDraft.text, false)
is UserDraft.Quote -> { is UserDraft.Quote -> {
room.getTimeLineEvent(currentDraft.linkedEventId)?.let { timelineEvent -> room.getTimeLineEvent(currentDraft.linkedEventId)?.let { timelineEvent ->
SendMode.Quote(timelineEvent, currentDraft.text) SendMode.Quote(timelineEvent, currentDraft.text)
} }
} }
is UserDraft.Reply -> { is UserDraft.Reply -> {
room.getTimeLineEvent(currentDraft.linkedEventId)?.let { timelineEvent -> room.getTimeLineEvent(currentDraft.linkedEventId)?.let { timelineEvent ->
SendMode.Reply(timelineEvent, currentDraft.text) SendMode.Reply(timelineEvent, currentDraft.text)
} }
} }
is UserDraft.Edit -> { is UserDraft.Edit -> {
room.getTimeLineEvent(currentDraft.linkedEventId)?.let { timelineEvent -> room.getTimeLineEvent(currentDraft.linkedEventId)?.let { timelineEvent ->
SendMode.Edit(timelineEvent, currentDraft.text) SendMode.Edit(timelineEvent, currentDraft.text)
} }
} }
else -> null else -> null
} ?: SendMode.Regular("", fromSharing = false) } ?: SendMode.Regular("", fromSharing = false)
) )
} }
@ -691,7 +691,7 @@ class MessageComposerViewModel @AssistedInject constructor(
setState { copy(sendMode = it.sendMode.copy(text = action.draft)) } setState { copy(sendMode = it.sendMode.copy(text = action.draft)) }
room.saveDraft(UserDraft.Quote(it.sendMode.timelineEvent.root.eventId!!, action.draft)) room.saveDraft(UserDraft.Quote(it.sendMode.timelineEvent.root.eventId!!, action.draft))
} }
it.sendMode is SendMode.Edit -> { it.sendMode is SendMode.Edit -> {
setState { copy(sendMode = it.sendMode.copy(text = action.draft)) } setState { copy(sendMode = it.sendMode.copy(text = action.draft)) }
room.saveDraft(UserDraft.Edit(it.sendMode.timelineEvent.root.eventId!!, action.draft)) room.saveDraft(UserDraft.Edit(it.sendMode.timelineEvent.root.eventId!!, action.draft))
} }