Skip to content

Commit

Permalink
fix: hide reactions in reaction drawer message preview
Browse files Browse the repository at this point in the history
  • Loading branch information
yqrashawn committed May 13, 2024
1 parent ff0afef commit b6c5a8d
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
:emoji-id emoji-id}])))

(defn- on-long-press
[{:keys [message-id emoji-id user-message-content reactions-order theme]}]
[{:keys [message-id emoji-id user-message-content-render-fn reactions-order theme]}]
(rf/dispatch
[:reactions/get-authors-by-message-id
{:message-id message-id
Expand All @@ -31,19 +31,19 @@
[drawers/reaction-authors
{:reactions-order reactions-order
:theme theme}])
:selected-item (fn [] user-message-content)
:selected-item (fn [] [user-message-content-render-fn
{:hide-reactions? true}])
:padding-bottom-override 0}]))}]))

(defn- on-press-add
[{:keys [chat-id message-id user-message-content]}]
[{:keys [chat-id message-id user-message-content-render-fn]}]
(rf/dispatch [:dismiss-keyboard])
(rf/dispatch
[:show-bottom-sheet
{:content (fn [] [drawers/reactions
{:chat-id chat-id
:message-id message-id}])
:selected-item (fn []
user-message-content)}]))
:selected-item (fn [] [user-message-content-render-fn])}]))

(defn- add-emoji-key
[reaction]
Expand All @@ -52,24 +52,25 @@
(get constants/reactions (:emoji-id reaction))))

(defn message-reactions-row
[{:keys [message-id chat-id pinned-by hide-new-reaction-button?]} user-message-content]
[{:keys [message-id chat-id pinned-by hide-new-reaction-button?]} user-message-content-render-fn]
(let [theme (quo.theme/use-theme)
reactions (rf/sub [:chats/message-reactions message-id chat-id])]
[:<>
(when (seq reactions)
[quo/react
{:container-style {:margin-left 44
:margin-top 8}
:reactions (map add-emoji-key reactions)
:hide-new-reaction-button? hide-new-reaction-button?
:use-case (when pinned-by :pinned)
:on-press #(on-press (assoc % :message-id message-id))
:on-long-press #(on-long-press (assoc %
:message-id message-id
:theme theme
:reactions-order (map :emoji-id
reactions)
:user-message-content user-message-content))
:on-press-add #(on-press-add {:chat-id chat-id
:message-id message-id
:user-message-content user-message-content})}])]))
(when (seq reactions)
[quo/react
{:container-style {:margin-left 44
:margin-top 8}
:reactions (map add-emoji-key reactions)
:hide-new-reaction-button? hide-new-reaction-button?
:use-case (when pinned-by :pinned)
:on-press #(on-press (assoc % :message-id message-id))
:on-long-press #(on-long-press (assoc %
:message-id message-id
:theme theme
:reactions-order (map :emoji-id
reactions)
:user-message-content-render-fn
user-message-content-render-fn))
:on-press-add #(on-press-add {:chat-id chat-id
:message-id message-id
:user-message-content-render-fn
user-message-content-render-fn})}])))
18 changes: 11 additions & 7 deletions src/status_im/contexts/chat/messenger/messages/content/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -265,13 +265,17 @@
[status/status outgoing-status])])]
(when-not hide-reactions?
[reactions/message-reactions-row (assoc message-data :hide-new-reaction-button? true)
[rn/view {:pointer-events :none}
[user-message-content
{:theme theme
:message-data message-data
:context context
:in-reaction-or-action-menu? true
:keyboard-shown? keyboard-shown?}]]])]]))))
(fn [override-opts]
[rn/view
{:pointer-events :none
:style style/drawer-message-container}
[user-message-content
(merge {:theme theme
:message-data message-data
:context context
:in-reaction-or-action-menu? true
:keyboard-shown? keyboard-shown?}
override-opts)]])])]]))))

(defn on-long-press
[{:keys [deleted? deleted-for-me?] :as message-data} context keyboard-shown?]
Expand Down

0 comments on commit b6c5a8d

Please sign in to comment.