-
Notifications
You must be signed in to change notification settings - Fork 992
/
Copy pathview.cljs
61 lines (57 loc) · 2.52 KB
/
view.cljs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
(ns status-im.contexts.onboarding.enable-biometrics.view
(:require
[quo.core :as quo]
[react-native.core :as rn]
[react-native.safe-area :as safe-area]
[status-im.common.biometric.utils :as biometric]
[status-im.common.resources :as resources]
[status-im.contexts.onboarding.enable-biometrics.style :as style]
[utils.i18n :as i18n]
[utils.re-frame :as rf]))
(defn page-title
[]
[quo/text-combinations
{:container-style style/title-container
:title (i18n/label :t/enable-biometrics)
:title-accessibility-label :enable-biometrics-title
:description (i18n/label :t/use-biometrics)
:description-accessibility-label :enable-biometrics-sub-title}])
(defn enable-biometrics-buttons
[insets]
(let [supported-biometric-type (rf/sub [:biometrics/supported-type])
bio-type-label (biometric/get-label-by-type supported-biometric-type)
profile-color (or (:color (rf/sub [:onboarding/profile]))
(rf/sub [:profile/customization-color]))
syncing? (= (rf/sub [:view-id]) :screen/onboarding.syncing-biometric)
biometric-type (rf/sub [:biometrics/supported-type])]
[rn/view {:style (style/buttons insets)}
[quo/button
{:size 40
:accessibility-label :enable-biometrics-button
:icon-left (biometric/get-icon-by-type biometric-type)
:customization-color profile-color
:on-press #(rf/dispatch [:onboarding/enable-biometrics])}
(i18n/label :t/biometric-enable-button {:bio-type-label bio-type-label})]
[quo/button
{:accessibility-label :maybe-later-button
:background :blur
:type :grey
:on-press #(rf/dispatch (if syncing?
[:onboarding/finish-onboarding false]
[:onboarding/create-account-and-login]))
:container-style {:margin-top 12}}
(i18n/label :t/maybe-later)]]))
(defn enable-biometrics-simple
[]
(let [width (:width (rn/get-window))]
[rn/image
{:resize-mode :contain
:style (style/page-illustration width)
:source (resources/get-image :biometrics)}]))
(defn view
[]
(let [insets (safe-area/get-insets)]
[rn/view {:style (style/page-container insets)}
[page-title]
[enable-biometrics-simple]
[enable-biometrics-buttons insets]]))