Skip to content

Commit 824094d

Browse files
mohsen-ghafouriilmotta
authored andcommitted
[#21439] fix: close swap flow after confirmation (#21466)
Signed-off-by: Brian Sztamfater <[email protected]>
1 parent 24ca8e1 commit 824094d

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

src/status_im/contexts/wallet/swap/events.cljs

+14-3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
(fn [{:keys [db]} [{:keys [network asset-to-receive open-new-screen?] :as data}]]
1818
(let [{:keys [wallet]} db
1919
test-networks-enabled? (get-in db [:profile/profile :test-networks-enabled?])
20+
view-id (:view-id db)
2021
account (swap-utils/wallet-account wallet)
2122
asset-to-pay (if (get-in data [:asset-to-pay :networks])
2223
(:asset-to-pay data)
@@ -30,12 +31,13 @@
3031
{:db (-> db
3132
(assoc-in [:wallet :ui :swap :asset-to-pay] asset-to-pay)
3233
(assoc-in [:wallet :ui :swap :asset-to-receive] asset-to-receive)
33-
(assoc-in [:wallet :ui :swap :network] network'))
34+
(assoc-in [:wallet :ui :swap :network] network')
35+
(assoc-in [:wallet :ui :swap :launch-screen] view-id))
3436
:fx (if network'
3537
[[:dispatch [:wallet/switch-current-viewing-account (:address account)]]
3638
[:dispatch
3739
(if open-new-screen?
38-
[:navigate-to :screen/wallet.setup-swap]
40+
[:open-modal :screen/wallet.setup-swap]
3941
[:navigate-to-within-stack
4042
[:screen/wallet.setup-swap :screen/wallet.swap-select-asset-to-pay]])]
4143
[:dispatch [:wallet.swap/set-default-slippage]]]
@@ -293,7 +295,7 @@
293295
:screen/wallet.swap-set-spending-cap
294296
:screen/wallet.swap-confirmation)])
295297
(when-not approval-required?
296-
(rf/dispatch [:wallet/select-account-tab :activity])
298+
(rf/dispatch [:wallet/end-swap-flow])
297299
(debounce/debounce-and-dispatch
298300
[:toasts/upsert
299301
{:id :swap-transaction-pending
@@ -419,3 +421,12 @@
419421
:last-request-uuid
420422
:approved-amount
421423
:approval-transaction-id)))})))
424+
425+
(rf/reg-event-fx :wallet/end-swap-flow
426+
(fn [{:keys [db]}]
427+
(let [launch-screen (get-in db [:wallet :ui :swap :launch-screen])
428+
address (get-in db [:wallet :current-viewing-account-address])]
429+
{:fx [(when (= launch-screen :wallet-stack)
430+
[:dispatch [:wallet/navigate-to-account-within-stack address]])
431+
[:dispatch [:wallet/fetch-activities-for-current-account]]
432+
[:dispatch [:wallet/select-account-tab :activity]]]})))

src/status_im/navigation/screens.cljs

+2-1
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,8 @@
541541
:component wallet-swap-select-asset-to-pay/view}
542542

543543
{:name :screen/wallet.setup-swap
544-
:options {:insets {:bottom? true}}
544+
:options {:modalPresentationStyle :overCurrentContext
545+
:insets {:bottom? true}}
545546
:component wallet-swap-setup-swap/view}
546547

547548
{:name :screen/wallet.swap-propasal

0 commit comments

Comments
 (0)