reformating

This commit is contained in:
Adam Brown 2021-11-23 18:22:47 +00:00
parent 70d25653c8
commit 6838e701b5

View file

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