mirror of
https://github.com/nextcloud/talk-android
synced 2025-01-19 13:41:26 +00:00
got editing down
Signed-off-by: rapterjet2004 <juliuslinus1@gmail.com>
This commit is contained in:
parent
8cd0983088
commit
411a4f1dce
@ -3666,7 +3666,9 @@ class ChatActivity :
|
||||
}
|
||||
|
||||
override fun editTemporaryMessage(id: Int, newMessage: String) {
|
||||
// TODO update adapter item and call viewModel to persist data
|
||||
messageInputViewModel.editQueuedMessage(roomToken, id, newMessage)
|
||||
adapter?.notifyDataSetChanged() // TODO optimize this
|
||||
|
||||
}
|
||||
|
||||
override fun deleteTemporaryMessage(id: Int) {
|
||||
|
@ -49,7 +49,7 @@ class MessageInputViewModel @Inject constructor(
|
||||
|
||||
data class QueuedMessage(
|
||||
val id: Int,
|
||||
val message: CharSequence? = null,
|
||||
var message: CharSequence? = null,
|
||||
val displayName: String? = null,
|
||||
val replyTo: Int? = null,
|
||||
val sendWithoutNotification: Boolean? = null
|
||||
@ -303,6 +303,17 @@ class MessageInputViewModel @Inject constructor(
|
||||
_messageQueueSizeFlow.tryEmit(queue.size)
|
||||
}
|
||||
|
||||
fun editQueuedMessage(roomToken: String, id: Int, newMessage: String) {
|
||||
val queue = dataStore.getMessageQueue(roomToken)
|
||||
for (qMsg in queue) {
|
||||
if (qMsg.id == id) {
|
||||
qMsg.message = newMessage
|
||||
break
|
||||
}
|
||||
}
|
||||
dataStore.saveMessageQueue(roomToken, queue)
|
||||
}
|
||||
|
||||
companion object {
|
||||
private val TAG = MessageInputViewModel::class.java.simpleName
|
||||
private const val DELAY_BETWEEN_QUEUED_MESSAGES: Long = 100
|
||||
|
Loading…
Reference in New Issue
Block a user