Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wallet: Disable long-press feature on tokens in watch-only accounts. #18597 #18598

16 changes: 9 additions & 7 deletions src/status_im/contexts/wallet/common/token_value/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,12 @@

(defn view
[item]
[quo/token-value
(merge item
{:on-long-press
#(rf/dispatch
[:show-bottom-sheet
{:content (fn [] [token-value-drawer item])
:selected-item (fn [] [quo/token-value item])}])})])
(let [{:keys [watch-only?]} (rf/sub [:wallet/current-viewing-account])
on-long-press (when (not watch-only?)
#(rf/dispatch
[:show-bottom-sheet
{:content (fn [] [token-value-drawer item])
:selected-item (fn [] [quo/token-value item])}]))]
[quo/token-value
(merge item
{:on-long-press on-long-press})]))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we can just use

cond-> item
(not watch-only?)
(assoc :on-long-press #(rf...))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. Didn't know about this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done