Skip to content

Commit 9a8354f

Browse files
authored
Improve dissmiss all overlays (#15773)
1 parent 6c0c742 commit 9a8354f

File tree

4 files changed

+19
-13
lines changed

4 files changed

+19
-13
lines changed

src/react_native/navigation.cljs

-4
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,6 @@
4141
[comp]
4242
(.catch (.dismissOverlay Navigation comp) #()))
4343

44-
(defn dissmiss-all-overlays
45-
[]
46-
(.catch (.dismissAllOverlays Navigation) #()))
47-
4844
(defn reg-app-launched-listener
4945
[handler]
5046
(.registerAppLaunchedListener ^js (.events ^js Navigation) handler))

src/status_im2/common/toasts/events.cljs

+8
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,11 @@
4545
(update-in [:db :toasts] assoc :hide-toasts-timer-set true)
4646
(assoc :dispatch-later [{:ms 500 :dispatch [:toasts/hide-with-check]}]))
4747
effect))))
48+
49+
(rf/defn close-all-toasts
50+
{:events [:toasts/close-all-toasts]}
51+
[{:keys [db]}]
52+
{:dispatch-n (reduce (fn [acc toast]
53+
(conj acc [:toasts/close (key toast)]))
54+
[]
55+
(get-in db [:toasts :toasts]))})

src/status_im2/navigation/core.cljs

-4
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,6 @@
160160
;; OVERLAY
161161
(def dissmiss-overlay navigation/dissmiss-overlay)
162162

163-
(def dissmiss-all-overlays navigation/dissmiss-all-overlays)
164-
165163
(defn show-overlay
166164
([comp] (show-overlay comp {}))
167165
([comp opts]
@@ -175,8 +173,6 @@
175173
:overlay {:interceptTouchOutside true}}
176174
opts)}})))
177175

178-
(re-frame/reg-fx :dissmiss-all-overlays-fx dissmiss-all-overlays)
179-
180176
;; toast
181177
(navigation/register-component "toasts" (fn [] views/toasts) js/undefined)
182178

src/status_im2/navigation/events.cljs

+11-5
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,14 @@
143143
(rf/defn dismiss-all-overlays
144144
{:events [:dissmiss-all-overlays]}
145145
[{:keys [db]}]
146-
{:dissmiss-all-overlays-fx nil
147-
:db (-> db
148-
(dissoc :popover/popover)
149-
(dissoc :visibility-status-popover/popover)
150-
(assoc-in [:bottom-sheet :hide?] true))})
146+
{:dispatch-n [[:hide-popover]
147+
[:hide-visibility-status-popover]
148+
[:hide-bottom-sheet]
149+
[:bottom-sheet-hidden]
150+
[:hide-wallet-connect-sheet]
151+
[:hide-wallet-connect-success-sheet]
152+
[:hide-wallet-connect-app-management-sheet]
153+
[:hide-signing-sheet]
154+
[:hide-select-acc-sheet]
155+
[:bottom-sheet/hide-old-navigation-overlay]
156+
[:toasts/close-all-toasts]]})

0 commit comments

Comments
 (0)