Edujugon / PushNotification

PHP and Laravel Package to send push notifications to Android and IOS devices.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Is it a deliberate choice that the format of feedback varies by failure cause?

tamc opened this issue · comments

With app notifications, getFeedback() provides data in two different formats.

When a push fails for connection reasons, the format of getFeedback() is:

['success' => bool, 'error' => string]

e.g., https://github.com/Edujugon/PushNotification/blob/master/src/Apn.php#L175

If it passes, or fails on Apple's side, then the format of getFeedback() is:

['success' => int, 'failure' => int, 'tokenFailList' => [int], $apnsFeedback => [stuff]]

e.g., https://github.com/Edujugon/PushNotification/blob/master/src/Apn.php#L405

I was expecting the getFeedback() result to have the same structure, albeit with different values.

Was this a deliberate choice? Would a pull request to make them return in a single format be welcome? It would obviously be a potentially breaking change.

If it would be welcome, I would think of making the first case return ints for success and failure, with the appropriate number given how far it got before the fail, and adding an error string field to the second case which would say "Apple provided feedback" or some such if there was a fail from Apple, or nothing otherwise.

Hi @tamc ,

Thanks for taking your time reviewing the code and bringing this topic up.
Of course that PR would be more than welcome. I'm quite busy with my job and side projects and I really appreciate any contribution on this package.