remove STUB_STATUS_GO parameter

This commit is contained in:
Roman Volosovskyi 2018-07-30 06:47:08 +03:00
parent a586d177f5
commit 27b3f1b87b
No known key found for this signature in database
GPG Key ID: 0238A4B5ECEE70DE
11 changed files with 28 additions and 203 deletions

1
.env
View File

@ -1,5 +1,4 @@
TESTFAIRY_ENABLED=0
STUB_STATUS_GO=0
ETHEREUM_DEV_CLUSTER=1
OFFLINE_INBOX_ENABLED=1
RPC_NETWORKS_ONLY=1

View File

@ -1,5 +1,4 @@
TESTFAIRY_ENABLED=1
STUB_STATUS_GO=0
ETHEREUM_DEV_CLUSTER=1
OFFLINE_INBOX_ENABLED=1
LOG_LEVEL=debug

View File

@ -1,5 +1,4 @@
TESTFAIRY_ENABLED=1
STUB_STATUS_GO=0
ETHEREUM_DEV_CLUSTER=1
OFFLINE_INBOX_ENABLED=1
LOG_LEVEL=debug

View File

@ -1,5 +1,4 @@
TESTFAIRY_ENABLED=1
STUB_STATUS_GO=0
ETHEREUM_DEV_CLUSTER=1
OFFLINE_INBOX_ENABLED=1
LOG_LEVEL=debug

View File

@ -1,5 +1,4 @@
TESTFAIRY_ENABLED=0
STUB_STATUS_GO=0
ETHEREUM_DEV_CLUSTER=0
MAINNET_WARNING_ENABLED=1
OFFLINE_INBOX_ENABLED=1

View File

@ -40,7 +40,6 @@ timeout(90) {
// TODO(oskarth): Consider read/write from .env to avoid having to specify in Jenkins again
// sh 'cp .env.jenkins .env'
sh 'echo TESTFAIRY_ENABLED=' + TESTFAIRY_ENABLED + '>>' + '.env'
sh 'echo STUB_STATUS_GO=' + STUB_STATUS_GO + '>>' + '.env'
sh 'echo ETHEREUM_DEV_CLUSTER=' + ETHEREUM_DEV_CLUSTER + '>>' + '.env'
sh 'echo MAINNET_NETWORKS_ENABLED=' + MAINNET_NETWORKS_ENABLED + '>>' + '.env'
sh 'echo LOG_LEVEL=' + LOG_LEVEL + '>>' + '.env'

View File

@ -1,83 +1,67 @@
(ns status-im.native-module.core
(:require [status-im.native-module.module :as module-interface]
[status-im.native-module.impl.module :as native-module]
[status-im.native-module.impl.non-status-go-module :as non-status-go-module]
[taoensso.timbre :as log]
[status-im.utils.config :as config]))
(def rns-module
(if config/stub-status-go?
(non-status-go-module/ReactNativeStatus.)
(native-module/ReactNativeStatus.)))
(:require [status-im.native-module.impl.module :as native-module]))
(def adjust-resize 16)
(def adjust-pan 32)
#_(defn- wrap-and-print-callback [name callback]
(fn [& args]
(println :callback name (str args))
(log/debug :callback name args)
(apply callback args)))
(defn move-to-internal-storage [callback]
(module-interface/-move-to-internal-storage rns-module callback))
(native-module/move-to-internal-storage callback))
(defn start-node [config]
(module-interface/-start-node rns-module config))
(native-module/start-node config))
(defn stop-node []
(module-interface/-stop-node rns-module))
(native-module/stop-node))
(defn create-account [password callback]
(module-interface/-create-account rns-module password callback))
(native-module/create-account password callback))
(defn recover-account [passphrase password callback]
(module-interface/-recover-account rns-module passphrase password callback))
(native-module/recover-account passphrase password callback))
(defn login [address password callback]
(module-interface/-login rns-module address password callback))
(native-module/login address password callback))
(defn approve-sign-request [id password callback]
(module-interface/-approve-sign-request rns-module id password callback))
(native-module/approve-sign-request id password callback))
(defn approve-sign-request-with-args [id password gas gas-price callback]
(module-interface/-approve-sign-request-with-args rns-module id password gas gas-price callback))
(native-module/approve-sign-request-with-args id password gas gas-price callback))
(defn discard-sign-request [id]
(module-interface/-discard-sign-request rns-module id))
(native-module/discard-sign-request id))
(defn set-soft-input-mode [mode]
(module-interface/-set-soft-input-mode rns-module mode))
(native-module/set-soft-input-mode mode))
(defn clear-web-data []
(module-interface/-clear-web-data rns-module))
(native-module/clear-web-data))
(defn call-web3 [payload callback]
(module-interface/-call-web3 rns-module payload callback))
(native-module/call-web3 payload callback))
(defn call-web3-private [payload callback]
(module-interface/-call-web3-private rns-module payload callback))
(native-module/call-web3-private payload callback))
(defn module-initialized! []
(module-interface/-module-initialized! rns-module))
(native-module/module-initialized!))
(defn should-move-to-internal-storage? [callback]
(module-interface/-should-move-to-internal-storage? rns-module callback))
(native-module/should-move-to-internal-storage? callback))
(defn notify-users [{:keys [message payload tokens] :as m} callback]
(module-interface/-notify-users rns-module m callback))
(defn notify-users [m callback]
(native-module/notify-users m callback))
(defn add-peer [enode callback]
(module-interface/-add-peer rns-module enode callback))
(native-module/add-peer enode callback))
(defn close-application []
(module-interface/-close-application rns-module))
(native-module/close-application))
(defn connection-change [data]
(module-interface/-connection-change rns-module data))
(native-module/connection-change data))
(defn app-state-change [state]
(module-interface/-app-state-change rns-module state))
(native-module/app-state-change state))
(defn get-device-UUID [callback]
(module-interface/-get-device-UUID rns-module callback))
(native-module/get-device-UUID callback))

