Skip to content

Commit 25f7bf9

Browse files
committed
fix(ios): cleaning firebase-messaging-core iOS build warnings
1 parent 6698bb9 commit 25f7bf9

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
@@ -76,7 +76,13 @@ public class NSCUNUserNotificationCenterDelegate: NSObject, UNUserNotificationCe
7676

7777
if (NSCFirebaseMessagingCore.showNotificationsWhenInForeground || notification.request.content.userInfo["gcm.notification.showWhenInForeground"] as? String == "true" || notification.request.content.userInfo["showWhenInForeground"] as? Bool ?? false ||
7878
aps != nil && aps?["showWhenInForeground"] as? Bool ?? false) {
79-
options = UNNotificationPresentationOptions(rawValue: UNNotificationPresentationOptions.alert.rawValue | UNNotificationPresentationOptions.sound.rawValue | UNNotificationPresentationOptions.badge.rawValue )
79+
var alertOptions: UInt = 0
80+
if #available(iOS 14.0, *) {
81+
alertOptions = UNNotificationPresentationOptions.list.rawValue | UNNotificationPresentationOptions.banner.rawValue
82+
} else {
83+
alertOptions = UNNotificationPresentationOptions.alert.rawValue
84+
}
85+
options = UNNotificationPresentationOptions(rawValue: alertOptions | UNNotificationPresentationOptions.sound.rawValue | UNNotificationPresentationOptions.badge.rawValue)
8086
}
8187

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

0 commit comments

Comments
 (0)