Eventhandler inconsistently called
O
Olly Rennard
I'm using react native and have successfully integrated Adapty, however I'm finding my event handler is inconsistently called. I make a purchase and sometimes it does fire and other times it doesn't, so my payment state ends up being out of date. When I call getProfile it returns the correct information, however this isn't a sustainable solution as my architecture currently relies on the idea of a correctly functioning event handler and propagating this state via a context provider. This is stopping me from launching as it's a terrible user experience and currently breaks my app.
For context, I only activate Adapty once and I only add a single event handler
O
Olly Rennard
Follow up - when I navigate to my phone's settings to unsubscribe, can I expect the handler to fire when the app receives focus or is this another potential edge case where I miss the profile update?
V
Vlad Guriev, Adapty
Olly Rennard when you get back to the app, Adapty tries to refetch the profile so generally you should receive the updated state
Could you please specify which 'event handler' you mean, and provide the code snippet where it's inconsistently called?
O
Olly Rennard
Vlad Guriev, Adapty
Thanks for getting back to me. Right now I'm having to force a refetch on app focus. Adapty's automatic refetch did appear to be working on and off but now doesn't seem to work at all.
The event handler is the 'onLatestProfileLoad' listener. It seemed to work most of the time but sometimes just doesn't fire at all.
Code here: https://gist.github.com/rennard/8b38d7e3ff23207b872b1d223552c694
V
Vlad Guriev, Adapty
Olly Rennard thank you! Could you please send us the logs (including those from the native layer) to support@adapty.io
O
Olly Rennard
Vlad Guriev, Adapty So I can't consistently get this behaviour unfortunately. I uninstalled the app yesterday and re-installed (classic) and it started working again, but there are definitely situations where it doesn't, it just seems to be sporadic. I've since just added explicit getProfile calls on screen refocus which is good enough for now.