Remove :node/status leftovers

This commit is contained in:
yenda 2019-08-23 11:17:54 +02:00
parent 8e3624e87b
commit d183cfe125
No known key found for this signature in database
GPG Key ID: 0095623C0069DCE6
10 changed files with 23 additions and 45 deletions

View File

@ -1592,8 +1592,7 @@
(fx/defn on-generate-and-load-key-success (fx/defn on-generate-and-load-key-success
[{:keys [db random-guid-generator] :as cofx} data] [{:keys [db random-guid-generator] :as cofx} data]
(let [account-data (js->clj data :keywordize-keys true) (let [account-data (js->clj data :keywordize-keys true)
flow (get-in db [:hardwallet :flow]) flow (get-in db [:hardwallet :flow])]
node-started? (= :started (:node/status db))]
(fx/merge cofx (fx/merge cofx
{:db (-> db {:db (-> db
(assoc-in [:hardwallet :multiaccount] (-> account-data (assoc-in [:hardwallet :multiaccount] (-> account-data

View File

@ -113,7 +113,8 @@
:confirm-button-text (i18n/label :recovery-confirm-phrase) :confirm-button-text (i18n/label :recovery-confirm-phrase)
:on-accept #(re-frame/dispatch [::recover-multiaccount-confirmed])}})))) :on-accept #(re-frame/dispatch [::recover-multiaccount-confirmed])}}))))
(fx/defn navigate-to-recover-multiaccount-screen [{:keys [db] :as cofx}] (fx/defn navigate-to-recover-multiaccount-screen
[{:keys [db] :as cofx}]
(fx/merge cofx (fx/merge cofx
{:db (dissoc db :multiaccounts/recover)} {:db (dissoc db :multiaccounts/recover)}
(navigation/navigate-to-cofx :recover-multiaccount nil))) (navigation/navigate-to-cofx :recover-multiaccount nil)))

View File

@ -194,7 +194,7 @@
(re-frame/reg-fx (re-frame/reg-fx
:node/les-show-debug-info :node/les-show-debug-info
(fn [[multiaccount chain-sync-state]] (fn [[multiaccount]]
#_(.getBalance #_(.getBalance
(.-eth eb3) (.-eth eb3)
(:address multiaccount) (:address multiaccount)
@ -212,5 +212,5 @@
"* eth_getSyncing=" (or chain-sync-state "false"))))))))) "* eth_getSyncing=" (or chain-sync-state "false")))))))))
(defn display-les-debug-info (defn display-les-debug-info
[{{:keys [multiaccount] :node/keys [chain-sync-state]} :db}] [{{:keys [multiaccount]} :db}]
{:node/les-show-debug-info [multiaccount]}) {:node/les-show-debug-info [multiaccount]})

View File

@ -16,10 +16,6 @@
[{db :db :as cofx} event] [{db :db :as cofx} event]
(login/multiaccount-login-success cofx)) (login/multiaccount-login-success cofx))
(fx/defn status-node-stopped
[{db :db}]
{:db (assoc db :node/status :stopped)})
(fx/defn summary (fx/defn summary
[{:keys [db] :as cofx} peers-summary] [{:keys [db] :as cofx} peers-summary]
(let [previous-summary (:peers-summary db) (let [previous-summary (:peers-summary db)
@ -35,7 +31,6 @@
(let [{:keys [type event]} (types/json->clj event-str)] (let [{:keys [type event]} (types/json->clj event-str)]
(case type (case type
"node.login" (status-node-started cofx event) "node.login" (status-node-started cofx event)
"node.stopped" (status-node-stopped cofx)
"envelope.sent" (transport.message/update-envelopes-status cofx (:ids event) :sent) "envelope.sent" (transport.message/update-envelopes-status cofx (:ids event) :sent)
"envelope.expired" (transport.message/update-envelopes-status cofx (:ids event) :not-sent) "envelope.expired" (transport.message/update-envelopes-status cofx (:ids event) :not-sent)
"bundles.added" (pairing/handle-bundles-added cofx event) "bundles.added" (pairing/handle-bundles-added cofx event)

View File

@ -71,7 +71,6 @@
(reg-root-key-sub :peers-count :peers-count) (reg-root-key-sub :peers-count :peers-count)
(reg-root-key-sub :about-app/node-info :node-info) (reg-root-key-sub :about-app/node-info :node-info)
(reg-root-key-sub :peers-summary :peers-summary) (reg-root-key-sub :peers-summary :peers-summary)
(reg-root-key-sub :node-status :node/status)
(reg-root-key-sub :tab-bar-visible? :tab-bar-visible?) (reg-root-key-sub :tab-bar-visible? :tab-bar-visible?)
(reg-root-key-sub :dimensions/window :dimensions/window) (reg-root-key-sub :dimensions/window :dimensions/window)
(reg-root-key-sub :initial-props :initial-props) (reg-root-key-sub :initial-props :initial-props)
@ -341,11 +340,9 @@
(re-frame/reg-sub (re-frame/reg-sub
:sign-in-enabled? :sign-in-enabled?
:<- [:multiaccounts/login] :<- [:multiaccounts/login]
:<- [:node-status] (fn [{:keys [password]}]
(fn [[{:keys [password]} status]] (spec/valid? ::multiaccounts.db/password
(and (or (nil? status) (= status :stopped)) (security/safe-unmask-data password))))
(spec/valid? ::multiaccounts.db/password
(security/safe-unmask-data password)))))
(re-frame/reg-sub (re-frame/reg-sub
:settings/current-fleet :settings/current-fleet

View File

@ -78,9 +78,6 @@
(spec/def ::web3-node-version (spec/nilable string?)) (spec/def ::web3-node-version (spec/nilable string?))
;;object? ;;object?
(spec/def ::webview-bridge (spec/nilable any?)) (spec/def ::webview-bridge (spec/nilable any?))
(spec/def :node/status (spec/nilable #{:stopped :starting :started :stopping}))
(spec/def :node/node-restart? (spec/nilable boolean?))
(spec/def :node/address (spec/nilable string?))
;;height of native keyboard if shown ;;height of native keyboard if shown
(spec/def ::keyboard-height (spec/nilable number?)) (spec/def ::keyboard-height (spec/nilable number?))
@ -97,9 +94,6 @@
(spec/def ::sync-state (spec/nilable #{:pending :in-progress :synced :done :offline})) (spec/def ::sync-state (spec/nilable #{:pending :in-progress :synced :done :offline}))
(spec/def ::sync-data (spec/nilable map?)) (spec/def ::sync-data (spec/nilable map?))
;; contents of eth_syncing or `nil` if the node isn't syncing now
(spec/def :node/chain-sync-state (spec/nilable map?))
;;;;NAVIGATION ;;;;NAVIGATION
;;current view ;;current view
@ -228,8 +222,6 @@
:networks/networks :networks/networks
:networks/manage :networks/manage
:bootnodes/manage :bootnodes/manage
:node/status
:node/chain-sync-state
:universal-links/url :universal-links/url
:push-notifications/stored :push-notifications/stored
:browser/browsers :browser/browsers

View File

@ -93,18 +93,18 @@
(defn connection-status (defn connection-status
"generates a composite message of the current connection state given peer and mailserver statuses" "generates a composite message of the current connection state given peer and mailserver statuses"
[peers-count node-status mailserver-state peers-disconnected?] [peers-count mailserver-state peers-disconnected?]
;; TODO probably not ideal criteria for searching ;; TODO probably not ideal criteria for searching
;; ask about directly calling rpc method to find discovery.started ;; ask about directly calling rpc method to find discovery.started
(let [searching? (= :starting node-status) (let [peers-connected? (not peers-disconnected?)
peers-connected? (not peers-disconnected?)
mailserver-connected? (= :connected mailserver-state)] mailserver-connected? (= :connected mailserver-state)]
(cond (cond
(and peers-connected? searching?) "Connected and searching" (and peers-connected? (not mailserver-connected?))
(and peers-connected? (not mailserver-connected?)) (str "Connected with " peers-count " peers") (str "Connected with " peers-count " peers")
(and peers-connected? mailserver-connected?) (str "Connected with " peers-count " peers including mailserver.") (and peers-connected? mailserver-connected?)
(and peers-disconnected? searching?) "Disconnected and searching" (str "Connected with " peers-count " peers including mailserver.")
:else "Disconnected"))) :else
"Disconnected")))
(defn connection-statistics-display (defn connection-statistics-display
[{:keys [mailserver-request-process-time [{:keys [mailserver-request-process-time
@ -157,7 +157,6 @@
mailservers [:mailserver/fleet-mailservers] mailservers [:mailserver/fleet-mailservers]
mailserver-state [:mailserver/state] mailserver-state [:mailserver/state]
preferred-mailserver-id [:mailserver/preferred-id] preferred-mailserver-id [:mailserver/preferred-id]
node-status [:node-status]
peers-count [:peers-count] peers-count [:peers-count]
connection-stats [:connection-stats] connection-stats [:connection-stats]
disconnected [:disconnected?]] disconnected [:disconnected?]]
@ -167,7 +166,7 @@
datasync? (:datasync? settings) datasync? (:datasync? settings)
v1-messages? (:datasync? settings) v1-messages? (:datasync? settings)
disable-discovery-topic? (:disable-discovery-topic? settings) disable-discovery-topic? (:disable-discovery-topic? settings)
connection-message (connection-status peers-count node-status mailserver-state disconnected)] connection-message (connection-status peers-count mailserver-state disconnected)]
[react/scroll-view [react/scroll-view
[react/text {:style styles/advanced-settings-title} [react/text {:style styles/advanced-settings-title}
(i18n/label :advanced-settings)] (i18n/label :advanced-settings)]

View File

@ -1,6 +1,7 @@
(ns status-im.ui.screens.keycard.recovery.views (ns status-im.ui.screens.keycard.recovery.views
(:require-macros [status-im.utils.views :refer [defview letsubs]]) (:require-macros [status-im.utils.views :refer [defview letsubs]])
(:require [status-im.ui.components.react :as react] (:require [status-im.multiaccounts.recover.core :as multiaccounts.recover]
[status-im.ui.components.react :as react]
[status-im.ui.screens.keycard.styles :as styles] [status-im.ui.screens.keycard.styles :as styles]
[status-im.ui.screens.keycard.views :as views] [status-im.ui.screens.keycard.views :as views]
[status-im.ui.components.toolbar.actions :as actions] [status-im.ui.components.toolbar.actions :as actions]
@ -25,7 +26,7 @@
:style {:margin-top 32}} :style {:margin-top 32}}
(toolbar/nav-button (toolbar/nav-button
(actions/back #(re-frame/dispatch (actions/back #(re-frame/dispatch
[:recover.ui/cancel-pressed]))) [::multiaccounts.recover/cancel-pressed])))
nil] nil]
[react/view {:flex 1 [react/view {:flex 1
:flex-direction :column :flex-direction :column
@ -320,4 +321,3 @@
:padding-top 27 :padding-top 27
:color colors/blue}} :color colors/blue}}
(i18n/label :t/cancel)]]]]])) (i18n/label :t/cancel)]]]]]))

View File

@ -71,17 +71,13 @@
:ref #(reset! inp-ref %)}]])) :ref #(reset! inp-ref %)}]]))
(defview recover [] (defview recover []
(letsubs [recovered-multiaccount [:get-recover-multiaccount] (letsubs [recovered-multiaccount [:get-recover-multiaccount]]
node-status? [:node-status]]
(let [{:keys [passphrase password passphrase-valid? password-valid? (let [{:keys [passphrase password passphrase-valid? password-valid?
password-error passphrase-error passphrase-warning processing?]} recovered-multiaccount password-error passphrase-error passphrase-warning processing?]} recovered-multiaccount
node-stopped? (or (nil? node-status?)
(= :stopped node-status?))
valid-form? (and password-valid? passphrase-valid?) valid-form? (and password-valid? passphrase-valid?)
disabled? (or (not recovered-multiaccount) disabled? (or (not recovered-multiaccount)
processing? processing?
(not valid-form?) (not valid-form?))
(not node-stopped?))
sign-in #(re-frame/dispatch [::multiaccounts.recover/sign-in-button-pressed])] sign-in #(re-frame/dispatch [::multiaccounts.recover/sign-in-button-pressed])]
[react/keyboard-avoiding-view {:style styles/screen-container} [react/keyboard-avoiding-view {:style styles/screen-container}
[status-bar/status-bar] [status-bar/status-bar]

View File

@ -64,8 +64,7 @@
:chats/loading? :chats/loading?
:desktop/desktop :desktop/desktop
:dimensions/window :dimensions/window
:my-profile/editing? :my-profile/editing?]))]
:node/status]))]
{:logs/archive-logs [db-json ::send-email]})) {:logs/archive-logs [db-json ::send-email]}))
(fx/defn show-logs-dialog (fx/defn show-logs-dialog