Show parsed bridge messages (#20058)
This commit is contained in:
parent
bcd8f3ad16
commit
366fb7b174
|
@ -97,7 +97,8 @@
|
|||
:deleted :deleted?
|
||||
:deletedForMe :deleted-for-me?
|
||||
:communityId :community-id
|
||||
:albumImagesCount :album-images-count})
|
||||
:albumImagesCount :album-images-count
|
||||
:bridgeMessage :bridge-message})
|
||||
(update :outgoing-status keyword)
|
||||
(update :command-parameters
|
||||
set/rename-keys
|
||||
|
|
|
@ -66,14 +66,25 @@
|
|||
:style style/reply-deleted-message}
|
||||
(i18n/label :t/message-deleted)]])
|
||||
|
||||
(defn- bridge-message-user-name
|
||||
[user-name]
|
||||
(when (string? user-name)
|
||||
(-> user-name
|
||||
(string/replace "<b>" "")
|
||||
(string/replace "</b>" ""))))
|
||||
|
||||
(defn reply-from
|
||||
[{:keys [from contact-name current-public-key pin?]}]
|
||||
(let [[primary-name _] (rf/sub [:contacts/contact-two-names-by-identity from])
|
||||
[{:keys [from contact-name current-public-key pin? bridge-message]}]
|
||||
(let [{user-name :userName user-avatar :userAvatar} bridge-message
|
||||
[primary-name _] (rf/sub [:contacts/contact-two-names-by-identity
|
||||
from])
|
||||
photo-path (rf/sub [:chats/photo-path from])]
|
||||
[rn/view {:style style/reply-from}
|
||||
[quo/user-avatar
|
||||
{:full-name primary-name
|
||||
:profile-picture photo-path
|
||||
{:full-name (if bridge-message
|
||||
(bridge-message-user-name user-name)
|
||||
primary-name)
|
||||
:profile-picture (or user-avatar photo-path)
|
||||
:status-indicator? false
|
||||
:size :xxxs
|
||||
:ring? false}]
|
||||
|
@ -82,11 +93,13 @@
|
|||
:size (if pin? :label :paragraph-2)
|
||||
:number-of-lines 1
|
||||
:style style/message-author-text}
|
||||
(format-reply-author from contact-name current-public-key)]]))
|
||||
(if bridge-message
|
||||
user-name
|
||||
(format-reply-author from contact-name current-public-key))]]))
|
||||
|
||||
(defn quoted-message
|
||||
[{:keys [from content-type contentType parsed-text content deleted? deleted-for-me?
|
||||
album-images-count]}
|
||||
album-images-count bridge-message]}
|
||||
in-chat-input? pin? recording-audio? input-ref]
|
||||
(let [[primary-name _] (rf/sub [:contacts/contact-two-names-by-identity from])
|
||||
current-public-key (rf/sub [:multiaccount/public-key])
|
||||
|
@ -110,7 +123,8 @@
|
|||
{:pin? pin?
|
||||
:from from
|
||||
:contact-name primary-name
|
||||
:current-public-key current-public-key}]
|
||||
:current-public-key current-public-key
|
||||
:bridge-message bridge-message}]
|
||||
(when (not-empty text)
|
||||
[quo/text
|
||||
{:number-of-lines 1
|
||||
|
|
|
@ -30,14 +30,37 @@
|
|||
[status-im.contexts.chat.messenger.messages.drawers.view :as drawers]
|
||||
[utils.address :as address]
|
||||
[utils.datetime :as datetime]
|
||||
[utils.i18n :as i18n]
|
||||
[utils.re-frame :as rf]))
|
||||
|
||||
(def delivery-state-showing-time-ms 3000)
|
||||
|
||||
(defn- bridge-message-user-name
|
||||
[user-name]
|
||||
(when (string? user-name)
|
||||
(-> user-name
|
||||
(string/replace "<b>" "")
|
||||
(string/replace "</b>" ""))))
|
||||
|
||||
(defn avatar-container
|
||||
[{: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))
|
||||
[{:keys [content last-in-group? pinned-by quoted-message from bridge-message]}
|
||||
hide-reactions? in-reaction-or-action-menu? show-user-info? in-pinned-view?]
|
||||
(cond
|
||||
(:user-avatar bridge-message)
|
||||
[fast-image/fast-image
|
||||
{:source {:uri (:user-avatar bridge-message)}
|
||||
:fallback-content [quo/user-avatar
|
||||
{:full-name (bridge-message-user-name (:user-name bridge-message))
|
||||
:ring? false
|
||||
:online? false
|
||||
:status-indicator? false
|
||||
:size :small}]
|
||||
:style {:width 32
|
||||
:margin-top 4
|
||||
:border-radius 16
|
||||
:height 32}}]
|
||||
|
||||
(or (and (seq (:response-to content))
|
||||
quoted-message)
|
||||
last-in-group?
|
||||
show-user-info?
|
||||
|
@ -48,10 +71,13 @@
|
|||
{:public-key from
|
||||
:size :small
|
||||
:hide-ring? (or in-pinned-view? in-reaction-or-action-menu?)}]
|
||||
|
||||
:else
|
||||
[rn/view {:padding-top 4 :width 32}]))
|
||||
|
||||
(defn author
|
||||
[{:keys [content
|
||||
[{:keys [bridge-message
|
||||
content
|
||||
compressed-key
|
||||
last-in-group?
|
||||
pinned-by
|
||||
|
@ -62,20 +88,27 @@
|
|||
in-reaction-or-action-menu?
|
||||
show-user-info?]
|
||||
(when (or (and (seq (:response-to content)) quoted-message)
|
||||
(seq bridge-message)
|
||||
last-in-group?
|
||||
pinned-by
|
||||
show-user-info?
|
||||
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])]
|
||||
(let [{:keys [user-name bridge-name]} bridge-message
|
||||
[primary-name secondary-name] (when-not bridge-message
|
||||
(rf/sub [:contacts/contact-two-names-by-identity from]))
|
||||
{:keys [ens-verified added?]} (when-not bridge-message
|
||||
(rf/sub [:contacts/contact-by-address from]))
|
||||
user-name (bridge-message-user-name user-name)]
|
||||
[quo/author
|
||||
{:primary-name primary-name
|
||||
{:primary-name (or user-name primary-name)
|
||||
:secondary-name secondary-name
|
||||
:short-chat-key (address/get-shortened-compressed-key (or compressed-key from))
|
||||
:short-chat-key (if bridge-message
|
||||
(i18n/label :t/bridge-from {:bridge-name bridge-name})
|
||||
(address/get-shortened-compressed-key (or compressed-key from)))
|
||||
:time-str (datetime/timestamp->time timestamp)
|
||||
:contact? added?
|
||||
:verified? ens-verified}])))
|
||||
:contact? (when-not bridge-message added?)
|
||||
:verified? (when-not bridge-message ens-verified)}])))
|
||||
|
||||
(defn system-message-contact-request
|
||||
[{:keys [chat-id timestamp-str from]} type]
|
||||
|
@ -118,42 +151,14 @@
|
|||
constants/content-type-system-message-mutual-event-sent
|
||||
[system-message-contact-request message-data :contact-request])))
|
||||
|
||||
(defn bridge-message-content
|
||||
[{:keys [bridge-message timestamp]}]
|
||||
(let [{:keys [user-avatar user-name
|
||||
bridge-name content]} bridge-message
|
||||
user-name (when (string? user-name)
|
||||
(-> user-name
|
||||
(string/replace "<b>" "")
|
||||
(string/replace "</b>" "")))]
|
||||
(when (and user-name content)
|
||||
[rn/view
|
||||
{:style {:flex-direction :row
|
||||
:padding-horizontal 12
|
||||
:padding-top 4}}
|
||||
[fast-image/fast-image
|
||||
{:source {:uri user-avatar}
|
||||
:fallback-content [quo/user-avatar
|
||||
{:full-name user-name
|
||||
:ring? false
|
||||
:online? false
|
||||
:status-indicator? false
|
||||
:size :small}]
|
||||
:style {:width 32
|
||||
:margin-top 4
|
||||
:border-radius 16
|
||||
:height 32}}]
|
||||
[rn/view {:margin-left 8 :flex 1}
|
||||
[quo/author
|
||||
{:primary-name (str user-name)
|
||||
:short-chat-key (str "Bridged from " bridge-name)
|
||||
:time-str (datetime/timestamp->time timestamp)}]
|
||||
(declare on-long-press)
|
||||
|
||||
(defn- bridge-message-content
|
||||
[content]
|
||||
[quo/text
|
||||
{:size :paragraph-1
|
||||
:style {:line-height 22.75}}
|
||||
content]]])))
|
||||
|
||||
(declare on-long-press)
|
||||
content])
|
||||
|
||||
(defn user-message-content
|
||||
[]
|
||||
|
@ -162,6 +167,7 @@
|
|||
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
|
||||
bridge-message
|
||||
last-in-group? message-id chat-id]} message-data
|
||||
{:keys [disable-message-long-press?]} context
|
||||
first-image (first (:album message-data))
|
||||
|
@ -191,7 +197,13 @@
|
|||
chat-id])
|
||||
six-reactions? (-> reactions
|
||||
count
|
||||
(= 6))]
|
||||
(= 6))
|
||||
content-type (if (and
|
||||
(= content-type
|
||||
constants/content-type-bridge-message)
|
||||
(seq (:parsed-text content)))
|
||||
constants/content-type-text
|
||||
content-type)]
|
||||
[rn/touchable-highlight
|
||||
{:accessibility-label (if (and outgoing (= outgoing-status :sending))
|
||||
:message-sending
|
||||
|
@ -237,9 +249,13 @@
|
|||
: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]
|
||||
|
||||
constants/content-type-bridge-message
|
||||
[bridge-message-content (:content bridge-message)]
|
||||
|
||||
constants/content-type-contact-request
|
||||
[content.text/text-content message-data context]
|
||||
|
||||
|
@ -340,10 +356,6 @@
|
|||
keyboard-shown?))
|
||||
context]
|
||||
|
||||
|
||||
(= content-type constants/content-type-bridge-message)
|
||||
[bridge-message-content message-data]
|
||||
|
||||
:else
|
||||
[user-message-content
|
||||
{:message-data message-data
|
||||
|
|
|
@ -94,7 +94,8 @@
|
|||
(assoc message-data :pinned message-not-pinned?)]))))
|
||||
|
||||
(defn get-actions
|
||||
[{:keys [outgoing content pinned-by outgoing-status deleted? deleted-for-me? content-type]
|
||||
[{:keys [outgoing content pinned-by outgoing-status deleted? deleted-for-me? content-type
|
||||
bridge-message]
|
||||
:as message-data}
|
||||
{:keys [able-to-send-message? community? can-delete-message-for-everyone?
|
||||
message-pin-enabled group-chat group-admin?]}]
|
||||
|
@ -139,7 +140,7 @@
|
|||
:accessibility-label (if pinned-by :unpin-message :pin-message)
|
||||
:icon :i/pin
|
||||
:id (if pinned-by :unpin :pin)}])
|
||||
(when-not (or deleted? deleted-for-me?)
|
||||
(when-not (or deleted? deleted-for-me? bridge-message)
|
||||
[{:type :danger
|
||||
:on-press (fn []
|
||||
(rf/dispatch
|
||||
|
@ -156,6 +157,7 @@
|
|||
outgoing true
|
||||
community? can-delete-message-for-everyone?
|
||||
group-chat group-admin?
|
||||
bridge-message false
|
||||
:else false)
|
||||
[{:type :danger
|
||||
:on-press (fn []
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"_comment": "Instead use: scripts/update-status-go.sh <rev>",
|
||||
"owner": "status-im",
|
||||
"repo": "status-go",
|
||||
"version": "v0.179.20",
|
||||
"commit-sha1": "92ef58d4202d151d44015c37d6c1ea45d8a8d8b3",
|
||||
"src-sha256": "05vqn5zy7fd4abq4d0r5191w2f3dzv9j5s6gmvqsis2r1y4njj7p"
|
||||
"version": "v0.179.22",
|
||||
"commit-sha1": "2b1bcb48c60bb40da1f1e3e9249a53dd57434b82",
|
||||
"src-sha256": "1fn6gwayb5ir1ym196qh774l315hccg6gkvhav3zlkdcvwfqny6i"
|
||||
}
|
||||
|
|
|
@ -2401,6 +2401,7 @@
|
|||
"empty-tab-description": "C'mon do something...",
|
||||
"buy": "Buy",
|
||||
"bridge": "Bridge",
|
||||
"bridge-from": "Bridge from {{bridge-name}}",
|
||||
"bridge-to": "Bridge {{name}} to",
|
||||
"on-device": "On device",
|
||||
"on-keycard": "On Keycard",
|
||||
|
|
Loading…
Reference in New Issue