Allow users to view the recovery phrase again when creating a profile for an empty keycard (#22009)

This commit is contained in:
Parvesh Monu 2025-02-05 20:58:16 +05:30 committed by GitHub
parent 1a5008bcda
commit 4782b3eb2a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 40 additions and 21 deletions

View File

@ -20,6 +20,13 @@
(rf/dispatch [:navigate-back])
(rf/dispatch [:open-modal :screen/confirm-backup
{: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
masked-seed-phrase])}]))

View File

@ -57,6 +57,13 @@
(rf/dispatch [:navigate-back])
(rf/dispatch [:open-modal :screen/confirm-backup
{: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])}]))
(rf/reg-event-fx :keycard/migration.get-phrase

View File

@ -51,9 +51,10 @@
:1 false
:2 false
:3 false})
revealed? (reagent/atom false)
{:keys [on-success masked-seed-phrase
revealed?]} (rf/sub [:get-screen-params])
revealed? (reagent/atom revealed?)
customization-color (rf/sub [:profile/customization-color])
{:keys [on-success masked-seed-phrase]} (rf/sub [:get-screen-params])
seed-phrase (reagent/atom (if masked-seed-phrase
(->
(security/safe-unmask-data
@ -108,8 +109,7 @@
[quo/bottom-actions
{:actions :one-action
:button-one-label (i18n/label :t/i-have-written)
:button-one-props {:disabled? (some false? (vals @checked?))
:customization-color customization-color
:button-one-props {:customization-color customization-color
:on-press #(on-success (security/mask-data @seed-phrase))}}]
[quo/text
{:size :paragraph-2

View File

@ -31,7 +31,7 @@
[(subvec result 0 2) (subvec result 2 4)]))
(defn- cheat-warning
[]
[on-try-again]
(let [customization-color (rf/sub [:profile/customization-color])]
[:<>
[quo/drawer-top {:title (i18n/label :t/do-not-cheat)}]
@ -43,7 +43,9 @@
:button-one-props {:customization-color customization-color
:on-press (fn []
(rf/dispatch [:hide-bottom-sheet])
(rf/dispatch [:navigate-back]))}}]]))
(rf/dispatch [:navigate-back])
(when on-try-again
(on-try-again)))}}]]))
(defn- button
[{:keys [word margin-right on-press]}]
@ -95,6 +97,7 @@
incorrect-count (reagent/atom 0)
show-error? (reagent/atom false)
{:keys [on-success
on-try-again
masked-seed-phrase]} (rf/sub [:get-screen-params])
unmasked-seed-phrase (security/safe-unmask-data masked-seed-phrase)
random-phrase (reagent/atom [])]
@ -121,7 +124,9 @@
(do
(when (> @incorrect-count 0)
(rf/dispatch [:show-bottom-sheet
{:content cheat-warning}]))
{:content (fn []
[cheat-warning
on-try-again])}]))
(reset! incorrect-count (inc @incorrect-count))
(reset! show-error? true))))]
[rn/view {:style {:flex 1}}