From f82cb695776499d5437ea6c370c44734d7c982fa Mon Sep 17 00:00:00 2001 From: S4NKALP Date: Sun, 27 Jul 2025 02:08:04 +0545 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat(notifications):=20add=20functi?= =?UTF-8?q?on=20to=20clear=20all=20notification=20history?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- utils/notification_utils.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/utils/notification_utils.py b/utils/notification_utils.py index 32c6fd8..4f9b7a5 100644 --- a/utils/notification_utils.py +++ b/utils/notification_utils.py @@ -394,6 +394,25 @@ class NotificationHistory(Box): except Exception as e: print(f"Error clearing history for app {app_name}: {e}") + def clear_history(self): + """Clear all notification history""" + try: + # Clear cached images for all notifications + for notif in self.persistent_notifications: + cached_image_path = notif.get("cached_image_path") + if cached_image_path: + delete_cached_image(cached_image_path) + + # Clear the persistent notifications list + self.persistent_notifications.clear() + + # Save the empty history + self._save_persistent_history() + + logger.info("Cleared all notification history") + except Exception as e: + print(f"Error clearing notification history: {e}") + def get_shared_notification_history(): """Get or create the shared notification history instance"""