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

Wrap supplementary node blocks to enable resizing them. #1265

Merged
merged 2 commits into from
Dec 10, 2018

Conversation

wiseoldduck
Copy link
Member

Most ASCellNodeBlocks are wrapped by ASCollectionView.mm to add an interactionDelegate as well as calling enterHierarchyState on the node and setting its transform to a reflection if inverted is set on the collectionView.

This PR adds this behavior to supplementary nodes as well.

@ghost
Copy link

ghost commented Dec 4, 2018

🚫 CI failed with log

@@ -2015,7 +2015,26 @@ - (ASCellNodeBlock)dataController:(ASDataController *)dataController supplementa
block = ^{ return cell; };
}

return block;
// Wrap the node block
BOOL disableRangeController = ASCellLayoutModeIncludes(ASCellLayoutModeDisableRangeController);
Copy link
Contributor

Choose a reason for hiding this comment

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

We may should remove that ;)

Most ASCellNodeBlocks are wrapped by ASCollectionView.mm to add an `interactionDelegate` as well as calling `enterHierarchyState` on the node and setting its transform to a reflection if `inverted` is set on the collectionView.

This PR adds this behavior to supplementary nodes as well.
@@ -2015,7 +2015,22 @@ - (ASCellNodeBlock)dataController:(ASDataController *)dataController supplementa
block = ^{ return cell; };
}

return block;
// Wrap the node block
__weak __typeof__(self) weakSelf = self;
Copy link
Member

Choose a reason for hiding this comment

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

At one point we should add strongify & weakify macros.

__weak __typeof__(self) weakSelf = self;
return ^{
__typeof__(self) strongSelf = weakSelf;
ASCellNode *node = (block ? block() : cell);
Copy link
Member

Choose a reason for hiding this comment

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

Isn't block is guaranteed to be non-nil after this line? Maybe remove that line to be consistent with the implementation of dataController:nodeBlockAtIndexPath:.

Copy link
Contributor

Choose a reason for hiding this comment

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

Concur with @nguyenhuy. The block should not be nil in here and the returning block is retaining the block too.

Copy link
Member Author

Choose a reason for hiding this comment

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

I thought you had to copy a block to actually retain it

Copy link
Member Author

Choose a reason for hiding this comment

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

nm I'm like stuck in 2010 😛

__weak __typeof__(self) weakSelf = self;
return ^{
__typeof__(self) strongSelf = weakSelf;
ASCellNode *node = (block ? block() : cell);
Copy link
Contributor

Choose a reason for hiding this comment

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

Concur with @nguyenhuy. The block should not be nil in here and the returning block is retaining the block too.

@maicki maicki merged commit b69fe70 into TextureGroup:master Dec 10, 2018
wsdwsd0829 pushed a commit to wsdwsd0829/Texture that referenced this pull request Mar 14, 2019
…#1265)

* Wrap supplementary node blocks to enable resizing them.

Most ASCellNodeBlocks are wrapped by ASCollectionView.mm to add an `interactionDelegate` as well as calling `enterHierarchyState` on the node and setting its transform to a reflection if `inverted` is set on the collectionView.

This PR adds this behavior to supplementary nodes as well.

* Simplify code / block will never be nil
wsdwsd0829 pushed a commit to wsdwsd0829/Texture that referenced this pull request Mar 15, 2019
…#1265)

* Wrap supplementary node blocks to enable resizing them.

Most ASCellNodeBlocks are wrapped by ASCollectionView.mm to add an `interactionDelegate` as well as calling `enterHierarchyState` on the node and setting its transform to a reflection if `inverted` is set on the collectionView.

This PR adds this behavior to supplementary nodes as well.

* Simplify code / block will never be nil
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.

None yet

3 participants