Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion messaging/MessagingExample/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,15 @@ - (void)userNotificationCenter:(UNUserNotificationCenter *)center
NSLog(@"%@", userInfo);

// Change this to your preferred presentation option
completionHandler(UNNotificationPresentationOptionBadge | UNNotificationPresentationOptionAlert);
// Note: UNNotificationPresentationOptionAlert has been deprecated.
if (@available(iOS 14.0, *)) {
completionHandler(UNNotificationPresentationOptionList |
UNNotificationPresentationOptionBanner |
UNNotificationPresentationOptionSound);
} else {
completionHandler(UNNotificationPresentationOptionAlert |
UNNotificationPresentationOptionSound);
}
}

// Handle notification messages after display notification is tapped by the user.
Expand Down
9 changes: 7 additions & 2 deletions messaging/MessagingExampleSwift/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,13 @@ extension AppDelegate: UNUserNotificationCenterDelegate {
print(userInfo)

// Change this to your preferred presentation option
return [[.alert, .sound]]
}
// Note: UNNotificationPresentationOptions.alert has been deprecated.
if #available(iOS 14.0, *) {
return [.list, .banner, .sound]
} else {
return [.alert, .sound]
}
}

func userNotificationCenter(_ center: UNUserNotificationCenter,
didReceive response: UNNotificationResponse) async {
Expand Down
Loading