nextcloud/talk-android

Message from search is not shown in chat

mahibi opened this issue · 0 comments

If search returns a message that is not yet loaded by adapter, it just won't show the message (and no info that it failed).

    private fun scrollToMessageWithId(messageId: String) {
        val position = adapter?.items?.indexOfFirst {
            it.item is ChatMessage && (it.item as ChatMessage).id == messageId
        }
        if (position != null && position >= 0) {
            binding.messagesListView.smoothScrollToPosition(position)
        } else {
            // TODO show error that we don't have that message?
        }
    }

https://github.com/nextcloud/talk-android/blob/59e8f4b550501b4ab833c44fee826829b8fa62dd/app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt#L2587C64-L2587C64

This was never implemented properly, so it exists since the search feature was added.
It maybe makes sense to even wait with this until offline support is implemented.

reproduce

search for quite old message

expected

scrolled to message

actual

chat opens with latest messages. searched message is not shown.