wordpress-mobile / wordpress-mobile/GutenbergKit
Split the media-handler files into one type per file
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 29
- Forks
- 6
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 41
Description
Follow-up from #621. The media files each hold several types, so the "server" files are doing far too much:
ios/.../Media/MediaUploadServer.swift— ~795 lines: the server plus the ~275-lineInternalMediaClient,UploadError, andUploadContext.android/.../gutenberg/MediaUploadServer.kt— ~758 lines: the response model, both protocols, both value types, the server, the exception, and the client.
Proposed split
One concern per file, kept in the same module/package — so no import-path or public-API change, purely organization:
| File | Holds |
|---|---|
MediaProcessor.{swift,kt} |
MediaProcessor (+ the iOS default-impl extension) & its result type ProcessedProxyFile |
MediaUploader.{swift,kt} |
MediaUploader & its input type MediaUpload |
MediaUploadResponse.{swift,kt} |
MediaUploadResponse (the shared internal relay model) |
InternalMediaClient.{swift,kt} |
InternalMediaClient (the concrete configured-site REST client) |
MediaUploadServer.{swift,kt} |
the server + its privates (UploadContext; UploadError / MediaUploadException) |
iOS's MediaHandlers.swift dissolves into the first three.
Grouping rationale: each value type sits with the protocol it serves (ProcessedProxyFile → processor, MediaUpload → uploader); MediaUploadResponse gets a neutral home since the client and the server both use it; server-privates stay with the server.
Notes
- Mechanical and low-risk — no logic changes, stays within the existing module/package, so hosts see no API change. Builds + the existing media test suites are the check.
- Keep the media types in the
org.wordpress.gutenbergpackage on Android; amediasubpackage would be a public-API break for hosts.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with ios/.../Media/MediaUploadServer.swift, ios/.../Media/MediaHandlers.swift, and android/.../gutenberg/MediaUploadServer.kt to identify each listed type and its module or package. Review the existing media test suites before moving declarations. Done means one concern per proposed file, Android types remain in org.wordpress.gutenberg, and builds and media tests still pass without API or logic changes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- kotlin, swift
- Domain
- mobile-dev
- Issue type
- Refactor
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 72/100