From 25f7bf97fe488d72b3fdb16a15470dac82866355 Mon Sep 17 00:00:00 2001 From: Gabriel Matos Date: Thu, 4 Apr 2024 12:34:31 -0300 Subject: [PATCH] fix(ios): cleaning firebase-messaging-core iOS build warnings --- .../ios/src/NSCUNUserNotificationCenterDelegate.swift | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/firebase-messaging-core/platforms/ios/src/NSCUNUserNotificationCenterDelegate.swift b/packages/firebase-messaging-core/platforms/ios/src/NSCUNUserNotificationCenterDelegate.swift index f5a94057..1b5e04d6 100644 --- a/packages/firebase-messaging-core/platforms/ios/src/NSCUNUserNotificationCenterDelegate.swift +++ b/packages/firebase-messaging-core/platforms/ios/src/NSCUNUserNotificationCenterDelegate.swift @@ -76,7 +76,13 @@ public class NSCUNUserNotificationCenterDelegate: NSObject, UNUserNotificationCe if (NSCFirebaseMessagingCore.showNotificationsWhenInForeground || notification.request.content.userInfo["gcm.notification.showWhenInForeground"] as? String == "true" || notification.request.content.userInfo["showWhenInForeground"] as? Bool ?? false || aps != nil && aps?["showWhenInForeground"] as? Bool ?? false) { - options = UNNotificationPresentationOptions(rawValue: UNNotificationPresentationOptions.alert.rawValue | UNNotificationPresentationOptions.sound.rawValue | UNNotificationPresentationOptions.badge.rawValue ) + var alertOptions: UInt = 0 + if #available(iOS 14.0, *) { + alertOptions = UNNotificationPresentationOptions.list.rawValue | UNNotificationPresentationOptions.banner.rawValue + } else { + alertOptions = UNNotificationPresentationOptions.alert.rawValue + } + options = UNNotificationPresentationOptions(rawValue: alertOptions | UNNotificationPresentationOptions.sound.rawValue | UNNotificationPresentationOptions.badge.rawValue) } if (notification.request.content.userInfo["gcm.message_id"] != nil) {