Ensure getEventTimelineItemByEventId is called when we enter in reply mode.
This commit is contained in:
parent
aefeb01cdd
commit
a192a8823f
4 changed files with 53 additions and 7 deletions
|
|
@ -20,6 +20,7 @@ import android.Manifest
|
|||
import android.annotation.SuppressLint
|
||||
import android.net.Uri
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.DisposableEffect
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.MutableState
|
||||
import androidx.compose.runtime.getValue
|
||||
|
|
@ -151,15 +152,24 @@ class MessageComposerPresenter @Inject constructor(
|
|||
}
|
||||
}
|
||||
|
||||
DisposableEffect(Unit) {
|
||||
onDispose {
|
||||
appCoroutineScope.launch {
|
||||
room.exitReplyMode()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun handleEvents(event: MessageComposerEvents) {
|
||||
when (event) {
|
||||
MessageComposerEvents.ToggleFullScreenState -> isFullScreen.value = !isFullScreen.value
|
||||
|
||||
MessageComposerEvents.CloseSpecialMode -> {
|
||||
richTextEditorState.setHtml("")
|
||||
messageComposerContext.composerMode = MessageComposerMode.Normal("")
|
||||
appCoroutineScope.launch {
|
||||
room.exitReplyMode()
|
||||
}
|
||||
}
|
||||
|
||||
is MessageComposerEvents.SendMessage -> appCoroutineScope.sendMessage(
|
||||
message = event.message,
|
||||
updateComposerMode = { messageComposerContext.composerMode = it },
|
||||
|
|
@ -167,6 +177,13 @@ class MessageComposerPresenter @Inject constructor(
|
|||
)
|
||||
is MessageComposerEvents.SetMode -> {
|
||||
messageComposerContext.composerMode = event.composerMode
|
||||
appCoroutineScope.launch {
|
||||
if (event.composerMode is MessageComposerMode.Reply) {
|
||||
room.enterReplyMode(event.composerMode.eventId)
|
||||
} else {
|
||||
room.exitReplyMode()
|
||||
}
|
||||
}
|
||||
}
|
||||
MessageComposerEvents.AddAttachment -> localCoroutineScope.launch {
|
||||
showAttachmentSourcePicker = true
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue