This commit is contained in:
Volodymyr Kozieiev 2024-10-25 14:49:38 +01:00
parent 2e07a3ddfe
commit 6adfb10255
No known key found for this signature in database
GPG Key ID: 82B04968DF4C0535
2 changed files with 16 additions and 26 deletions

View File

@ -1,12 +1,10 @@
(ns status-im.contexts.wallet.send.input-amount.view
(:require
[clojure.string :as string]
[quo.core :as quo]
[quo.foundations.colors :as colors]
[quo.theme]
[react-native.core :as rn]
[react-native.safe-area :as safe-area]
[status-im.constants :as constants]
[status-im.contexts.wallet.common.account-switcher.view :as account-switcher]
[status-im.contexts.wallet.common.asset-list.view :as asset-list]
[status-im.contexts.wallet.send.input-amount.controller]
@ -18,7 +16,6 @@
[status-im.setup.hot-reload :as hot-reload]
[utils.debounce :as debounce]
[utils.i18n :as i18n]
[utils.money :as money]
[utils.re-frame :as rf]))
(defn- estimated-fees
@ -161,7 +158,7 @@
:t/send-limit
{:limit upper-limit-prettified})
:status (when value-out-of-limits? :error)}]}]))
(defn routes-component
(defn routes-view
[current-screen-id]
(let [{:keys [valid-input?
upper-limit-exceeded?
@ -169,16 +166,15 @@
routes
token-not-supported-in-receiver-networks?
token
token-by-symbol]
:as state} (rf/sub [:send-input-amount-screen/routes-subs])
request-fetch-routes (fn [bounce-duration-ms]
(fetch-routes
{:amount amount-in-crypto
:valid-input? valid-input?
:bounce-duration-ms bounce-duration-ms
:token token
:reset-amounts-to-zero? (and upper-limit-exceeded?
(some? routes))}))]
token-by-symbol]} (rf/sub [:send-input-amount-screen/routes-subs])
request-fetch-routes (fn [bounce-duration-ms]
(fetch-routes
{:amount amount-in-crypto
:valid-input? valid-input?
:bounce-duration-ms bounce-duration-ms
:token token
:reset-amounts-to-zero? (and upper-limit-exceeded?
(some? routes))}))]
[routes/view
{:token token-by-symbol
:send-amount-in-crypto amount-in-crypto
@ -195,8 +191,7 @@
loading-routes?
token-by-symbol
sending-to-unpreferred-networks?
should-try-again?]
:as state} (rf/sub [:send-input-amount-screen/bottom-actions-subs])]
should-try-again?]} (rf/sub [:send-input-amount-screen/bottom-actions-subs])]
[quo/bottom-actions
{:actions :one-action
:button-one-label (if should-try-again?
@ -245,7 +240,6 @@
not-enough-asset?
show-no-routes?]
:as state} (rf/sub [:send-input-amount-screen/view-subs])
;; from-enabled-networks (rf/sub [:wallet/wallet-send-enabled-networks])
view-id (rf/sub [:view-id])
active-screen? (= view-id current-screen-id)
bottom (safe-area/get-bottom)
@ -282,7 +276,7 @@
:on-press #(rf/dispatch [:navigate-back])
:switcher-type :select-account}]
[token-input]
[routes-component current-screen-id]
[routes-view current-screen-id]
(when (and (not loading-routes?)
sender-network-values
token-not-supported-in-receiver-networks?)

View File

@ -340,15 +340,11 @@
(let [token-symbol (:symbol token)
nav-current-screen-id (rf/sub [:view-id])
active-screen? (= nav-current-screen-id current-screen-id)
loading-routes? (rf/sub
[:wallet/wallet-send-loading-suggested-routes?])
sender-network-values (rf/sub
[:wallet/wallet-send-sender-network-values])
receiver-network-values (rf/sub
[:wallet/wallet-send-receiver-network-values])
loading-routes? (rf/sub [:wallet/wallet-send-loading-suggested-routes?])
sender-network-values (rf/sub [:wallet/wallet-send-sender-network-values])
receiver-network-values (rf/sub [:wallet/wallet-send-receiver-network-values])
network-links (rf/sub [:wallet/wallet-send-network-links])
disabled-from-chain-ids (rf/sub
[:wallet/wallet-send-disabled-from-chain-ids])
disabled-from-chain-ids (rf/sub [:wallet/wallet-send-disabled-from-chain-ids])
{token-balances-per-chain :balances-per-chain} (rf/sub [:wallet/wallet-send-token])
token-available-networks-for-suggested-routes
(send-utils/token-available-networks-for-suggested-routes