[#9954] Add 'view profile' to message long tap
Signed-off-by: yenda <eric@status.im>
This commit is contained in:
parent
785f829554
commit
c1245d7b1d
|
@ -13,14 +13,19 @@
|
|||
(:url content))
|
||||
(.share react/sharing (clj->js content))))
|
||||
|
||||
(defn- message-options [message-id text]
|
||||
[{:label (i18n/label :t/message-reply)
|
||||
:action #(re-frame/dispatch [:chat.ui/reply-to-message message-id])}
|
||||
{:label (i18n/label :t/sharing-copy-to-clipboard)
|
||||
:action #(react/copy-to-clipboard text)}
|
||||
(when-not platform/desktop?
|
||||
(defn- message-options [message-id text from outgoing]
|
||||
(into
|
||||
[]
|
||||
(concat
|
||||
(when (and from (not outgoing))
|
||||
[{:label (i18n/label :t/view-profile)
|
||||
:action #(re-frame/dispatch [:chat.ui/show-profile from])}])
|
||||
[{:label (i18n/label :t/message-reply)
|
||||
:action #(re-frame/dispatch [:chat.ui/reply-to-message message-id])}
|
||||
{:label (i18n/label :t/sharing-copy-to-clipboard)
|
||||
:action #(react/copy-to-clipboard text)}
|
||||
{:label (i18n/label :t/sharing-share)
|
||||
:action #(open-share {:message text})})])
|
||||
:action #(open-share {:message text})}])))
|
||||
|
||||
(defn show [options]
|
||||
(cond
|
||||
|
@ -28,9 +33,9 @@
|
|||
platform/android? (dialog/show options)
|
||||
platform/desktop? (show-desktop-menu (->> (:options options) (remove nil?)))))
|
||||
|
||||
(defn chat-message [message-id text dialog-title]
|
||||
(defn chat-message [message-id text from outgoing dialog-title]
|
||||
(show {:title dialog-title
|
||||
:options (message-options message-id text)
|
||||
:options (message-options message-id text from outgoing)
|
||||
:cancel-text (i18n/label :t/message-options-cancel)}))
|
||||
|
||||
(defn- platform-web-browser []
|
||||
|
|
|
@ -521,8 +521,17 @@
|
|||
[message-delivery-status message]]])
|
||||
|
||||
(defn open-chat-context-menu
|
||||
[{:keys [message-id content] :as message}]
|
||||
(list-selection/chat-message message-id (:text content) (i18n/label :t/message)))
|
||||
[{:keys [message-id content from outgoing]}]
|
||||
(list-selection/chat-message message-id (:text content) from outgoing (i18n/label :t/message)))
|
||||
|
||||
(defn open-sticker-context-menu
|
||||
[{:keys [from outgoing]}]
|
||||
(when (and from (not outgoing))
|
||||
(list-selection/show
|
||||
{:title (i18n/label :t/message)
|
||||
:options [{:label (i18n/label :t/view-profile)
|
||||
:action #(re-frame/dispatch [:chat.ui/show-profile from])}]
|
||||
:cancel-text (i18n/label :t/message-options-cancel)})))
|
||||
|
||||
(defn chat-message
|
||||
[{:keys [outgoing group-chat modal? current-public-key content-type content] :as message}]
|
||||
|
@ -539,9 +548,12 @@
|
|||
:input-bottom-sheet nil}])
|
||||
(when-not platform/desktop?
|
||||
(react/dismiss-keyboard!)))))
|
||||
:on-long-press #(when (or (= content-type constants/content-type-text)
|
||||
:on-long-press #(cond (or (= content-type constants/content-type-text)
|
||||
(= content-type constants/content-type-emoji))
|
||||
(open-chat-context-menu message))}
|
||||
(open-chat-context-menu message)
|
||||
|
||||
(= content-type constants/content-type-sticker)
|
||||
(open-sticker-context-menu message))}
|
||||
[react/view {:accessibility-label :chat-item}
|
||||
(let [incoming-group (and group-chat (not outgoing))]
|
||||
[message-content message-body (merge message
|
||||
|
|
Loading…
Reference in New Issue