Fix/Ios notifications not playing sound #352
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Notifications sounds are not being played on iOS while the app is in the foreground.
This issue was addressed in #295 , with the solution being a workaround by manually playing a sound.
Upon further investigation, I have determined the issue to be a missing flag on the
WillPresentNotification
completion handler.This plays the sound defined within the notification payload's ApnsConfig object (see https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#apnsconfig).
For example, setting the following in your notification will play the user-defined default alert sound (iOS 17.2+):
Additionally, I have included changes to support the
UNNotificationPresentationOptions
ofBanner
andList
, introduced in iOS 14 (deprecatingUNNotificationPresentationOptions.Alert
).Apologies if I did anything incorrect, this is my first public pull request and I was failing to install the legacy net 6.0 workloads to test, however I have custom implemented the
WillPresentNotification
delegate in my personal projects and is working as intended.