diff --git a/src/status_im/ethereum/subscriptions.cljs b/src/status_im/ethereum/subscriptions.cljs index 1c0cbcb402..772f0b9ed0 100644 --- a/src/status_im/ethereum/subscriptions.cljs +++ b/src/status_im/ethereum/subscriptions.cljs @@ -59,7 +59,9 @@ [{:keys [db]} accounts] (log/debug "[wallet-subs] recent-history-fetching-started" "accounts" accounts) - {:db (transactions/update-fetching-status db accounts :recent? true)}) + {:db (-> db + (transactions/update-fetching-status accounts :recent? true) + (assoc :wallet/recent-history-fetching-started? true))}) (fx/defn recent-history-fetching-ended [{:keys [db] :as cofx} {:keys [accounts blockNumber]}] @@ -73,7 +75,9 @@ wallet/remove-transactions-since-block blockNumber) (transactions/update-fetching-status accounts :recent? false) (dissoc :wallet/waiting-for-recent-history? - :wallet/refreshing-history?)) + :wallet/refreshing-history? + :wallet/fetching-error + :wallet/recent-history-fetching-started?)) :transactions/get-transfers {:chain-tokens (:wallet/all-tokens db) :addresses (reduce @@ -90,6 +94,13 @@ :historical? true}} (wallet.core/restart-wallet-service-default))) +(fx/defn fetching-error + [{:keys [db] :as cofx} {:keys [message]}] + (fx/merge + cofx + {:db (assoc db :wallet/fetching-error message)} + (wallet.core/stop-wallet))) + (fx/defn new-wallet-event [cofx {:keys [type blockNumber accounts newTransactions] :as event}] (log/debug "[wallet-subs] new-wallet-event" @@ -101,4 +112,5 @@ "reorg" (reorg cofx event) "recent-history-fetching" (recent-history-fetching-started cofx accounts) "recent-history-ready" (recent-history-fetching-ended cofx event) + "fetching-history-error" (fetching-error cofx event) (log/warn ::unknown-wallet-event :type type :event event))) diff --git a/src/status_im/subs.cljs b/src/status_im/subs.cljs index 8c692ec254..0d89161d1b 100644 --- a/src/status_im/subs.cljs +++ b/src/status_im/subs.cljs @@ -171,6 +171,7 @@ (reg-root-key-sub :wallet/favourites :wallet/favourites) (reg-root-key-sub :wallet/refreshing-history? :wallet/refreshing-history?) (reg-root-key-sub :wallet/buy-crypto-hidden :wallet/buy-crypto-hidden) +(reg-root-key-sub :wallet/fetching-error :wallet/fetching-error) ;;commands (reg-root-key-sub :commands/select-account :commands/select-account) diff --git a/src/status_im/ui/screens/wallet/account/views.cljs b/src/status_im/ui/screens/wallet/account/views.cljs index b3b58917c6..9afbf59a48 100644 --- a/src/status_im/ui/screens/wallet/account/views.cljs +++ b/src/status_im/ui/screens/wallet/account/views.cljs @@ -18,6 +18,7 @@ [status-im.wallet.utils :as wallet.utils] [status-im.ui.components.tabs :as tabs] [quo.react-native :as rn] + [quo.design-system.colors :as quo-colors] [status-im.utils.utils :as utils.utils]) (:require-macros [status-im.utils.views :as views])) @@ -212,7 +213,8 @@ :onRefresh refresh-action}])) (views/defview account [] - (views/letsubs [{:keys [name address] :as account} [:multiaccount/current-account]] + (views/letsubs [{:keys [name address] :as account} [:multiaccount/current-account] + fetching-error [:wallet/fetching-error]] (let [anim-y (animation/create-value button-group-height) scroll-y (animation/create-value 0)] (anim-listener anim-y scroll-y) @@ -228,6 +230,30 @@ (and @updates-counter @(re-frame/subscribe [:wallet/refreshing-history?])))} + (when fetching-error + [react/view {:style {:flex 1 + :align-items :center + :margin 8}} + [icons/icon + :main-icons/warning + {:color :red + :container-style {:background-color (quo-colors/get-color :negative-02) + :height 40 + :width 40 + :border-radius 20 + :align-items :center + :justify-content :center}}] + [react/view + {:style {:justify-content :center + :align-items :center + :margin-top 8 + :margin-horizontal 67.5 + :text-align :center}} + [quo/text + {:color :secondary + :size :small + :style {:text-align :center}} + (i18n/label :t/transfers-fetching-failure)]]]) [react/view {:padding-left 16} [react/scroll-view {:horizontal true} [react/view {:flex-direction :row :padding-top 8 :padding-bottom 12} diff --git a/src/status_im/wallet/core.cljs b/src/status_im/wallet/core.cljs index 48658b88c5..94e0f4bfb7 100644 --- a/src/status_im/wallet/core.cljs +++ b/src/status_im/wallet/core.cljs @@ -557,8 +557,12 @@ #(re-frame.core/dispatch [::restart]) ms-20-min))] {:db (-> db + (update :wallet dissoc :fetching) (assoc :wallet-service/state :stopped) - (assoc :wallet-service/restart-timeout timeout)) + (assoc :wallet-service/restart-timeout timeout) + (dissoc :wallet/recent-history-fetching-started? + :wallet/waiting-for-recent-history? + :wallet/refreshing-history?)) ::stop-wallet nil})) (fx/defn start-wallet @@ -620,9 +624,11 @@ (fx/defn restart-on-pull {:events [:wallet.ui/pull-to-refresh-history]} [{:keys [db now] :as cofx}] - (let [last-pull (get db :wallet/last-pull-time) - watching? (get db :wallet/watch-txs)] + (let [last-pull (get db :wallet/last-pull-time) + watching? (get db :wallet/watch-txs) + fetching-history? (get db :wallet/recent-history-fetching-started?)] (when (and (not watching?) + (not fetching-history?) (or (not last-pull) (> (- now last-pull) pull-to-refresh-cooldown-period))) (fx/merge diff --git a/status-go-version.json b/status-go-version.json index f2f68b36e5..bcf2c12aa8 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.65.0", - "commit-sha1": "cdca42b90f7fd5f302a5eb31802b9ae526d566d7", - "src-sha256": "1qpq9y099bfa6x36afbimn2p5inzrsgbb8qzigmchl513mkhp5s1" + "version": "v0.66.1", + "commit-sha1": "bf703254ba242293c39abd9102420be9e2cc2e25", + "src-sha256": "1xfrgil9nz5q2jmq86v4fhhkz0gnq02dhyq8bnavvi5j7qg1saw1" } diff --git a/translations/en.json b/translations/en.json index 9d5ead875e..43817d3de9 100644 --- a/translations/en.json +++ b/translations/en.json @@ -1349,5 +1349,6 @@ "has-permissions": "has permission to access", "connect-wallet": "Connect wallet", "open-chat": "Open chat", - "favourite-description": "Your favourite websites will appear here" + "favourite-description": "Your favourite websites will appear here", + "transfers-fetching-failure": "Transfers history could not be updated. Check your connection and pull down to try again" }