From 3233e3046d8922a6f948e0dbd74216d1943df31b Mon Sep 17 00:00:00 2001
From: Matthias Nott <mnott@mnsoft.org>
Date: Sun, 05 Apr 2026 12:47:46 +0200
Subject: [PATCH] fix: suppress push notification banner in foreground, show only when backgrounded
---
ios/Runner/AppDelegate.swift | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/ios/Runner/AppDelegate.swift b/ios/Runner/AppDelegate.swift
index e7b3b78..a92a1bb 100644
--- a/ios/Runner/AppDelegate.swift
+++ b/ios/Runner/AppDelegate.swift
@@ -43,13 +43,15 @@
super.application(application, didFailToRegisterForRemoteNotificationsWithError: error)
}
- // Forward notification presentation (foreground)
+ // Suppress push notification display when app is in foreground —
+ // the MQTT message handler shows it in-app instead
override func userNotificationCenter(
_ center: UNUserNotificationCenter,
willPresent notification: UNNotification,
withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void
) {
- super.userNotificationCenter(center, willPresent: notification, withCompletionHandler: completionHandler)
+ // Don't show banner/sound/badge when app is active — MQTT delivers the message directly
+ completionHandler([])
}
// Forward notification tap
--
Gitblit v1.3.1