From 6d104d60e24d8dba299d942f3aaff638b4a9fbc2 Mon Sep 17 00:00:00 2001 From: andrey Date: Mon, 9 Nov 2020 09:58:15 +0100 Subject: [PATCH] [#11382] Status Updates: Add URL unfurling Signed-off-by: andrey --- .../ui/screens/chat/message/link_preview.cljs | 15 ++++++++------- src/status_im/ui/screens/status/views.cljs | 7 +++++-- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/status_im/ui/screens/chat/message/link_preview.cljs b/src/status_im/ui/screens/chat/message/link_preview.cljs index 7d764214d1..6e1d68487e 100644 --- a/src/status_im/ui/screens/chat/message/link_preview.cljs +++ b/src/status_im/ui/screens/chat/message/link_preview.cljs @@ -88,10 +88,11 @@ [ask-user? [:link-preview/link-preview-request-enabled] whitelist [:link-preview/whitelist] enabled-sites [:link-preview/enabled-sites]] - (let [link-info (previewable-link links whitelist enabled-sites) - {:keys [link whitelisted enabled]} link-info] - (when (and link whitelisted) - (if enabled - [link-preview-loader link outgoing] - (when ask-user? - [link-preview-enable-request])))))) \ No newline at end of file + (when links + (let [link-info (previewable-link links whitelist enabled-sites) + {:keys [link whitelisted enabled]} link-info] + (when (and link whitelisted) + (if enabled + [link-preview-loader link outgoing] + (when ask-user? + [link-preview-enable-request]))))))) \ No newline at end of file diff --git a/src/status_im/ui/screens/status/views.cljs b/src/status_im/ui/screens/status/views.cljs index 6726d097ca..34388c074e 100644 --- a/src/status_im/ui/screens/status/views.cljs +++ b/src/status_im/ui/screens/status/views.cljs @@ -16,7 +16,8 @@ [status-im.ui.screens.chat.photos :as photos] [status-im.ui.components.tabs :as tabs] [status-im.utils.contenthash :as contenthash] - [status-im.multiaccounts.core :as multiaccounts])) + [status-im.multiaccounts.core :as multiaccounts] + [status-im.ui.screens.chat.message.link-preview :as link-preview])) (defonce messages-list-ref (atom nil)) (def image-max-dimension 260) @@ -84,7 +85,9 @@ (datetime/time-ago (datetime/to-date timestamp))]] (if (= content-type constants/content-type-image) [image-message message] - [message/render-parsed-text (assoc message :outgoing false) (:parsed-text content)])]]]) + [react/view + [message/render-parsed-text (assoc message :outgoing false) (:parsed-text content)] + [link-preview/link-preview-wrapper (:links content) outgoing]])]]]) (defn render-message [timeline? account] (fn [{:keys [type] :as message} idx]