Merge pull request #2611 from nextcloud/bugfix/noid/fixLinkPreviewMessages

avoid to set link preview content from wrong message/ make link preview messages able to be swiped left
This commit is contained in:
Marcel Hibbe 2022-12-07 17:50:58 +01:00 committed by GitHub
commit 39c0b0bb3b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 0 deletions

View file

@ -37,6 +37,7 @@ import com.nextcloud.talk.databinding.ItemCustomIncomingLinkPreviewMessageBindin
import com.nextcloud.talk.extensions.loadBotsAvatar
import com.nextcloud.talk.extensions.loadChangelogBotAvatar
import com.nextcloud.talk.models.json.chat.ChatMessage
import com.nextcloud.talk.ui.recyclerview.MessageSwipeCallback
import com.nextcloud.talk.ui.theme.ViewThemeUtils
import com.nextcloud.talk.utils.ApiUtils
import com.nextcloud.talk.utils.preferences.AppPreferences
@ -92,6 +93,8 @@ class IncomingLinkPreviewMessageViewHolder(incomingView: View, payload: Any) : M
true
}
itemView.setTag(MessageSwipeCallback.REPLYABLE_VIEW_TAG, message.replyable)
Reaction().showReactions(
message,
::clickOnReaction,

View file

@ -44,6 +44,11 @@ class LinkPreview {
binding: ReferenceInsideMessageBinding,
context: Context
) {
binding.referenceName.text = ""
binding.referenceDescription.text = ""
binding.referenceLink.text = ""
binding.referenceThumbImage.setImageDrawable(null)
if (!message.extractedUrlToPreview.isNullOrEmpty()) {
val credentials: String = ApiUtils.getCredentials(message.activeUser?.username, message.activeUser?.token)
val openGraphLink = ApiUtils.getUrlForOpenGraph(message.activeUser?.baseUrl)

View file

@ -36,6 +36,7 @@ import com.nextcloud.talk.application.NextcloudTalkApplication.Companion.sharedA
import com.nextcloud.talk.databinding.ItemCustomOutcomingLinkPreviewMessageBinding
import com.nextcloud.talk.models.json.chat.ChatMessage
import com.nextcloud.talk.models.json.chat.ReadStatus
import com.nextcloud.talk.ui.recyclerview.MessageSwipeCallback
import com.nextcloud.talk.ui.theme.ViewThemeUtils
import com.nextcloud.talk.utils.ApiUtils
import com.nextcloud.talk.utils.preferences.AppPreferences
@ -114,6 +115,8 @@ class OutcomingLinkPreviewMessageViewHolder(outcomingView: View, payload: Any) :
true
}
itemView.setTag(MessageSwipeCallback.REPLYABLE_VIEW_TAG, message.replyable)
Reaction().showReactions(
message,
::clickOnReaction,