Skip to content
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

Refactor: Add WordPressMedia #23890

Merged
merged 3 commits into from
Dec 18, 2024
Merged

Refactor: Add WordPressMedia #23890

merged 3 commits into from
Dec 18, 2024

Conversation

kean
Copy link
Contributor

@kean kean commented Dec 12, 2024

This PR enables a bit of modularization by extracting some obvious stuff: ImageDownloader. The framework name is WordPressMedia because the idea is to put everything media-related there, including exporters in the future.

The main advantage of this change is that you can now compile and run tests for this new target nearly instantly, so it will encourage us to add more tests and make it easier to maintain existing ones.

Changes:

  • Add WordPressMedia target
  • Move ImageDownloader and the types it depend on to the new target
  • Update ImageDownloader tests to use the new Swift Testing framework
  • Add WordPressTesting target to share test code and resources across test targets

Regression Notes

  1. Potential unintended areas of impact

  2. What I did to test those areas of impact (or what existing automated tests I relied on)

  3. What automated tests I added (or what prevented me from doing so)

PR submission checklist:

  • I have completed the Regression Notes.
  • I have considered adding unit tests for my changes.
  • I have considered adding accessibility improvements for my changes.
  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

Testing checklist:

  • WordPress.com sites and self-hosted Jetpack sites.
  • Portrait and landscape orientations.
  • Light and dark modes.
  • Fonts: Larger, smaller and bold text.
  • High contrast.
  • VoiceOver.
  • Languages with large words or with letters/accents not frequently used in English.
  • Right-to-left languages. (Even if translation isn’t complete, formatting should still respect the right-to-left layout)
  • iPhone and iPad.
  • Multi-tasking: Split view and Slide over. (iPad)

@kean kean added the Media label Dec 12, 2024
@dangermattic
Copy link
Collaborator

dangermattic commented Dec 12, 2024

4 Warnings
⚠️ Modules/Package.swift was changed without updating its corresponding Package.resolved. Please resolve the Swift packages as appropriate to your project setup (e.g. in Xcode or by running swift package resolve).
⚠️ View files have been modified, but no screenshot or video is included in the pull request. Consider adding some for clarity.
⚠️ This PR is larger than 500 lines of changes. Please consider splitting it into smaller PRs for easier and faster reviews.
⚠️ PR is not assigned to a milestone.

Generated by 🚫 Danger

@kean kean requested a review from crazytonyli December 12, 2024 20:22
@wpmobilebot
Copy link
Contributor

wpmobilebot commented Dec 12, 2024

WordPress Alpha📲 You can test the changes from this Pull Request in WordPress Alpha by scanning the QR code below to install the corresponding build.
App NameWordPress Alpha WordPress Alpha
ConfigurationRelease-Alpha
Build Numberpr23890-9ee042e
Version25.6
Bundle IDorg.wordpress.alpha
Commit9ee042e
App Center BuildWPiOS - One-Offs #11200
Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.

@wpmobilebot
Copy link
Contributor

wpmobilebot commented Dec 12, 2024

Jetpack Alpha📲 You can test the changes from this Pull Request in Jetpack Alpha by scanning the QR code below to install the corresponding build.
App NameJetpack Alpha Jetpack Alpha
ConfigurationRelease-Alpha
Build Numberpr23890-9ee042e
Version25.6
Bundle IDcom.jetpack.alpha
Commit9ee042e
App Center Buildjetpack-installable-builds #10238
Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.

@crazytonyli
Copy link
Contributor

Do you think it's worthwhile enabling strict concurrency checks on the new targets? If so, we can wait for #23838 to be merged.

import Foundation

extension Bundle {
public static var test: Bundle { Bundle.module }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test seems too generic. What do you think of naming it wordPressTesting?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't rename it, so I'd suggest sticking with this name for now. I think it's OK because you are only ever going to import it in a subset of files in tests targets. It doesn't affect anything else.

Screenshot 2024-12-12 at 6 03 13 PM

@kean
Copy link
Contributor Author

kean commented Dec 12, 2024

Do you think it's worthwhile enabling strict concurrency checks on the new targets?

Sure. New modules like this should start with Swift 6 enabled. I approved the PR you referenced.

@crazytonyli
Copy link
Contributor

Thanks! The PR has been merged.

@kean kean force-pushed the task/add-wordpress-media branch from 8dccafd to ea24202 Compare December 13, 2024 22:06
@kean
Copy link
Contributor Author

kean commented Dec 13, 2024

I rebased it (with no changes) and added Swift 6 support in ea24202. The changes should be pretty straightforward. I added @ImageDownloaderActor to synchronize more types on it in the future (prefetcher). ImageDownloader (Closures) are no longer in the module.

@kean kean requested a review from crazytonyli December 13, 2024 22:07
@kean
Copy link
Contributor Author

kean commented Dec 17, 2024

I'm going to merge this later after 24.6 is properly cut-off.

@kean kean added this pull request to the merge queue Dec 17, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Dec 17, 2024
@kean kean force-pushed the task/add-wordpress-media branch from ea24202 to 9ee042e Compare December 18, 2024 00:46
@kean kean enabled auto-merge December 18, 2024 00:47
@kean kean added this pull request to the merge queue Dec 18, 2024
Merged via the queue into trunk with commit 3937a09 Dec 18, 2024
25 checks passed
@kean kean deleted the task/add-wordpress-media branch December 18, 2024 01:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants