|
24 | 24 | (on-success mnemonic keyUID)))))))
|
25 | 25 |
|
26 | 26 | (rf/defn profile-data-set
|
27 |
| - {:events [:onboarding-2/profile-data-set]} |
| 27 | + {:events [:onboarding/profile-data-set]} |
28 | 28 | [{:keys [db]} onboarding-data]
|
29 |
| - {:db (update db :onboarding-2/profile merge onboarding-data) |
| 29 | + {:db (update db :onboarding/profile merge onboarding-data) |
30 | 30 | :dispatch [:navigate-to-within-stack [:create-profile-password :new-to-status]]})
|
31 | 31 |
|
32 | 32 | (rf/defn enable-biometrics
|
33 |
| - {:events [:onboarding-2/enable-biometrics]} |
| 33 | + {:events [:onboarding/enable-biometrics]} |
34 | 34 | [_]
|
35 |
| - {:biometric/authenticate {:on-success #(rf/dispatch [:onboarding-2/biometrics-done]) |
36 |
| - :on-fail #(rf/dispatch [:onboarding-2/biometrics-fail %])}}) |
| 35 | + {:biometric/authenticate {:on-success #(rf/dispatch [:onboarding/biometrics-done]) |
| 36 | + :on-fail #(rf/dispatch [:onboarding/biometrics-fail %])}}) |
37 | 37 |
|
38 | 38 | (rf/defn navigate-to-enable-notifications
|
39 |
| - {:events [:onboarding-2/navigate-to-enable-notifications]} |
| 39 | + {:events [:onboarding/navigate-to-enable-notifications]} |
40 | 40 | [{:keys [db]}]
|
41 | 41 | (let [key-uid (get-in db [:profile/profile :key-uid])]
|
42 |
| - {:db (dissoc db :onboarding-2/profile) |
| 42 | + {:db (dissoc db :onboarding/profile) |
43 | 43 | :dispatch [:navigate-to-within-stack [:enable-notifications :enable-biometrics]]}))
|
44 | 44 |
|
45 | 45 | (rf/defn biometrics-done
|
46 |
| - {:events [:onboarding-2/biometrics-done]} |
| 46 | + {:events [:onboarding/biometrics-done]} |
47 | 47 | [{:keys [db]}]
|
48 |
| - (let [syncing? (get-in db [:onboarding-2/profile :syncing?])] |
49 |
| - {:db (assoc-in db [:onboarding-2/profile :auth-method] constants/auth-method-biometric) |
| 48 | + (let [syncing? (get-in db [:onboarding/profile :syncing?])] |
| 49 | + {:db (assoc-in db [:onboarding/profile :auth-method] constants/auth-method-biometric) |
50 | 50 | :dispatch (if syncing?
|
51 |
| - [:onboarding-2/finalize-setup] |
52 |
| - [:onboarding-2/create-account-and-login])})) |
| 51 | + [:onboarding/finalize-setup] |
| 52 | + [:onboarding/create-account-and-login])})) |
53 | 53 |
|
54 | 54 | (rf/defn biometrics-fail
|
55 |
| - {:events [:onboarding-2/biometrics-fail]} |
| 55 | + {:events [:onboarding/biometrics-fail]} |
56 | 56 | [cofx code]
|
57 | 57 | (biometric/show-message cofx code))
|
58 | 58 |
|
59 | 59 | (rf/defn create-account-and-login
|
60 |
| - {:events [:onboarding-2/create-account-and-login]} |
| 60 | + {:events [:onboarding/create-account-and-login]} |
61 | 61 | [{:keys [db] :as cofx}]
|
62 | 62 | (let [{:keys [display-name seed-phrase password image-path color] :as profile}
|
63 |
| - (:onboarding-2/profile db)] |
| 63 | + (:onboarding/profile db)] |
64 | 64 | (rf/merge cofx
|
65 | 65 | {:dispatch [:navigate-to-within-stack [:generating-keys :new-to-status]]
|
66 | 66 | :dispatch-later [{:ms constants/onboarding-generating-keys-animation-duration-ms
|
67 |
| - :dispatch [:onboarding-2/navigate-to-identifiers]}] |
| 67 | + :dispatch [:onboarding/navigate-to-identifiers]}] |
68 | 68 | :db (-> db
|
69 | 69 | (dissoc :profile/login)
|
70 | 70 | (dissoc :auth-method)
|
71 |
| - (assoc :onboarding-2/new-account? true))} |
| 71 | + (assoc :onboarding/new-account? true))} |
72 | 72 | (if seed-phrase
|
73 | 73 | (profile.recover/recover-profile-and-login profile)
|
74 | 74 | (profile.create/create-profile-and-login profile)))))
|
75 | 75 |
|
76 | 76 | (rf/defn on-delete-profile-success
|
77 |
| - {:events [:onboarding-2/on-delete-profile-success]} |
| 77 | + {:events [:onboarding/on-delete-profile-success]} |
78 | 78 | [{:keys [db]} key-uid]
|
79 | 79 | (let [multiaccounts (dissoc (:profile/profiles-overview db) key-uid)]
|
80 | 80 | (merge
|
|
83 | 83 | {:set-root :intro}))))
|
84 | 84 |
|
85 | 85 | (rf/defn password-set
|
86 |
| - {:events [:onboarding-2/password-set]} |
| 86 | + {:events [:onboarding/password-set]} |
87 | 87 | [{:keys [db]} password]
|
88 | 88 | (let [supported-type (:biometric/supported-type db)]
|
89 | 89 | {:db (-> db
|
90 |
| - (assoc-in [:onboarding-2/profile :password] password) |
91 |
| - (assoc-in [:onboarding-2/profile :auth-method] constants/auth-method-password)) |
| 90 | + (assoc-in [:onboarding/profile :password] password) |
| 91 | + (assoc-in [:onboarding/profile :auth-method] constants/auth-method-password)) |
92 | 92 | :dispatch (if supported-type
|
93 | 93 | [:navigate-to-within-stack [:enable-biometrics :new-to-status]]
|
94 |
| - [:onboarding-2/create-account-and-login])})) |
| 94 | + [:onboarding/create-account-and-login])})) |
95 | 95 |
|
96 | 96 | (rf/defn navigate-to-enable-biometrics
|
97 |
| - {:events [:onboarding-2/navigate-to-enable-biometrics]} |
| 97 | + {:events [:onboarding/navigate-to-enable-biometrics]} |
98 | 98 | [{:keys [db]}]
|
99 | 99 | (let [supported-type (:biometric/supported-type db)]
|
100 | 100 | {:dispatch (if supported-type
|
101 | 101 | [:open-modal :enable-biometrics]
|
102 | 102 | [:open-modal :enable-notifications])}))
|
103 | 103 |
|
104 | 104 | (rf/defn seed-phrase-entered
|
105 |
| - {:events [:onboarding-2/seed-phrase-entered]} |
| 105 | + {:events [:onboarding/seed-phrase-entered]} |
106 | 106 | [_ seed-phrase on-error]
|
107 | 107 | {:multiaccount/validate-mnemonic [seed-phrase
|
108 | 108 | (fn [mnemonic key-uid]
|
109 |
| - (re-frame/dispatch [:onboarding-2/seed-phrase-validated |
| 109 | + (re-frame/dispatch [:onboarding/seed-phrase-validated |
110 | 110 | mnemonic key-uid]))
|
111 | 111 | on-error]})
|
112 | 112 |
|
113 | 113 | (rf/defn seed-phrase-validated
|
114 |
| - {:events [:onboarding-2/seed-phrase-validated]} |
| 114 | + {:events [:onboarding/seed-phrase-validated]} |
115 | 115 | [{:keys [db]} seed-phrase key-uid]
|
116 | 116 | (if (contains? (:profile/profiles-overview db) key-uid)
|
117 | 117 | {:utils/show-confirmation
|
|
123 | 123 | (re-frame/dispatch
|
124 | 124 | [:profile/profile-selected key-uid]))
|
125 | 125 | :on-cancel #(re-frame/dispatch [:pop-to-root :multiaccounts])}}
|
126 |
| - {:db (assoc-in db [:onboarding-2/profile :seed-phrase] seed-phrase) |
| 126 | + {:db (assoc-in db [:onboarding/profile :seed-phrase] seed-phrase) |
127 | 127 | :dispatch [:navigate-to-within-stack [:create-profile :new-to-status]]}))
|
128 | 128 |
|
129 | 129 | (rf/defn navigate-to-create-profile
|
130 |
| - {:events [:onboarding-2/navigate-to-create-profile]} |
| 130 | + {:events [:onboarding/navigate-to-create-profile]} |
131 | 131 | [{:keys [db]}]
|
132 | 132 | ;; Restart the flow
|
133 |
| - {:db (dissoc db :onboarding-2/profile) |
| 133 | + {:db (dissoc db :onboarding/profile) |
134 | 134 | :dispatch [:navigate-to-within-stack [:create-profile :new-to-status]]})
|
135 | 135 |
|
136 | 136 | (rf/defn onboarding-new-account-finalize-setup
|
137 |
| - {:events [:onboarding-2/finalize-setup]} |
| 137 | + {:events [:onboarding/finalize-setup]} |
138 | 138 | [{:keys [db]}]
|
139 |
| - (let [masked-password (get-in db [:onboarding-2/profile :password]) |
| 139 | + (let [masked-password (get-in db [:onboarding/profile :password]) |
140 | 140 | key-uid (get-in db [:profile/profile :key-uid])
|
141 |
| - syncing? (get-in db [:onboarding-2/profile :syncing?]) |
142 |
| - biometric-enabled? (= (get-in db [:onboarding-2/profile :auth-method]) |
| 141 | + syncing? (get-in db [:onboarding/profile :syncing?]) |
| 142 | + biometric-enabled? (= (get-in db [:onboarding/profile :auth-method]) |
143 | 143 | constants/auth-method-biometric)]
|
144 |
| - (cond-> {:db (assoc db :onboarding-2/generated-keys? true)} |
| 144 | + (cond-> {:db (assoc db :onboarding/generated-keys? true)} |
145 | 145 | biometric-enabled?
|
146 | 146 | (assoc :keychain/save-password-and-auth-method
|
147 | 147 | {:key-uid key-uid
|
|
150 | 150 | (security/hash-masked-password masked-password))
|
151 | 151 | :on-success (fn []
|
152 | 152 | (if syncing?
|
153 |
| - (rf/dispatch [:onboarding-2/navigate-to-enable-notifications]) |
| 153 | + (rf/dispatch [:onboarding/navigate-to-enable-notifications]) |
154 | 154 | (log/error "successfully saved biometrics")))
|
155 | 155 | :on-error #(log/error "failed to save biometrics"
|
156 | 156 | {:key-uid key-uid
|
157 | 157 | :error %})}))))
|
158 | 158 |
|
159 | 159 | (rf/defn navigate-to-identifiers
|
160 |
| - {:events [:onboarding-2/navigate-to-identifiers]} |
| 160 | + {:events [:onboarding/navigate-to-identifiers]} |
161 | 161 | [{:keys [db]}]
|
162 |
| - (if (:onboarding-2/generated-keys? db) |
| 162 | + (if (:onboarding/generated-keys? db) |
163 | 163 | {:dispatch [:navigate-to-within-stack [:identifiers :new-to-status]]}
|
164 | 164 | {:dispatch-later [{:ms constants/onboarding-generating-keys-navigation-retry-ms
|
165 |
| - :dispatch [:onboarding-2/navigate-to-identifiers]}]})) |
| 165 | + :dispatch [:onboarding/navigate-to-identifiers]}]})) |
0 commit comments