phrase / ios-sdk

Phrase Over the Air iOS SDK
https://phrase.com
Other
14 stars 3 forks source link

Min/Max version constraints behaviour #36

Closed angelolloqui closed 2 years ago

angelolloqui commented 3 years ago

Hi, I am running into something that might be expected behavior but I was expecting something different and I can not see any explicit comment about this in the doc. How is the min/max version range supposed to work?

What I expected

Min/Max to be applied not only on downloading but also in future uses. So, if for example I am in app version 3.1.0, and there is an OTA for [3.0.0 - 3.2.0], then I expect OTA to download and use that file. However, when the user updates the app (without deleting) to 3.3.0, I was expecting the OTA to no longer apply and therefore serve strings from the app bundle rather than the outdated OTA file.

What I see happening

Min/Max is applied on download, so it only gets a new OTA file if the app version matches the range. However, once the OTA is downloaded, it seems to be used every time from now on, even if the app upgraded to a version that is no longer under the OTA range.

What is the problem?

The main issue I see with this behavior is that the translations are no longer consistent. So, if I update strings, users that downloaded some old OTA content are now seeing the old strings even if they have the app updated with newer texts, while new users downloading the app today see something newer (coming from the binary)

Can anyone confirm this is indeed how it works and this is intended and not a bug? and, if intended, is there anything we can do to restrict OTA to the range on runtime? Maybe a way to delete previously downloaded OTAs on app update?

Thanks!

theSoenke commented 3 years ago

Hey @angelolloqui, right now the app version constraint only applies during the initial fetch of the latest translations. After that, the version constraints are not checked on the device. But this is a really good point and we'll investigate adding this check to the SDKs. So right now it is not possible to enforce this constraint as an SDK user. I'll provide an update here as soon as we've figured out how to proceed with it

angelolloqui commented 3 years ago

Suggestion: If you do not want to provide such a thing, at least, provide a "clearCache" method or alike that deletes any previous stored content. This way I could control that myself and call it on each app update. The negative side of it is that then it will always download for all users every time they update, so increased load.

winkelsdorf commented 2 years ago

@angelolloqui I welcome you to test our latest RC which implements min/max behaviour and provides an additional clear method. See: https://github.com/phrase/ios-sdk/releases/tag/4.0.1-rc.1. Glad to get your feedback on this :)

angelolloqui commented 2 years ago

Thanks @winkelsdorf ! I missed your comment but I was entering to check the status because this is raising as a critical in some circustances... do you know when the release will be made final? I will try to give it a try in meanwhile, but we normally never ship beta or rc versions that are not finals.

angelolloqui commented 2 years ago

@winkelsdorf it works like a charm! at least the min/max version part! thanks!

Regarding the other updates, specially the ones with the different language configurations, what are the changes applied? can I safely remove the override I made here?

winkelsdorf commented 2 years ago

@angelolloqui Sorry for the late reply. We are planning to release in a few weeks, still testing all possible combinations to ensure a stable SDK. From what I had tested: yes, as long as your Bundle contains regions they will be respected as well and you can safely remove your override, too.

And thank you again for your valuable feedback and suggestions, you are very welcome, glad to hear that min/max version works for you now :)

winkelsdorf commented 2 years ago

I am pleased to announce that v4.0.1 has just been released. I'm closing this issue for now, if there are any questions let me know - just reopen or create a new ticket.