| .. | .. |
|---|
| 43 | 43 | super.application(application, didFailToRegisterForRemoteNotificationsWithError: error) |
|---|
| 44 | 44 | } |
|---|
| 45 | 45 | |
|---|
| 46 | | - // Forward notification presentation (foreground) |
|---|
| 46 | + // Suppress push notification display when app is in foreground — |
|---|
| 47 | + // the MQTT message handler shows it in-app instead |
|---|
| 47 | 48 | override func userNotificationCenter( |
|---|
| 48 | 49 | _ center: UNUserNotificationCenter, |
|---|
| 49 | 50 | willPresent notification: UNNotification, |
|---|
| 50 | 51 | withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void |
|---|
| 51 | 52 | ) { |
|---|
| 52 | | - super.userNotificationCenter(center, willPresent: notification, withCompletionHandler: completionHandler) |
|---|
| 53 | + // Don't show banner/sound/badge when app is active — MQTT delivers the message directly |
|---|
| 54 | + completionHandler([]) |
|---|
| 53 | 55 | } |
|---|
| 54 | 56 | |
|---|
| 55 | 57 | // Forward notification tap |
|---|