Skip to content

Commit bffce78

Browse files
authored
Merge branch 'develop' into bugfix/21616
2 parents 5c86b64 + 8c82a84 commit bffce78

File tree

33 files changed

+414
-147
lines changed

33 files changed

+414
-147
lines changed
149 KB
Loading
278 KB
Loading
-4.06 KB
Binary file not shown.
-6.05 KB
Binary file not shown.

src/quo/components/buttons/predictive_keyboard/view.cljs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858

5959
:error
6060
[info-message/view
61-
{:icon :i/info
61+
{:icon :i/alert
6262
:size :default
6363
:status :error}
6464
text]

src/quo/components/onboarding/small_option_card/view.cljs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
subtitle]]])
3636

3737
(defn- main-variant
38-
[{:keys [title subtitle button-label image max-height accessibility-label on-press button-type]}]
38+
[{:keys [title subtitle button-label image max-height accessibility-label on-press button-props]}]
3939
[rn/view {:style style/main-variant}
4040
[rn/view {:style style/main-variant-text-container}
4141
[text/text
@@ -56,18 +56,20 @@
5656
:resize-mode :contain
5757
:source image}]
5858
[button/button
59-
{:on-press on-press
60-
:accessibility-label accessibility-label
61-
:type (or button-type :grey)
62-
:size 40
63-
:container-style style/main-button
64-
:theme :dark
65-
:background :blur}
59+
(merge
60+
{:on-press on-press
61+
:accessibility-label accessibility-label
62+
:type :grey
63+
:size 40
64+
:container-style style/main-button
65+
:theme :dark
66+
:background :blur}
67+
button-props)
6668
button-label]])
6769

6870
(defn small-option-card
6971
[{:keys [variant title subtitle button-label image max-height on-press accessibility-label
70-
button-type container-style]
72+
button-props container-style]
7173
:or {variant :main accessibility-label :small-option-card}}]
7274
(let [main-variant? (= variant :main)
7375
card-component (if main-variant? main-variant icon-variant)
@@ -84,4 +86,4 @@
8486
:accessibility-label accessibility-label
8587
:image image
8688
:max-height max-height
87-
:button-type button-type}]]))
89+
:button-props button-props}]]))

src/quo/foundations/resources.cljs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
{:keycard-logo (js/require "../resources/images/ui2/keycard-logo.png")
55
:keycard-chip-light (js/require "../resources/images/ui2/keycard-chip-light.png")
66
:keycard-chip-dark (js/require "../resources/images/ui2/keycard-chip-dark.png")
7-
:keycard-watermark (js/require "../resources/images/ui2/keycard-watermark.png")
87
:bored-ape (js/require "../resources/images/mock2/bored-ape.png")})
98

109
(def ui-themed

src/status_im/common/resources.cljs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@
1818
:podcasts (js/require "../resources/images/ui2/podcasts.png")
1919
:generate-keys (js/require "../resources/images/ui2/generate-keys.png")
2020
:add-key-to-keycard (js/require "../resources/images/ui2/add-key-to-keycard.png")
21+
:import-key-to-keycard (js/require "../resources/images/ui2/import-key-to-keycard.png")
2122
:ethereum-address (js/require "../resources/images/ui2/ethereum-address.png")
2223
:use-keycard (js/require "../resources/images/ui2/keycard.png")
2324
:use-recovery-phrase (js/require "../resources/images/ui2/recovery-phrase.png")
2425
:check-your-keycard (js/require "../resources/images/ui2/check-your-keycard.png")
2526
:qr-code (js/require "../resources/images/ui2/qr-code.png")
2627
:keycard-logo (js/require "../resources/images/ui2/keycard-logo.png")
27-
:keycard-watermark (js/require "../resources/images/ui2/keycard-watermark.png")
2828
:keycard-buy (js/require "../resources/images/ui2/keycard-buy.png")
2929
:keycard-migration (js/require "../resources/images/ui2/keycard-migration.png")
3030
:keycard-migration-failed (js/require "../resources/images/ui2/keycard-migration-failed.png")

src/status_im/common/standard_authentication/events.cljs

Lines changed: 49 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,35 @@
1010
[utils.re-frame :as rf]
1111
[utils.security.core :as security]))
1212

