bug #5356 - added snackbar for wallet errors, removed ATT from default tokens on ropsten
Signed-off-by: Goran Jovic <goranjovic@gmail.com>
This commit is contained in:
parent
8f13d97b43
commit
879e33b9b5
|
@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|||
- Added dismiss button to "Add to contacts" bar
|
||||
|
||||
### Fixed
|
||||
- Partially fixed issue with 0 fiat in main Wallet screen. We are now explicitly showing an error when app can't fetch
|
||||
asset prices, instead of silently failing.
|
||||
|
||||
### Changed
|
||||
|
||||
|
|
|
@ -146,7 +146,7 @@
|
|||
(assoc default-wnodes-without-custom :custom (:testnet default-wnodes-without-custom)))
|
||||
|
||||
(defn default-account-settings []
|
||||
{:wallet {:visible-tokens {:testnet #{:STT :ATT}
|
||||
{:wallet {:visible-tokens {:testnet #{:STT :HND}
|
||||
:mainnet #{:SNT}
|
||||
:rinkeby #{:MOKSHA}}}})
|
||||
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
[status-im.data-store.realm.schemas.base.v4.core :as v4]
|
||||
[status-im.data-store.realm.schemas.base.v5.core :as v5]
|
||||
[status-im.data-store.realm.schemas.base.v6.core :as v6]
|
||||
[status-im.data-store.realm.schemas.base.v7.core :as v7]))
|
||||
[status-im.data-store.realm.schemas.base.v7.core :as v7]
|
||||
[status-im.data-store.realm.schemas.base.v8.core :as v8]))
|
||||
|
||||
;; put schemas ordered by version
|
||||
(def schemas [{:schema v1/schema
|
||||
|
@ -28,4 +29,7 @@
|
|||
:migration v6/migration}
|
||||
{:schema v7/schema
|
||||
:schemaVersion 7
|
||||
:migration v7/migration}])
|
||||
:migration v7/migration}
|
||||
{:schema v8/schema
|
||||
:schemaVersion 8
|
||||
:migration v8/migration}])
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
(ns status-im.data-store.realm.schemas.base.v8.account
|
||||
(:require [taoensso.timbre :as log]
|
||||
[cognitect.transit :as transit]
|
||||
[clojure.set :as set]
|
||||
[status-im.data-store.realm.schemas.base.v4.account :as v7]))
|
||||
|
||||
(def schema v7/schema)
|
||||
|
||||
(def removed-tokens
|
||||
#{:ATT})
|
||||
|
||||
(def reader (transit/reader :json))
|
||||
(def writer (transit/writer :json))
|
||||
|
||||
(defn serialize [o] (transit/write writer o))
|
||||
(defn deserialize [o] (try (transit/read reader o) (catch :default e nil)))
|
||||
|
||||
(defn migration [old-realm new-realm]
|
||||
(log/debug "migrating accounts schema v8")
|
||||
(let [accounts (.objects new-realm "account")]
|
||||
(dotimes [i (.-length accounts)]
|
||||
(let [account (aget accounts i)
|
||||
old-settings (deserialize (aget account "settings"))
|
||||
new-settings (-> old-settings
|
||||
(update-in [:wallet :visible-tokens :testnet]
|
||||
#(set/difference % removed-tokens)))
|
||||
updated (serialize new-settings)]
|
||||
(aset account "settings" updated)))))
|
|
@ -0,0 +1,13 @@
|
|||
(ns status-im.data-store.realm.schemas.base.v8.core
|
||||
(:require [status-im.data-store.realm.schemas.base.v1.network :as network]
|
||||
[status-im.data-store.realm.schemas.base.v4.bootnode :as bootnode]
|
||||
[status-im.data-store.realm.schemas.base.v8.account :as account]
|
||||
[taoensso.timbre :as log]))
|
||||
|
||||
(def schema [network/schema
|
||||
bootnode/schema
|
||||
account/schema])
|
||||
|
||||
(defn migration [old-realm new-realm]
|
||||
(log/debug "migrating base database v8: " old-realm new-realm)
|
||||
(account/migration old-realm new-realm))
|
|
@ -458,6 +458,10 @@
|
|||
:signing-phrase-description "Sign the transaction by entering your password. Make sure that the words above match your secret signing phrase"
|
||||
:wallet-insufficient-funds "Insufficient funds"
|
||||
:wallet-insufficient-gas "Not enough ETH for gas"
|
||||
:error-unable-to-get-prices "Currency conversion error. Try to refresh to update later"
|
||||
:error-unable-to-get-balance "Unable to get balance"
|
||||
:error-unable-to-get-token-balance "Unable to get token balance"
|
||||
:error-unable-to-get-transactions "Unable to get transaction history"
|
||||
:receive "Receive"
|
||||
:request-qr-legend "Share this code to receive assets"
|
||||
:send-request "Send request"
|
||||
|
|
|
@ -41,8 +41,7 @@
|
|||
(on-error "web3, contract or account-id not available")))
|
||||
|
||||
(defn assoc-error-message [db error-type err]
|
||||
(assoc-in db [:wallet :errors error-type] (or (when err (str err))
|
||||
:unknown-error)))
|
||||
(assoc-in db [:wallet :errors error-type] (or err :unknown-error)))
|
||||
|
||||
(defn clear-error-message [db error-type]
|
||||
(update-in db [:wallet :errors] dissoc error-type))
|
||||
|
@ -189,7 +188,7 @@
|
|||
(fn [db [_ err]]
|
||||
(log/debug "Unable to get transactions: " err)
|
||||
(-> db
|
||||
(assoc-error-message :transactions-update err)
|
||||
(assoc-error-message :transactions-update :error-unable-to-get-transactions)
|
||||
(assoc-in [:wallet :transactions-loading?] false))))
|
||||
|
||||
(handlers/register-handler-db
|
||||
|
@ -204,7 +203,7 @@
|
|||
(fn [db [_ err]]
|
||||
(log/debug "Unable to get balance: " err)
|
||||
(-> db
|
||||
(assoc-error-message :balance-update err)
|
||||
(assoc-error-message :balance-update :error-unable-to-get-balance)
|
||||
(assoc-in [:wallet :balance-loading?] false))))
|
||||
|
||||
(defn update-token-balance-success [symbol balance {:keys [db]}]
|
||||
|
@ -222,7 +221,7 @@
|
|||
(fn [db [_ symbol err]]
|
||||
(log/debug "Unable to get token " symbol "balance: " err)
|
||||
(-> db
|
||||
(assoc-error-message :balance-update err)
|
||||
(assoc-error-message :balance-update :error-unable-to-get-token-balance)
|
||||
(assoc-in [:wallet :balance-loading?] false))))
|
||||
|
||||
(handlers/register-handler-db
|
||||
|
@ -237,7 +236,7 @@
|
|||
(fn [db [_ err]]
|
||||
(log/debug "Unable to get prices: " err)
|
||||
(-> db
|
||||
(assoc-error-message :prices-update err)
|
||||
(assoc-error-message :prices-update :error-unable-to-get-prices)
|
||||
(assoc :prices-loading? false))))
|
||||
|
||||
(handlers/register-handler-fx
|
||||
|
@ -279,11 +278,6 @@
|
|||
(assoc-in db [:wallet :send-transaction :gas] (money/bignumber (int (* gas 1.2))))
|
||||
db)))
|
||||
|
||||
(handlers/register-handler-fx
|
||||
:wallet/show-error
|
||||
(fn []
|
||||
{:show-error (i18n/label :t/wallet-error)}))
|
||||
|
||||
(handlers/register-handler-fx
|
||||
:wallet-setup-navigate-back
|
||||
(fn [{:keys [db]}]
|
||||
|
|
|
@ -65,6 +65,15 @@
|
|||
:android {:letter-spacing 1.5}
|
||||
:ios {:letter-spacing 1.16}})
|
||||
|
||||
(def snackbar-container
|
||||
{:background-color colors/gray-notifications})
|
||||
|
||||
(def snackbar-text
|
||||
{:color colors/white
|
||||
:margin-horizontal 50
|
||||
:margin-vertical 10
|
||||
:text-align :center})
|
||||
|
||||
;; Actions section
|
||||
|
||||
(def action-section
|
||||
|
|
|
@ -18,7 +18,8 @@
|
|||
status-im.ui.screens.wallet.collectibles.cryptokitties.views
|
||||
[status-im.ui.components.status-bar.view :as status-bar.view]
|
||||
[status-im.ui.components.text :as text]
|
||||
[status-im.ui.screens.wallet.transactions.views :as transactions.views]))
|
||||
[status-im.ui.screens.wallet.transactions.views :as transactions.views]
|
||||
[status-im.ui.components.colors :as colors]))
|
||||
|
||||
(defn toolbar-view []
|
||||
[toolbar/toolbar {:style wallet.styles/toolbar :flat? true}
|
||||
|
@ -147,12 +148,18 @@
|
|||
:data nfts
|
||||
:render-fn #(render-collectible address-hex % modal?)}]}]]))
|
||||
|
||||
(defn snackbar [error-message]
|
||||
[react/view styles/snackbar-container
|
||||
[react/text {:style styles/snackbar-text}
|
||||
(i18n/label error-message)]])
|
||||
|
||||
(views/defview wallet-root [modal?]
|
||||
(views/letsubs [assets [:wallet/visible-assets-with-amount]
|
||||
currency [:wallet/currency]
|
||||
portfolio-value [:portfolio-value]
|
||||
{:keys [modal-history?]} [:get :wallet]
|
||||
{:keys [seed-backed-up?]} [:get-current-account]
|
||||
error-message [:wallet/error-message]
|
||||
address-hex [:get-current-account-hex]]
|
||||
[react/view styles/main-section
|
||||
(if modal?
|
||||
|
@ -166,7 +173,9 @@
|
|||
[react/refresh-control {:on-refresh #(re-frame/dispatch [:update-wallet])
|
||||
:tint-color :white
|
||||
:refreshing false}])}
|
||||
[total-section portfolio-value currency]
|
||||
(if error-message
|
||||
[snackbar error-message]
|
||||
[total-section portfolio-value currency])
|
||||
(when (and (not modal?)
|
||||
(not seed-backed-up?)
|
||||
(some (fn [{:keys [amount]}]
|
||||
|
|
|
@ -80,7 +80,7 @@
|
|||
(fn [wallet]
|
||||
(:balance-loading? wallet)))
|
||||
|
||||
(re-frame/reg-sub :wallet/error-message?
|
||||
(re-frame/reg-sub :wallet/error-message
|
||||
:<- [:wallet]
|
||||
(fn [wallet]
|
||||
(or (get-in wallet [:errors :balance-update])
|
||||
|
|
Loading…
Reference in New Issue