fix(wallet): Remove redirection to send flow when the user scans an address QR code (#20979)

This commit is contained in:
Ulises Manuel 2024-08-08 08:19:41 -06:00 committed by GitHub
parent ce3f2b5895
commit 41e18993be
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 39 additions and 24 deletions

View File

@ -1,33 +1,47 @@
(ns status-im.contexts.shell.qr-reader.sheets.scanned-wallet-address
(:require
[quo.core :as quo]
[status-im.contexts.wallet.common.utils :as utils]
[status-im.contexts.wallet.common.utils.networks :as network-utils]
[react-native.clipboard :as clipboard]
[status-im.feature-flags :as ff]
[utils.i18n :as i18n]
[utils.re-frame :as rf]))
(defn- copy-address
[address]
(clipboard/set-string address)
(rf/dispatch [:toasts/upsert
{:type :positive
:text (i18n/label :t/address-copied)}]))
#_(defn- send-to-address
[address]
(let [[_ split-address] (network-utils/split-network-full-address address)]
(rf/dispatch
[:wallet/select-send-address
{:address address
:recipient {:recipient-type :address
:label (utils/get-shortened-address split-address)}
:stack-id :wallet-select-address
:start-flow? true}])))
(defn view
[address]
(let [[_ splitted-address] (network-utils/split-network-full-address address)]
[:<>
[quo/drawer-top
{:title address
:type :address}]
[quo/action-drawer
[[{:icon :i/send
[:<>
[quo/drawer-top {:title address :type :address}]
[quo/action-drawer
[[{:icon :i/copy
:accessibility-label :send-asset
:label (i18n/label :t/copy-address)
:on-press #(copy-address address)}
;; Originally, the flow went to the send flow, but it has been removed to avoid bugs,
;; please check https://github.com/status-im/status-mobile/issues/20972 for more context
;; The previous code has been commented out to be reintroduced in the future easily.
#_{:icon :i/send
:accessibility-label :send-asset
:label (i18n/label :t/send-to-this-address)
:on-press (fn []
(rf/dispatch [:wallet/select-send-address
{:address address
:recipient {:recipient-type :address
:label (utils/get-shortened-address
splitted-address)}
:stack-id :wallet-select-address
:start-flow? true}]))}
(when (ff/enabled? :ff/wallet.saved-addresses)
{:icon :i/save
:accessibility-label :save-address
:label (i18n/label :t/save-address)
:on-press #(js/alert "feature not implemented")})]]]]))
:on-press #(send-to-address address)}
(when (ff/enabled? :ff/wallet.saved-addresses)
{:icon :i/save
:accessibility-label :save-address
:label (i18n/label :t/save-address)
:on-press #(js/alert "feature not implemented")})]]]])

View File

@ -12,9 +12,10 @@
[re-frame.events :as rf-events]
[re-frame.registrar :as rf-registrar]
[re-frame.subs :as rf-subs]
[taoensso.timbre :as log] ;; We must require this namespace to register the custom cljs.test
;; directive `match-strict?`.
[taoensso.timbre :as log]
test-helpers.matchers))
;; We must require `test-helpers.matchers` this namespace to register the custom cljs.test
;; directive `match-strict?`.
(defn db
"A simple wrapper to get the latest value from the app db."