Skip to content

Commit

Permalink
Convert deprecated UIUserNotificationType to UNAuthorizationOptions (f…
Browse files Browse the repository at this point in the history
…acebook#40884)

Summary:
Pull Request resolved: facebook#40884

# Changelog:

[Internal] - Removing usages of deprecated UIUserNotificationType

Reviewed By: christophpurrer

Differential Revision: D50238678

fbshipit-source-id: 16ee8cbec50a2273c0156f89691ef2ac7dea2d25
  • Loading branch information
Ingrid Wang authored and okwasniewski committed Jan 31, 2024
1 parent 05f9b54 commit cd7eb69
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -349,20 +349,20 @@ - (void)handleRemoteNotificationRegistrationError:(NSNotification *)notification
// Add a listener to make sure that startObserving has been called
[self addListener:@"remoteNotificationsRegistered"];

UIUserNotificationType types = UIUserNotificationTypeNone;
UNAuthorizationOptions options = UNAuthorizationOptionNone;

if (permissions.alert()) {
types |= UIUserNotificationTypeAlert;
options |= UNAuthorizationOptionAlert;
}
if (permissions.badge()) {
types |= UIUserNotificationTypeBadge;
options |= UNAuthorizationOptionBadge;
}
if (permissions.sound()) {
types |= UIUserNotificationTypeSound;
options |= UNAuthorizationOptionSound;
}

[UNUserNotificationCenter.currentNotificationCenter
requestAuthorizationWithOptions:types
requestAuthorizationWithOptions:options
completionHandler:^(BOOL granted, NSError *_Nullable error) {
if (error != NULL) {
reject(@"-1", @"Error - Push authorization request failed.", error);
Expand Down

0 comments on commit cd7eb69

Please sign in to comment.