-
Notifications
You must be signed in to change notification settings - Fork 3
Add Android Preload List #260
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: trunk
Are you sure you want to change the base?
Conversation
| val viewModel = ViewModelProvider( | ||
| this, | ||
| SitePreparationViewModelFactory(application, configurationItem) | ||
| )[SitePreparationViewModel::class.java] |
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.
⛏️Aren't we using injection in the example project? ViewModels can be simply injected.
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 don't think we are at the moment – I'd be happy to adopt it, but I think it's outside the scope of this PR :)
android/Gutenberg/src/main/java/org/wordpress/gutenberg/model/EditorDependenciesSerializer.kt
Outdated
Show resolved
Hide resolved
android/Gutenberg/src/main/java/org/wordpress/gutenberg/model/EditorSettings.kt
Outdated
Show resolved
Hide resolved
android/Gutenberg/src/main/java/org/wordpress/gutenberg/stores/EditorAssetsLibrary.kt
Outdated
Show resolved
Hide resolved
| responseHeaders = EditorHTTPHeaders(entry.headers) | ||
| ) | ||
| } catch (e: Exception) { | ||
| null |
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.
Do we want to track the exception here?
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.
In this case probably not, because we'll treat a cache failure as a simple cache miss. I've modified this to use runCatching in c64592b, which should hopefully make the intent more clear!
android/Gutenberg/src/main/java/org/wordpress/gutenberg/GutenbergView.kt
Outdated
Show resolved
Hide resolved
209696f to
f59acb1
Compare
f59acb1 to
c82027d
Compare
0e760f1 to
8060669
Compare
86161e3 to
0d0ce7f
Compare
Full warning: > Redundant creation of Json format. Creating instances for each usage can be slow.
bd9046e to
84042ab
Compare
What?
Adds an Android preloading system for the Gutenberg editor that prefetches editor dependencies before display, matching the existing iOS implementation.
Why?
The Gutenberg editor requires several API calls and asset downloads during initialization, which can cause slow launch times. This PR introduces a preloading architecture that:
How?
New Core Components:
EditorService- Orchestrates loading all editor dependencies with progress trackingEditorPreloadList- Pre-fetched API responses injected into the editor JavaScriptEditorAssetsLibrary(in stores/) - Downloads and caches asset bundlesEditorHTTPClient- Authenticated HTTP client for WordPress REST APIRESTAPIRepository- REST API calls with response cachingEditorURLCache- URL-level caching with configurable policiesNew Model Classes:
EditorAssetBundle- Represents downloaded editor assetsEditorCachePolicy- Configurable caching strategies (Always, MaxAge, Ignore)EditorSettings,EditorDependencies- Editor configuration modelsGBKitGlobal,LocalEditorAssetManifest,RemoteEditorAssetManifest- Asset manifest parsingDemo App Updates:
SitePreparationActivityandSitePreparationViewModelshowing the preloading flow with progress UIOther Changes:
EditorSettingsimprovements for consistencyandroidx.webkitexposesprerenderUrlAsyncwhich we should adopt for this purpose.Testing Instructions
make test-androidto verify all new unit tests passSee the tests in #250 for examples of tests sites you can use.