diff --git a/src/status_im/ui/components/list_selection.cljs b/src/status_im/ui/components/list_selection.cljs index 39f3fc3de1f..57e7eecb198 100644 --- a/src/status_im/ui/components/list_selection.cljs +++ b/src/status_im/ui/components/list_selection.cljs @@ -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 [] diff --git a/src/status_im/ui/screens/chat/message/message.cljs b/src/status_im/ui/screens/chat/message/message.cljs index 2d8d7cc8791..df45f339e11 100644 --- a/src/status_im/ui/screens/chat/message/message.cljs +++ b/src/status_im/ui/screens/chat/message/message.cljs @@ -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