Skip to content

Commit 0cc96b6

Browse files
authored
Merge pull request g123k#1 from EvGeniyLell/master
remove unneeded `UNUserNotificationCenter requestAuthorizationWithOptions`
2 parents a1918eb + a8f82f8 commit 0cc96b6

File tree

3 files changed

+6
-14
lines changed

3 files changed

+6
-14
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## [1.5.2] - 15th Mart 2024
2+
3+
* Removed unnecessary requestAuthorizationWithOptions for iOS, this plugin doesn't need it to show badges. This should be used only for remote push notification.
4+
15
## [1.5.1] - 2nd January 2024
26

37
* Fixed an issue with missing Gradle namespace and other related issues.

ios/Classes/FlutterAppBadgerPlugin.m

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,7 @@ + (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar>*)registrar {
1010
[registrar addMethodCallDelegate:instance channel:channel];
1111
}
1212

13-
- (void)enableNotifications {
14-
if (@available(iOS 10, *)) {
15-
UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
16-
[center requestAuthorizationWithOptions:(UNAuthorizationOptionAlert | UNAuthorizationOptionBadge | UNAuthorizationOptionSound) completionHandler:^(BOOL granted, NSError * _Nullable error){}];
17-
} else {
18-
UIUserNotificationSettings* notificationSettings = [UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeAlert | UIUserNotificationTypeBadge | UIUserNotificationTypeSound categories:[[UIApplication sharedApplication] currentUserNotificationSettings].categories];
19-
[[UIApplication sharedApplication] registerUserNotificationSettings:notificationSettings];
20-
}
21-
}
22-
2313
- (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result {
24-
[self enableNotifications];
25-
2614
if ([@"updateBadgeCount" isEqualToString:call.method]) {
2715
NSDictionary *args = call.arguments;
2816
NSNumber *count = [args objectForKey:@"count"];

pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
name: flutter_app_badger
22
description: Plugin to update the app badge on the launcher (both for Android, iOS and macOS)
3-
version: 1.5.1
3+
version: 1.5.2
44
homepage: https://github.com/g123k/flutter_app_badger
55

66
environment:
77
sdk: '>=2.19.6 <4.0.0'
8-
flutter: ">=3.7.12"
8+
flutter: '>=3.7.12'
99

1010
dependencies:
1111
flutter:

0 commit comments

Comments
 (0)