Merge pull request #3746 from nextcloud/issue-3744-sent-message-delayed

Fix message delay on send and delete
This commit is contained in:
Marcel Hibbe 2024-04-03 16:50:09 +02:00 committed by GitHub
commit 7e3d48f45f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 482 additions and 486 deletions

View File

@ -846,14 +846,6 @@ class ChatActivity :
Snackbar.LENGTH_LONG
).show()
}
chatViewModel.refreshChatParams(
setupFieldsForPullChatMessages(
true,
globalLastKnownFutureMessageId,
true
)
)
}
is ChatViewModel.DeleteChatMessageErrorState -> {
@ -933,10 +925,11 @@ class ChatActivity :
}
var lastAdapterId = getLastAdapterId()
val oneNewMessage = (lastAdapterId != 0 || chatMessageList.size == 1)
if (
state.lookIntoFuture &&
lastAdapterId != 0 &&
oneNewMessage &&
chatMessageList[0].jsonMessageId > lastAdapterId
) {
processMessagesFromTheFuture(chatMessageList)
@ -970,8 +963,7 @@ class ChatActivity :
true,
globalLastKnownFutureMessageId,
true
),
true
)
)
}
@ -981,8 +973,7 @@ class ChatActivity :
true,
globalLastKnownFutureMessageId,
true
),
true
)
)
}
@ -1104,7 +1095,7 @@ class ChatActivity :
binding.popupBubbleView.setRecyclerView(binding.messagesListView)
binding.popupBubbleView.setPopupBubbleListener { context ->
binding.popupBubbleView.setPopupBubbleListener { _ ->
if (newMessagesCount != 0) {
val scrollPosition = if (newMessagesCount - 1 < 0) {
0
@ -1584,8 +1575,8 @@ class ChatActivity :
var sliderInitX = 0F
var downX = 0f
var originY = 0f
var deltaX = 0f
var deltaY = 0f
var deltaX: Float
var deltaY: Float
var voiceRecordStartTime = 0L
var voiceRecordEndTime = 0L
@ -3606,11 +3597,12 @@ class ChatActivity :
for (i in mentionSpans.indices) {
mentionSpan = mentionSpans[i]
var mentionId = mentionSpan.id
if (mentionId.contains(" ") ||
val needsQuotes = mentionId.contains(" ") ||
mentionId.contains("@") ||
mentionId.startsWith("guest/") ||
mentionId.startsWith("group/")
) {
if (needsQuotes) {
mentionId = "\"" + mentionId + "\""
}
editable.replace(editable.getSpanStart(mentionSpan), editable.getSpanEnd(mentionSpan), "@$mentionId")
@ -3996,7 +3988,8 @@ class ChatActivity :
}
override fun onLoadMore(page: Int, totalItemsCount: Int) {
if (page > 1) {
val calculatedPage = page / MESSAGE_PULL_LIMIT
if (calculatedPage > 0) {
chatViewModel.refreshChatParams(
setupFieldsForPullChatMessages(
false,

View File

@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
~ Nextcloud Talk - Android Client
~
~ SPDX-FileCopyrightText: 2022 Andy Scherzinger <info@andy-scherzinger.de>
@ -108,6 +107,10 @@
android:paddingEnd="@dimen/standard_padding" />
</LinearLayout>
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/message_actions"
android:layout_width="match_parent"
@ -128,14 +131,14 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="start|center_vertical"
android:ellipsize="end"
android:maxLines="1"
android:paddingStart="16dp"
android:paddingEnd="@dimen/standard_padding"
tools:text="@string/nc_edited_by_admin"
android:textAlignment="viewStart"
android:maxLines="1"
android:ellipsize="end"
android:textColor="@color/grey_600"
android:textSize="15sp"
android:textColor = "@color/grey_600"/>
tools:text="@string/nc_edited_by_admin" />
<TextView
android:id="@+id/edited_time"
@ -144,10 +147,10 @@
android:layout_gravity="start|center_vertical"
android:paddingStart="16dp"
android:paddingEnd="@dimen/standard_padding"
tools:text="12:30 AM"
android:textAlignment="viewStart"
android:textColor="@color/grey_600"
android:textSize="15sp"
android:textColor ="@color/grey_600"/>
tools:text="12:30 AM" />
</LinearLayout>
@ -482,7 +485,6 @@
</LinearLayout>
<LinearLayout
android:id="@+id/menu_edit_message"
android:layout_width="match_parent"
@ -583,5 +585,6 @@
</LinearLayout>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</LinearLayout>