You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For the most part (auth and firestore modules) I was able to use this great package without any issues. Today I was implementing notifications and I've noticed that this library only subscribes to var unsubscribe = messaging.onMessage(emit); which results in notifications being emited only when app is open. https://github.com/n6g7/redux-saga-firebase/blob/master/src/messaging.js#L12
There is another event messaging.setBackgroundMessageHandler (which turns out it also works in JS version of firabase), which emits a message while app is not open (in background), which is usually more important on mobile devices.
Would there be a way to add this subscription?
I was looking through the code but I'm not sure if I could just add another subscriptions on line 12 and then somehow combine them (since message emitted is of same class in both cases), or would we need a completely new channel (according to code copy pasting function channel() should be easy to do, but is there a better way?). If anyone can show me how it should be done I'm also willing to get my hands dirty. :)
EDIT: After trying to copy channel() code I fugured that same approach won't work, since onMessage seems like expecting generator, but setBackgroundMessageHandler requires a callback that returns a promise. I guess that's why it doesn't fit into saga world?
The text was updated successfully, but these errors were encountered:
tad3j
changed the title
Using redux-saga-firebase in react-native (messaging module not subbed to setBackgroundMessageHandler())
Using redux-saga-firebase in react-native (messaging module not subbed to setBackgroundMessageHandler)
Jan 29, 2020
tad3j
changed the title
Using redux-saga-firebase in react-native (messaging module not subbed to setBackgroundMessageHandler)
Using RSF in react-native (messaging module not subbed to setBackgroundMessageHandler)
Jan 29, 2020
tad3j
changed the title
Using RSF in react-native (messaging module not subbed to setBackgroundMessageHandler)
Using RSF in react-native (messaging channel not subbed to setBackgroundMessageHandler)
Jan 29, 2020
For the most part (auth and firestore modules) I was able to use this great package without any issues. Today I was implementing notifications and I've noticed that this library only subscribes to
var unsubscribe = messaging.onMessage(emit);
which results in notifications being emited only when app is open. https://github.com/n6g7/redux-saga-firebase/blob/master/src/messaging.js#L12There is another event messaging.setBackgroundMessageHandler (which turns out it also works in JS version of firabase), which emits a message while app is not open (in background), which is usually more important on mobile devices.
Would there be a way to add this subscription?
I was looking through the code but I'm not sure if I could just add another subscriptions on line 12 and then somehow combine them (since message emitted is of same class in both cases), or would we need a completely new channel (according to code copy pasting
function channel()
should be easy to do, but is there a better way?). If anyone can show me how it should be done I'm also willing to get my hands dirty. :)EDIT: After trying to copy
channel()
code I fugured that same approach won't work, sinceonMessage
seems like expecting generator, butsetBackgroundMessageHandler
requires a callback that returns a promise. I guess that's why it doesn't fit into saga world?The text was updated successfully, but these errors were encountered: