Hello,
Is there a way to have a global “displayed page change” event?
I would like to send an event to Firebase Analytic every time the user change the page in front of him (whether he has navigated from a page to another, from a routable tab to another, or displayed a routable popup).
I have an app with 3 tabs, a left panel, 3 popups ready to fire, so 7 views at start.
And I have a “routes” file which describe all the routes of my app.
Ideally, I would like to subscribe to a “displayedPageChange” event at the app level which triggers every time the user does an action changing the page in front of him.
Of course, I could build my own stuff, listening to pageChange / popupOpen / popupClose / panelOpen / panelClose / tabChange events at app level, but it is definitely not trivial.
You have to ignore the initial “pageChange” of the non visible views. And when a popup opens, you have to save the previous page so you can send back the event when the popupClose, etc.
And in more complex cases, you could have popup A that opens, then popup B that opens, then an action that close popup A in an invisible way. If we use a dumb “LIFO” management, the popupClose event of popup A would trigger removing the popup B from the “history” pile, which would induce that the currently visible page is popup A and not popup B…
So before starting the creation of this complex stuff, I would like to confirm that there is nothing that already does the trick !
Thanks!
PS: if nothing exists, would it be a welcome PR if I can make it happen?