No option to recover immediately after a fresh install. #741

This commit is contained in:
Andrey Shovkoplyas 2017-10-19 15:57:52 +03:00 committed by Roman Volosovskyi
parent dba52f9de7
commit 01b1f2da4b
6 changed files with 22 additions and 13 deletions

View File

@ -113,11 +113,13 @@
creating? [:get :accounts/creating-account?]] creating? [:get :accounts/creating-account?]]
[view [view
[status-bar] [status-bar]
(let [hide-nav? (or (empty? accounts) show-actions? creating?)]
[toolbar/toolbar2 {:show-sync-bar? true} [toolbar/toolbar2 {:show-sync-bar? true}
(when-not hide-nav? toolbar/default-nav-back) (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-content-view]
[toolbar-action]]) [toolbar-action]]
[add-contact-bar]]) [add-contact-bar]])
(defn get-intro-status-message [all-messages] (defn get-intro-status-message [all-messages]

View File

@ -51,8 +51,7 @@
:android {:align-items :flex-start :android {:align-items :flex-start
:margin-left (if show-actions 66 18) :margin-left (if show-actions 66 18)
:padding-bottom 6} :padding-bottom 6}
:ios {:align-items :center :ios {:align-items :center}})
:margin-left (if show-actions 54 6)}})
(def chat-name-text (def chat-name-text
{:color color-gray6 {:color color-gray6

View File

@ -45,7 +45,7 @@
(when-not (str/blank? public-key) (when-not (str/blank? public-key)
{:db (update db :accounts/recover assoc :passphrase "" :password "") {:db (update db :accounts/recover assoc :passphrase "" :password "")
:dispatch-n [[:add-account account] :dispatch-n [[:add-account account]
[:navigate-back]]})))) [:navigate-to-clean :accounts]]}))))
(register-handler-fx (register-handler-fx
:recover-account :recover-account

View File

@ -40,16 +40,23 @@
:secure-text-entry true :secure-text-entry true
:error error}]])) :error error}]]))
(defview recover [] (defview recover [& [modal?]]
(letsubs [{:keys [passphrase password]} [:get :accounts/recover]] (letsubs [{:keys [passphrase password]} [:get :accounts/recover]]
(let [valid-form? (and (let [valid-form? (and
(spec/valid? ::v/passphrase passphrase) (spec/valid? ::v/passphrase passphrase)
(spec/valid? ::v/password password))] (spec/valid? ::v/password password))]
[keyboard-avoiding-view {:style st/screen-container} [keyboard-avoiding-view {:style st/screen-container}
[status-bar] [status-bar]
[toolbar {:title (i18n/label :t/recover-access)}] [toolbar {:title (i18n/label :t/recover-access) :modal? modal?}]
[passphrase-input (or passphrase "")] [passphrase-input (or passphrase "")]
[password-input (or password "")] [password-input (or password "")]
[view {:flex 1}] [view {:flex 1}]
(when valid-form? (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])

View File

@ -8,7 +8,7 @@
[status-im.components.context-menu :refer [menu-context]] [status-im.components.context-menu :refer [menu-context]]
[status-im.ui.screens.accounts.login.views :refer [login]] [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.ui.screens.accounts.views :refer [accounts]]
[status-im.chat.screen :refer [chat]] [status-im.chat.screen :refer [chat]]
@ -120,6 +120,7 @@
(let [component (case modal-view (let [component (case modal-view
:qr-scanner qr-scanner :qr-scanner qr-scanner
:qr-code-view qr-code-view :qr-code-view qr-code-view
:recover-modal recover-modal
:contact-list-modal contact-list-modal :contact-list-modal contact-list-modal
:wallet-transactions-filter wallet-transactions/filter-history :wallet-transactions-filter wallet-transactions/filter-history
:wallet-send-transaction-modal send-transaction-modal :wallet-send-transaction-modal send-transaction-modal

View File

@ -1,5 +1,5 @@
(ns status-im.ui.screens.wallet.wallet-list.views (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] (:require [clojure.string :as string]
[re-frame.core :as re-frame] [re-frame.core :as re-frame]
[status-im.components.list.views :as list] [status-im.components.list.views :as list]