[mentions] Fix mention appearance in reply and quoted message

This commit is contained in:
Roman Volosovskyi 2020-09-09 14:18:23 +03:00
parent 754b826629
commit 5aa33fc9c0
No known key found for this signature in database
GPG Key ID: 0238A4B5ECEE70DE
4 changed files with 29 additions and 10 deletions

View File

@ -27,6 +27,7 @@
:outgoingStatus :outgoing-status
:audioDurationMs :audio-duration-ms})
(update :quoted-message clojure.set/rename-keys {:parsedText :parsed-text})
(update :outgoing-status keyword)
(update :command-parameters clojure.set/rename-keys {:transactionHash :transaction-hash
:commandState :command-state})

View File

@ -8,7 +8,8 @@
[status-im.ethereum.stateofus :as stateofus]
[status-im.ui.screens.chat.components.style :as styles]
[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 "↪ ")
@ -25,10 +26,24 @@
(str reply-symbol (i18n/label :t/You)))
(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]}]
(let [contact-name @(re-frame/subscribe [:contacts/contact-name-by-identity from])
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-content)}
[quo/text {:weight :medium
@ -46,7 +61,7 @@
[quo/text {:size :small
:number-of-lines 1
:style {:line-height 18}}
text])]
(get-quoted-text-with-mentions parsed-text)])]
[rn/view
[pressable/pressable {:on-press #(re-frame/dispatch [:chat.ui/cancel-message-reply])
:accessibility-label :cancel-message-reply}

View File

@ -16,7 +16,8 @@
[status-im.utils.security :as security]
[status-im.ui.screens.chat.message.reactions :as reactions]
[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]]))
(defview mention-element [from]
@ -33,7 +34,7 @@
(:rtl? content))} timestamp-str]))
(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]]
[react/view {:style (style/quoted-message-container outgoing)}
[react/view {:style style/quoted-message-author-container}
@ -52,7 +53,7 @@
:source {:uri image}}]
[react/text {:style (style/quoted-message-text outgoing)
: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]}]
(case type
@ -246,7 +247,9 @@
(on-long-press
[{:on-press #(re-frame/dispatch [:chat.ui/reply-to-message message])
: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)}]))})
[react/view (style/message-view message)
(let [response-to (:response-to content)]

View File

@ -2,7 +2,7 @@
"_comment": "DO NOT EDIT THIS FILE BY HAND. USE 'scripts/update-status-go.sh <tag>' instead",
"owner": "status-im",
"repo": "status-go",
"version": "0.60.0",
"commit-sha1": "3b748a2e467fe0850b2630947a9dadfe180f35fb",
"src-sha256": "1fvrh62480xfjcaagvwl7n7njhavb6plw48rv9w5vy9ykqj089bx"
"version": "v0.60.2",
"commit-sha1": "57728224d45ce3086e135988ae02e247abbc7b60",
"src-sha256": "1smgazlkgjxqq27ncgxagdi3523vcnmrca7lgj0lbxb4kbqgmmbl"
}