Skip to content
This repository was archived by the owner on Feb 2, 2023. It is now read-only.

[ASRangeController] Improvements for automatic range mode to ensure it is persistent / stable if set for an invisible view. - #1382

Merged
appleguy merged 7 commits into
facebookarchive:masterfrom
maicki:AutomaticRangeModeImprovements
Mar 16, 2016
Merged

appleguy merged 7 commits into
facebookarchive:masterfrom
maicki:AutomaticRangeModeImprovements

Conversation

@maicki

@maicki maicki commented Mar 15, 2016

Copy link
Copy Markdown
Contributor
  • Only update range mode if visibility changes if the node is not range controlled
  • Only change explicitly set range mode if ASRangeController becomes visible
  • Return interface state for range controller in ASCollectionView and ASTableView based on if the containing node is range managed

}

/**
* We currently only set interface state on nodes in table/collection views. For other nodes, if they are

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm not sure there is a reason to remove this comment - let's leave it in, at least until it is replaced by something comparable / useful.

@maicki

maicki commented Mar 16, 2016

Copy link
Copy Markdown
Contributor Author

@appleguy Addressed comments

Comment thread AsyncDisplayKit/ASTableView.mm Outdated
// For not range managed nodes or until we can always create an associated ASTableNode
// without a retain cycle, we might be on our own to try to guess if we're visible. The node normally
// handles this even if it is the root / directly added to the view hierarchy.
return (self.window != nil ? ASInterfaceStateVisible : ASInterfaceStateNone);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Both here and in collcetion, let's make the first case in the ternary be (ASInterfaceStateVisible | ASInterfaceStateDisplay)

maicki added 3 commits March 16, 2016 11:44
- Only update range mode if visibility changes if the node is not range controlled
- Only change explicitly set range mode if ASRangeController becomes visible
- Return interface state for range controller in ASCollectionView and ASTableView based on if the containing node is range managed
@@ -918,13 +918,15 @@ - (CGSize)viewportSizeForRangeController:(ASRangeController *)rangeController
- (ASInterfaceState)interfaceStateForRangeController:(ASRangeController *)rangeController

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This looks like exactly what we need. In a future diff, let's factor this into the range controller itself, and do something like interfaceStateForDataSource:withWindow: and then deduplicate / share the logic.

Comment thread AsyncDisplayKit/ASCollectionView.mm Outdated
// Trigger updating interfaceState for cells in case ASCollectionView becomes visible or invisible
[_rangeController visibleNodeIndexPathsDidChangeWithScrollDirection:self.scrollDirection];

// Updating the visible node index paths only for range managed nodes. Not range managed nodes will get their

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

comment should say only for NOT range managed collections / tables, e.g. root level ones, need this notification? As range managed ones will get this update through the range controller itself that owns them?

maicki added 2 commits March 16, 2016 16:27
…e automatic range mode detection

This is necessary to get out of the initial range mode state into the first defined range mode state
appleguy added a commit that referenced this pull request Mar 16, 2016
[ASRangeController] Improvements for automatic range mode to ensure it is persistent / stable if set for an invisible view.
@appleguy
appleguy merged commit 5f58b9d into facebookarchive:master Mar 16, 2016
@appleguy appleguy changed the title [ASRangeController] Improvements for automatic range mode [ASRangeController] Improvements for automatic range mode to ensure it is persistent / stable if set for an invisible view. Mar 17, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants