Skip to content

Commit 1ad8626

Browse files
committed
chore: add two button types for standard auth
1 parent c150070 commit 1ad8626

File tree

6 files changed

+109
-58
lines changed

6 files changed

+109
-58
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
(ns status-im2.common.standard-authentication.core
2+
(:require
3+
status-im2.common.standard-authentication.standard-auth.button.view
4+
status-im2.common.standard-authentication.standard-auth.slide-button.view))
5+
6+
(def button status-im2.common.standard-authentication.standard-auth.button.view/view)
7+
(def slide-button status-im2.common.standard-authentication.standard-auth.slide-button.view/view)
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
1-
(ns status-im2.common.standard-authentication.standard-auth.view
1+
(ns status-im2.common.standard-authentication.standard-auth.authorize
22
(:require
3-
[quo.core :as quo]
4-
[quo.theme :as quo.theme]
5-
[react-native.core :as rn]
63
[react-native.touch-id :as biometric]
7-
[reagent.core :as reagent]
84
[status-im2.common.standard-authentication.enter-password.view :as enter-password]
95
[taoensso.timbre :as log]
106
[utils.i18n :as i18n]
@@ -46,39 +42,3 @@
4642
{:on-enter-password on-enter-password
4743
:button-icon-left auth-button-icon-left
4844
:button-label auth-button-label}])}]))))))
49-
50-
(defn- view-internal
51-
[_]
52-
(let [reset-slider? (reagent/atom false)
53-
on-close #(reset! reset-slider? true)]
54-
(fn [{:keys [biometric-auth?
55-
track-text
56-
customization-color
57-
auth-button-label
58-
on-enter-password
59-
on-auth-success
60-
on-auth-fail
61-
auth-button-icon-left
62-
size
63-
theme
64-
blur?
65-
container-style]}]
66-
[rn/view {:style {:flex 1}}
67-
[quo/slide-button
68-
{:size size
69-
:container-style container-style
70-
:customization-color customization-color
71-
:on-reset (when @reset-slider? #(reset! reset-slider? false))
72-
:on-complete #(authorize {:on-close on-close
73-
:auth-button-icon-left auth-button-icon-left
74-
:theme theme
75-
:blur? blur?
76-
:on-enter-password on-enter-password
77-
:biometric-auth? biometric-auth?
78-
:on-auth-success on-auth-success
79-
:on-auth-fail on-auth-fail
80-
:auth-button-label auth-button-label})
81-
:track-icon (if biometric-auth? :i/face-id :password)
82-
:track-text track-text}]])))
83-
84-
(def view (quo.theme/with-theme view-internal))
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
(ns status-im2.common.standard-authentication.standard-auth.button.view
2+
(:require
3+
[quo.core :as quo]
4+
[quo.theme :as quo.theme]
5+
[react-native.core :as rn]
6+
[reagent.core :as reagent]
7+
[status-im2.common.standard-authentication.standard-auth.authorize :as authorize]))
8+
9+
(defn- view-internal
10+
[_]
11+
(let [reset-slider? (reagent/atom false)
12+
on-close #(reset! reset-slider? true)]
13+
(fn [{:keys [biometric-auth?
14+
customization-color
15+
auth-button-label
16+
on-enter-password
17+
on-auth-success
18+
on-auth-fail
19+
auth-button-icon-left
20+
size
21+
button-label
22+
theme
23+
blur?
24+
container-style]}]
25+
[rn/view {:style {:flex 1}}
26+
[quo/button
27+
{:size size
28+
:container-style container-style
29+
:customization-color customization-color
30+
:on-press #(authorize/authorize {:on-close on-close
31+
:auth-button-icon-left auth-button-icon-left
32+
:theme theme
33+
:blur? blur?
34+
:on-enter-password on-enter-password
35+
:biometric-auth? biometric-auth?
36+
:on-auth-success on-auth-success
37+
:on-auth-fail on-auth-fail
38+
:auth-button-label auth-button-label})}
39+
button-label]])))
40+
41+
(def view (quo.theme/with-theme view-internal))
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
(ns status-im2.common.standard-authentication.standard-auth.slide-button.view
2+
(:require
3+
[quo.core :as quo]
4+
[quo.theme :as quo.theme]
5+
[react-native.core :as rn]
6+
[reagent.core :as reagent]
7+
[status-im2.common.standard-authentication.standard-auth.authorize :as authorize]))
8+
9+
(defn- view-internal
10+
[_]
11+
(let [reset-slider? (reagent/atom false)
12+
on-close #(reset! reset-slider? true)]
13+
(fn [{:keys [biometric-auth?
14+
track-text
15+
customization-color
16+
auth-button-label
17+
on-enter-password
18+
on-auth-success
19+
on-auth-fail
20+
auth-button-icon-left
21+
size
22+
theme
23+
blur?
24+
container-style]}]
25+
[rn/view {:style {:flex 1}}
26+
[quo/slide-button
27+
{:size size
28+
:container-style container-style
29+
:customization-color customization-color
30+
:on-reset (when @reset-slider? #(reset! reset-slider? false))
31+
:on-complete #(authorize/authorize {:on-close on-close
32+
:auth-button-icon-left auth-button-icon-left
33+
:theme theme
34+
:blur? blur?
35+
:on-enter-password on-enter-password
36+
:biometric-auth? biometric-auth?
37+
:on-auth-success on-auth-success
38+
:on-auth-fail on-auth-fail
39+
:auth-button-label auth-button-label})
40+
:track-icon (if biometric-auth? :i/face-id :password)
41+
:track-text track-text}]])))
42+
43+
(def view (quo.theme/with-theme view-internal))

