Sorry for the long post, but I feel the background for the issue is important and may be relevant to others having similiar situations.
We have been experiencing the error:"Invalid call of the 'TriggerOnLoadComplete' client action of the 'Common.Splash' since the latter is not currently active. This is likely due to a platform's client action being used as an event handler or in a setTimeout function. Consider removing this call by using the 'On Destroy' event of the screen/block or moving your logic to a global client action. "
I found that this is caused by the OutSystemsUI ApplicationLoadEvents block having a MinimumDisplayTimeMs that is too high (1500ms). I have confirmed that reducing this value to below 1000 ms prevents the error.
Our situation is a bit more specific, though.
When opening the app normally, it enters the Splash screen, loads the app, and everything works as expected.
However, when opening the app from a notification, it seems to move through the Splash screen faster. As a result, the app finishes loading before the configured 1500 ms minimum display time has elapsed. The Splash screen is then destroyed, but ApplicationLoadEvents still tries to trigger TriggerOnLoadComplete, resulting in the error above.
What we actually want is:
When the app is opened normally, keep the normal Splash screen duration.
When the app is opened from a notification, allow it to proceed faster and avoid waiting for the minimum display time.
Is there a way, for example in OnApplicationReady, to determine whether the app was opened as a result of a notification?
If so, we could use a global boolean (or similar) to adjust the minimum display time depending on how the app was launched.
Has anyone implemented something similar, or is there a recommended way in OutSystems to handle this?
There's a documented OnNotificationOpened client action in the OneSignal plugin that fires when the user taps the notification. You could set a global/session boolean there and check it wherever you configure the Splash's MinimumDisplayTimeMs.
I haven't verified the exact firing order relative to OnApplicationReady in a cold-start-from-notification scenario though, so it's worth testing that sequencing on your end before relying on it.
You are completely right in that being the tool that we should be using. It gives the proper response and should be able to use that for a global value. I am experiencing some timing problems still, but I expect to fix it. Thanks!