fix_: Adding own address as saved addresses (#20839)
This commit: - prevents the user from saving their wallet address as the saved address - fixes button not capturing taps when the keyboard is open in saved address flows Signed-off-by: Mohamed Javid <19339952+smohamedjavid@users.noreply.github.com>
This commit is contained in:
parent
c6a63e30b2
commit
4989c92780
|
@ -7,6 +7,7 @@
|
||||||
[react-native.safe-area :as safe-area]
|
[react-native.safe-area :as safe-area]
|
||||||
[status-im.common.floating-button-page.view :as floating-button-page]
|
[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.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]
|
[status-im.contexts.wallet.common.validation :as validation]
|
||||||
[utils.debounce :as debounce]
|
[utils.debounce :as debounce]
|
||||||
[utils.i18n :as i18n]
|
[utils.i18n :as i18n]
|
||||||
|
@ -18,20 +19,21 @@
|
||||||
|
|
||||||
(defn- validate-input
|
(defn- validate-input
|
||||||
[account-addresses saved-addresses user-input]
|
[account-addresses saved-addresses user-input]
|
||||||
|
(let [[_ address-without-prefix] (utils/split-prefix-and-address user-input)]
|
||||||
(cond
|
(cond
|
||||||
(string/blank? user-input)
|
(string/blank? user-input)
|
||||||
nil
|
nil
|
||||||
|
|
||||||
(contains? saved-addresses user-input)
|
(contains? saved-addresses address-without-prefix)
|
||||||
:existing-saved-address
|
:existing-saved-address
|
||||||
|
|
||||||
(contains? account-addresses user-input)
|
(contains? account-addresses address-without-prefix)
|
||||||
:own-account
|
:own-account
|
||||||
|
|
||||||
(not
|
(not
|
||||||
(or (validation/eth-address? user-input)
|
(or (validation/eth-address? user-input)
|
||||||
(validation/ens-name? user-input)))
|
(validation/ens-name? user-input)))
|
||||||
:invalid-address-or-ens))
|
:invalid-address-or-ens)))
|
||||||
|
|
||||||
(defn- address-input
|
(defn- address-input
|
||||||
[{:keys [input-value on-change-text paste-into-input clear-input]}]
|
[{:keys [input-value on-change-text paste-into-input clear-input]}]
|
||||||
|
@ -93,8 +95,9 @@
|
||||||
|
|
||||||
(defn- existing-saved-address
|
(defn- existing-saved-address
|
||||||
[{:keys [address]}]
|
[{:keys [address]}]
|
||||||
(let [{:keys [name customization-color chain-short-names ens ens?]}
|
(let [[_ address-without-prefix] (utils/split-prefix-and-address address)
|
||||||
(rf/sub [:wallet/saved-address-by-address address])]
|
{:keys [name customization-color chain-short-names ens ens?]}
|
||||||
|
(rf/sub [:wallet/saved-address-by-address address-without-prefix])]
|
||||||
[rn/view {:style style/existing-saved-address-container}
|
[rn/view {:style style/existing-saved-address-container}
|
||||||
[quo/text
|
[quo/text
|
||||||
{:size :paragraph-1
|
{:size :paragraph-1
|
||||||
|
@ -105,7 +108,7 @@
|
||||||
{:blur? true
|
{:blur? true
|
||||||
:active-state? true
|
:active-state? true
|
||||||
:user-props {:name name
|
:user-props {:name name
|
||||||
:address (str chain-short-names address)
|
:address (str chain-short-names address-without-prefix)
|
||||||
:ens (when ens? ens)
|
:ens (when ens? ens)
|
||||||
:customization-color customization-color
|
:customization-color customization-color
|
||||||
:blur? true}
|
:blur? true}
|
||||||
|
@ -169,6 +172,7 @@
|
||||||
[quo/overlay {:type :shell}
|
[quo/overlay {:type :shell}
|
||||||
[floating-button-page/view
|
[floating-button-page/view
|
||||||
{:footer-container-padding 0
|
{:footer-container-padding 0
|
||||||
|
:keyboard-should-persist-taps :handled
|
||||||
:header [quo/page-nav
|
:header [quo/page-nav
|
||||||
{:type :no-title
|
{:type :no-title
|
||||||
:icon-name :i/close
|
:icon-name :i/close
|
||||||
|
|
|
@ -106,6 +106,7 @@
|
||||||
[quo/overlay {:type :shell}
|
[quo/overlay {:type :shell}
|
||||||
[floating-button-page/view
|
[floating-button-page/view
|
||||||
{:footer-container-padding (if edit? (+ (safe-area/get-bottom) 12) 0)
|
{:footer-container-padding (if edit? (+ (safe-area/get-bottom) 12) 0)
|
||||||
|
:keyboard-should-persist-taps :handled
|
||||||
:header [quo/page-nav
|
:header [quo/page-nav
|
||||||
{:type :no-title
|
{:type :no-title
|
||||||
:background :blur
|
:background :blur
|
||||||
|
|
Loading…
Reference in New Issue