src/status_im2/contexts/syncing/setup_syncing/view.cljs

+15-15
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
(ns status-im2.contexts.syncing.setup-syncing.view
22
(:require
3-
[quo.core :as quo]
4-
[quo.foundations.colors :as colors]
5-
[react-native.clipboard :as clipboard]
6-
[react-native.core :as rn]
7-
[react-native.hooks :as hooks]
8-
[reagent.core :as reagent]
9-
[status-im2.common.qr-codes.view :as qr-codes]
10-
[status-im2.common.resources :as resources]
11-
[status-im2.common.standard-authentication.standard-auth.view :as standard-auth]
12-
[status-im2.contexts.syncing.setup-syncing.style :as style]
13-
[status-im2.contexts.syncing.utils :as sync-utils]
14-
[utils.datetime :as datetime]
15-
[utils.i18n :as i18n]
16-
[utils.re-frame :as rf]))
3+
[quo.core :as quo]
4+
[quo.foundations.colors :as colors]
5+
[react-native.clipboard :as clipboard]
6+
[react-native.core :as rn]
7+
[react-native.hooks :as hooks]
8+
[reagent.core :as reagent]
9+
[status-im2.common.qr-codes.view :as qr-codes]
10+
[status-im2.common.resources :as resources]
11+
[status-im2.common.standard-authentication.core :as standard-auth]
12+
[status-im2.contexts.syncing.setup-syncing.style :as style]
13+
[status-im2.contexts.syncing.utils :as sync-utils]
14+
[utils.datetime :as datetime]
15+
[utils.i18n :as i18n]
16+
[utils.re-frame :as rf]))
1717

1818
(def code-valid-for-ms 120000)
1919
(def one-min-ms 60000)
@@ -119,7 +119,7 @@
119119
(i18n/label :t/copy-qr)]])
120120
(when-not (sync-utils/valid-connection-string? @code)
121121
[rn/view {:style style/standard-auth}
122-
[standard-auth/view
122+
[standard-auth/slide-button
123123
{:blur? true
124124
:size :size-40
125125
:track-text (i18n/label :t/slide-to-reveal-code)

src/status_im2/contexts/wallet/create_account/view.cljs

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
[react-native.core :as rn]
88
[react-native.safe-area :as safe-area]
99
[reagent.core :as reagent]
10-
[status-im2.common.standard-authentication.standard-auth.view :as standard-auth]
10+
[status-im2.common.standard-authentication.standard-auth.core :as standard-auth]
1111
[status-im2.constants :as constants]
1212
[status-im2.contexts.emoji-picker.utils :as emoji-picker.utils]
1313
[status-im2.contexts.wallet.common.utils :as utils]
@@ -114,7 +114,7 @@
114114
{:list-type :settings
115115
:label (i18n/label :t/origin)
116116
:data (get-keypair-data primary-name @derivation-path @account-color)}]
117-
[standard-auth/view
117+
[standard-auth/slide-button
118118
{:size :size-48
119119
:track-text (i18n/label :t/slide-to-create-account)
120120
:customization-color @account-color

0 commit comments

Comments
 (0)