From 5337ede58962bc4b50adae96f5def450dc2f3106 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Blin?= <sebastien.blin@savoirfairelinux.com> Date: Wed, 27 Apr 2022 16:33:10 -0400 Subject: [PATCH] preview: fix undefined domain for twitter and color with luma Change-Id: I28a5d02881b9b5eb57ad6efa646dd1c5a3327856 GitLab: #670 --- resources/misc/previewInterop.js | 8 ++++---- src/commoncomponents/TextMessageDelegate.qml | 12 +++++++++--- src/constant/JamiTheme.qml | 2 -- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/resources/misc/previewInterop.js b/resources/misc/previewInterop.js index 552c8b0d8..375ff60c4 100644 --- a/resources/misc/previewInterop.js +++ b/resources/misc/previewInterop.js @@ -24,13 +24,13 @@ function getPreviewInfo(messageId, url) { var doc = parser.parseFromString(html, "text/html") if (!url.includes("twitter.com")){ title = getTitle(doc) - image = getImage(doc, url) - description = getDescription(doc) - var domain = (new URL(url)) - domain = (domain.hostname).replace("www.", "") } else { title = "Twitter. It's what's happening." } + image = getImage(doc, url) + description = getDescription(doc) + var domain = (new URL(url)) + domain = (domain.hostname).replace("www.", "") window.jsbridge.emitInfoReady(messageId, { 'title': title, diff --git a/src/commoncomponents/TextMessageDelegate.qml b/src/commoncomponents/TextMessageDelegate.qml index b8ed17741..abe8e3feb 100644 --- a/src/commoncomponents/TextMessageDelegate.qml +++ b/src/commoncomponents/TextMessageDelegate.qml @@ -148,7 +148,9 @@ SBSMessageBase { wrapMode: Label.WrapAtWordBoundaryOrAnywhere renderType: Text.NativeRendering textFormat: TextEdit.RichText - color: JamiTheme.previewTitleColor + color: UtilsAdapter.luma(bubble.color) ? + JamiTheme.chatviewTextColorLight : + JamiTheme.chatviewTextColorDark visible: LinkPreviewInfo.title !== null text: LinkPreviewInfo.title } @@ -159,7 +161,9 @@ SBSMessageBase { wrapMode: Label.WrapAtWordBoundaryOrAnywhere renderType: Text.NativeRendering textFormat: TextEdit.RichText - color: JamiTheme.previewSubtitleColor + color: UtilsAdapter.luma(bubble.color) ? + JamiTheme.chatviewTextColorLight : + JamiTheme.chatviewTextColorDark visible: LinkPreviewInfo.description !== null text: '<a href=" " style="text-decoration: ' + ( hoveredLink ? 'underline' : 'none') + ';"' + @@ -172,7 +176,9 @@ SBSMessageBase { wrapMode: Label.WrapAtWordBoundaryOrAnywhere renderType: Text.NativeRendering textFormat: TextEdit.RichText - color: JamiTheme.previewSubtitleColor + color: UtilsAdapter.luma(bubble.color) ? + JamiTheme.chatviewTextColorLight : + JamiTheme.chatviewTextColorDark text: LinkPreviewInfo.domain } } diff --git a/src/constant/JamiTheme.qml b/src/constant/JamiTheme.qml index 8c21b923e..e8dfc606c 100644 --- a/src/constant/JamiTheme.qml +++ b/src/constant/JamiTheme.qml @@ -175,8 +175,6 @@ Item { property color chatviewButtonColor: darkTheme ? whiteColor : blackColor property color bgTextInput: darkTheme ? "#060608" : whiteColor property color previewTextContainerColor: darkTheme ? "#959595" : "#ececec" - property color previewTitleColor: darkTheme ? whiteColor : blackColor - property color previewSubtitleColor: darkTheme ? whiteColor : blackColor property color previewImageBackgroundColor: whiteColor property color previewCardContainerColor : darkTheme ? blackColor : whiteColor property color previewUrlColor : darkTheme ? "#eeeeee" : "#333" -- GitLab