[Firebase] How to use Fire base to update badge numbers

Forge Component
Published on 2018-12-20 by Labs
11 votes
Published on 2018-12-20 by Labs

Hello Mates, 

I'm trying to make a real time new messages count on conversations screen on my chat application, I suppose to use fire base to it. 

We created a block with an event inside, and used the the block with a handler function to get the missing fire base data. 

This is where I use the block with the TestEventsEvent function 

Note: The conversations screen and chat screen are two separate screens, so does the event trigger through 2 separate screens ? 

Any Help will be appreciated :) 

Thanks in Advance
Mohamed AlMokadem

Hi Mohamed.

The FirebaseMissingData event must be handled by each ChatListItem block, but the handler can be the same. Meaning you only need to set the data once for the same screen with multiple instances.

For different screens, you need to have a handler for the FirebaseMissingData event on each screen.

From your screenshots, I'm assuming you are referencing a block that requires the FirebaseProjectId and FirebaseToken inside the ChatListItem.

If that's the case you should set the content of your TestEventsEvent inside the InAppChatFirebaseMissingData client action, which is handling the event triggered by referenced block. 

If you are implementing your own block, you should set the FirebaseProjectId and FirebaseToken variables as input parameters; check if they are provided and trigger the event if not. In this case the TestEventsEvent can remain as the handler for the MissingData event.

Hope this helps.

Rui Mendes