[#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]]
(let [link-info (previewable-link links whitelist enabled-sites) (when links
{:keys [link whitelisted enabled]} link-info] (let [link-info (previewable-link links whitelist enabled-sites)
(when (and link whitelisted) {:keys [link whitelisted enabled]} link-info]
(if enabled (when (and link whitelisted)
[link-preview-loader link outgoing] (if enabled
(when ask-user? [link-preview-loader link outgoing]
[link-preview-enable-request])))))) (when ask-user?
[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]