This commit is contained in:
Roman Volosovskyi 2017-02-22 11:01:17 +02:00
parent 37932bce74
commit d82bf5eeda
2 changed files with 17 additions and 14 deletions

View File

@ -96,8 +96,8 @@
(register-handler :received-message-when-commands-loaded
(u/side-effect!
(fn [db [_ chat-id message]]
(if (commands-loaded? db chat-id)
(fn [{:keys [status-node-started?] :as db} [_ chat-id message]]
(if (and status-node-started? (commands-loaded? db chat-id))
(dispatch [:received-message message])
(s/execute-later
#(dispatch [:received-message-when-commands-loaded chat-id message])

View File

@ -27,7 +27,8 @@
[status-im.i18n :refer [label]]
[status-im.constants :refer [console-chat-id]]
[status-im.utils.ethereum-network :as enet]
[status-im.utils.instabug :as inst]))
[status-im.utils.instabug :as inst]
[status-im.utils.platform :as p]))
;; -- Common --------------------------------------------------------------
@ -46,16 +47,14 @@
(assoc-in db [:animations k] v)))
(register-handler :initialize-db
(fn [{:keys [status-module-initialized? network-status network]} _]
(fn [{:keys [status-module-initialized? status-node-started?
network-status network]} _]
(data-store/init)
(cond-> (assoc app-db :current-account-id nil
:network-status network-status)
status-module-initialized?
(assoc :status-module-initialized? true)
true
(assoc :network (or network :testnet)))))
(assoc app-db :current-account-id nil
:network-status network-status
:status-module-initialized? (or p/ios? js/goog.DEBUG status-module-initialized?)
:status-node-started? status-node-started?
:network (or network :testnet))))
(register-handler :initialize-account-db
(fn [db _]
@ -129,9 +128,9 @@
(case type
"transaction.queued" (dispatch [:transaction-queued event])
"transaction.failed" (dispatch [:transaction-failed event])
"node.started" (log/debug "Event *node.started* received")
"node.started" (dispatch [:status-node-started!])
"module.initialized" (dispatch [:status-module-initialized!])
"local_storage.set" (dispatch [:set-local-storage event])
"local_storage.set" (dispatch [:set-local-storage event])
(log/debug "Event " type " not handled"))))))
(register-handler :status-module-initialized!
@ -141,6 +140,10 @@
(fn [db]
(assoc db :status-module-initialized? true)))
(register-handler :status-node-started!
(fn [db]
(assoc db :status-node-started? true)))
(register-handler :crypt-initialized
(u/side-effect!
(fn [_ _]