NotificationPusher
NotificationPusher copied to clipboard
PushManager resends sent Pushes
This code will send same message twice:
...
$pushManager = new PushManager(PushManager::ENVIRONMENT_DEV);
$push = new Push($gcmAdapter, $devices, $message);
$pushManager->add($push);
$pushManager->push();
$pushManager->push();
Is it expected behavior or bug? PushManager can't be reused to send another batch of messages?
This is an issue I also encountered where when you try to call $pushManager->push multiple times on one class initialization it will actually repeat a message to the users on the previous push and so on. Because a notification to a user might be different than a notification to another, I find myself initializing the class for every push notification I send. That fixes the multiplication of messages. I just wonder if there is a reset function you can call... I have not seen it thru the code
@akkaweb feel free to add reset() method in PR
@seyfer, Consider adding check if $push has been sent somewhere around here:
https://github.com/Ph3nol/NotificationPusher/blob/master/src/Sly/NotificationPusher/PushManager.php#L89-L91
Maybe in next major version, cause it's backward incompatible.