mirror of
https://github.com/status-im/status-mobile.git
synced 2025-03-01 16:50:58 +00:00
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]
|
||||
(:symbol token))
|
||||
:always (assoc-in
|
||||
[:wallet :ui :send
|
||||
:token-not-supported-in-receiver-networks?]
|
||||
[:wallet :ui :send :token-not-supported-in-receiver-networks?]
|
||||
token-not-supported-in-receiver-networks?)
|
||||
token (assoc-in [:wallet :ui :send :token] token)
|
||||
token-symbol (assoc-in [:wallet :ui :send :token-symbol]
|
||||
token-symbol))
|
||||
token-symbol (assoc-in [:wallet :ui :send :token-symbol] token-symbol))
|
||||
:fx [[:dispatch [:wallet/clean-suggested-routes]]
|
||||
[:dispatch
|
||||
[:wallet/wizard-navigate-forward
|
||||
@ -253,8 +251,7 @@
|
||||
:collectible
|
||||
:token-display-name
|
||||
:amount
|
||||
(when (send-utils/tx-type-collectible?
|
||||
transaction-type)
|
||||
(when (send-utils/tx-type-collectible? transaction-type)
|
||||
:tx-type))})))
|
||||
|
||||
(rf/reg-event-fx
|
||||
|
@ -108,8 +108,9 @@
|
||||
[]
|
||||
(let [options-height (reagent/atom 0)]
|
||||
(fn []
|
||||
(let [theme (quo.theme/use-theme)
|
||||
accounts (rf/sub [:wallet/accounts-without-current-viewing-account])
|
||||
(let [theme (quo.theme/use-theme)
|
||||
accounts (rf/sub
|
||||
[:wallet/fully-or-partially-operable-accounts-without-current-viewing-account])
|
||||
show-account-selector? (pos? (count accounts))]
|
||||
[:<>
|
||||
(when show-account-selector?
|
||||
|
@ -20,7 +20,7 @@
|
||||
(defn view
|
||||
[]
|
||||
(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)}]
|
||||
[gesture/flat-list
|
||||
|
@ -446,9 +446,25 @@
|
||||
(fn [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
|
||||
: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]
|
||||
(fn [[accounts token-symbol token]]
|
||||
|
@ -15,10 +15,12 @@
|
||||
(def ^:private accounts-with-tokens
|
||||
{:0x1 {:tokens [{:symbol "ETH"} {:symbol "SNT"}]
|
||||
:network-preferences-names #{}
|
||||
:customization-color nil}
|
||||
:customization-color nil
|
||||
:operable :fully}
|
||||
:0x2 {:tokens [{:symbol "SNT"}]
|
||||
:network-preferences-names #{}
|
||||
:customization-color nil}})
|
||||
:customization-color nil
|
||||
:operable :partially}})
|
||||
|
||||
(def tokens-0x1
|
||||
[{:decimals 1
|
||||
@ -481,7 +483,8 @@
|
||||
(is (match? result
|
||||
[{:tokens [{:symbol "ETH"} {:symbol "SNT"}]
|
||||
:network-preferences-names #{}
|
||||
:customization-color nil}]))))
|
||||
:customization-color nil
|
||||
:operable :fully}]))))
|
||||
|
||||
(testing "returns the accounts list with the current asset using token"
|
||||
(swap! rf-db/app-db
|
||||
@ -492,7 +495,8 @@
|
||||
(is (match? result
|
||||
[{:tokens [{:symbol "ETH"} {:symbol "SNT"}]
|
||||
:network-preferences-names #{}
|
||||
:customization-color nil}]))))
|
||||
:customization-color nil
|
||||
:operable :fully}]))))
|
||||
|
||||
(testing
|
||||
"returns the full accounts list with the current asset using token-symbol if each account has the asset"
|
||||
|
Loading…
x
Reference in New Issue
Block a user