View File

@ -2,15 +2,12 @@
(:require-macros
[cljs.core.async.macros :refer [go-loop go]])
(:require [status-im.ui.components.react :as r]
[re-frame.core :refer [dispatch] :as re-frame]
[re-frame.core :as re-frame]
[taoensso.timbre :as log]
[cljs.core.async :as async :refer [<!]]
[cljs.core.async :as async]
[status-im.utils.platform :as p]
[status-im.utils.types :as types]
[status-im.utils.transducers :as transducers]
[status-im.utils.async :as async-util :refer [timeout]]
[status-im.utils.async :as async-util]
[status-im.react-native.js-dependencies :as rn-dependencies]
[status-im.native-module.module :as module]
[clojure.string :as string]))
;; if StatusModule is not initialized better to store
@ -44,7 +41,7 @@
(doseq [call calls]
(call))))
(reset! loop-started false))
(recur (<! (timeout 500))))))
(recur (async/<! (async-util/timeout 500))))))
(def status
(when (exists? (.-NativeModules rn-dependencies/react-native))
@ -55,7 +52,7 @@
(when-not @listener-initialized
(reset! listener-initialized true)
(.addListener r/device-event-emitter "gethEvent"
#(dispatch [:signal-event (.-jsonEvent %)])))
#(re-frame/dispatch [:signal-event (.-jsonEvent %)])))
(defn should-move-to-internal-storage? [on-result]
(when status
@ -157,55 +154,3 @@
status
(fn [UUID]
(callback (string/upper-case UUID))))))
(defrecord ReactNativeStatus []
module/IReactNativeStatus
;; status-go calls
(-init-jail [this])
(-start-node [this config]
(start-node config))
(-stop-node [this]
(stop-node))
(-create-account [this password callback]
(create-account password callback))
(-recover-account [this passphrase password callback]
(recover-account passphrase password callback))
(-login [this address password callback]
(login address password callback))
(-approve-sign-request [this id password callback]
(approve-sign-request id password callback))
(-approve-sign-request-with-args [this id password gas gas-price callback]
(approve-sign-request-with-args id password gas gas-price callback))
(-discard-sign-request [this id]
(discard-sign-request id))
(-parse-jail [this chat-id file callback])
(-call-jail [this params])
(-call-function! [this params])
(-call-web3 [this payload callback]
(call-web3 payload callback))
(-call-web3-private [this payload callback]
(call-web3-private payload callback))
(-notify-users [this {:keys [message payload tokens] :as m} callback]
(notify-users m callback))
(-add-peer [this enode callback]
(add-peer enode callback))
;; other calls
(-move-to-internal-storage [this callback]
(move-to-internal-storage callback))
(-set-soft-input-mode [this mode]
(set-soft-input-mode mode))
(-clear-web-data [this]
(clear-web-data))
(-module-initialized! [this]
(module-initialized!))
(-should-move-to-internal-storage? [this callback]
(should-move-to-internal-storage? callback))
(-close-application [this]
(close-application))
(-connection-change [this data]
(connection-change data))
(-app-state-change [this state]
(app-state-change state))
(-get-device-UUID [this callback]
(get-device-UUID callback)))

View File

@ -1,67 +0,0 @@
(ns status-im.native-module.impl.non-status-go-module
(:require [status-im.native-module.module :as module]
[status-im.native-module.impl.module :as impl]
[status-im.constants :as constants]
[re-frame.core :as re-frame]
[goog.string :as gstring]
[goog.string.format]))
(def wrong-password "111")
(defrecord ReactNativeStatus []
module/IReactNativeStatus
;; status-go calls
(-init-jail [this])
(-start-node [this config]
(re-frame/dispatch [:signal-event "{\"type\":\"node.started\",\"event\":{}}"])
(re-frame/dispatch [:signal-event "{\"type\":\"node.ready\",\"event\":{}}"]))
(-stop-node [this])
(-create-account [this password callback]
(let [address (str "c9f5c0e2bea0aabb6b0b618e9f45ab0958" (gstring/format "%06d" (rand-int 100000)))]
(callback (str "{\"address\":\"" address "\",\"pubkey\":\"0x046a313ba760e8853356b42a8732db1e2c339602977a3ac3d57ec2056449439b2c9f28e2e0dd243ac319f5da198b4a96f980d0ab6d4c7220ca7c5e1af2bd1ee8c7\",\"mnemonic\":\"robust rib ramp adult cannon amateur refuse burden review feel scout sell\",\"error\":\"\"}"))))
(-recover-account [this passphrase password callback])
(-login [this address password callback]
(if (not= password wrong-password)
(callback "{\"error\":\"\"}")
(callback "{\"error\":\"cannot retrieve a valid key for a given account: could not decrypt key with given passphrase\"}")))
(-approve-sign-request [this id password callback])
(-approve-sign-request-with-args [this id password gas gas-price callback])
(-discard-sign-request [this id])
(-parse-jail [this chat-id file callback]
(when (= chat-id constants/console-chat-id)
(callback "{\"result\":\"{\\\"commands\\\":{\\\"phone,50\\\":{\\\"name\\\":\\\"phone\\\",\\\"title\\\":\\\"Send Phone Number\\\",\\\"description\\\":\\\"Find friends using your number\\\",\\\"has-handler\\\":true,\\\"async-handler\\\":false,\\\"color\\\":\\\"#5bb2a2\\\",\\\"icon\\\":\\\"phone_white\\\",\\\"params\\\":[{\\\"name\\\":\\\"phone\\\",\\\"type\\\":\\\"phone\\\",\\\"placeholder\\\":\\\"Phone number\\\"}],\\\"sequential-params\\\":true,\\\"scope\\\":[\\\"personal-chats\\\",\\\"registered\\\",\\\"dapps\\\"],\\\"scope-bitmask\\\":50},\\\"faucet,50\\\":{\\\"name\\\":\\\"faucet\\\",\\\"title\\\":\\\"Faucet\\\",\\\"description\\\":\\\"Get some ETH\\\",\\\"has-handler\\\":true,\\\"async-handler\\\":false,\\\"color\\\":\\\"#7099e6\\\",\\\"params\\\":[{\\\"name\\\":\\\"url\\\",\\\"type\\\":\\\"text\\\",\\\"placeholder\\\":\\\"Faucet URL\\\"}],\\\"scope\\\":[\\\"personal-chats\\\",\\\"registered\\\",\\\"dapps\\\"],\\\"scope-bitmask\\\":50},\\\"debug,50\\\":{\\\"name\\\":\\\"debug\\\",\\\"title\\\":\\\"Debug mode\\\",\\\"description\\\":\\\"Starts\\/stops a debug mode\\\",\\\"has-handler\\\":true,\\\"async-handler\\\":false,\\\"color\\\":\\\"#7099e6\\\",\\\"params\\\":[{\\\"name\\\":\\\"mode\\\",\\\"type\\\":\\\"text\\\"}],\\\"scope\\\":[\\\"personal-chats\\\",\\\"registered\\\",\\\"dapps\\\"],\\\"scope-bitmask\\\":50}},\\\"responses\\\":{\\\"phone,50\\\":{\\\"name\\\":\\\"phone\\\",\\\"title\\\":\\\"Send Phone Number\\\",\\\"description\\\":\\\"Find friends using your number\\\",\\\"has-handler\\\":true,\\\"async-handler\\\":false,\\\"color\\\":\\\"#5bb2a2\\\",\\\"icon\\\":\\\"phone_white\\\",\\\"params\\\":[{\\\"name\\\":\\\"phone\\\",\\\"type\\\":\\\"phone\\\",\\\"placeholder\\\":\\\"Phone number\\\"}],\\\"sequential-params\\\":true,\\\"scope\\\":[\\\"personal-chats\\\",\\\"registered\\\",\\\"dapps\\\"],\\\"scope-bitmask\\\":50},\\\"confirmation-code,50\\\":{\\\"name\\\":\\\"confirmation-code\\\",\\\"description\\\":\\\"Confirmation code\\\",\\\"has-handler\\\":true,\\\"async-handler\\\":false,\\\"color\\\":\\\"#7099e6\\\",\\\"params\\\":[{\\\"name\\\":\\\"code\\\",\\\"type\\\":\\\"number\\\"}],\\\"sequential-params\\\":true,\\\"scope\\\":[\\\"personal-chats\\\",\\\"registered\\\",\\\"dapps\\\"],\\\"scope-bitmask\\\":50},\\\"password,42\\\":{\\\"name\\\":\\\"password\\\",\\\"description\\\":\\\"Password\\\",\\\"has-handler\\\":true,\\\"async-handler\\\":false,\\\"color\\\":\\\"#7099e6\\\",\\\"icon\\\":\\\"lock_white\\\",\\\"params\\\":[{\\\"name\\\":\\\"password\\\",\\\"type\\\":\\\"password\\\",\\\"placeholder\\\":\\\"Type your password\\\",\\\"hidden\\\":true},{\\\"name\\\":\\\"password-confirmation\\\",\\\"type\\\":\\\"password\\\",\\\"placeholder\\\":\\\"Confirm\\\",\\\"hidden\\\":true}],\\\"sequential-params\\\":true,\\\"scope\\\":[\\\"personal-chats\\\",\\\"anonymous\\\",\\\"dapps\\\"],\\\"scope-bitmask\\\":42},\\\"grant-permissions,58\\\":{\\\"name\\\":\\\"grant-permissions\\\",\\\"description\\\":\\\"Grant permissions\\\",\\\"has-handler\\\":true,\\\"async-handler\\\":false,\\\"color\\\":\\\"#7099e6\\\",\\\"icon\\\":\\\"lock_white\\\",\\\"params\\\":[],\\\"execute-immediately?\\\":true,\\\"scope\\\":[\\\"personal-chats\\\",\\\"anonymous\\\",\\\"registered\\\",\\\"dapps\\\"],\\\"scope-bitmask\\\":58}},\\\"functions\\\":{},\\\"subscriptions\\\":{}}\"}")))
(-call-jail [this {:keys [callback path] :as params}]
(cond
(= path [:responses "password" :preview])
(callback {:result {:context {},
:messages {},
:returned {:markup ["text"
{:style
{:color "black",
:font-size 8,
:letter-spacing 1,
:margin-bottom 2,
:margin-horizontal 0,
:margin-top 10}}
"●●●●●●●●●●"]}}})
:else (callback {:result nil})))
(-call-function! [this params])
(-call-web3 [this payload callback])
(-call-web3-private [this payload callback])
;; other calls
(-move-to-internal-storage [this callback]
(impl/move-to-internal-storage callback))
(-set-soft-input-mode [this mode]
(impl/set-soft-input-mode mode))
(-clear-web-data [this]
(impl/clear-web-data))
(-module-initialized! [this]
(impl/module-initialized!))
(-should-move-to-internal-storage? [this callback]
(impl/should-move-to-internal-storage? callback))
(-notify-users [this {:keys [message payload tokens] :as m} callback])
(-add-peer [this enode callback])
(-close-application [this])
(-connection-change [this data])
(-app-state-change [this state]))

View File

@ -1,29 +0,0 @@
(ns status-im.native-module.module)
(defprotocol IReactNativeStatus
(-init-jail [this])
(-move-to-internal-storage [this callback])
(-start-node [this config])
(-stop-node [this])
(-create-account [this password callback])
(-recover-account [this passphrase password callback])
(-login [this address password callback])
(-approve-sign-request [this id password callback])
(-approve-sign-request-with-args [this id password gas gas-price callback])
(-discard-sign-request [this id])
(-parse-jail [this chat-id file callback])
(-call-jail [this params])
(-call-function! [this params])
(-set-soft-input-mode [this mode])
(-clear-web-data [this])
(-call-web3 [this payload callback])
(-call-web3-private [this payload callback])
(-module-initialized! [this])
(-should-move-to-internal-storage? [this callback])
(-notify-users [this {:keys [message payload tokens] :as m} callback])
(-add-peer [this enode callback])
(-close-application [this])
(-connection-change [this data])
(-app-state-change [this state])
(-get-device-UUID [this callback]))

View File

@ -15,11 +15,9 @@
;; flags stay up to date and are removed once behavior introduced is stable.
;;
;; TESTFAIRY_ENABLED - indefinite
;; STUB_STATUS_GO - indefinite
;; OFFLINE_INBOX_ENABLED - TBD, tenatively until #idea 1 is merged
(def testfairy-enabled? (enabled? (get-config :TESTFAIRY_ENABLED)))
(def stub-status-go? (enabled? (get-config :STUB_STATUS_GO 0)))
(def offline-inbox-enabled? (enabled? (get-config :OFFLINE_INBOX_ENABLED "1")))
(def bootnodes-settings-enabled? (enabled? (get-config :BOOTNODES_SETTINGS_ENABLED "1")))
(def universal-links-enabled? (enabled? (get-config :UNIVERSAL_LINK_ENABLED "1")))