-
Notifications
You must be signed in to change notification settings - Fork 135
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
End of Year: preload stories #471
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This value was being published too quickly, making the story's view create a new View every time it changed.
This ensures the data source will contain the podcast instance with the correct colors
emilylaguna
approved these changes
Nov 2, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work, left some comments to clean up a few items and an idea for default colors.
None of them are blockers though.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
To provide a better experience for the users, the app preloads the next 2 stories. The assets that are preloaded are:
Those are requested if they do not exist, and they are requests only once (images by using Kingfisher and colors by using the current
ColorManager
).This also changes how the
StoriesView
is rendered to avoid Stories being re-created hundreds of time.To test
Playing stories without skipping to next/previous
endOfYear
flag inFeatureFlag.swift
Skipping
endOfYear
flag inFeatureFlag.swift
Number of Stories View
A bit of context:
StoriesModel
had theprogress
property as a published one. Each time that changed,StoriesView
was invalidated and re-rendered again. In turn, this caused the current story to be invalidated and re-rendered again.In terms of allocation, this wasn't a big problem because the views are mainly
structs
, but the CPU usage was going up due to the view being invalidated every 0.01s.I moved the progress to another object that is used only by the progress indicators, now the
StoriesView
is only invalidated when the current story changes.To test:
endOfYear
flag inFeatureFlag.swift
Checklist
CHANGELOG.md
if necessary.