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

[WIP] HACK Week: Reader detail customization #22851

Merged
merged 31 commits into from Mar 29, 2024

Conversation

dvdchr
Copy link
Contributor

@dvdchr dvdchr commented Mar 18, 2024

Internal refs: zQnohyMpLzBzQ5jzMMKni3-fi-3900_17941, p1710343618122149-slack-C06PGTY5PKK

Warning

Some of the display settings are not fully applied yet, namely:

  • The comments section
  • Related posts
  • Toolbar
  • Navigation bar items

Since the feature is wrapped under a feature flag, I'll plan to address them separately via small-sized PRs.

This covers the proof-of-concept (WIP) of applying custom display settings to the Reader Post screen. The core idea is around the object ReaderDisplaySetting, which encapsulates the preferred color, font, and size.

  • The main part of customization, the post, is relatively easy. We just need to expose the display setting to the ReaderWebView, and allow the colors to be injected to the CSS styles.
  • The tricky/arduous part is actually the view components around the web view; like the header view, the comment table, the related posts section, and the navigation bar. Some of them have hardcoded background colors, so I needed to ensure that they are transparent.
  • Some definitions (such as secondary text color and font size scaling values) were missing, so I defined the values myself for now. Other details were also replaced with something "easier" to get it done faster—for example, I haven't imported the customization icon yet, so I used one from SF Symbols instead. Slider is another example; I used the "stock" Slider appearance for now, as the one from Figma requires custom implementation.

Todo

Edit tasklist title
Beta Give feedback Tasklist Todo, more options

Delete tasklist

Delete tasklist block?
Are you sure? All relationships in this tasklist will be removed.
  1. Add a Done button to the customization sheet.
    Options
  2. Save the updated display setting to user defaults.
    Options
  3. Fix the preview section's height so that it remain fixed as the value changes. Internal ref: p1710941720606209/1710938030.708789-slack-C06PGTY5PKK
    Options
  4. Apply the updated display setting to the Reader detail screen.
    Options
  5. Update the view components to apply foreground color based on the display setting.
    Options
  6. Apply font and size settings to the remaining views.
    Options
  7. Add a feature flag
    Options
  8. Build a custom slider to match the designs.
    Options
  9. Apply proper accessibility labels to the customization sheet.
    Options

To figure out next

  • Consider if the way ReaderDisplaySetting is used and/or passed around is the "right" approach.
  • Consider somehow merging ReaderDisplaySetting to the design system or standard colors.
  • How to make the views react when the display setting is updated? In the current PR, I had to painstakingly update each component so that the colors are injectable.
    • With the display settings integrated to the standard colors, views could automatically use the selected colors.
    • But the problem is, how to make the views react when the selected colors are changed?
  • Figure out some other color components for each scheme, such as secondary text colors, secondary background colors, border colors, etc.
  • Review if the font generation method is correct, considering the customization variables. Ensure that they respect the preferred content size category, etc.

To test

Note that the functionality to save the updated preferences hasn't been added yet. For now, you can test bringing up the customization interface and play around with the selections by:

  • Going to any Reader post
  • Tap the customization icon (next to the "Open in Safari" navigation bar button)

Regression Notes

  1. Potential unintended areas of impact
    Should be none. Feature is hidden behind a feature flag.

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

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

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)

@dangermattic
Copy link
Collaborator

dangermattic commented Mar 18, 2024

1 Warning
⚠️ This PR is larger than 500 lines of changes. Please consider splitting it into smaller PRs for easier and faster reviews.

Generated by 🚫 Danger

@wpmobilebot
Copy link
Contributor

wpmobilebot commented Mar 18, 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 Numberpr22851-5eaac2d
Version24.5
Bundle IDorg.wordpress.alpha
Commit5eaac2d
App Center BuildWPiOS - One-Offs #9316
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 Mar 18, 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 Numberpr22851-5eaac2d
Version24.5
Bundle IDcom.jetpack.alpha
Commit5eaac2d
App Center Buildjetpack-installable-builds #8360
Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.

