Skip to content

Commit

Permalink
Schedule notification requests without checking settings first
Browse files Browse the repository at this point in the history
  • Loading branch information
newmarcel committed Jun 5, 2021
1 parent 91cdc8a commit bc67879
Showing 1 changed file with 2 additions and 22 deletions.
24 changes: 2 additions & 22 deletions KYAKit/KYAUserNotificationCenter/KYAUserNotificationCenter.m
Expand Up @@ -123,28 +123,8 @@ - (void)postNotification:(__kindof KYAUserNotification *)notification
{
NSParameterAssert(notification);

Auto center = self.center;
[center getNotificationSettingsWithCompletionHandler:^(UNNotificationSettings *settings) {
if(settings.authorizationStatus != UNAuthorizationStatusAuthorized
&& settings.authorizationStatus != UNAuthorizationStatusProvisional)
{
KYALog(@"Posting notifications has not been authorized.");
return;
}

if(settings.alertSetting == UNNotificationSettingEnabled)
{
Auto content = [notification createNotificationContent];
Auto identifier = notification.identifier;
[self scheduleNotificationRequestWithIdentifier:identifier content:content];
}
}];
}

- (void)scheduleNotificationRequestWithIdentifier:(NSString *)identifier content:(UNNotificationContent *)content
{
NSParameterAssert(identifier);
NSParameterAssert(content);
Auto content = [notification createNotificationContent];
Auto identifier = notification.identifier;

Auto request = [UNNotificationRequest requestWithIdentifier:identifier
content:content
Expand Down

0 comments on commit bc67879

Please sign in to comment.