Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable-19.0] Fix message delay on send and delete #3795

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 12 additions & 19 deletions app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -819,14 +819,6 @@ class ChatActivity :
Snackbar.LENGTH_LONG
).show()
}

chatViewModel.refreshChatParams(
setupFieldsForPullChatMessages(
true,
globalLastKnownFutureMessageId,
true
)
)
}

is ChatViewModel.DeleteChatMessageErrorState -> {
Expand Down Expand Up @@ -906,10 +898,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)
Expand Down Expand Up @@ -943,8 +936,7 @@ class ChatActivity :
true,
globalLastKnownFutureMessageId,
true
),
true
)
)
}

Expand All @@ -954,8 +946,7 @@ class ChatActivity :
true,
globalLastKnownFutureMessageId,
true
),
true
)
)
}

Expand Down Expand Up @@ -1077,7 +1068,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
Expand Down Expand Up @@ -1557,8 +1548,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
Expand Down Expand Up @@ -3583,11 +3574,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")
Expand Down Expand Up @@ -3973,7 +3965,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,
Expand Down
Loading