iteratehq / iterate-android

Iterate Android SDK
MIT License
3 stars 1 forks source link

[Bug] The DISPLAYED event is emitted before the survey is shown to the user #85

Open maciejsurmacz opened 3 months ago

maciejsurmacz commented 3 months ago

This is especially apparent when the network is slow. While testing on an emulator with EDGE/poor signal strength, there are around 3 seconds between the DISPLAYED event being received by the observer and the survey window actually showing (with a loading spinner until the survey content is loaded).

Tested on: API 32 Network type: EDGE Signal strength: Poor Lib version: 1.3.0

msingleton commented 3 months ago

@maciejsurmacz Yea, we tend to opt into the most conservative definition of "displayed" to avoid users seeing surveys more often than they should. Are you using a prompt in this survey? The prompt is much faster to show, but I see the argument to move the display event to be when the survey view has fully displayed if there is no prompt

maciejsurmacz commented 3 months ago

@msingleton we are not using a prompt for the survey right now.

The use case is the following: 1) user presses Show survey button, 2) we show a loading indicator in the app UI since the operation is async, 3) we want to hide the loading indicator once the survey is shown.

So far, what I found works for our use case is hiding the loading state when DISMISS event is fired. This works just fine right now but I think the DISPLAY event can be a bit misleading (based on the name I was expecting it to be fired when the survey view is shown) and using the DISMISS event for this feels to me a bit like a workaround.

msingleton commented 3 months ago

Ah yea, alright that's helpful context -- agreed that feels like a workaround and not a proper solution