fix_:display group message using the new ui (#20787)
This commit is contained in:
parent
c6a1db6334
commit
d27ab756d0
|
@ -32,8 +32,7 @@
|
||||||
|
|
||||||
(def system-message-base-wrapper
|
(def system-message-base-wrapper
|
||||||
{:flex-direction :row
|
{:flex-direction :row
|
||||||
:flex 1
|
:flex 1})
|
||||||
:align-items :center})
|
|
||||||
|
|
||||||
(def system-message-base-content-wrapper
|
(def system-message-base-content-wrapper
|
||||||
{:align-self :center
|
{:align-self :center
|
||||||
|
|
|
@ -127,6 +127,14 @@
|
||||||
(when incoming? [split-text "sent you a contact request" theme true])
|
(when incoming? [split-text "sent you a contact request" theme true])
|
||||||
[sm-timestamp timestamp theme]]]))
|
[sm-timestamp timestamp theme]]]))
|
||||||
|
|
||||||
|
(defn system-message-group
|
||||||
|
[{:keys [customization-color child]}]
|
||||||
|
[system-message-base
|
||||||
|
{:icon {:icon :i/add-user
|
||||||
|
:color (or customization-color :primary)
|
||||||
|
:opacity 5}}
|
||||||
|
[rn/view child]])
|
||||||
|
|
||||||
(defn system-message-pinned
|
(defn system-message-pinned
|
||||||
[{:keys [pinned-by child customization-color timestamp]}]
|
[{:keys [pinned-by child customization-color timestamp]}]
|
||||||
(let [theme (quo.theme/use-theme)]
|
(let [theme (quo.theme/use-theme)]
|
||||||
|
@ -183,6 +191,7 @@
|
||||||
:contact-request [system-message-contact-request data]
|
:contact-request [system-message-contact-request data]
|
||||||
:added [system-message-added data]
|
:added [system-message-added data]
|
||||||
:removed [system-message-removed data]
|
:removed [system-message-removed data]
|
||||||
|
:group [system-message-group data]
|
||||||
nil)]))
|
nil)]))
|
||||||
|
|
||||||
(defn system-message
|
(defn system-message
|
||||||
|
|
|
@ -33,3 +33,7 @@
|
||||||
(def drawer-message-container
|
(def drawer-message-container
|
||||||
{:padding-top 4
|
{:padding-top 4
|
||||||
:padding-bottom 4})
|
:padding-bottom 4})
|
||||||
|
|
||||||
|
(def group-member-mention
|
||||||
|
{:flex-direction :row
|
||||||
|
:align-items :center})
|
||||||
|
|
|
@ -126,14 +126,60 @@
|
||||||
:photo-path photo-path
|
:photo-path photo-path
|
||||||
:incoming? (not= public-key from)}]))
|
:incoming? (not= public-key from)}]))
|
||||||
|
|
||||||
|
(defn group-member
|
||||||
|
[literal]
|
||||||
|
(let [[primary-name _] (rf/sub [:contacts/contact-two-names-by-identity literal])
|
||||||
|
photo-path (rf/sub [:chats/photo-path literal])]
|
||||||
|
[rn/view {:style style/group-member-mention}
|
||||||
|
[quo/user-avatar
|
||||||
|
{:full-name primary-name
|
||||||
|
:profile-picture photo-path
|
||||||
|
:status-indicator? false
|
||||||
|
:size :xxxs
|
||||||
|
:ring? false}]
|
||||||
|
[quo/text
|
||||||
|
{:weight :semi-bold
|
||||||
|
:style {:margin-left 4}}
|
||||||
|
primary-name]]))
|
||||||
|
|
||||||
|
|
||||||
|
(defn resolve-group-system-message
|
||||||
|
[{:keys [children]}]
|
||||||
|
(reduce (fn [acc {:keys [type literal]}]
|
||||||
|
(if (= type "mention")
|
||||||
|
(conj acc [group-member literal])
|
||||||
|
(conj acc
|
||||||
|
[rn/view
|
||||||
|
[quo/text literal]])))
|
||||||
|
[:<>]
|
||||||
|
children))
|
||||||
|
|
||||||
|
|
||||||
|
(defn render-parsed-text
|
||||||
|
[content]
|
||||||
|
(reduce (fn [acc e]
|
||||||
|
(conj acc (resolve-group-system-message e)))
|
||||||
|
[quo/text]
|
||||||
|
(:parsed-text content)))
|
||||||
|
|
||||||
|
(defn group-system-message
|
||||||
|
[{:keys [chat-id timestamp-str content]} type]
|
||||||
|
(let [{:keys [customization-color]} (rf/sub [:contacts/contact-by-address chat-id])]
|
||||||
|
[quo/system-message
|
||||||
|
{:type type
|
||||||
|
:timestamp timestamp-str
|
||||||
|
:customization-color customization-color
|
||||||
|
:child (render-parsed-text content)}]))
|
||||||
|
|
||||||
(defn system-message-content
|
(defn system-message-content
|
||||||
[{:keys [content-type quoted-message] :as message-data}]
|
[{:keys [content-type quoted-message] :as message-data}]
|
||||||
|
|
||||||
(if quoted-message
|
(if quoted-message
|
||||||
[pin/pinned-message message-data]
|
[pin/pinned-message message-data]
|
||||||
(condp = content-type
|
(condp = content-type
|
||||||
|
|
||||||
constants/content-type-system-text
|
constants/content-type-system-text
|
||||||
[system.text/text-content message-data]
|
[group-system-message message-data :group]
|
||||||
|
|
||||||
constants/content-type-system-pinned-message
|
constants/content-type-system-pinned-message
|
||||||
[system.text/text-content message-data]
|
[system.text/text-content message-data]
|
||||||
|
|
Loading…
Reference in New Issue