From 4f6830b271a12001ce11f5fe2468a2a5d49ee9b1 Mon Sep 17 00:00:00 2001 From: Aleksandr Pantiukhov Date: Thu, 17 May 2018 15:44:28 +0200 Subject: [PATCH] [#3941]: Introducing wallet / notification not for new user Signed-off-by: Pedro Pombeiro --- .../realm/schemas/base/v1/account.cljs | 3 +- src/status_im/translations/en.cljs | 2 ++ src/status_im/ui/components/colors.cljs | 1 + src/status_im/ui/screens/accounts/events.cljs | 20 ++++++------- .../wallet/send/transaction_sent/styles.cljs | 5 ++-- src/status_im/ui/screens/wallet/styles.cljs | 24 +++++++++++++++ src/status_im/ui/screens/wallet/views.cljs | 30 ++++++++++++++----- 7 files changed, 64 insertions(+), 21 deletions(-) diff --git a/src/status_im/data_store/realm/schemas/base/v1/account.cljs b/src/status_im/data_store/realm/schemas/base/v1/account.cljs index 58f6f45327..29387dcf69 100644 --- a/src/status_im/data_store/realm/schemas/base/v1/account.cljs +++ b/src/status_im/data_store/realm/schemas/base/v1/account.cljs @@ -22,5 +22,4 @@ :sharing-usage-data? {:type :bool :default false} :dev-mode? {:type :bool :default false} :seed-backed-up? {:type :bool :default false} - :wallet-set-up-passed? {:type :bool - :default false}}}) + :wallet-set-up-passed? {:type :bool :default false}}}) diff --git a/src/status_im/translations/en.cljs b/src/status_im/translations/en.cljs index c2c46007e8..a0c98e159d 100644 --- a/src/status_im/translations/en.cljs +++ b/src/status_im/translations/en.cljs @@ -177,6 +177,8 @@ :wallet-set-up-signing-phrase "This is your personal transaction phrase that you’ll use everytime you make a transaction. Make sure to write it down on a piece of paper, store it somewhere, and only confirm transactions when you see these three words." :wallet-set-up-confirm-title "Wrote it down?" :wallet-set-up-confirm-description "You won’t be able to see your 3-word transaction phrase again after this." + :wallet-backup-seed-title "Backup your Seed Phrase" + :wallet-backup-seed-description "This will help you to keep your money safe" ;;make_photo :image-source-title "Edit picture" diff --git a/src/status_im/ui/components/colors.cljs b/src/status_im/ui/components/colors.cljs index dc512a5aa5..1728bc0345 100644 --- a/src/status_im/ui/components/colors.cljs +++ b/src/status_im/ui/components/colors.cljs @@ -7,6 +7,7 @@ (def white-lighter-transparent "rgba(255, 255, 255, 0.6)") ;; Used for input placeholder color (def black "#000000") ;; Used as the default text color (def black-transparent "#00000020") ;; Used as background color for rounded button on dark background +(def black-darker-transparent "#00000033") ;; Used as background color for containers like "Backup seed phrase" (def gray "#939ba1") ;; Used as a background for a light foreground and as section header and secondary text color (def gray-icon "#6e777e") ;; Used for forward icon in accounts (def gray-light "#e8ebec") ;; Used as divider color diff --git a/src/status_im/ui/screens/accounts/events.cljs b/src/status_im/ui/screens/accounts/events.cljs index 33367b4e7d..c62cf76f65 100644 --- a/src/status_im/ui/screens/accounts/events.cljs +++ b/src/status_im/ui/screens/accounts/events.cljs @@ -70,15 +70,15 @@ [re-frame/trim-v (re-frame/inject-cofx ::get-signing-phrase) (re-frame/inject-cofx ::get-status)] (fn [{:keys [signing-phrase status db] :as cofx} [{:keys [pubkey address mnemonic]} password]] (let [normalized-address (utils.hex/normalize-hex address) - account {:public-key pubkey - :address normalized-address - :name (generate-gfy pubkey) - :status status - :signed-up? true - :photo-path (identicon pubkey) - :signing-phrase signing-phrase - :mnemonic mnemonic - :settings (constants/default-account-settings)}] + account {:public-key pubkey + :address normalized-address + :name (generate-gfy pubkey) + :status status + :signed-up? true + :photo-path (identicon pubkey) + :signing-phrase signing-phrase + :mnemonic mnemonic + :settings (constants/default-account-settings)}] (log/debug "account-created") (when-not (str/blank? pubkey) (-> (add-account db account) @@ -164,4 +164,4 @@ (handlers/register-handler-fx :wallet-set-up-passed (fn [cofx] - (accounts.utils/account-update {:wallet-set-up-passed? true} cofx))) + (accounts.utils/account-update {:wallet-set-up-passed? true} cofx))) \ No newline at end of file diff --git a/src/status_im/ui/screens/wallet/send/transaction_sent/styles.cljs b/src/status_im/ui/screens/wallet/send/transaction_sent/styles.cljs index e5c3e41fd4..ca4440e142 100644 --- a/src/status_im/ui/screens/wallet/send/transaction_sent/styles.cljs +++ b/src/status_im/ui/screens/wallet/send/transaction_sent/styles.cljs @@ -1,5 +1,6 @@ (ns status-im.ui.screens.wallet.send.transaction-sent.styles - (:require-macros [status-im.utils.styles :refer [defnstyle defstyle]])) + (:require-macros [status-im.utils.styles :refer [defnstyle defstyle]]) + (:require [status-im.ui.components.colors :as colors])) (def transaction-sent-container {:align-items :center}) @@ -30,7 +31,7 @@ (def transaction-details-container {:height 42 - :background-color "#00000033" + :background-color colors/black-darker-transparent :margin-horizontal 16 :opacity 0.2 :align-items :center diff --git a/src/status_im/ui/screens/wallet/styles.cljs b/src/status_im/ui/screens/wallet/styles.cljs index 88558a3d3f..5c2cb71963 100644 --- a/src/status_im/ui/screens/wallet/styles.cljs +++ b/src/status_im/ui/screens/wallet/styles.cljs @@ -81,6 +81,30 @@ (def section {:background-color colors/blue}) +(def backup-seed-phrase-container + {:flex-direction :row + :align-items :center + :border-radius 8 + :margin 16 + :background-color colors/black-darker-transparent + :padding-top 10 + :padding-bottom 10 + :padding-left 14 + :padding-right 12}) + +(def backup-seed-phrase-text-container + {:flex 1}) + +(def backup-seed-phrase-title + {:font-size 15 + :line-height 20 + :color colors/white}) + +(def backup-seed-phrase-description + {:font-size 14 + :line-height 20 + :color colors/white-lighter-transparent}) + (def total-balance-container {:align-items :center :justify-content :center}) diff --git a/src/status_im/ui/screens/wallet/views.cljs b/src/status_im/ui/screens/wallet/views.cljs index 4f59a4fdff..bd4ff0046d 100644 --- a/src/status_im/ui/screens/wallet/views.cljs +++ b/src/status_im/ui/screens/wallet/views.cljs @@ -6,11 +6,10 @@ [status-im.ui.components.list.views :as list] [status-im.ui.components.react :as react] [status-im.ui.components.toolbar.view :as toolbar] + [status-im.ui.components.icons.vector-icons :as vector-icons] [status-im.ui.screens.wallet.onboarding.views :as onboarding.views] [status-im.ui.screens.wallet.styles :as styles] - [status-im.ui.screens.wallet.utils :as wallet.utils] - [status-im.utils.ethereum.core :as ethereum] - [status-im.utils.ethereum.tokens :as tokens])) + [status-im.ui.screens.wallet.utils :as wallet.utils])) (defn toolbar-view [] [toolbar/toolbar {:style styles/toolbar :flat? true} @@ -35,6 +34,17 @@ (:code currency)]] [react/text {:style styles/total-value} (i18n/label :t/wallet-total-value)]]]) +(defn- backup-seed-phrase [] + [react/view styles/section + [react/touchable-highlight {:on-press #(re-frame/dispatch [:navigate-to :backup-seed])} + [react/view styles/backup-seed-phrase-container + [react/view styles/backup-seed-phrase-text-container + [react/text {:style styles/backup-seed-phrase-title} + (i18n/label :t/wallet-backup-seed-title)] + [react/text {:style styles/backup-seed-phrase-description} + (i18n/label :t/wallet-backup-seed-description)]] + [vector-icons/icon :icons/forward {:color :white}]]]]) + (def actions [{:label (i18n/label :t/send-transaction) :accessibility-label :send-transaction-button @@ -83,7 +93,8 @@ (views/defview wallet-root [] (views/letsubs [assets [:wallet/visible-assets-with-amount] currency [:wallet/currency] - portfolio-value [:portfolio-value]] + portfolio-value [:portfolio-value] + {:keys [seed-backed-up?]} [:get-current-account]] [react/view styles/main-section [toolbar-view] [react/scroll-view {:refresh-control @@ -92,6 +103,11 @@ :tint-color :white :refreshing false}])} [total-section portfolio-value currency] + (when (and (not seed-backed-up?) + (some (fn [{:keys [amount]}] + (and amount (not (.isZero amount)))) + assets)) + [backup-seed-phrase]) [list/action-list actions {:container-style styles/action-section}] [asset-section assets currency] @@ -100,6 +116,6 @@ (views/defview wallet [] (views/letsubs [{:keys [wallet-set-up-passed?]} [:get-current-account]] - (if wallet-set-up-passed? - [wallet-root] - [onboarding.views/onboarding]))) + (if (not wallet-set-up-passed?) + [onboarding.views/onboarding] + [wallet-root])))