Skip to content

Commit 21cfea1

Browse files
committed
Onboarding readd biometric screen to syncing flow
1 parent 3697f63 commit 21cfea1

File tree

13 files changed

+67
-214
lines changed

13 files changed

+67
-214
lines changed

src/status_im/contexts/centralized_metrics/tracking.cljs

-3
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,6 @@
5252
(contains? view-ids-to-track view-id)
5353
(conj (navigation-event (name view-id)))
5454

55-
(= :screen/onboarding.syncing-results view-id)
56-
(conj (key-value-event "onboarding-completed"))
57-
5855
(= :screen/keycard.migrate.success view-id)
5956
(conj (key-value-event "keycard-migration-succeeded"))
6057

src/status_im/contexts/onboarding/enable_biometrics/view.cljs

+5-7
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
[status-im.common.biometric.utils :as biometric]
77
[status-im.common.resources :as resources]
88
[status-im.contexts.onboarding.enable-biometrics.style :as style]
9-
[status-im.navigation.state :as state]
109
[utils.i18n :as i18n]
1110
[utils.re-frame :as rf]))
1211

@@ -25,8 +24,9 @@
2524
bio-type-label (biometric/get-label-by-type supported-biometric-type)
2625
profile-color (or (:color (rf/sub [:onboarding/profile]))
2726
(rf/sub [:profile/customization-color]))
28-
syncing-results? (= :screen/onboarding.syncing-results @state/root-id)
29-
biometric-type (rf/sub [:biometrics/supported-type])]
27+
biometric-type (rf/sub [:biometrics/supported-type])
28+
syncing? (rf/sub [:onboarding/syncing-connection-string?])]
29+
(print "---------" syncing?)
3030
[rn/view {:style (style/buttons insets)}
3131
[quo/button
3232
{:size 40
@@ -39,10 +39,8 @@
3939
{:accessibility-label :maybe-later-button
4040
:background :blur
4141
:type :grey
42-
:on-press #(rf/dispatch (if syncing-results?
43-
[:navigate-to-within-stack
44-
[:screen/onboarding.enable-notifications
45-
:screen/onboarding.enable-biometrics]]
42+
:on-press #(rf/dispatch (if syncing?
43+
[:syncing/initiate-local-pairing-with-connection-string]
4644
[:onboarding/create-account-and-login]))
4745
:container-style {:margin-top 12}}
4846
(i18n/label :t/maybe-later)]]))

src/status_im/contexts/onboarding/events.cljs

+8-22
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,6 @@
3838
(fn [{:keys [db]}]
3939
{:db (dissoc db :onboarding/navigated-to-enter-seed-phrase-from-screen)}))
4040

