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

FR: Differentiate Click vs Receive Notification in Window Messaging Controller #294

Open
briantq opened this issue Nov 4, 2017 · 0 comments

Comments

@briantq
Copy link

briantq commented Nov 4, 2017

[REQUIRED] Describe your environment

  • Operating System version: _____Angular 4.4.4
  • Firebase SDK version: _____Firebase 4.5.0
  • Firebase Product: _____ messaging

[REQUIRED] Describe the problem

I have a use case that I want to refresh the content on the page if the user is not currently using the page. If they are on the page I don't want to interrupt their workflow. The problem is that both the notification click and received go through the same onMessage subscriber.

Looking at the code, I don't see how I can achieve that without abandoning a good portion of Firebase messaging. If we could add some indicator in the onMessage() callback to indicate the source of the message, it would be help in handling the events separately.

Steps to reproduce:

Add callback to Firebase.messaging().onMessage().

Notice that the same code 'attemptToMessageClient_' gets called for both the 'onNotificationClick_' and 'onPush_' in sw-controller.ts. From there, the messaged is handled by the event listener registered in 'setupSWMessageListener_' in window-controller.ts. You can see that the two events call the same messageObserver_ which routes the same to onMessage that the client registers.

Relevant Code:

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

No branches or pull requests

4 participants