Reader: Add remote fetching for the tags stream #23076
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
Depends on #23057
Adds fetching logic to the 'Your Tags' stream. Note that the loading state will be addressed in the next PR.
In this PR, I had to add a variable on
ReaderStreamViewController
to track whether we've remotely synced posts for a certain tag. This is done to prevent infinite looping from the remote request and the cell being reloaded. For example:didChange
notification and triggers a reload (becauseReaderPost
has a relation withReaderAbstractTopic
.)The variable,
tagStreamSyncTracker
, is added to ensure that we only fetch once per tag. This doesn't completely remove the unnecessary reloading, but it does limit and prevent it from reloading indefinitely. Also, I've added a note that this is a temporary workaround. The proper way would be to create a new view controller conforming toReaderContentViewController
protocol and should no longer be driven by aFetchedResultsController
.To test
Tip
To make it easy to verify, you could add a print statement in
ReaderTagCardCellViewModel:L80
, right below the TODO for the loading state:🗒️ Remotely fetching for: \(tag.slug)
appears in the console as you scroll down the list.🗒️ Remotely fetching for: \(tag.slug)
no longer appears for tags that have previously fetched data remotely.Regression Notes
Potential unintended areas of impact
Should be none. Changes are isolated to the new stream.
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: