crowdin/mobile-sdk-ios

Starting the SDK blocks the app from loading until the manifest downloads

chrispomeroyhale opened this issue · 1 comments

Describe the bug
It appears that calling startWithConfig is synchronous which prevents client apps from continuing to load while the SDK loads. This is potentially important to us because it impacts app start time which is a key metric for us.

Our team is a little confused because it has an @escaping completion handler. And because while downloading the manifest.json blocks, downloading the subsequent Crowdin files happens asynchronously.

I don't know the code base well enough to make a contribution. Any guidance or advice would be helpful!

To Reproduce
Steps to reproduce the behavior:

  1. Install the Crowdin SDK on an app
  2. Set the completion handler of startWithConfig to print "completed"
  3. Immediately after the call to startWithConfig print "starting"

Expected behavior
Console prints "starting" then "completed".

Two possible expectations:

  1. SDK performs startWithConfig asynchronously.
  2. startWithConfig could block until downloading critical files. Perhaps remove the completion closure and document it as a synchronous method? Then clients could decide whether they want to call startWithConfig asynchronously.

Actual behavior
Console prints "completed" then "started". Using a proxy tool to prevent a response for "manifest.json" prevents "started" from being printed until a response is returned.

Smartphone:

  • Device: iPhone XS simulator
  • OS: 14.5

Additional context
Over roughly 15 trials we observed initializing the SDK added about 0.6 seconds to our app startup time.

Hi there,
Thanks for reporting the bug!
We'll check with the team and come back with the update