Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug suddenly overwritted android payload tag #24

Open
lipflip opened this issue Jun 21, 2024 · 0 comments
Open

Bug suddenly overwritted android payload tag #24

lipflip opened this issue Jun 21, 2024 · 0 comments

Comments

@lipflip
Copy link

lipflip commented Jun 21, 2024

When using a payload for example:

{"notification":{"title":"We are opening soon","body":"test"}, "android": {"notification": {"sound": "soon.wav","channel_id":"soon"}}}

The "android" part is being overwritten when you set setPriority or setTimeToLive.

it is then overwritten by

"android":{"priority":"HIGH","ttl":"86400s"}

We could fix it by modifying "Client.php" to use array_replace_recursive instead of array_merge

if (!is_null($notification)) { $result = array_replace_recursive($result, $notification()); $isPlayload = true; }
if (!is_null($data)) { $result = array_replace_recursive($result, $data()); $isPlayload = true; }
if (!is_null($config)) { $result = array_replace_recursive($result, $config()); }

Which will result in:

"android":{"notification":{"sound":"soon.wav","channel_id":"soon"},"priority":"HIGH","ttl":"86400s"}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant