Skip to content

Commit

Permalink
refactor: show-reactions? -> hide-reactions?
Browse files Browse the repository at this point in the history
  • Loading branch information
yqrashawn committed May 13, 2024
1 parent 67bd4e6 commit 30f08e3
Showing 1 changed file with 15 additions and 19 deletions.
34 changes: 15 additions & 19 deletions src/status_im/contexts/chat/messenger/messages/content/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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])]
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -264,16 +263,15 @@

(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
{:theme theme
: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?]
Expand All @@ -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]
Expand Down Expand Up @@ -340,5 +337,4 @@
[user-message-content
{:message-data message-data
:context context
:keyboard-shown? keyboard-shown?
:show-reactions? true}])]))
:keyboard-shown? keyboard-shown?}])]))

0 comments on commit 30f08e3

Please sign in to comment.