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
[{:keys [db random-guid-generator] :as cofx} data]
(let [account-data (js->clj data :keywordize-keys true)
flow (get-in db [:hardwallet :flow])
node-started? (= :started (:node/status db))]
flow (get-in db [:hardwallet :flow])]
(fx/merge cofx
{:db (-> db
(assoc-in [:hardwallet :multiaccount] (-> account-data

View File

@ -113,7 +113,8 @@
:confirm-button-text (i18n/label :recovery-confirm-phrase)
: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
{:db (dissoc db :multiaccounts/recover)}
(navigation/navigate-to-cofx :recover-multiaccount nil)))

View File

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

View File

@ -16,10 +16,6 @@
[{db :db :as cofx} event]
(login/multiaccount-login-success cofx))
(fx/defn status-node-stopped
[{db :db}]
{:db (assoc db :node/status :stopped)})
(fx/defn summary
[{:keys [db] :as cofx} peers-summary]
(let [previous-summary (:peers-summary db)
@ -35,7 +31,6 @@
(let [{:keys [type event]} (types/json->clj event-str)]
(case type
"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.expired" (transport.message/update-envelopes-status cofx (:ids event) :not-sent)
"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 :about-app/node-info :node-info)
(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 :dimensions/window :dimensions/window)
(reg-root-key-sub :initial-props :initial-props)
@ -341,11 +340,9 @@
(re-frame/reg-sub
:sign-in-enabled?
:<- [:multiaccounts/login]
:<- [:node-status]
(fn [[{:keys [password]} status]]
(and (or (nil? status) (= status :stopped))
(spec/valid? ::multiaccounts.db/password
(security/safe-unmask-data password)))))
(fn [{:keys [password]}]
(spec/valid? ::multiaccounts.db/password
(security/safe-unmask-data password))))
(re-frame/reg-sub
:settings/current-fleet

View File

@ -78,9 +78,6 @@
(spec/def ::web3-node-version (spec/nilable string?))
;;object?
(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
(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-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
;;current view
@ -228,8 +222,6 @@
:networks/networks
:networks/manage
:bootnodes/manage
:node/status
:node/chain-sync-state
:universal-links/url
:push-notifications/stored
:browser/browsers

View File

@ -93,18 +93,18 @@
(defn connection-status
"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
;; ask about directly calling rpc method to find discovery.started
(let [searching? (= :starting node-status)
peers-connected? (not peers-disconnected?)
(let [peers-connected? (not peers-disconnected?)
mailserver-connected? (= :connected mailserver-state)]
(cond
(and peers-connected? searching?) "Connected and searching"
(and peers-connected? (not mailserver-connected?)) (str "Connected with " peers-count " peers")
(and peers-connected? mailserver-connected?) (str "Connected with " peers-count " peers including mailserver.")
(and peers-disconnected? searching?) "Disconnected and searching"
:else "Disconnected")))
(and peers-connected? (not mailserver-connected?))
(str "Connected with " peers-count " peers")
(and peers-connected? mailserver-connected?)
(str "Connected with " peers-count " peers including mailserver.")
:else
"Disconnected")))
(defn connection-statistics-display
[{:keys [mailserver-request-process-time
@ -157,7 +157,6 @@
mailservers [:mailserver/fleet-mailservers]
mailserver-state [:mailserver/state]
preferred-mailserver-id [:mailserver/preferred-id]
node-status [:node-status]
peers-count [:peers-count]
connection-stats [:connection-stats]
disconnected [:disconnected?]]
@ -167,7 +166,7 @@
datasync? (:datasync? settings)
v1-messages? (:datasync? 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/text {:style styles/advanced-settings-title}
(i18n/label :advanced-settings)]

View File

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

View File

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

View File

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