Reader: Show empty state for individual rows #23144
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Part of #23069
As titled, this shows an empty state cell when there are no posts under a tag. For cases with no internet connection, after loading fails, the collection view will still display cached posts (if it exists) before displaying the empty state cell. Some more technical changes:
Section
andCardCellItem
inReaderTagCardCell
to encapsulate the section & item identifier of the diffable data source. Since the generic type now differs from the one returned fromNSFetchedResultsController
, I've added a method to translate them to the correct structure.ReaderTagCardEmptyCell
for the empty state cell. This cell's width is set to the collection view's width.AdaptiveCollectionViewFlowLayout
so that the collection view properly resizes on orientation change.ReaderTagCardCell.xib
, I've removed the 8pt leading constraint since it made the empty cell look skewed/not centered. I can revert this if this value was intended.Here's a preview:
To test
Since the collection view will still display the list if there are cached items, you can modify this line (ReaderTagCardCellViewModel.swift:L171) to ensure that the empty state cell will always be shown:
Regression Notes
Potential unintended areas of impact
Should be none. Component is isolated and hidden behind a feature flag.
What I did to test those areas of impact (or what existing automated tests I relied on)
Manually tested the changes.
What automated tests I added (or what prevented me from doing so)
N/A.
PR submission checklist:
RELEASE-NOTES.txt
if necessary.Testing checklist: