Skip to content

Commit

Permalink
feat(messenger): Add option to copy active message ID (#22018)
Browse files Browse the repository at this point in the history
Add option to copy message ID when long pressing on a chat message. Similar to
how it's implemented in the desktop client, the option is only visible if the
user enables the DEBUG log level.

Fixes #21984
  • Loading branch information
ilmotta authored Feb 5, 2025
1 parent e38cb0d commit 25072cf
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
12 changes: 10 additions & 2 deletions src/status_im/contexts/chat/messenger/messages/drawers/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,10 @@

(defn get-actions
[{:keys [outgoing content pinned-by outgoing-status deleted? deleted-for-me? content-type
bridge-message]
bridge-message message-id]
:as message-data}
{:keys [able-to-send-message? community? community-member? can-delete-message-for-everyone?
message-pin-enabled group-chat group-admin?]}]
message-pin-enabled group-chat group-admin? debug-log-level?]}]
(let [edit-message? (and (or community-member? (not community?))
outgoing
(not (or deleted? deleted-for-me?))
Expand Down Expand Up @@ -153,6 +153,14 @@
:icon :i/copy
:id :copy})

debug-log-level?
(conj {:type :main
:on-press #(clipboard/set-string message-id)
:label (i18n/label :t/copy-message-id)
:accessibility-label :copy-message-id
:icon :i/copy
:id :copy-message-id})

pin-message?
(conj {:type :main
:on-press #(pin-message message-data)
Expand Down
4 changes: 3 additions & 1 deletion src/status_im/subs/chats.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,8 @@
:<- [:chats/current-chat-chat-view]
:<- [:communities/current-community]
:<- [:multiaccount/public-key]
(fn [[current-chat current-community current-public-key] [_ in-pinned-view?]]
:<- [:log-level/debug?]
(fn [[current-chat current-community current-public-key debug-log-level?] [_ in-pinned-view?]]
(let [{:keys [group-chat chat-id public? admins space-keeper able-to-send-message?]}
current-chat

Expand All @@ -244,6 +245,7 @@
:community? community?
:community-admin? community-admin?
:current-public-key current-public-key
:debug-log-level? debug-log-level?
:space-keeper space-keeper
:chat-id chat-id
:in-pinned-view? (boolean in-pinned-view?)
Expand Down
6 changes: 5 additions & 1 deletion src/status_im/subs/profile.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,11 @@
(fn [multiaccount]
(get multiaccount :log-level)))

(re-frame/reg-sub :log-level/debug?
:<- [:log-level/current-log-level]
(fn [level]
(= "DEBUG" level)))

(re-frame/reg-sub
:dapps-address
:<- [:profile/profile]
Expand Down Expand Up @@ -309,4 +314,3 @@
:<- [:profile/profile]
(fn [profile]
(not (boolean (seq (:mnemonic profile))))))

1 change: 1 addition & 0 deletions translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,7 @@
"copy-address": "Copy address",
"copy-all-details": "Copy all details",
"copy-info": "Copy info",
"copy-message-id": "Copy message ID",
"copy-qr": "Copy code",
"copy-text": "Copy text",
"copy-to-clipboard": "Copy",
Expand Down

0 comments on commit 25072cf

Please sign in to comment.