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: Remove ImageLoader usages from Blaze #23891

Merged
merged 2 commits into from
Dec 13, 2024

Conversation

kean
Copy link
Contributor

@kean kean commented Dec 12, 2024

This brings us one step closer to removing AlamofireImage and consolidating all the image management code in ImageDownloader and AsyncImageView.

My initial idea was to update the existing (deprecated) ImageLoader to use ImageDownloader, but after a quick search, I realized that there were only seven remaining places where it was used. So, I decided to remove ImageLoader usages instead.

Changes:

  • Update Blaze cells to use AsyncImageView
  • Fix an issue with Blaze campaigns in the Blaze screen being displayed with a gray background (not sure why it was there in the first place, clearly an issue)

Before / After

Screenshot 2024-12-12 at 4 13 04 PM Screenshot 2024-12-12 at 4 25 04 PM

To test:

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
@kean kean requested a review from crazytonyli December 12, 2024 21:31
@dangermattic
Copy link
Collaborator

1 Warning
⚠️ PR is not assigned to a milestone.

Generated by 🚫 Danger

@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 Numberpr23891-73f82b3
Version25.5
Bundle IDorg.wordpress.alpha
Commit73f82b3
App Center BuildWPiOS - One-Offs #11170
Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.

@@ -28,7 +28,7 @@ final class ImageRequest {
}

struct ImageRequestOptions {
/// Resize the thumbnail to the given size. By default, `nil`.
/// Resize the thumbnail to the given size (in pixels). By default, `nil`.
var size: CGSize?
Copy link
Contributor

Choose a reason for hiding this comment

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

I feel like I have commented about this before... I apologize if you have already answered this question... 😅

I think it's good to express "the given size (in pixels)" in code. Like sizeInPixel: CGSize, or creating a struct PixelSize { pixelWidth, pixelHeight } type.

It's easy to miss documentation, but it's very hard to miss if you have to write "pixel" in code.

Copy link
Contributor Author

@kean kean Dec 12, 2024

Choose a reason for hiding this comment

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

Yes. I already attempted it once by adding an ImageSize struct, but then realized the name was already taken – ugh! I added a note to try it again later 😄

PixelSize sounds. I can introduce it in a separate PR. It could also have a convenience initializer that takes points and multiplies by the display scale.

@kean kean force-pushed the task/remove-image-loader-usages branch from 5bc3c60 to 499c6e6 Compare December 13, 2024 12:22
@kean kean enabled auto-merge December 13, 2024 12:23
@kean kean force-pushed the task/remove-image-loader-usages branch from 499c6e6 to 73f82b3 Compare December 13, 2024 12:30
@wpmobilebot
Copy link
Contributor

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 Numberpr23891-73f82b3
Version25.5
Bundle IDcom.jetpack.alpha
Commit73f82b3
App Center Buildjetpack-installable-builds #10208
Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.

@kean kean added this pull request to the merge queue Dec 13, 2024
Merged via the queue into trunk with commit c387e2f Dec 13, 2024
25 checks passed
@kean kean deleted the task/remove-image-loader-usages branch December 13, 2024 13:24
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