crowdin/mobile-sdk-ios

Caching does not work when the network is down

chrispomeroyhale opened this issue · 2 comments

Describe the bug
When I start the SDK to download translations for a non-source language and the .strings files fail, it falls back to the cached values. But if I start the SDK and the manifest.json network request fails it falls back to the bundled translations. This is inconsistent and suggests caching is not working. If the Crowdin CDN is down in any way, it shouldn't matter which request fails, and the result for the end-user should be the same.

To Reproduce

  1. Set the region/language settings to a non-source language. e.g. If en is the source language, set to fr-CA.
  2. Do a fresh install of the app. App should be already integrated with the SDK.
  3. Start the app, letting it complete calls to establish a cache.
  4. Kill the app.
  5. Configure a proxy tool like Charles Proxy to block the calls to manifest.json from succeeding
  6. Re-launch the app and ensure calls get blocked.
  7. In the app, navigate to UI that retrieves the latest translation for some text. That text should use the cache values retrieved previously.

Repeat this process, but block against the .strings files instead.

Note: I observed this on regions that are not the source language. I did not look into why this worked as expected for en.

Expected behavior
Starting SDK should get back any previously cached translations rather than falling back to the bundled translations.

As soon as the SDK begins retrieving of translations, I expect to still get back previously cached translations until new translations are downloaded. Ideally, client apps should have control over whether they want to wait until all translations are downloaded. Only when the cache is expired and is in progress or fails would I expected to receive the translations bundled into the app.

Screenshots
Please contact me for screenshots or videos. The support team should have my contact info.

Smartphone (please complete the following information):

  • Device: iPhone SE
  • OS: iOS 15.4

@chrispomeroyhale Hi, can you please try with the current master branch. this problem should be fixed.