Add missing keycard event handlers

This commit is contained in:
Vitaliy Vlasov 2020-02-25 20:36:29 +02:00 committed by Roman Volosovskyi
parent 1c81d6e190
commit bca946aa78
No known key found for this signature in database
GPG Key ID: 0238A4B5ECEE70DE
3 changed files with 12 additions and 3 deletions

View File

@ -82,6 +82,11 @@
(onboarding/proceed-with-generating-key)))
(recovery/load-pair-screen cofx)))))
(fx/defn on-register-card-events
{:events [:hardwallet.callback/on-register-card-events]}
[{:keys [db]} listeners]
{:db (update-in db [:hardwallet :listeners] merge listeners)})
(fx/defn navigate-to-keycard-settings
{:events [:profile.ui/keycard-settings-button-pressed]}
[{:keys [db] :as cofx}]
@ -301,6 +306,7 @@
; original - new PIN when user changes it or creates new one
; confirmation - confirmation for new PIN
(fx/defn process-pin-input
{:events [:hardwallet/process-pin-input]}
[{:keys [db]}]
(let [enter-step (get-in db [:hardwallet :pin :enter-step])
pin (get-in db [:hardwallet :pin enter-step])

View File

@ -147,11 +147,13 @@
;; if a name is still `nil` we have to generate it before multiaccount's
;; creation otherwise spec validation will fail
(if (nil? name)
{::generate-name-and-photo whisper-public-key}
{:hardwallet/generate-name-and-photo
{:public-key whisper-public-key
:on-success :hardwallet/on-name-and-photo-generated}}
(fx/merge cofx
{:db (-> db
(assoc-in [:hardwallet :setup-step] nil)
(assoc :intro-wizard nil))}
(dissoc :intro-wizard))}
(multiaccounts.create/on-multiaccount-created
{:derived {constants/path-wallet-root-keyword
{:public-key wallet-root-public-key
@ -245,7 +247,7 @@
(navigation/navigate-to-cofx :keycard-recovery-pin nil)))
(fx/defn on-name-and-photo-generated
{:events [::on-name-and-photo-generated]
{:events [:hardwallet/on-name-and-photo-generated]
:interceptors [(re-frame/inject-cofx :random-guid-generator)
(re-frame/inject-cofx ::multiaccounts.create/get-signing-phrase)]}
[{:keys [db] :as cofx} whisper-name photo-path]

View File

@ -68,6 +68,7 @@
::open-multiaccounts #(re-frame/dispatch [::initialize-multiaccounts % {:logout? false}])
:ui/listen-to-window-dimensions-change nil
::network/listen-to-network-info nil
:hardwallet/register-card-events nil
:hardwallet/check-nfc-support nil
:hardwallet/check-nfc-enabled nil
:hardwallet/retrieve-pairings nil}