Skip to content

Commit

Permalink
Implements notifications actions, reworked callbacks getActiveNotific…
Browse files Browse the repository at this point in the history
…ations on iOS and macOS, iOS and macOS refactoring and renamed Android error codes (MaikuB#1406)

* Added support for active notifications on iOS (MaikuB#1391)

* Added support for active notifications on iOS

* bump platform interface to 6.0.0-dev.1 for prerelease

Co-authored-by: Michael Bui <[email protected]>

* Google Java Format

* fix version of platform interface

* Swift Format

* update error codes for unsupported os version and existing error codes to lower case

* Swift Format

* update groupKey changelog details

* Clang Format

* bump platform interface dependency used by linux plugin

* bump linux plugin for prerelease

* use dependency overrides for example app

* update text in example app for getActiveNotifications example around unsupported iOS version

* bump main plugin for prerelease

* bump cross-platform facing plugin's dependency on linux plugin

* call apply method for shared preferences editor instead of committing in background via a thread

* fix linux plugin pubspec

* update example to use device_info_plus instead of device_info

* Clang Format

* address linter issues

* refactored iOS and macOS classes

* update readme based on iOS/macOS refactoring and tweaks to docs around actions

* fix section around handling notifications when app is in the foreground for iOS

* updates for pre-release

* add changelog entry on breaking change for refactoring iOS and macOS classes

* bump platform interface dependency

* rename callback for selecting notification action

* rename method invoked from macos when action is selected

* bump linux dependency

* [flutter_local_notifications_linux] Add actions support in Linux (MaikuB#1442)

* Add actions support in Linux

* Update README

* bump versions and changelog for another pre-release

* add git clean script

* add exported flag to ActionBroadcastReceiver

* add keep annotation to NotificationAction

* lookup callback handler after flutter engine is initialised

* fix error where plugin was lookup to the notification action callback and failed to find it as it was doing before the Flutter engine was initialised

* Google Java Format

* remove ActionBroadcastReceiverTest as implementation logic depends on starting Flutter engine

* apply appropriate mutability flag to intents for notification actions to

* Google Java Format

* bump to 10.0.0-dev.8

* bump linux plugin

* avoid trying to process iOS notification responses for notifications not created by the plugin (MaikuB#1509)

* fix completionHandler being called for notifications created outside of the plugin

* Clang Format

* bump to 10.0.0-dev.9

Co-authored-by: runner <[email protected]>

* update requestPermissions on macOS to have non-nullable parameters

* fix default param values on macOS for requestPermissions

* update 10.0.0-dev.9 changelog entry for macOS requestPermissions change

* [flutter_local_notifications] adding ios/macos time sensitive interruption level (MaikuB#1501)

* adding ios/macos time sensitive interruption level

* adding ios/macos time sensitive interruption level

* adding ios/macos time sensitive interruption level

* darwin time sensitive notifications requested changes

* darwin time sensitive notifications requested changes

* fixing accidental revert of requrestPermission bool parameter defaults

* fixing doc comment default value for `requestCriticalPermission`

* Clang Format

* change import used to get access to immutable annotation

* update InterruptionLevel to use a class and be explicit on numeric values

* bump to 10.0.0-dev.10

* fix api docs for InterruptionLevel

* update example app to display groupKey of ActiveNotification

* changelog and version bumps to prep for 10.0.0-dev.11 release

* Reworked callbacks have separate callbacks to deal with foreground and background interactions (MaikuB#1548)

* updated notification callbacks

* update ios plugin code to deal with foreground notification actions

* update notification app launch to process notification responses on ios

* refactor code for extracting notification response dictionary on ios

* update launch notification to be saved as a dictionary

* update app launch notification logic on macos

* rename and refactor notification logic on macos and ios

* revert making didNotificationLaunchApp parameter named

* update android plugin to send foreground event for notification actions

* bump plugin and update changelog

* Google Java Format

* Swift Format

* formatted objective c with clang format

Co-authored-by: github-actions <>
Co-authored-by: runner <[email protected]>

* update logic on iOS and macOS to set notification categories without querying for existing categories (MaikuB#1549)

* update logic to set notification categories without querying for existing categories

* Swift Format

Co-authored-by: runner <[email protected]>

* add changelog entry on changes to setting notification categories

* clarify notification actions support on Apple's platforms

* updated readme to be more explicit around how to handle when is launched by a notification

* remove reference to the word foreground from notification callback to avoid confusion (MaikuB#1555)

* remove reference to the word foreground from notification callback to avoid confusion

* Clang Format

* add changelog entry for platform interface

* update changelog entries and bump linux plugin

Co-authored-by: runner <[email protected]>

* fix linter issues in linux test class

* bump linux plugin's dependency on platform interface

* bump flutter_local_notifications dependencies on linux plugin and platform interface

* suppress unchecked cast warnings in plugin

* Google Java Format

* bump to 10.0.0-dev.13

* bump to 10.0.0-dev.14

* fix merge issue

* bump to 10.0.0-dev.15

* fix version which should be 10.0.0-dev.14

* fix progress in example app (MaikuB#1600)

* [flutter_local_notifications] removed dependency on ThreeTenBP and use desugaring (MaikuB#1601)

* remove ThreeTenBP and use Java desugaring

* update example to app to use launchUrl instead of deprecated launch method

* bump plugin and update changelog and readme on Gradle setup

* add changelog entry for example app fix

* add gradle setup to toc

* fix version to 10.0.0-dev.14

* update changelog entry on version that it includes from stable release

* remove extra bullet point in 10.0.0-dev.14 changelog entry

* change linux plugin to now be a 1.0.0 pre-release instead

* release 10.0.0-dev.15

* [flutter_local_notifications] add AndroidNotificationCategory to make Android categories more accessible (MaikuB#1609)

* replace Android notification category String to AndroidNotificationCategory class type

* change AndroidNotificationCategory to make use of const properties instead of factory constructors

* add API docs for each Android category

* format categories file

* changed linux notification categories to static const fields instead of factory constructors

* release 10.0.0-dev.16

* fix example app with using the email arrived linux notification category

* release flutter_local_notifications 10.0.0-dev.17

* fix show with actions unit test

* [flutter_local_notifications] Fix MaikuB#1654 (MaikuB#1655)

* fix MaikuB#1654

* Google Java Format

Co-authored-by: github-actions <>

* add comment on why actionInputs has the nullable annotation

* Google Java Format

* release 10.0.0-dev.18

* release flutter_local_notification_linux 1.0.0-dev.3

* fix merge issue

* bump for 10.0.0-dev.19 release

* 10.0.0-dev.20 release

* Google Java Format

* fix unit test for notification actions to check for audioAttributesUsage

* release flutter_local_notifications 10.0.0-dev.21

* bump minimum flutter sdk to 2.8 and minimum dart sdk to 2.15

* update changelog entry when mentioning dbus

* [flutter_local_notification] update document MaikuB#1684 (MaikuB#1692)

update IOS general setup document in flutter_local_notification/README.md

* add annotation to solve tree-shaking issues when dealing with functions using background isolates

* add more details on entry point annotation and wording tweaks to cavaets to using background isolates

* update API docs for onDidReceiveBackgroundNotificationResponse to mention entry point annotation

* remove references to IsolateNameServer APIs

* update docs around callbacks

* fix documentation on getActiveNotifications related code

* update min flutter sdk version of flutter app to 2.8

* clean up example app

* fix issues picked up by linter

* add details on caveat on null notification payload

* update versions for stable release

* update changelog for stable release

* add missing changelog entry for iOS and macOS on request critical notification permissions and specifying interruption level

* add changelog entry on changes done to example app around notification IDs

* remove url_launcher dependency as it's not longer used

* add steps on setting up compile SDK version

* remove excess blank line from changelog

Co-authored-by: morvagergely <[email protected]>
Co-authored-by: github-actions <>
Co-authored-by: runner <[email protected]>
Co-authored-by: runner <[email protected]>
Co-authored-by: runner <[email protected]>
Co-authored-by: runner <[email protected]>
Co-authored-by: Yaroslav Pronin <[email protected]>
Co-authored-by: runner <[email protected]>
Co-authored-by: maprohu <[email protected]>
Co-authored-by: runner <[email protected]>
Co-authored-by: runner <[email protected]>
Co-authored-by: runner <[email protected]>
Co-authored-by: runner <[email protected]>
Co-authored-by: Lucas Ribolli <[email protected]>
Co-authored-by: SungHyun <[email protected]>
  • Loading branch information
15 people authored Sep 17, 2022
1 parent 0fff663 commit 0144fa6
Show file tree
Hide file tree
Showing 97 changed files with 5,225 additions and 1,970 deletions.
11 changes: 11 additions & 0 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,17 @@ task:
- melos bootstrap
- melos run test:unit --no-select

task:
name: Run all unit tests (Android)
container:
image: cirrusci/flutter:stable
install_melos_script:
- dart pub global activate melos
test_script:
- export PATH="$PATH":"$HOME/.pub-cache/bin"
- melos bootstrap
- melos run test:unit:android

task:
name: Run integration tests (Android)
env:
Expand Down
88 changes: 33 additions & 55 deletions flutter_local_notifications/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,35 @@
# [10.0.0]

* **Breaking change** [Android] `zonedSchedule()`'s implementation has switched to using [desugaring](https://developer.android.com/studio/releases/gradle-plugin#j8-library-desugaring) instead of the [ThreeTen Android Backport library](https://github.com/JakeWharton/ThreeTenABP). This required the plugin to update to using Android Gradle plugin 4.2.2 and applications may need to bump their Android Gradle plugin dependency to at least 4.2.2 as a result. Added a "Gradle setup" section underneath "Android setup" with details on the extra setup needed
* [Android] **Breaking change** the following error codes included in `PlatformException`s that can occur on Android have been updated
* `INVALID_ICON` -> `invalid_icon`
* `INVALID_LARGE_ICON` -> `invalid_large_icon`
* `INVALID_BIG_PICTURE` -> `invalid_big_picture`
* `INVALID_SOUND` -> `invalid_sound`
* `INVALID_LED_DETAILS` -> `invalid_led_details`
* `GET_ACTIVE_NOTIFICATIONS_ERROR_CODE` -> `unsupported_os_version`
* `GET_NOTIFICATION_CHANNELS_ERROR_CODE` -> `getNotificationChannelsError`
* `GET_ACTIVE_NOTIFICATION_MESSAGING_STYLE_ERROR_CODE` -> `getActiveNotificationMessagingStyle`
* `PERMISSION_REQUEST_IN_PROGRESS` -> `permissionRequestInProgress`
* [Android] **Breaking change** the `category` of the `AndroidNotificationDetails` now requires an instance of the newly added `AndroidNotificationCategory` class instead of a string. This was to improve the discoverability of the APIs and improve the semantics as the category can specified in a similar fashion to using an enum value
* **Breaking change** callbacks have now been reworked. There are now the following callbacks and both will pass an instance of the `NotificationResponse` class
* `onDidReceiveNotificationResponse`: invoked only when the app is running. This works for when a user has selected a notification or notification action. This replaces the `onSelectNotification` callback that existed before. For notification actions, the action needs to be configured to indicate the the app or user interface should be shown on invoking the action for this callback to be invoked i.e. by specifying the `DarwinNotificationActionOption.foreground` option on iOS and the `showsUserInterface` property on Android. On macOS and Linux, as there's no support for background isolates it will always invoke this callback
* `onDidReceiveBackgroundNotificationResponse`: invoked on a background isolate for when a user has selected a notification action. This replaces the `onSelectNotificationAction` callback
* **Breaking change** the `NotificationAppLaunchDetails` has been updated to contain an instance `NotificationResponse` class with the `payload` belonging to the `NotificationResponse` class. This is to allow knowing more details about what caused the app to launch e.g. if a notification action was used to do so
* [iOS][macOS] **Breaking changes** iOS and macOS classes have been renamed and refactored as they are based on the same operating system and share the same notification APIs. Rather than having a prefix of either `IOS` or `MacOS`, these are now replaced by classes with a `Darwin` prefix. For example, `IOSInitializationSettings` can be replaced with `DarwinInitializationSettings`
* [macOS] **Breaking change** the `requestPermissions()` method of the `MacOSFlutterLocalNotificationsPlugin` class now only accepts non-nullable parameters that default to `false`. This makes it consistent with the iOS implementation of the plugin
* Added support for notification actions. Massive thanks to [Sebastian Roth](https://github.com/ened), [Pieter van Loon](https://github.com/Kavantix) and [Yaroslav Pronin](https://github.com/proninyaroslav) for their work on this. Note that on Apple's platforms, notification actions are only supported on iOS 10 or newer and macOS 10.14 or newer
* [Linux] **Breaking change** the linux notification categories defined by `LinuxNotificationCategory` no longer has factory constructors but has static constant fields instead to make the semantics more similar to access enum values
* [Android] Updated how scheduled notifications are saved to shared preferences so it is done in the background. This is to fix issue [1378](https://github.com/MaikuB/flutter_local_notifications/issues/1378) where `pendingNotificationRequests` method may not report the correct number of scheduled notifications if it is invoked before the data had been saved to shared preferences
* [iOS] `getActiveNotifications()` is now supported for iOS versions 10.0 or newer
* [macOS] `getActiveNotifications()` is now supported for macOS versions 10.14 or newer
* [iOS][macOS] thanks to the PR from [maprohu](https://github.com/maprohu), the following features are now available
* the ability to request permissions to show critical notifications
* the ability to specify the interruption level of a notification. This is only applicable to iOS 15.0 and macOS 12.0 or newer.
* Updated minimum Flutter version to 2.8 as that aligns with the minimum Dart SDK version of 2.1.5 required by one of `flutter_local_notifications_linux`'s dependencies (`dbus`)
* Example app has been updated so that each notification has its own notification ID. Previously, they were all given a notification ID of `0`
* Updated Android setup docs to mention setting up `compileSdkVersion`

# [9.9.1]

* [Android] plugin has been updated to minimise clashing with other plugins that handle permission requests. Thanks to the PR from [Tiernan](https://github.com/nvx)
Expand Down Expand Up @@ -1008,58 +1040,4 @@ Please note that there are a number of breaking changes in this release to impro

## [0.0.1]

* Initial release






















































* Initial release
Loading

0 comments on commit 0144fa6

Please sign in to comment.