Skip to content

Commit

Permalink
[flutter_local_notifications] updated presentSound and defaultPresent…
Browse files Browse the repository at this point in the history
…Sound API docs around background app behaviour (#2112)

* added more details on background sound behaviour to presentSound and defaultPresentSound

* added changelog entry
  • Loading branch information
MaikuB authored Oct 5, 2023
1 parent eeaf120 commit f59f7eb
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions flutter_local_notifications/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* [Android] bumped Java desugaring dependency and updated readme accordingly to also mention Gradle version that is used by plugin
* [Android] fixed issue an issue similar to [2033](https://github.com/MaikuB/flutter_local_notifications/issues/2033) that was addressed in 15.0.1 where notifications on scheduled using older version of the plugin via the `periodicallyShow()` method would fail to have the next subsequent ones scheduled. This issue started occuring in 14.0 where support for inexact notifications was added using the `ScheduleMode` enum that was added and resulted in the deprecation of `androidAllowWhileIdle`. A mechanism was added to help "migrate" old notifications that had `androidAllowWhileIdle` specified but didn't account for how there are recurring notifications that were scheduled using older versions of the plugin prior to `androidAllowWhile` being added. This was also released as part of the 15.1.1 and 14.1.3 hotfix releases
* [Android] fixed issue [2106](https://github.com/MaikuB/flutter_local_notifications/issues/2106) where calling `getNotificationChannels()` reports the wrong importance level or result in an exception if the importance level was unspecified. This was also released as part of the 15.1.2 and 14.1.4 hotfix releases
* [iOS][macOS] addresses issue [2097](https://github.com/MaikuB/flutter_local_notifications/issues/2097) by updating API docs for the `presentSound` and `defaultPresentSound` properties that belong to the `DarwinNotificationDetails` and `DarwinInitializationSettings` classes respectively to clarify the background behaviour and how have a sound play even when app is the background yet these properties are set to false
* Updated example app so that the Android side specifies minimum SDK version version that aligns with what's specified by the Flutter SDK
* Fixed Dart API docs for `DarwinNotificationDetails` class where `this This` was being repeated. Thanks to the PR from [Adrian Jagielak](https://github.com/adrianjagielak)
* Fixed example code shown at the "Handling notifications whilst the app is in the foreground" section of the readme. Thanks to the PR from [Tinh Huynh](https://github.com/TinhHuynh)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,16 @@ class DarwinInitializationSettings {
///
/// Default value is true.
///
/// If this is set to false to indicate that the notification shouldn't play
/// a sound in the foreground then note that for consistency, the notification
/// won't play a sound when the app is in the background. If the intention in
/// this scenario is to have the app also play the default notification sound
/// whilst the app is in the background as well, then the
/// [DarwinNotificationDetails.sound] should be set to an arbitrary value
/// (e.g. empty string) that doesn't match a custom sound file. This way the
/// platform fails to find a custom sound file to fallback to the default
/// notification sound.
///
/// On iOS, this property is only applicable to iOS 10 or newer.
/// On macOS, this property is only applicable to macOS 10.14 or newer.
final bool defaultPresentSound;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,15 @@ class DarwinNotificationDetails {
/// When this is set to `null`, it will use the default setting given
/// to [DarwinInitializationSettings.defaultPresentSound].
///
/// If this is set to false to indicate that the notification shouldn't play
/// a sound in the foreground then note that for consistency, the notification
/// won't play a sound when the app is in the background. If the intention in
/// this scenario is to have the app also play the default notification sound
/// whilst the app is in the background as well, then the [sound] should be
/// set to an arbitrary value (e.g. empty string) that doesn't match a custom
/// sound file. This way the platform fails to find a custom sound file to
/// fallback to the default notification sound.
///
/// This property is only applicable to iOS 10 or newer.
final bool? presentSound;

Expand Down

0 comments on commit f59f7eb

Please sign in to comment.