Use renderComposerMode (disable formattedContent which crashes)

This commit is contained in:
ganfra 2022-12-02 19:12:29 +01:00
parent 13bbcc6e26
commit 2d54838e4f
2 changed files with 8 additions and 4 deletions

View file

@ -485,11 +485,15 @@ class RichTextComposerLayout @JvmOverloads constructor(
} else {
views.composerModeGroup.isGone = true
(mode as? MessageComposerMode.Normal)?.content?.let { text ->
// TODO: un-comment once we update to a version of the lib > 0.8.0
/*
if (isTextFormattingEnabled) {
replaceFormattedContent(text)
} else {
views.plainTextComposerEditText.setText(text)
}
*/
views.plainTextComposerEditText.setText(text)
}
views.sendButton.contentDescription = resources.getString(ElementR.string.action_send)
hasRelatedMessage = false

View file

@ -36,6 +36,7 @@ fun TextComposer(
FakeComposer(modifier)
return
}
val isInDarkMode = isSystemInDarkTheme()
AndroidView(
modifier = modifier,
@ -86,10 +87,10 @@ fun TextComposer(
// Example of Compose -> View communication
val messageComposerView = (view as MessageComposerView)
view.setFullScreen(fullscreen, animated = false, manageKeyboard = false)
// TODO: un-comment once we update to a version of the lib > 0.8.0
// messageComposerView.renderComposerMode(composerMode)
messageComposerView.renderComposerMode(composerMode)
messageComposerView.sendButton.isInvisible = !composerCanSendMessage
messageComposerView.setTextIfDifferent(composerText ?: "")
messageComposerView.editText.requestFocus()
}
)
}
@ -124,8 +125,7 @@ private fun MessageComposerView.setup(isDarkMode: Boolean, composerMode: Message
emojiButton?.isVisible = true
sendButton.isVisible = true
editText.maxLines = MessageComposerView.MAX_LINES_WHEN_COLLAPSED
// TODO: un-comment once we update to a version of the lib > 0.8.0
// renderComposerMode(composerMode)
renderComposerMode(composerMode)
}
@Preview