Compare commits

...
14 changed files with 41 additions and 30 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 182 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 324 KiB

+1
View File
@@ -29,6 +29,7 @@
:keycard-migration (js/require "../resources/images/ui2/keycard-migration.png") :keycard-migration (js/require "../resources/images/ui2/keycard-migration.png")
:keycard-migration-failed (js/require "../resources/images/ui2/keycard-migration-failed.png") :keycard-migration-failed (js/require "../resources/images/ui2/keycard-migration-failed.png")
:keycard-migration-succeeded (js/require "../resources/images/ui2/keycard-migration-succeeded.png") :keycard-migration-succeeded (js/require "../resources/images/ui2/keycard-migration-succeeded.png")
:keycard-not-same (js/require "../resources/images/ui2/keycard-not-same.png")
:not-keycard (js/require "../resources/images/ui2/not-keycard.png") :not-keycard (js/require "../resources/images/ui2/not-keycard.png")
:discover (js/require "../resources/images/ui2/discover.png") :discover (js/require "../resources/images/ui2/discover.png")
:invite-friends (js/require "../resources/images/ui2/invite-friends.png") :invite-friends (js/require "../resources/images/ui2/invite-friends.png")
@@ -23,4 +23,7 @@
(do (do
(rf/dispatch [:keycard/disconnect]) (rf/dispatch [:keycard/disconnect])
(rf/dispatch [:open-modal :screen/keycard.empty])) (rf/dispatch [:open-modal :screen/keycard.empty]))
(rf/dispatch [:keycard/on-application-info-error error])))}]]]}))) (rf/dispatch [:keycard/on-application-info-error
(if (= error :keycard/error.keycard-wrong-profile)
:keycard/error.keycard-not-empty
error)])))}]]]})))
@@ -83,7 +83,7 @@
(fn [{:keys [db]} [error]] (fn [{:keys [db]} [error]]
(if (or (= error :keycard/error.keycard-empty) (if (or (= error :keycard/error.keycard-empty)
(and (get-in db [:keycard :application-info :initialized?]) (and (get-in db [:keycard :application-info :initialized?])
(= error :keycard/error.keycard-wrong-profile))) (= error :keycard/error.keycard-not-empty)))
(rf/dispatch [:keycard/create.continue]) (rf/dispatch [:keycard/create.continue])
(rf/dispatch [:keycard/on-application-info-error error])))) (rf/dispatch [:keycard/on-application-info-error error]))))
@@ -2,6 +2,7 @@
(:require [quo.core :as quo] (:require [quo.core :as quo]
[react-native.core :as rn] [react-native.core :as rn]
[status-im.common.events-helper :as events-helper] [status-im.common.events-helper :as events-helper]
[status-im.common.resources :as resources]
[utils.i18n :as i18n])) [utils.i18n :as i18n]))
(defn view (defn view
@@ -14,7 +15,10 @@
{:title (i18n/label :t/different-keycard) {:title (i18n/label :t/different-keycard)
:description :text :description :text
:description-text (i18n/label :t/scan-previous-keycard)}] :description-text (i18n/label :t/scan-previous-keycard)}]
[rn/view {:style {:flex 1}}] [rn/image
{:resize-mode :contain
:style {:flex 1 :width (:width (rn/get-window))}
:source (resources/get-image :keycard-not-same)}]
[rn/view {:style {:padding-horizontal 20}} [rn/view {:style {:padding-horizontal 20}}
[quo/button {:on-press events-helper/navigate-back} [quo/button {:on-press events-helper/navigate-back}
(i18n/label :t/try-again)]]]) (i18n/label :t/try-again)]]])
+10 -10
View File
@@ -9,16 +9,16 @@
[utils.re-frame :as rf])) [utils.re-frame :as rf]))
(def titles (def titles
{:keycard/error.keycard-empty {:title (i18n/label :t/keycard-empty) {:keycard/error.keycard-empty {:title (i18n/label :t/keycard-empty)
:description (i18n/label :t/no-key-pair-keycard)} :description (i18n/label :t/no-key-pair-keycard)}
:keycard/error.keycard-wrong-profile {:title (i18n/label :t/keycard-not-empty) :keycard/error.keycard-not-empty {:title (i18n/label :t/keycard-not-empty)
:description (i18n/label :t/cant-store-new-keys)} :description (i18n/label :t/cant-store-new-keys)}
:keycard/error.keycard-unpaired {:title (i18n/label :t/keycard-full) :keycard/error.keycard-unpaired {:title (i18n/label :t/keycard-full)
:description (i18n/label :t/pairing-slots-occupied)} :description (i18n/label :t/pairing-slots-occupied)}
:keycard/error.keycard-frozen {:title (i18n/label :t/keycard-blocked) :keycard/error.keycard-frozen {:title (i18n/label :t/keycard-blocked)
:description (i18n/label :t/cant-use-right-now)} :description (i18n/label :t/cant-use-right-now)}
:keycard/error.keycard-locked {:title (i18n/label :t/keycard-blocked) :keycard/error.keycard-locked {:title (i18n/label :t/keycard-blocked)
:description (i18n/label :t/cant-use-right-now)}}) :description (i18n/label :t/cant-use-right-now)}})
(defn view (defn view
[] []
+3 -2
View File
@@ -132,8 +132,9 @@
:fx [[:dispatch [:keycard/disconnect]] :fx [[:dispatch [:keycard/disconnect]]
[:dispatch [:dispatch
[:open-modal [:open-modal
(if (= :keycard/error.not-keycard error) (case error
:screen/keycard.not-keycard :keycard/error.not-keycard :screen/keycard.not-keycard
:keycard/error.keycard-wrong-profile :screen/keycard.different-card
:screen/keycard.error)]]]})) :screen/keycard.error)]]]}))
(rf/reg-event-fx :keycard/update-application-info (rf/reg-event-fx :keycard/update-application-info
@@ -32,11 +32,7 @@
(reset-card) (reset-card)
(do (do
(rf/dispatch [:navigate-back]) (rf/dispatch [:navigate-back])
(if (= error :keycard/error.keycard-wrong-profile) (rf/dispatch [:keycard/on-application-info-error error]))))}]))
(do
(rf/dispatch [:keycard/disconnect])
(rf/dispatch [:open-modal :screen/keycard.different-card]))
(rf/dispatch [:keycard/on-application-info-error error])))))}]))
(defn success-view (defn success-view
[] []
@@ -46,7 +46,7 @@
{:theme :dark {:theme :dark
:on-error :on-error
(fn [error] (fn [error]
(if (= error :keycard/error.keycard-wrong-profile) (if (= error :keycard/error.keycard-not-empty)
(do (do
(rf/dispatch [:keycard/disconnect]) (rf/dispatch [:keycard/disconnect])
(rf/dispatch [:open-modal :screen/keycard.pin.enter (rf/dispatch [:open-modal :screen/keycard.pin.enter
@@ -80,8 +80,4 @@
:else :else
(do (do
(rf/dispatch [:navigate-back]) (rf/dispatch [:navigate-back])
(if (= error :keycard/error.keycard-wrong-profile) (rf/dispatch [:keycard/on-application-info-error error]))))}]]]}))
(do
(rf/dispatch [:keycard/disconnect])
(rf/dispatch [:open-modal :screen/keycard.different-card]))
(rf/dispatch [:keycard/on-application-info-error error])))))}]]]}))
+7 -3
View File
@@ -30,6 +30,13 @@
(not has-master-key?) (not has-master-key?)
:keycard/error.keycard-empty :keycard/error.keycard-empty
(and (nil? profile-key-uid)
(some? key-uid))
:keycard/error.keycard-not-empty
(not= profile-key-uid key-uid)
:keycard/error.keycard-wrong-profile
(and (zero? pin-retry-counter) (and (zero? pin-retry-counter)
(or (nil? puk-retry-counter) (or (nil? puk-retry-counter)
(pos? puk-retry-counter))) (pos? puk-retry-counter)))
@@ -41,9 +48,6 @@
(not paired?) (not paired?)
:keycard/error.keycard-unpaired :keycard/error.keycard-unpaired
(not= profile-key-uid key-uid)
:keycard/error.keycard-wrong-profile
:else :else
nil)) nil))
@@ -256,6 +256,12 @@
(rf/dispatch (rf/dispatch
[:keycard/connect [:keycard/connect
{:key-uid key-uid {:key-uid key-uid
:on-error
(fn [error]
(rf/dispatch [:keycard/on-application-info-error
(if (= error :keycard/error.keycard-empty)
:keycard/error.keycard-wrong-profile
error)]))
:on-success :on-success
(fn [] (fn []
(rf/dispatch (rf/dispatch
+1 -1
View File
@@ -796,7 +796,7 @@
"device-syncing": "Device syncing", "device-syncing": "Device syncing",
"devices": "Devices", "devices": "Devices",
"devices-count": "{{number}} devices", "devices-count": "{{number}} devices",
"different-keycard": "Its a different Keycard", "different-keycard": "This is a different Keycard",
"disable": "disable", "disable": "disable",
"disable-all": "Disable all", "disable-all": "Disable all",
"disable-later-in-settings": "You can disable this later in Settings", "disable-later-in-settings": "You can disable this later in Settings",