RevenueCat / purchases-ios

In-app purchases and subscriptions made easy. Support for iOS, watchOS, tvOS, macOS, and visionOS.
https://www.revenuecat.com/
MIT License
2.26k stars 303 forks source link

fix mac os sandbox check slowness #3875

Closed aboedo closed 3 days ago

aboedo commented 3 months ago

Addresses #3871

Solves the issue by ensuring that the calls to isSandbox are performed on a worker thread, and that we're pre-loading the values.

I'm not a huge fan of this solution since it isn't technically perfectly safe, meaning that it's possible (albeit very unlikely) for us to still check sandbox values in the main thread.

Additionally I don't love how hard it is to actually write tests for it.

The ideal solutions would be:

aboedo commented 3 months ago

tagging @MarkVillacampa here too since he's worked on these checks quite a bit

RevenueCat-Danger-Bot commented 3 months ago
1 Message
:book: Size increase: 1.67 KB

Generated by :no_entry_sign: Danger

aboedo commented 3 months ago

Note: this was only an issue in production, because of this check which would early-return true in sandbox

aboedo commented 3 months ago

@tonidero yeah I definitely still don't love this solution. Maybe it makes sense to limit its effects to macOS for the sake of minimizing impact... Or to give the asynchronous isSandbox approach another try, even though that one feels a lot more impactful in terms of the changes

aboedo commented 3 days ago

closing in favor of https://github.com/RevenueCat/purchases-ios/pull/3875