Skip to content

Commit 120d329

Browse files
committed
added navigate to biometric screen after sign-in by syncing
1 parent c42fc51 commit 120d329

File tree

4 files changed

+40
-27
lines changed

4 files changed

+40
-27
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
(ns status-im2.contexts.onboarding.enable-biometrics.view
2-
(:require
3-
[quo.core :as quo]
4-
[react-native.core :as rn]
5-
[react-native.safe-area :as safe-area]
6-
[status-im2.common.biometric.events :as biometric]
7-
[status-im2.common.parallax.view :as parallax]
8-
[status-im2.common.parallax.whitelist :as whitelist]
9-
[status-im2.common.resources :as resources]
10-
[status-im2.contexts.onboarding.enable-biometrics.style :as style]
11-
[utils.i18n :as i18n]
12-
[utils.re-frame :as rf]))
2+
(:require [quo.core :as quo]
3+
[react-native.core :as rn]
4+
[react-native.safe-area :as safe-area]
5+
[status-im2.common.biometric.events :as biometric]
6+
[status-im2.common.parallax.view :as parallax]
7+
[status-im2.common.parallax.whitelist :as whitelist]
8+
[status-im2.common.resources :as resources]
9+
[status-im2.contexts.onboarding.enable-biometrics.style :as style]
10+
[status-im2.navigation.state :as state]
11+
[utils.i18n :as i18n]
12+
[utils.re-frame :as rf]))
1313

1414
(defn page-title
1515
[]
@@ -24,7 +24,8 @@
2424
[insets]
2525
(let [supported-biometric-type (rf/sub [:biometric/supported-type])
2626
bio-type-label (biometric/get-label-by-type supported-biometric-type)
27-
profile-color (:color (rf/sub [:onboarding-2/profile]))]
27+
profile-color (or (:color (rf/sub [:onboarding-2/profile]))
28+
(rf/sub [:profile/customization-color]))]
2829
[rn/view {:style (style/buttons insets)}
2930
[quo/button
3031
{:accessibility-label :enable-biometrics-button
@@ -36,16 +37,17 @@
3637
{:accessibility-label :maybe-later-button
3738
:background :blur
3839
:type :grey
39-
:on-press #(rf/dispatch [:onboarding-2/create-account-and-login])
40-
:container-style {:margin-top 12}}
41-
(i18n/label :t/maybe-later)]]))
40+
:on-press #(rf/dispatch (if (= :syncing-results @state/root-id)
41+
[:navigate-to-within-stack
42+
[:enable-notifications :enable-biometrics]]
43+
[:onboarding-2/create-account-and-login]))
44+
:container-style {:margin-top 12}} (i18n/label :t/maybe-later)]]))
4245

4346
(defn enable-biometrics-parallax
4447
[]
4548
(let [stretch (if rn/small-screen? 25 40)]
4649
[parallax/video
47-
{:layers (:biometrics resources/parallax-video)
48-
:stretch stretch}]))
50+
{:layers (:biometrics resources/parallax-video) :stretch stretch}]))
4951

5052
(defn enable-biometrics-simple
5153
[]
@@ -58,9 +60,7 @@
5860
(defn enable-biometrics
5961
[]
6062
(let [insets (safe-area/get-insets)]
61-
[rn/view {:style (style/page-container insets)}
62-
[page-title]
63+
[rn/view {:style (style/page-container insets)} [page-title]
6364
(if whitelist/whitelisted?
6465
[enable-biometrics-parallax]
65-
[enable-biometrics-simple])
66-
[enable-biometrics-buttons insets]]))
66+
[enable-biometrics-simple]) [enable-biometrics-buttons insets]]))

src/status_im2/contexts/onboarding/events.cljs

+12-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
[status-im2.constants :as constants]
77
[status-im2.contexts.profile.create.events :as profile.create]
88
[status-im2.contexts.profile.recover.events :as profile.recover]
9+
[status-im2.navigation.state :as state]
910
[taoensso.timbre :as log]
1011
[utils.i18n :as i18n]
1112
[utils.re-frame :as rf]
@@ -39,7 +40,9 @@
3940
{:events [:onboarding-2/biometrics-done]}
4041
[{:keys [db]}]
4142
{:db (assoc-in db [:onboarding-2/profile :auth-method] constants/auth-method-biometric)
42-
:dispatch [:onboarding-2/create-account-and-login]})
43+
:dispatch (if (= :syncing-results @state/root-id)
44+
[:navigate-to-within-stack [:enable-notifications :enable-biometrics]]
45+
[:onboarding-2/create-account-and-login])})
4346

4447
(rf/defn biometrics-fail
4548
{:events [:onboarding-2/biometrics-fail]}
@@ -83,6 +86,14 @@
8386
[:navigate-to-within-stack [:enable-biometrics :new-to-status]]
8487
[:onboarding-2/create-account-and-login])}))
8588

89+
(rf/defn navigate-to-enable-biometrics
90+
{:events [:onboarding-2/navigate-to-enable-biometrics]}
91+
[{:keys [db]}]
92+
(let [supported-type (:biometric/supported-type db)]
93+
{:dispatch (if supported-type
94+
[:open-modal :enable-biometrics]
95+
[:open-modal :enable-notifications])}))
96+
8697
(rf/defn seed-phrase-entered
8798
{:events [:onboarding-2/seed-phrase-entered]}
8899
[_ seed-phrase on-error]

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
{:on-press (fn []
5555
(when on-press
5656
(on-press))
57-
(rf/dispatch [:open-modal :enable-notifications]))
57+
(rf/dispatch [:onboarding-2/navigate-to-enable-biometrics]))
5858
:accessibility-label :continue-button
5959
:customization-color profile-color
6060
:container-style style/continue-button}

src/status_im2/navigation/screens.cljs

+6-4
Original file line numberDiff line numberDiff line change
@@ -157,10 +157,12 @@
157157
:component create-password/create-password}
158158

159159
{:name :enable-biometrics
160-
:options {:theme :dark
161-
:layout options/onboarding-transparent-layout
162-
:animations transitions/push-animations-for-transparent-background
163-
:popGesture false}
160+
:options {:theme :dark
161+
:layout options/onboarding-transparent-layout
162+
:animations (merge transitions/new-to-status-modal-animations
163+
transitions/push-animations-for-transparent-background)
164+
:popGesture false
165+
:modalPresentationStyle :overCurrentContext}
164166
:component enable-biometrics/enable-biometrics}
165167

166168
{:name :generating-keys

0 commit comments

Comments
 (0)