diff --git a/src/status_im/events.cljs b/src/status_im/events.cljs index 0d525ffffb..9531047525 100644 --- a/src/status_im/events.cljs +++ b/src/status_im/events.cljs @@ -698,11 +698,6 @@ (fn [cofx _] (protocol/handle-close-app-confirmed cofx))) -(handlers/register-handler-fx - :protocol/state-sync-timed-out - (fn [cofx _] - (protocol/check-sync-state cofx))) - ;; notifications module (handlers/register-handler-fx diff --git a/src/status_im/protocol/core.cljs b/src/status_im/protocol/core.cljs index 43ed9e2593..eb9a9dc78e 100644 --- a/src/status_im/protocol/core.cljs +++ b/src/status_im/protocol/core.cljs @@ -9,9 +9,9 @@ [status-im.transport.core :as transport] [status-im.tribute-to-talk.core :as tribute-to-talk] [status-im.utils.fx :as fx] - [status-im.utils.semaphores :as semaphores] [status-im.utils.utils :as utils])) +;;TODO move this logic to status-go (fx/defn update-sync-state [{{:keys [sync-state sync-data] :as db} :db} error sync] (let [{:keys [highestBlock currentBlock] :as state} @@ -39,30 +39,6 @@ (update-sync-state error sync) (node/update-sync-state error sync))) -(fx/defn check-sync-state - [{:keys [db] :as cofx}] - (if (:multiaccount db) - {::json-rpc/call - [{:method "eth_syncing" - :on-success - (fn [sync] - (re-frame/dispatch [:ethereum.callback/get-syncing-success nil sync])) - :on-error - (fn [error] - (re-frame/dispatch [:ethereum.callback/get-syncing-success error nil]))}] - :utils/dispatch-later [{:ms 10000 - :dispatch [:protocol/state-sync-timed-out]}]} - (semaphores/free cofx :check-sync-state?))) - -(fx/defn start-check-sync-state - [{{:keys [:networks/current-network :networks/networks] :as db} :db :as cofx}] - (when (and (not (semaphores/locked? cofx :check-sync-state?)) - (not (ethereum/network-with-upstream-rpc? - (get networks current-network)))) - (fx/merge cofx - (check-sync-state) - (semaphores/lock :check-sync-state?)))) - (fx/defn initialize-protocol [{:data-store/keys [mailserver-topics mailservers] :keys [db] :as cofx}] @@ -87,7 +63,6 @@ :fetched-network-id fetched-network-id}) #(re-frame/dispatch [:protocol.ui/close-app-confirmed]))))}]} (tribute-to-talk/init) - (start-check-sync-state) (mailserver/initialize-ranges) (mailserver/initialize-mailserver mailservers) (transport/init-whisper)))) diff --git a/src/status_im/ui/screens/db.cljs b/src/status_im/ui/screens/db.cljs index 1717f00e1b..f0ea49af9b 100644 --- a/src/status_im/ui/screens/db.cljs +++ b/src/status_im/ui/screens/db.cljs @@ -38,7 +38,6 @@ :node-info {} :peers-summary [] :notifications {} - :semaphores #{} :my-profile/editing? false :transport/filters {} :transport/message-envelopes {} @@ -174,8 +173,6 @@ ;; PUSH NOTIFICATIONS (spec/def :push-notifications/stored (spec/nilable map?)) -(spec/def ::semaphores set?) - (spec/def ::hardwallet (spec/nilable map?)) (spec/def :stickers/packs (spec/nilable map?)) @@ -287,7 +284,6 @@ ::chain ::app-state ::app-in-background-since - ::semaphores ::hardwallet :multiaccount/multiaccount :navigation/view-id diff --git a/src/status_im/utils/semaphores.cljs b/src/status_im/utils/semaphores.cljs deleted file mode 100644 index f1f5fd49f4..0000000000 --- a/src/status_im/utils/semaphores.cljs +++ /dev/null @@ -1,14 +0,0 @@ -(ns status-im.utils.semaphores - (:require [status-im.utils.fx :as fx])) - -(fx/defn lock [{:keys [db]} semaphore] - #_{:pre [(keyword? semaphore)]} - {:db (update db :semaphores conj semaphore)}) - -(fx/defn free [{:keys [db]} semaphore] - #_{:pre [(keyword? semaphore)]} - {:db (update db :semaphores disj semaphore)}) - -(defn locked? [{:keys [db]} semaphore] - #_{:pre [(keyword? semaphore)]} - ((get db :semaphores) semaphore)) diff --git a/test/cljs/status_im/test/sign_in/flow.cljs b/test/cljs/status_im/test/sign_in/flow.cljs index 34bde7818f..086a44af72 100644 --- a/test/cljs/status_im/test/sign_in/flow.cljs +++ b/test/cljs/status_im/test/sign_in/flow.cljs @@ -28,8 +28,7 @@ (testing ":accounts.login.callback/login-success event received." (let [db {:multiaccounts/login {:address "address" :password "password"} - :multiaccount data/multiaccount - :semaphores #{}} + :multiaccount data/multiaccount} cofx {:db db :data-store/mailservers [] :data-store/mailserver-topics data/topics} diff --git a/test/cljs/status_im/test/transport/core.cljs b/test/cljs/status_im/test/transport/core.cljs index 27276b7932..7a550e4f5b 100644 --- a/test/cljs/status_im/test/transport/core.cljs +++ b/test/cljs/status_im/test/transport/core.cljs @@ -6,8 +6,7 @@ [status-im.transport.message.core :as message])) (deftest init-whisper - (let [cofx {:db {:multiaccount {:public-key "1"} - :semaphores #{}}}] + (let [cofx {:db {:multiaccount {:public-key "1"}}}] (testing "custom mailservers" (let [ms-1 {:id "1" :fleet :eth.beta