edamov / pushok

PHP client for Apple Push Notification Service (APNs) - Send push notifications to iOS using the new APNs HTTP/2 protocol with token-based (JWT with p8 private key)
MIT License
368 stars 119 forks source link

Update Payload.php #131

Closed KoIIIeY closed 3 years ago

KoIIIeY commented 3 years ago

Fix for able to do like this:

public function toApnVoip($notifiable) { return ApnVoipMessage::create() ->body(json_encode($this->card)) ->custom('aps', ['alert' => ['incoming_caller_id' => $this->card->patient->user_id, 'incoming_caller_name' => $this->card->patient->fullName, 'uuid' => \uniqid()]]) ->badge(1); }

edamov commented 3 years ago

Now I understand what you want to achieve :) I think it is better to add an ability to add custom value in the Alert class, and not change the payload custom value method.

KoIIIeY commented 3 years ago

Now I understand what you want to achieve :) I think it is better to add an ability to add custom value in the Alert class, and not change the payload custom value method.

The problem is that I also need to change the laravel notification channels in order for it to work :) In theory, it will be enough for me to at least insert data directly as a string, given that no one has noticed this problem before, then nothing will break for anyone.

KoIIIeY commented 3 years ago

Ok, I done all changes that we both wants.

Added array as value for alert in setAlert, so we doesnt need always use JSON serialize and deserialize for settings. Your setCustom returned to original and my new method addCustomValue added.

Plz check and merge

coveralls commented 3 years ago

Coverage Status

Coverage decreased (-1.4%) to 80.662% when pulling cdeeb24e0c01850129b2bfd2a03729219d41c104 on KoIIIeY:patch-1 into aada72b8dce94c9248cb8e77c4b1e086a6f2ea54 on edamov:master.

KoIIIeY commented 3 years ago

@edamov , can you check? My project needs that changes :)

And I already created new pull request to Laravel notification channels https://github.com/laravel-notification-channels/apn/pull/122

KoIIIeY commented 3 years ago

Thanks :)