13+
(defn- partially-operable-accounts?
14+
[accounts]
15+
(->> accounts
16+
vals
17+
(some #(= :partially (:operable %)))
18+
boolean))
19+
20+
(rf/reg-event-fx :standard-auth/migrate-partially-operable-accounts
21+
(fn [{:keys [db]} [{:keys [masked-password on-success]}]]
22+
(let [on-auth-success-callback #(on-success masked-password)
23+
has-partially-operable-accounts? (-> (get-in db [:wallet :accounts])
24+
partially-operable-accounts?)]
25+
{:fx [(if has-partially-operable-accounts?
26+
[:dispatch
27+
[:wallet/make-partially-operable-accounts-fully-operable
28+
{:password masked-password
29+
:on-success on-auth-success-callback
30+
:on-error on-auth-success-callback}]]
31+
[:effects.standard-auth/on-auth-success on-auth-success-callback])]})))
32+
1333
(defn- handle-password-success
14-
[has-partially-operable-accounts? on-auth-success masked-password]
34+
[{:keys [migrate-partially-operable-accounts? on-auth-success masked-password]}]
1535
(let [on-auth-success-callback #(on-auth-success masked-password)]
1636
(rf/dispatch [:standard-auth/set-success true])
1737
(rf/dispatch [:standard-auth/reset-login-password])
18-
(if has-partially-operable-accounts?
19-
(rf/dispatch [:wallet/make-partially-operable-accounts-fully-operable
20-
{:password masked-password
21-
:on-success on-auth-success-callback
22-
:on-error on-auth-success-callback}])
38+
(if migrate-partially-operable-accounts?
39+
(rf/dispatch [:standard-auth/migrate-partially-operable-accounts
40+
{:masked-password masked-password
41+
:on-success on-auth-success}])
2342
(on-auth-success-callback))))
2443

2544
(defn authorize
@@ -42,9 +61,10 @@
4261
{:pin pin
4362
:on-success (fn [{:keys [encryption-public-key]}]
4463
(rf/dispatch [:keycard/disconnect])
45-
(handle-password-success false
46-
on-auth-success
47-
(security/mask-data encryption-public-key)))
64+
(handle-password-success {:migrate-partially-operable-accounts? false
65+
:on-auth-success on-auth-success
66+
:masked-password (security/mask-data
67+
encryption-public-key)}))
4868
:on-failure #(rf/dispatch [:keycard/on-action-with-pin-error
4969
%])}]))}]))}]]
5070
[:effects.biometric/check-if-available
@@ -85,7 +105,12 @@
85105
keycard? (get-in db [:profile/profile :keycard-pairing])]
86106
{:fx [(if keycard?
87107
[:keychain/get-keycard-keys [key-uid on-auth-success]]
88-
[:keychain/get-user-password [key-uid on-auth-success]])
108+
[:keychain/get-user-password
109+
[key-uid
110+
(fn [masked-password]
111+
(rf/dispatch [:standard-auth/migrate-partially-operable-accounts
112+
{:masked-password masked-password
113+
:on-success on-auth-success}]))]])
89114
[:dispatch [:standard-auth/set-success true]]
90115
[:dispatch [:standard-auth/reset-login-password]]]}))
91116

@@ -108,15 +133,14 @@
108133
(defn- bottom-sheet-password-view
109134
[{:keys [on-press-biometric on-auth-success auth-button-icon-left auth-button-label]}]
110135
(fn []
111-
(let [has-partially-operable-accounts? (rf/sub [:wallet/has-partially-operable-accounts?])]
112-
[enter-password/view
113-
{:on-enter-password #(handle-password-success
114-
has-partially-operable-accounts?
115-
on-auth-success
116-
(security/hash-masked-password %))
117-
:on-press-biometrics on-press-biometric
118-
:button-icon-left auth-button-icon-left
119-
:button-label auth-button-label}])))
136+
[enter-password/view
137+
{:on-enter-password #(handle-password-success {:migrate-partially-operable-accounts? true
138+
:on-auth-success on-auth-success
139+
:masked-password (security/hash-masked-password
140+
%)})
141+
:on-press-biometrics on-press-biometric
142+
:button-icon-left auth-button-icon-left
143+
:button-label auth-button-label}]))
120144

121145
(defn authorize-with-keycard
122146
[_ [{:keys [on-complete]}]]
@@ -155,6 +179,12 @@
155179
(when on-close
156180
(on-close success?))))
157181

182+
(rf/reg-fx
183+
:effects.standard-auth/on-auth-success
184+
(fn [on-auth-success]
185+
(when on-auth-success
186+
(on-auth-success))))
187+
158188
(rf/reg-event-fx
159189
:standard-auth/close
160190
(fn [{:keys [db]} [on-close]]

src/status_im/contexts/keycard/create/events.cljs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
(ns status-im.contexts.keycard.create.events
22
(:require [clojure.string :as string]
3+
[status-im.common.resources :as resources]
4+
[utils.i18n :as i18n]
35
[utils.re-frame :as rf]
46
[utils.security.core :as security]))
57

@@ -49,10 +51,13 @@
4951
security/safe-unmask-data
5052
(string/join " ")
5153
security/mask-data))
52-
:fx [[:dispatch [:keycard/create.create-or-enter-pin]]]}))
54+
:fx [[:dispatch
55+
[:keycard/create.create-or-enter-pin
56+
{:ready-to-add-screen-title (i18n/label :t/ready-add-keypair-keycard)
57+
:ready-to-add-screen-image (resources/get-image :add-key-to-keycard)}]]]}))
5358

5459
(rf/reg-event-fx :keycard/create.create-or-enter-pin
55-
(fn [{:keys [db]}]
60+
(fn [{:keys [db]} [{:keys [ready-to-add-screen-title ready-to-add-screen-image]}]]
5661
(let [{:keys [initialized?]} (get-in db [:keycard :application-info])]
5762
{:fx [[:dispatch [:navigate-back]]
5863
(if initialized?
@@ -66,7 +71,9 @@
6671
{:on-complete (fn [new-pin]
6772
(rf/dispatch [:navigate-back])
6873
(rf/dispatch [:keycard/create.save-pin new-pin])
69-
(rf/dispatch [:open-modal :screen/keycard.create.ready-to-add]))}]])]})))
74+
(rf/dispatch [:open-modal :screen/keycard.create.ready-to-add
75+
{:title ready-to-add-screen-title
76+
:image ready-to-add-screen-image}]))}]])]})))
7077

7178
(rf/reg-event-fx :keycard/create.save-pin
7279
(fn [{:keys [db]} [pin]]
@@ -123,4 +130,7 @@
123130
(if (contains? (:profile/profiles-overview db) key-uid)
124131
{:fx [[:dispatch [:onboarding/multiaccount-already-exists key-uid]]]}
125132
{:db (assoc-in db [:keycard :create :masked-phrase] masked-seed-phrase)
126-
:fx [[:dispatch [:keycard/create.create-or-enter-pin]]]})))
133+
:fx [[:dispatch
134+
[:keycard/create.create-or-enter-pin
135+
{:ready-to-add-screen-title (i18n/label :t/ready-to-import-keypair-keycard)
136+
:ready-to-add-screen-image (resources/get-image :import-key-to-keycard)}]]]})))

0 commit comments

Comments
 (0)