Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Jul 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/quo2/components/notifications/activity_log/style.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/quo2/components/notifications/activity_log/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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]

Expand Down Expand Up @@ -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)}}]]]))