fix to not set clipboard text repeatedly

initMessageInputView() is called repeatedly when capabilities are received. This is not a good solution but was done because capabilities are needed inside initMessageInputView().

As sharedText is set inside initMessageInputView(), this caused the bug that text was repeatedly inserted in to the message input field.

All in all, there is only the need to initialize initMessageInputView() once. With this fix, it is for now done when there is no filter set yet. As a long term solution, the architecture must be changed so that initMessageInputView() is not called repeatedly, but all UI elements that need capabilities etc are updated by livedata.

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
Marcel Hibbe 2024-05-17 14:09:40 +02:00
parent 7bd2e6c81a
commit cc823dcc0c
No known key found for this signature in database
GPG Key ID: C793F8B59F43CE7B

View File

@ -1156,6 +1156,7 @@ class ChatActivity :
}
private fun initMessageInputView() {
if (binding.messageInputView.inputEditText?.filters?.isEmpty() == true) {
val filters = arrayOfNulls<InputFilter>(1)
val lengthFilter = CapabilitiesUtil.getMessageMaxLength(spreedCapabilities)
@ -1243,6 +1244,7 @@ class ChatActivity :
binding.messageInputView.button?.contentDescription =
resources?.getString(R.string.nc_description_send_message_button)
}
}
private fun editMessageAPI(message: ChatMessage, editedMessageText: String) {
var apiVersion = 1