diff --git a/flutter_local_notifications/CHANGELOG.md b/flutter_local_notifications/CHANGELOG.md index 1b9688763..d41dab832 100644 --- a/flutter_local_notifications/CHANGELOG.md +++ b/flutter_local_notifications/CHANGELOG.md @@ -1,3 +1,7 @@ +# [1.0.0] +* **BREAKING CHANGE** [iOS] Added checks to ensure callbacks are only invoked for notifications originating from the plugin to improve compatibility with other notification plugins. +* [Android] Bump Gradle plugin to 3.5.3 + # [0.9.1+3] * Include notes in getting started section to emphasise that the steps in the integration guide for each platform needs to be done. * Move information in the readme on configuring resources to keep on Android. diff --git a/flutter_local_notifications/android/build.gradle b/flutter_local_notifications/android/build.gradle index c23d01f3f..9a2704bcc 100644 --- a/flutter_local_notifications/android/build.gradle +++ b/flutter_local_notifications/android/build.gradle @@ -8,7 +8,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:3.5.0' + classpath 'com.android.tools.build:gradle:3.5.3' } } diff --git a/flutter_local_notifications/example/android/build.gradle b/flutter_local_notifications/example/android/build.gradle index f6838e08f..4e7ce9c95 100644 --- a/flutter_local_notifications/example/android/build.gradle +++ b/flutter_local_notifications/example/android/build.gradle @@ -5,7 +5,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:3.5.0' + classpath 'com.android.tools.build:gradle:3.5.3' } } diff --git a/flutter_local_notifications/ios/Classes/FlutterLocalNotificationsPlugin.m b/flutter_local_notifications/ios/Classes/FlutterLocalNotificationsPlugin.m index 0e358fa7e..56355a1b5 100644 --- a/flutter_local_notifications/ios/Classes/FlutterLocalNotificationsPlugin.m +++ b/flutter_local_notifications/ios/Classes/FlutterLocalNotificationsPlugin.m @@ -190,7 +190,7 @@ - (void)initialize:(FlutterMethodCall * _Nonnull)call result:(FlutterResult _Non } UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:notificationTypes categories:nil]; [[UIApplication sharedApplication] registerUserNotificationSettings:settings]; - if(launchNotification != nil) { + if(launchNotification != nil && [self isAFlutterLocalNotification:launchNotification.userInfo]) { NSString *payload = launchNotification.userInfo[PAYLOAD]; [self handleSelectNotification:payload]; } @@ -319,6 +319,10 @@ - (NSDictionary*)buildUserDict:(NSNumber *)id title:(NSString *)title presentAle return userDict; } +- (BOOL)isAFlutterLocalNotification:(NSDictionary *)userInfo { + return userInfo != nil && userInfo[NOTIFICATION_ID] && userInfo[TITLE] && userInfo[PRESENT_ALERT] && userInfo[PRESENT_SOUND] && userInfo[PRESENT_BADGE] && userInfo[PAYLOAD]; +} + - (void) showUserNotification:(NotificationDetails *) notificationDetails NS_AVAILABLE_IOS(10.0) { UNMutableNotificationContent* content = [[UNMutableNotificationContent alloc] init]; UNNotificationTrigger *trigger; @@ -483,7 +487,7 @@ - (void)handleSelectNotification:(NSString *)payload { - (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)(void))completionHandler NS_AVAILABLE_IOS(10.0) { - if ([response.actionIdentifier isEqualToString:UNNotificationDefaultActionIdentifier]) { + if ([response.actionIdentifier isEqualToString:UNNotificationDefaultActionIdentifier] && [self isAFlutterLocalNotification:response.notification.request.content.userInfo]) { NSString *payload = (NSString *) response.notification.request.content.userInfo[PAYLOAD]; if(initialized) { [self handleSelectNotification:payload]; @@ -508,6 +512,9 @@ - (void)application:(UIApplication*)application if(@available(iOS 10.0, *)) { return; } + if(![self isAFlutterLocalNotification:notification.userInfo]) { + return; + } NSMutableDictionary *arguments = [[NSMutableDictionary alloc] init]; arguments[ID]= notification.userInfo[NOTIFICATION_ID]; diff --git a/flutter_local_notifications/pubspec.yaml b/flutter_local_notifications/pubspec.yaml index e882c7801..cf799df6b 100644 --- a/flutter_local_notifications/pubspec.yaml +++ b/flutter_local_notifications/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_local_notifications description: A cross platform plugin for displaying and scheduling local notifications for Flutter applications with the ability to customise for each platform. -version: 0.9.1+3 +version: 1.0.0 homepage: https://github.com/MaikuB/flutter_local_notifications/tree/master/flutter_local_notifications dependencies: