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

onPushNotification(title,description) needs payload #109

Closed
chrisjenx opened this issue Jan 27, 2025 · 1 comment
Closed

onPushNotification(title,description) needs payload #109

chrisjenx opened this issue Jan 27, 2025 · 1 comment

Comments

@chrisjenx
Copy link
Contributor

chrisjenx commented Jan 27, 2025

Hey love the lib,

But ideally public fun onPushNotification(title: String?, body: String?) {} should also take nullable payload.

Most cases one would filter these messages and decide to show them based on if the user is logged in (pushes include userId).

Theres a couple of quick fixes:

public fun onPushNotification(title: String?, body: String?, data: PayloadData?) {}

Or you can pipe the notification title/body into the payload (which is what I used to do)

val payloadData = message.data.toMutableMap()
message.notification?.also {
  payloadData["title"] = it.title ?: payloadData["title"]
  payloadData["body"] = it.title ?: payloadData["body"]
}

notifierManager.onPushPayloadData(data)

Or you can pass the notification to onPushPayloadData(title, body, data)

The TLDR is that these shouldn't be seperate methods, it should be up to the consumer how the handle show incoming messages.

@mirzemehdi
Copy link
Owner

Implemented in #110

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

2 participants