[#3558] Show the revision of status-go in the version label

This commit is contained in:
Daniel Regeci 2018-04-19 18:33:40 +08:00 committed by Roman Volosovskyi
parent 90a508b64f
commit e2d44a3589
No known key found for this signature in database
GPG Key ID: 0238A4B5ECEE70DE
4 changed files with 26 additions and 3 deletions

View File

@ -57,6 +57,7 @@
(spec/def ::rpc-url (spec/nilable string?))
;;object? doesn't work
(spec/def ::web3 (spec/nilable any?))
(spec/def ::web3-node-version (spec/nilable string?))
;;object?
(spec/def ::webview-bridge (spec/nilable any?))
(spec/def ::status-module-initialized? (spec/nilable boolean?))
@ -186,6 +187,7 @@
::was-modal?
::rpc-url
::web3
::web3-node-version
::webview-bridge
::status-module-initialized?
::status-node-started?

View File

@ -302,6 +302,7 @@
(fn [_ [_ address events-after]]
{:dispatch-n (cond-> [[:initialize-account-db address]
[:initialize-protocol address]
[:fetch-web3-node-version]
[:initialize-sync-listener]
[:load-contacts]
[:load-contact-groups]
@ -340,6 +341,20 @@
(get-in default-networks [default-network :config]))]
{:initialize-geth-fx network-config})))
(handlers/register-handler-fx
:fetch-web3-node-version-callback
(fn [{:keys [db]} [_ resp]]
(when-let [git-commit (nth (re-find #"-([0-9a-f]{7,})/" resp) 1)]
{:db (assoc db :web3-node-version git-commit)})))
(handlers/register-handler-fx
:fetch-web3-node-version
(fn [{{:keys [web3] :as db} :db} _]
(.. web3 -version (getNode (fn [err resp]
(when-not err
(re-frame/dispatch [:fetch-web3-node-version-callback resp])))))
nil))
(handlers/register-handler-fx
:webview-geo-permissions-granted
(fn [{{:keys [webview-bridge]} :db} _]

View File

@ -1,9 +1,15 @@
(ns status-im.ui.screens.profile.subs
(:require [re-frame.core :refer [reg-sub]]
[clojure.string :as string]))
[clojure.string :as string]
[status-im.utils.build :as build]))
(reg-sub
:get-profile-unread-messages-number
:<- [:get-current-account]
(fn [{:keys [seed-backed-up? mnemonic]}]
(if (or seed-backed-up? (string/blank? mnemonic)) 0 1)))
(reg-sub
:get-app-version
(fn [{:keys [web3-node-version]}]
(str build/version " (" (or web3-node-version "N/A") ")")))

View File

@ -123,7 +123,7 @@
:hide-arrow? true
:action-fn #(handle-logout)}]]
[react/view styles/my-profile-settings-logout-version
[react/text build/version]]]]))
[react/text @(re-frame/subscribe [:get-app-version])]]]]))
(defview advanced [{:keys [network networks dev-mode?]}]
(letsubs [advanced? [:get :my-profile/advanced?]