mirror of
https://github.com/status-im/status-react.git
synced 2025-02-23 16:18:32 +00:00
Allow users to view the recovery phrase again when creating a profile for an empty keycard (#22009)
This commit is contained in:
parent
1a5008bcda
commit
4782b3eb2a
@ -20,6 +20,13 @@
|
|||||||
(rf/dispatch [:navigate-back])
|
(rf/dispatch [:navigate-back])
|
||||||
(rf/dispatch [:open-modal :screen/confirm-backup
|
(rf/dispatch [:open-modal :screen/confirm-backup
|
||||||
{:masked-seed-phrase masked-seed-phrase
|
{:masked-seed-phrase masked-seed-phrase
|
||||||
|
:on-try-again #(rf/dispatch [:open-modal :screen/backup-recovery-phrase-dark
|
||||||
|
{:on-success backup-recovery-phrase-success
|
||||||
|
:masked-seed-phrase (->> masked-seed-phrase
|
||||||
|
security/safe-unmask-data
|
||||||
|
(string/join " ")
|
||||||
|
security/mask-data)
|
||||||
|
:revealed? true}])
|
||||||
:on-success #(rf/dispatch [:keycard/create.phrase-backed-up
|
:on-success #(rf/dispatch [:keycard/create.phrase-backed-up
|
||||||
masked-seed-phrase])}]))
|
masked-seed-phrase])}]))
|
||||||
|
|
||||||
|
@ -57,6 +57,13 @@
|
|||||||
(rf/dispatch [:navigate-back])
|
(rf/dispatch [:navigate-back])
|
||||||
(rf/dispatch [:open-modal :screen/confirm-backup
|
(rf/dispatch [:open-modal :screen/confirm-backup
|
||||||
{:masked-seed-phrase masked-seed-phrase
|
{:masked-seed-phrase masked-seed-phrase
|
||||||
|
:on-try-again #(rf/dispatch [:open-modal :screen/backup-recovery-phrase-dark
|
||||||
|
{:on-success backup-recovery-phrase-success
|
||||||
|
:masked-seed-phrase (->> masked-seed-phrase
|
||||||
|
security/safe-unmask-data
|
||||||
|
(string/join " ")
|
||||||
|
security/mask-data)
|
||||||
|
:revealed? true}])
|
||||||
:on-success #(rf/dispatch [:keycard/migration.phrase-backed-up])}]))
|
:on-success #(rf/dispatch [:keycard/migration.phrase-backed-up])}]))
|
||||||
|
|
||||||
(rf/reg-event-fx :keycard/migration.get-phrase
|
(rf/reg-event-fx :keycard/migration.get-phrase
|
||||||
|
@ -44,22 +44,23 @@
|
|||||||
|
|
||||||
(defn view
|
(defn view
|
||||||
[]
|
[]
|
||||||
(let [step-labels [:t/backup-step-1 :t/backup-step-2 :t/backup-step-3
|
(let [step-labels [:t/backup-step-1 :t/backup-step-2 :t/backup-step-3
|
||||||
:t/backup-step-4]
|
:t/backup-step-4]
|
||||||
checked? (reagent/atom
|
checked? (reagent/atom
|
||||||
{:0 false
|
{:0 false
|
||||||
:1 false
|
:1 false
|
||||||
:2 false
|
:2 false
|
||||||
:3 false})
|
:3 false})
|
||||||
revealed? (reagent/atom false)
|
{:keys [on-success masked-seed-phrase
|
||||||
customization-color (rf/sub [:profile/customization-color])
|
revealed?]} (rf/sub [:get-screen-params])
|
||||||
{:keys [on-success masked-seed-phrase]} (rf/sub [:get-screen-params])
|
revealed? (reagent/atom revealed?)
|
||||||
seed-phrase (reagent/atom (if masked-seed-phrase
|
customization-color (rf/sub [:profile/customization-color])
|
||||||
(->
|
seed-phrase (reagent/atom (if masked-seed-phrase
|
||||||
(security/safe-unmask-data
|
(->
|
||||||
masked-seed-phrase)
|
(security/safe-unmask-data
|
||||||
(string/split #"\s"))
|
masked-seed-phrase)
|
||||||
[]))]
|
(string/split #"\s"))
|
||||||
|
[]))]
|
||||||
(fn []
|
(fn []
|
||||||
(let [theme (quo.theme/use-theme)]
|
(let [theme (quo.theme/use-theme)]
|
||||||
(rn/use-mount
|
(rn/use-mount
|
||||||
@ -108,8 +109,7 @@
|
|||||||
[quo/bottom-actions
|
[quo/bottom-actions
|
||||||
{:actions :one-action
|
{:actions :one-action
|
||||||
:button-one-label (i18n/label :t/i-have-written)
|
:button-one-label (i18n/label :t/i-have-written)
|
||||||
:button-one-props {:disabled? (some false? (vals @checked?))
|
:button-one-props {:customization-color customization-color
|
||||||
:customization-color customization-color
|
|
||||||
:on-press #(on-success (security/mask-data @seed-phrase))}}]
|
:on-press #(on-success (security/mask-data @seed-phrase))}}]
|
||||||
[quo/text
|
[quo/text
|
||||||
{:size :paragraph-2
|
{:size :paragraph-2
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
[(subvec result 0 2) (subvec result 2 4)]))
|
[(subvec result 0 2) (subvec result 2 4)]))
|
||||||
|
|
||||||
(defn- cheat-warning
|
(defn- cheat-warning
|
||||||
[]
|
[on-try-again]
|
||||||
(let [customization-color (rf/sub [:profile/customization-color])]
|
(let [customization-color (rf/sub [:profile/customization-color])]
|
||||||
[:<>
|
[:<>
|
||||||
[quo/drawer-top {:title (i18n/label :t/do-not-cheat)}]
|
[quo/drawer-top {:title (i18n/label :t/do-not-cheat)}]
|
||||||
@ -43,7 +43,9 @@
|
|||||||
:button-one-props {:customization-color customization-color
|
:button-one-props {:customization-color customization-color
|
||||||
:on-press (fn []
|
:on-press (fn []
|
||||||
(rf/dispatch [:hide-bottom-sheet])
|
(rf/dispatch [:hide-bottom-sheet])
|
||||||
(rf/dispatch [:navigate-back]))}}]]))
|
(rf/dispatch [:navigate-back])
|
||||||
|
(when on-try-again
|
||||||
|
(on-try-again)))}}]]))
|
||||||
|
|
||||||
(defn- button
|
(defn- button
|
||||||
[{:keys [word margin-right on-press]}]
|
[{:keys [word margin-right on-press]}]
|
||||||
@ -95,6 +97,7 @@
|
|||||||
incorrect-count (reagent/atom 0)
|
incorrect-count (reagent/atom 0)
|
||||||
show-error? (reagent/atom false)
|
show-error? (reagent/atom false)
|
||||||
{:keys [on-success
|
{:keys [on-success
|
||||||
|
on-try-again
|
||||||
masked-seed-phrase]} (rf/sub [:get-screen-params])
|
masked-seed-phrase]} (rf/sub [:get-screen-params])
|
||||||
unmasked-seed-phrase (security/safe-unmask-data masked-seed-phrase)
|
unmasked-seed-phrase (security/safe-unmask-data masked-seed-phrase)
|
||||||
random-phrase (reagent/atom [])]
|
random-phrase (reagent/atom [])]
|
||||||
@ -121,7 +124,9 @@
|
|||||||
(do
|
(do
|
||||||
(when (> @incorrect-count 0)
|
(when (> @incorrect-count 0)
|
||||||
(rf/dispatch [:show-bottom-sheet
|
(rf/dispatch [:show-bottom-sheet
|
||||||
{:content cheat-warning}]))
|
{:content (fn []
|
||||||
|
[cheat-warning
|
||||||
|
on-try-again])}]))
|
||||||
(reset! incorrect-count (inc @incorrect-count))
|
(reset! incorrect-count (inc @incorrect-count))
|
||||||
(reset! show-error? true))))]
|
(reset! show-error? true))))]
|
||||||
[rn/view {:style {:flex 1}}
|
[rn/view {:style {:flex 1}}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user