From f0302e7cbf0a19b3abcabce2f1f323499bd27eef Mon Sep 17 00:00:00 2001 From: Audrius Molis Date: Mon, 7 Feb 2022 18:44:10 +0200 Subject: [PATCH] [status-im#12603] Show short hash near build number in About page Signed-off-by: andrey --- src/status_im/subs.cljs | 12 ++++++------ src/status_im/ui/screens/about_app/views.cljs | 9 +++++++++ src/status_im/utils/build.clj | 2 +- src/status_im/utils/build.cljs | 4 ++++ translations/en.json | 1 + 5 files changed, 21 insertions(+), 7 deletions(-) diff --git a/src/status_im/subs.cljs b/src/status_im/subs.cljs index c74d9267a7..ef730fcdc9 100644 --- a/src/status_im/subs.cljs +++ b/src/status_im/subs.cljs @@ -610,19 +610,19 @@ (defn- node-version [web3-node-version] (or web3-node-version "N/A")) -(def app-short-version - (let [version build/build-no] - (str build/version " (" version ")"))) - (re-frame/reg-sub :get-app-version :<- [:web3-node-version] (fn [web3-node-version] - (str app-short-version "; " (node-version web3-node-version)))) + (str build/app-short-version "; " (node-version web3-node-version)))) (re-frame/reg-sub :get-app-short-version - (fn [_] app-short-version)) + (fn [_] build/app-short-version)) + +(re-frame/reg-sub + :get-commit-hash + (fn [_] build/commit-hash)) (re-frame/reg-sub :get-app-node-version diff --git a/src/status_im/ui/screens/about_app/views.cljs b/src/status_im/ui/screens/about_app/views.cljs index 3d7452887c..9c1d819eae 100644 --- a/src/status_im/ui/screens/about_app/views.cljs +++ b/src/status_im/ui/screens/about_app/views.cljs @@ -12,6 +12,7 @@ (views/defview about-app [] (views/letsubs [app-version [:get-app-short-version] + commit-hash [:get-commit-hash] node-version [:get-app-node-version]] [react/scroll-view [quo/list-item @@ -35,6 +36,14 @@ :title (i18n/label :t/version) :accessory :text :accessory-text app-version}]] + [copyable-text/copyable-text-view + {:copied-text commit-hash} + [quo/list-item + {:size :small + :accessibility-label :commit-hash + :title (i18n/label :t/app-commit) + :accessory :text + :accessory-text commit-hash}]] [copyable-text/copyable-text-view {:copied-text node-version} [quo/list-item diff --git a/src/status_im/utils/build.clj b/src/status_im/utils/build.clj index 90756e97fd..5c548138f5 100644 --- a/src/status_im/utils/build.clj +++ b/src/status_im/utils/build.clj @@ -29,7 +29,7 @@ (defmacro get-current-sha "fetches the latest commit sha from the current branch" [] - (-> (shell/sh "git" "rev-parse" "--short" "HEAD") + (-> (shell/sh "git" "rev-parse" "HEAD") :out (string/replace "\n" ""))) diff --git a/src/status_im/utils/build.cljs b/src/status_im/utils/build.cljs index ac7de34cfe..130214486b 100644 --- a/src/status_im/utils/build.cljs +++ b/src/status_im/utils/build.cljs @@ -1,5 +1,9 @@ (ns status-im.utils.build (:require-macros [status-im.utils.build :as build])) +(def commit-hash (build/get-current-sha)) (def version (build/git-short-version)) (def build-no (build/get-build-no)) + +(def app-short-version + (str version " (" build-no ")")) diff --git a/translations/en.json b/translations/en.json index 84750ded89..05d00fcce8 100644 --- a/translations/en.json +++ b/translations/en.json @@ -1304,6 +1304,7 @@ "validation-amount-invalid-number": "Amount is not a valid number", "validation-amount-is-too-precise": "Amount is too precise. Max number of decimals is {{decimals}}.", "version": "App version", + "app-commit": "App commit", "view": "View", "view-cryptokitties": "View in CryptoKitties", "view-cryptostrikers": "View in CryptoStrikers",