Merge pull request #2562 from SpiritCroc/notice_preview
Enable URL-previews for notices
This commit is contained in:
commit
621c6c8773
|
@ -2,7 +2,7 @@ Changes in Element 1.0.14 (2020-XX-XX)
|
||||||
===================================================
|
===================================================
|
||||||
|
|
||||||
Features ✨:
|
Features ✨:
|
||||||
-
|
- Enable url previews for notices (#2562)
|
||||||
|
|
||||||
Improvements 🙌:
|
Improvements 🙌:
|
||||||
-
|
-
|
||||||
|
|
|
@ -32,7 +32,9 @@ 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 }
|
||||||
|
|
|
@ -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)
|
||||||
|
|
Loading…
Reference in New Issue