mirror of
https://github.com/status-im/status-react.git
synced 2025-01-11 03:26:31 +00:00
[fix] fix mailserver configuration
- current wnode defaults to main for upgraded account - current wnode is randomly selected for new and recovered accounts and saved - fix bug when changing mailserver config because encryption key was not provided for realm file - fix bug when logging out with mixpanel tracking because :unregister-mixpanel-tracking event was removed some time ago Signed-off-by: Eric Dvorsak <eric@dvorsak.fr>
This commit is contained in:
parent
23f1c377c5
commit
85389a3101
@ -34,13 +34,6 @@
|
|||||||
;; TODO(jeluard) Restore once we support postponing transaction
|
;; TODO(jeluard) Restore once we support postponing transaction
|
||||||
#_{:id :postponed :label (i18n/label :t/postponed) :checked? true}]}})
|
#_{:id :postponed :label (i18n/label :t/postponed) :checked? true}]}})
|
||||||
|
|
||||||
(def default-account-settings
|
|
||||||
{:wallet {:visible-tokens {:testnet #{:STT :ATT}
|
|
||||||
:mainnet #{:SNT}}}
|
|
||||||
:wnode {:testnet "main"
|
|
||||||
:mainnet "main"
|
|
||||||
:rinkeby "main"}})
|
|
||||||
|
|
||||||
(defn- transform-config [networks]
|
(defn- transform-config [networks]
|
||||||
(->> networks
|
(->> networks
|
||||||
(map (fn [[network-name {:keys [config] :as data}]]
|
(map (fn [[network-name {:keys [config] :as data}]]
|
||||||
@ -89,24 +82,31 @@
|
|||||||
mainnet-networks)))
|
mainnet-networks)))
|
||||||
|
|
||||||
(def default-wnodes
|
(def default-wnodes
|
||||||
{:testnet {"main" {:id "main"
|
{:testnet {"mailserver-a" {:id "mailserver-a"
|
||||||
:name "Status mailserver A"
|
:name "Status mailserver A"
|
||||||
:address "enode://1da276e34126e93babf24ec88aac1a7602b4cbb2e11b0961d0ab5e989ca9c261aa7f7c1c85f15550a5f1e5a5ca2305b53b9280cf5894d5ecf7d257b173136d40@167.99.209.61:30504"}
|
:address "enode://1da276e34126e93babf24ec88aac1a7602b4cbb2e11b0961d0ab5e989ca9c261aa7f7c1c85f15550a5f1e5a5ca2305b53b9280cf5894d5ecf7d257b173136d40@167.99.209.61:30504"}
|
||||||
"backup" {:id "backup"
|
"mailserver-b" {:id "mailserver-b"
|
||||||
:name "Status mailserver B"
|
:name "Status mailserver B"
|
||||||
:address "enode://07ac64fe0e9b2d4ecbfe0ccaeab3d8d95fa8858754f511104bb403b19255d7bf47a8416bdd0df01f6720ff82164451b7a028c93d15ddd37b7e8382d74e91ebc2@167.99.209.72:30504"}}
|
:address "enode://07ac64fe0e9b2d4ecbfe0ccaeab3d8d95fa8858754f511104bb403b19255d7bf47a8416bdd0df01f6720ff82164451b7a028c93d15ddd37b7e8382d74e91ebc2@167.99.209.72:30504"}}
|
||||||
:mainnet {"main" {:id "main"
|
:mainnet {"mailserver-a" {:id "mailserver-a"
|
||||||
:name "Status mailserver A"
|
:name "Status mailserver A"
|
||||||
:address "enode://1da276e34126e93babf24ec88aac1a7602b4cbb2e11b0961d0ab5e989ca9c261aa7f7c1c85f15550a5f1e5a5ca2305b53b9280cf5894d5ecf7d257b173136d40@167.99.209.61:30504"}
|
:address "enode://1da276e34126e93babf24ec88aac1a7602b4cbb2e11b0961d0ab5e989ca9c261aa7f7c1c85f15550a5f1e5a5ca2305b53b9280cf5894d5ecf7d257b173136d40@167.99.209.61:30504"}
|
||||||
"backup" {:id "backup"
|
"mailserver-b" {:id "mailserver-b"
|
||||||
:name "Status mailserver B"
|
:name "Status mailserver B"
|
||||||
:address "enode://07ac64fe0e9b2d4ecbfe0ccaeab3d8d95fa8858754f511104bb403b19255d7bf47a8416bdd0df01f6720ff82164451b7a028c93d15ddd37b7e8382d74e91ebc2@167.99.209.72:30504"}}
|
:address "enode://07ac64fe0e9b2d4ecbfe0ccaeab3d8d95fa8858754f511104bb403b19255d7bf47a8416bdd0df01f6720ff82164451b7a028c93d15ddd37b7e8382d74e91ebc2@167.99.209.72:30504"}}
|
||||||
:rinkeby {"main" {:id "main"
|
:rinkeby {"mailserver-a" {:id "mailserver-a"
|
||||||
:name "Status mailserver A"
|
:name "Status mailserver A"
|
||||||
:address "enode://43829580446ad138386dadb7fa50b6bd4d99f7c28659a0bc08115f8c0380005922a340962496f6af756a42b94a1522baa38a694fa27de59c3a73d4e08d5dbb31@206.189.6.48:30504"}
|
:address "enode://43829580446ad138386dadb7fa50b6bd4d99f7c28659a0bc08115f8c0380005922a340962496f6af756a42b94a1522baa38a694fa27de59c3a73d4e08d5dbb31@206.189.6.48:30504"}
|
||||||
"backup" {:id "backup"
|
"mailserver-b" {:id "mailserver-b"
|
||||||
:name "Status mailserver B"
|
:name "Status mailserver B"
|
||||||
:address "enode://70a2004e78399075f566033c42e9a0b1d43c683d4742755bb5457d03191be66a1b48c2b4fb259696839f28646a5828a1958b900860e27897f984ad0fc8482404@206.189.56.154:30504"}}})
|
:address "enode://70a2004e78399075f566033c42e9a0b1d43c683d4742755bb5457d03191be66a1b48c2b4fb259696839f28646a5828a1958b900860e27897f984ad0fc8482404@206.189.56.154:30504"}}})
|
||||||
|
|
||||||
|
(defn default-account-settings []
|
||||||
|
{:wallet {:visible-tokens {:testnet #{:STT :ATT}
|
||||||
|
:mainnet #{:SNT}}}
|
||||||
|
:wnode {:testnet (rand-nth (keys (:testnet default-wnodes)))
|
||||||
|
:mainnet (rand-nth (keys (:mainnet default-wnodes)))
|
||||||
|
:rinkeby (rand-nth (keys (:rinkeby default-wnodes)))}})
|
||||||
|
|
||||||
(def currencies
|
(def currencies
|
||||||
{:aed {:id :aed :code "AED" :display-name (i18n/label :t/currency-display-name-aed) :symbol "د.إ"}
|
{:aed {:id :aed :code "AED" :display-name (i18n/label :t/currency-display-name-aed) :symbol "د.إ"}
|
||||||
|
@ -78,7 +78,7 @@
|
|||||||
:photo-path (identicon pubkey)
|
:photo-path (identicon pubkey)
|
||||||
:signing-phrase signing-phrase
|
:signing-phrase signing-phrase
|
||||||
:mnemonic mnemonic
|
:mnemonic mnemonic
|
||||||
:settings constants/default-account-settings}]
|
:settings (constants/default-account-settings)}]
|
||||||
(log/debug "account-created")
|
(log/debug "account-created")
|
||||||
(when-not (str/blank? pubkey)
|
(when-not (str/blank? pubkey)
|
||||||
(-> (add-account db account)
|
(-> (add-account db account)
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
:mnemonic ""
|
:mnemonic ""
|
||||||
:signed-up? true
|
:signed-up? true
|
||||||
:signing-phrase phrase
|
:signing-phrase phrase
|
||||||
:settings constants/default-account-settings
|
:settings (constants/default-account-settings)
|
||||||
:wallet-set-up-passed? true}]
|
:wallet-set-up-passed? true}]
|
||||||
(when-not (string/blank? public-key)
|
(when-not (string/blank? public-key)
|
||||||
(-> db
|
(-> db
|
||||||
|
@ -144,6 +144,13 @@
|
|||||||
(fn [encryption-key]
|
(fn [encryption-key]
|
||||||
(re-frame/dispatch [:initialize-app encryption-key])))))
|
(re-frame/dispatch [:initialize-app encryption-key])))))
|
||||||
|
|
||||||
|
(re-frame/reg-fx
|
||||||
|
::get-encryption-key-fx
|
||||||
|
(fn [event]
|
||||||
|
(keychain/get-encryption-key-then
|
||||||
|
(fn [encryption-key]
|
||||||
|
(re-frame/dispatch [event encryption-key])))))
|
||||||
|
|
||||||
(re-frame/reg-fx
|
(re-frame/reg-fx
|
||||||
::got-encryption-key-fx
|
::got-encryption-key-fx
|
||||||
(fn [{:keys [encryption-key callback]}]
|
(fn [{:keys [encryption-key callback]}]
|
||||||
@ -248,17 +255,16 @@
|
|||||||
|
|
||||||
(handlers/register-handler-fx
|
(handlers/register-handler-fx
|
||||||
:logout
|
:logout
|
||||||
(fn [{:keys [db] :as cofx} [_ encryption-key]]
|
(fn [{:keys [db] :as cofx} [this-event encryption-key]]
|
||||||
(let [{:transport/keys [chats]} db
|
(if encryption-key
|
||||||
sharing-usage-data? (get-in db [:account/account :sharing-usage-data?])]
|
(let [{:transport/keys [chats]} db]
|
||||||
(handlers-macro/merge-fx cofx
|
(handlers-macro/merge-fx cofx
|
||||||
{:dispatch-n (concat [[:initialize-db encryption-key]
|
{:dispatch-n [[:initialize-db encryption-key]
|
||||||
[:load-accounts]
|
[:load-accounts]
|
||||||
[:listen-to-network-status]
|
[:listen-to-network-status]
|
||||||
[:navigate-to :accounts]]
|
[:navigate-to :accounts]]}
|
||||||
(when sharing-usage-data?
|
(transport/stop-whisper)))
|
||||||
[[:unregister-mixpanel-tracking]]))}
|
{::get-encryption-key-fx this-event})))
|
||||||
(transport/stop-whisper)))))
|
|
||||||
|
|
||||||
(handlers/register-handler-fx
|
(handlers/register-handler-fx
|
||||||
:initialize-db
|
:initialize-db
|
||||||
|
Loading…
x
Reference in New Issue
Block a user