41-
(rf/reg-event-fx :onboarding/navigate-to-enable-notifications-from-syncing
42-
(fn [{:keys [db]}]
43-
{:db (dissoc db :onboarding/profile)
44-
:dispatch [:navigate-to-within-stack
45-
[:screen/onboarding.enable-notifications :screen/onboarding.enable-biometrics]]}))
46-
4741
(rf/reg-event-fx :onboarding/navigate-to-enable-notifications
4842
(fn [{:keys [db]}]
4943
{:dispatch [:navigate-to-within-stack
@@ -55,10 +49,10 @@
5549
(rf/defn biometrics-done
5650
{:events [:onboarding/biometrics-done]}
5751
[{:keys [db]}]
58-
(let [syncing? (get-in db [:onboarding/profile :syncing?])]
52+
(let [syncing? (get-in db [:onboarding/profile :connection-string])]
5953
{:db (assoc-in db [:onboarding/profile :auth-method] constants/auth-method-biometric)
6054
:dispatch (if syncing?
61-
[:onboarding/finalize-setup]
55+
[:syncing/initiate-local-pairing-with-stored-connection-string]
6256
[:onboarding/create-account-and-login])}))
6357

6458
(rf/reg-event-fx
@@ -107,20 +101,13 @@
107101
:screen/onboarding.create-profile)]
108102
{:db (-> db
109103
(assoc-in [:onboarding/profile :password] masked-password)
104+
(update-in [:onboarding/profile] dissoc :connection-string)
110105
(assoc-in [:onboarding/profile :auth-method] constants/auth-method-password))
111106
:fx [[:dispatch
112107
(if biometric-supported-type
113108
[:navigate-to-within-stack [:screen/onboarding.enable-biometrics from-screen]]
114109
[:onboarding/create-account-and-login])]]})))
115110

116-
(rf/reg-event-fx
117-
:onboarding/navigate-to-enable-biometrics
118-
(fn [{:keys [db]}]
119-
(let [supported-type (get-in db [:biometrics :supported-type])]
120-
{:dispatch (if supported-type
121-
[:open-modal :screen/onboarding.enable-biometrics]
122-
[:open-modal :screen/onboarding.enable-notifications])})))
123-
124111
(rf/reg-event-fx
125112
:onboarding/seed-phrase-validated
126113
(fn [{:keys [db]} [seed-phrase key-uid]]
@@ -187,7 +174,10 @@
187174
temporary-display-name?]} (:onboarding/profile db)
188175
{:keys [key-uid] :as profile} (:profile/profile db)
189176
biometric-enabled? (= auth-method constants/auth-method-biometric)]
190-
{:db (assoc db :onboarding/generated-keys? true)
177+
(print "----------------" password)
178+
{:db (-> db
179+
(assoc :onboarding/generated-keys? true)
180+
(dissoc :onboarding/profile))
191181
:fx [(when temporary-display-name?
192182
[:dispatch [:profile/set-default-profile-name profile]])
193183
(when biometric-enabled?
@@ -196,11 +186,7 @@
196186
:masked-password (if syncing?
197187
password
198188
(security/hash-masked-password password))
199-
:on-success (fn []
200-
(rf/dispatch [:onboarding/set-auth-method auth-method])
201-
(when syncing?
202-
(rf/dispatch
203-
[:onboarding/navigate-to-enable-notifications-from-syncing])))
189+
:on-success [:onboarding/set-auth-method auth-method]
204190
:on-error #(log/error "failed to save biometrics"
205191
{:key-uid key-uid
206192
:error %})}])]})))

src/status_im/contexts/onboarding/syncing/progress/view.cljs

+19-18
Original file line numberDiff line numberDiff line change
@@ -41,24 +41,25 @@
4141

4242
(defn try-again-button
4343
[profile-color logged-in?]
44-
[quo/bottom-actions
45-
{:actions (if logged-in? :one-action :two-vertical-actions)
46-
:blur? true
47-
:container-style {:height (when-not logged-in? 116)}
48-
:button-two-label (i18n/label :t/use-recovery-phrase)
49-
:button-two-props {:type :primary
50-
:accessibility-label :try-seed-phrase-button
51-
:customization-color profile-color
52-
:size 40
53-
:on-press navigate-to-enter-seed-phrase}
54-
:button-one-label
55-
(i18n/label :t/try-again)
56-
:button-one-props
57-
{:type (if logged-in? :primary :grey)
58-
:accessibility-label :try-again-later-button
59-
:customization-color profile-color
60-
:size 40
61-
:on-press #(try-again logged-in?)}}])
44+
(let [two-vertical-actions-height 116]
45+
[quo/bottom-actions
46+
{:actions (if logged-in? :one-action :two-vertical-actions)
47+
:blur? true
48+
:container-style {:height (when-not logged-in? two-vertical-actions-height)}
49+
:button-two-label (i18n/label :t/use-recovery-phrase)
50+
:button-two-props {:type :primary
51+
:accessibility-label :try-seed-phrase-button
52+
:customization-color profile-color
53+
:size 40
54+
:on-press navigate-to-enter-seed-phrase}
55+
:button-one-label
56+
(i18n/label :t/try-again)
57+
:button-one-props
58+
{:type (if logged-in? :primary :grey)
59+
:accessibility-label :try-again-later-button
60+
:customization-color profile-color
61+
:size 40
62+
:on-press #(try-again logged-in?)}}]))
6263

6364
(defn- illustration
6465
[pairing-progress?]

src/status_im/contexts/onboarding/syncing/results/style.cljs

-43
This file was deleted.

src/status_im/contexts/onboarding/syncing/results/view.cljs

-84
This file was deleted.

src/status_im/contexts/profile/login/events.cljs

+1-4
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,7 @@
8181
(when keycard?
8282
[:dispatch [:centralized-metrics/track :metric/keycard-login]])]
8383
(cond
84-
pairing-completed?
85-
[[:dispatch [:onboarding/finish-onboarding false]]]
86-
87-
(get db :onboarding/new-account?)
84+
(or pairing-completed? (get db :onboarding/new-account?))
8885
[[:dispatch [:onboarding/finalize-setup]]
8986
[:dispatch [:onboarding/finish-onboarding false]]]
9087

src/status_im/contexts/syncing/enter_sync_code/view.cljs

+14-14
Original file line numberDiff line numberDiff line change
@@ -58,19 +58,19 @@
5858
(reset! sync-code-value nil))}
5959
[quo/icon :i/clear style/clear-icon]])]]
6060
[quo/button
61-
{:type :primary
62-
:disabled? (string/blank? @sync-code-value)
61+
{:type :primary
62+
:disabled? (string/blank? @sync-code-value)
6363
:customization-color profile-color
64-
:container-style style/continue-button-container
65-
:on-press (fn [_]
66-
(if (sync-utils/valid-connection-string? @sync-code-value)
67-
(debounce/debounce-and-dispatch
68-
[:syncing/input-connection-string-for-bootstrapping
69-
@sync-code-value]
70-
300)
71-
(rf/dispatch [:toasts/upsert
72-
{:type :negative
73-
:theme :dark
74-
:text (i18n/label
75-
:t/error-this-is-not-a-sync-qr-code)}])))}
64+
:container-style style/continue-button-container
65+
:on-press (fn [_]
66+
(if (sync-utils/valid-connection-string? @sync-code-value)
67+
(debounce/debounce-and-dispatch
68+
[:syncing/store-local-pairing-connection-string-and-navigate-to-biometric
69+
@sync-code-value]
70+
300)
71+
(rf/dispatch [:toasts/upsert
72+
{:type :negative
73+
:theme :dark
74+
:text (i18n/label
75+
:t/error-this-is-not-a-sync-qr-code)}])))}
7676
(i18n/label :t/confirm)]]))))

