Skip to content

Commit 872c1c2

Browse files
authored
fix(ios): cleaning firebase-messaging-core iOS build warnings (#251)
1 parent 86a2723 commit 872c1c2

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

packages/firebase-messaging-core/platforms/ios/src/NSCUNUserNotificationCenterDelegate.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,13 @@ public class NSCUNUserNotificationCenterDelegate: NSObject, UNUserNotificationCe
8080

8181
if (NSCFirebaseMessagingCore.showNotificationsWhenInForeground || notification.request.content.userInfo["gcm.notification.showWhenInForeground"] as? String == "true" || notification.request.content.userInfo["showWhenInForeground"] as? Bool ?? false ||
8282
aps != nil && aps?["showWhenInForeground"] as? Bool ?? false) {
83-
options = UNNotificationPresentationOptions(rawValue: UNNotificationPresentationOptions.alert.rawValue | UNNotificationPresentationOptions.sound.rawValue | UNNotificationPresentationOptions.badge.rawValue )
83+
var alertOptions: UInt = 0
84+
if #available(iOS 14.0, *) {
85+
alertOptions = UNNotificationPresentationOptions.list.rawValue | UNNotificationPresentationOptions.banner.rawValue
86+
} else {
87+
alertOptions = UNNotificationPresentationOptions.alert.rawValue
88+
}
89+
options = UNNotificationPresentationOptions(rawValue: alertOptions | UNNotificationPresentationOptions.sound.rawValue | UNNotificationPresentationOptions.badge.rawValue)
8490
}
8591

8692
if (notification.request.content.userInfo["gcm.message_id"] != nil) {

0 commit comments

Comments
 (0)