@dvdchr dvdchr marked this pull request as draft March 19, 2024 15:32
@dvdchr dvdchr self-assigned this Mar 20, 2024
@dvdchr dvdchr force-pushed the hackweek/reader-post-customization branch from 76dcbfe to d684c03 Compare March 25, 2024 15:50
@dvdchr dvdchr force-pushed the hackweek/reader-post-customization branch from d684c03 to 51da0d3 Compare March 27, 2024 12:40
The priority is still given to the `ButtonColor` object that's
passed through the parameter. The `ReaderDisplaySetting` only takes
precedence when there are no `ButtonColor` objects being passed.

The `@State` wrapper is removed from the `color` property since
it seems to be the cause of the button not updating colors after
the display setting is updated.
@dvdchr dvdchr added this to the 24.6 milestone Mar 28, 2024
@dvdchr dvdchr added Part of a WIP Feature This label is used to disable milestone checks for PRs that are not against `develop` or `release`. [Type] Enhancement and removed [Status] DO NOT MERGE labels Mar 28, 2024
@dvdchr dvdchr marked this pull request as ready for review March 28, 2024 20:47
Copy link
Contributor

@wargcm wargcm left a comment

Choose a reason for hiding this comment

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

On an iPhone SE with default font settings, there are some display issues with the customization sheet. It appears too big for the screen:

Portrait Landscape
Simulator Screenshot - iPhone SE (3rd generation) - 2024-03-28 at 17 30 51 Simulator Screenshot - iPhone SE (3rd generation) - 2024-03-28 at 17 31 16

I found some display issues while changing the font size without navigating away from the screen:

resizing.mp4

I'm guessing this may be part of the toolbar work, but figured I'd mention it just in case. I noticed the close (X) button is a bit difficult to see with some configurations.

Light mode + Evening:
Screenshot 2024-03-28 at 6 19 24 PM

Light mode + OLED:
Screenshot 2024-03-28 at 6 23 26 PM


Given that all these are pretty minor and it being a work in progress, I'm good approving it. Overall, nice work! :shipit:

if let contentCache = commentContentCache, contentCache == comment.content {
return webView
if #available(iOS 16.4, *) {
webView.isInspectable = true
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm guessing this was mostly for debugging. Should this be removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm, I was thinking of leaving it in. I notice other web view subclasses/containers also have the isInspectable property enabled, so I think it's fine to ship this into production.

I'll leave it in for this PR, but we can continue to discuss, and I can remove it later during beta if we feel this is unsafe.

Copy link

@osullivanchris osullivanchris left a comment

Choose a reason for hiding this comment

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

testing the build and looking good so far. Approving per request but noting a couple things (that maybe fixed already elsewhere, thats why I'm not blocking this). When I made the text size largest:

  • the layout for the tags broke. Only seemed to happen first time, not the second time.
  • the article got cut off when I went back. Its like it remembered the initial article length in size and then didn't realise the text was now longer
    IMG_6010

IMG_6011

@dvdchr
Copy link
Contributor Author

dvdchr commented Mar 29, 2024

Thanks for the review @wargcm & @osullivanchris!

Since this is still hidden behind a feature flag, I will aim to merge this today and address the remaining issues through smaller PRs so it's manageable for us and so that the PR is not too "different" from when you reviewed it last 😅 I'll open an issue after this to log the issues so that we can keep track of it. 🙂

@dvdchr dvdchr force-pushed the hackweek/reader-post-customization branch from 08e43bd to 12e74be Compare March 29, 2024 16:40
@dvdchr dvdchr force-pushed the hackweek/reader-post-customization branch from 12e74be to b13bc83 Compare March 29, 2024 16:44
@dvdchr dvdchr merged commit f6f8890 into trunk Mar 29, 2024
24 checks passed
@dvdchr dvdchr deleted the hackweek/reader-post-customization branch March 29, 2024 19:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Part of a WIP Feature This label is used to disable milestone checks for PRs that are not against `develop` or `release`. Reader [Type] Enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants