From 834937950926b11de17ade7048c275691fffde85 Mon Sep 17 00:00:00 2001 From: Roman Volosovskyi Date: Fri, 15 Dec 2017 16:27:09 +0200 Subject: [PATCH] fix account creation without status-go --- .../native_module/impl/non_status_go_module.cljs | 2 +- src/status_im/ui/screens/accounts/login/events.cljs | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/status_im/native_module/impl/non_status_go_module.cljs b/src/status_im/native_module/impl/non_status_go_module.cljs index 56aa3ea7af..aef4ade648 100644 --- a/src/status_im/native_module/impl/non_status_go_module.cljs +++ b/src/status_im/native_module/impl/non_status_go_module.cljs @@ -28,7 +28,7 @@ (-discard-transaction [this id]) (-parse-jail [this chat-id file callback] (when (= chat-id constants/console-chat-id) - (callback "{\"result\": {\"commands\":{\"debug\":{\"color\":\"#7099e6\",\"description\":\"Starts/stops a debug mode\",\"has-handler\":false,\"name\":\"debug\",\"params\":[{\"name\":\"mode\",\"type\":\"text\"}],\"registered-only\":true,\"title\":\"Debug mode\"},\"faucet\":{\"color\":\"#7099e6\",\"description\":\"Get some ETH\",\"has-handler\":false,\"name\":\"faucet\",\"params\":[{\"name\":\"url\",\"placeholder\":\"Faucet URL\",\"type\":\"text\"}],\"registered-only\":true,\"title\":\"Faucet\"},\"phone\":{\"color\":\"#5bb2a2\",\"description\":\"Find friends using your number\",\"has-handler\":false,\"icon\":\"phone_white\",\"name\":\"phone\",\"params\":[{\"name\":\"phone\",\"placeholder\":\"Phone number\",\"type\":\"phone\"}],\"registered-only\":true,\"sequential-params\":true,\"title\":\"Send Phone Number\"}},\"functions\":{},\"responses\":{\"confirmation-code\":{\"color\":\"#7099e6\",\"description\":\"Confirmation code\",\"has-handler\":false,\"name\":\"confirmation-code\",\"params\":[{\"name\":\"code\",\"type\":\"number\"}],\"sequential-params\":true},\"grant-permissions\":{\"color\":\"#7099e6\",\"description\":\"Grant permissions\",\"execute-immediately?\":true,\"has-handler\":false,\"icon\":\"lock_white\",\"name\":\"grant-permissions\",\"params\":[]},\"password\":{\"color\":\"#7099e6\",\"description\":\"Password\",\"has-handler\":false,\"icon\":\"lock_white\",\"name\":\"password\",\"params\":[{\"hidden\":true,\"name\":\"password\",\"placeholder\":\"Type your password\",\"type\":\"password\"},{\"hidden\":true,\"name\":\"password-confirmation\",\"placeholder\":\"Confirm\",\"type\":\"password\"}],\"sequential-params\":true},\"phone\":{\"color\":\"#5bb2a2\",\"description\":\"Find friends using your number\",\"has-handler\":false,\"icon\":\"phone_white\",\"name\":\"phone\",\"params\":[{\"name\":\"phone\",\"placeholder\":\"Phone number\",\"type\":\"phone\"}],\"registered-only\":true,\"sequential-params\":true,\"title\":\"Send Phone Number\"}},\"subscriptions\":{}}}"))) + (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]) diff --git a/src/status_im/ui/screens/accounts/login/events.cljs b/src/status_im/ui/screens/accounts/login/events.cljs index 27b1572178..4f2f91750c 100644 --- a/src/status_im/ui/screens/accounts/login/events.cljs +++ b/src/status_im/ui/screens/accounts/login/events.cljs @@ -7,7 +7,8 @@ [status-im.utils.types :refer [json->clj]] [status-im.data-store.core :as data-store] [status-im.native-module.core :as status] - [status-im.constants :refer [console-chat-id]])) + [status-im.constants :refer [console-chat-id]] + [status-im.utils.config :as config])) ;;;; FX @@ -27,8 +28,13 @@ (reg-fx ::change-account (fn [[address new-account?]] - (data-store/change-account address new-account? - #(dispatch [:change-account-handler % address new-account?])))) + (js/setTimeout + (fn [] + (data-store/change-account address new-account? + #(dispatch [:change-account-handler % address new-account?]))) + ;; if we don't add delay when running app without status-go + ;; "null is not an object (evaluating 'realm.schema')" error appears + (if config/stub-status-go? 300 0)))) ;;;; Handlers