Open buschtoens opened 3 years ago
Hi @buschtoens
Sorry for a bit delayed response. It's a nice idea, but in current state of things not really achievable because our callback definition mechanism "ties you" to define them in place where you perform configuration object creation and SDK initialisation (in your example from above, the native world). But this might be interesting feature to add. What we might do (this is actually what we are doing for all getters for next major SDK release) is to add asynchronous getter to Adjust interface which you can use to get (in this case) deferred deep link and that SDK triggers it as soon as it gets in possession of deferred deep link. Upcoming 5.0.0 release will have this for sure, but we will also check how feasible this might be in current 4.x.x version. Will keep you posted.
Btw, +1 from my end on idea on how to "speed up" deferred deep link obtaining in your Cordova/Capacitor layer. It's pretty cool idea, but just huge majority of people is unwilling to take down this road and mess with native code at all.
Cheers
Thanks for getting back to me!
We experimented with initializing the config early from the native side and registering fake listeners for all the COMMAND_SET_*_CALLBACK
events, that buffer all calls and replay them, once the real JS bridge registers listeners. We haven't tested it yet, but if it does work out, I can submit a PR, so that you can toy around with the concept.
Absolutely. PRs are always more than welcomed and if you end up with something which solves the issue, feel free to submit it and we're gonna check it out and if all works well, add to one of next releases.
@uerceg Great! I've submitted a preliminary draft PR #124 that is largely just a carbon-copy from our local patches to cordova_sdk
, but should work and also should explain the concept well enough.
If Adjust lies on a time-critical path, as could be the case for e.g. the deferred deep link callback, it would be desirable to initialize the SDK as early as possible, to minimize the time to wait until the callback resolves.
I'd love, if there were convenient way to initialize the SDK from the native code, before the Cordova / Capacitor WebView even starts loading, and then still allow the WebView to register callback listeners.