diff --git a/src/status_im/network/net_info.cljs b/src/status_im/network/net_info.cljs index 950c1b8b8ccf..a8ed580ffee1 100644 --- a/src/status_im/network/net_info.cljs +++ b/src/status_im/network/net_info.cljs @@ -7,12 +7,16 @@ [status-im.mailserver.core :as mailserver] [status-im.chaos-mode.core :as chaos-mode] [status-im.native-module.core :as status] - [status-im.ui.screens.mobile-network-settings.events :as mobile-network])) + [status-im.ui.screens.mobile-network-settings.events :as mobile-network] + [status-im.wallet.core :as wallet])) (fx/defn change-network-status [{:keys [db] :as cofx} is-connected?] (fx/merge cofx {:db (assoc db :network-status (if is-connected? :online :offline))} + (when is-connected? + (if-not (get-in db [:wallet :accounts]) + (wallet/update-balances nil))) (mailserver/network-connection-status-changed is-connected?))) (fx/defn change-network-type @@ -26,12 +30,13 @@ (fx/defn handle-network-info-change {:events [::network-info-changed]} - [{:keys [db] :as cofx} {:keys [is-connected type details] :as state}] + [{:keys [db] :as cofx} {:keys [isConnected type details] :as state}] (let [old-network-status (:network-status db) - old-network-type (:network/type db)] + old-network-type (:network/type db) + connectivity-status (if isConnected :online :offline)] (fx/merge cofx - (when-not (= is-connected old-network-status) - (change-network-status is-connected)) + (when-not (= connectivity-status old-network-status) + (change-network-status isConnected)) (when-not (= type old-network-type) (change-network-type old-network-type type (:is-connection-expensive details))))))