Skip to content

Commit

Permalink
fix(ios, permission): status key should be authorizationStatus
Browse files Browse the repository at this point in the history
Fixes #333 - thanks to @andrepaulo-bit for noticing and letting us know!
  • Loading branch information
mikehardy committed Mar 8, 2022
1 parent 8251327 commit 0f6f854
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions ios/NotifeeCore/NotifeeCore.m
Original file line number Diff line number Diff line change
Expand Up @@ -585,19 +585,19 @@ + (void)getNotificationSettings:(notifeeMethodNSDictionaryBlock)block {
NSMutableDictionary *settingsDictionary = [NSMutableDictionary dictionary];
NSMutableDictionary *iosDictionary = [NSMutableDictionary dictionary];

// authorizedStatus
NSNumber *authorizedStatus = @-1;
// authorizationStatus
NSNumber *authorizationStatus = @-1;
if (settings.authorizationStatus == UNAuthorizationStatusNotDetermined) {
authorizedStatus = @-1;
authorizationStatus = @-1;
} else if (settings.authorizationStatus == UNAuthorizationStatusDenied) {
authorizedStatus = @0;
authorizationStatus = @0;
} else if (settings.authorizationStatus == UNAuthorizationStatusAuthorized) {
authorizedStatus = @1;
authorizationStatus = @1;
}

if (@available(iOS 12.0, *)) {
if (settings.authorizationStatus == UNAuthorizationStatusProvisional) {
authorizedStatus = @2;
authorizationStatus = @2;
}
}

Expand Down Expand Up @@ -634,7 +634,7 @@ + (void)getNotificationSettings:(notifeeMethodNSDictionaryBlock)block {
}

iosDictionary[@"showPreviews"] = showPreviews;
iosDictionary[@"authorizationStatus"] = authorizedStatus;
iosDictionary[@"authorizationStatus"] = authorizationStatus;
iosDictionary[@"alert"] =
[NotifeeCoreUtil numberForUNNotificationSetting:settings.alertSetting];
iosDictionary[@"badge"] =
Expand All @@ -648,7 +648,7 @@ + (void)getNotificationSettings:(notifeeMethodNSDictionaryBlock)block {
iosDictionary[@"notificationCenter"] =
[NotifeeCoreUtil numberForUNNotificationSetting:settings.notificationCenterSetting];

settingsDictionary[@"authorizedStatus"] = authorizedStatus;
settingsDictionary[@"authorizationStatus"] = authorizationStatus;
settingsDictionary[@"ios"] = iosDictionary;

block(nil, settingsDictionary);
Expand Down

0 comments on commit 0f6f854

Please sign in to comment.