schedule :check-sync outside callback (which can be not called after locking/unlocking phone)
This commit is contained in:
parent
45a08d7643
commit
ec469f59b1
|
@ -74,18 +74,17 @@
|
||||||
(when (and (not= sync-data state) (= :in-progress new-state))
|
(when (and (not= sync-data state) (= :in-progress new-state))
|
||||||
(dispatch [:set :sync-data state]))
|
(dispatch [:set :sync-data state]))
|
||||||
(when (not= sync-state new-state)
|
(when (not= sync-state new-state)
|
||||||
(dispatch [:set :sync-state new-state]))
|
(dispatch [:set :sync-state new-state]))))))
|
||||||
(let [timeout (if (#{:done :synced} new-state) 60 10)]
|
|
||||||
(s/execute-later #(dispatch [:check-sync]) (s/s->ms timeout)))))))
|
|
||||||
|
|
||||||
(register-handler :check-sync
|
(register-handler :check-sync
|
||||||
(u/side-effect!
|
(u/side-effect!
|
||||||
(fn [{:keys [web3] :as db}]
|
(fn [{:keys [web3] :as db}]
|
||||||
(if web3
|
(if web3
|
||||||
(.getSyncing
|
(do (.getSyncing
|
||||||
(.-eth web3)
|
(.-eth web3)
|
||||||
(fn [error sync]
|
(fn [error sync]
|
||||||
(dispatch [:update-sync-state error sync])))
|
(dispatch [:update-sync-state error sync])))
|
||||||
|
(s/execute-later #(dispatch [:check-sync]) (s/s->ms 10)))
|
||||||
(s/execute-later #(dispatch [:check-sync]) (s/s->ms 10))))))
|
(s/execute-later #(dispatch [:check-sync]) (s/s->ms 10))))))
|
||||||
|
|
||||||
(register-handler :initialize-sync-listener
|
(register-handler :initialize-sync-listener
|
||||||
|
|
Loading…
Reference in New Issue