src/status_im/contexts/syncing/events.cljs

+11-2
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@
2525

2626
(defn- input-connection-string-callback
2727
[res]
28-
(log/info "[local-pairing] input-connection-string-for-bootstrapping callback"
28+
(log/info "[local-pairing] initiate-local-pairing-with-stored-connection-string callback"
2929
{:response res
30-
:event :syncing/input-connection-string-for-bootstrapping})
30+
:event :syncing/initiate-local-pairing-with-stored-connection-string})
3131
(let [response (transforms/json->clj res)
3232
installation-id (:installationId response)
3333
key-uid (:keyUID response)
@@ -93,6 +93,15 @@
9393
config-map
9494
input-connection-string-callback)))
9595

96+
(rf/reg-event-fx
97+
:syncing/store-local-pairing-connection-string-and-navigate-to-biometric
98+
(fn [{:keys [db]} [connection-string]]
99+
{:db (assoc-in db [:onboarding/profile :connection-string] connection-string)
100+
:dispatch
101+
(if (get-in db [:biometrics :supported-type])
102+
[:navigate-to-within-stack [:screen/onboarding.enable-biometrics :screen/onboarding.log-in]]
103+
[:syncing/initiate-local-pairing-with-stored-connection-string])}))
104+
96105
(rf/defn preparations-for-connection-string
97106
{:events [:syncing/get-connection-string]}
98107
[{:keys [db]} sha3-pwd on-valid-connection-string]

src/status_im/contexts/syncing/scan_sync_code/view.cljs

+1-1
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@
225225
(do
226226
(on-success-scan)
227227
(debounce/debounce-and-dispatch
228-
[:syncing/input-connection-string-for-bootstrapping connection-string]
228+
[:syncing/store-local-pairing-connection-string-and-navigate-to-biometric connection-string]
229229
300))
230230
(do
231231
(on-failed-scan)

src/status_im/navigation/roots.cljs

+1-6
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,7 @@
2424
{:stack {:id :screen/profile.profiles
2525
:children [{:component {:name :screen/profile.profiles
2626
:id :screen/profile.profiles
27-
:options (options/dark-root-options)}}]}}}
28-
29-
:screen/onboarding.syncing-results
30-
{:root {:stack {:children [{:component {:name :screen/onboarding.syncing-results
31-
:id :screen/onboarding.syncing-results
32-
:options (options/dark-root-options)}}]}}}})
27+
:options (options/dark-root-options)}}]}}}})
3328

3429
(defn old-roots
3530
[status-bar-theme]

0 commit comments

Comments
 (0)