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.32k stars 315 forks source link

RemoteImage Low Res Image support #3906

Closed jamesrb1 closed 4 months ago

jamesrb1 commented 4 months ago

RemoteImage now uses two images: a high res image (as before), and a new low res image which will be used if it is available before the high res image has been loaded.

To enable this, it now uses two ImageLoader instances, one for to fetch the low res image, a second for high res image.

It assumes that the low res image url is the same as the high res image url, with a suffix appended (default _low_res) to the file name, eg /images/myImage.jpg is assumed to have a low res equivalent at /images/myImage_low_res.jpg.

It requests the high and low res images concurrently, and displays an error when both requests fail. A low res image will never replace a high res image even if it is received last.

Here is a video of it loading a "low res" image, following by high res image. For this video the low-res image was intentionally set to a completely different image to make the change easy to see. If you move the slider manually you can control the speed.

https://github.com/RevenueCat/purchases-ios/assets/109382862/97521803-5c12-43d0-92a8-596b23cdcff6

RevenueCat-Danger-Bot commented 4 months ago
1 Message
:book: Size increase: 5.74 KB

Generated by :no_entry_sign: Danger

aboedo commented 4 months ago

why is the linter so angry? it's pointing at stuff that isn't changed in this PR

jamesrb1 commented 4 months ago

I've opened a new draft PR here: https://github.com/RevenueCat/purchases-ios/pull/3937