mirror of
https://github.com/status-im/status-react.git
synced 2025-01-11 03:26:31 +00:00
[mentions] Fix mention appearance in reply and quoted message
This commit is contained in:
parent
754b826629
commit
5aa33fc9c0
@ -27,6 +27,7 @@
|
|||||||
:outgoingStatus :outgoing-status
|
:outgoingStatus :outgoing-status
|
||||||
:audioDurationMs :audio-duration-ms})
|
:audioDurationMs :audio-duration-ms})
|
||||||
|
|
||||||
|
(update :quoted-message clojure.set/rename-keys {:parsedText :parsed-text})
|
||||||
(update :outgoing-status keyword)
|
(update :outgoing-status keyword)
|
||||||
(update :command-parameters clojure.set/rename-keys {:transactionHash :transaction-hash
|
(update :command-parameters clojure.set/rename-keys {:transactionHash :transaction-hash
|
||||||
:commandState :command-state})
|
:commandState :command-state})
|
||||||
|
@ -8,7 +8,8 @@
|
|||||||
[status-im.ethereum.stateofus :as stateofus]
|
[status-im.ethereum.stateofus :as stateofus]
|
||||||
[status-im.ui.screens.chat.components.style :as styles]
|
[status-im.ui.screens.chat.components.style :as styles]
|
||||||
[re-frame.core :as re-frame]
|
[re-frame.core :as re-frame]
|
||||||
[status-im.ui.components.react :as react]))
|
[status-im.ui.components.react :as react]
|
||||||
|
[clojure.string :as string]))
|
||||||
|
|
||||||
(def ^:private reply-symbol "↪ ")
|
(def ^:private reply-symbol "↪ ")
|
||||||
|
|
||||||
@ -25,10 +26,24 @@
|
|||||||
(str reply-symbol (i18n/label :t/You)))
|
(str reply-symbol (i18n/label :t/You)))
|
||||||
(format-author (str reply-symbol username))))
|
(format-author (str reply-symbol username))))
|
||||||
|
|
||||||
|
(defn get-quoted-text-with-mentions [parsed-text]
|
||||||
|
(string/join
|
||||||
|
(mapv (fn [{:keys [type literal children]}]
|
||||||
|
(cond
|
||||||
|
(= type "paragraph")
|
||||||
|
(get-quoted-text-with-mentions children)
|
||||||
|
|
||||||
|
(= type "mention")
|
||||||
|
@(re-frame/subscribe [:contacts/contact-name-by-identity literal])
|
||||||
|
|
||||||
|
:else
|
||||||
|
literal))
|
||||||
|
parsed-text)))
|
||||||
|
|
||||||
(defn reply-message [{:keys [from content]}]
|
(defn reply-message [{:keys [from content]}]
|
||||||
(let [contact-name @(re-frame/subscribe [:contacts/contact-name-by-identity from])
|
(let [contact-name @(re-frame/subscribe [:contacts/contact-name-by-identity from])
|
||||||
current-public-key @(re-frame/subscribe [:multiaccount/public-key])
|
current-public-key @(re-frame/subscribe [:multiaccount/public-key])
|
||||||
{:keys [image text]} content]
|
{:keys [image parsed-text]} content]
|
||||||
[rn/view {:style (styles/reply-container false)}
|
[rn/view {:style (styles/reply-container false)}
|
||||||
[rn/view {:style (styles/reply-content)}
|
[rn/view {:style (styles/reply-content)}
|
||||||
[quo/text {:weight :medium
|
[quo/text {:weight :medium
|
||||||
@ -46,7 +61,7 @@
|
|||||||
[quo/text {:size :small
|
[quo/text {:size :small
|
||||||
:number-of-lines 1
|
:number-of-lines 1
|
||||||
:style {:line-height 18}}
|
:style {:line-height 18}}
|
||||||
text])]
|
(get-quoted-text-with-mentions parsed-text)])]
|
||||||
[rn/view
|
[rn/view
|
||||||
[pressable/pressable {:on-press #(re-frame/dispatch [:chat.ui/cancel-message-reply])
|
[pressable/pressable {:on-press #(re-frame/dispatch [:chat.ui/cancel-message-reply])
|
||||||
:accessibility-label :cancel-message-reply}
|
:accessibility-label :cancel-message-reply}
|
||||||
|
@ -16,7 +16,8 @@
|
|||||||
[status-im.utils.security :as security]
|
[status-im.utils.security :as security]
|
||||||
[status-im.ui.screens.chat.message.reactions :as reactions]
|
[status-im.ui.screens.chat.message.reactions :as reactions]
|
||||||
[quo.core :as quo]
|
[quo.core :as quo]
|
||||||
[reagent.core :as reagent])
|
[reagent.core :as reagent]
|
||||||
|
[status-im.ui.screens.chat.components.reply :as components.reply])
|
||||||
(:require-macros [status-im.utils.views :refer [defview letsubs]]))
|
(:require-macros [status-im.utils.views :refer [defview letsubs]]))
|
||||||
|
|
||||||
(defview mention-element [from]
|
(defview mention-element [from]
|
||||||
@ -33,7 +34,7 @@
|
|||||||
(:rtl? content))} timestamp-str]))
|
(:rtl? content))} timestamp-str]))
|
||||||
|
|
||||||
(defview quoted-message
|
(defview quoted-message
|
||||||
[_ {:keys [from text image]} outgoing current-public-key public?]
|
[_ {:keys [from parsed-text image]} outgoing current-public-key public?]
|
||||||
(letsubs [contact-name [:contacts/contact-name-by-identity from]]
|
(letsubs [contact-name [:contacts/contact-name-by-identity from]]
|
||||||
[react/view {:style (style/quoted-message-container outgoing)}
|
[react/view {:style (style/quoted-message-container outgoing)}
|
||||||
[react/view {:style style/quoted-message-author-container}
|
[react/view {:style style/quoted-message-author-container}
|
||||||
@ -52,7 +53,7 @@
|
|||||||
:source {:uri image}}]
|
:source {:uri image}}]
|
||||||
[react/text {:style (style/quoted-message-text outgoing)
|
[react/text {:style (style/quoted-message-text outgoing)
|
||||||
:number-of-lines 5}
|
:number-of-lines 5}
|
||||||
text])]))
|
(components.reply/get-quoted-text-with-mentions parsed-text)])]))
|
||||||
|
|
||||||
(defn render-inline [message-text outgoing content-type acc {:keys [type literal destination]}]
|
(defn render-inline [message-text outgoing content-type acc {:keys [type literal destination]}]
|
||||||
(case type
|
(case type
|
||||||
@ -246,7 +247,9 @@
|
|||||||
(on-long-press
|
(on-long-press
|
||||||
[{:on-press #(re-frame/dispatch [:chat.ui/reply-to-message message])
|
[{:on-press #(re-frame/dispatch [:chat.ui/reply-to-message message])
|
||||||
:label (i18n/label :t/message-reply)}
|
:label (i18n/label :t/message-reply)}
|
||||||
{:on-press #(react/copy-to-clipboard (get content :text))
|
{:on-press #(react/copy-to-clipboard
|
||||||
|
(components.reply/get-quoted-text-with-mentions
|
||||||
|
(get content :parsed-text)))
|
||||||
:label (i18n/label :t/sharing-copy-to-clipboard)}]))})
|
:label (i18n/label :t/sharing-copy-to-clipboard)}]))})
|
||||||
[react/view (style/message-view message)
|
[react/view (style/message-view message)
|
||||||
(let [response-to (:response-to content)]
|
(let [response-to (:response-to content)]
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
"_comment": "DO NOT EDIT THIS FILE BY HAND. USE 'scripts/update-status-go.sh <tag>' instead",
|
"_comment": "DO NOT EDIT THIS FILE BY HAND. USE 'scripts/update-status-go.sh <tag>' instead",
|
||||||
"owner": "status-im",
|
"owner": "status-im",
|
||||||
"repo": "status-go",
|
"repo": "status-go",
|
||||||
"version": "0.60.0",
|
"version": "v0.60.2",
|
||||||
"commit-sha1": "3b748a2e467fe0850b2630947a9dadfe180f35fb",
|
"commit-sha1": "57728224d45ce3086e135988ae02e247abbc7b60",
|
||||||
"src-sha256": "1fvrh62480xfjcaagvwl7n7njhavb6plw48rv9w5vy9ykqj089bx"
|
"src-sha256": "1smgazlkgjxqq27ncgxagdi3523vcnmrca7lgj0lbxb4kbqgmmbl"
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user