[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}
|
||||
:android {:color colors/black}})
|
||||
|
||||
(def settings-item-destructive
|
||||
{:color colors/red})
|
||||
|
||||
(def settings-item-value
|
||||
{:flex-wrap :nowrap
|
||||
{:flex 1
|
||||
:flex-wrap :nowrap
|
||||
:text-align :right
|
||||
:padding-right 10
|
||||
:font-size 15
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
(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]
|
||||
[status-im.ui.components.list-selection :as list-selection]
|
||||
[status-im.i18n :as i18n]
|
||||
[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.icons.vector-icons :as vector-icons]
|
||||
[status-im.ui.components.colors :as colors]
|
||||
[clojure.string :as string]))
|
||||
[status-im.ui.components.react :as react]
|
||||
[status-im.ui.components.list-selection :as list-selection]
|
||||
[status-im.ui.screens.profile.components.styles :as styles]))
|
||||
|
||||
;; profile header elements
|
||||
|
||||
(defn profile-name-input [name on-change-text-event]
|
||||
(defn- profile-name-input [name on-change-text-event]
|
||||
[react/view
|
||||
[react/text-input
|
||||
{:style styles/profile-name-input-text
|
||||
|
@ -23,12 +23,12 @@
|
|||
(re-frame/dispatch [on-change-text-event %]))
|
||||
:accessibility-label :username-input}]])
|
||||
|
||||
(defn show-profile-icon-actions [options]
|
||||
(defn- show-profile-icon-actions [options]
|
||||
(when (seq options)
|
||||
(list-selection/show {:title (i18n/label :t/image-source-title)
|
||||
:options options})))
|
||||
|
||||
(defn profile-header-display [{:keys [name] :as contact}]
|
||||
(defn- profile-header-display [{:keys [name] :as contact}]
|
||||
[react/view styles/profile-header-display
|
||||
[chat-icon.screen/my-profile-icon {:account contact
|
||||
:edit? false}]
|
||||
|
@ -37,8 +37,8 @@
|
|||
:number-of-lines 1}
|
||||
name]]])
|
||||
|
||||
(defn profile-header-edit [{:keys [name] :as contact}
|
||||
icon-options on-change-text-event allow-icon-change?]
|
||||
(defn- profile-header-edit [{:keys [name] :as contact}
|
||||
icon-options on-change-text-event allow-icon-change?]
|
||||
[react/view styles/profile-header-edit
|
||||
[react/touchable-highlight {:on-press #(show-profile-icon-actions icon-options)
|
||||
:accessibility-label :edit-profile-photo-button}
|
||||
|
@ -62,7 +62,7 @@
|
|||
[react/text {:style styles/settings-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}}]
|
||||
[react/touchable-highlight
|
||||
(cond-> {:on-press action-fn
|
||||
|
@ -71,7 +71,8 @@
|
|||
(assoc :accessibility-label accessibility-label))
|
||||
[react/view styles/settings-item
|
||||
[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}
|
||||
(i18n/label label-kw)]
|
||||
(when-not (string/blank? value)
|
||||
|
@ -81,7 +82,7 @@
|
|||
value])]
|
||||
(if icon-content
|
||||
icon-content
|
||||
(when active?
|
||||
(when (and active? (not hide-arrow?))
|
||||
[vector-icons/icon :icons/forward {:color colors/gray}]))]])
|
||||
|
||||
(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
|
||||
:value value
|
||||
:on-value-change action-fn
|
||||
:disabled (not active?)}]])
|
||||
:disabled (not active?)}]])
|
||||
|
|
|
@ -39,10 +39,6 @@
|
|||
{:flex-grow 1
|
||||
:flex-direction :column})
|
||||
|
||||
(defstyle logout-text
|
||||
(merge profile.components.styles/settings-item-text
|
||||
{:color colors/red}))
|
||||
|
||||
(defstyle my-profile-info-container
|
||||
{:background-color colors/white})
|
||||
|
||||
|
@ -68,4 +64,4 @@
|
|||
(def advanced-button-label
|
||||
{:font-size 15
|
||||
: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.styles :as profile.components.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.platform :as platform]
|
||||
[status-im.utils.utils :as utils]
|
||||
|
@ -88,46 +89,43 @@
|
|||
:accessibility-label :share-my-contact-code-button}
|
||||
[vector-icons/icon :icons/qr {:color colors/blue}]]]])
|
||||
|
||||
(defn my-profile-settings [{:keys [seed-backed-up? mnemonic]}]
|
||||
[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?]
|
||||
(defn- navigate-to-accounts [sharing-usage-data?]
|
||||
;; TODO(rasom): probably not the best place for this call
|
||||
(protocol/stop-whisper!)
|
||||
(re-frame/dispatch [:navigate-to :accounts])
|
||||
(when sharing-usage-data?
|
||||
(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)
|
||||
(i18n/label :t/logout-are-you-sure)
|
||||
(i18n/label :t/logout) #(navigate-to-accounts sharing-usage-data?)))
|
||||
|
||||
(defn logout [sharing-usage-data?]
|
||||
[react/view {}
|
||||
[react/touchable-highlight
|
||||
{:on-press #(handle-logout sharing-usage-data?)
|
||||
:accessibility-label :log-out-button}
|
||||
[react/view profile.components.styles/settings-item
|
||||
[react/text {:style styles/logout-text
|
||||
:font (if platform/android? :medium :default)}
|
||||
(i18n/label :t/logout)]]]])
|
||||
(defn- my-profile-settings [{:keys [seed-backed-up? mnemonic]} sharing-usage-data?]
|
||||
(let [show-backup-seed? (and (not seed-backed-up?) (not (string/blank? mnemonic)))]
|
||||
[react/view
|
||||
[profile.components/settings-title (i18n/label :t/settings)]
|
||||
[profile.components/settings-item {:label-kw :t/main-currency
|
||||
:value (i18n/label :usd-currency)
|
||||
:active? false}]
|
||||
[profile.components/settings-item-separator]
|
||||
[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?]}]
|
||||
(letsubs [advanced? [:get :my-profile/advanced?]]
|
||||
|
@ -175,6 +173,5 @@
|
|||
[react/view action-button.styles/actions-list
|
||||
[share-contact-code current-account public-key]]
|
||||
[react/view styles/my-profile-info-container
|
||||
[my-profile-settings current-account]]
|
||||
[logout sharing-usage-data?]
|
||||
[my-profile-settings current-account sharing-usage-data?]]
|
||||
[advanced shown-account]]])))
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
(ns status-im.utils.build
|
||||
(:require [cljs.analyzer :as analyzer]
|
||||
[clojure.string :as string]
|
||||
[clojure.java.shell :as shell]))
|
||||
|
||||
;; Some warnings are unavoidable due to dependencies. For example, reagent 0.6.0
|
||||
|
@ -20,4 +21,4 @@
|
|||
(System/exit 1))))
|
||||
|
||||
(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