From bf16116acda18e2b4fe8fea75bdb1669e00c4211 Mon Sep 17 00:00:00 2001 From: yenda Date: Tue, 10 Dec 2019 12:31:22 +0100 Subject: [PATCH] move multiaccount settings to a table integrate status-go changes to move multiaccount settings to a table that can be migrated Signed-off-by: yenda --- .../status/ethereum/module/StatusModule.java | 8 +- .../ios/RCTStatus/RCTStatus.m | 6 +- src/status_im/bootnodes/core.cljs | 30 ++++--- src/status_im/browser/core.cljs | 4 +- src/status_im/constants.cljs | 81 ++++++++--------- src/status_im/data_store/settings.cljs | 35 ++++++++ src/status_im/ens/core.cljs | 13 +-- src/status_im/ethereum/json_rpc.cljs | 6 +- src/status_im/events.cljs | 17 ++-- src/status_im/fleet/core.cljs | 26 +++--- src/status_im/hardwallet/core.cljs | 33 ++++--- src/status_im/log_level/core.cljs | 48 +++++----- src/status_im/mailserver/core.cljs | 30 ++++--- src/status_im/multiaccounts/core.cljs | 25 +++--- src/status_im/multiaccounts/create/core.cljs | 83 ++++++++++------- src/status_im/multiaccounts/db.cljs | 3 +- src/status_im/multiaccounts/login/core.cljs | 49 ++++------ src/status_im/multiaccounts/update/core.cljs | 43 +++------ src/status_im/native_module/core.cljs | 10 ++- src/status_im/network/core.cljs | 14 +-- src/status_im/node/core.cljs | 17 ++-- src/status_im/pairing/core.cljs | 34 +++++-- src/status_im/stickers/core.cljs | 3 +- src/status_im/subs.cljs | 70 +++++++-------- src/status_im/tribute_to_talk/core.cljs | 29 +++--- src/status_im/tribute_to_talk/db.cljs | 2 +- .../ui/screens/advanced_settings/views.cljs | 4 +- .../ui/screens/bootnodes_settings/views.cljs | 4 +- .../ui/screens/currency_settings/models.cljs | 12 +-- .../ui/screens/fleet_settings/views.cljs | 2 +- .../ui/screens/log_level_settings/views.cljs | 2 +- .../mobile_network_settings/events.cljs | 6 +- .../privacy_and_security_settings/views.cljs | 11 ++- src/status_im/ui/screens/profile/models.cljs | 11 ++- src/status_im/wallet/accounts/core.cljs | 4 +- .../wallet/choose_recipient/core.cljs | 4 +- src/status_im/wallet/collectibles/core.cljs | 10 ++- src/status_im/wallet/core.cljs | 89 +++++++++---------- src/status_im/wallet/custom_tokens/core.cljs | 3 +- status-go-version.json | 6 +- test/cljs/status_im/test/i18n.cljs | 6 -- test/cljs/status_im/test/mailserver/core.cljs | 30 +++---- test/cljs/status_im/test/models/bootnode.cljs | 73 +++++++-------- .../test/multiaccounts/update/core.cljs | 8 +- test/cljs/status_im/test/network/core.cljs | 4 +- test/cljs/status_im/test/sign_in/data.cljs | 62 +++---------- .../status_im/test/tribute_to_talk/core.cljs | 12 +-- .../test/tribute_to_talk/whitelist.cljs | 4 +- .../ui/screens/currency_settings/models.cljs | 15 ++-- translations/ar.json | 8 +- translations/en.json | 6 -- translations/fr.json | 6 -- translations/it.json | 8 +- translations/ja.json | 6 -- translations/ko.json | 6 -- translations/ru.json | 6 -- translations/zh.json | 8 +- translations/zh_Hans_CN.json | 6 -- 58 files changed, 552 insertions(+), 609 deletions(-) create mode 100644 src/status_im/data_store/settings.cljs diff --git a/modules/react-native-status/android/src/main/java/im/status/ethereum/module/StatusModule.java b/modules/react-native-status/android/src/main/java/im/status/ethereum/module/StatusModule.java index 92198da015..c266c46361 100644 --- a/modules/react-native-status/android/src/main/java/im/status/ethereum/module/StatusModule.java +++ b/modules/react-native-status/android/src/main/java/im/status/ethereum/module/StatusModule.java @@ -312,10 +312,10 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL } @ReactMethod - public void saveAccountAndLogin(final String multiaccountData, final String password, final String config, final String accountsData) { + public void saveAccountAndLogin(final String multiaccountData, final String password, final String settings, final String config, final String accountsData) { Log.d(TAG, "saveAccountAndLogin"); String finalConfig = prepareDirAndUpdateConfig(config); - String result = Statusgo.saveAccountAndLogin(multiaccountData, password, finalConfig, accountsData); + String result = Statusgo.saveAccountAndLogin(multiaccountData, password, settings, finalConfig, accountsData); if (result.startsWith("{\"error\":\"\"")) { Log.d(TAG, "saveAccountAndLogin result: " + result); Log.d(TAG, "Geth node started"); @@ -325,10 +325,10 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL } @ReactMethod - public void saveAccountAndLoginWithKeycard(final String multiaccountData, final String password, final String config, final String accountsData, final String chatKey) { + public void saveAccountAndLoginWithKeycard(final String multiaccountData, final String password, final String settings, final String config, final String accountsData, final String chatKey) { Log.d(TAG, "saveAccountAndLoginWithKeycard"); String finalConfig = prepareDirAndUpdateConfig(config); - String result = Statusgo.saveAccountAndLoginWithKeycard(multiaccountData, password, finalConfig, accountsData, chatKey); + String result = Statusgo.saveAccountAndLoginWithKeycard(multiaccountData, password, settings, finalConfig, accountsData, chatKey); if (result.startsWith("{\"error\":\"\"")) { Log.d(TAG, "saveAccountAndLoginWithKeycard result: " + result); Log.d(TAG, "Geth node started"); diff --git a/modules/react-native-status/ios/RCTStatus/RCTStatus.m b/modules/react-native-status/ios/RCTStatus/RCTStatus.m index 3e27a4de5c..e98064aa13 100644 --- a/modules/react-native-status/ios/RCTStatus/RCTStatus.m +++ b/modules/react-native-status/ios/RCTStatus/RCTStatus.m @@ -380,19 +380,21 @@ RCT_EXPORT_METHOD(prepareDirAndUpdateConfig:(NSString *)config //////////////////////////////////////////////////////////////////// saveAccountAndLogin RCT_EXPORT_METHOD(saveAccountAndLogin:(NSString *)multiaccountData password:(NSString *)password + settings:(NSString *)settings config:(NSString *)config accountsData:(NSString *)accountsData) { #if DEBUG NSLog(@"SaveAccountAndLogin() method called"); #endif NSString *finalConfig = [self prepareDirAndUpdateConfig:config]; - NSString *result = StatusgoSaveAccountAndLogin(multiaccountData, password, finalConfig, accountsData); + NSString *result = StatusgoSaveAccountAndLogin(multiaccountData, password, settings, finalConfig, accountsData); NSLog(@"%@", result); } //////////////////////////////////////////////////////////////////// saveAccountAndLoginWithKeycard RCT_EXPORT_METHOD(saveAccountAndLoginWithKeycard:(NSString *)multiaccountData password:(NSString *)password + settings:(NSString *)settings config:(NSString *)config accountsData:(NSString *)accountsData chatKey:(NSString *)chatKey) { @@ -400,7 +402,7 @@ RCT_EXPORT_METHOD(saveAccountAndLoginWithKeycard:(NSString *)multiaccountData NSLog(@"SaveAccountAndLoginWithKeycard() method called"); #endif NSString *finalConfig = [self prepareDirAndUpdateConfig:config]; - NSString *result = StatusgoSaveAccountAndLoginWithKeycard(multiaccountData, password, finalConfig, accountsData, chatKey); + NSString *result = StatusgoSaveAccountAndLoginWithKeycard(multiaccountData, password, settings, finalConfig, accountsData, chatKey); NSLog(@"%@", result); } diff --git a/src/status_im/bootnodes/core.cljs b/src/status_im/bootnodes/core.cljs index de0ad4f4d8..7c1acb1646 100644 --- a/src/status_im/bootnodes/core.cljs +++ b/src/status_im/bootnodes/core.cljs @@ -19,8 +19,8 @@ :name bootnode-name}) (fx/defn fetch [cofx id] - (let [network (get-in cofx [:db :network])] - (get-in cofx [:db :multiaccount :bootnodes network id]))) + (let [network (get-in cofx [:db :networks/current-network])] + (get-in cofx [:db :multiaccount :custom-bootnodes network id]))) (fx/defn set-input [{:keys [db]} input-key value] @@ -47,16 +47,16 @@ (assoc fxs :dispatch [:navigate-to :edit-bootnode]))) (defn custom-bootnodes-in-use? [{:keys [db] :as cofx}] - (let [network (:network db)] - (get-in db [:multiaccount :settings :bootnodes network]))) + (let [network (:networks/current-network db)] + (get-in db [:multiaccount :custom-bootnodes-enabled? network]))) (fx/defn delete [{{:keys [multiaccount] :as db} :db :as cofx} id] - (let [network (:network db) - new-multiaccount (update-in multiaccount [:bootnodes network] dissoc id)] + (let [network (:networks/current-network db) + new-multiaccount (update-in multiaccount [:custom-bootnodes network] dissoc id)] (fx/merge cofx {:db (assoc db :multiaccount new-multiaccount)} (multiaccounts.update/multiaccount-update - (select-keys new-multiaccount [:bootnodes]) + :custom-bootnodes (:custom-bootnodes new-multiaccount) {:success-event (when (custom-bootnodes-in-use? cofx) [:multiaccounts.update.callback/save-settings-success])})))) @@ -64,14 +64,14 @@ [{{:bootnodes/keys [manage] :keys [multiaccount] :as db} :db random-id-generator :random-id-generator :as cofx}] (let [{:keys [name id url]} manage - network (:network db) + network (:networks/current-network db) bootnode (build (or (:value id) (random-id-generator)) (:value name) (:value url) network) new-bootnodes (assoc-in - (:bootnodes multiaccount) + (:custom-bootnodes multiaccount) [network (:id bootnode)] bootnode)] @@ -79,17 +79,19 @@ {:db (dissoc db :bootnodes/manage) :dispatch [:navigate-back]} (multiaccounts.update/multiaccount-update - {:bootnodes new-bootnodes} + :custom-bootnodes new-bootnodes {:success-event (when (custom-bootnodes-in-use? cofx) [:multiaccounts.update.callback/save-settings-success])})))) (fx/defn toggle-custom-bootnodes + {:events [:bootnodes.ui/custom-bootnodes-switch-toggled]} [{:keys [db] :as cofx} value] (let [current-network (:networks/current-network db) - settings (get-in db [:multiaccount :settings])] - (multiaccounts.update/update-settings cofx - (assoc-in settings [:bootnodes current-network] value) - {:success-event [:multiaccounts.update.callback/save-settings-success]}))) + bootnodes-settings (get-in db [:multiaccount :custom-bootnodes-enabled?])] + (multiaccounts.update/multiaccount-update + cofx + :custom-bootnodes-enabled? (assoc bootnodes-settings current-network value) + {:success-event [:multiaccounts.update.callback/save-settings-success]}))) (fx/defn set-bootnodes-from-qr [cofx url] diff --git a/src/status_im/browser/core.cljs b/src/status_im/browser/core.cljs index 95bc3ee9e8..1a9b5eee8a 100644 --- a/src/status_im/browser/core.cljs +++ b/src/status_im/browser/core.cljs @@ -461,7 +461,7 @@ {:browser/clear-web-data nil} (bottom-sheet/hide-bottom-sheet) (browser.permissions/clear-dapps-permissions) - (multiaccounts.update/multiaccount-update {:dapps-address address} {}) + (multiaccounts.update/multiaccount-update :dapps-address address {}) #(when (= (:view-id db) :browser) (merge (navigation/navigate-back %) - {:dispatch [:browser.ui/browser-item-selected (get-in db [:browser/options :browser-id])]})))) \ No newline at end of file + {:dispatch [:browser.ui/browser-item-selected (get-in db [:browser/options :browser-id])]})))) diff --git a/src/status_im/constants.cljs b/src/status_im/constants.cljs index 8d2eb5c7a0..e1dbac313e 100644 --- a/src/status_im/constants.cljs +++ b/src/status_im/constants.cljs @@ -35,56 +35,57 @@ (def system "system") (def mainnet-networks - {"mainnet_rpc" {:id "mainnet_rpc", - :name "Mainnet with upstream RPC", - :config {:NetworkId (ethereum/chain-keyword->chain-id :mainnet) - :DataDir "/ethereum/mainnet_rpc" - :UpstreamConfig {:Enabled true - :URL "https://mainnet.infura.io/v3/f315575765b14720b32382a61a89341a"}}}}) + [{:id "mainnet_rpc", + :name "Mainnet with upstream RPC", + :config {:NetworkId (ethereum/chain-keyword->chain-id :mainnet) + :DataDir "/ethereum/mainnet_rpc" + :UpstreamConfig {:Enabled true + :URL "https://mainnet.infura.io/v3/f315575765b14720b32382a61a89341a"}}}]) (def sidechain-networks - {"xdai_rpc" {:id "xdai_rpc", - :name "xDai Chain", - :config {:NetworkId (ethereum/chain-keyword->chain-id :xdai) - :DataDir "/ethereum/xdai_rpc" - :UpstreamConfig {:Enabled true - :URL "https://dai.poa.network"}}} - "poa_rpc" {:id "poa_rpc", - :name "POA Network", - :config {:NetworkId (ethereum/chain-keyword->chain-id :poa) - :DataDir "/ethereum/poa_rpc" - :UpstreamConfig {:Enabled true - :URL "https://core.poa.network"}}}}) + [{:id "xdai_rpc", + :name "xDai Chain", + :config {:NetworkId (ethereum/chain-keyword->chain-id :xdai) + :DataDir "/ethereum/xdai_rpc" + :UpstreamConfig {:Enabled true + :URL "https://dai.poa.network"}}} + {:id "poa_rpc", + :name "POA Network", + :config {:NetworkId (ethereum/chain-keyword->chain-id :poa) + :DataDir "/ethereum/poa_rpc" + :UpstreamConfig {:Enabled true + :URL "https://core.poa.network"}}}]) (def testnet-networks - {"testnet_rpc" {:id "testnet_rpc", - :name "Ropsten with upstream RPC", - :config {:NetworkId (ethereum/chain-keyword->chain-id :testnet) - :DataDir "/ethereum/testnet_rpc" - :UpstreamConfig {:Enabled true - :URL "https://ropsten.infura.io/v3/f315575765b14720b32382a61a89341a"}}} - "rinkeby_rpc" {:id "rinkeby_rpc", - :name "Rinkeby with upstream RPC", - :config {:NetworkId (ethereum/chain-keyword->chain-id :rinkeby) - :DataDir "/ethereum/rinkeby_rpc" - :UpstreamConfig {:Enabled true - :URL "https://rinkeby.infura.io/v3/f315575765b14720b32382a61a89341a"}}} - "goerli_rpc" {:id "goerli_rpc", - :name "Goerli with upstream RPC", - :config {:NetworkId (ethereum/chain-keyword->chain-id :goerli) - :DataDir "/ethereum/goerli_rpc" - :UpstreamConfig {:Enabled true - :URL "https://goerli.blockscout.com/"}}}}) + [{:id "testnet_rpc", + :name "Ropsten with upstream RPC", + :config {:NetworkId (ethereum/chain-keyword->chain-id :testnet) + :DataDir "/ethereum/testnet_rpc" + :UpstreamConfig {:Enabled true + :URL "https://ropsten.infura.io/v3/f315575765b14720b32382a61a89341a"}}} + {:id "rinkeby_rpc", + :name "Rinkeby with upstream RPC", + :config {:NetworkId (ethereum/chain-keyword->chain-id :rinkeby) + :DataDir "/ethereum/rinkeby_rpc" + :UpstreamConfig {:Enabled true + :URL "https://rinkeby.infura.io/v3/f315575765b14720b32382a61a89341a"}}} + {:id "goerli_rpc", + :name "Goerli with upstream RPC", + :config {:NetworkId (ethereum/chain-keyword->chain-id :goerli) + :DataDir "/ethereum/goerli_rpc" + :UpstreamConfig {:Enabled true + :URL "https://goerli.blockscout.com/"}}}]) (def default-networks - (merge testnet-networks mainnet-networks sidechain-networks)) + (concat testnet-networks mainnet-networks sidechain-networks)) -(def default-multiaccount-settings +(def default-multiaccount {:preview-privacy? config/blank-preview? - :wallet {:visible-tokens {:mainnet #{:SNT}}}}) + :wallet/visible-tokens {:mainnet #{:SNT}} + :currency :usd}) (defn default-visible-tokens [chain] - (get-in default-multiaccount-settings [:wallet :visible-tokens chain])) + (get-in default-multiaccount [:wallet/visible-tokens chain])) (def currencies {:aed {:id :aed :code "AED" :display-name (i18n/label :t/currency-display-name-aed) :symbol "د.إ"} diff --git a/src/status_im/data_store/settings.cljs b/src/status_im/data_store/settings.cljs new file mode 100644 index 0000000000..1a7bb2e514 --- /dev/null +++ b/src/status_im/data_store/settings.cljs @@ -0,0 +1,35 @@ +(ns status-im.data-store.settings + (:require [status-im.ethereum.eip55 :as eip55])) + +(defn rpc->networks [networks] + (reduce (fn [acc {:keys [id] :as network}] + (assoc acc id network)) + {} + networks)) + +(defn rpc->visible-tokens [visible-tokens] + (reduce-kv (fn [acc chain visible-tokens] + (assoc acc chain (into #{} (map keyword visible-tokens)))) + {} + visible-tokens)) + +(defn rpc->pinned-mailservers [pinned-mailservers] + (reduce-kv (fn [acc chain pinned-mailserver] + (assoc acc chain (keyword pinned-mailserver))) + {} + pinned-mailservers)) + +(defn rpc->custom-bootnodes [custom-bootnodes] + (reduce-kv (fn [acc chain custom-bootnodes] + (assoc acc (str chain) custom-bootnodes)) + {} + custom-bootnodes)) + +(defn rpc->settings [settings] + (-> settings + (update :dapps-address eip55/address->checksum) + (update :address eip55/address->checksum) + (update :networks/networks rpc->networks) + (update :wallet/visible-tokens rpc->visible-tokens) + (update :pinned-mailservers rpc->pinned-mailservers) + (update :currency keyword))) diff --git a/src/status_im/ens/core.cljs b/src/status_im/ens/core.cljs index 4dfeab39e2..f6642eff73 100644 --- a/src/status_im/ens/core.cljs +++ b/src/status_im/ens/core.cljs @@ -71,10 +71,13 @@ (let [name (fullname custom-domain? username) names (get-in db [:multiaccount :usernames] []) new-names (conj names name)] - (multiaccounts.update/multiaccount-update cofx - (cond-> {:usernames new-names} - (empty? names) (assoc :preferred-name name)) - {:on-success #(re-frame/dispatch [::username-saved])}))) + (fx/merge cofx + (multiaccounts.update/multiaccount-update + :usernames new-names + {:on-success #(re-frame/dispatch [::username-saved])}) + (when (empty? names) + (multiaccounts.update/multiaccount-update + :preferred-name name {}))))) (fx/defn on-input-submitted {:events [::input-submitted ::input-icon-pressed]} @@ -226,7 +229,7 @@ {:events [::save-preferred-name]} [{:keys [db] :as cofx} name] (multiaccounts.update/multiaccount-update cofx - {:preferred-name name} + :preferred-name name {})) (fx/defn on-registration-failure diff --git a/src/status_im/ethereum/json_rpc.cljs b/src/status_im/ethereum/json_rpc.cljs index e2538fb970..d78a572794 100644 --- a/src/status_im/ethereum/json_rpc.cljs +++ b/src/status_im/ethereum/json_rpc.cljs @@ -82,10 +82,8 @@ "permissions_addDappPermissions" {} "permissions_getDappPermissions" {} "permissions_deleteDappPermissions" {} - "settings_saveConfig" {} - "settings_getConfig" {} - "settings_getConfigs" {} - "settings_saveNodeConfig" {} + "settings_saveSetting" {} + "settings_getSettings" {} "accounts_getAccounts" {} "accounts_saveAccounts" {} "accounts_deleteAccount" {} diff --git a/src/status_im/events.cljs b/src/status_im/events.cljs index 2e701dc6cb..da139648a5 100644 --- a/src/status_im/events.cljs +++ b/src/status_im/events.cljs @@ -77,13 +77,13 @@ (handlers/register-handler-fx :multiaccounts.update.callback/published (fn [{:keys [now] :as cofx} _] - (multiaccounts.update/multiaccount-update cofx {:last-updated now} {}))) + (multiaccounts.update/multiaccount-update cofx :last-updated now {}))) (handlers/register-handler-fx :multiaccounts.update.callback/failed-to-publish (fn [{:keys [now] :as cofx} [_ message]] (log/warn "failed to publish multiaccount update" message) - (multiaccounts.update/multiaccount-update cofx {:last-updated now} {}))) + (multiaccounts.update/multiaccount-update cofx :last-updated now {}))) (handlers/register-handler-fx :multiaccounts.ui/dev-mode-switched @@ -289,11 +289,6 @@ ;; bootnodes module -(handlers/register-handler-fx - :bootnodes.ui/custom-bootnodes-switch-toggled - (fn [cofx [_ value]] - (bootnodes/toggle-custom-bootnodes cofx value))) - (handlers/register-handler-fx :bootnodes.ui/add-bootnode-pressed (fn [cofx [_ bootnode-id]] @@ -354,7 +349,8 @@ (handlers/register-handler-fx :log-level.ui/logging-enabled-confirmed (fn [cofx [_ enabled]] - (log-level/save-logging-enabled cofx enabled))) + ;;FIXME desktop only + #_(log-level/save-logging-enabled cofx enabled))) ;; Browser bridge module @@ -583,7 +579,8 @@ (fx/merge cofx (multiaccounts.update/multiaccount-update - {:stickers/recent-stickers (conj (remove #(= hash %) (:stickers/recent-stickers multiaccount)) hash)} + :stickers/recent-stickers + (conj (remove #(= hash %) (:stickers/recent-stickers multiaccount)) hash) {}) (chat.input/send-sticker-fx sticker current-chat-id)))) @@ -1543,4 +1540,4 @@ (handlers/register-handler-fx :gfycat-generated (fn [{:keys [db]} [_ path gfycat]] - {:db (assoc-in db path gfycat)})) \ No newline at end of file + {:db (assoc-in db path gfycat)})) diff --git a/src/status_im/fleet/core.cljs b/src/status_im/fleet/core.cljs index ad4a0534a9..71e1a31362 100644 --- a/src/status_im/fleet/core.cljs +++ b/src/status_im/fleet/core.cljs @@ -8,8 +8,9 @@ [status-im.utils.types :as types] [status-im.utils.fx :as fx])) -(defn current-fleet-sub [settings] - (keyword (or (get settings :fleet) +(defn current-fleet-sub + [multiaccount] + (keyword (or (get multiaccount :fleet) config/fleet))) (defn format-mailserver @@ -69,15 +70,12 @@ (fx/defn save [{:keys [db now] :as cofx} fleet] - (let [settings (get-in db [:multiaccount :settings]) - new-settings (if fleet - (assoc settings :fleet fleet) - (dissoc settings :fleet))] - (fx/merge cofx - (multiaccounts.update/update-settings new-settings {}) - (node/prepare-new-config - {:on-success - #(when (not= fleet - (:fleet settings)) - (re-frame/dispatch - [:multiaccounts.update.callback/save-settings-success]))})))) + (let [old-fleet (get-in db [:multiaccount :fleet])] + (when (not= fleet old-fleet) + (fx/merge + cofx + (multiaccounts.update/multiaccount-update :fleet fleet {}) + (node/prepare-new-config + {:on-success + #(re-frame/dispatch + [:multiaccounts.update.callback/save-settings-success])}))))) diff --git a/src/status_im/hardwallet/core.cljs b/src/status_im/hardwallet/core.cljs index ee30cb3e07..10e0fc58a8 100644 --- a/src/status_im/hardwallet/core.cljs +++ b/src/status_im/hardwallet/core.cljs @@ -163,11 +163,14 @@ (fx/defn remove-pairing-from-multiaccount [cofx {:keys [remove-instance-uid?]}] - (multiaccounts.update/multiaccount-update cofx - (cond-> {:keycard-pairing nil - :keycard-paired-on nil} - remove-instance-uid? (assoc :keycard-instance-uid nil)) - {})) + (fx/merge cofx + (multiaccounts.update/multiaccount-update + :keycard-pairing nil {}) + (multiaccounts.update/multiaccount-update + :keycard-paired-on nil {}) + (when remove-instance-uid? + (multiaccounts.update/multiaccount-update + :keycard-instance-uid nil {})))) (defn hardwallet-supported? [] (and config/hardwallet-enabled? @@ -1648,10 +1651,11 @@ (fx/defn set-multiaccount-pairing [{:keys [db] :as cofx} {:keys [address] :as multiaccount} pairing paired-on] - (multiaccounts.update/multiaccount-update cofx - {:keycard-pairing pairing - :keycard-paired-on paired-on} - {})) + (fx/merge cofx + (multiaccounts.update/multiaccount-update + :keycard-pairing pairing {}) + (multiaccounts.update/multiaccount-update + :keycard-paired-on paired-on {}))) (fx/defn on-retrieve-pairings-success {:events [:hardwallet.callback/on-retrieve-pairings-success]} @@ -1817,8 +1821,10 @@ public-key whisper-public-key wallet-public-key + wallet-root-public-key whisper-address wallet-address + wallet-root-address whisper-private-key encryption-public-key instance-uid @@ -1839,7 +1845,10 @@ (assoc-in [:hardwallet :setup-step] nil) (assoc :intro-wizard nil))} (multiaccounts.create/on-multiaccount-created - {:derived {constants/path-whisper-keyword + {:derived {constants/path-wallet-root-keyword + {:publicKey wallet-root-public-key + :address (eip55/address->checksum wallet-root-address)} + constants/path-whisper-keyword {:publicKey whisper-public-key :address (eip55/address->checksum whisper-address) :name name @@ -1848,7 +1857,7 @@ {:publicKey wallet-public-key :address (eip55/address->checksum wallet-address)}} :address address - :public-key public-key + :public-key public-key :keycard-instance-uid instance-uid :keyUid (ethereum/normalized-hex key-uid) :keycard-pairing pairing @@ -1884,9 +1893,11 @@ (update :address ethereum/normalized-hex) (update :whisper-address ethereum/normalized-hex) (update :wallet-address ethereum/normalized-hex) + (update :wallet-root-address ethereum/normalized-hex) (update :public-key ethereum/normalized-hex) (update :whisper-public-key ethereum/normalized-hex) (update :wallet-public-key ethereum/normalized-hex) + (update :wallet-root-public-key ethereum/normalized-hex) (update :instance-uid #(get-in db [:hardwallet :multiaccount :instance-uid] %)))) (assoc-in [:hardwallet :multiaccount-wallet-address] (:wallet-address account-data)) (assoc-in [:hardwallet :multiaccount-whisper-public-key] (:whisper-public-key account-data)) diff --git a/src/status_im/log_level/core.cljs b/src/status_im/log_level/core.cljs index b921458bf5..267b55e1fd 100644 --- a/src/status_im/log_level/core.cljs +++ b/src/status_im/log_level/core.cljs @@ -8,24 +8,25 @@ (fx/defn save-log-level [{:keys [db now] :as cofx} log-level] - (let [settings (get-in db [:multiaccount :settings]) - new-settings (if log-level - (assoc settings :log-level log-level) - (dissoc settings :log-level))] - (fx/merge cofx - (multiaccounts.update/update-settings new-settings {}) - (node/prepare-new-config {:on-success #(when (not= (node/get-log-level settings) - (node/get-log-level new-settings)) - (re-frame/dispatch [:logout]))})))) + (let [old-log-level (get-in db [:multiaccount :log-level])] + (when (not= old-log-level log-level) + (fx/merge cofx + (multiaccounts.update/multiaccount-update + :log-level log-level + {}) + (node/prepare-new-config + {:on-success #(re-frame/dispatch [:logout])}))))) (fx/defn show-change-log-level-confirmation [{:keys [db]} {:keys [name value] :as log-level}] - {:ui/show-confirmation {:title (i18n/label :t/close-app-title) - :content (i18n/label :t/change-log-level - {:log-level name}) - :confirm-button-text (i18n/label :t/close-app-button) - :on-accept #(re-frame/dispatch [:log-level.ui/change-log-level-confirmed value]) - :on-cancel nil}}) + {:ui/show-confirmation + {:title (i18n/label :t/close-app-title) + :content (i18n/label :t/change-log-level + {:log-level name}) + :confirm-button-text (i18n/label :t/close-app-button) + :on-accept #(re-frame/dispatch + [:log-level.ui/change-log-level-confirmed value]) + :on-cancel nil}}) (fx/defn show-logging-enabled-confirmation [{:keys [db]} enabled] @@ -37,10 +38,13 @@ :on-accept #(re-frame/dispatch [:log-level.ui/logging-enabled-confirmed enabled]) :on-cancel nil}}) -(fx/defn save-logging-enabled - [{:keys [db] :as cofx} enabled] - (.setValue rn-dependencies/desktop-config "logging_enabled" enabled) - (let [settings (get-in db [:multiaccount :settings])] - (multiaccounts.update/update-settings (assoc-in cofx [:db :desktop/desktop :logging-enabled] enabled) - (if enabled (assoc settings :log-level "INFO") (dissoc settings :log-level)) - {:success-event [:multiaccounts.update.callback/save-settings-success]}))) +;;FIXME ignored until desktop is fixed +#_(fx/defn save-logging-enabled + [{:keys [db] :as cofx} enabled] + (.setValue rn-dependencies/desktop-config "logging_enabled" enabled) + (fx/merge + cofx + {:db (assoc-in db [:desktop/desktop :logging-enabled] enabled)} + (multiaccounts.update/multiaccount-update + {:log-level (when enabled "INFO")} + {:success-event [:multiaccounts.update.callback/save-settings-success]}))) diff --git a/src/status_im/mailserver/core.cljs b/src/status_im/mailserver/core.cljs index 3a8835087f..2589e5f0ce 100644 --- a/src/status_im/mailserver/core.cljs +++ b/src/status_im/mailserver/core.cljs @@ -58,7 +58,7 @@ (fetch db (:mailserver/current-id db))) (defn preferred-mailserver-id [db] - (get-in db [:multiaccount :settings :mailserver (node/current-fleet-key db)])) + (get-in db [:multiaccount :pinned-mailservers (node/current-fleet-key db)])) (defn mailserver-address->id [db address] (let [current-fleet (node/current-fleet-key db)] @@ -1126,25 +1126,27 @@ (fx/defn save-settings [{:keys [db] :as cofx} current-fleet mailserver-id] (let [{:keys [address]} (fetch-current db) - settings (get-in db [:multiaccount :settings]) + pinned-mailservers (get-in db [:multiaccount :pinned-mailservers]) ;; Check if previous mailserver was pinned - pinned? (get-in settings [:mailserver current-fleet])] + pinned? (get pinned-mailservers current-fleet)] (fx/merge cofx {:db (assoc db :mailserver/current-id mailserver-id) :mailserver/remove-peer address} (connect-to-mailserver) (when pinned? - (multiaccounts.update/update-settings - (assoc-in settings [:mailserver current-fleet] mailserver-id) + (multiaccounts.update/multiaccount-update + :pinned-mailservers (assoc pinned-mailservers + current-fleet + mailserver-id) {}))))) (fx/defn unpin [{:keys [db] :as cofx}] (let [current-fleet (node/current-fleet-key db) - settings (get-in db [:multiaccount :settings])] + pinned-mailservers (get-in db [:multiaccount :pinned-mailservers])] (fx/merge cofx - (multiaccounts.update/update-settings - (update settings :mailserver dissoc current-fleet) + (multiaccounts.update/multiaccount-update + :pinned-mailservers (dissoc pinned-mailservers current-fleet) {}) (change-mailserver)))) @@ -1152,11 +1154,13 @@ [{:keys [db] :as cofx}] (let [current-fleet (node/current-fleet-key db) mailserver-id (:mailserver/current-id db) - settings (get-in db [:multiaccount :settings])] - (fx/merge cofx - (multiaccounts.update/update-settings - (assoc-in settings [:mailserver current-fleet] mailserver-id) - {})))) + pinned-mailservers (get-in db [:multiaccount :pinned-mailservers])] + (multiaccounts.update/multiaccount-update + cofx + :pinned-mailservers (assoc pinned-mailservers + current-fleet + mailserver-id) + {}))) (fx/defn load-gaps-fx [{:keys [db] :as cofx} chat-id] (when-not (get-in db [:chats chat-id :gaps-loaded?]) diff --git a/src/status_im/multiaccounts/core.cljs b/src/status_im/multiaccounts/core.cljs index 00ccb2eeb7..ac383b3159 100644 --- a/src/status_im/multiaccounts/core.cljs +++ b/src/status_im/multiaccounts/core.cljs @@ -51,17 +51,17 @@ (fx/defn confirm-wallet-set-up [cofx] (multiaccounts.update/multiaccount-update cofx - {:wallet-set-up-passed? true} {})) + :wallet-set-up-passed? true {})) (fx/defn confirm-home-tooltip [cofx] (multiaccounts.update/multiaccount-update cofx - {:hide-home-tooltip? true} {})) + :hide-home-tooltip? true {})) (fx/defn switch-dev-mode [cofx dev-mode?] (multiaccounts.update/multiaccount-update cofx - {:dev-mode? dev-mode?} + :dev-mode? dev-mode? {})) (fx/defn switch-notifications @@ -72,7 +72,7 @@ ::notifications/enable ::notifications/disable) nil} (multiaccounts.update/multiaccount-update - {:notifications-enabled? notifications-enabled?} + :notifications-enabled? (boolean notifications-enabled?) {}))) (fx/defn switch-chaos-mode @@ -81,25 +81,24 @@ (fx/merge cofx {::chaos-mode-changed chaos-mode?} (multiaccounts.update/multiaccount-update - {:chaos-mode? chaos-mode?} + :chaos-mode? (boolean chaos-mode?) {})))) (fx/defn enable-notifications [cofx desktop-notifications?] (multiaccounts.update/multiaccount-update cofx - {:desktop-notifications? desktop-notifications?} + :desktop-notifications? desktop-notifications? {})) (fx/defn switch-preview-privacy-mode [{:keys [db] :as cofx} private?] - (let [settings (get-in db [:multiaccount :settings])] - (fx/merge cofx - {::blank-preview-flag-changed private?} - (multiaccounts.update/update-settings - (assoc settings :preview-privacy? private?) - {})))) + (fx/merge cofx + {::blank-preview-flag-changed private?} + (multiaccounts.update/multiaccount-update + :preview-privacy? (boolean private?) + {}))) (fx/defn switch-preview-privacy-mode-flag [{:keys [db]}] - (let [private? (get-in db [:multiaccount :settings :preview-privacy?])] + (let [private? (get-in db [:multiaccount :preview-privacy?])] {::blank-preview-flag-changed private?})) diff --git a/src/status_im/multiaccounts/create/core.cljs b/src/status_im/multiaccounts/create/core.cljs index 5488a74ab5..b84a936cbc 100644 --- a/src/status_im/multiaccounts/create/core.cljs +++ b/src/status_im/multiaccounts/create/core.cljs @@ -2,6 +2,7 @@ (:require [clojure.set :refer [map-invert]] [re-frame.core :as re-frame] [status-im.constants :as constants] + [status-im.data-store.settings :as data-store.settings] [status-im.ethereum.core :as ethereum] [status-im.ethereum.eip55 :as eip55] [taoensso.timbre :as log] @@ -208,17 +209,19 @@ :chat true})]) (fx/defn save-account-and-login-with-keycard - [_ multiaccount-data password node-config accounts-data chat-key] + [_ multiaccount-data password settings node-config accounts-data chat-key] {::save-account-and-login-with-keycard [(types/clj->json multiaccount-data) password + (types/clj->json settings) node-config (types/clj->json accounts-data) chat-key]}) (fx/defn save-account-and-login - [_ multiaccount-data password node-config accounts-data] + [_ multiaccount-data password settings node-config accounts-data] {::save-account-and-login [(types/clj->json multiaccount-data) password + (types/clj->json settings) node-config (types/clj->json accounts-data)]}) @@ -233,32 +236,43 @@ multiaccount-data {:name name :address address :photo-path photo-path - :key-uid keyUid} + :key-uid keyUid + :keycard-pairing keycard-pairing} keycard-multiaccount? (boolean keycard-pairing) - new-multiaccount (cond-> {;; address of the master key - :address address - ;; sha256 of master public key - :key-uid keyUid - ;; The address from which we derive any wallet - :wallet-root-address (get-in multiaccount [:derived constants/path-wallet-root-keyword :address]) - ;; The address from which we derive any chat account/encryption keys - :eip1581-address (get-in multiaccount [:derived constants/path-eip1581-keyword :address]) - :name name - :photo-path photo-path - ;; public key of the chat account - :public-key public-key - ;; default address for Dapps - :dapps-address (:address wallet-account) - :latest-derived-path 0 - :signing-phrase signing-phrase - :installation-id (random-guid-generator) - :settings constants/default-multiaccount-settings} - save-mnemonic? - (assoc :mnemonic mnemonic) - keycard-multiaccount? - (assoc :keycard-instance-uid keycard-instance-uid - :keycard-pairing keycard-pairing - :keycard-paired-on keycard-paired-on)) + eip1581-address (get-in multiaccount [:derived + constants/path-eip1581-keyword + :address]) + new-multiaccount + (cond-> (merge + {;; address of the master key + :address address + ;; sha256 of master public key + :key-uid keyUid + ;; The address from which we derive any wallet + :wallet-root-address + (get-in multiaccount [:derived + constants/path-wallet-root-keyword + :address]) + :name name + :photo-path photo-path + ;; public key of the chat account + :public-key public-key + ;; default address for Dapps + :dapps-address (:address wallet-account) + :latest-derived-path 0 + :signing-phrase signing-phrase + :installation-id (random-guid-generator)} + constants/default-multiaccount) + ;; The address from which we derive any chat + ;; account/encryption keys + eip1581-address + (assoc :eip1581-address eip1581-address) + save-mnemonic? + (assoc :mnemonic mnemonic) + keycard-multiaccount? + (assoc :keycard-instance-uid keycard-instance-uid + :keycard-pairing keycard-pairing + :keycard-paired-on keycard-paired-on)) db (assoc db :multiaccounts/login {:key-uid keyUid :name name @@ -269,17 +283,22 @@ :multiaccount new-multiaccount :multiaccount/accounts [wallet-account] :networks/current-network constants/default-network - :networks/networks constants/default-networks)] + :networks/networks (data-store.settings/rpc->networks constants/default-networks)) + settings (assoc new-multiaccount + :networks/current-network constants/default-network + :networks/networks constants/default-networks)] (fx/merge cofx {:db db} (if keycard-multiaccount? - (save-account-and-login-with-keycard new-multiaccount + (save-account-and-login-with-keycard multiaccount-data password + settings (node/get-new-config db) accounts-data chat-key) (save-account-and-login multiaccount-data (ethereum/sha3 (security/safe-unmask-data password)) + settings (node/get-new-config db) accounts-data)) (when (:intro-wizard db) @@ -377,16 +396,18 @@ (re-frame/reg-fx ::save-account-and-login - (fn [[multiaccount-data hashed-password config accounts-data]] + (fn [[multiaccount-data hashed-password settings config accounts-data]] (status/save-account-and-login multiaccount-data hashed-password + settings config accounts-data))) (re-frame/reg-fx ::save-account-and-login-with-keycard - (fn [[multiaccount-data password config accounts-data chat-key]] + (fn [[multiaccount-data password settings config accounts-data chat-key]] (status/save-account-and-login-with-keycard multiaccount-data (security/safe-unmask-data password) + settings config accounts-data chat-key))) diff --git a/src/status_im/multiaccounts/db.cljs b/src/status_im/multiaccounts/db.cljs index 886952096f..70df61ae9a 100644 --- a/src/status_im/multiaccounts/db.cljs +++ b/src/status_im/multiaccounts/db.cljs @@ -43,7 +43,6 @@ (spec/def :multiaccount/chaos-mode? (spec/nilable boolean?)) (spec/def :multiaccount/bootnodes (spec/nilable :bootnodes/bootnodes)) (spec/def :multiaccount/mailserver (spec/nilable string?)) -(spec/def :multiaccount/settings (spec/nilable (spec/map-of keyword? any?))) (spec/def :multiaccount/signing-phrase :global/not-empty-string) (spec/def :multiaccount/mnemonic (spec/nilable string?)) (spec/def :multiaccount/sharing-usage-data? (spec/nilable boolean?)) @@ -63,7 +62,7 @@ :multiaccount/installation-id :multiaccount/debug? :multiaccount/last-updated :multiaccount/public-key :multiaccount/email :multiaccount/signed-up? - :multiaccount/settings :multiaccount/mailserver + :multiaccount/mailserver :multiaccount/sharing-usage-data? :multiaccount/mnemonic :multiaccount/desktop-notifications? :multiaccount/chaos-mode? diff --git a/src/status_im/multiaccounts/login/core.cljs b/src/status_im/multiaccounts/login/core.cljs index 15b0600812..2e0e244fd9 100644 --- a/src/status_im/multiaccounts/login/core.cljs +++ b/src/status_im/multiaccounts/login/core.cljs @@ -34,7 +34,8 @@ [status-im.ethereum.eip55 :as eip55] [status-im.popover.core :as popover] [status-im.hardwallet.nfc :as nfc] - [status-im.multiaccounts.core :as multiaccounts])) + [status-im.multiaccounts.core :as multiaccounts] + [status-im.data-store.settings :as data-store.settings])) (def rpc-endpoint "https://goerli.infura.io/v3/f315575765b14720b32382a61a89341a") (def contract-address "0xfbf4c8e2B41fAfF8c616a0E49Fb4365a5355Ffaf") @@ -163,13 +164,6 @@ current-network (types/deserialize networks)]) -(defn convert-multiaccount-addresses - [multiaccount] - (let [update-address #(update % :address eip55/address->checksum)] - (-> multiaccount - update-address - (update :accounts (partial mapv update-address))))) - (re-frame/reg-fx ;;TODO: this could be replaced by a single API call on status-go side ::initialize-wallet @@ -191,18 +185,19 @@ (.catch (fn [error] (log/error "Failed to initialize wallet")))))) -(fx/defn get-config-callback - {:events [::get-config-callback]} - [{:keys [db] :as cofx} config] - (let [[{:keys [address notifications-enabled?] :as multiaccount} - current-network networks] (deserialize-config config) +(fx/defn get-settings-callback + {:events [::get-settings-callback]} + [{:keys [db] :as cofx} settings] + (let [{:keys [address notifications-enabled? + networks/current-network networks/networks] :as settings} + (data-store.settings/rpc->settings settings) + multiaccount (dissoc settings :networks/current-network :networks/networks) network-id (str (get-in networks [current-network :config :NetworkId]))] (fx/merge cofx (cond-> {:db (assoc db :networks/current-network current-network :networks/networks networks - :multiaccount (convert-multiaccount-addresses - multiaccount))} + :multiaccount multiaccount)} (and platform/android? notifications-enabled?) (assoc ::notifications/enable nil) @@ -252,9 +247,8 @@ :on-success #(re-frame/dispatch [::initialize-dapp-permissions %])} {:method "mailservers_getMailservers" :on-success #(re-frame/dispatch [::protocol/initialize-protocol {:mailservers (or % [])}])} - {:method "settings_getConfigs" - :params [["multiaccount" "current-network" "networks"]] - :on-success #(re-frame/dispatch [::get-config-callback %])}]} + {:method "settings_getSettings" + :on-success #(re-frame/dispatch [::get-settings-callback %])}]} (when save-password? (keychain/save-user-password key-uid password)) (keychain/save-auth-method key-uid (or new-auth-method auth-method)) @@ -264,8 +258,7 @@ (fx/defn create-only-events [{:keys [db] :as cofx}] - (let [{:keys [multiaccount :multiaccount/accounts - :networks/networks :networks/current-network]} db] + (let [{:keys [multiaccount :multiaccount/accounts]} db] (fx/merge cofx {:db (assoc db ;;NOTE when login the filters are initialized twice @@ -275,20 +268,8 @@ ;;later on there is a check that filters have been initialized twice ;;so here we set it at 1 already so that it passes the check once it has ;;been initialized - :filters/initialized 1 - :network constants/default-network - :networks/networks constants/default-networks) - :filters/load-filters [] - ::json-rpc/call - [{:method "settings_saveConfig" - :params ["multiaccount" (types/serialize multiaccount)] - :on-success #()} - {:method "settings_saveConfig" - :params ["networks" (types/serialize networks)] - :on-success #()} - {:method "settings_saveConfig" - :params ["current-network" current-network] - :on-success #()}]} + :filters/initialized 1) + :filters/load-filters []} (finish-keycard-setup) (protocol/initialize-protocol {:mailservers [] :mailserver-ranges {} diff --git a/src/status_im/multiaccounts/update/core.cljs b/src/status_im/multiaccounts/update/core.cljs index ea8fd89f8b..49e7e7d0bf 100644 --- a/src/status_im/multiaccounts/update/core.cljs +++ b/src/status_im/multiaccounts/update/core.cljs @@ -43,44 +43,27 @@ "Takes effects (containing :db) + new multiaccount fields, adds all effects necessary for multiaccount update. Optionally, one can specify a success-event to be dispatched after fields are persisted." [{:keys [db] :as cofx} - new-multiaccount-fields + setting setting-value {:keys [on-success] :or {on-success #()}}] - (let [current-multiaccount (:multiaccount db) - new-multiaccount (merge current-multiaccount new-multiaccount-fields) - fx {:db (assoc db :multiaccount new-multiaccount) - ::json-rpc/call - [{:method "settings_saveConfig" - :params ["multiaccount" (types/serialize new-multiaccount)] - :on-success on-success}]} - {:keys [name photo-path prefered-name]} new-multiaccount-fields] + (let [current-multiaccount (:multiaccount db)] (if (empty? current-multiaccount) ;; NOTE: this should never happen, but if it does this is a critical error ;; and it is better to crash than risk having an unstable state (throw (js/Error. "Please shake the phone to report this error and restart the app. multiaccount is currently empty, which means something went wrong when trying to update it with")) - (if (or name photo-path prefered-name) - (fx/merge cofx - fx - (send-multiaccount-update)) - fx)))) + (fx/merge cofx + {:db (if setting-value + (assoc-in db [:multiaccount setting] setting-value) + (update db :multiaccount dissoc setting)) + ::json-rpc/call + [{:method "settings_saveSetting" + :params [setting setting-value] + :on-success on-success}]} + (when (#{:name :photo-path :prefered-name} setting) + (send-multiaccount-update)))))) (fx/defn clean-seed-phrase "A helper function that removes seed phrase from storage." [cofx] (multiaccount-update cofx - {:mnemonic nil} + :mnemonic nil {})) - -(fx/defn update-settings - [{{:keys [multiaccount] :as db} :db :as cofx} - settings - {:keys [on-success] :or {on-success #()}}] - (let [new-multiaccount (assoc multiaccount :settings settings)] - (if (empty? multiaccount) - ;; NOTE: this should never happen, but if it does this is a critical error - ;; and it is better to crash than risk having an unstable state - (throw (js/Error. "Please shake the phone to report this error and restart the app. multiaccount is currently empty, which means something went wrong when trying to update settings")) - {:db (assoc db :multiaccount new-multiaccount) - ::json-rpc/call - [{:method "settings_saveConfig" - :params ["multiaccount" (types/serialize new-multiaccount)] - :on-success on-success}]}))) diff --git a/src/status_im/native_module/core.cljs b/src/status_im/native_module/core.cljs index b5187f8f4e..b090edee8a 100644 --- a/src/status_im/native_module/core.cljs +++ b/src/status_im/native_module/core.cljs @@ -45,17 +45,19 @@ (defn save-account-and-login "NOTE: beware, the password has to be sha3 hashed" - [multiaccount-data hashed-password config accounts-data] + [multiaccount-data hashed-password settings config accounts-data] (log/debug "[native-module] save-account-and-login" "multiaccount-data" multiaccount-data) (clear-web-data) - (.saveAccountAndLogin (status) multiaccount-data hashed-password config accounts-data)) + (.saveAccountAndLogin + (status) multiaccount-data hashed-password settings config accounts-data)) (defn save-account-and-login-with-keycard "NOTE: chat-key is a whisper private key sent from keycard" - [multiaccount-data password config accounts-data chat-key] + [multiaccount-data password settings config accounts-data chat-key] (log/debug "[native-module] save-account-and-login-with-keycard") - (.saveAccountAndLoginWithKeycard (status) multiaccount-data password config accounts-data chat-key)) + (.saveAccountAndLoginWithKeycard + (status) multiaccount-data password settings config accounts-data chat-key)) (defn login "NOTE: beware, the password has to be sha3 hashed" diff --git a/src/status_im/network/core.cljs b/src/status_im/network/core.cljs index ee55184029..7b42ae8a67 100644 --- a/src/status_im/network/core.cljs +++ b/src/status_im/network/core.cljs @@ -136,8 +136,8 @@ [{:keys [db] :as cofx} network] (fx/merge cofx {:db (assoc db :networks/current-network network) - ::json-rpc/call [{:method "settings_saveConfig" - :params ["current-network" network] + ::json-rpc/call [{:method "settings_saveSetting" + :params [:networks/current-network network] :on-success #()}]} (node/prepare-new-config {:on-success #(re-frame/dispatch [:logout])}))) @@ -146,8 +146,8 @@ [{:keys [db] :as cofx} network] (let [networks (dissoc (:networks/networks db) network)] {:db (assoc db :networks/networks networks) - ::json-rpc/call [{:method "settings_saveConfig" - :params ["networks" (types/serialize networks)] + ::json-rpc/call [{:method "settings_saveSetting" + :params [:networks/networks (vals networks)] :on-success #(re-frame/dispatch [:navigate-back])}]})) (defn new-network @@ -183,8 +183,8 @@ {:db (-> db (dissoc :networks/manage) (assoc :networks/networks new-networks)) - ::json-rpc/call [{:method "settings_saveConfig" - :params ["networks" (types/serialize new-networks)] + ::json-rpc/call [{:method "settings_saveSetting" + :params [:networks/networks (vals new-networks)] :on-success #(re-frame/dispatch [:navigate-back])}]} {:ui/show-error "chain-id already defined"})) {:ui/show-error "invalid network parameters"})) @@ -192,4 +192,4 @@ (fx/defn open-network-details {:events [::network-entry-pressed]} [cofx network] - (navigation/navigate-to-cofx cofx :network-details {:networks/selected-network network})) \ No newline at end of file + (navigation/navigate-to-cofx cofx :network-details {:networks/selected-network network})) diff --git a/src/status_im/node/core.cljs b/src/status_im/node/core.cljs index 0d36875193..f5ab40193f 100644 --- a/src/status_im/node/core.cljs +++ b/src/status_im/node/core.cljs @@ -84,7 +84,7 @@ (reduce merge $))) (defn current-fleet-key [db] - (keyword (get-in db [:multiaccount :settings :fleet] + (keyword (get-in db [:multiaccount :fleet] config/fleet))) (defn get-current-fleet @@ -94,16 +94,13 @@ (defn- get-multiaccount-node-config [{:keys [multiaccount :networks/networks :networks/current-network] - :or {current-network config/default-network - networks constants/default-networks} :as db}] (let [current-fleet-key (current-fleet-key db) current-fleet (get-current-fleet db) rendezvous-nodes (pick-nodes 3 (vals (:rendezvous current-fleet))) - {:keys [installation-id settings bootnodes] - :or {settings constants/default-multiaccount-settings}} multiaccount - use-custom-bootnodes (get-in settings [:bootnodes current-network]) - log-level (get-log-level settings)] + {:keys [installation-id log-level + custom-bootnodes custom-bootnodes-enabled?]} multiaccount + use-custom-bootnodes (get custom-bootnodes-enabled? current-network)] (cond-> (get-in networks [current-network :config]) :always (get-base-node-config) @@ -145,7 +142,7 @@ (and config/bootnodes-settings-enabled? use-custom-bootnodes) - (add-custom-bootnodes current-network bootnodes) + (add-custom-bootnodes current-network custom-bootnodes) :always (add-log-level log-level)))) @@ -162,8 +159,8 @@ app-db" {:events [::save-new-config]} [{:keys [db]} config {:keys [on-success]}] - {::json-rpc/call [{:method "settings_saveNodeConfig" - :params [config] + {::json-rpc/call [{:method "settings_saveSetting" + :params [:node-config config] :on-success on-success}]}) (fx/defn prepare-new-config diff --git a/src/status_im/pairing/core.cljs b/src/status_im/pairing/core.cljs index 53fab56ea1..f36c750eb8 100644 --- a/src/status_im/pairing/core.cljs +++ b/src/status_im/pairing/core.cljs @@ -8,6 +8,7 @@ [status-im.ethereum.json-rpc :as json-rpc] [status-im.i18n :as i18n] [status-im.multiaccounts.model :as multiaccounts.model] + [status-im.multiaccounts.update.core :as multiaccounts.update] [status-im.transport.message.pairing :as transport.pairing] [status-im.transport.message.protocol :as protocol] [status-im.ui.screens.navigation :as navigation] @@ -319,21 +320,38 @@ [{:keys [db] :as cofx} {:keys [contacts account chat]} sender] (let [confirmation (:metadata cofx)] (when (= sender (multiaccounts.model/current-public-key cofx)) - (let [on-success #(log/debug "handled sync installation successfully") - new-contacts (when (seq contacts) + (let [new-contacts (when (seq contacts) (vals (merge-contacts (:contacts/contacts db) ((comp ensure-photo-path ensure-system-tags) contacts)))) - new-multiaccount (merge-multiaccount (:multiaccount db) account) - contacts-fx (when new-contacts (mapv contact/upsert-contact new-contacts))] + {old-name :name + old-photo-path :photo-path + old-last-updated :last-updated + :as multiaccount} (:multiaccount db) + {:keys [name photo-path last-updated]} + (merge-multiaccount multiaccount account) + contacts-fx (when new-contacts + (mapv contact/upsert-contact new-contacts))] (apply fx/merge cofx (concat - [{:db (assoc db :multiaccount new-multiaccount) + [{:db (-> db + (assoc-in [:multiaccount :name] name) + (assoc-in [:multiaccount :last-updated] last-updated) + (assoc-in [:multiaccount :photo-path] photo-path)) ::json-rpc/call - [{:method "settings_saveConfig" - :params ["multiaccount" (types/serialize new-multiaccount)] - :on-success on-success}]} + [(when (not= old-name name) + {:method "settings_saveConfig" + :params [:name name] + :on-success #(log/debug "handled sync of name field successfully")}) + (when (not= old-photo-path photo-path) + {:method "settings_saveConfig" + :params [:photo-path photo-path] + :on-success #(log/debug "handled sync of photo-path field successfully")}) + (when (not= old-last-updated last-updated) + {:method "settings_saveConfig" + :params [:last-updated last-updated] + :on-success #(log/debug "handled sync of last-updated field successfully")})]} #(when (:public? chat) (models.chat/start-public-chat % (:chat-id chat) {:dont-navigate? true}))] contacts-fx)))))) diff --git a/src/status_im/stickers/core.cljs b/src/status_im/stickers/core.cljs index ac1c17a590..b1b0368688 100644 --- a/src/status_im/stickers/core.cljs +++ b/src/status_im/stickers/core.cljs @@ -101,7 +101,8 @@ (assoc-in [:stickers/packs-installed id] pack))} ;;(assoc :stickers/selected-pack id))} TODO it doesn't scroll to selected pack on Android (multiaccounts.update/multiaccount-update - {:stickers/packs-installed (assoc (:stickers/packs-installed multiaccount) id pack)} + :stickers/packs-installed + (assoc (:stickers/packs-installed multiaccount) id pack) {})))) (defn valid-sticker? [sticker] diff --git a/src/status_im/subs.cljs b/src/status_im/subs.cljs index 376e695b6c..034dd24d5d 100644 --- a/src/status_im/subs.cljs +++ b/src/status_im/subs.cljs @@ -271,11 +271,12 @@ (fn [[intro-wizard multiaccounts]] (recover/existing-account? (:root-key intro-wizard) multiaccounts))) -(re-frame/reg-sub - :settings/logging-enabled - :<- [:desktop/desktop] - (fn [desktop _] - (get desktop :logging-enabled false))) +;;FIXME not needed until desktop enabled +#_(re-frame/reg-sub + :settings/logging-enabled + :<- [:desktop/desktop] + (fn [desktop _] + (get desktop :logging-enabled false))) (re-frame/reg-sub :current-network @@ -457,28 +458,16 @@ (security/safe-unmask-data password)))) (re-frame/reg-sub - :settings/current-fleet - :<- [:multiaccount-settings] - (fn [sett] - (fleet/current-fleet-sub sett))) - -(re-frame/reg-sub - :multiaccount-settings + :fleets/current-fleet :<- [:multiaccount] - (fn [acc] - (get acc :settings))) + (fn [multiaccount] + (fleet/current-fleet-sub multiaccount))) (re-frame/reg-sub - :multiaccount/address + :log-level/current-log-level :<- [:multiaccount] - (fn [acc] - (get acc :address))) - -(re-frame/reg-sub - :settings/current-log-level - :<- [:multiaccount-settings] - (fn [sett] - (or (get sett :log-level) + (fn [multiaccount] + (or (get multiaccount :log-level) config/log-level-status-go))) (re-frame/reg-sub @@ -893,18 +882,18 @@ ;;BOOTNODES ============================================================================================================ (re-frame/reg-sub - :settings/bootnodes-enabled + :custom-bootnodes/enabled? :<- [:multiaccount] :<- [:networks/current-network] - (fn [[{:keys [settings]} current-network]] - (get-in settings [:bootnodes current-network]))) + (fn [[{:keys [custom-bootnodes-enabled?]} current-network]] + (get custom-bootnodes-enabled? current-network))) (re-frame/reg-sub - :settings/network-bootnodes + :custom-bootnodes/network-bootnodes :<- [:multiaccount] :<- [:networks/current-network] (fn [[multiaccount current-network]] - (get-in multiaccount [:bootnodes current-network]))) + (get-in multiaccount [:custom-bootnodes current-network]))) (re-frame/reg-sub :get-manage-bootnode @@ -1078,9 +1067,9 @@ (re-frame/reg-sub :wallet.settings/currency - :<- [:multiaccount-settings] + :<- [:multiaccount] (fn [settings] - (or (get-in settings [:wallet :currency]) :usd))) + (or (get settings :currency) :usd))) (defn- get-balance-total-value [balance prices currency token->decimals] @@ -1162,7 +1151,7 @@ :<- [:ethereum/chain-keyword] :<- [:multiaccount] (fn [[chain current-multiaccount]] - (get-in current-multiaccount [:settings :wallet :visible-tokens chain]))) + (get-in current-multiaccount [:wallet/visible-tokens chain]))) (re-frame/reg-sub :wallet/visible-assets @@ -1705,7 +1694,7 @@ (re-frame/reg-sub :mailserver/fleet-mailservers - :<- [:settings/current-fleet] + :<- [:fleets/current-fleet] :<- [:mailserver/mailservers] (fn [[current-fleet mailservers]] (current-fleet mailservers))) @@ -1738,9 +1727,10 @@ (re-frame/reg-sub :mailserver/preferred-id - :<- [:multiaccount-settings] - (fn [settings] - (get-in settings [:mailserver (fleet/current-fleet-sub settings)]))) + :<- [:multiaccount] + (fn [multiaccount] + (get-in multiaccount + [:pinned-mailservers (fleet/current-fleet-sub multiaccount)]))) ;;SEARCH ============================================================================================================== @@ -1779,10 +1769,10 @@ ;; TRIBUTE TO TALK (re-frame/reg-sub :tribute-to-talk/settings - :<- [:multiaccount-settings] + :<- [:multiaccount] :<- [:ethereum/chain-keyword] - (fn [[settings chain-keyword]] - (get-in settings [:tribute-to-talk chain-keyword]))) + (fn [[multiaccount chain-keyword]] + (get-in multiaccount [:tribute-to-talk]) chain-keyword)) (re-frame/reg-sub :tribute-to-talk/screen-params @@ -2062,14 +2052,14 @@ (defn- label-networks [default-networks] (fn [network] - (let [custom? (not (contains? default-networks (:id network)))] + (let [custom? (not (default-networks (:id network)))] (assoc network :custom? custom?)))) (re-frame/reg-sub :get-networks :<- [:networks/networks] (fn [networks] - (let [networks (map (label-networks constants/default-networks) (sort-by :name (vals networks))) + (let [networks (map (label-networks (into #{} (map :id constants/default-networks))) (sort-by :name (vals networks))) types [:mainnet :testnet :custom]] (zipmap types diff --git a/src/status_im/tribute_to_talk/core.cljs b/src/status_im/tribute_to_talk/core.cljs index b602e49689..90da1578b0 100644 --- a/src/status_im/tribute_to_talk/core.cljs +++ b/src/status_im/tribute_to_talk/core.cljs @@ -29,24 +29,25 @@ (fx/defn update-settings [{:keys [db] :as cofx} {:keys [snt-amount message update] :as new-settings}] - (let [multiaccount-settings (get-in db [:multiaccount :settings]) + (let [tribute-to-talk-settings (get-in db [:multiaccount :tribute-to-talk]) chain-keyword (ethereum/chain-keyword db) - tribute-to-talk-settings (cond-> (merge (tribute-to-talk.db/get-settings db) - new-settings) - new-settings - (assoc :seen? true) + tribute-to-talk-chain-settings + (cond-> (merge (tribute-to-talk.db/get-settings db) + new-settings) + new-settings + (assoc :seen? true) - (not new-settings) - (dissoc :snt-amount :manifest) + (not new-settings) + (dissoc :snt-amount :manifest) - (and (contains? new-settings :update) - (nil? update)) - (dissoc :update))] + (and (contains? new-settings :update) + (nil? update)) + (dissoc :update))] (fx/merge cofx - (multiaccounts.update/update-settings - (-> multiaccount-settings - (assoc-in [:tribute-to-talk chain-keyword] - tribute-to-talk-settings)) + (multiaccounts.update/multiaccount-update + :tribute-to-talk (assoc tribute-to-talk-settings + chain-keyword + tribute-to-talk-chain-settings) {}) (whitelist/enable-whitelist)))) diff --git a/src/status_im/tribute_to_talk/db.cljs b/src/status_im/tribute_to_talk/db.cljs index 5ea8fd1511..f8ec6900a9 100644 --- a/src/status_im/tribute_to_talk/db.cljs +++ b/src/status_im/tribute_to_talk/db.cljs @@ -51,7 +51,7 @@ (defn get-settings [db] (let [chain-keyword (ethereum/chain-keyword db)] - (get-in db [:multiaccount :settings :tribute-to-talk chain-keyword]))) + (get-in db [:multiaccount :tribute-to-talk chain-keyword]))) (defn enabled? [settings] diff --git a/src/status_im/ui/screens/advanced_settings/views.cljs b/src/status_im/ui/screens/advanced_settings/views.cljs index 2b9d61d6d7..ade98b1aab 100644 --- a/src/status_im/ui/screens/advanced_settings/views.cljs +++ b/src/status_im/ui/screens/advanced_settings/views.cljs @@ -89,8 +89,8 @@ (views/defview advanced-settings [] (views/letsubs [{:keys [chaos-mode?]} [:multiaccount] network-name [:network-name] - current-log-level [:settings/current-log-level] - current-fleet [:settings/current-fleet]] + current-log-level [:log-level/current-log-level] + current-fleet [:fleets/current-fleet]] [react/view {:flex 1 :background-color colors/white} [topbar/topbar {:title :t/advanced}] [list/flat-list diff --git a/src/status_im/ui/screens/bootnodes_settings/views.cljs b/src/status_im/ui/screens/bootnodes_settings/views.cljs index 9b519d3bee..3ee1091886 100644 --- a/src/status_im/ui/screens/bootnodes_settings/views.cljs +++ b/src/status_im/ui/screens/bootnodes_settings/views.cljs @@ -20,8 +20,8 @@ name]]]]) (views/defview bootnodes-settings [] - (views/letsubs [bootnodes-enabled [:settings/bootnodes-enabled] - bootnodes [:settings/network-bootnodes]] + (views/letsubs [bootnodes-enabled [:custom-bootnodes/enabled?] + bootnodes [:custom-bootnodes/network-bootnodes]] [react/view {:flex 1} [topbar/topbar {:title :t/bootnodes-settings :accessories [{:icon :main-icons/add diff --git a/src/status_im/ui/screens/currency_settings/models.cljs b/src/status_im/ui/screens/currency_settings/models.cljs index c82eb5da2d..40c549ce52 100644 --- a/src/status_im/ui/screens/currency_settings/models.cljs +++ b/src/status_im/ui/screens/currency_settings/models.cljs @@ -4,12 +4,12 @@ [status-im.wallet.core :as wallet])) (defn get-currency [db] - (or (get-in db [:multiaccount :settings :wallet :currency]) :usd)) + (get-in db [:multiaccount :currency] :usd)) (fx/defn set-currency [{:keys [db] :as cofx} currency] - (let [settings (get-in db [:multiaccount :settings]) - new-settings (assoc-in settings [:wallet :currency] currency)] - (fx/merge cofx - (multiaccounts.update/update-settings new-settings {}) - (wallet/update-prices)))) + (fx/merge cofx + (multiaccounts.update/multiaccount-update + :currency currency + {}) + (wallet/update-prices))) diff --git a/src/status_im/ui/screens/fleet_settings/views.cljs b/src/status_im/ui/screens/fleet_settings/views.cljs index 6d430514ba..e0391bd915 100644 --- a/src/status_im/ui/screens/fleet_settings/views.cljs +++ b/src/status_im/ui/screens/fleet_settings/views.cljs @@ -39,7 +39,7 @@ (views/defview fleet-settings [] (views/letsubs [custom-fleets [:fleets/custom-fleets] - current-fleet [:settings/current-fleet]] + current-fleet [:fleets/current-fleet]] [react/view {:flex 1} [topbar/topbar {:title :t/fleet-settings}] [react/view styles/wrapper diff --git a/src/status_im/ui/screens/log_level_settings/views.cljs b/src/status_im/ui/screens/log_level_settings/views.cljs index b4290b7624..343a4c52fe 100644 --- a/src/status_im/ui/screens/log_level_settings/views.cljs +++ b/src/status_im/ui/screens/log_level_settings/views.cljs @@ -46,7 +46,7 @@ :value "TRACE"}]) (views/defview log-level-settings [] - (views/letsubs [current-log-level [:settings/current-log-level]] + (views/letsubs [current-log-level [:log-level/current-log-level]] [react/view {:flex 1} [topbar/topbar {:title :t/log-level-settings}] [react/view styles/wrapper diff --git a/src/status_im/ui/screens/mobile_network_settings/events.cljs b/src/status_im/ui/screens/mobile_network_settings/events.cljs index 9c59cbee6b..720617e8cd 100644 --- a/src/status_im/ui/screens/mobile_network_settings/events.cljs +++ b/src/status_im/ui/screens/mobile_network_settings/events.cljs @@ -47,9 +47,9 @@ (fx/merge cofx (multiaccounts.update/multiaccount-update - {:syncing-on-mobile-network? sync? - :remember-syncing-choice? remember-choice?} - {}) + :syncing-on-mobile-network? (boolean sync?) {}) + (multiaccounts.update/multiaccount-update + :remember-syncing-choice? (boolean remember-choice?) {}) (bottom-sheet/hide-bottom-sheet) (when (and (utils/cellular? network) sync?) (mailserver/process-next-messages-request))))))) diff --git a/src/status_im/ui/screens/privacy_and_security_settings/views.cljs b/src/status_im/ui/screens/privacy_and_security_settings/views.cljs index 376fa590f0..b3ceadc6a4 100644 --- a/src/status_im/ui/screens/privacy_and_security_settings/views.cljs +++ b/src/status_im/ui/screens/privacy_and_security_settings/views.cljs @@ -12,7 +12,7 @@ [status-im.ui.components.topbar :as topbar]) (:require-macros [status-im.utils.views :as views])) -(defn- list-data [mnemonic settings supported-biometric-auth biometric-auth? keycard?] +(defn- list-data [mnemonic preview-privacy? supported-biometric-auth biometric-auth? keycard?] [{:type :section-header :title :t/security :container-margin-top 6} @@ -64,7 +64,7 @@ :accessories [[react/switch {:track-color #js {:true colors/blue :false nil} - :value (boolean (:preview-privacy? settings)) + :value (boolean preview-privacy?) :on-value-change #(re-frame/dispatch [:multiaccounts.ui/preview-privacy-mode-switched %]) @@ -72,7 +72,7 @@ :on-press #(re-frame/dispatch [:multiaccounts.ui/preview-privacy-mode-switched - ((complement boolean) (:preview-privacy? settings))])} + ((complement boolean) preview-privacy?)])} {:type :divider} ;; TODO - uncomment when implemented (comment @@ -83,15 +83,14 @@ :theme :action-destructive})]) (views/defview privacy-and-security [] - (views/letsubs [{:keys [mnemonic]} [:multiaccount] - settings [:multiaccount-settings] + (views/letsubs [{:keys [mnemonic preview-privacy?]} [:multiaccount] supported-biometric-auth [:supported-biometric-auth] auth-method [:auth-method] keycard-multiaccount? [:keycard-multiaccount?]] [react/view {:flex 1 :background-color colors/white} [topbar/topbar {:title :t/privacy-and-security}] [list/flat-list - {:data (list-data mnemonic settings supported-biometric-auth + {:data (list-data mnemonic preview-privacy? supported-biometric-auth (= auth-method "biometric") keycard-multiaccount?) :key-fn (fn [_ i] (str i)) :render-fn list/flat-list-generic-render-fn}]])) diff --git a/src/status_im/ui/screens/profile/models.cljs b/src/status_im/ui/screens/profile/models.cljs index 93453a730e..2c389f8cba 100644 --- a/src/status_im/ui/screens/profile/models.cljs +++ b/src/status_im/ui/screens/profile/models.cljs @@ -51,14 +51,13 @@ (fx/defn save [{:keys [db now] :as cofx}] (let [{:keys [photo-path]} (:my-profile/profile db) - cleaned-name (clean-name db :my-profile/profile) - cleaned-edit (merge {:name cleaned-name - :last-updated now} - (if photo-path - {:photo-path photo-path}))] + cleaned-name (clean-name db :my-profile/profile)] (fx/merge cofx (clear-profile) - (multiaccounts.update/multiaccount-update cleaned-edit {})))) + (multiaccounts.update/multiaccount-update :name cleaned-name {}) + (multiaccounts.update/multiaccount-update :last-updated now {}) + (when photo-path + (multiaccounts.update/multiaccount-update :photo-path photo-path {}))))) (defn update-picture [this-event base64-image {:keys [db] :as cofx}] (if base64-image diff --git a/src/status_im/wallet/accounts/core.cljs b/src/status_im/wallet/accounts/core.cljs index 1f308be12d..f690057d82 100644 --- a/src/status_im/wallet/accounts/core.cljs +++ b/src/status_im/wallet/accounts/core.cljs @@ -130,8 +130,8 @@ (dissoc :add-account))} (when (= type :generate) (multiaccounts.update/multiaccount-update - {:latest-derived-path (inc latest-derived-path)} - nil)) + :latest-derived-path (inc latest-derived-path) + {})) (wallet/update-balances nil) (navigation/navigate-to-cofx :wallet nil))))) diff --git a/src/status_im/wallet/choose_recipient/core.cljs b/src/status_im/wallet/choose_recipient/core.cljs index 3dbbd2094e..f5e384bf01 100644 --- a/src/status_im/wallet/choose_recipient/core.cljs +++ b/src/status_im/wallet/choose_recipient/core.cljs @@ -116,8 +116,8 @@ (fx/defn request-uri-parsed {:events [:wallet/request-uri-parsed]} - [{{:networks/keys [current-network] :wallet/keys [all-tokens] :as db} :db} data uri] - (let [current-chain-id (get-in constants/default-networks [current-network :config :NetworkId]) + [{{:networks/keys [networks current-network] :wallet/keys [all-tokens] :as db} :db} data uri] + (let [current-chain-id (get-in networks [current-network :config :NetworkId]) {:keys [address chain-id] :as details} (extract-details data current-chain-id all-tokens) valid-network? (boolean (= current-chain-id chain-id)) previous-state (get db :wallet/prepare-transaction) diff --git a/src/status_im/wallet/collectibles/core.cljs b/src/status_im/wallet/collectibles/core.cljs index 37c0d09313..6768ad7973 100644 --- a/src/status_im/wallet/collectibles/core.cljs +++ b/src/status_im/wallet/collectibles/core.cljs @@ -38,8 +38,9 @@ (handlers/register-handler-fx :show-collectibles-list (fn [{:keys [db]} [_ {:keys [symbol amount] :as collectible} address]] - (let [chain (ethereum/chain-id->chain-keyword - (get-in constants/default-networks [(:networks/current-network db) :config :NetworkId])) + (let [{:networks/keys [current-network networks]} db + chain (ethereum/chain-id->chain-keyword + (get-in networks [current-network :config :NetworkId])) all-tokens (:wallet/all-tokens db) items-number (money/to-number amount) loaded-items-number (count (get-in db [:collectibles symbol]))] @@ -99,7 +100,8 @@ (def kudos :KDO) (defmethod load-collectible-fx kudos [{db :db} symbol id] - (let [chain-id (get-in constants/default-networks [(:network db) :config :NetworkId]) + (let [{:networks/keys [current-network networks]} db + chain-id (get-in networks [current-network :config :NetworkId]) all-tokens (:wallet/all-tokens db)] {:erc721-token-uri [all-tokens symbol id chain-id]})) @@ -197,4 +199,4 @@ (handlers/register-handler-fx :open-collectible-in-browser (fn [cofx [_ url]] - (browser/open-url cofx url))) \ No newline at end of file + (browser/open-url cofx url))) diff --git a/src/status_im/wallet/core.cljs b/src/status_im/wallet/core.cljs index 2283ac948d..c309e10bbc 100644 --- a/src/status_im/wallet/core.cljs +++ b/src/status_im/wallet/core.cljs @@ -59,7 +59,7 @@ (assoc-in db [:wallet :errors error-type] (or err :unknown-error))) (fx/defn on-update-prices-fail - {::events [::update-prices-fail]} + {:events [::update-prices-fail]} [{:keys [db]} err] (log/debug "Unable to get prices: " err) {:db (-> db @@ -225,10 +225,10 @@ [{{:keys [network-status :wallet/all-tokens multiaccount :multiaccount/accounts] :as db} :db :as cofx} addresses] - (let [{:keys [settings]} multiaccount - addresses (or addresses (map (comp string/lower-case :address) accounts)) + (let [addresses (or addresses (map (comp string/lower-case :address) accounts)) + {:keys [:wallet/visible-tokens]} multiaccount chain (ethereum/chain-keyword db) - assets (get-in settings [:wallet :visible-tokens chain]) + assets (get visible-tokens chain) init? (or (empty? assets) (= assets (constants/default-visible-tokens chain))) tokens (->> (tokens/tokens-for all-tokens chain) @@ -249,21 +249,20 @@ :init? init?} :db (clear-error-message db :balance-update)} (when-not assets - (multiaccounts.update/update-settings - (assoc-in settings - [:wallet :visible-tokens chain] - #{}) + (multiaccounts.update/multiaccount-update + :wallet/visible-tokens (assoc visible-tokens chain (or (constants/default-visible-tokens chain) + #{})) {})))))) (fx/defn update-prices [{{:keys [network-status :wallet/all-tokens] - {:keys [address chaos-mode? settings]} :multiaccount :as db} :db}] + {:keys [address currency chaos-mode? :wallet/visible-tokens] + :or {currency :usd}} :multiaccount :as db} :db}] (let [chain (ethereum/chain-keyword db) mainnet? (= :mainnet chain) - assets (get-in settings [:wallet :visible-tokens chain] #{}) + assets (get visible-tokens chain #{}) tokens (tokens-symbols assets all-tokens chain) - currency-id (or (get-in settings [:wallet :currency]) :usd) - currency (get constants/currencies currency-id)] + currency (get constants/currencies currency)] (when (not= network-status :offline) {:wallet/get-prices {:from (if mainnet? @@ -281,10 +280,11 @@ (clear-error-message :prices-update) (assoc :prices-loading? true))}))) -(defn- set-checked [ids id checked?] - (if checked? - (conj (or ids #{}) id) - (disj ids id))) +(defn- set-checked [tokens-id token-id checked?] + (let [tokens-id (or tokens-id #{})] + (if checked? + (conj tokens-id token-id) + (disj tokens-id token-id)))) (fx/defn on-update-prices-success {:events [::update-prices-success]} @@ -300,16 +300,20 @@ [:wallet :accounts (eip55/address->checksum address) :balance :ETH] (money/bignumber balance))}) -(defn update-toggle-in-settings - [{{:keys [multiaccount] :as db} :db} symbol checked?] - (let [chain (ethereum/chain-keyword db) - settings (get multiaccount :settings)] - (update-in settings [:wallet :visible-tokens chain] #(set-checked % symbol checked?)))) +(fx/defn update-toggle-in-settings + [{{:keys [multiaccount] :as db} :db :as cofx} symbol checked?] + (let [chain (ethereum/chain-keyword db) + visible-tokens (get multiaccount :wallet/visible-tokens)] + (multiaccounts.update/multiaccount-update + cofx + :wallet/visible-tokens (update visible-tokens + chain + #(set-checked % symbol checked?)) + {}))) (fx/defn toggle-visible-token [cofx symbol checked?] - (let [new-settings (update-toggle-in-settings cofx symbol checked?)] - (multiaccounts.update/update-settings cofx new-settings {}))) + (update-toggle-in-settings cofx symbol checked?)) (fx/defn update-tokens-balances {:events [::update-tokens-balances-success]} @@ -332,35 +336,30 @@ (fx/defn configure-token-balance-and-visibility {:events [::tokens-found]} [{:keys [db] :as cofx} balances] - (let [chain (ethereum/chain-keyword db) - settings (get-in db [:multiaccount :settings]) - visible-tokens (into (or - (constants/default-visible-tokens chain) - #{}) - (flatten (map keys (vals balances)))) - new-settings (assoc-in settings - [:wallet :visible-tokens chain] - visible-tokens)] + (let [chain (ethereum/chain-keyword db) + visible-tokens (get-in db [:multiaccount :wallet/visible-tokens]) + chain-visible-tokens (into (or (constants/default-visible-tokens chain) + #{}) + (flatten (map keys (vals balances))))] (fx/merge cofx - (multiaccounts.update/update-settings cofx new-settings {}) + (multiaccounts.update/multiaccount-update + cofx + :wallet/visible-tokens (assoc visible-tokens + chain + chain-visible-tokens) + {}) (update-tokens-balances balances) (update-prices)))) (fx/defn add-custom-token - [{:keys [db] :as cofx} {:keys [symbol address] :as token}] - (let [chain (ethereum/chain-keyword db) - settings (update-toggle-in-settings cofx symbol true) - new-settings (assoc-in settings [:wallet :custom-tokens chain address] token)] - (fx/merge cofx - (multiaccounts.update/update-settings cofx new-settings {}) - (update-balances nil)))) + [{:keys [db] :as cofx} {:keys [symbol]}] + (fx/merge cofx + (update-toggle-in-settings symbol true) + (update-balances nil))) (fx/defn remove-custom-token - [{:keys [db] :as cofx} {:keys [symbol address]}] - (let [chain (ethereum/chain-keyword db) - settings (update-toggle-in-settings cofx symbol false) - new-settings (update-in settings [:wallet :custom-tokens chain] dissoc address)] - (multiaccounts.update/update-settings cofx new-settings {}))) + [{:keys [db] :as cofx} {:keys [symbol]}] + (update-toggle-in-settings cofx symbol false)) (fx/defn set-and-validate-amount {:events [:wallet.send/set-amount-text]} diff --git a/src/status_im/wallet/custom_tokens/core.cljs b/src/status_im/wallet/custom_tokens/core.cljs index 5b8037ce9b..850fab88a0 100644 --- a/src/status_im/wallet/custom_tokens/core.cljs +++ b/src/status_im/wallet/custom_tokens/core.cljs @@ -8,7 +8,8 @@ [status-im.ui.components.react :as react] [status-im.utils.fx :as fx] [status-im.utils.money :as money] - [status-im.wallet.core :as wallet])) + [status-im.wallet.core :as wallet] + [status-im.multiaccounts.update.core :as multiaccounts.update])) (re-frame/reg-fx :wallet.custom-token/get-decimals diff --git a/status-go-version.json b/status-go-version.json index bb50573cc8..e8a990dd35 100644 --- a/status-go-version.json +++ b/status-go-version.json @@ -2,7 +2,7 @@ "_comment": "DO NOT EDIT THIS FILE BY HAND. USE 'scripts/update-status-go.sh ' instead", "owner": "status-im", "repo": "status-go", - "version": "v0.38.2", - "commit-sha1": "655031616c46233e93767d8a3d8c54568ca043f2", - "src-sha256": "0bi1k1yf70zhayqd5lyrpc84nwdjvja1nsjj1pv75f1s0c2qbmw6" + "version": "v0.38.5", + "commit-sha1": "cf2d16d186f1aff84613b4442f25fbba34665328", + "src-sha256": "0crja1cpql4np8v1n478q0zjiynvagvwxm4diia2zry4w8bk290h" } diff --git a/test/cljs/status_im/test/i18n.cljs b/test/cljs/status_im/test/i18n.cljs index 1bab4c89f1..fb2fa99848 100644 --- a/test/cljs/status_im/test/i18n.cljs +++ b/test/cljs/status_im/test/i18n.cljs @@ -351,9 +351,6 @@ :device-to-device :devices :disable - :disable-discovery-topic - :disable-discovery-topic-warning-content - :disable-discovery-topic-warning-title :disabled :disconnected :discover @@ -1031,9 +1028,6 @@ :use-valid-contact-code :use-valid-contact-code-desktop :use-valid-qr-code - :v1-messages - :v1-messages-warning-content - :v1-messages-warning-title :validation-amount-invalid-number :validation-amount-is-too-precise :version diff --git a/test/cljs/status_im/test/mailserver/core.cljs b/test/cljs/status_im/test/mailserver/core.cljs index fc166f6c21..98f356503d 100644 --- a/test/cljs/status_im/test/mailserver/core.cljs +++ b/test/cljs/status_im/test/mailserver/core.cljs @@ -39,9 +39,8 @@ (testing "there's a preferred mailserver" (testing "it shows the popup" (is (:ui/show-confirmation (mailserver/change-mailserver - {:db {:multiaccount {:settings - {:fleet :staging - :mailserver {:staging "id"}}} + {:db {:multiaccount {:fleet :staging + :pinned-mailservers {:staging "id"}} :peers-count 1}}))))) (testing "there's not a preferred mailserver" (testing "it changes the mailserver" @@ -49,8 +48,7 @@ (get-in (mailserver/change-mailserver {:db {:mailserver/mailservers {:staging {:a "b"}} - :multiaccount {:settings - {:fleet :staging}} + :multiaccount {:fleet :staging} :peers-count 1}}) [::json-rpc/call 0 :method])))) (testing "it does not show the popup" @@ -206,8 +204,8 @@ "d" {}}}}}] (testing "the user has already a preference" (let [cofx (assoc-in cofx - [:db :multiaccount :settings] - {:mailserver {:eth.staging "a"}})] + [:db :multiaccount] + {:pinned-mailservers {:eth.staging "a"}})] (testing "the mailserver exists" (testing "it sets the preferred mailserver" (is (= "a" (-> (mailserver/set-current-mailserver cofx) @@ -334,7 +332,7 @@ :peers-summary (if registered-peer? [{:id "mailserver-id" :enode "enode://mailserver-id@ip"}] []) - :multiaccount {:settings {:fleet :eth.staging}} + :multiaccount {:fleet :eth.staging} :mailserver/current-id "mailserver-a" :mailserver/mailservers {:eth.staging {"mailserver-a" {:sym-key-id sym-key :address "enode://mailserver-id@ip"}}}}}) @@ -595,10 +593,10 @@ {:eth.staging {"mailserverid" {:address "mailserver-address" :password "mailserver-password"}}} :multiaccount - {:settings {:fleet :eth.staging - :mailserver {:eth.staging "mailserverid"}}}}] + {:fleet :eth.staging + :pinned-mailservers {:eth.staging "mailserverid"}}}] (is (not (get-in (mailserver/unpin {:db db}) - [:db :multiaccount :settings :mailserver :eth.staging])))))) + [:db :multiaccount :pinned-mailservers :eth.staging])))))) (deftest pin-test (testing "it removes the preference" @@ -607,10 +605,10 @@ {:eth.staging {"mailserverid" {:address "mailserver-address" :password "mailserver-password"}}} :multiaccount - {:settings {:fleet :eth.staging - :mailserver {}}}}] + {:fleet :eth.staging + :pinned-mailservers {}}}] (is (= "mailserverid" (get-in (mailserver/pin {:db db}) - [:db :multiaccount :settings :mailserver :eth.staging])))))) + [:db :multiaccount :pinned-mailservers :eth.staging])))))) (deftest connect-to-mailserver (let [db {:mailserver/current-id "mailserverid" @@ -618,8 +616,8 @@ {:eth.staging {"mailserverid" {:address "mailserver-address" :password "mailserver-password"}}} :multiaccount - {:settings {:fleet :eth.staging - :mailserver {:eth.staging "mailserverid"}}}}] + {:fleet :eth.staging + :pinned-mailservers {:eth.staging "mailserverid"}}}] (testing "it adds the peer" (is (= "mailserver-address" (:mailserver/add-peer (mailserver/connect-to-mailserver {:db db}))))) diff --git a/test/cljs/status_im/test/models/bootnode.cljs b/test/cljs/status_im/test/models/bootnode.cljs index 5b96b9af3b..7caec6f24d 100644 --- a/test/cljs/status_im/test/models/bootnode.cljs +++ b/test/cljs/status_im/test/models/bootnode.cljs @@ -18,9 +18,9 @@ actual (model/upsert {:random-id-generator (constantly "some-id") :db {:bootnodes/manage new-bootnode - :network "mainnet_rpc" + :networks/current-network "mainnet_rpc" :multiaccount {:not-empty "would throw an error if was empty"}}})] - (is (= expected (get-in actual [:db :multiaccount :bootnodes]))))) + (is (= expected (get-in actual [:db :multiaccount :custom-bootnodes]))))) (testing "adding an existing bootnode" (let [new-bootnode {:id {:value "a"} :name {:value "new-name"} @@ -32,14 +32,14 @@ actual (model/upsert {:random-id-generator (constantly "some-id") :db {:bootnodes/manage new-bootnode - :network "mainnet_rpc" - :multiaccount {:bootnodes + :networks/current-network "mainnet_rpc" + :multiaccount {:custom-bootnodes {"mainnet_rpc" {"a" {:name "name" :address "url" :chain "mainnet_rpc" :id "a"}}}}}})] - (is (= expected (get-in actual [:db :multiaccount :bootnodes])))))) + (is (= expected (get-in actual [:db :multiaccount :custom-bootnodes])))))) (deftest set-input-bootnode (testing "it validates names" @@ -69,9 +69,9 @@ (model/set-bootnodes-from-qr {:db {}} (str valid-bootnode-address " ")))))) (deftest edit-bootnode - (let [db {:network "mainnet_rpc" + (let [db {:networks/current-network "mainnet_rpc" :multiaccount - {:bootnodes + {:custom-bootnodes {"mainnet_rpc" {"a" {:id "a" :name "name" @@ -120,53 +120,54 @@ (deftest fetch-bootnode (testing "it fetches the bootnode from the db" - (let [cofx {:db {:network "mainnet_rpc" - :multiaccount {:bootnodes {"mainnet_rpc" - {"a" {:id "a" - :name "name" - :address "enode://old-id:old-password@url:port"}}}}}}] + (let [cofx {:db {:networks/current-network "mainnet_rpc" + :multiaccount {:custom-bootnodes + {"mainnet_rpc" + {"a" {:id "a" + :name "name" + :address "enode://old-id:old-password@url:port"}}}}}}] (is (model/fetch cofx "a"))))) (deftest custom-bootnodes-in-use? (testing "is on the same network" (testing "it returns false when not enabled" - (is (not (model/custom-bootnodes-in-use? {:db {:network "mainnet_rpc"}})))) + (is (not (model/custom-bootnodes-in-use? {:db {:networks/current-network "mainnet_rpc"}})))) (testing "it returns true when enabled" (is (model/custom-bootnodes-in-use? - {:db {:network "mainnet_rpc" - :multiaccount {:settings - {:bootnodes - {"mainnet_rpc" true}}}}})))) + {:db {:networks/current-network "mainnet_rpc" + :multiaccount {:custom-bootnodes-enabled? + {"mainnet_rpc" true}}}})))) (testing "is on a different network" (testing "it returns false when not enabled" - (is (not (model/custom-bootnodes-in-use? {:db {:network "testnet_rpc"}})))) + (is (not (model/custom-bootnodes-in-use? {:db {:networks/current-network "testnet_rpc"}})))) (testing "it returns true when enabled" (is (not (model/custom-bootnodes-in-use? - {:db {:network "testnet_rpc" - :multiaccount {:settings - {:bootnodes - {"mainnnet_rpc" true}}}}})))))) + {:db {:networks/current-network "testnet_rpc" + :multiaccount {:custom-bootnodes-enabled? + {"mainnnet_rpc" true}}}})))))) (deftest delete-bootnode (testing "non existing bootnode" - (let [cofx {:db {:network "mainnet_rpc" - :multiaccount {:bootnodes {"mainnet_rpc" - {"a" {:id "a" - :name "name" - :address "enode://old-id:old-password@url:port"}}} - :settings {:bootnodes - {"mainnnet_rpc" true}}}}} + (let [cofx {:db {:networks/current-network "mainnet_rpc" + :multiaccount {:custom-bootnodes + {"mainnet_rpc" + {"a" {:id "a" + :name "name" + :address "enode://old-id:old-password@url:port"}}} + :custom-bootnodes-enabled? + {"mainnnet_rpc" true}}}} actual (model/delete cofx "b")] (testing "it does not removes the bootnode" (is (model/fetch actual "a"))))) (testing "existing bootnode" - (let [cofx {:db {:network "mainnet_rpc" - :multiaccount {:bootnodes {"mainnet_rpc" - {"a" {:id "a" - :name "name" - :address "enode://old-id:old-password@url:port"}}} - :settings {:bootnodes - {"mainnnet_rpc" true}}}}} + (let [cofx {:db {:networks/current-network "mainnet_rpc" + :multiaccount {:custom-bootnodes + {"mainnet_rpc" + {"a" {:id "a" + :name "name" + :address "enode://old-id:old-password@url:port"}}} + :custom-bootnodes-enabled? + {"mainnnet_rpc" true}}}} actual (model/delete cofx "a")] (testing "it removes the bootnode" diff --git a/test/cljs/status_im/test/multiaccounts/update/core.cljs b/test/cljs/status_im/test/multiaccounts/update/core.cljs index 8106731110..d3c40aef2c 100644 --- a/test/cljs/status_im/test/multiaccounts/update/core.cljs +++ b/test/cljs/status_im/test/multiaccounts/update/core.cljs @@ -8,13 +8,13 @@ ;;there is no changes, but it is an edge case that shouldn't really happen (let [efx (multiaccounts.update/multiaccount-update {:db {:multiaccount {:not-empty "would throw an error if was empty"}}} - nil {}) + nil nil {}) json-rpc (into #{} (map :method (::json-rpc/call efx)))] - (is (json-rpc "settings_saveConfig")) + (is (json-rpc "settings_saveSetting")) (is (= (get-in efx [:db :multiaccount]) {:not-empty "would throw an error if was empty"})))) (deftest test-clean-seed-phrase (let [efx (multiaccounts.update/clean-seed-phrase {:db {:multiaccount {:mnemonic "lalalala"}}}) json-rpc (into #{} (map :method (::json-rpc/call efx)))] - (is (json-rpc "settings_saveConfig")) - (is (= (get-in efx [:db :multiaccount]) {:mnemonic nil})))) + (is (json-rpc "settings_saveSetting")) + (is (nil? (get-in efx [:db :multiaccount :mnemonic]))))) diff --git a/test/cljs/status_im/test/network/core.cljs b/test/cljs/status_im/test/network/core.cljs index 17b5b79dcf..9a140112db 100644 --- a/test/cljs/status_im/test/network/core.cljs +++ b/test/cljs/status_im/test/network/core.cljs @@ -120,7 +120,7 @@ :DataDir "/ethereum/mainnet_rpc" :UpstreamConfig {:Enabled true :URL "upstream-url"}}}}}})] - (is (= "settings_saveConfig" (:method (first (::json-rpc/call fx))))) + (is (= "settings_saveSetting" (:method (first (::json-rpc/call fx))))) (is (nil? (:networks/manage (:db fx)))) (testing "and check that it has an id with `-` and the correct mainnet NetworkId" (is (= 1 (get-in fx [:db :networks/networks "randomid" :config :NetworkId]))))))) @@ -157,6 +157,6 @@ :DataDir "/ethereum/mainnet_rpc" :UpstreamConfig {:Enabled true :URL "upstream-url"}}}}}})] - (is (= "settings_saveConfig" (:method (first (::json-rpc/call fx))))) + (is (= "settings_saveSetting" (:method (first (::json-rpc/call fx))))) (is (nil? (:networks/manage (:db fx)))) (is (get-in fx [:db :networks/networks "random"]))))) diff --git a/test/cljs/status_im/test/sign_in/data.cljs b/test/cljs/status_im/test/sign_in/data.cljs index b5a02fc8b3..333b7b6a14 100644 --- a/test/cljs/status_im/test/sign_in/data.cljs +++ b/test/cljs/status_im/test/sign_in/data.cljs @@ -83,64 +83,22 @@ :last-updated 0 :address "7540c34d6c4082391f12468580a9a4e0724c6755" :mnemonic "tumble gorilla neglect dumb budget involve tennis ocean diary eagle lady ring" - :bootnodes {} + :custom-bootnodes {} :signing-phrase "bull exam weed" :signed-up? true :name "name" :last-request nil :desktop-notifications? false - :settings {:preview-privacy? true - :fleet :eth.beta - :wallet {:visible-tokens {:testnet #{:STT - :HND} - :mainnet #{:SNT} - :rinkeby #{:MOKSHA - :KDO} - :xdai #{} - :poa #{}}}} - :networks/networks {"testnet" {:id "testnet" - :name "Ropsten" - :config {:NetworkId 3 - :DataDir "/ethereum/testnet" - :LightEthConfig {:Enabled true}} - :rpc-url nil} - "testnet_rpc" {:id "testnet_rpc" - :name "Ropsten with upstream RPC" - :config {:NetworkId 3 - :DataDir "/ethereum/testnet_rpc" - :UpstreamConfig {:Enabled true - :URL "https://ropsten.infura.io/z6GCTmjdP3FETEJmMBI4"}} - :rpc-url nil} - "rinkeby_rpc" {:id "rinkeby_rpc" - :name "Rinkeby with upstream RPC" - :config {:NetworkId 4 - :DataDir "/ethereum/rinkeby_rpc" - :UpstreamConfig {:Enabled true - :URL "https://rinkeby.infura.io/z6GCTmjdP3FETEJmMBI4"}} - :rpc-url nil} - "mainnet_rpc" {:id "mainnet_rpc" - :name "Mainnet with upstream RPC" - :config {:NetworkId 1 - :DataDir "/ethereum/mainnet_rpc" - :UpstreamConfig {:Enabled true - :URL "https://mainnet.infura.io/z6GCTmjdP3FETEJmMBI4"}} - :rpc-url nil} - "xdai_rpc" {:id "xdai_rpc" - :name "xDai Chain" - :config {:NetworkId 100 - :DataDir "/ethereum/xdai_rpc" - :UpstreamConfig {:Enabled true - :URL "https://dai.poa.network"}} - :rpc-url nil} - "poa_rpc" {:id "poa_rpc" - :name "POA Network" - :config {:NetworkId 99 - :DataDir "/ethereum/poa_rpc" - :UpstreamConfig {:Enabled true - :URL "https://poa.infura.io"}} - :rpc-url nil}} + :wallet/visible-tokens {:testnet #{:STT + :HND} + :mainnet #{:SNT} + :rinkeby #{:MOKSHA + :KDO} + :xdai #{} + :poa #{}} + :preview-privacy? true + :fleet :eth.beta :photo-path "data:image/png;base64iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAMAAAC7IEhfAAADAFBMVEX////YsYwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABPGFwxAAABAHRSTlP//wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAKmfXxgAABnNJREFUeNoBaAaX+QAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEBAQEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQEBAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAQEBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEBAQEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEBAQEAAAAAAQEBAQAAAAABAQEBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQEBAQAAAAABAQEBAAAAAAEBAQEAAAAAAAAAAAAAAAAAAAAAAAAAAAABAQEBAAAAAAEBAQEAAAAAAQEBAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAEBAQEAAAAAAQEBAQAAAAABAQEBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQEBAQAAAAABAQEBAAAAAAEBAQEAAAAAAAAAAAAAAAAAAAAAAAAAAAABAQEBAAAAAAEBAQEAAAAAAQEBAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAEBAQEAAAAAAQEBAQAAAAABAQEBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQEBAQAAAAABAQEBAAAAAAEBAQEAAAAAAAAAAAAAAAAAAAAAAAAAAAABAQEBAAAAAAEBAQEAAAAAAQEBAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAEBAQEAAAAAAQEBAQAAAAABAQEBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQEBAQAAAAABAQEBAAAAAAEBAQEAAAAAAAAAAAAAAAAAAAAAAAAAAAABAQEBAAAAAAEBAQEAAAAAAQEBAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAEBAQEBAQEBAAAAAAEBAQEBAQEBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQEBAQEBAQEAAAAAAQEBAQEBAQEAAAAAAAAAAAAAAAAAAAAAAAAAAAABAQEBAQEBAQAAAAABAQEBAQEBAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAEBAQEBAQEBAAAAAAEBAQEBAQEBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAloYA4a9rBHIAAAAASUVORK5CYII=" - :network "mainnet_rpc" :wallet-set-up-passed? false :public-key "0x04173f7cdea0076a7998abb674cc79fe61337c42db77043c01d5b0f3e3ac1e5a45bca0c93bb9f3c3d38b7cc9a7337cd64f9f9b2114fe4bbdfe1ae2633ba14d8c9c" :keycard-key-uid nil diff --git a/test/cljs/status_im/test/tribute_to_talk/core.cljs b/test/cljs/status_im/test/tribute_to_talk/core.cljs index 117208ddcd..87ae2a6b12 100644 --- a/test/cljs/status_im/test/tribute_to_talk/core.cljs +++ b/test/cljs/status_im/test/tribute_to_talk/core.cljs @@ -51,11 +51,11 @@ (def recipient-address "0xdff1a5e4e57d9723b3294e0f4413372e3ea9a8ff") (def user-cofx - {:db {:multiaccount - {:address "954d4393515747ea75808a0301fb73317ae1e460" - :network "testnet_rpc" - :networks/networks {"testnet_rpc" {:config {:NetworkId 3}}} - :settings {:tribute-to-talk {:testnet {:snt-amount "1000000000000000000"}}}} + {:db {:networks/current-network "testnet_rpc" + :networks/networks {"testnet_rpc" {:config {:NetworkId 3}}} + :multiaccount + {:address "954d4393515747ea75808a0301fb73317ae1e460"} + :tribute-to-talk {:testnet {:snt-amount "1000000000000000000"}} :contacts/contacts {recipient-pk {:name "bob" :address recipient-address @@ -101,7 +101,7 @@ (let [result (tribute-to-talk/check-tribute {:db test-db} my-public-key)] (is (= (-> test-db (assoc :navigation/screen-params {:tribute-to-talk {:unavailable? true}}) - (assoc-in [:multiaccount :settings] {:tribute-to-talk {:mainnet nil}})) + (assoc-in [:multiaccount :tribute-to-talk] {:mainnet nil})) (:db result))))) (testing "No contract in network, another public key" diff --git a/test/cljs/status_im/test/tribute_to_talk/whitelist.cljs b/test/cljs/status_im/test/tribute_to_talk/whitelist.cljs index e6ea13f728..65a2905fd3 100644 --- a/test/cljs/status_im/test/tribute_to_talk/whitelist.cljs +++ b/test/cljs/status_im/test/tribute_to_talk/whitelist.cljs @@ -75,7 +75,7 @@ (def sender-address "0xdff1a5e4e57d9723b3294e0f4413372e3ea9a8ff") (def ttt-enabled-multiaccount - {:db {:multiaccount {:settings {:tribute-to-talk {:testnet {:snt-amount "1000000000000000000"}}}} + {:db {:multiaccount {:tribute-to-talk {:testnet {:snt-amount "1000000000000000000"}}} :networks/current-network "testnet_rpc" :networks/networks {"testnet_rpc" {:config {:NetworkId 3}}} :contacts/contacts user-contacts @@ -87,7 +87,7 @@ :ethereum/current-block 8}}) (def ttt-disabled-multiaccount - {:db {:multiaccount {:settings {:tribute-to-talk {}}} + {:db {:multiaccount {:tribute-to-talk {}} :networks/current-network "testnet_rpc" :networks/networks {"testnet_rpc" {:config {:NetworkId 3}}} :contacts/contacts user-contacts}}) diff --git a/test/cljs/status_im/test/ui/screens/currency_settings/models.cljs b/test/cljs/status_im/test/ui/screens/currency_settings/models.cljs index 5c0461a746..5469a95331 100644 --- a/test/cljs/status_im/test/ui/screens/currency_settings/models.cljs +++ b/test/cljs/status_im/test/ui/screens/currency_settings/models.cljs @@ -3,13 +3,12 @@ [status-im.ui.screens.currency-settings.models :as models])) (deftest get-currency - (is (= :usd (models/get-currency {:multiaccount {:settings {:wallet {:currency :usd}}}}))) - (is (= :usd (models/get-currency {:multiaccount {:settings {:wallet {:currency nil}}}}))) - (is (= :usd (models/get-currency {:multiaccount {:settings {:wallet {}}}}))) - (is (= :aud (models/get-currency {:multiaccount {:settings {:wallet {:currency :aud}}}})))) + (is (= :usd (models/get-currency {:multiaccount {:currency :usd}}))) + (is (= :usd (models/get-currency {:multiaccount {:not-empty "would throw an error if was empty"}}))) + (is (= :aud (models/get-currency {:multiaccount {:currency :aud}})))) (deftest set-currency - (let [cofx (models/set-currency {:db {:multiaccount {:settings {:wallet {}}}}} :usd)] - (is (= :usd (get-in cofx [:db :multiaccount :settings :wallet :currency])))) - (is (= :jpy (get-in (models/set-currency {:db {:multiaccount {:settings {:wallet {}}}}} :jpy) - [:db :multiaccount :settings :wallet :currency])))) + (let [cofx (models/set-currency {:db {:multiaccount {:not-empty "would throw an error if was empty"}}} :usd)] + (is (= :usd (get-in cofx [:db :multiaccount :currency])))) + (is (= :jpy (get-in (models/set-currency {:db {:multiaccount {:not-empty "would throw an error if was empty"}}} :jpy) + [:db :multiaccount :currency])))) diff --git a/translations/ar.json b/translations/ar.json index dd553a8cba..618f22fc5b 100644 --- a/translations/ar.json +++ b/translations/ar.json @@ -369,9 +369,6 @@ "device-to-device": "تمكين جهاز إلى جهاز", "devices": "الأجهزة", "disable": "تعطيل", - "disable-discovery-topic": "موضوع الاكتشاف معطل", - "disable-discovery-topic-warning-content": "في حالة التمكين ، سيتمكن فقط المستخدمون الذين لديهم هذا من قراءة رسائلك وإرسال رسائل إليك. يرجى تسجيل الخروج \/ تسجيل الدخول حتى تدخل التغييرات حيز التنفيذMessage", - "disable-discovery-topic-warning-title": "تحذير ، ميزه تجريبية", "disabled": "معطل", "disconnected": "الدردشة غير متصلة بالأنترنت\n", "discover": "اكتشاف", @@ -1093,9 +1090,6 @@ "use-valid-contact-code": "الرجاء إدخال مفتاح دردشة صالح أو مسحه ضوئيًا", "use-valid-contact-code-desktop": "يرجى إدخال مفتاح دردشة صالح أو اسم المستخدم", "use-valid-qr-code": "لا يحتوي رمز الاستجابة السريعة هذا على رابط عالمي صالح أو مفتاح محادثة أو اسم مستخدم: {{data}}", - "v1-messages": "تم تمكين رسائل V1", - "v1-messages-warning-content": "إذا تم تمكينه ، فسيتمكن المستخدمون الذين يقومون بتشغيل تصميمات باستخدام رسائل v1 من قراءة رسائلك. يرجى تسجيل الخروج \/ تسجيل الدخول حتى تدخل التغييرات حيز التنفيذ", - "v1-messages-warning-title": "تحذير ، ميزه تجريبية", "validation-amount-invalid-number": "المبلغ ليس رقمًا صالحًا", "validation-amount-is-too-precise": "المبلغ دقيق جدا. الحد الأقصى لعدد الكسور العشرية هو {{decimals}} .", "version": "نسخة التطبيق", @@ -1174,4 +1168,4 @@ "your-data-belongs-to-you-description": "لا يمكن أن تساعدك Status في استرداد الحساب المتعدد إذا فقدت العبارة الأولية. أنت المسؤول عن أمان بياناتك ، والنسخ الاحتياطي للعبارة الأساسية هو أفضل حماية.", "your-recovery-phrase": "العبارة الأولية الخاصة بك", "your-recovery-phrase-description": "هذه هي العبارة الأولية الخاصة بك. يمكنك استخدامها لإثبات أن هذه هي محفظتك. يمكنك فقط أن ترى ذلك مرة واحدة! اكتبها على الورق واحتفظ بها في مكان آمن. ستحتاج إليها إذا فقدت أو أعدت تثبيت محفظتك." -} \ No newline at end of file +} diff --git a/translations/en.json b/translations/en.json index 02d175b54e..b5ae9eee6b 100644 --- a/translations/en.json +++ b/translations/en.json @@ -336,9 +336,6 @@ "device-to-device": "Device-to-device Enabled", "devices": "Devices", "disable": "disable", - "disable-discovery-topic": "Discovery topic Disabled", - "disable-discovery-topic-warning-content": "If enabled, only users who have this on will be able to read your messages and send you messages. Please logout/login for the changes to take effect", - "disable-discovery-topic-warning-title": "Warning, experimental feature", "disabled": "Disabled", "disconnected": "Chat offline", "discover": "Discover", @@ -1046,9 +1043,6 @@ "use-valid-contact-code": "Please enter or scan a valid chat key or username", "use-valid-contact-code-desktop": "Please enter a valid chat key or username", "use-valid-qr-code": "This QR code doesn't contain a valid universal link, chat key or username: {{data}}", - "v1-messages": "V1 Messages Enabled", - "v1-messages-warning-content": "If enabled, only users who are running builds with v1-messages will be able to read your messages. Please logout/login for the changes to take effect", - "v1-messages-warning-title": "Warning, experimental feature", "validation-amount-invalid-number": "Amount is not a valid number", "validation-amount-is-too-precise": "Amount is too precise. Max number of decimals is {{decimals}}.", "version": "App version", diff --git a/translations/fr.json b/translations/fr.json index 71873225db..aee1097c87 100644 --- a/translations/fr.json +++ b/translations/fr.json @@ -345,9 +345,6 @@ "device-to-device": "Périphérique vers périphérique Activé", "devices": "Appareils", "disable": "désactiver", - "disable-discovery-topic": "Sujet de découverte Désactivé", - "disable-discovery-topic-warning-content": "Si cette option est activée, seuls les utilisateurs qui l'ont activée pourront lire vos messages et vous envoyer des messages. Veuillez vous déconnecter\/ouvrir une session pour que les changements prennent effet.", - "disable-discovery-topic-warning-title": "Attention, fonctionnalité expérimentale", "disabled": "Désactivé", "disconnected": "Chat hors ligne", "discover": "Découvrir", @@ -1061,9 +1058,6 @@ "use-valid-contact-code": "Veuillez entrer ou scanner un code de contact ou un nom d'utilisateur valide.", "use-valid-contact-code-desktop": "Veuillez entrer un code de contact ou un nom d'utilisateur valide", "use-valid-qr-code": "Ce code QR ne contient pas de lien universel, de code de contact ou de nom d'utilisateur valide: {{data}}", - "v1-messages": "Messages V1 activés", - "v1-messages-warning-content": "Si cette option est activée, seuls les utilisateurs qui exécutent des builds avec des messages v1 pourront lire vos messages. Veuillez vous déconnecter\/ouvrir une session pour que les changements prennent effet.", - "v1-messages-warning-title": "Attention, fonctionnalité expérimentale", "validation-amount-invalid-number": "Le montant n'est pas un nombre valide", "validation-amount-is-too-precise": "Le montant est trop précis. Le nombre maximum de décimales est {{decimals}} .", "version": "Version de l'application", diff --git a/translations/it.json b/translations/it.json index 0d1575455f..8650e78383 100644 --- a/translations/it.json +++ b/translations/it.json @@ -345,9 +345,6 @@ "device-to-device": "Device-to-device Abilitato", "devices": "Dispositivi", "disable": "disabilitare", - "disable-discovery-topic": "Argomento di rilevamento disabilitato", - "disable-discovery-topic-warning-content": "Se abilitato, solo gli utenti che lo hanno attivato saranno in grado di leggere i tuoi messaggi e inviarti messaggi. Esci \/ accedi per rendere effettive le modifiche", - "disable-discovery-topic-warning-title": "Attenzione, funzionalità sperimentale", "disabled": "Disabilitato", "disconnected": "Chat offline", "discover": "Scopri", @@ -1061,9 +1058,6 @@ "use-valid-contact-code": "Inserisci o scansiona una chiave chat o un nome utente valido", "use-valid-contact-code-desktop": "Inserisci una chiave chat o un nome utente valido", "use-valid-qr-code": "Questo codice QR non contiene un link universale valido, chat chiave o nome utente: {{data}}", - "v1-messages": "Messaggi V1 abilitati", - "v1-messages-warning-content": "Se abilitato, solo gli utenti che stanno eseguendo build con v1-messages saranno in grado di leggere i vostri messaggi. Si prega di effettuare il logout\/login per far sì che le modifiche abbiano effetto", - "v1-messages-warning-title": "Attenzione, funzionalità sperimentale", "validation-amount-invalid-number": "L'importo non è valido", "validation-amount-is-too-precise": "L'importo è troppo preciso. Il numero massimo di decimali è {{decimals}} .", "version": "Versione App", @@ -1138,4 +1132,4 @@ "your-data-belongs-to-you-description": "Status non può aiutarti a recuperare il tuo Multi-Account se perdi la frase di recupero. Sei responsabile della sicurezza dei tuoi dati e il backup della tua frase di recupero è la migliore salvaguardia.", "your-recovery-phrase": "La tua frase di recupero", "your-recovery-phrase-description": "Questa è la tua frase di recupero. La usi per dimostrare che questo è il tuo portafoglio. Puoi vederlo solo una volta! Scrivilo su carta e conservalo in un luogo sicuro. Ne avrai bisogno se perdi o reinstalli il tuo portafoglio." -} \ No newline at end of file +} diff --git a/translations/ja.json b/translations/ja.json index e4ddf2b994..8fa3f6b2da 100644 --- a/translations/ja.json +++ b/translations/ja.json @@ -315,9 +315,6 @@ "device-to-device": "デバイス間で有効になりました", "devices": "デバイス", "disable": "無効", - "disable-discovery-topic": "トピックを探す が無効", - "disable-discovery-topic-warning-content": "有効にすると、この機能をオンにしたユーザーだけがあなたのメッセージを見たり、あなたにメッセージを送ったりできます。変更を実行するにはログインしなおしてください。", - "disable-discovery-topic-warning-title": "警告、これは実験的な機能です", "disabled": "無効", "disconnected": "チャットがオフライン", "discover": "発見", @@ -991,9 +988,6 @@ "use-valid-contact-code": "有効な連絡先コードまたはユーザー名を入力してください", "use-valid-contact-code-desktop": "有効な連絡先コードまたはユーザー名を入力してください", "use-valid-qr-code": "このQRコードには有効なユニバーサルリンク、連絡先コード、またはユーザー名が含まれていません{{data}}", - "v1-messages": "V1メッセージが有効", - "v1-messages-warning-content": "有効にすると、V1メッセージを有効にしたユーザーだけがあなたのダイレクトメッセージを読むことができます。変更を実行するにはログインしなおしてください。", - "v1-messages-warning-title": "警告、これは実験的な機能です", "validation-amount-invalid-number": "金額が正しくありません", "validation-amount-is-too-precise": "金額が細かすぎます。小数点以下を{{decimals}}桁以下にしてください。", "version": "バージョン", diff --git a/translations/ko.json b/translations/ko.json index c7e376abae..093e7c1748 100644 --- a/translations/ko.json +++ b/translations/ko.json @@ -339,9 +339,6 @@ "device-to-device": "Device-to-device 활성화", "devices": "디바이스", "disable": "비활성화", - "disable-discovery-topic": "디스커버리 비활성화", - "disable-discovery-topic-warning-content": "기능을 활성화하면, 이 기능을 활용하는 사용자만이 귀하에게 메시지를 보내거나 귀하의 메시지를 읽을 수 있습니다. 기능을 적용하려면 다시 로그인해주세요.", - "disable-discovery-topic-warning-title": "경고, 테스트 중인 기능임", "disabled": "비활성화", "disconnected": "연결 중...", "discover": "찾아보기", @@ -1053,9 +1050,6 @@ "use-valid-contact-code": "유효한 채팅 키 또는 사용자 이름을 입력하거나 스캔하십시오", "use-valid-contact-code-desktop": "유효한 채팅 키 또는 사용자 이름을 입력해주세요", "use-valid-qr-code": "이 QR 코드에는 유효한 범용 링크, 채팅 키 또는 사용자 이름이 포함되어 있지 않습니다: {{data}}", - "v1-messages": "V1 메시지 사용", - "v1-messages-warning-content": "기능을 활성화하면, V1 이상의 버전을 활용하는 사용자만이 귀하의 메시지를 확인할 수 있습니다. 기능을 적용하려면 다시 로그인해주세요.", - "v1-messages-warning-title": "경고, 테스트 중인 기능임", "validation-amount-invalid-number": "잘못된 수량입니다", "validation-amount-is-too-precise": "액수가 너무 정확합니다. 최대 소수점 자리수는 {{decimals}}입니다.", "version": "앱 버전", diff --git a/translations/ru.json b/translations/ru.json index 9335ec366e..036987557b 100644 --- a/translations/ru.json +++ b/translations/ru.json @@ -343,9 +343,6 @@ "device-to-device": "Режим устройство-к-устройству включен", "devices": "Устройства", "disable": "отключить", - "disable-discovery-topic": "Режим Discovery topic отключен", - "disable-discovery-topic-warning-content": "Если этот режим включен, то получать ваши сообщения и отправлять сообщения вам смогут только те пользователи, которые тоже включили этот режим. Пожалуйста, выйдите и войдите в систему снова, чтобы изменения вступили в силу.", - "disable-discovery-topic-warning-title": "Предупреждение, экспериментальная функция", "disabled": "Отключен", "disconnected": "Чат оффлайн", "discover": "Поиск", @@ -1037,9 +1034,6 @@ "use-valid-contact-code": "Введите или отсканируйте валидный код контакта или имя пользователя", "use-valid-contact-code-desktop": "Пожалуйста, введите валидный код контакта или имя пользователя", "use-valid-qr-code": "Этот QR-код не содержит валидной универсальной ссылки, кода контакта или имени пользователя: {{data}}", - "v1-messages": "Сообщения V1 включены", - "v1-messages-warning-content": "Если включено, только пользователи, которые запускают сборки с v1, смогут читать ваши сообщения. Пожалуйста, выйдите и войдите в систему, чтобы изменения вступили в силу.", - "v1-messages-warning-title": "Предупреждение, экспериментальная функция", "validation-amount-invalid-number": "Сумма недействительна", "validation-amount-is-too-precise": "Слишком много чисел после запятой. {{decimals}} - это максимальное допустимое количество знаков после запятой.", "version": "Версия {{version}}", diff --git a/translations/zh.json b/translations/zh.json index d31c432434..c88c3dc75e 100644 --- a/translations/zh.json +++ b/translations/zh.json @@ -339,9 +339,6 @@ "device-to-device": "设备到设备启用", "devices": "设备", "disable": "禁用", - "disable-discovery-topic": "Discovery禁用", - "disable-discovery-topic-warning-content": "如果启用,则只有启用本功能的用户才能阅读您的消息并向您发送消息。请注销后重新登录以使更改生效", - "disable-discovery-topic-warning-title": "警告,试验功能", "disabled": "禁用", "disconnected": "正在连接到对等方..。", "discover": "发现", @@ -1053,9 +1050,6 @@ "use-valid-contact-code": "请输入或扫描有效的聊天码或用户名", "use-valid-contact-code-desktop": "请输入有效的聊天码或者用户名", "use-valid-qr-code": "此二维码未包含有效的链接,聊天码或用户名: {{data}}", - "v1-messages": "V1消息启用", - "v1-messages-warning-content": "如果启用,则只有运行v1消息版本的用户才能阅读您的消息。请注销后重新登录以使更改生效", - "v1-messages-warning-title": "警告,实验性功能", "validation-amount-invalid-number": "金额不是一个有效的数字", "validation-amount-is-too-precise": "金额太精确了。最大小数位数为{{decimals}} 。", "version": "App版本", @@ -1129,4 +1123,4 @@ "your-data-belongs-to-you-description": "如果您丢失了助记词,Status无法帮助您恢复多帐户。您需对数据的安全性负责,备份助记词是最佳保障。", "your-recovery-phrase": "您的助记词", "your-recovery-phrase-description": "这是您的助记词。您需要用它来证明这个钱包属于您。您只能查看一次!请将其写在纸上并保存在安全的地方。如果丢失或重新安装钱包,您将需要用到这些助记词。" -} \ No newline at end of file +} diff --git a/translations/zh_Hans_CN.json b/translations/zh_Hans_CN.json index 5603fb26ea..11e209f2bd 100644 --- a/translations/zh_Hans_CN.json +++ b/translations/zh_Hans_CN.json @@ -325,9 +325,6 @@ "device-to-device": "设备到设备已启用", "devices": "设备", "disable": "禁用", - "disable-discovery-topic": "发现主题已禁用", - "disable-discovery-topic-warning-content": "如果启用,则只有具有此功能的用户才能阅读您的消息并向您发送消息。请注销\/登录以使更改生效", - "disable-discovery-topic-warning-title": "警告,实验性功能", "disabled": "禁用", "disconnected": "正在连接到对等方..。", "discover": "发现", @@ -1013,9 +1010,6 @@ "use-valid-contact-code": "请输入或扫描有效的联系人代码或用户名", "use-valid-contact-code-desktop": "请输入有效的聊天码或者用户名", "use-valid-qr-code": "此二维码未包含有效的通用链接,聊天码或用户名: {{data}}", - "v1-messages": "V1消息已启用", - "v1-messages-warning-content": "如果启用,则只有使用v1-messages运行构建的用户才能阅读您的消息。请注销\/登录以使更改生效", - "v1-messages-warning-title": "警告,实验性功能", "validation-amount-invalid-number": "金额不是一个有效的数字", "validation-amount-is-too-precise": "金额太精确了。最大小数位数为{{decimals}} 。", "version": "版本",