parent
b9f7e8758d
commit
95be83756b
|
@ -419,6 +419,17 @@
|
|||
[{:keys [db]}]
|
||||
{::open-last-chat (get-in db [:multiaccount :key-uid])})
|
||||
|
||||
(fx/defn update-wallet-accounts
|
||||
[{:keys [db]} accounts]
|
||||
(let [existing-accounts (into {} (map #(vector (:address %1) %1) (:multiaccount/accounts db)))
|
||||
reduce-fn (fn [existing-accs new-acc]
|
||||
(let [address (:address new-acc)]
|
||||
(if (:removed new-acc)
|
||||
(dissoc existing-accs address)
|
||||
(assoc existing-accs address new-acc))))
|
||||
new-accounts (reduce reduce-fn existing-accounts (rpc->accounts accounts))]
|
||||
{:db (assoc db :multiaccount/accounts (vals new-accounts))}))
|
||||
|
||||
(fx/defn get-chats-callback
|
||||
{:events [::get-chats-callback]}
|
||||
[{:keys [db] :as cofx}]
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
[status-im.utils.types :as types]
|
||||
[status-im.constants :as constants]
|
||||
[status-im.multiaccounts.model :as multiaccounts.model]
|
||||
[status-im.multiaccounts.login.core :as multiaccounts.login]
|
||||
[status-im.notifications-center.core :as notifications-center]
|
||||
[status-im.visibility-status-updates.core :as models.visibility-status-updates]
|
||||
[status-im.browser.core :as browser]
|
||||
|
@ -51,6 +52,7 @@
|
|||
^js settings (.-settings response-js)
|
||||
^js cleared-histories (.-clearedHistories response-js)
|
||||
^js identity-images (.-identityImages response-js)
|
||||
^js accounts (.-accounts response-js)
|
||||
sync-handler (when-not process-async process-response)]
|
||||
(cond
|
||||
|
||||
|
@ -159,6 +161,13 @@
|
|||
(models.visibility-status-updates/handle-visibility-status-updates
|
||||
visibility-status-updates-clj)))
|
||||
|
||||
(seq accounts)
|
||||
(do
|
||||
(js-delete response-js "accounts")
|
||||
(fx/merge cofx
|
||||
(process-next response-js sync-handler)
|
||||
(multiaccounts.login/update-wallet-accounts (types/js->clj accounts))))
|
||||
|
||||
(seq settings)
|
||||
(do
|
||||
(js-delete response-js "settings")
|
||||
|
|
Loading…
Reference in New Issue