[17634] Start rendering syncing UI ASAP (#17755)
* Start rendering syncing UI ASAP * Consolidating values * fix: show syncing ui immediately * fix: error validation --------- Co-authored-by: balogunofafrica <balogunakanbi.k@gmail.com>
This commit is contained in:
parent
87c9946092
commit
1b745857e8
|
@ -2,6 +2,7 @@
|
||||||
(:require
|
(:require
|
||||||
[clojure.string :as string]
|
[clojure.string :as string]
|
||||||
[native-module.core :as native-module]
|
[native-module.core :as native-module]
|
||||||
|
[quo.foundations.colors :as colors]
|
||||||
[re-frame.core :as re-frame]
|
[re-frame.core :as re-frame]
|
||||||
[react-native.platform :as platform]
|
[react-native.platform :as platform]
|
||||||
[status-im.data-store.settings :as data-store.settings]
|
[status-im.data-store.settings :as data-store.settings]
|
||||||
|
@ -36,6 +37,26 @@
|
||||||
:custom-bootnodes-enabled? false}}]
|
:custom-bootnodes-enabled? false}}]
|
||||||
(node/get-multiaccount-node-config db)))
|
(node/get-multiaccount-node-config db)))
|
||||||
|
|
||||||
|
(defn- extract-error
|
||||||
|
[json-str]
|
||||||
|
(-> json-str
|
||||||
|
transforms/json->clj
|
||||||
|
(get :error "")
|
||||||
|
not-empty))
|
||||||
|
|
||||||
|
(defn- input-connection-string-callback
|
||||||
|
[res]
|
||||||
|
(log/info "[local-pairing] input-connection-string-for-bootstrapping callback"
|
||||||
|
{:response res
|
||||||
|
:event :syncing/input-connection-string-for-bootstrapping})
|
||||||
|
(let [error (when (extract-error res)
|
||||||
|
(str "generic-error: " res))]
|
||||||
|
(when (some? error)
|
||||||
|
(rf/dispatch [:toasts/upsert
|
||||||
|
{:icon :i/alert
|
||||||
|
:icon-color colors/danger-50
|
||||||
|
:text error}]))))
|
||||||
|
|
||||||
(rf/defn preflight-outbound-check-for-local-pairing
|
(rf/defn preflight-outbound-check-for-local-pairing
|
||||||
{:events [:syncing/preflight-outbound-check]}
|
{:events [:syncing/preflight-outbound-check]}
|
||||||
[_ set-checks-passed]
|
[_ set-checks-passed]
|
||||||
|
@ -60,19 +81,18 @@
|
||||||
(fn [final-node-config]
|
(fn [final-node-config]
|
||||||
(let [config-map (.stringify js/JSON
|
(let [config-map (.stringify js/JSON
|
||||||
(clj->js
|
(clj->js
|
||||||
{:receiverConfig {:kdfIterations config/default-kdf-iterations
|
{:receiverConfig
|
||||||
:nodeConfig final-node-config
|
{:kdfIterations config/default-kdf-iterations
|
||||||
:settingCurrentNetwork config/default-network
|
:nodeConfig final-node-config
|
||||||
:deviceType platform/os
|
:settingCurrentNetwork config/default-network
|
||||||
:deviceName
|
:deviceType platform/os
|
||||||
(native-module/get-installation-name)}}))]
|
:deviceName
|
||||||
|
(native-module/get-installation-name)}}))]
|
||||||
(rf/dispatch [:syncing/update-role constants/local-pairing-role-receiver])
|
(rf/dispatch [:syncing/update-role constants/local-pairing-role-receiver])
|
||||||
(native-module/input-connection-string-for-bootstrapping
|
(native-module/input-connection-string-for-bootstrapping
|
||||||
connection-string
|
connection-string
|
||||||
config-map
|
config-map
|
||||||
#(log/info "Initiated local pairing"
|
input-connection-string-callback)))]
|
||||||
{:response %
|
|
||||||
:event :syncing/input-connection-string-for-bootstrapping}))))]
|
|
||||||
(native-module/prepare-dir-and-update-config "" default-node-config-string callback)))
|
(native-module/prepare-dir-and-update-config "" default-node-config-string callback)))
|
||||||
|
|
||||||
(rf/defn preparations-for-connection-string
|
(rf/defn preparations-for-connection-string
|
||||||
|
|
Loading…
Reference in New Issue