Closed gdebrauwer closed 10 months ago
While I get this in principle this isn't really a bugfix, rather a change in functionality. The early exit for having no tokens is over 3 years old.
I feel also that this is unconventional compared to other notification drivers. Even Laravel's Vonage driver exits early without a destinaton.
I appreciate your use-case but I wonder if perhaps this should be a different channel altogether - FcmMessageChannel
and FcmTopicChannel
(?) or instead just code you keep in your app.
I feel also that this is unconventional compared to other notification drivers. Even Laravel's Vonage driver exits early without a destination.
I understand that, but when using a topic or condition you just don't have a destination so that makes it a bit different than normal drivers.
The changes in this PR also do not cause any breaking changes. If you do not provide a destination and also no topic or condition, then it will still do nothing and just return an empty array
I understand it's not a breaking change, but there was work in #146 to greatly simplify this method and always use multicasting. I think it's weird that this happens first, regardless of if there are tokens or not. I'd be happy to consider this as a separate channel so that it's use can be explicit.
Currently, sending push notifications to a topic or conditions is impossible.
This is caused by the fact that the
FcmChannel
class immediately aborts if there are no tokens: https://github.com/laravel-notification-channels/fcm/blob/fa5e63d167f2d4a6e8ce01a2c8ea58553681e84e/src/FcmChannel.php#L46-L52This PR fixes that.