Merge branch 'develop' into feature/ons/wait_members_before_sending_event

This commit is contained in:
Onuray Sahin 2020-12-21 12:41:24 +03:00 committed by GitHub
commit a755536a2f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 23 additions and 4 deletions

View File

@ -2,13 +2,14 @@ Changes in Element 1.0.14 (2020-XX-XX)
=================================================== ===================================================
Features ✨: Features ✨:
- - Enable url previews for notices (#2562)
Improvements 🙌: Improvements 🙌:
- -
Bugfix 🐛: Bugfix 🐛:
- Wait for all room members to be known before sending a message to a e2e room (#2518) - Wait for all room members to be known before sending a message to a e2e room (#2518)
- Url previews sometimes attached to wrong message (#2561)
Translations 🗣: Translations 🗣:
- -

View File

@ -32,7 +32,11 @@ internal class UrlsExtractor @Inject constructor() {
return event.takeIf { it.getClearType() == EventType.MESSAGE } return event.takeIf { it.getClearType() == EventType.MESSAGE }
?.getClearContent() ?.getClearContent()
?.toModel<MessageContent>() ?.toModel<MessageContent>()
?.takeIf { it.msgType == MessageType.MSGTYPE_TEXT || it.msgType == MessageType.MSGTYPE_EMOTE } ?.takeIf {
it.msgType == MessageType.MSGTYPE_TEXT
|| it.msgType == MessageType.MSGTYPE_NOTICE
|| it.msgType == MessageType.MSGTYPE_EMOTE
}
?.body ?.body
?.let { urlRegex.findAll(it) } ?.let { urlRegex.findAll(it) }
?.map { it.value } ?.map { it.value }

View File

@ -114,6 +114,7 @@ abstract class VectorBaseBottomSheetDialogFragment<VB: ViewBinding> : BottomShee
@CallSuper @CallSuper
override fun onDestroyView() { override fun onDestroyView() {
uiDisposables.clear() uiDisposables.clear()
_binding = null
super.onDestroyView() super.onDestroyView()
} }

View File

@ -512,6 +512,9 @@ class MessageItemFactory @Inject constructor(
return MessageTextItem_() return MessageTextItem_()
.leftGuideline(avatarSizeProvider.leftGuideline) .leftGuideline(avatarSizeProvider.leftGuideline)
.previewUrlRetriever(callback?.getPreviewUrlRetriever())
.imageContentRenderer(imageContentRenderer)
.previewUrlCallback(callback)
.attributes(attributes) .attributes(attributes)
.message(message) .message(message)
.highlighted(highlight) .highlighted(highlight)

View File

@ -19,6 +19,7 @@ package im.vector.app.features.home.room.detail.timeline.item
import android.text.method.MovementMethod import android.text.method.MovementMethod
import androidx.appcompat.widget.AppCompatTextView import androidx.appcompat.widget.AppCompatTextView
import androidx.core.text.PrecomputedTextCompat import androidx.core.text.PrecomputedTextCompat
import androidx.core.view.isVisible
import androidx.core.widget.TextViewCompat import androidx.core.widget.TextViewCompat
import com.airbnb.epoxy.EpoxyAttribute import com.airbnb.epoxy.EpoxyAttribute
import com.airbnb.epoxy.EpoxyModelClass import com.airbnb.epoxy.EpoxyModelClass
@ -60,7 +61,12 @@ abstract class MessageTextItem : AbsMessageItem<MessageTextItem.Holder>() {
// Preview URL // Preview URL
previewUrlViewUpdater.previewUrlView = holder.previewUrlView previewUrlViewUpdater.previewUrlView = holder.previewUrlView
previewUrlViewUpdater.imageContentRenderer = imageContentRenderer previewUrlViewUpdater.imageContentRenderer = imageContentRenderer
previewUrlRetriever?.addListener(attributes.informationData.eventId, previewUrlViewUpdater) val safePreviewUrlRetriever = previewUrlRetriever
if (safePreviewUrlRetriever == null) {
holder.previewUrlView.isVisible = false
} else {
safePreviewUrlRetriever.addListener(attributes.informationData.eventId, previewUrlViewUpdater)
}
holder.previewUrlView.delegate = previewUrlCallback holder.previewUrlView.delegate = previewUrlCallback
if (useBigFont) { if (useBigFont) {
@ -106,7 +112,11 @@ abstract class MessageTextItem : AbsMessageItem<MessageTextItem.Holder>() {
var imageContentRenderer: ImageContentRenderer? = null var imageContentRenderer: ImageContentRenderer? = null
override fun onStateUpdated(state: PreviewUrlUiState) { override fun onStateUpdated(state: PreviewUrlUiState) {
val safeImageContentRenderer = imageContentRenderer ?: return val safeImageContentRenderer = imageContentRenderer
if (safeImageContentRenderer == null) {
previewUrlView?.isVisible = false
return
}
previewUrlView?.render(state, safeImageContentRenderer) previewUrlView?.render(state, safeImageContentRenderer)
} }
} }