Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve SoundDidFinishPlayingNotification by including completion success in notification #29

Merged
merged 4 commits into from
Oct 10, 2018

Conversation

jashenson
Copy link
Contributor

Modules wanting to be notified about the completion of an AudioPlayer playing a sound have two options:

  1. Provide completion handler, but only be notified about whether play completed successfully
  2. Register for NotificationCenter, but only be notified about the player that completed

This creates an issue when the module wants to do something specifically based on the completion success while not knowing which of potentially multiple AudioPlayers is sending the message.

Fixing #1 requires changing the method signature. While I would encourage this to be implemented as it makes the completion handler more powerful, it will break the current API.

Fixing #2 is easy and non-breaking. I have implemented this here by adding a userInfo dictionary to the Notification including the boolean completion success.


I have also made a few small code changes to the init methods to use best Swift practices.

Copy link
Owner

@tbaranes tbaranes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All good! Could you just add an entry to the CHANGELOG?
Travis seems to be failing, I'm restarting the failing jobs, doesn't seem to be related to this PR.

@jashenson
Copy link
Contributor Author

Updated CHANGELOG as requested.

@tbaranes
Copy link
Owner

Travis is failing due to Swiftlint, which doesn't make sense (I checked it locally), will merge anyway. Thanks for your PR!

@tbaranes tbaranes merged commit 249b3ae into tbaranes:master Oct 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants