Commit Graph
5 Commits
Author SHA1 Message Date
Rick d3b845c8e5 Fix cache files visible in documents directory: Etags, offerings and product entitlements mapping (#6020)
* Renamed applicationSupport directory type to persistence

* Only deleting the old diagnostics file when the new diagnostics file does not exist yet

* Implemented PR feedback

* Changed testing-only check from assertion to #if DEBUG

* Implemented migration + deleting LargeItemCache files from the Documents directory for Etags + DeviceCache caching

* Fixed compile issue after rebase

* Fixed test compilation after rebase

* Updated test

* Refactored logica to the specific classes that actually store the data, removing the logic from the large item cache

* Fix compilation issue

* Moved comment

* Implemented PR feedback

* Implemented most PR feedback

* Implemented PR feedback

* Simplified ETagManager's old Documents directory removal by just doing it on init if needed

* Simplified old documents directory removal in EtagManager

* Also deleting old files from documents if we're clearing caches

* Fixed swiftlint warning

* Simplified directory cleanup between tests

* Updated FileRepository to keep using the existing directory in order to avoid duplicate cache files or having to migrate them right now

* Fixed tests not compiling

* Added additional test assertions that check whether new cache directory was created

* Add locking to DeviceCache migration logic to be safe

* Handle multiple concurrent reads across threads only actually migrating the data once

* PR feedback tweak
2026-01-22 17:17:50 +01:00
Jacob RakidzichandAntonio Pallares f033ddc398 Fix Crashes: Move large object cacheing off of user defaults to file storage (#5652)
* move device cache to file cache for potentially large data sets

* Fix vibe coded implementation and test it

* Update device cache tests

* bring back some of the old functionality

* revert accidental deletion

* use the static variable

* be kind and clean up after your(my)self.

* Move from caches to docs dir

* simplify cache by returning the decoded object

* remove update function and scope read and write to internal functions

* Potential fix for CI issues?

* fix tests

* Update Sources/Caching/DeviceCache.swift

Co-authored-by: Antonio Pallares <ajpallares@users.noreply.github.com>

* Update Sources/Caching/DeviceCache.swift

Co-authored-by: Antonio Pallares <ajpallares@users.noreply.github.com>

* scope adjustment

* requested changes

* fix test

---------

Co-authored-by: Antonio Pallares <ajpallares@users.noreply.github.com>
2025-11-18 10:02:28 -06:00
Jacob Rakidzich 04bc10266b Finalize video component to include a checksum, dark mode support, and optimize memory usage for large file downloads (#5631)
* Checksum and tests

* add checksum to video component models

* Update cache warming

* put the checksum in the right spot and update the view model

* File repo updates

* add missing assertion

* revert accidental trailiing comma

* Checksum from file

* Ensure cache invalidates when the checksum changes

* Use checksum as filename if available

* greedily fill space while loading occurs

* update remote image usage of the repository

* Reduce memory footprint of large file downloads by streaming the download to a temp file

* Update keyed deferred value storage key to include checksum

* remove unused argument

* remove wip comment

* Get tests to compile

* Write tests for the large item cache type

* remove test from the file repository suite

* trailing commas

* remove cache warming of videos

* remove un-needed change causing existential types

* delete the temporary file after success or failure of the code block

* log with the checksums

* optimize checksum generation to occur at the same time as the temp file storage

* starting to work on border gradients,

* Revert "starting to work on border gradients,"

This reverts commit 429e6d2fab.

* clarity regarding dark mode urls
2025-10-14 08:05:01 -05:00
Jacob Rakidzich 6c8140e058 Fix the tests and implicit returns that broke our CI on main (#5493)
* explicit returns

* wrap prefetch in high priority task to ensure yield picks things up.

* more explicit returns

* explicit self in closure
2025-08-21 22:05:35 -05:00
Jacob Rakidzich f730d9df52 Create File Repository for use in upcoming feature work (#5477)
* Pull files from staging branch to introduce a file repository and intelligent task sharing

* removed typed throws and fix some docs

* Make tests satisfy predictive swift 6 failures

* @_spi(Internal) public

* Stop using the shared instance in an instance method

* Pull cache directory logic out of file repository

* update cache naming conventions

* @fire-at-will feedback -> use url instead of path

* Use strings file pattern

* remove priority from repository

* Remove RC Internal access from keyed deferred value store

* Remove spi internal from cache and network service

* makeSUT -> makeSystemUnderTest

* remove public scope in extensions

* rename function for clarity
2025-08-21 05:41:52 -05:00