Move AudioService.notificationClicked to AudioHandler.onNotificationClicked (discussion)
Is your feature request related to a problem? Please describe.
We already have onNotificationDeleted in AudioHandler and it would seem nice to have onNotificationClicked there too. But things may not be that simple.
Arguments for:
- Other interactions with the notification are in
AudioHandler.
Arguments against:
- If the app is already running, then responding to a click like an event makes sense. However, the app can also be launched from a terminated state because of a notification click. In this case, the app may want to query the reason why the app was launched during it's startup routine rather than listen for a click event which may not be received at the most ideal point in the startup routine. The current
ValueStreamallows for that.
Describe the solution you'd like
The idea would look something like this:
abstract class AudioHandler {
Future<void> onNotificationClicked();
}
Describe alternatives you've considered
- Leave it as a value stream in
AudioService. This will work fine. - Move the value stream into
AudioHandler. A bad idea since there is no point in making it something that subclasses can override and implement. Rather streams are things listened to.
Additional context
My inclination is to leave it as is for now, but if anyone has more arguments for or against, please feel free to share below.
Argument for:
- connection through isolate
I would keep it as ValueStream though
Can anyone let me know how to open a specific screen in App when the notification is clicked. There's no documentation I could refer to. @ryanheise.
Let's keep this issue focused on it's original purpose please, i.e. discussing a design decision surrounding the notificationClicked API. This is not the place to ask for help with your app, but please instead ask your question on StackOverflow or another discussion forum. Marking above comment (and my own comment) as off topic.
Edit: I see a related question (not exactly the same as this) on S/O here. If that was you, then you can add a comment asking for more information specifically regarding the navigation part. Note: Add the comment there, rather than here.