eclipsesource / tabris-plugin-firebase

A firebase plugin for Tabris.js
https://tabrisjs.com
BSD 3-Clause "New" or "Revised" License
6 stars 5 forks source link

Make it possible to consume notifications in all app states and present them appropriately #29

Closed cpetrov closed 6 years ago

cpetrov commented 6 years ago

Problem description

Current state:

e.g.

    {
      to: ...,
      data: {
        title: 'title',
        body: 'body',
        payload: {}
      }
    }    
app killed (cold start through tap on notification) app in bg app in fg
"message" event fired cannot launch, since no banner is shown

When a notification/data mixed message is received:

app killed (cold start through tap on notification) app in bg (either opened through tap on banner or app icon) app in fg
"message" event fired
launchData set - -

Expected behavior

There should be a way to show a notification banner in the system UI when:

There should be a way to consume a notification in the app when:

... ideally only using the "message" event and the launchData property if this is possible.

cpetrov commented 6 years ago

This may be helpful: https://firebase.google.com/docs/cloud-messaging/ios/receive

patrykmol commented 6 years ago

I have updated plugin. Hook is now fixed and launchData is now properly propagated. All of the mixed scenarios work in the example app.

Do note that when app is in background or when doing cold start data from regular notification will always land in launchData. message event is fired when app is in foreground.