-
Notifications
You must be signed in to change notification settings - Fork 382
Consider Offerings cache stale when preferred locales change #5312
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider Offerings cache stale when preferred locales change #5312
Conversation
…-preferred-locales-change
I considered actively refreshing the offerings cache when receiving a different preferred language override here purchases-ios/Sources/Purchasing/Purchases/Purchases.swift Lines 1851 to 1853 in e74be6e
but I thought it would overcomplicate things and I don't really think we want to call get offerings whenever the preferred locale is overriden. WDYT @RevenueCat/coresdk? |
I guess it depends... I would think that's an uncommon enough operation that it would be fine either way. I guess I kinda like the current lazy approach in case a customer changes the languages multiple times, so we only fetch once, when required. So yeah, I think it's fine as is! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a good improvement either way (include locale in "staleness" check), whether we proactively fetch offerings or not.
We should consider Paywalls though. We want the Paywall to be properly localized and to appear immediately, so it might be good to proactively fetch offerings. I'd say that can be a separate PR. Happy to hear thoughts! @RevenueCat/coresdk
@JayShortway this was my thinking. But then I thought of @tonidero's argument for not doing it
and I don't think we should because it could be abused as a workaround to force refreshing the offerings cache. |
@ajpallares Hmm, good point. We could use the same rate limiter we have on |
I didn't know about that rate limiter! It seems like that would certainly solve the potential abuse of the locale API 🤔 |
…-preferred-locales-change
# Conflicts: # RevenueCat.xcodeproj/project.pbxproj # Sources/Misc/Locale/PreferredLocalesProvider.swift # Sources/Misc/SystemInfo.swift # Sources/Purchasing/Purchases/Purchases.swift # Tests/UnitTests/Networking/Backend/__Snapshots__/BackendGetCustomerCenterConfigTests/macOS-testGetCustomerCenterConfigPassesLocalesWithOverride.1.json # Tests/UnitTests/Networking/Backend/__Snapshots__/BackendGetCustomerCenterConfigTests/watchOS-testGetCustomerCenterConfigPassesLocalesWithOverride.1.json
…-preferred-locales-change
…-preferred-locales-change
Similar idea to RevenueCat/purchases-android#2438
Checklist
purchases-android
and hybridsMotivation
Now that we allow for the developer to override the preferred locale, we need to make sure that the caching of Get Offerings considers the locales as well.
Description
Up until now, the offerings cache would only implement time-based staleness. With this PR, the offerings cache will also be considered stale if the preferred locales change.