[ISSUE #889] Show app version in profile
Signed-off-by: Julien Eluard <julien.eluard@gmail.com>
This commit is contained in:
parent
83b5312a05
commit
f7f41d2f37
|
@ -61,8 +61,12 @@
|
||||||
:ios {:letter-spacing -0.2}
|
:ios {:letter-spacing -0.2}
|
||||||
:android {:color colors/black}})
|
:android {:color colors/black}})
|
||||||
|
|
||||||
|
(def settings-item-destructive
|
||||||
|
{:color colors/red})
|
||||||
|
|
||||||
(def settings-item-value
|
(def settings-item-value
|
||||||
{:flex-wrap :nowrap
|
{:flex 1
|
||||||
|
:flex-wrap :nowrap
|
||||||
:text-align :right
|
:text-align :right
|
||||||
:padding-right 10
|
:padding-right 10
|
||||||
:font-size 15
|
:font-size 15
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
(ns status-im.ui.screens.profile.components.views
|
(ns status-im.ui.screens.profile.components.views
|
||||||
(:require [status-im.ui.components.react :as react]
|
(:require [clojure.string :as string]
|
||||||
[re-frame.core :as re-frame]
|
[re-frame.core :as re-frame]
|
||||||
[status-im.ui.components.list-selection :as list-selection]
|
|
||||||
[status-im.i18n :as i18n]
|
[status-im.i18n :as i18n]
|
||||||
[status-im.ui.components.chat-icon.screen :as chat-icon.screen]
|
[status-im.ui.components.chat-icon.screen :as chat-icon.screen]
|
||||||
[status-im.ui.screens.profile.components.styles :as styles]
|
[status-im.ui.components.colors :as colors]
|
||||||
[status-im.ui.components.common.common :as common]
|
[status-im.ui.components.common.common :as common]
|
||||||
[status-im.ui.components.icons.vector-icons :as vector-icons]
|
[status-im.ui.components.icons.vector-icons :as vector-icons]
|
||||||
[status-im.ui.components.colors :as colors]
|
[status-im.ui.components.react :as react]
|
||||||
[clojure.string :as string]))
|
[status-im.ui.components.list-selection :as list-selection]
|
||||||
|
[status-im.ui.screens.profile.components.styles :as styles]))
|
||||||
|
|
||||||
;; profile header elements
|
;; profile header elements
|
||||||
|
|
||||||
(defn profile-name-input [name on-change-text-event]
|
(defn- profile-name-input [name on-change-text-event]
|
||||||
[react/view
|
[react/view
|
||||||
[react/text-input
|
[react/text-input
|
||||||
{:style styles/profile-name-input-text
|
{:style styles/profile-name-input-text
|
||||||
|
@ -23,12 +23,12 @@
|
||||||
(re-frame/dispatch [on-change-text-event %]))
|
(re-frame/dispatch [on-change-text-event %]))
|
||||||
:accessibility-label :username-input}]])
|
:accessibility-label :username-input}]])
|
||||||
|
|
||||||
(defn show-profile-icon-actions [options]
|
(defn- show-profile-icon-actions [options]
|
||||||
(when (seq options)
|
(when (seq options)
|
||||||
(list-selection/show {:title (i18n/label :t/image-source-title)
|
(list-selection/show {:title (i18n/label :t/image-source-title)
|
||||||
:options options})))
|
:options options})))
|
||||||
|
|
||||||
(defn profile-header-display [{:keys [name] :as contact}]
|
(defn- profile-header-display [{:keys [name] :as contact}]
|
||||||
[react/view styles/profile-header-display
|
[react/view styles/profile-header-display
|
||||||
[chat-icon.screen/my-profile-icon {:account contact
|
[chat-icon.screen/my-profile-icon {:account contact
|
||||||
:edit? false}]
|
:edit? false}]
|
||||||
|
@ -37,8 +37,8 @@
|
||||||
:number-of-lines 1}
|
:number-of-lines 1}
|
||||||
name]]])
|
name]]])
|
||||||
|
|
||||||
(defn profile-header-edit [{:keys [name] :as contact}
|
(defn- profile-header-edit [{:keys [name] :as contact}
|
||||||
icon-options on-change-text-event allow-icon-change?]
|
icon-options on-change-text-event allow-icon-change?]
|
||||||
[react/view styles/profile-header-edit
|
[react/view styles/profile-header-edit
|
||||||
[react/touchable-highlight {:on-press #(show-profile-icon-actions icon-options)
|
[react/touchable-highlight {:on-press #(show-profile-icon-actions icon-options)
|
||||||
:accessibility-label :edit-profile-photo-button}
|
:accessibility-label :edit-profile-photo-button}
|
||||||
|
@ -62,7 +62,7 @@
|
||||||
[react/text {:style styles/settings-title}
|
[react/text {:style styles/settings-title}
|
||||||
title])
|
title])
|
||||||
|
|
||||||
(defn settings-item [{:keys [label-kw value action-fn active? accessibility-label icon-content]
|
(defn settings-item [{:keys [label-kw value action-fn active? destructive? hide-arrow? accessibility-label icon-content]
|
||||||
:or {value "" active? true}}]
|
:or {value "" active? true}}]
|
||||||
[react/touchable-highlight
|
[react/touchable-highlight
|
||||||
(cond-> {:on-press action-fn
|
(cond-> {:on-press action-fn
|
||||||
|
@ -71,7 +71,8 @@
|
||||||
(assoc :accessibility-label accessibility-label))
|
(assoc :accessibility-label accessibility-label))
|
||||||
[react/view styles/settings-item
|
[react/view styles/settings-item
|
||||||
[react/view styles/settings-item-text-wrapper
|
[react/view styles/settings-item-text-wrapper
|
||||||
[react/text {:style styles/settings-item-text
|
[react/text {:style (merge styles/settings-item-text
|
||||||
|
(when destructive? styles/settings-item-destructive))
|
||||||
:number-of-lines 1}
|
:number-of-lines 1}
|
||||||
(i18n/label label-kw)]
|
(i18n/label label-kw)]
|
||||||
(when-not (string/blank? value)
|
(when-not (string/blank? value)
|
||||||
|
@ -81,7 +82,7 @@
|
||||||
value])]
|
value])]
|
||||||
(if icon-content
|
(if icon-content
|
||||||
icon-content
|
icon-content
|
||||||
(when active?
|
(when (and active? (not hide-arrow?))
|
||||||
[vector-icons/icon :icons/forward {:color colors/gray}]))]])
|
[vector-icons/icon :icons/forward {:color colors/gray}]))]])
|
||||||
|
|
||||||
(defn settings-switch-item [{:keys [label-kw value action-fn active?] :or {active? true}}]
|
(defn settings-switch-item [{:keys [label-kw value action-fn active?] :or {active? true}}]
|
||||||
|
@ -92,4 +93,4 @@
|
||||||
[react/switch {:on-tint-color colors/blue
|
[react/switch {:on-tint-color colors/blue
|
||||||
:value value
|
:value value
|
||||||
:on-value-change action-fn
|
:on-value-change action-fn
|
||||||
:disabled (not active?)}]])
|
:disabled (not active?)}]])
|
||||||
|
|
|
@ -39,10 +39,6 @@
|
||||||
{:flex-grow 1
|
{:flex-grow 1
|
||||||
:flex-direction :column})
|
:flex-direction :column})
|
||||||
|
|
||||||
(defstyle logout-text
|
|
||||||
(merge profile.components.styles/settings-item-text
|
|
||||||
{:color colors/red}))
|
|
||||||
|
|
||||||
(defstyle my-profile-info-container
|
(defstyle my-profile-info-container
|
||||||
{:background-color colors/white})
|
{:background-color colors/white})
|
||||||
|
|
||||||
|
@ -68,4 +64,4 @@
|
||||||
(def advanced-button-label
|
(def advanced-button-label
|
||||||
{:font-size 15
|
{:font-size 15
|
||||||
:letter-spacing -0.2
|
:letter-spacing -0.2
|
||||||
:color colors/blue})
|
:color colors/blue})
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
[status-im.ui.screens.profile.components.views :as profile.components]
|
[status-im.ui.screens.profile.components.views :as profile.components]
|
||||||
[status-im.ui.screens.profile.components.styles :as profile.components.styles]
|
[status-im.ui.screens.profile.components.styles :as profile.components.styles]
|
||||||
[status-im.ui.screens.profile.user.styles :as styles]
|
[status-im.ui.screens.profile.user.styles :as styles]
|
||||||
|
[status-im.utils.build :as build]
|
||||||
[status-im.utils.config :as config]
|
[status-im.utils.config :as config]
|
||||||
[status-im.utils.platform :as platform]
|
[status-im.utils.platform :as platform]
|
||||||
[status-im.utils.utils :as utils]
|
[status-im.utils.utils :as utils]
|
||||||
|
@ -88,46 +89,43 @@
|
||||||
:accessibility-label :share-my-contact-code-button}
|
:accessibility-label :share-my-contact-code-button}
|
||||||
[vector-icons/icon :icons/qr {:color colors/blue}]]]])
|
[vector-icons/icon :icons/qr {:color colors/blue}]]]])
|
||||||
|
|
||||||
(defn my-profile-settings [{:keys [seed-backed-up? mnemonic]}]
|
(defn- navigate-to-accounts [sharing-usage-data?]
|
||||||
[react/view
|
|
||||||
[profile.components/settings-title (i18n/label :t/settings)]
|
|
||||||
[profile.components/settings-item {:label-kw :t/main-currency
|
|
||||||
:value "USD"
|
|
||||||
:active? false}]
|
|
||||||
[profile.components/settings-item-separator]
|
|
||||||
[profile.components/settings-item {:label-kw :t/notifications
|
|
||||||
:action-fn #(.openURL react/linking "app-settings://notification/status-im")}
|
|
||||||
:notifications-button]
|
|
||||||
[profile.components/settings-item-separator]
|
|
||||||
(when (and (not seed-backed-up?) (not (string/blank? mnemonic)))
|
|
||||||
[react/view
|
|
||||||
[profile.components/settings-item
|
|
||||||
{:label-kw :t/backup-your-seed
|
|
||||||
:action-fn #(re-frame/dispatch [:navigate-to :backup-seed])
|
|
||||||
:icon-content [components.common/counter {:size 22} 1]}]
|
|
||||||
[profile.components/settings-item-separator]])])
|
|
||||||
|
|
||||||
(defn navigate-to-accounts [sharing-usage-data?]
|
|
||||||
;; TODO(rasom): probably not the best place for this call
|
;; TODO(rasom): probably not the best place for this call
|
||||||
(protocol/stop-whisper!)
|
(protocol/stop-whisper!)
|
||||||
(re-frame/dispatch [:navigate-to :accounts])
|
(re-frame/dispatch [:navigate-to :accounts])
|
||||||
(when sharing-usage-data?
|
(when sharing-usage-data?
|
||||||
(re-frame/dispatch [:unregister-mixpanel-tracking])))
|
(re-frame/dispatch [:unregister-mixpanel-tracking])))
|
||||||
|
|
||||||
(defn handle-logout [sharing-usage-data?]
|
(defn- handle-logout [sharing-usage-data?]
|
||||||
(utils/show-confirmation (i18n/label :t/logout-title)
|
(utils/show-confirmation (i18n/label :t/logout-title)
|
||||||
(i18n/label :t/logout-are-you-sure)
|
(i18n/label :t/logout-are-you-sure)
|
||||||
(i18n/label :t/logout) #(navigate-to-accounts sharing-usage-data?)))
|
(i18n/label :t/logout) #(navigate-to-accounts sharing-usage-data?)))
|
||||||
|
|
||||||
(defn logout [sharing-usage-data?]
|
(defn- my-profile-settings [{:keys [seed-backed-up? mnemonic]} sharing-usage-data?]
|
||||||
[react/view {}
|
(let [show-backup-seed? (and (not seed-backed-up?) (not (string/blank? mnemonic)))]
|
||||||
[react/touchable-highlight
|
[react/view
|
||||||
{:on-press #(handle-logout sharing-usage-data?)
|
[profile.components/settings-title (i18n/label :t/settings)]
|
||||||
:accessibility-label :log-out-button}
|
[profile.components/settings-item {:label-kw :t/main-currency
|
||||||
[react/view profile.components.styles/settings-item
|
:value (i18n/label :usd-currency)
|
||||||
[react/text {:style styles/logout-text
|
:active? false}]
|
||||||
:font (if platform/android? :medium :default)}
|
[profile.components/settings-item-separator]
|
||||||
(i18n/label :t/logout)]]]])
|
[profile.components/settings-item {:label-kw :t/notifications
|
||||||
|
:accessibility-label :notifications-button
|
||||||
|
:action-fn #(.openURL react/linking "app-settings://notification/status-im")}]
|
||||||
|
(when show-backup-seed?
|
||||||
|
[profile.components/settings-item-separator])
|
||||||
|
(when show-backup-seed?
|
||||||
|
[profile.components/settings-item
|
||||||
|
{:label-kw :t/backup-your-seed
|
||||||
|
:action-fn #(re-frame/dispatch [:navigate-to :backup-seed])
|
||||||
|
:icon-content [components.common/counter {:size 22} 1]}])
|
||||||
|
[profile.components/settings-item-separator]
|
||||||
|
[profile.components/settings-item {:label-kw :t/logout
|
||||||
|
:accessibility-label :log-out-button
|
||||||
|
:value build/version
|
||||||
|
:destructive? true
|
||||||
|
:hide-arrow? true
|
||||||
|
:action-fn #(handle-logout sharing-usage-data?)}]]))
|
||||||
|
|
||||||
(defview advanced [{:keys [network networks dev-mode?]}]
|
(defview advanced [{:keys [network networks dev-mode?]}]
|
||||||
(letsubs [advanced? [:get :my-profile/advanced?]]
|
(letsubs [advanced? [:get :my-profile/advanced?]]
|
||||||
|
@ -175,6 +173,5 @@
|
||||||
[react/view action-button.styles/actions-list
|
[react/view action-button.styles/actions-list
|
||||||
[share-contact-code current-account public-key]]
|
[share-contact-code current-account public-key]]
|
||||||
[react/view styles/my-profile-info-container
|
[react/view styles/my-profile-info-container
|
||||||
[my-profile-settings current-account]]
|
[my-profile-settings current-account sharing-usage-data?]]
|
||||||
[logout sharing-usage-data?]
|
|
||||||
[advanced shown-account]]])))
|
[advanced shown-account]]])))
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
(ns status-im.utils.build
|
(ns status-im.utils.build
|
||||||
(:require [cljs.analyzer :as analyzer]
|
(:require [cljs.analyzer :as analyzer]
|
||||||
|
[clojure.string :as string]
|
||||||
[clojure.java.shell :as shell]))
|
[clojure.java.shell :as shell]))
|
||||||
|
|
||||||
;; Some warnings are unavoidable due to dependencies. For example, reagent 0.6.0
|
;; Some warnings are unavoidable due to dependencies. For example, reagent 0.6.0
|
||||||
|
@ -20,4 +21,4 @@
|
||||||
(System/exit 1))))
|
(System/exit 1))))
|
||||||
|
|
||||||
(defmacro git-short-version []
|
(defmacro git-short-version []
|
||||||
(:out (shell/sh "bash" "-c" "git describe --always")))
|
(string/replace (:out (shell/sh "bash" "-c" "git describe --always")) "\n" ""))
|
||||||
|
|
Loading…
Reference in New Issue