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

Match interfacestate update sequence to uikit #882

Merged

Conversation

wsdwsd0829
Copy link
Contributor

@wsdwsd0829 wsdwsd0829 commented Apr 12, 2018

For example of CollectionNode of Red, Green, Blue cells exit by pushing a new viewController on top of it.
(each cell is of UIScreen's size)

Before
2018-04-17 14:51:12.035338-0700 Sample[57499:4071071] !!! preCommit
2018-04-17 14:51:12.035596-0700 Sample[57499:4071071] ^^^^ Red didExitVisibleState <ICCellNode: 0x7ff54481aa00>
2018-04-17 14:51:12.035730-0700 Sample[57499:4071071] ^^^^ didExitDisplayState <ICCollectionNode: 0x7ff542500250>
2018-04-17 14:51:12.041084-0700 Sample[57499:4071071] ^^^^ didExitVisibleState <ICCollectionNode: 0x7ff542500250>
2018-04-17 14:51:12.041251-0700 Sample[57499:4071071] ^^^^ Green didExitDisplayState <ICCellNode: 0x7ff544006000>
2018-04-17 14:51:12.041375-0700 Sample[57499:4071071] ^^^^ Blue didExitPreloadState <ICCellNode: 0x7ff544004400>
2018-04-17 14:51:12.041708-0700 Sample[57499:4071071] !!! postCommit

Afters
2018-04-17 14:44:54.097780-0700 Sample[57279:4016006] !!! preCommit
2018-04-17 14:44:54.098054-0700 Sample[57279:4016006] ^^^^ Red didExitVisibleState <ICCellNode: 0x7fed0a821200>
2018-04-17 14:44:54.098174-0700 Sample[57279:4016006] ^^^^ Green didExitDisplayState <ICCellNode: 0x7fed0a019a00>
2018-04-17 14:44:54.098333-0700 Sample[57279:4016006] ^^^^ Blue didExitPreloadState <ICCellNode: 0x7fed0d807600>
2018-04-17 14:44:54.098464-0700 Sample[57279:4016006] ^^^^ didExitDisplayState <ICCollectionNode: 0x7fed09d039c0>
2018-04-17 14:44:54.098596-0700 Sample[57279:4016006] ^^^^ didExitVisibleState <ICCollectionNode: 0x7fed09d039c0>

// Exit CellNodes first before Collection to match UIKit behaviors (tear down bottom up).
// Although we have not yet cleared the interfaceState's Visible bit (this happens in __exitHierarchy),
// the ASRangeController will get the correct value from -interfaceStateForRangeController:.
[_rangeController updateRanges];
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Normally visible cells will exit first before collection in UIKit;
This change is to ask cells in preload/visible state to exit "together" with visible ones (before collection exit)

@@ -376,7 +380,7 @@ - (void)_updateVisibleNodeIndexPaths
[newVisibleNodes addObject:node];
}
// Skip the many method calls of the recursive operation if the top level cell node already has the right interfaceState.
if (node.interfaceState != interfaceState) {
if (node.pendingInterfaceState != interfaceState) {
Copy link
Contributor Author

@wsdwsd0829 wsdwsd0829 Apr 17, 2018

Choose a reason for hiding this comment

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

This will make sure the correct interface exiting order when thrashing happen during push animation (node being pushed will exit - enter - exit hierarchy).
Note the first exit & enter happened in one runloop triggered by CAAnimation inside UIKit.
Before the change: node will exit for first exit call instead of last. End up visible cell node exit, collection exit, other cell node in preload/display exit.
After the change: Collection exit, cell in visible/preload/display exits

@ghost
Copy link

ghost commented Apr 17, 2018

1 Warning
⚠️ Any source code changes should have an entry in CHANGELOG.md or have #trivial in their title.

Generated by 🚫 Danger

Copy link
Member

@Adlai-Holler Adlai-Holler left a comment

Choose a reason for hiding this comment

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

So the update sequence did this:

[visible cells, collection, preload/display cells] -> [visible cells, preload/display cells, collection]?

That's pretty excellent! A nice improvement in consistency as well as matching UIKit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants