[#11382] Status Updates: Add URL unfurling

Signed-off-by: andrey <motor4ik@gmail.com>
This commit is contained in:
andrey 2020-11-09 09:58:15 +01:00
parent 72591f576d
commit 6d104d60e2
No known key found for this signature in database
GPG Key ID: 89B67245FD2F0272
2 changed files with 13 additions and 9 deletions

View File

@ -88,10 +88,11 @@
[ask-user? [:link-preview/link-preview-request-enabled] [ask-user? [:link-preview/link-preview-request-enabled]
whitelist [:link-preview/whitelist] whitelist [:link-preview/whitelist]
enabled-sites [:link-preview/enabled-sites]] enabled-sites [:link-preview/enabled-sites]]
(when links
(let [link-info (previewable-link links whitelist enabled-sites) (let [link-info (previewable-link links whitelist enabled-sites)
{:keys [link whitelisted enabled]} link-info] {:keys [link whitelisted enabled]} link-info]
(when (and link whitelisted) (when (and link whitelisted)
(if enabled (if enabled
[link-preview-loader link outgoing] [link-preview-loader link outgoing]
(when ask-user? (when ask-user?
[link-preview-enable-request])))))) [link-preview-enable-request])))))))

View File

@ -16,7 +16,8 @@
[status-im.ui.screens.chat.photos :as photos] [status-im.ui.screens.chat.photos :as photos]
[status-im.ui.components.tabs :as tabs] [status-im.ui.components.tabs :as tabs]
[status-im.utils.contenthash :as contenthash] [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)) (defonce messages-list-ref (atom nil))
(def image-max-dimension 260) (def image-max-dimension 260)
@ -84,7 +85,9 @@
(datetime/time-ago (datetime/to-date timestamp))]] (datetime/time-ago (datetime/to-date timestamp))]]
(if (= content-type constants/content-type-image) (if (= content-type constants/content-type-image)
[image-message message] [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] (defn render-message [timeline? account]
(fn [{:keys [type] :as message} idx] (fn [{:keys [type] :as message} idx]