Skip to content

Commit

Permalink
[flutter_local_notifications] coleasce null audio attributes when map…
Browse files Browse the repository at this point in the history
…ping notification channel (#2319)

* coleasce null audio attributes when mapping notification channel

* Google Java Format

* fixed typo in changelog entry

* fixed another issue with changelog entry where "error" was written instead of "occur"

---------

Co-authored-by: github-actions <>
  • Loading branch information
MaikuB committed May 6, 2024
1 parent aa7ef0a commit 5375645
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
4 changes: 4 additions & 0 deletions flutter_local_notifications/CHANGELOG.md
@@ -1,3 +1,7 @@
## [17.1.2]

* [Android] fixed issue [2318](https://github.com/MaikuB/flutter_local_notifications/issues/2318) where an exception could occur on calling the `getNotificationChannels()` method from the `AndroidFlutterLocalNotificationsPlugin` class. This happened when Android found that the audio attributes associated with the channel was null. The plugin will now coalesce the null value to indicate that the usage of the audio is for notifications as per https://developer.android.com/reference/android/media/AudioAttributes#USAGE_NOTIFICATION. On the Dart side, this would correspond to the [AudioAttributesUsage.notification](https://pub.dev/documentation/flutter_local_notifications/latest/flutter_local_notifications/AudioAttributesUsage.html#notification) enum value

## [17.1.1]

* [Android] fixes issue [#2299](https://github.com/MaikuB/flutter_local_notifications/issues/2299) where within the range of the max integer value of epoch time passed to a messaging style would result in a casting exception
Expand Down
Expand Up @@ -2081,7 +2081,12 @@ private HashMap<String, Object> getMappedNotificationChannel(NotificationChannel
channelPayload.put("vibrationPattern", channel.getVibrationPattern());
channelPayload.put("enableLights", channel.shouldShowLights());
channelPayload.put("ledColor", channel.getLightColor());
channelPayload.put("audioAttributesUsage", channel.getAudioAttributes().getUsage());
final AudioAttributes audioAttributes = channel.getAudioAttributes();
channelPayload.put(
"audioAttributesUsage",
audioAttributes == null
? AudioAttributes.USAGE_NOTIFICATION
: audioAttributes.getUsage());
}
return channelPayload;
}
Expand Down
2 changes: 1 addition & 1 deletion flutter_local_notifications/pubspec.yaml
Expand Up @@ -2,7 +2,7 @@ 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: 17.1.1
version: 17.1.2
homepage: https://github.com/MaikuB/flutter_local_notifications/tree/master/flutter_local_notifications
issue_tracker: https://github.com/MaikuB/flutter_local_notifications/issues

Expand Down

0 comments on commit 5375645

Please sign in to comment.