fix Test mode banner disappears after redirect upon push notification (#20263)

This commit is contained in:
Parvesh Monu 2024-05-30 21:04:09 +05:30 committed by GitHub
parent cb4ce20c98
commit 0e76e88a81
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 1 deletions

View File

@ -32,8 +32,16 @@
[{:keys [db]}] [{:keys [db]}]
{:db (dissoc db :alert-banners/hide?)}) {:db (dissoc db :alert-banners/hide?)})
;; When push notifications are enabled and the app is closed then overlays get dismissed,
;; we need to restore them once app is relaunched
(defn restore-alert-banners
[{:keys [db]}]
(when-not (zero? (count (get db :alert-banners)))
{:show-alert-banner [(:view-id db) (:theme db)]}))
(re-frame/reg-event-fx :alert-banners/add add-alert-banner) (re-frame/reg-event-fx :alert-banners/add add-alert-banner)
(re-frame/reg-event-fx :alert-banners/remove remove-alert-banner) (re-frame/reg-event-fx :alert-banners/remove remove-alert-banner)
(re-frame/reg-event-fx :alert-banners/remove-all remove-all-alert-banners) (re-frame/reg-event-fx :alert-banners/remove-all remove-all-alert-banners)
(re-frame/reg-event-fx :alert-banners/hide hide-alert-banners) (re-frame/reg-event-fx :alert-banners/hide hide-alert-banners)
(re-frame/reg-event-fx :alert-banners/unhide unhide-alert-banners) (re-frame/reg-event-fx :alert-banners/unhide unhide-alert-banners)
(re-frame/reg-event-fx :alert-banners/restore-alert-banners restore-alert-banners)

View File

@ -30,7 +30,8 @@
(when @state/root-id (when @state/root-id
(reset! theme/device-theme (rn/get-color-scheme)) (reset! theme/device-theme (rn/get-color-scheme))
(re-frame/dispatch [:init-root @state/root-id]) (re-frame/dispatch [:init-root @state/root-id])
(re-frame/dispatch [:chat/check-last-chat])) (re-frame/dispatch [:chat/check-last-chat])
(re-frame/dispatch [:alert-banners/restore-alert-banners]))
(rn/hide-splash-screen))) (rn/hide-splash-screen)))
;;;; Modal ;;;; Modal