audio_service icon indicating copy to clipboard operation
audio_service copied to clipboard

Move AudioService.notificationClicked to AudioHandler.onNotificationClicked (discussion)

Open ryanheise opened this issue 4 years ago • 4 comments

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 ValueStream allows 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.

ryanheise avatar Jun 26 '21 07:06 ryanheise

Argument for:

  • connection through isolate

nt4f04uNd avatar Jun 26 '21 14:06 nt4f04uNd

I would keep it as ValueStream though

nt4f04uNd avatar Jun 26 '21 14:06 nt4f04uNd

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.

balasubramanian1612s avatar Jul 07 '21 09:07 balasubramanian1612s

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.

ryanheise avatar Jul 07 '21 10:07 ryanheise