mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-19 16:13:42 +02:00
Drop use of deprecated currentUserNotificationSettings property in favour of UNUserNotificationCenter.
This commit is contained in:
@@ -2790,10 +2790,19 @@ TableViewSectionsDelegate>
|
||||
}
|
||||
|
||||
- (void)togglePushNotifications:(id)sender
|
||||
{
|
||||
// Get the user's notification settings to check check authorization status.
|
||||
[[UNUserNotificationCenter currentNotificationCenter] getNotificationSettingsWithCompletionHandler:^(UNNotificationSettings * _Nonnull settings) {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[self togglePushNotifications:sender withNotificationSettings:settings];
|
||||
});
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)togglePushNotifications:(id)sender withNotificationSettings:(UNNotificationSettings * _Nonnull)settings
|
||||
{
|
||||
// Check first whether the user allow notification from device settings
|
||||
UIUserNotificationType currentUserNotificationTypes = UIApplication.sharedApplication.currentUserNotificationSettings.types;
|
||||
if (currentUserNotificationTypes == UIUserNotificationTypeNone)
|
||||
if (settings.authorizationStatus == UNAuthorizationStatusDenied)
|
||||
{
|
||||
[currentAlert dismissViewControllerAnimated:NO completion:nil];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user