feature #3953 - enabled mainnet on release builds, with a warning

This commit is contained in:
Goran Jovic 2018-05-07 18:15:10 +02:00 committed by Roman Volosovskyi
parent e2d44a3589
commit df901e8748
No known key found for this signature in database
GPG Key ID: 0238A4B5ECEE70DE
10 changed files with 35 additions and 11 deletions

2
.env
View File

@ -1,7 +1,7 @@
TESTFAIRY_ENABLED=0
STUB_STATUS_GO=0
ETHEREUM_DEV_CLUSTER=1
MAINNET_NETWORKS_ENABLED=1
MAINNET_WARNING_ENABLED=0
OFFLINE_INBOX_ENABLED=1
OFFLINE_INBOX_MANY_ENABLED=1
LOG_LEVEL=debug

View File

@ -1,7 +1,7 @@
TESTFAIRY_ENABLED=1
STUB_STATUS_GO=0
ETHEREUM_DEV_CLUSTER=1
MAINNET_NETWORKS_ENABLED=1
MAINNET_WARNING_ENABLED=0
OFFLINE_INBOX_ENABLED=1
OFFLINE_INBOX_MANY_ENABLED=0
LOG_LEVEL=debug

View File

@ -1,7 +1,7 @@
TESTFAIRY_ENABLED=1
STUB_STATUS_GO=0
ETHEREUM_DEV_CLUSTER=1
MAINNET_NETWORKS_ENABLED=1
MAINNET_WARNING_ENABLED=0
OFFLINE_INBOX_ENABLED=1
OFFLINE_INBOX_MANY_ENABLED=0
LOG_LEVEL=debug

View File

@ -1,7 +1,7 @@
TESTFAIRY_ENABLED=0
STUB_STATUS_GO=0
ETHEREUM_DEV_CLUSTER=0
MAINNET_NETWORKS_ENABLED=0
MAINNET_WARNING_ENABLED=1
OFFLINE_INBOX_ENABLED=0
OFFLINE_INBOX_MANY_ENABLED=0
LOG_LEVEL=info

View File

@ -46,6 +46,8 @@ node ('macos1') {
sh 'echo MANY_WHISPER_TOPICS_ENABLED=' + MANY_WHISPER_TOPICS_ENABLED + '>>' + '.env'
sh 'echo POW_TARGET=' + POW_TARGET + '>>' + '.env'
sh 'echo POW_TIME=' + POW_TIME + '>>' + '.env'
sh 'echo MAINNET_WARNING_ENABLED=' + MAINNET_WARNING_ENABLED + '>>' + '.env'
sh 'echo DEFAULT_NETWORK=' + DEFAULT_NETWORK + '>>' + '.env'
sh 'echo "**********************************************************************"'
sh 'echo PARAMETERIZED BUILD - USING CUSTOM ENVIRONMENT'

View File

@ -85,7 +85,7 @@
(def default-networks
(transform-config
(merge testnet-networks
(when config/mainnet-networks-enabled? mainnet-networks))))
mainnet-networks)))
(def default-wnodes
{:testnet {"main" {:id "main"

View File

@ -590,6 +590,10 @@
:close-app-button "Confirm"
:connect-wnode-content "Connect to {{name}}?"
:mainnet-warning-title "Warning!"
:mainnet-warning-text "While we highly appreciate your contribution as a tester of Status, wed like to point out the dangers. Youre switching to Mainnet mode which is still in Alpha. This means it is still in development and has not been audited yet. Some of the risks you may be exposed to include:\n\n- Accounts may be unrecoverable due to breaking changes\n- Loss of ETH and tokens\n- Failure to send or receive messages\n\nSwitching to Mainnet should be done for testing purposes only. By tapping \"I understand\", you confirm that you assume the full responsibility for all risks concerning your data and funds. "
:mainnet-warning-ok-text "I understand"
;; browser
:browser "Browser"
:enter-dapp-url "Enter a ÐApp URL"

View File

@ -7,7 +7,9 @@
[status-im.ui.components.list.views :as list]
[status-im.ui.components.status-bar.view :as status-bar]
[status-im.ui.components.toolbar.view :as toolbar]
[status-im.ui.screens.network-settings.styles :as styles]))
[status-im.ui.screens.network-settings.styles :as styles]
[status-im.utils.utils :as utils]
[status-im.utils.config :as config]))
(defn- network-icon [connected? size]
[react/view (styles/network-icon connected? size)
@ -23,11 +25,27 @@
[react/text {:style styles/badge-connected-text}
(i18n/label :t/connected)])]])
(def mainnet?
#{"mainnet" "mainnet_rpc"})
(defn navigate-to-network [network]
(re-frame/dispatch [:navigate-to :network-details {:networks/selected-network network}]))
(defn wrap-mainnet-warning [network cb]
(fn []
(if (and config/mainnet-warning-enabled?
(mainnet? (:id network)))
(utils/show-confirmation (i18n/label :t/mainnet-warning-title)
(i18n/label :t/mainnet-warning-text)
(i18n/label :t/mainnet-warning-ok-text)
#(cb network))
(cb network))))
(defn render-network [current-network]
(fn [{:keys [id name] :as network}]
(let [connected? (= id current-network)]
[react/touchable-highlight
{:on-press #(re-frame/dispatch [:navigate-to :network-details {:networks/selected-network network}])
{:on-press (wrap-mainnet-warning network navigate-to-network)
:accessibility-label :network-item}
[react/view styles/network-item
[network-icon connected? 40]

View File

@ -20,7 +20,7 @@
(def testfairy-enabled? (enabled? (get-config :TESTFAIRY_ENABLED)))
(def stub-status-go? (enabled? (get-config :STUB_STATUS_GO 0)))
(def mainnet-networks-enabled? (enabled? (get-config :MAINNET_NETWORKS_ENABLED 0)))
(def mainnet-warning-enabled? (enabled? (get-config :MAINNET_WARNING_ENABLED 0)))
(def offline-inbox-enabled? (enabled? (get-config :OFFLINE_INBOX_ENABLED 0)))
(def offline-inbox-many-enabled? (enabled? (get-config :OFFLINE_INBOX_MANY_ENABLED 0)))
(def log-level