Skip to content

Commit

Permalink
fixes #19977 #19976
Browse files Browse the repository at this point in the history
  • Loading branch information
Parveshdhull committed May 16, 2024
1 parent 1817a86 commit dcbbec1
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 57 deletions.
105 changes: 51 additions & 54 deletions src/status_im/contexts/chat/messenger/messages/content/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -30,28 +30,42 @@
[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 avatar-container
[{:keys [content last-in-group? pinned-by quoted-message from]} show-reactions?
[{:keys [content last-in-group? pinned-by quoted-message from bridge-message timestamp]}
show-reactions?
in-reaction-and-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?)
in-reaction-and-action-menu?)
(cond
(:user-avatar bridge-message)
[fast-image/fast-image
{:source {:uri (:user-avatar bridge-message)}
: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?
pinned-by
(not show-reactions?)
in-reaction-and-action-menu?)
[avatar/avatar
{:public-key from
:size :small
:hide-ring? (or in-pinned-view? in-reaction-and-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
Expand All @@ -62,20 +76,30 @@
in-reaction-and-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?
(not show-reactions?)
in-reaction-and-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-name
(rf/sub [:contacts/contact-two-names-by-identity from]))
{:keys [ens-verified added?]} (when-not bridge-name
(rf/sub [:contacts/contact-by-address from]))
user-name (when (string? user-name)
(-> user-name
(string/replace "<b>" "")
(string/replace "</b>" "")))]
[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-name
(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-name added?)
:verified? (when-not bridge-name ens-verified)}])))

(defn system-message-contact-request
[{:keys [chat-id timestamp-str from]} type]
Expand Down Expand Up @@ -118,50 +142,23 @@
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)}]
[quo/text
{:size :paragraph-1
:style {:line-height 22.75}}
content]]])))

(declare on-long-press)

(defn bridge-message-content
[{:keys [content]}]
[quo/text
{:size :paragraph-1
:style {:line-height 22.75}}
content])

(defn user-message-content
[]
(let [show-delivery-state? (reagent/atom false)]
(fn [{:keys [message-data context keyboard-shown? show-reactions? in-reaction-and-action-menu?
show-user-info? preview?]}]
(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))
Expand Down Expand Up @@ -239,9 +236,13 @@
(* 0.4 height))}}
[author message-data show-reactions? in-reaction-and-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 bridge-message]

constants/content-type-contact-request
[content.text/text-content message-data context]

Expand Down Expand Up @@ -341,10 +342,6 @@
keyboard-shown?))
context]


(= content-type constants/content-type-bridge-message)
[bridge-message-content message-data]

:else
[user-message-content
{:message-data message-data
Expand Down
6 changes: 3 additions & 3 deletions src/status_im/contexts/wallet/wallet_connect/utils.cljs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
(ns status-im.contexts.wallet.wallet-connect.utils
;; NOTE: Not sorting namespaces since @walletconnect/react-native-compat should be the first
#_{:clj-kondo/ignore [:unsorted-required-namespaces]}
(:require ["@walletconnect/react-native-compat"]
["@walletconnect/core" :refer [Core]]
["@walletconnect/web3wallet" :refer [Web3Wallet]]
(:require ["@walletconnect/core" :refer [Core]]
["@walletconnect/react-native-compat"]
["@walletconnect/utils" :refer [buildApprovedNamespaces]]
["@walletconnect/web3wallet" :refer [Web3Wallet]]
[status-im.config :as config]
[utils.i18n :as i18n]))

Expand Down
1 change: 1 addition & 0 deletions translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -2393,6 +2393,7 @@
"buy": "Buy",
"confirm-bridge": "Confirm bridge",
"bridge": "Bridge",
"bridge-from": "Bridge from {{bridge-name}}",
"bridge-to": "Bridge {{name}} to",
"on-device": "On device",
"on-keycard": "On Keycard",
Expand Down

0 comments on commit dcbbec1

Please sign in to comment.