diff --git a/src/legacy/status_im/ens/core.cljs b/src/legacy/status_im/ens/core.cljs index b302498b97..edfdbe185d 100644 --- a/src/legacy/status_im/ens/core.cljs +++ b/src/legacy/status_im/ens/core.cljs @@ -88,6 +88,15 @@ {:chainId :chain-id :removed :removed?}) name-details)] + (let [new-db (reduce (fn [db {:keys [username removed? chain-id] :as name-detail}] + (if removed? + (update-in db [:ens/names chain-id] dissoc username) + (let [old (get-in db [:ens/names chain-id username])] + (assoc-in db [:ens/names chain-id username] (merge old name-detail))))) + db + name-details)] + (prn "new db" new-db) + ) {:db (reduce (fn [db {:keys [username removed? chain-id] :as name-detail}] (if removed? (update-in db [:ens/names chain-id] dissoc username) diff --git a/src/native_module/core.cljs b/src/native_module/core.cljs index 4a2b5109f6..4bbaf0dfc8 100644 --- a/src/native_module/core.cljs +++ b/src/native_module/core.cljs @@ -37,10 +37,8 @@ (defn ui-helper [] - (if false - (when (exists? (.-NativeModules react-native)) - (.-UIHelper ^js (.-NativeModules react-native))) - status-backend/fetch-js-obj)) + (when (exists? (.-NativeModules react-native)) + (.-UIHelper ^js (.-NativeModules react-native)))) (defn log-manager [] @@ -208,9 +206,7 @@ (defn call-private-rpc [payload callback] - (if false - (.callPrivateRPC ^js (network) payload callback) - (status-backend/call-private-rpc payload callback))) + (.callPrivateRPC ^js (network) payload callback)) (defn hash-transaction "used for keycard" @@ -362,7 +358,9 @@ (log/debug "[native-module] set-blank-preview-flag") ;; Sometimes the app crashes during logout because `flag` is nil. (when-not (nil? flag) - (.setBlankPreviewFlag ^js (encryption) flag))) + (.setBlankPreviewFlag ^js (when (exists? (.-NativeModules react-native)) + (.-EncryptionUtils ^js (.-NativeModules react-native))) + flag))) (defn get-device-model-info [] @@ -441,10 +439,11 @@ (defn sha3 [s] (log/debug "[native-module] sha3") - (let [temp-encryption (when (exists? (.-NativeModules react-native)) - (.-EncryptionUtils ^js (.-NativeModules react-native)))] - (when s - (.sha3 ^js temp-encryption (str s))))) + (time + (let [temp-encryption (when (exists? (.-NativeModules react-native)) + (.-EncryptionUtils ^js (.-NativeModules react-native)))] + (when s + (.sha3 ^js temp-encryption (str s)))))) (defn utf8-to-hex [s] @@ -481,7 +480,9 @@ (defn to-checksum-address [address] (log/debug "[native-module] to-checksum-address") - (.toChecksumAddress ^js (utils) address)) + (.toChecksumAddress ^js (when (exists? (.-NativeModules react-native)) + (.-Utils ^js (.-NativeModules react-native))) + address)) (defn validate-mnemonic "Validate that a mnemonic conforms to BIP39 dictionary/checksum standards" diff --git a/src/status_backend/config.cljs b/src/status_backend/config.cljs index b9c61abfbb..b70059b305 100644 --- a/src/status_backend/config.cljs +++ b/src/status_backend/config.cljs @@ -17,8 +17,8 @@ "Content-Type" "application/json"}}) ;; This dir musts exist before running the app -(def data-dir-path "/home/ulises/p/status-go/test-db") +(def data-dir-path "/home/ulises/p/status-go/1_test-db") -(def keystore-dir-path (str data-dir-path "/keystore")) -(def log-dir-path (str data-dir-path "/log")) -(def log-request-file-path (str data-dir-path "/request.log")) +(def keystore-dir-path "/home/ulises/p/status-go/1_test-db/1_keystore") +(def log-dir-path "/home/ulises/p/status-go/requests.log") +(def log-request-file-path (str data-dir-path "/requests.log")) diff --git a/src/status_backend/core.cljs b/src/status_backend/core.cljs index e83d5e96f7..1b9065033d 100644 --- a/src/status_backend/core.cljs +++ b/src/status_backend/core.cljs @@ -8,10 +8,13 @@ (defn fetch ([endpoint] + (println (str ".......................... 1-----: " endpoint)) (fetch endpoint nil (fn []))) ([endpoint body-params] + (println (str ".......................... 2-----: " endpoint)) (fetch endpoint body-params (fn []))) ([endpoint body-params callback] + (println (str "========================== > INVOKE: " endpoint "::" (prn-str body-params))) (let [url (str config/status-go-url endpoint) params (assoc config/fetch-default-params :body body-params)] (network/fetch url params callback)))) @@ -36,15 +39,18 @@ (defn init-web-socket [on-message] (defonce web-socket (js/WebSocket. config/signals-url)) (oops/oset! web-socket "onopen" #(log/debug "[backend] Web Socket connected")) - (oops/oset! web-socket "onmessage" #(-> % (oops/oget "data") (on-message))) + (oops/oset! web-socket "onmessage" (fn [e] + (println " NEW WEBSOCKET MESSAGE! -- START") + (-> e (oops/oget "data") (on-message)) + (println " NEW WEBSOCKET MESSAGE! -- END"))) (oops/oset! web-socket "onerror" #(log/error "[backend] Web Socket error" %)) (oops/oset! web-socket "onclose" #(log/error "[backend] Web Socket closed" %))) -(defn call-private-rpc [payload callback] - ;; NOTE: according to the status-backend readme, we call RPCs using the `CallRPC` - ;; endpoint, instead of using `CallPrivateRPC` as in mobile. - (fetch "CallRPC" payload callback)) +;(defn call-private-rpc [payload callback] +; ;; NOTE: according to the status-backend readme, we call RPCs using the `CallRPC` +; ;; endpoint, instead of using `CallPrivateRPC` as in mobile. +; (fetch "CallRPC" payload callback)) (comment ;; Useful REPL commands (will be removed) diff --git a/src/status_im/common/signals/events.cljs b/src/status_im/common/signals/events.cljs index d3f49327f7..428f88499f 100644 --- a/src/status_im/common/signals/events.cljs +++ b/src/status_im/common/signals/events.cljs @@ -25,14 +25,15 @@ (rf/defn process {:events [:signals/signal-received]} [{:keys [db] :as cofx} event-str] + (println (str "<<<<<<<<<<<<<<<<<<<<<<<<<< SIGNAL: " (prn-str event-str))) ;; We only convert to clojure when strictly necessary or we know it ;; won't impact performance, as it is a fairly costly operation on large-ish ;; data structures (let [^js data (.parse js/JSON event-str) ^js event-js (.-event data) type (.-type data)] - ;(log/debug "Signal received" {:type type}) - ;(log/trace "Signal received" {:payload event-str}) + (log/debug "Signal received" {:type type}) + (log/trace "Signal received" {:payload event-str}) (case type "wallet" {:fx [[:dispatch [:wallet/signal-received event-js]]]} @@ -108,6 +109,4 @@ "backup.performed" {:db (assoc-in db [:profile/profile :last-backup] (oops/oget event-js :lastBackup))} - (do - #_(log/debug "Event " type " not handled") - nil)))) + (log/debug "Event " type " not handled")))) diff --git a/src/status_im/contexts/onboarding/events.cljs b/src/status_im/contexts/onboarding/events.cljs index a17f28b1f7..1919e1e46f 100644 --- a/src/status_im/contexts/onboarding/events.cljs +++ b/src/status_im/contexts/onboarding/events.cljs @@ -87,7 +87,7 @@ :screen/onboarding.new-to-status)]]] (when-not syncing-account-recovered? [:dispatch [:syncing/clear-syncing-installation-id]])] - :dispatch-later [{:ms constants/onboarding-generating-keys-animation-duration-ms + :dispatch-later [#_{:ms constants/onboarding-generating-keys-animation-duration-ms :dispatch [:navigate-to-within-stack [:screen/onboarding.enable-notifications loading-screen]]}] diff --git a/src/status_im/contexts/onboarding/generating_keys/view.cljs b/src/status_im/contexts/onboarding/generating_keys/view.cljs index 7877b96fa6..d9206270bb 100644 --- a/src/status_im/contexts/onboarding/generating_keys/view.cljs +++ b/src/status_im/contexts/onboarding/generating_keys/view.cljs @@ -65,7 +65,7 @@ (defn title [] - (let [generate-keys-opacity (reanimated/use-shared-value 1) + #_(let [generate-keys-opacity (reanimated/use-shared-value 1) saving-keys-opacity (reanimated/use-shared-value 0) keys-saved-opacity (reanimated/use-shared-value 0)] (sequence-animation generate-keys-opacity saving-keys-opacity keys-saved-opacity) @@ -86,7 +86,8 @@ {:style (reanimated/apply-animations-to-style {:opacity keys-saved-opacity} style/title-style)} - [keys-saved-title]]])) + [keys-saved-title]]]) + ) (defn content [] diff --git a/src/status_im/contexts/profile/login/events.cljs b/src/status_im/contexts/profile/login/events.cljs index eac82330a2..7f046a571a 100644 --- a/src/status_im/contexts/profile/login/events.cljs +++ b/src/status_im/contexts/profile/login/events.cljs @@ -156,7 +156,9 @@ {:db (update db :profile/login #(-> % (dissoc :processing) (assoc :error error)))} {:db (dissoc db :profile/login) :fx [(when (and new-account? (not recovered-account?)) - [:dispatch-later [{:ms 1000 :dispatch [:wallet-legacy/set-initial-blocks-range]}]]) + ;; INVALID EVENT: + ;[:dispatch-later [{:ms 1000 :dispatch [:wallet-legacy/set-initial-blocks-range]}]] + ) [:dispatch-later [{:ms 2000 :dispatch [:ens/update-usernames ensUsernames]}]] [:dispatch [:profile.login/login-existing-profile settings account]]]}))) diff --git a/src/status_im/contexts/wallet/signals.cljs b/src/status_im/contexts/wallet/signals.cljs index 2d1f882c20..0c86278d84 100644 --- a/src/status_im/contexts/wallet/signals.cljs +++ b/src/status_im/contexts/wallet/signals.cljs @@ -89,7 +89,7 @@ ;; RN to dispatch the network status update, otherwise when going ;; offline the user will immediately see a toast saying "provider ;; X is down". - [{:ms 500 + [{:ms 50000 :dispatch [:wallet/blockchain-status-changed (transforms/js->clj event-js)]}]]]} diff --git a/src/utils/re_frame.cljs b/src/utils/re_frame.cljs index f80f301fa7..1f85e18d7d 100644 --- a/src/utils/re_frame.cljs +++ b/src/utils/re_frame.cljs @@ -22,7 +22,7 @@ (reset! handler-nesting-level 0)) (when rf.interop/debug-enabled? (do - #_(log/debug "Handling re-frame event: " + (log/debug "Handling re-frame event: " (first (interceptor/get-coeffect context :event))) nil)) context)))