Skip to content

Bug suddenly overwritted android payload tag #24

@lipflip

Description

@lipflip

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"}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions