[#8107] Wallet balance is not updated when transaction is received

Signed-off-by: Pedro Pombeiro <pombeirp@users.noreply.github.com>
This commit is contained in:
Andrey Shovkoplyas 2019-05-06 16:59:35 +02:00 committed by Pedro Pombeiro
parent 441989f168
commit f3b6f98079
No known key found for this signature in database
GPG Key ID: C4A24185B2AA48A1
3 changed files with 23 additions and 4 deletions

View File

@ -164,7 +164,11 @@
[react/scroll-view {:end-fill-color colors/white
:refresh-control
(reagent/as-element
[react/refresh-control {:on-refresh #(re-frame/dispatch [:wallet.ui/pull-to-refresh])
[react/refresh-control {:on-refresh (fn [_]
;;TODO temporay fix to update balance, should be fixed
;;properly later
(re-frame/dispatch [:wallet.ui/pull-to-refresh])
(re-frame/dispatch [:update-wallet]))
:tint-color :white
:refreshing false}])}
(if error-message

View File

@ -2,16 +2,27 @@
(:require [re-frame.core :as re-frame]
[status-im.ui.screens.navigation :as navigation]
[status-im.utils.ethereum.core :as ethereum]
[status-im.constants :as constants]))
[status-im.constants :as constants]
[status-im.utils.utils :as utils]))
(defmethod navigation/preload-data! :wallet
[db _]
;;TODO(goranjovic) - get rid of this preload hook completely
;;TODO(andrey) - temporary "improvement" with timeout, to fix screen rendering, wallet update should be optimized
(utils/set-timeout (fn []
(re-frame/dispatch [:wallet.ui/pull-to-refresh])
(re-frame/dispatch [:update-wallet]))
500)
(assoc-in db [:wallet :current-tab] 0))
(defmethod navigation/preload-data! :wallet-stack
[db _]
;;TODO(goranjovic) - get rid of this preload hook completely
;;TODO(andrey) - temporary "improvement" with timeout, to fix screen rendering, wallet update should be optimized
(utils/set-timeout (fn []
(re-frame/dispatch [:wallet.ui/pull-to-refresh])
(re-frame/dispatch [:update-wallet]))
500)
(assoc-in db [:wallet :current-tab] 0))
(defmethod navigation/preload-data! :transactions-history

View File

@ -14,7 +14,8 @@
[status-im.utils.money :as money]
[status-im.utils.ethereum.tokens :as tokens]
[status-im.utils.ethereum.core :as ethereum]
[status-im.ui.screens.wallet.utils :as wallet.utils]))
[status-im.ui.screens.wallet.utils :as wallet.utils]
[status-im.utils.utils :as utils]))
(defn history-action [filter?]
(cond->
@ -254,7 +255,9 @@
[react/view {:style components.styles/flex}
[status-bar/status-bar]
[toolbar/toolbar {}
toolbar/default-nav-back
[toolbar/nav-button (actions/back
;;TODO temporary fix to update wallet balance, should be fixed properly later
(utils/set-timeout #(re-frame/dispatch [:update-wallet]) 500))]
[toolbar/content-title (i18n/label :t/transaction-details)]
(when transaction [toolbar/actions (details-action hash url)])]
[react/scroll-view {:style components.styles/main-container}
@ -262,3 +265,4 @@
[details-confirmations confirmations confirmations-progress type]
[react/view {:style styles/details-separator}]
[details-list transaction]]]))