[#11468] Hide/show option for accounts in the wallet
Signed-off-by: andrey <motor4ik@gmail.com>
This commit is contained in:
parent
8ec46a0d78
commit
ad9dc9913f
|
@ -624,6 +624,12 @@
|
||||||
(fn [accounts]
|
(fn [accounts]
|
||||||
(ethereum/get-default-account accounts)))
|
(ethereum/get-default-account accounts)))
|
||||||
|
|
||||||
|
(re-frame/reg-sub
|
||||||
|
:multiaccount/visible-accounts
|
||||||
|
:<- [:multiaccount/accounts]
|
||||||
|
(fn [accounts]
|
||||||
|
(remove :hidden accounts)))
|
||||||
|
|
||||||
(re-frame/reg-sub
|
(re-frame/reg-sub
|
||||||
:sign-in-enabled?
|
:sign-in-enabled?
|
||||||
:<- [:multiaccounts/login]
|
:<- [:multiaccounts/login]
|
||||||
|
@ -710,13 +716,19 @@
|
||||||
(fn [accounts]
|
(fn [accounts]
|
||||||
(filter #(not= (:type %) :watch) accounts)))
|
(filter #(not= (:type %) :watch) accounts)))
|
||||||
|
|
||||||
|
(re-frame/reg-sub
|
||||||
|
:visible-accounts-without-watch-only
|
||||||
|
:<- [:multiaccount/accounts]
|
||||||
|
(fn [accounts]
|
||||||
|
(remove :hidden (filter #(not= (:type %) :watch) accounts))))
|
||||||
|
|
||||||
(defn filter-recipient-accounts
|
(defn filter-recipient-accounts
|
||||||
[search-filter {:keys [name]}]
|
[search-filter {:keys [name]}]
|
||||||
(string/includes? (string/lower-case (str name)) search-filter))
|
(string/includes? (string/lower-case (str name)) search-filter))
|
||||||
|
|
||||||
(re-frame/reg-sub
|
(re-frame/reg-sub
|
||||||
:accounts-for-recipient
|
:accounts-for-recipient
|
||||||
:<- [:multiaccount/accounts]
|
:<- [:multiaccount/visible-accounts]
|
||||||
:<- [:wallet/prepare-transaction]
|
:<- [:wallet/prepare-transaction]
|
||||||
:<- [:search/recipient-filter]
|
:<- [:search/recipient-filter]
|
||||||
(fn [[accounts {:keys [from]} search-filter]]
|
(fn [[accounts {:keys [from]} search-filter]]
|
||||||
|
@ -1551,8 +1563,10 @@
|
||||||
(re-frame/reg-sub
|
(re-frame/reg-sub
|
||||||
:balances
|
:balances
|
||||||
:<- [:wallet]
|
:<- [:wallet]
|
||||||
(fn [wallet]
|
:<- [:multiaccount/visible-accounts]
|
||||||
(map :balance (vals (:accounts wallet)))))
|
(fn [[wallet accounts]]
|
||||||
|
(let [accounts (map :address accounts)]
|
||||||
|
(map :balance (vals (select-keys (:accounts wallet) accounts))))))
|
||||||
|
|
||||||
(re-frame/reg-sub
|
(re-frame/reg-sub
|
||||||
:empty-balances?
|
:empty-balances?
|
||||||
|
|
|
@ -65,7 +65,7 @@
|
||||||
(str desc)]]))
|
(str desc)]]))
|
||||||
|
|
||||||
(views/defview navigation [{:keys [url can-go-back? can-go-forward? dapps-account empty-tab browser-id name]}]
|
(views/defview navigation [{:keys [url can-go-back? can-go-forward? dapps-account empty-tab browser-id name]}]
|
||||||
(views/letsubs [accounts [:accounts-without-watch-only]]
|
(views/letsubs [accounts [:visible-accounts-without-watch-only]]
|
||||||
[react/view (styles/navbar)
|
[react/view (styles/navbar)
|
||||||
[react/touchable-highlight {:on-press #(if can-go-back?
|
[react/touchable-highlight {:on-press #(if can-go-back?
|
||||||
(re-frame/dispatch [:browser.ui/previous-page-button-pressed])
|
(re-frame/dispatch [:browser.ui/previous-page-button-pressed])
|
||||||
|
|
|
@ -108,7 +108,8 @@
|
||||||
[status-im.ui.components.icons.icons :as icons]
|
[status-im.ui.components.icons.icons :as icons]
|
||||||
[status-im.ui.screens.chat.pinned-messages :as pin-messages]
|
[status-im.ui.screens.chat.pinned-messages :as pin-messages]
|
||||||
[status-im.ui.screens.communities.create-category :as create-category]
|
[status-im.ui.screens.communities.create-category :as create-category]
|
||||||
[status-im.ui.screens.communities.select-category :as select-category]))
|
[status-im.ui.screens.communities.select-category :as select-category]
|
||||||
|
[status-im.ui.screens.wallet.accounts-manage.views :as accounts-manage]))
|
||||||
|
|
||||||
(def components
|
(def components
|
||||||
[{:name :chat-toolbar
|
[{:name :chat-toolbar
|
||||||
|
@ -376,6 +377,10 @@
|
||||||
:options {:topBar {:title {:text (i18n/label :t/main-currency)}}}
|
:options {:topBar {:title {:text (i18n/label :t/main-currency)}}}
|
||||||
:component currency-settings/currency-settings}
|
:component currency-settings/currency-settings}
|
||||||
|
|
||||||
|
{:name :manage-accounts
|
||||||
|
:options {:topBar {:title {:text (i18n/label :t/wallet-manage-accounts)}}}
|
||||||
|
:component accounts-manage/manage}
|
||||||
|
|
||||||
;;MY STATUS
|
;;MY STATUS
|
||||||
|
|
||||||
{:name :status
|
{:name :status
|
||||||
|
|
|
@ -10,7 +10,14 @@
|
||||||
|
|
||||||
(defn accounts-options [mnemonic]
|
(defn accounts-options [mnemonic]
|
||||||
(fn []
|
(fn []
|
||||||
[react/view
|
[:<>
|
||||||
|
[quo/list-item
|
||||||
|
{:theme :accent
|
||||||
|
:title (i18n/label :t/wallet-manage-accounts)
|
||||||
|
:icon :main-icons/account
|
||||||
|
:accessibility-label :wallet-manage-accounts
|
||||||
|
:on-press #(hide-sheet-and-dispatch
|
||||||
|
[:navigate-to :manage-accounts])}]
|
||||||
[quo/list-item
|
[quo/list-item
|
||||||
{:theme :accent
|
{:theme :accent
|
||||||
:title (i18n/label :t/wallet-manage-assets)
|
:title (i18n/label :t/wallet-manage-assets)
|
||||||
|
@ -47,7 +54,7 @@
|
||||||
:on-press #(hide-sheet-and-dispatch
|
:on-press #(hide-sheet-and-dispatch
|
||||||
[:navigate-to :backup-seed])}])]))
|
[:navigate-to :backup-seed])}])]))
|
||||||
|
|
||||||
(defn account-card-actions [account type]
|
(defn account-card-actions [account type wallet]
|
||||||
[react/view
|
[react/view
|
||||||
(when-not (= type :watch)
|
(when-not (= type :watch)
|
||||||
[quo/list-item
|
[quo/list-item
|
||||||
|
@ -63,7 +70,15 @@
|
||||||
:icon :main-icons/share
|
:icon :main-icons/share
|
||||||
:accessibility-label :share-account-button
|
:accessibility-label :share-account-button
|
||||||
:on-press #(hide-sheet-and-dispatch
|
:on-press #(hide-sheet-and-dispatch
|
||||||
[:wallet/share-popover (:address account)])}]])
|
[:wallet/share-popover (:address account)])}]
|
||||||
|
(when-not wallet
|
||||||
|
[quo/list-item
|
||||||
|
{:theme :accent
|
||||||
|
:title (i18n/label :t/hide)
|
||||||
|
:icon :main-icons/hide
|
||||||
|
:accessibility-label :hide-account-button
|
||||||
|
:on-press #(hide-sheet-and-dispatch
|
||||||
|
[:wallet.accounts/save-account account {:hidden true}])}])])
|
||||||
|
|
||||||
(defn add-account []
|
(defn add-account []
|
||||||
(let [keycard? @(re-frame/subscribe [:keycard-multiaccount?])]
|
(let [keycard? @(re-frame/subscribe [:keycard-multiaccount?])]
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
[status-im.keycard.login :as keycard.login])
|
[status-im.keycard.login :as keycard.login])
|
||||||
(:require-macros [status-im.utils.views :as views]))
|
(:require-macros [status-im.utils.views :as views]))
|
||||||
|
|
||||||
(views/defview account-card [{:keys [name color address type] :as account} keycard? card-width]
|
(views/defview account-card [{:keys [name color address type wallet] :as account} keycard? card-width]
|
||||||
(views/letsubs [currency [:wallet/currency]
|
(views/letsubs [currency [:wallet/currency]
|
||||||
portfolio-value [:account-portfolio-value address]
|
portfolio-value [:account-portfolio-value address]
|
||||||
prices-loading? [:prices-loading?]]
|
prices-loading? [:prices-loading?]]
|
||||||
|
@ -48,7 +48,7 @@
|
||||||
[react/touchable-highlight
|
[react/touchable-highlight
|
||||||
{:style styles/card-icon-more
|
{:style styles/card-icon-more
|
||||||
:on-press #(re-frame/dispatch [:bottom-sheet/show-sheet
|
:on-press #(re-frame/dispatch [:bottom-sheet/show-sheet
|
||||||
{:content (fn [] [sheets/account-card-actions account type])
|
{:content (fn [] [sheets/account-card-actions account type wallet])
|
||||||
:content-height 130}])}
|
:content-height 130}])}
|
||||||
[icons/icon :main-icons/more {:color colors/white-persist}]]]]]))
|
[icons/icon :main-icons/more {:color colors/white-persist}]]]]]))
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@
|
||||||
[dot {:selected (= selected i)}])])
|
[dot {:selected (= selected i)}])])
|
||||||
|
|
||||||
(views/defview accounts []
|
(views/defview accounts []
|
||||||
(views/letsubs [accounts [:multiaccount/accounts]
|
(views/letsubs [accounts [:multiaccount/visible-accounts]
|
||||||
keycard? [:keycard-multiaccount?]
|
keycard? [:keycard-multiaccount?]
|
||||||
window-width [:dimensions/window-width]
|
window-width [:dimensions/window-width]
|
||||||
index (reagent/atom 0)]
|
index (reagent/atom 0)]
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
(ns status-im.ui.screens.wallet.accounts-manage.views
|
||||||
|
(:require [status-im.utils.handlers :refer [>evt <sub]]
|
||||||
|
[status-im.ui.components.list.views :as list]
|
||||||
|
[reagent.core :as reagent]
|
||||||
|
[quo.core :as quo]
|
||||||
|
[status-im.utils.utils :as utils]
|
||||||
|
[status-im.ui.components.icons.icons :as icons]
|
||||||
|
[status-im.ui.components.colors :as colors]))
|
||||||
|
|
||||||
|
(defn render-account [_]
|
||||||
|
(reagent/create-class
|
||||||
|
{:should-component-update
|
||||||
|
(fn [_ [_ old-item] [_ new-item]]
|
||||||
|
(not= (:hidden old-item) (:hidden new-item)))
|
||||||
|
:reagent-render
|
||||||
|
(fn [{:keys [hidden name address wallet] :as account}]
|
||||||
|
[quo/list-item
|
||||||
|
{:accessory [icons/icon
|
||||||
|
(if hidden :main-icos/hide :main-icos/show)
|
||||||
|
(merge {:accessibility-label (if hidden :hide-icon :show-icon)}
|
||||||
|
(when wallet {:color colors/gray}))]
|
||||||
|
:animated-accessory? false
|
||||||
|
:animated false
|
||||||
|
:disabled wallet
|
||||||
|
:title name
|
||||||
|
:subtitle (utils/get-shortened-checksum-address address)
|
||||||
|
:on-press #(>evt [:wallet.accounts/save-account account {:hidden (not hidden)}])}])}))
|
||||||
|
|
||||||
|
(defn manage []
|
||||||
|
(let [accounts (<sub [:multiaccount/accounts])]
|
||||||
|
[list/flat-list
|
||||||
|
{:key-fn :address
|
||||||
|
:data accounts
|
||||||
|
:render-fn render-account}]))
|
|
@ -24,8 +24,8 @@
|
||||||
:on-press #(re-frame/dispatch [event field account])}])
|
:on-press #(re-frame/dispatch [event field account])}])
|
||||||
|
|
||||||
(views/defview accounts-list [field event]
|
(views/defview accounts-list [field event]
|
||||||
(views/letsubs [accounts [:multiaccount/accounts]
|
(views/letsubs [accounts [:multiaccount/visible-accounts]
|
||||||
accounts-whithout-watch [:accounts-without-watch-only]]
|
accounts-whithout-watch [:visible-accounts-without-watch-only]]
|
||||||
[list/flat-list {:data (if (= :to field) accounts accounts-whithout-watch)
|
[list/flat-list {:data (if (= :to field) accounts accounts-whithout-watch)
|
||||||
:key-fn :address
|
:key-fn :address
|
||||||
:render-data {:field field
|
:render-data {:field field
|
||||||
|
|
|
@ -275,11 +275,12 @@
|
||||||
|
|
||||||
(fx/defn save-account
|
(fx/defn save-account
|
||||||
{:events [:wallet.accounts/save-account]}
|
{:events [:wallet.accounts/save-account]}
|
||||||
[{:keys [db]} account {:keys [name color]}]
|
[{:keys [db]} account {:keys [name color hidden]}]
|
||||||
(let [accounts (:multiaccount/accounts db)
|
(let [accounts (:multiaccount/accounts db)
|
||||||
new-account (cond-> account
|
new-account (cond-> account
|
||||||
name (assoc :name name)
|
name (assoc :name name)
|
||||||
color (assoc :color color))
|
color (assoc :color color)
|
||||||
|
(not (nil? hidden)) (assoc :hidden hidden))
|
||||||
new-accounts (replace {account new-account} accounts)]
|
new-accounts (replace {account new-account} accounts)]
|
||||||
{::json-rpc/call [{:method "accounts_saveAccounts"
|
{::json-rpc/call [{:method "accounts_saveAccounts"
|
||||||
:params [[new-account]]
|
:params [[new-account]]
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"_comment": "DO NOT EDIT THIS FILE BY HAND. USE 'scripts/update-status-go.sh <tag>' instead",
|
"_comment": "DO NOT EDIT THIS FILE BY HAND. USE 'scripts/update-status-go.sh <tag>' instead",
|
||||||
"owner": "status-im",
|
"owner": "status-im",
|
||||||
"repo": "status-go",
|
"repo": "status-go",
|
||||||
"version": "v0.83.9",
|
"version": "v0.83.11",
|
||||||
"commit-sha1": "7dfeda15110af8ae315f41d19db39476a8e28d62",
|
"commit-sha1": "fc16588cf1b37a6aea473404495782ca9e0cfff8",
|
||||||
"src-sha256": "12v2k8679kl8gca6ihpn954rblpfdsi95kcaxpm39dahlg5ax2v9"
|
"src-sha256": "0gh0v1v3hcxq99i0szwp8y5395xfcdj920wg2p707s8j3vwrb325"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1298,6 +1298,7 @@
|
||||||
"wallet-invalid-address-checksum": "Error in address: \n {{data}}",
|
"wallet-invalid-address-checksum": "Error in address: \n {{data}}",
|
||||||
"wallet-invalid-chain-id": "Network does not match: \n {{data}} but current chain is {{chain}}",
|
"wallet-invalid-chain-id": "Network does not match: \n {{data}} but current chain is {{chain}}",
|
||||||
"wallet-manage-assets": "Manage assets",
|
"wallet-manage-assets": "Manage assets",
|
||||||
|
"wallet-manage-accounts": "Manage accounts",
|
||||||
"wallet-request": "Request",
|
"wallet-request": "Request",
|
||||||
"wallet-send": "Send",
|
"wallet-send": "Send",
|
||||||
"wallet-send-min-units": "Min 21000 units",
|
"wallet-send-min-units": "Min 21000 units",
|
||||||
|
@ -1645,5 +1646,6 @@
|
||||||
"suggested-price-limit": "Suggested price limit",
|
"suggested-price-limit": "Suggested price limit",
|
||||||
"include": "Include",
|
"include": "Include",
|
||||||
"category": "Category",
|
"category": "Category",
|
||||||
"edit-chats": "Edit chats"
|
"edit-chats": "Edit chats",
|
||||||
|
"hide": "Hide"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue