issue #1951 - added a hardcoded snt entry under asset list - hidden behind ERC20_ENABLED flag

This commit is contained in:
Goran Jovic 2017-11-17 16:03:28 +01:00 committed by Oskar Thorén
parent 641cebee09
commit 8700ec77f5
5 changed files with 18 additions and 3 deletions

1
.env
View File

@ -4,4 +4,5 @@ DEBUG_LOGS_ENABLED=1
STUB_STATUS_GO=0
ETHEREUM_DEV_CLUSTER=1
MAINNET_NETWORKS_ENABLED=1
ERC20_ENABLED=1
LOG_LEVEL=debug

View File

@ -4,4 +4,5 @@ DEBUG_LOGS_ENABLED=1
STUB_STATUS_GO=0
ETHEREUM_DEV_CLUSTER=1
MAINNET_NETWORKS_ENABLED=1
ERC20_ENABLED=1
LOG_LEVEL=debug

View File

@ -4,4 +4,5 @@ DEBUG_LOGS_ENABLED=0
STUB_STATUS_GO=0
ETHEREUM_DEV_CLUSTER=0
MAINNET_NETWORKS_ENABLED=0
ERC20_ENABLED=0
LOG_LEVEL=info

View File

@ -88,9 +88,12 @@
[btn/button {:disabled? true :style (button.styles/button-bar :last) :text-style styles/main-button-text}
(i18n/label :t/wallet-exchange)]]]])
;; TODO(goranjovic): snt is temporarily given the same logo that eth uses to minimize the changes
;; while ERC20 is mocked and hidden behind a flag.
(defn- token->image [id]
(case id
"eth" {:source (:ethereum resources/assets) :style (styles/asset-border components.styles/color-gray-transparent-light)}))
"eth" {:source (:ethereum resources/assets) :style (styles/asset-border components.styles/color-gray-transparent-light)}
"snt" {:source (:ethereum resources/assets) :style (styles/asset-border components.styles/color-blue)}))
(defn add-asset []
[list/touchable-item show-not-implemented!
@ -131,11 +134,18 @@
[add-asset]))
(defn asset-section [balance prices-loading? balance-loading?]
(let [assets [{:id "eth" :currency :eth :amount balance}]]
(let [assets (concat [{:id "eth" :currency :eth :amount balance}]
(if config/erc20-enabled?
[{:id "snt" :currency :snt :amount 5000000000000000000000}]))]
[react/view {:style styles/asset-section}
[react/text {:style styles/asset-section-title} (i18n/label :t/wallet-assets)]
[list/flat-list
{:data (conj assets {}) ;; Extra map triggers rendering for add-asset
{:data (concat assets [{}]) ;; Extra map triggers rendering for add-asset
;; TODO(goranjovic): Refactor
;; the order where new element is inserted
;; with `conj` depends on the underlying collection type.
;; whereas `concat` like here guarantees that empty element
;; will be inserted in the end.
:render-fn render-asset
:on-refresh #(rf/dispatch [:update-wallet])
:refreshing (boolean (or prices-loading? balance-loading?))}]]))

View File

@ -16,11 +16,13 @@
;; TESTFAIRY_ENABLED - indefinite
;; STUB_STATUS_GO - indefinite
;; NOTIFICATIONS_WIP_ENABLED - in 0.9.12 release, remove in develop if all goes well
;; ERC20_ENABLED - until idea #3 is merged, remove in develop when ready
(def testfairy-enabled? (enabled? (get-config :TESTFAIRY_ENABLED)))
(def notifications-wip-enabled? (enabled? (get-config :NOTIFICATIONS_WIP_ENABLED 0)))
(def stub-status-go? (enabled? (get-config :STUB_STATUS_GO 0)))
(def mainnet-networks-enabled? (enabled? (get-config :MAINNET_NETWORKS_ENABLED 0)))
(def erc20-enabled? (enabled? (get-config :ERC20_ENABLED 0)))
(def log-level
(-> (get-config :LOG_LEVEL "error")
string/lower-case