-
Notifications
You must be signed in to change notification settings - Fork 2
feat(cdn): adding in cdn caching #41
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
base: main
Are you sure you want to change the base?
Conversation
|
This is great @bassrock! We'll get this reviewed Edit: and thanks for the contribution + early feedback |
ios/ReferencedAssetLoader.swift
Outdated
| } | ||
| } | ||
|
|
||
| func dispose() { |
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.
Where is this dispose is called from?!
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.
hmm actually looks like it never is. Guess its a bug
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.
FWIW we've ended up merging a slightly different fix for the iOS crash. #45
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.
@mfazekas I was also seeing a similar issue on Android
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 removed the disposal on android and ios, and rebased on main
f68cf0c to
e52a135
Compare
b628586 to
42c36a9
Compare
42c36a9 to
c513f3d
Compare
|
@mfazekas I have made updates since the view stuff was fixed elsewhere. This now fixes just referenced assets and adds in a Cache layer |
756b341 to
3b94ed6
Compare
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.
can this file be removed?
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.
@HayesGordon my understanding is this is an artifact of the Kotlin compiler process
Description
This PR adds URL-based asset caching to the
ReferencedAssetLoaderon both Android and iOS platforms. The implementation introduces a dedicatedURLAssetCachemodule that caches downloaded HTTP/HTTPS assets to disk, improving performance by avoiding redundant network requests for the same assets.Changes Made
URL Asset Caching
URLAssetCacheModule: Created a dedicated caching system for URL-based assets on both platformsAndroid (
URLAssetCache.kt):cacheDir/rive_url_assets/getCachedData(),saveToCache(), andclearCache()methodsiOS (
URLAssetCache.swift):cachesDirectory/rive_url_assets/ReferencedAssetLoader Updates
Cache Integration: Both Android and iOS loaders now check the cache before downloading HTTP/HTTPS assets
Asset Cache Management in
createCustomLoader:uniqueNameandnamekeys)referencedAssetslater in the file lifecycle. Since assets are cached immediately, new referenced assets can be provided and will properly associate with existing file assets throughout the file's lifecycle.Additional Changes
Unitinstead of empty mapAdditional Information
Technical Details
Cache Key Generation:
Cache Storage:
Cache Strategy:
Asset Cache Management: The
createCustomLoaderfunction now immediately caches all assets (both byuniqueFilename/uniqueNameandname) when they are first encountered, regardless of whether they've been loaded yet. This ensures:Breaking Changes
None - this is a backward-compatible enhancement. Existing functionality remains unchanged, with caching added as an optimization layer.