Compare commits

..
Author SHA1 Message Date
Mohamed Javid 73d5cb24f8 fix(wallet)_: Address or ENS - Paste button behaviour
Signed-off-by: Mohamed Javid <19339952+smohamedjavid@users.noreply.github.com>
2025-03-04 17:32:03 +05:30
9 changed files with 20 additions and 16 deletions
@@ -1,10 +1,6 @@
(ns quo.components.banners.alert-banner.style
(:require [quo.foundations.colors :as colors]))
(defn alert-banner-container
[theme]
{:background-color (colors/theme-colors colors/white colors/neutral-95 theme)})
(defn container
[container-style]
(merge
@@ -14,8 +14,7 @@
[{:keys [action? text button-text text-number-of-lines container-style on-button-press]}]
(let [theme (quo.theme/use-theme)]
[rn/view
{:accessibility-label :alert-banner
:style (style/alert-banner-container theme)}
{:accessibility-label :alert-banner}
[linear-gradient/linear-gradient
{:style (style/container container-style)
:start {:x 0 :y 0}
@@ -44,7 +44,7 @@
[network-amount
{:network k
:amount (str amount " " (or token-symbol (get default-token-symbols k)))
:divider? (not= (inc i) (-> networks-to-show keys count))
:divider? (not= (dec i) (-> networks-to-show keys count))
:theme theme}])))
(remove nil?)
(into [rn/view
@@ -56,7 +56,7 @@
(let [theme (quo.theme/use-theme)
address (or (:address account-props) (:address token-props))]
[rn/view
{:style (style/container (boolean networks-to-show) theme)}
{:style (style/container (seq? networks-to-show) theme)}
[rn/view
{:style style/info-container}
(case type
@@ -7,6 +7,7 @@
[react-native.safe-area :as safe-area]
[status-im.common.floating-button-page.view :as floating-button-page]
[status-im.contexts.settings.wallet.saved-addresses.add-address-to-save.style :as style]
[status-im.contexts.wallet.common.utils :as utils]
[status-im.contexts.wallet.common.validation :as validation]
[utils.address :as utils-address]
[utils.debounce :as debounce]
@@ -159,7 +160,7 @@
(fn [clipboard-text]
(when-not (string/blank? clipboard-text)
(-> clipboard-text
utils-address/extract-address-without-chains-info
utils/on-paste-address-or-ens
on-change-text)))))
on-press-continue (rn/use-callback
(fn []
@@ -7,6 +7,7 @@
[reagent.core :as reagent]
[status-im.common.floating-button-page.view :as floating-button-page]
[status-im.contexts.wallet.add-account.add-address-to-watch.style :as style]
[status-im.contexts.wallet.common.utils :as utils]
[status-im.contexts.wallet.common.validation :as validation]
[status-im.subs.wallet.add-account.address-to-watch]
[utils.address :as utils-address]
@@ -42,7 +43,7 @@
paste-on-input #(clipboard/get-string
(fn [clipboard-text]
(-> clipboard-text
utils.address/extract-address-without-chains-info
utils/on-paste-address-or-ens
on-change-text)))]
(rn/use-effect (fn []
(when-not (string/blank? scanned-address)
@@ -4,6 +4,7 @@
[status-im.common.qr-codes.view :as qr-codes]
[status-im.constants :as constants]
[status-im.contexts.wallet.common.utils.networks :as network-utils]
[utils.address]
[utils.money :as money]
[utils.number :as number]
[utils.string]))
@@ -479,3 +480,11 @@
(filter (fn [{:keys [tokens]}]
(some positive-balance-in-any-chain? tokens))
operable-account))))
(defn on-paste-address-or-ens
"Check if the clipboard has any valid address and extract the address without any chain info.
If it does not contain an valid address or it is ENS, return the clipboard text as it is"
[clipboard-text]
(if (utils.address/supported-address? clipboard-text)
(utils.address/extract-address-without-chains-info clipboard-text)
clipboard-text))
@@ -61,7 +61,7 @@
(fn [clipboard]
(when-not (empty? clipboard)
(-> clipboard
utils-address/extract-address-without-chains-info
utils/on-paste-address-or-ens
on-change)))))
:ens-regex constants/regx-ens
:scanned-value (or (when recipient-plain-address? send-address) scanned-address)
@@ -12,13 +12,11 @@
{:padding-top 12
:padding-horizontal 20})
(defn details-container
[theme]
(def details-container
{:flex-direction :row
:justify-content :space-between
:padding-top 7
:padding-horizontal 20
:background-color (colors/theme-colors colors/white colors/neutral-95 theme)})
:padding-horizontal 20})
(def detail-item
{:flex 1
@@ -88,7 +88,7 @@
currency-symbol
max-fee)
error-response (rf/sub [:wallet/swap-error-response])]
[rn/view {:style (style/details-container theme)}
[rn/view {:style style/details-container}
[data-item
(cond-> {:title (i18n/label :t/max-fees)
:subtitle max-fee-formatted