Fix UI freezing when image is opened from activity center (#16707)

This commit is contained in:
Parvesh Monu 2023-07-26 18:19:10 +05:30 committed by GitHub
parent 238e35a281
commit 7cd9f76043
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 26 additions and 6 deletions

View File

@ -25,11 +25,12 @@
(def message-body
{:color colors/white})
(def message-container
(defn message-container
[attachment]
{:border-radius 12
:margin-top 12
:padding-horizontal 12
:padding-vertical 8
:padding-vertical (if (#{:photo :gif} attachment) 12 8)
:background-color colors/white-opa-5})
(def footer-container

View File

@ -74,8 +74,8 @@
context))))
(defn- activity-message
[{:keys [title body title-number-of-lines body-number-of-lines]}]
[rn/view {:style style/message-container}
[{:keys [title body title-number-of-lines body-number-of-lines attachment]}]
[rn/view {:style (style/message-container attachment)}
(when title
[text/text
{:size :paragraph-2

View File

@ -10,7 +10,7 @@
[utils.datetime :as datetime]
[utils.i18n :as i18n]
[utils.re-frame :as rf]
[status-im2.contexts.chat.messages.content.image.view :as image]))
[status-im.utils.http :as http]))
;; NOTE: Replies support text, image and stickers only.
(defn- get-message-content
@ -19,7 +19,11 @@
constants/content-type-text [quo/text {:style style/tag-text}
(get-in message [:content :text])]
constants/content-type-image [image/image-message 0 message nil]
constants/content-type-image
(let [image (get-in message [:content :image])
image-local-url (http/replace-port image (rf/sub [:mediaserver/port]))
photos (when image-local-url [{:uri image-local-url}])]
[quo/activity-logs-photos {:photos photos}])
constants/content-type-sticker [old-message/sticker message]
@ -72,4 +76,19 @@
[quo/context-tag common/tag-params community-image community-name chat-name]
[quo/group-avatar-tag chat-name common/tag-params])]
:message {:body-number-of-lines 1
:attachment (cond
(= (:content-type message) constants/content-type-text)
:text
(= (:content-type message) constants/content-type-image)
:photo
(= (:content-type message) constants/content-type-sticker)
:sticker
(= (:content-type message) constants/content-type-gif)
:gif
:else
nil)
:body (get-message-content message)}}]]]))