fix: hide the pin sheet before showing the connection sheet

This commit is contained in:
Cristian Lungu 2024-11-22 14:45:20 +02:00
parent 41734778cb
commit f8908c2006
No known key found for this signature in database
GPG Key ID: FBF86D630661E2CE
1 changed files with 17 additions and 13 deletions

View File

@ -27,14 +27,16 @@
(fn [{:keys [db]} [{:keys [keycard-pin sign-data on-success on-fail]}]] (fn [{:keys [db]} [{:keys [keycard-pin sign-data on-success on-fail]}]]
(let [address (get-in db [:wallet-connect/current-request :address]) (let [address (get-in db [:wallet-connect/current-request :address])
{:keys [path key-uid]} (get-in db [:wallet :accounts address])] {:keys [path key-uid]} (get-in db [:wallet :accounts address])]
{:fx [[:dispatch ;; NOTE: give time to the keycard-pin sheet to hide before showing the next one
[:keycard/sign-hash {:fx [[:dispatch-later
{:key-uid key-uid {:ms 300
:pin keycard-pin :dispatch [:keycard/sign-hash
:path path {:key-uid key-uid
:hash (hex/normalize-hex sign-data) :pin keycard-pin
:on-success on-success :path path
:on-failure on-fail}]]]}))) :hash (hex/normalize-hex sign-data)
:on-success on-success
:on-failure on-fail}]}]]})))
(rf/reg-event-fx (rf/reg-event-fx
:wallet-connect/authorized-signing :wallet-connect/authorized-signing
@ -48,11 +50,13 @@
(if keycard-sign? (if keycard-sign?
{:fx [[:dispatch {:fx [[:dispatch
[:standard-auth/authorize-with-keycard [:standard-auth/authorize-with-keycard
{:on-complete #(rf/dispatch [:wallet-connect/sign-message-with-keycard {:on-complete (fn [pin]
{:keycard-pin % (rf/dispatch [:hide-bottom-sheet])
:sign-data sign-data (rf/dispatch [:wallet-connect/sign-message-with-keycard
:on-success on-success {:keycard-pin pin
:on-fail on-fail}])}]]]} :sign-data sign-data
:on-success on-success
:on-fail on-fail}]))}]]]}
{:fx [[:effects.wallet/sign-message {:fx [[:effects.wallet/sign-message
{:message sign-data {:message sign-data
:address address :address address