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

[Notifications P1] Replace Notifications Cell Content #22593

Conversation

alpavanoglu
Copy link
Contributor

Fixes #22465 | #22472

Description

Utilises the newly added NotificationsTableViewCellContent to replace the old cells used in NotificationsViewController.
Also contains improvements to AvatarsView like placeholder image and parsing multiple image urls from the Notification response.

Testing Steps

  1. Install & login to Jetpack App
  2. Navigate to Notifications tab.
  3. ✅ Verify that the UI matches the designs.
  4. ✅ Verify, cell selection does not highlight the cell.
  5. ✅ Verify various avatar styles: single, double, triple.
  6. ✅ Retry steps 3, 4 and 5 after toggling the theme color.

Regression Notes

  1. Potential unintended areas of impact
    N/A

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

  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 Feb 12, 2024

2 Warnings
⚠️ View files have been modified, but no screenshot 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.

Generated by 🚫 Danger

@wpmobilebot
Copy link
Contributor

wpmobilebot commented Feb 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 Numberpr22593-c4657ca
Version24.2
Bundle IDorg.wordpress.alpha
Commitc4657ca
App Center BuildWPiOS - One-Offs #8789
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 Feb 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 Numberpr22593-c4657ca
Version24.2
Bundle IDcom.jetpack.alpha
Commitc4657ca
App Center Buildjetpack-installable-builds #7818
Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.

func host(_ view: Content, parent: UIViewController) {
if let controller = controller {
controller.rootView = view
controller.view.layoutIfNeeded()
Copy link
Contributor

Choose a reason for hiding this comment

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

[Discussion] I'm not sure if you ran into an issue where the cell doesn't resize to fit its content. From experience, the only method that worked for me is controller.view.invalidateIntrinsicContentSize.

There is another approach, but I haven't tried it yet:

tableView.selfSizingInvalidation = .enabledIncludingConstraints

Source https://appcircle.io/blog/using-swiftui-inside-uicollectionview-and-uitableview

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 notice any problems about the cell sizing. Did you?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Resolved ee81dd7

Copy link
Contributor

@salimbraksa salimbraksa Feb 14, 2024

Choose a reason for hiding this comment

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

[Nit] layoutIfNeeded() is no longer needed when calling invalidateIntrinsicContentSize

Suggested change
controller.view.layoutIfNeeded()

)
),
parent: self
)
Copy link
Contributor

Choose a reason for hiding this comment

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

[Question] I guess we don't handle the "Altered" state yet? Are you planning to work on that in this PR or a separate PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No I actually should've done it. I'll look into the old code now to see the conditions it is displayed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Resolved: 2b1626e

title: note.renderSubject()?.string ?? "",
description: note.renderSnippet()?.string,
shouldShowIndicator: !note.read,
avatarStyle: .init(urls: note.allAvatarURLs) ?? .single(note.iconURL!),
Copy link
Contributor

Choose a reason for hiding this comment

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

 .single(note.iconURL!)

[Suggestion] Honestly I wouldn't be confident force unwrapping a value that comes from the Backend. In my opinion, the avatarStyle can be nil, and in that case, we should display some placeholder.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah we shouldn't force unwrap for sure. I'll fix it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Resolved 9abb1cc

@salimbraksa salimbraksa self-requested a review February 13, 2024 21:35
@salimbraksa
Copy link
Contributor

salimbraksa commented Feb 13, 2024

I've shared feedback with Alp internally because it included screenshots and recordings of the app showing information about the company.

return UITableViewCell()
}
cell.selectionStyle = .none
if let deletionRequest = notificationDeletionRequests[note.objectID] {
Copy link
Contributor

@salimbraksa salimbraksa Feb 14, 2024

Choose a reason for hiding this comment

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

[Nit] This if-else is a little bit hard to read, also, the cell.host method call is redundant. Why not do this if-else logic only for the style computation, because it is the only dynamic part in this logic?

let style = {
   if let deletionRequest {
       // return altered style
   }
   // return regular style
}()

cell.host(...)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Resolved 9abb1cc

Copy link
Contributor

@salimbraksa salimbraksa left a comment

Choose a reason for hiding this comment

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

All good 🚀

@salimbraksa salimbraksa merged commit 37a3215 into feature/notifications_refresh_p1 Feb 14, 2024
21 of 22 checks passed
@salimbraksa salimbraksa deleted the feature/notifications-adopt-new-cell-content branch February 14, 2024 18:51
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.

4 participants