mirror of
https://github.com/status-im/status-mobile.git
synced 2025-01-13 02:04:28 +00:00
Merge password screens
Update e2e Small UX feedback changes Signed-off-by: Gheorghe Pinzaru <feross95@gmail.com>
This commit is contained in:
parent
df9062475c
commit
5c05174604
@ -1,7 +1,9 @@
|
||||
(ns quo.platform
|
||||
(:require [quo.react-native :as rn]))
|
||||
(:require ["react-native" :as rn]))
|
||||
|
||||
(def os (when rn/platform (.-OS rn/platform)))
|
||||
(def platform (.-Platform ^js rn))
|
||||
|
||||
(def os (when platform (.-OS platform)))
|
||||
|
||||
(def android? (= os "android"))
|
||||
(def ios? (= os "ios"))
|
||||
|
@ -1,6 +1,7 @@
|
||||
(ns quo.react-native
|
||||
(:require [reagent.core :as reagent]
|
||||
[cljs-bean.core :as bean]
|
||||
[quo.platform :as platform]
|
||||
["react-native" :as rn]
|
||||
["@react-native-community/hooks" :as hooks]))
|
||||
|
||||
@ -20,9 +21,19 @@
|
||||
(def touchable-without-feedback (reagent/adapt-react-class (.-TouchableWithoutFeedback ^js rn)))
|
||||
(def text-input (reagent/adapt-react-class (.-TextInput ^js rn)))
|
||||
|
||||
(def keyboard-avoiding-view (reagent/adapt-react-class (.-KeyboardAvoidingView ^js rn)))
|
||||
(def keyboard-avoiding-view-class (reagent/adapt-react-class (.-KeyboardAvoidingView ^js rn)))
|
||||
|
||||
(defn keyboard-avoiding-view []
|
||||
(let [this (reagent/current-component)
|
||||
props (reagent/props this)]
|
||||
(into [keyboard-avoiding-view-class
|
||||
(merge (when platform/ios?
|
||||
{:behavior :padding})
|
||||
props)]
|
||||
(reagent/children this))))
|
||||
|
||||
(def keyboard (.-Keyboard ^js rn))
|
||||
|
||||
(def dismiss-keyboard! #(.dismiss ^js keyboard))
|
||||
|
||||
(def ui-manager (.-UIManager ^js rn))
|
||||
@ -33,10 +44,8 @@
|
||||
:linear (-> ^js layout-animation .-Presets .-linear)
|
||||
:spring (-> ^js layout-animation .-Presets .-spring)})
|
||||
|
||||
(def activity-indicator-class (reagent/adapt-react-class (.-ActivityIndicator ^js rn)))
|
||||
|
||||
(defn activity-indicator [props]
|
||||
[activity-indicator-class props])
|
||||
(def switch (reagent/adapt-react-class (.-Switch ^js rn)))
|
||||
(def activity-indicator (reagent/adapt-react-class (.-ActivityIndicator ^js rn)))
|
||||
|
||||
;; Flat-list
|
||||
(def ^:private rn-flat-list (reagent/adapt-react-class (.-FlatList ^js rn)))
|
||||
|
@ -7,7 +7,6 @@
|
||||
[status-im.ethereum.eip55 :as eip55]
|
||||
[status-im.keycard.nfc :as nfc]
|
||||
[status-im.i18n :as i18n]
|
||||
[status-im.multiaccounts.db :as db]
|
||||
[status-im.native-module.core :as status]
|
||||
[status-im.node.core :as node]
|
||||
[status-im.ui.components.bottom-sheet.core :as bottom-sheet]
|
||||
@ -26,8 +25,7 @@
|
||||
{:generate-key 1
|
||||
:choose-key 2
|
||||
:select-key-storage 3
|
||||
:create-code 4
|
||||
:confirm-code 5})
|
||||
:create-code 4})
|
||||
|
||||
(defn decrement-step [step]
|
||||
(let [inverted (map-invert step-kw-to-num)]
|
||||
@ -69,8 +67,8 @@
|
||||
(update :derived normalize-derived-data-keys)))
|
||||
|
||||
(fx/defn create-multiaccount
|
||||
[{:keys [db]}]
|
||||
(let [{:keys [selected-id key-code]} (:intro-wizard db)
|
||||
[{:keys [db]} key-code]
|
||||
(let [{:keys [selected-id]} (:intro-wizard db)
|
||||
key-uid (some
|
||||
(fn [{:keys [id key-uid]}]
|
||||
(when (= id selected-id)
|
||||
@ -94,10 +92,8 @@
|
||||
(fx/defn prepare-intro-wizard
|
||||
[{:keys [db] :as cofx}]
|
||||
{:db (assoc db :intro-wizard {:step :generate-key
|
||||
:weak-password? true
|
||||
:back-action :intro-wizard/navigate-back
|
||||
:forward-action :intro-wizard/step-forward-pressed
|
||||
:encrypt-with-password? true})})
|
||||
:forward-action :intro-wizard/step-forward-pressed})})
|
||||
|
||||
(fx/defn intro-wizard
|
||||
{:events [:multiaccounts.create.ui/intro-wizard]}
|
||||
@ -121,11 +117,7 @@
|
||||
(let [step (get-in db [:intro-wizard :step])]
|
||||
(fx/merge cofx
|
||||
(when-not (= :generate-key step)
|
||||
{:db (cond-> (assoc-in db [:intro-wizard :step] (decrement-step step))
|
||||
(#{:create-code :confirm-code} step)
|
||||
(update :intro-wizard assoc :weak-password? true :key-code nil)
|
||||
(= step :confirm-code)
|
||||
(assoc-in [:intro-wizard :confirm-failure?] false))})
|
||||
{:db (assoc-in db [:intro-wizard :step] (decrement-step step))})
|
||||
(when (= :generate-key-step)
|
||||
{:db (dissoc db :intro-wizard)}))))
|
||||
|
||||
@ -154,18 +146,6 @@
|
||||
{:db (assoc-in db [:intro-wizard :processing?] true)
|
||||
:intro-wizard/start-onboarding nil})
|
||||
|
||||
(fx/defn on-confirm-failure [{:keys [db] :as cofx}]
|
||||
(do
|
||||
(utils/vibrate)
|
||||
{:db (assoc-in db [:intro-wizard :confirm-failure?] true)}))
|
||||
|
||||
(defn confirm-failure? [db]
|
||||
(let [step (get-in db [:intro-wizard :step])]
|
||||
(and (= step :confirm-code)
|
||||
(not (:multiaccounts/login db))
|
||||
(get-in db [:intro-wizard :encrypt-with-password?])
|
||||
(not= (get-in db [:intro-wizard :stored-key-code]) (get-in db [:intro-wizard :key-code])))))
|
||||
|
||||
(fx/defn store-key-code [{:keys [db] :as cofx}]
|
||||
(let [key-code (get-in db [:intro-wizard :key-code])]
|
||||
{:db (update db :intro-wizard
|
||||
@ -174,27 +154,20 @@
|
||||
|
||||
(fx/defn intro-step-forward
|
||||
{:events [:intro-wizard/step-forward-pressed]}
|
||||
[{:keys [db] :as cofx} {:keys [skip?] :as opts}]
|
||||
(let [{:keys [step selected-storage-type processing? weak-password?]} (:intro-wizard db)]
|
||||
[{:keys [db] :as cofx} {:keys [skip? key-code] :as opts}]
|
||||
(let [{:keys [step selected-storage-type processing?]} (:intro-wizard db)]
|
||||
(log/debug "[multiaccount.create] intro-step-forward"
|
||||
"step" step)
|
||||
(cond (confirm-failure? db)
|
||||
(on-confirm-failure cofx)
|
||||
|
||||
(= step :generate-key)
|
||||
(cond (= step :generate-key)
|
||||
(init-key-generation cofx)
|
||||
|
||||
(and (= step :create-code)
|
||||
(= weak-password? true))
|
||||
nil
|
||||
|
||||
(and (= step :confirm-code)
|
||||
(not processing?))
|
||||
(fx/merge cofx
|
||||
{:db (assoc-in db [:intro-wizard :processing?] true)}
|
||||
create-multiaccount)
|
||||
(create-multiaccount key-code))
|
||||
|
||||
(and (= step :confirm-code)
|
||||
(and (= step :create-code)
|
||||
(:multiaccounts/login db))
|
||||
(exit-wizard cofx)
|
||||
|
||||
@ -363,33 +336,11 @@
|
||||
[{:keys [db] :as cofx} storage-type]
|
||||
{:db (assoc-in db [:intro-wizard :selected-storage-type] storage-type)})
|
||||
|
||||
(fx/defn on-encrypt-with-password-pressed
|
||||
{:events [:intro-wizard/on-encrypt-with-password-pressed]}
|
||||
[{:keys [db] :as cofx}]
|
||||
{:db (assoc-in db [:intro-wizard :encrypt-with-password?] true)})
|
||||
|
||||
(fx/defn on-learn-more-pressed
|
||||
{:events [:intro-wizard/on-learn-more-pressed]}
|
||||
[{:keys [db] :as cofx}]
|
||||
{:db (assoc-in db [:intro-wizard :show-learn-more?] true)})
|
||||
|
||||
(defn get-new-key-code [current-code sym encrypt-with-password?]
|
||||
(cond (or (= sym :remove) (= sym "Backspace"))
|
||||
(subs current-code 0 (dec (count current-code)))
|
||||
(and (not encrypt-with-password?) (= (count current-code) 6))
|
||||
current-code
|
||||
(= (count sym) 1)
|
||||
(str current-code sym)
|
||||
:else current-code))
|
||||
|
||||
(fx/defn code-symbol-pressed
|
||||
{:events [:intro-wizard/code-symbol-pressed]}
|
||||
[{:keys [db] :as cofx} new-key-code]
|
||||
(let [encrypt-with-password? (get-in db [:intro-wizard :encrypt-with-password?])]
|
||||
{:db (update db :intro-wizard assoc :key-code new-key-code
|
||||
:confirm-failure? false
|
||||
:weak-password? (not (db/valid-length? new-key-code)))}))
|
||||
|
||||
(re-frame/reg-cofx
|
||||
::get-signing-phrase
|
||||
(fn [cofx _]
|
||||
|
@ -77,28 +77,14 @@
|
||||
|
||||
(fx/defn store-multiaccount
|
||||
{:events [::recover-multiaccount-confirmed]}
|
||||
[{:keys [db]}]
|
||||
(let [password (get-in db [:intro-wizard :key-code])
|
||||
{:keys [root-key]} (:intro-wizard db)
|
||||
[{:keys [db]} password]
|
||||
(let [{:keys [root-key]} (:intro-wizard db)
|
||||
{:keys [id key-uid]} root-key
|
||||
callback #(re-frame/dispatch [::store-multiaccount-success % password])
|
||||
hashed-password (ethereum/sha3 (security/safe-unmask-data password))]
|
||||
{:db (assoc-in db [:intro-wizard :processing?] true)
|
||||
::multiaccounts.create/store-multiaccount [id key-uid hashed-password callback]}))
|
||||
|
||||
(fx/defn recover-multiaccount-with-checks
|
||||
{:events [::sign-in-button-pressed]}
|
||||
[{:keys [db] :as cofx}]
|
||||
(let [{:keys [passphrase processing?]} (:intro-wizard db)]
|
||||
(when-not processing?
|
||||
(if (mnemonic/status-generated-phrase? passphrase)
|
||||
(store-multiaccount cofx)
|
||||
{:ui/show-confirmation
|
||||
{:title (i18n/label :recovery-typo-dialog-title)
|
||||
:content (i18n/label :recovery-typo-dialog-description)
|
||||
:confirm-button-text (i18n/label :recovery-confirm-phrase)
|
||||
:on-accept #(re-frame/dispatch [::recover-multiaccount-confirmed])}}))))
|
||||
|
||||
(re-frame/reg-fx
|
||||
::import-multiaccount
|
||||
(fn [{:keys [passphrase password]}]
|
||||
@ -210,11 +196,9 @@
|
||||
(case step
|
||||
:recovery-success :enter-phrase
|
||||
:select-key-storage :recovery-success
|
||||
:create-code :select-key-storage
|
||||
:confirm-code :create-code)
|
||||
:create-code :select-key-storage)
|
||||
:confirm-failure? false
|
||||
:key-code nil
|
||||
:weak-password? true)})))
|
||||
:key-code nil)})))
|
||||
|
||||
(fx/defn cancel-pressed
|
||||
{:events [:multiaccounts.recover/cancel-pressed]}
|
||||
@ -259,31 +243,11 @@
|
||||
(navigation/navigate-to-cofx :recover-multiaccount-select-storage nil)
|
||||
(select-storage-next-pressed))))
|
||||
|
||||
(fx/defn proceed-to-password-confirm
|
||||
[{:keys [db] :as cofx}]
|
||||
(fx/merge cofx
|
||||
{:db (update db :intro-wizard assoc :step :confirm-code
|
||||
:forward-action :multiaccounts.recover/confirm-password-next-pressed)}
|
||||
(navigation/navigate-to-cofx :recover-multiaccount-confirm-password nil)))
|
||||
|
||||
(fx/defn enter-password-next-button-pressed
|
||||
{:events [:multiaccounts.recover/enter-password-next-pressed]}
|
||||
[{:keys [db] :as cofx}]
|
||||
(fx/merge cofx
|
||||
{:db (-> db
|
||||
(assoc-in [:intro-wizard :stored-key-code] (get-in db [:intro-wizard :key-code]))
|
||||
(assoc-in [:intro-wizard :key-code] ""))}
|
||||
(proceed-to-password-confirm)))
|
||||
|
||||
(fx/defn confirm-password-next-button-pressed
|
||||
{:events [:multiaccounts.recover/confirm-password-next-pressed]
|
||||
{:events [:multiaccounts.recover/enter-password-next-pressed]
|
||||
:interceptors [(re-frame/inject-cofx :random-guid-generator)]}
|
||||
[{:keys [db] :as cofx}]
|
||||
(let [{:keys [key-code stored-key-code]} (:intro-wizard db)]
|
||||
(if (= key-code stored-key-code)
|
||||
(fx/merge cofx
|
||||
(store-multiaccount))
|
||||
{:db (assoc-in db [:intro-wizard :confirm-failure?] true)})))
|
||||
[{:keys [db] :as cofx} {:keys [key-code]}]
|
||||
(store-multiaccount cofx key-code))
|
||||
|
||||
(fx/defn count-words
|
||||
[{:keys [db]}]
|
||||
|
@ -2,8 +2,7 @@
|
||||
(:require [cljs.test :refer-macros [deftest is testing]]
|
||||
[status-im.multiaccounts.recover.core :as models]
|
||||
[status-im.multiaccounts.create.core :as multiaccounts.create]
|
||||
[status-im.utils.security :as security]
|
||||
[status-im.i18n :as i18n]))
|
||||
[status-im.utils.security :as security]))
|
||||
|
||||
;;;; helpers
|
||||
|
||||
@ -37,22 +36,10 @@
|
||||
|
||||
(deftest store-multiaccount
|
||||
(let [new-cofx (models/store-multiaccount {:db {:intro-wizard
|
||||
{:passphrase "game buzz method pretty zeus fat quit display velvet unveil marine crater"
|
||||
:password "thisisapaswoord"}}})]
|
||||
{:passphrase "game buzz method pretty zeus fat quit display velvet unveil marine crater"}}}
|
||||
(security/mask-data "thisisapaswoord"))]
|
||||
(is (::multiaccounts.create/store-multiaccount new-cofx))))
|
||||
|
||||
(deftest recover-multiaccount-with-checks
|
||||
(let [new-cofx (models/recover-multiaccount-with-checks {:db {:intro-wizard
|
||||
{:passphrase "game buzz method pretty olympic fat quit display velvet unveil marine crater"
|
||||
:password "thisisapaswoord"}}})]
|
||||
(is (::multiaccounts.create/store-multiaccount new-cofx)))
|
||||
(let [new-cofx (models/recover-multiaccount-with-checks {:db {:intro-wizard
|
||||
{:passphrase "game buzz method pretty zeus fat quit display velvet unveil marine crater"
|
||||
:password "thisisapaswoord"}}})]
|
||||
(is (= (i18n/label :recovery-typo-dialog-title) (-> new-cofx :ui/show-confirmation :title)))
|
||||
(is (= (i18n/label :recovery-typo-dialog-description) (-> new-cofx :ui/show-confirmation :content)))
|
||||
(is (= (i18n/label :recovery-confirm-phrase) (-> new-cofx :ui/show-confirmation :confirm-button-text)))))
|
||||
|
||||
(deftest on-import-multiaccount-success
|
||||
(testing "importing a new multiaccount"
|
||||
(let [res (models/on-import-multiaccount-success
|
||||
|
@ -231,20 +231,11 @@
|
||||
:intro-wizard/create-code
|
||||
:<- [:intro-wizard]
|
||||
(fn [wizard-state]
|
||||
(merge (select-keys wizard-state [:confirm-failure? :encrypt-with-password? :weak-password? :view-width])
|
||||
(merge (select-keys wizard-state [:processing?])
|
||||
(if (:recovering? wizard-state)
|
||||
{:forward-action :multiaccounts.recover/enter-password-next-pressed}
|
||||
{:forward-action :intro-wizard/step-forward-pressed}))))
|
||||
|
||||
(re-frame/reg-sub
|
||||
:intro-wizard/confirm-code
|
||||
:<- [:intro-wizard]
|
||||
(fn [wizard-state]
|
||||
(merge (select-keys wizard-state [:confirm-failure? :encrypt-with-password? :processing? :view-width])
|
||||
(if (:recovering? wizard-state)
|
||||
{:forward-action :multiaccounts.recover/confirm-password-next-pressed}
|
||||
{:forward-action :intro-wizard/step-forward-pressed}))))
|
||||
|
||||
(re-frame/reg-sub
|
||||
:intro-wizard/enter-phrase
|
||||
:<- [:intro-wizard]
|
||||
|
112
src/status_im/ui/screens/intro/password.cljs
Normal file
112
src/status_im/ui/screens/intro/password.cljs
Normal file
@ -0,0 +1,112 @@
|
||||
(ns status-im.ui.screens.intro.password
|
||||
(:require [re-frame.core :as re-frame]
|
||||
[reagent.core :as reagent]
|
||||
[status-im.ui.components.topbar :as topbar]
|
||||
[status-im.ui.components.toolbar :as toolbar]
|
||||
[status-im.i18n :as i18n]
|
||||
[status-im.constants :as const]
|
||||
[status-im.utils.security :as security]
|
||||
[quo.react-native :as rn]
|
||||
[quo.core :as quo]))
|
||||
|
||||
(defn validate-password [password]
|
||||
(>= (count password) const/min-password-length))
|
||||
|
||||
(defn confirm-password [password confirm]
|
||||
(= password confirm))
|
||||
|
||||
(defn screen []
|
||||
(let [password (reagent/atom nil)
|
||||
confirm (reagent/atom nil)
|
||||
show-error (reagent/atom nil)
|
||||
confirm-ref (atom nil)]
|
||||
(fn []
|
||||
(let [{:keys [forward-action processing?]}
|
||||
@(re-frame/subscribe [:intro-wizard/create-code])
|
||||
valid-password (validate-password @password)
|
||||
valid-form (confirm-password @password @confirm)
|
||||
on-submit (fn []
|
||||
(when (not processing?)
|
||||
(if valid-form
|
||||
(do (reset! show-error false)
|
||||
(re-frame/dispatch [forward-action {:key-code @password}]))
|
||||
(reset! show-error true))))]
|
||||
[rn/keyboard-avoiding-view {:flex 1}
|
||||
[topbar/topbar
|
||||
{:navigation
|
||||
{:icon :main-icons/back
|
||||
:accessibility-label :back-button
|
||||
:handler #(re-frame/dispatch [:intro-wizard/navigate-back])}}]
|
||||
[rn/view {:style {:flex 1
|
||||
:justify-content :space-between
|
||||
:padding-vertical 16
|
||||
:padding-horizontal 16}}
|
||||
|
||||
[rn/view
|
||||
[quo/text {:weight :bold
|
||||
:align :center
|
||||
:size :x-large}
|
||||
(i18n/label :intro-wizard-title-alt4)]]
|
||||
[rn/view
|
||||
[rn/view {:style {:padding 16}}
|
||||
[quo/text-input {:secure-text-entry true
|
||||
:auto-capitalize :none
|
||||
:auto-focus true
|
||||
:show-cancel false
|
||||
:accessibility-label :password-input
|
||||
:placeholder (i18n/label :t/password-placeholder)
|
||||
:on-change-text #(reset! password (security/mask-data %))
|
||||
:return-key-type :next
|
||||
:on-submit-editing #(when valid-password
|
||||
(some-> ^js @confirm-ref .focus))}]]
|
||||
[rn/view {:style {:padding 16
|
||||
:opacity (if-not valid-password 0.33 1)}}
|
||||
[quo/text-input {:secure-text-entry true
|
||||
:get-ref #(reset! confirm-ref %)
|
||||
:auto-capitalize :none
|
||||
:show-cancel false
|
||||
:accessibility-label :password-input
|
||||
:editable valid-password
|
||||
:placeholder (i18n/label :t/confirm-password-placeholder)
|
||||
:return-key-type :go
|
||||
:error (when @show-error (i18n/label :t/password_error1))
|
||||
:blur-on-submit true
|
||||
:on-focus #(reset! show-error false)
|
||||
:on-submit-editing on-submit
|
||||
:on-change-text #(do
|
||||
(reset! confirm (security/mask-data %))
|
||||
(cond
|
||||
(> (count @password) (count @confirm))
|
||||
(reset! show-error false)
|
||||
|
||||
(not (confirm-password @password @confirm))
|
||||
(reset! show-error true)
|
||||
|
||||
:else (reset! show-error false)))}]]]
|
||||
[rn/view
|
||||
[quo/text {:color :secondary
|
||||
:align :center
|
||||
:size :small}
|
||||
(i18n/label :t/password-description)]]]
|
||||
[toolbar/toolbar
|
||||
(merge {:show-border? true}
|
||||
(if processing?
|
||||
{:center
|
||||
[rn/view {:align-items :center
|
||||
:justify-content :center
|
||||
:flex-direction :row}
|
||||
[rn/activity-indicator {:size :small
|
||||
:animating true}]
|
||||
[rn/view {:padding-horizontal 8}
|
||||
[quo/text {:color :secondary}
|
||||
(i18n/label :t/processing)]]]}
|
||||
{:right
|
||||
[quo/button
|
||||
{:on-press on-submit
|
||||
:accessibility-label :onboarding-next-button
|
||||
:disabled (or (nil? @confirm)
|
||||
(not valid-password)
|
||||
processing?)
|
||||
:type :secondary
|
||||
:after :main-icons/next}
|
||||
(i18n/label :t/next)]}))]]))))
|
@ -153,40 +153,7 @@
|
||||
:max-height 16}}]
|
||||
[storage-entry (second storage-types) selected-storage-type]]]]))
|
||||
|
||||
(defn password-container [confirm-failure? _]
|
||||
(let [horizontal-margin 16]
|
||||
[react/view {:style {:flex 1
|
||||
:justify-content :space-between
|
||||
:margin-horizontal horizontal-margin}}
|
||||
[react/view
|
||||
[react/text {:style (assoc styles/wizard-text :color colors/red
|
||||
:margin-bottom 16)}
|
||||
(if confirm-failure? (i18n/label :t/password_error1) " ")]]
|
||||
[react/view {:padding 16}
|
||||
[quo/text-input {:secure-text-entry true
|
||||
:auto-capitalize :none
|
||||
:auto-focus true
|
||||
:show-cancel false
|
||||
:accessibility-label :password-input
|
||||
:placeholder ""
|
||||
:on-change-text #(re-frame/dispatch [:intro-wizard/code-symbol-pressed %])}]]
|
||||
[react/text {:style (assoc styles/wizard-text :margin-bottom 16)} (i18n/label :t/password-description)]]))
|
||||
|
||||
(defn create-code [{:keys [confirm-failure? view-width]}]
|
||||
[password-container confirm-failure? view-width])
|
||||
|
||||
(defn confirm-code [{:keys [confirm-failure? processing? view-width]}]
|
||||
(if processing?
|
||||
[react/view {:style {:justify-content :center
|
||||
:align-items :center}}
|
||||
[react/activity-indicator {:size :large
|
||||
:animating true}]
|
||||
[react/text {:style {:color colors/gray
|
||||
:margin-top 8}}
|
||||
(i18n/label :t/processing)]]
|
||||
[password-container confirm-failure? view-width]))
|
||||
|
||||
(defn bottom-bar [{:keys [step weak-password? encrypt-with-password?
|
||||
(defn bottom-bar [{:keys [step weak-password?
|
||||
forward-action
|
||||
next-button-disabled?
|
||||
processing? existing-account?]}]
|
||||
@ -206,15 +173,6 @@
|
||||
:on-press #(re-frame/dispatch [forward-action])
|
||||
:accessibility-label :onboarding-next-button}
|
||||
(i18n/label label-kw)]])
|
||||
(and (#{:create-code :confirm-code} step)
|
||||
(not encrypt-with-password?))
|
||||
[react/view {:margin-bottom 16}
|
||||
[quo/button {:style styles/bottom-button
|
||||
:accessibility-label :encrypt-with-password-button
|
||||
:on-press #(re-frame/dispatch [:intro-wizard/on-encrypt-with-password-pressed])
|
||||
:type :secondary}
|
||||
(i18n/label :t/encrypt-with-password)]]
|
||||
|
||||
:else
|
||||
[toolbar/toolbar
|
||||
{:show-border? true
|
||||
@ -241,10 +199,8 @@
|
||||
processing? :t/generating-keys
|
||||
:else :t/this-will-take-few-seconds))])])
|
||||
|
||||
(defn top-bar [{:keys [step encrypt-with-password?]}]
|
||||
(let [hide-subtitle? (or (= step :confirm-code)
|
||||
(= step :enter-phrase)
|
||||
(and (#{:create-code :confirm-code} step) encrypt-with-password?))]
|
||||
(defn top-bar [{:keys [step]}]
|
||||
(let [hide-subtitle? (or (= step :enter-phrase))]
|
||||
[react/view {:style {:margin-top 16
|
||||
:margin-horizontal 32}}
|
||||
|
||||
@ -256,9 +212,7 @@
|
||||
:t/multiaccounts-recover-enter-phrase-title
|
||||
(= step :recovery-success)
|
||||
:t/keycard-recovery-success-header
|
||||
:else (keyword (str "intro-wizard-title"
|
||||
(when (and (#{:create-code :confirm-code} step) encrypt-with-password?)
|
||||
"-alt") (step-kw-to-num step)))))]
|
||||
:else (keyword (str "intro-wizard-title" (step-kw-to-num step)))))]
|
||||
(cond (#{:choose-key :select-key-storage} step)
|
||||
; Use nested text for the "Learn more" link
|
||||
[react/nested-text {:style (merge styles/wizard-text
|
||||
@ -408,40 +362,6 @@
|
||||
[bottom-bar {:step :select-key-storage
|
||||
:forward-action (:forward-action wizard-state)}]]]))
|
||||
|
||||
(defview wizard-create-code []
|
||||
(letsubs [wizard-state [:intro-wizard/create-code]]
|
||||
[react/keyboard-avoiding-view {:style {:flex 1}}
|
||||
[topbar/topbar
|
||||
{:navigation
|
||||
{:icon :main-icons/arrow-left
|
||||
:accessibility-label :back-button
|
||||
:handler #(re-frame/dispatch [:intro-wizard/navigate-back])}}]
|
||||
[react/view {:style {:flex 1
|
||||
:justify-content :space-between}}
|
||||
[top-bar {:step :create-code :encrypt-with-password? (:encrypt-with-password? wizard-state)}]
|
||||
[create-code wizard-state]
|
||||
[bottom-bar (merge {:step :create-code
|
||||
:forward-action (:forward-action wizard-state)}
|
||||
wizard-state)]]]))
|
||||
|
||||
(defview wizard-confirm-code []
|
||||
(letsubs [wizard-state [:intro-wizard/confirm-code]]
|
||||
[react/keyboard-avoiding-view {:style {:flex 1}}
|
||||
[topbar/topbar
|
||||
{:navigation
|
||||
(if (:processing? wizard-state)
|
||||
:none
|
||||
{:icon :main-icons/arrow-left
|
||||
:accessibility-label :back-button
|
||||
:handler #(re-frame/dispatch [:intro-wizard/navigate-back])})}]
|
||||
[react/view {:style {:flex 1
|
||||
:justify-content :space-between}}
|
||||
[top-bar {:step :confirm-code :encrypt-with-password? (:encrypt-with-password? wizard-state)}]
|
||||
[confirm-code wizard-state]
|
||||
[bottom-bar (merge {:step :confirm-code
|
||||
:forward-action (:forward-action wizard-state)}
|
||||
wizard-state)]]]))
|
||||
|
||||
(defview wizard-enter-phrase []
|
||||
(letsubs [wizard-state [:intro-wizard/enter-phrase]]
|
||||
[react/keyboard-avoiding-view {:style {:flex 1}}
|
||||
|
@ -7,6 +7,7 @@
|
||||
[status-im.ui.screens.keycard.onboarding.views :as keycard.onboarding]
|
||||
[status-im.ui.screens.keycard.recovery.views :as keycard.recovery]
|
||||
[status-im.ui.screens.keycard.views :as keycard]
|
||||
[status-im.ui.screens.intro.password :as password]
|
||||
[status-im.ui.screens.keycard.authentication-method.views
|
||||
:as
|
||||
keycard.authentication]
|
||||
@ -47,10 +48,7 @@
|
||||
:component intro/wizard-select-key-storage}
|
||||
{:name :create-multiaccount-create-code
|
||||
:back-handler :noop
|
||||
:component intro/wizard-create-code}
|
||||
{:name :create-multiaccount-confirm-code
|
||||
:back-handler :noop
|
||||
:component intro/wizard-confirm-code}
|
||||
:component password/screen}
|
||||
{:name :recover-multiaccount-enter-phrase
|
||||
:component intro/wizard-enter-phrase}
|
||||
{:name :recover-multiaccount-select-storage
|
||||
@ -58,10 +56,7 @@
|
||||
:component intro/wizard-select-key-storage}
|
||||
{:name :recover-multiaccount-enter-password
|
||||
:back-handler :noop
|
||||
:component intro/wizard-create-code}
|
||||
{:name :recover-multiaccount-confirm-password
|
||||
:back-handler :noop
|
||||
:component intro/wizard-confirm-code}
|
||||
:component password/screen}
|
||||
{:name :recover-multiaccount-success
|
||||
:back-handler :noop
|
||||
:component intro/wizard-recovery-success}
|
||||
|
@ -48,7 +48,6 @@ class TestCreateAccount(SingleDeviceTestCase):
|
||||
sign_in.next_button.click()
|
||||
sign_in.next_button.click()
|
||||
sign_in.create_password_input.set_value(common_password)
|
||||
sign_in.next_button.click()
|
||||
sign_in.confirm_your_password_input.set_value(common_password)
|
||||
sign_in.next_button.click()
|
||||
for element in sign_in.maybe_later_button, sign_in.lets_go_button:
|
||||
|
@ -70,15 +70,13 @@ class FirstKeyForChatText(BaseText):
|
||||
class CreatePasswordInput(BaseEditBox):
|
||||
def __init__(self, driver):
|
||||
super(CreatePasswordInput, self).__init__(driver)
|
||||
self.locator = self.Locator.xpath_selector("//android.widget.TextView[@text='Create a password']/.."
|
||||
"//android.widget.EditText")
|
||||
self.locator = self.Locator.xpath_selector("(//android.widget.EditText[@content-desc='password-input'])[1]")
|
||||
|
||||
|
||||
class ConfirmYourPasswordInput(BaseEditBox):
|
||||
def __init__(self, driver):
|
||||
super(ConfirmYourPasswordInput, self).__init__(driver)
|
||||
self.locator = self.Locator.xpath_selector("//android.widget.TextView[@text='Confirm your password']/.."
|
||||
"//android.widget.EditText")
|
||||
self.locator = self.Locator.xpath_selector("(//android.widget.EditText[@content-desc='password-input'])[2]")
|
||||
|
||||
|
||||
class SignInButton(BaseButton):
|
||||
@ -265,7 +263,6 @@ class SignInView(BaseView):
|
||||
else:
|
||||
self.next_button.click()
|
||||
self.create_password_input.set_value(password)
|
||||
self.next_button.click()
|
||||
self.confirm_your_password_input.set_value(password)
|
||||
self.next_button.click()
|
||||
self.maybe_later_button.wait_for_visibility_of_element(30)
|
||||
@ -288,7 +285,6 @@ class SignInView(BaseView):
|
||||
else:
|
||||
recover_access_view.next_button.click()
|
||||
recover_access_view.create_password_input.set_value(password)
|
||||
recover_access_view.next_button.click()
|
||||
recover_access_view.confirm_your_password_input.set_value(password)
|
||||
recover_access_view.next_button.click_until_presence_of_element(self.maybe_later_button)
|
||||
self.maybe_later_button.wait_for_element(30)
|
||||
|
@ -417,6 +417,8 @@
|
||||
"pair-code-placeholder": "Pair code...",
|
||||
"enter-pair-code-description": "Pairing code was displayed to you during the Keycard setup",
|
||||
"enter-password": "Enter password",
|
||||
"password-placeholder":"Password...",
|
||||
"confirm-password-placeholder": "Confirm your password...",
|
||||
"enter-pin": "Enter 6-digit passcode",
|
||||
"enter-puk-code": "Enter PUK code",
|
||||
"enter-puk-code-description": "6-digit passcode has been blocked.\n Please enter PUK code to unblock passcode.",
|
||||
|
Loading…
x
Reference in New Issue
Block a user