feat(wallet): Remove non-operable accounts from account switcher (#20457)
* feat(wallet): Remove non-operable accounts from account switcher * Remove non-operable accounts in the From page
This commit is contained in:
parent
fbc9b59a5e
commit
1e703cdc81
|
@ -210,12 +210,10 @@
|
||||||
:always (assoc-in [:wallet :ui :send :token-display-name]
|
:always (assoc-in [:wallet :ui :send :token-display-name]
|
||||||
(:symbol token))
|
(:symbol token))
|
||||||
:always (assoc-in
|
:always (assoc-in
|
||||||
[:wallet :ui :send
|
[:wallet :ui :send :token-not-supported-in-receiver-networks?]
|
||||||
:token-not-supported-in-receiver-networks?]
|
|
||||||
token-not-supported-in-receiver-networks?)
|
token-not-supported-in-receiver-networks?)
|
||||||
token (assoc-in [:wallet :ui :send :token] token)
|
token (assoc-in [:wallet :ui :send :token] token)
|
||||||
token-symbol (assoc-in [:wallet :ui :send :token-symbol]
|
token-symbol (assoc-in [:wallet :ui :send :token-symbol] token-symbol))
|
||||||
token-symbol))
|
|
||||||
:fx [[:dispatch [:wallet/clean-suggested-routes]]
|
:fx [[:dispatch [:wallet/clean-suggested-routes]]
|
||||||
[:dispatch
|
[:dispatch
|
||||||
[:wallet/wizard-navigate-forward
|
[:wallet/wizard-navigate-forward
|
||||||
|
@ -253,8 +251,7 @@
|
||||||
:collectible
|
:collectible
|
||||||
:token-display-name
|
:token-display-name
|
||||||
:amount
|
:amount
|
||||||
(when (send-utils/tx-type-collectible?
|
(when (send-utils/tx-type-collectible? transaction-type)
|
||||||
transaction-type)
|
|
||||||
:tx-type))})))
|
:tx-type))})))
|
||||||
|
|
||||||
(rf/reg-event-fx
|
(rf/reg-event-fx
|
||||||
|
|
|
@ -109,7 +109,8 @@
|
||||||
(let [options-height (reagent/atom 0)]
|
(let [options-height (reagent/atom 0)]
|
||||||
(fn []
|
(fn []
|
||||||
(let [theme (quo.theme/use-theme)
|
(let [theme (quo.theme/use-theme)
|
||||||
accounts (rf/sub [:wallet/accounts-without-current-viewing-account])
|
accounts (rf/sub
|
||||||
|
[:wallet/fully-or-partially-operable-accounts-without-current-viewing-account])
|
||||||
show-account-selector? (pos? (count accounts))]
|
show-account-selector? (pos? (count accounts))]
|
||||||
[:<>
|
[:<>
|
||||||
(when show-account-selector?
|
(when show-account-selector?
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
(defn view
|
(defn view
|
||||||
[]
|
[]
|
||||||
(let [selected-account-address (rf/sub [:wallet/current-viewing-account-address])
|
(let [selected-account-address (rf/sub [:wallet/current-viewing-account-address])
|
||||||
accounts (rf/sub [:wallet/accounts-without-watched-accounts])]
|
accounts (rf/sub [:wallet/fully-or-partially-operable-accounts-without-watched-accounts])]
|
||||||
[:<>
|
[:<>
|
||||||
[quo/drawer-top {:title (i18n/label :t/select-account)}]
|
[quo/drawer-top {:title (i18n/label :t/select-account)}]
|
||||||
[gesture/flat-list
|
[gesture/flat-list
|
||||||
|
|
|
@ -446,9 +446,25 @@
|
||||||
(fn [accounts]
|
(fn [accounts]
|
||||||
(remove :watch-only? accounts)))
|
(remove :watch-only? accounts)))
|
||||||
|
|
||||||
|
(defn- keep-fully-or-partially-operable-accounts
|
||||||
|
[accounts]
|
||||||
|
(filter (fn fully-or-partially-operable? [{:keys [operable]}]
|
||||||
|
(#{:fully :partially} operable))
|
||||||
|
accounts))
|
||||||
|
|
||||||
|
(rf/reg-sub
|
||||||
|
:wallet/fully-or-partially-operable-accounts-without-current-viewing-account
|
||||||
|
:<- [:wallet/accounts-without-current-viewing-account]
|
||||||
|
keep-fully-or-partially-operable-accounts)
|
||||||
|
|
||||||
|
(rf/reg-sub
|
||||||
|
:wallet/fully-or-partially-operable-accounts-without-watched-accounts
|
||||||
|
:<- [:wallet/accounts-without-watched-accounts]
|
||||||
|
keep-fully-or-partially-operable-accounts)
|
||||||
|
|
||||||
(rf/reg-sub
|
(rf/reg-sub
|
||||||
:wallet/accounts-with-current-asset
|
:wallet/accounts-with-current-asset
|
||||||
:<- [:wallet/accounts-without-watched-accounts]
|
:<- [:wallet/fully-or-partially-operable-accounts-without-watched-accounts]
|
||||||
:<- [:wallet/wallet-send-token-symbol]
|
:<- [:wallet/wallet-send-token-symbol]
|
||||||
:<- [:wallet/wallet-send-token]
|
:<- [:wallet/wallet-send-token]
|
||||||
(fn [[accounts token-symbol token]]
|
(fn [[accounts token-symbol token]]
|
||||||
|
|
|
@ -15,10 +15,12 @@
|
||||||
(def ^:private accounts-with-tokens
|
(def ^:private accounts-with-tokens
|
||||||
{:0x1 {:tokens [{:symbol "ETH"} {:symbol "SNT"}]
|
{:0x1 {:tokens [{:symbol "ETH"} {:symbol "SNT"}]
|
||||||
:network-preferences-names #{}
|
:network-preferences-names #{}
|
||||||
:customization-color nil}
|
:customization-color nil
|
||||||
|
:operable :fully}
|
||||||
:0x2 {:tokens [{:symbol "SNT"}]
|
:0x2 {:tokens [{:symbol "SNT"}]
|
||||||
:network-preferences-names #{}
|
:network-preferences-names #{}
|
||||||
:customization-color nil}})
|
:customization-color nil
|
||||||
|
:operable :partially}})
|
||||||
|
|
||||||
(def tokens-0x1
|
(def tokens-0x1
|
||||||
[{:decimals 1
|
[{:decimals 1
|
||||||
|
@ -481,7 +483,8 @@
|
||||||
(is (match? result
|
(is (match? result
|
||||||
[{:tokens [{:symbol "ETH"} {:symbol "SNT"}]
|
[{:tokens [{:symbol "ETH"} {:symbol "SNT"}]
|
||||||
:network-preferences-names #{}
|
:network-preferences-names #{}
|
||||||
:customization-color nil}]))))
|
:customization-color nil
|
||||||
|
:operable :fully}]))))
|
||||||
|
|
||||||
(testing "returns the accounts list with the current asset using token"
|
(testing "returns the accounts list with the current asset using token"
|
||||||
(swap! rf-db/app-db
|
(swap! rf-db/app-db
|
||||||
|
@ -492,7 +495,8 @@
|
||||||
(is (match? result
|
(is (match? result
|
||||||
[{:tokens [{:symbol "ETH"} {:symbol "SNT"}]
|
[{:tokens [{:symbol "ETH"} {:symbol "SNT"}]
|
||||||
:network-preferences-names #{}
|
:network-preferences-names #{}
|
||||||
:customization-color nil}]))))
|
:customization-color nil
|
||||||
|
:operable :fully}]))))
|
||||||
|
|
||||||
(testing
|
(testing
|
||||||
"returns the full accounts list with the current asset using token-symbol if each account has the asset"
|
"returns the full accounts list with the current asset using token-symbol if each account has the asset"
|
||||||
|
|
Loading…
Reference in New Issue