From 0e76e88a81aae9bc6880e1b46650476270566d04 Mon Sep 17 00:00:00 2001 From: Parvesh Monu Date: Thu, 30 May 2024 21:04:09 +0530 Subject: [PATCH] fix Test mode banner disappears after redirect upon push notification (#20263) --- src/status_im/common/alert_banner/events.cljs | 8 ++++++++ src/status_im/navigation/core.cljs | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/status_im/common/alert_banner/events.cljs b/src/status_im/common/alert_banner/events.cljs index 46e55fd206..a9e6420c13 100644 --- a/src/status_im/common/alert_banner/events.cljs +++ b/src/status_im/common/alert_banner/events.cljs @@ -32,8 +32,16 @@ [{:keys [db]}] {: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/remove remove-alert-banner) (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/unhide unhide-alert-banners) +(re-frame/reg-event-fx :alert-banners/restore-alert-banners restore-alert-banners) diff --git a/src/status_im/navigation/core.cljs b/src/status_im/navigation/core.cljs index bdf8395a82..286b82a9b6 100644 --- a/src/status_im/navigation/core.cljs +++ b/src/status_im/navigation/core.cljs @@ -30,7 +30,8 @@ (when @state/root-id (reset! theme/device-theme (rn/get-color-scheme)) (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))) ;;;; Modal