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

Reader: Add announcement card #23197

Merged
merged 13 commits into from
May 14, 2024
Merged

Reader: Add announcement card #23197

merged 13 commits into from
May 14, 2024

Conversation

dvdchr
Copy link
Contributor

@dvdchr dvdchr commented May 13, 2024

Part of #23069

Adds the announcement card to the Reader stream. The card is only shown when:

  • There's no other header being displayed. The announcement card should have the lowest display priority.
  • There are no active filters.
  • There are contents to display. It shouldn't be displayed when the no results or error view is displayed.
  • The announcement card hasn't been dismissed yet.
  • Lastly, of course, the remote feature flag reader_announcement_card needs to be enabled.

Preview:

Light Dark
Simulator Screenshot - iPhone 15 - 2024-05-14 at 02 25 27 Simulator Screenshot - iPhone 15 - 2024-05-14 at 02 20 20

To test

Tip

To avoid dismissing the card and never seeing it again, you could temporarily disable the dismiss logic by commenting out the line in ReaderStreamViewController+Helper.swift:L179:

    self?.readerAnnouncementCoordinator.isDismissed = false

This way, the announcement card will reappear on the next stream after you dismiss it.

  • Make sure the readerAnnouncementCard flag is enabled.
  • Launch the Jetpack app.
  • Go to the Reader tab.
  • 🔎 Verify that the announcement card is displayed in the Discover stream.
  • Navigate to other (non-empty) streams.
  • 🔎 Verify that the announcement card is visible.
  • Navigate to an empty stream.
  • 🔎 Verify that the announcement card is NOT visible.
  • Go to Subscriptions or Your Tags and filter the stream.
  • 🔎 Verify that the announcement card is NOT visible.

Offline case

  • Turn on airplane mode and relaunch the Jetpack app.
  • Go to the Reader stream > Discover.
  • 🔎 Verify that the announcement card is NOT visible.

Spam test

Context

During development, I stumbled on some crashes while switching to Discover, and it crashed with this message:

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'unable to dequeue a cell with identifier ReaderSitesCell - must register a nib or a class for the identifier or connect a prototype cell in a storyboard'

let cell = tableView.dequeueReusableCell(withIdentifier: readerCardSitesIdentifier) as! ReaderSitesCardCell

However, after a while, it seems like the crash stopped happening... I'm guessing it may be related to this commit: 45d58e4 since the refresh method calls layoutIfNeeded on the table view, and perhaps there might be a retain cycle somewhere.

  • Ensure that the connectivity is enabled.
  • Go to the Reader stream > Discover.
  • Quickly switch to different streams.
    • Note: you could also try activating the Network Link Conditioner to switch streams while the request is in progress.
  • 🔎 Ensure that the app does not crash.

Regression Notes

  1. Potential unintended areas of impact
    Should be none. The card is hidden behind a 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)

dvdchr added 11 commits May 11, 2024 14:07
I've noticed that `configureStreamHeader()` had too many layout
constraints juggling, so this simplifies it a bit.

* `ReaderSiteHeaderView` now inherits from `UITableViewHeaderFooterView`,
  so that it has the same readableContentGuide of table views. This
  removes the need to put the SwiftUI view in a container view and
  align the horizontal anchors  manually to the table view.
* Moved the border-adding logic to each own views.
This is a workaround that avoids unsatisfiable constraint warnings
in the console. By reducing the constraint priority to 999, this
allows the the layout engine to prioritize the constraints from
`UIView-Encapsulated-Layout-Width` (or height).
The `configureStreamHeader()` method is currently only called when
the `readerTopic` is not nil. This needs to be modified because
there are streams without a topic (Saved, Tags).
@dvdchr dvdchr added this to the 25.0 milestone May 13, 2024
@dvdchr dvdchr requested a review from wargcm May 13, 2024 19:44
@dvdchr dvdchr self-assigned this May 13, 2024
@wpmobilebot
Copy link
Contributor

wpmobilebot commented May 13, 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 Numberpr23197-be6ec3d
Version24.8
Bundle IDcom.jetpack.alpha
Commitbe6ec3d
App Center Buildjetpack-installable-builds #8941
Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.

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.

One minor thing, the icons are accessible and it reads the image name:

LGTM! :shipit:

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like this file needs to be added to the WordPress target.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch. I've added it in e2a312a.

@dvdchr
Copy link
Contributor Author

dvdchr commented May 14, 2024

One minor thing, the icons are accessible and it reads the image name:

Good catch! I've manually excluded the image views in be6ec3d.

Thanks for the review! 👍

@dvdchr dvdchr enabled auto-merge May 14, 2024 11:01
@wpmobilebot
Copy link
Contributor

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 Numberpr23197-be6ec3d
Version24.8
Bundle IDorg.wordpress.alpha
Commitbe6ec3d
App Center BuildWPiOS - One-Offs #9892
Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.

@dvdchr dvdchr merged commit 5c64b83 into trunk May 14, 2024
21 of 22 checks passed
@dvdchr dvdchr deleted the issue/23069-reader-whats-new branch May 14, 2024 11:17
@dvdchr dvdchr mentioned this pull request May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants