Send notifications to multiple interests #87
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.
The
alymosul/exponent-server-sdk-php
package supports sending a notification to multiple interests, however, this package forces you to only return one interest using therouteNotificationForExpoPushNotifications()
method. I've changed this so that the developer can choose themselves if they want to return multiple interests or not. For me this is particularly useful because I've made a team notifiable and in the teamrouteNotificationForExpoPushNotifications()
I can now return all intersets of users in that team.Small suggestion
I personally would maybe change the way the
routeNotificationForExpoPushNotifications()
method works. Instead of returning interests, I maybe would allow developers to return actual tokens. This optionally gives them more flexibility to decide which token needs to be used when sending notifications to a notifiable model. If norouteNotificationForExpoPushNotifications()
exists, you obviously would keep the current implementation. This would mean that theExpo
class also need to change. Maybe a$expo->notifyDirectly(array $recipients, array $data, bool $debug);
(maybe not the best name, just a quick thought).The
notify()
method itself could use that method as well:Again, this would be useful for me. In my project I've my own API implementation for saving and managing tokens of a user because I need that to support multiple token types (Firebase and APN). Currently the package doesn't give me a lot of flexibility (which I get) and I need to override I few things in the service provider to accomplish this. This way instead of overriding service providers or creating your own expo repository you can just handle the token retrievement via the models which is also what I like about the notification system of Laravel 😄
What do you think about this idea? I could make a PR as a proof of concept.