From 01b1f2da4b6d5dae305e5bdae685aee73dd26d03 Mon Sep 17 00:00:00 2001 From: Andrey Shovkoplyas Date: Thu, 19 Oct 2017 15:57:52 +0300 Subject: [PATCH] No option to recover immediately after a fresh install. #741 --- src/status_im/chat/screen.cljs | 12 +++++++----- src/status_im/chat/styles/screen.cljs | 3 +-- .../ui/screens/accounts/recover/events.cljs | 2 +- .../ui/screens/accounts/recover/views.cljs | 13 ++++++++++--- src/status_im/ui/screens/views.cljs | 3 ++- .../ui/screens/wallet/wallet_list/views.cljs | 2 +- 6 files changed, 22 insertions(+), 13 deletions(-) diff --git a/src/status_im/chat/screen.cljs b/src/status_im/chat/screen.cljs index b73a342839..651d4bd64c 100644 --- a/src/status_im/chat/screen.cljs +++ b/src/status_im/chat/screen.cljs @@ -113,11 +113,13 @@ creating? [:get :accounts/creating-account?]] [view [status-bar] - (let [hide-nav? (or (empty? accounts) show-actions? creating?)] - [toolbar/toolbar2 {:show-sync-bar? true} - (when-not hide-nav? toolbar/default-nav-back) - [toolbar-content-view] - [toolbar-action]]) + [toolbar/toolbar2 {:show-sync-bar? true} + (when-not (or show-actions? creating?) + (if (empty? accounts) + [toolbar/nav-clear-text (label :t/recover) #(dispatch [:navigate-to-modal :recover-modal])] + toolbar/default-nav-back)) + [toolbar-content-view] + [toolbar-action]] [add-contact-bar]]) (defn get-intro-status-message [all-messages] diff --git a/src/status_im/chat/styles/screen.cljs b/src/status_im/chat/styles/screen.cljs index a653bd97bb..79f3d22312 100644 --- a/src/status_im/chat/styles/screen.cljs +++ b/src/status_im/chat/styles/screen.cljs @@ -51,8 +51,7 @@ :android {:align-items :flex-start :margin-left (if show-actions 66 18) :padding-bottom 6} - :ios {:align-items :center - :margin-left (if show-actions 54 6)}}) + :ios {:align-items :center}}) (def chat-name-text {:color color-gray6 diff --git a/src/status_im/ui/screens/accounts/recover/events.cljs b/src/status_im/ui/screens/accounts/recover/events.cljs index a4ed7e0675..5714dc705f 100644 --- a/src/status_im/ui/screens/accounts/recover/events.cljs +++ b/src/status_im/ui/screens/accounts/recover/events.cljs @@ -45,7 +45,7 @@ (when-not (str/blank? public-key) {:db (update db :accounts/recover assoc :passphrase "" :password "") :dispatch-n [[:add-account account] - [:navigate-back]]})))) + [:navigate-to-clean :accounts]]})))) (register-handler-fx :recover-account diff --git a/src/status_im/ui/screens/accounts/recover/views.cljs b/src/status_im/ui/screens/accounts/recover/views.cljs index b13b53e63a..b5bffb16db 100644 --- a/src/status_im/ui/screens/accounts/recover/views.cljs +++ b/src/status_im/ui/screens/accounts/recover/views.cljs @@ -40,16 +40,23 @@ :secure-text-entry true :error error}]])) -(defview recover [] +(defview recover [& [modal?]] (letsubs [{:keys [passphrase password]} [:get :accounts/recover]] (let [valid-form? (and (spec/valid? ::v/passphrase passphrase) (spec/valid? ::v/password password))] [keyboard-avoiding-view {:style st/screen-container} [status-bar] - [toolbar {:title (i18n/label :t/recover-access)}] + [toolbar {:title (i18n/label :t/recover-access) :modal? modal?}] [passphrase-input (or passphrase "")] [password-input (or password "")] [view {:flex 1}] (when valid-form? - [sticky-button (i18n/label :t/recover-access) #(dispatch [:recover-account passphrase password])])]))) + [sticky-button + (i18n/label :t/recover-access) + #(do + (when modal? (dispatch [:navigate-back])) + (dispatch [:recover-account passphrase password]))])]))) + +(defview recover-modal [] + [recover true]) diff --git a/src/status_im/ui/screens/views.cljs b/src/status_im/ui/screens/views.cljs index 1468eda631..07cfa19e33 100644 --- a/src/status_im/ui/screens/views.cljs +++ b/src/status_im/ui/screens/views.cljs @@ -8,7 +8,7 @@ [status-im.components.context-menu :refer [menu-context]] [status-im.ui.screens.accounts.login.views :refer [login]] - [status-im.ui.screens.accounts.recover.views :refer [recover]] + [status-im.ui.screens.accounts.recover.views :refer [recover recover-modal]] [status-im.ui.screens.accounts.views :refer [accounts]] [status-im.chat.screen :refer [chat]] @@ -120,6 +120,7 @@ (let [component (case modal-view :qr-scanner qr-scanner :qr-code-view qr-code-view + :recover-modal recover-modal :contact-list-modal contact-list-modal :wallet-transactions-filter wallet-transactions/filter-history :wallet-send-transaction-modal send-transaction-modal diff --git a/src/status_im/ui/screens/wallet/wallet_list/views.cljs b/src/status_im/ui/screens/wallet/wallet_list/views.cljs index bd67ec7f5d..f0c5201c3d 100644 --- a/src/status_im/ui/screens/wallet/wallet_list/views.cljs +++ b/src/status_im/ui/screens/wallet/wallet_list/views.cljs @@ -1,5 +1,5 @@ (ns status-im.ui.screens.wallet.wallet-list.views - (:require-macros [status-im.utils.views :refer [defview]]) + (:require-macros [status-im.utils.views :refer [defview letsubs]]) (:require [clojure.string :as string] [re-frame.core :as re-frame] [status-im.components.list.views :as list]