From 30f08e39c13e6d5cb42373569d73e668a651d1bd Mon Sep 17 00:00:00 2001 From: yqrashawn Date: Mon, 13 May 2024 14:31:59 +0800 Subject: [PATCH] refactor: show-reactions? -> hide-reactions? --- .../chat/messenger/messages/content/view.cljs | 34 ++++++++----------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/src/status_im/contexts/chat/messenger/messages/content/view.cljs b/src/status_im/contexts/chat/messenger/messages/content/view.cljs index 24db5a4efa4c..b1bc99f461fd 100644 --- a/src/status_im/contexts/chat/messenger/messages/content/view.cljs +++ b/src/status_im/contexts/chat/messenger/messages/content/view.cljs @@ -35,14 +35,14 @@ (def delivery-state-showing-time-ms 3000) (defn avatar-container - [{:keys [content last-in-group? pinned-by quoted-message from]} show-reactions? + [{:keys [content last-in-group? pinned-by quoted-message from]} hide-reactions? in-reaction-or-action-menu? show-user-info? in-pinned-view?] (if (or (and (seq (:response-to content)) quoted-message) last-in-group? show-user-info? pinned-by - (not show-reactions?) + hide-reactions? in-reaction-or-action-menu?) [avatar/avatar {:public-key from @@ -58,14 +58,14 @@ quoted-message from timestamp]} - show-reactions? + hide-reactions? in-reaction-or-action-menu? show-user-info?] (when (or (and (seq (:response-to content)) quoted-message) last-in-group? pinned-by show-user-info? - (not show-reactions?) + hide-reactions? in-reaction-or-action-menu?) (let [[primary-name secondary-name] (rf/sub [:contacts/contact-two-names-by-identity from]) {:keys [ens-verified added?]} (rf/sub [:contacts/contact-by-address from])] @@ -151,7 +151,7 @@ (defn user-message-content [] (let [show-delivery-state? (reagent/atom false)] - (fn [{:keys [message-data context keyboard-shown? show-reactions? + (fn [{:keys [message-data context keyboard-shown? hide-reactions? in-reaction-or-action-menu? show-user-info?]}] (let [theme (quo.theme/use-theme) {:keys [content-type quoted-message content outgoing outgoing-status pinned-by pinned @@ -219,17 +219,16 @@ [rn/view {:style {:padding-horizontal 4 :flex-direction :row}} - [avatar-container message-data show-reactions? in-reaction-or-action-menu? show-user-info? + [avatar-container message-data hide-reactions? in-reaction-or-action-menu? show-user-info? (:in-pinned-view? context)] (into - (if show-reactions? - [rn/view] - [gesture/scroll-view]) + (if hide-reactions? + [gesture/scroll-view] + [rn/view]) [{:style {:margin-left 8 :flex 1 - :max-height (when-not show-reactions? - (* 0.4 height))}} - [author message-data show-reactions? in-reaction-or-action-menu? show-user-info?] + :max-height (when hide-reactions? (* 0.4 height))}} + [author message-data hide-reactions? in-reaction-or-action-menu? show-user-info?] (condp = content-type constants/content-type-text [content.text/text-content message-data context] @@ -264,7 +263,7 @@ (when @show-delivery-state? [status/status outgoing-status])])] - (when show-reactions? + (when-not hide-reactions? [reactions/message-reactions-row (assoc message-data :hide-new-reaction-button? true) [rn/view {:pointer-events :none} [user-message-content @@ -272,8 +271,7 @@ :message-data message-data :context context :in-reaction-or-action-menu? true - :keyboard-shown? keyboard-shown? - :show-reactions? true}]]])]])))) + :keyboard-shown? keyboard-shown?}]]])]])))) (defn on-long-press [{:keys [deleted? deleted-for-me?] :as message-data} context keyboard-shown?] @@ -294,8 +292,7 @@ :context context :keyboard-shown? keyboard-shown? :in-reaction-or-action-menu? true - :show-user-info? false - :show-reactions? true}]]))}])) + :show-user-info? false}]]))}])) (defn check-if-system-message? [content-type] @@ -340,5 +337,4 @@ [user-message-content {:message-data message-data :context context - :keyboard-shown? keyboard-shown? - :show-reactions? true}])])) + :keyboard-shown? keyboard-shown?}])]))