_setImage is intended to call the super version of the method,
however with the adoption of the new _locked_ prefix, ASImageNode's
implementation would call back into ASNetworkImageNode's implementation.
This restore the intent of the _setImage method.
* [ASCollectionView] Improve interop to silence invalid layout warnings, fix supplementary passthrough.
Before this change, passthrough of supplementary elements didn't work properly -- it would get rehosted into the blank ASCellNode.
* [ASCollectionView] Ensure that IGListKit-handled supplementary views are sent through ASRangeController.
* [ASCellNode] When .shouldUseUIKitCell == YES, don't remove the subviews of the .contentView
* Add unit test to test trait collection changes occur during updates are handles correctly
* Remove handling code in ASDataController:updateWithChangeSet. Previous test should fail
* Correctly handle trait collection changes that occur mid-updates
- Currently, when there is a new trait collection, we correctly propagate it to all visible elements. However, since the propagating block is executed on main thread immediately without waiting for the background editing queue of ASDataController, not all elements are updated.
- Then to fix that, we updated ASDataController to handle these changes inside updateWithChangeSet. This works, but it doesn’t address the underlying issue.
- We now delegate the propagating task to ASDataController which schedule a block to its main serial queue after waiting for its background editing queue.
- It's not safe to hold the lock of a supernode and:
- Edit states of its subnodes
- Call subclass hooks
- Run completion block
- Run animation, which can trigger layout passes on subnodes, especially if one of them is a collection view.
* Avoid multiple initial data loads being issued by UICollectionView/UITableView
- Currently, there is a gap between the moment UICollectionView/UITableView triggers its first data load and when ASDataController finishes processing it. During this gap, the view keeps issuing "initial" loads by calling reloadData and causes its data controller to reload multiple times.
- Fix by immediately forward the first reloadData call to UICollectionView/UITableView before letting its data controller to handle it for real. During the gap, the view thinks that it loaded initial data but is empty, and thus stops triggering initial loads. Once the data controller finished loading, it will call another reloadData on the view which causes the view to swap to a correct state.
* Fix tests
* Use the existing flag of ASDataController
* Explain unit test
* [ASTextNode] Reset _composedTruncationText when attributedText is updated
Current issue:
1) Set `attributedText` in `ASTextNode` with whiteColor
2) `_composedTruncationText` gets updated to take on this new color attribute
3) Set the `attributedText` with greenColor
4) The `_composedTruncationText` gets updated with the new attributes, but does NOT overwrite any existing attributes — i.e., does not overwrite the white color with green. Comment from `_locked_prepareTruncationStringForDrawing:`:
`
// Add any of the original string's attributes to the truncation string,
// but don't overwrite any of the truncation string's attributes
`
* michael’s suggestion
* Fix trait collection handling in ASCollectionElement
- Don't store a trait environment directly and request it when needed. The environment is often the cotaining collection/table node. Asking it for a trait collection is an upward tree traversal and can cause deadlocks. This reverts #2963.
- If the environment changes during a change set update, notify all visible elements about the change. This fixes#2959.
* Address comments
Although we may not want to support this property long-term, there are some usages of it
that are difficult to avoid. Specifically because the complexity it adds is both low,
and contained to a small area of the code that would be easy to remove it, it would be
great to support this.
The usage relates to apps that require the Interop protocol, and are architected to expect
a few methods / protocols being implemented on the UICollectionView class itself. It does
not directly override ASCollectionView behaviors. So hypothetically, it would also work
if it were possible to set ASCollectionView's superclass.
Instead, the app is making its own subclass descend from ASCollectionView and use the interop
APIs, even in environments where there are no ASCellNodes ever returned.
* [ASMultiplex/NetworkImageNode] Ensure ASImageProtocols are not called with nil arguments.
* [ASBasic/PINRemoteImageDownloader] Do not check for nil downloadIdentifier needlessly.
* [ASImageCacheProtocol] Make synchronouslyFetchedCachedImageWithURL URL nonnull.
We have to check in this case if the supernode of the subnode is indeed the _node that executes a layout transition. It can happen that a node already did a layout transition and added this subnode, in this case the subnode would would be removed from the new node instead of _node.
- Before this commit:
- Bridged properties are accessed to construct a recursive description without considering thread affinity.
- We have multiple methods that does the same thing: generates a debug description.
- After this commit:
- Bridged properties are accessed without triggering thread affinity assertions.
- We have only one method that provides debug description of a node. It is then used to construct a recursive description.
* Improve locking situation in ASDisplayNode subclasses
* Adress first number of comments
* Don’t hold the lock while calling _updateComposedTruncationText
- Avoid returning a NaN flexShrinkAdjustment.
- Bail early (instead of assert) if a line has a positive `flexFactorSum` but then no flexible item can be found via flex adjustments, for example because the flexible items have zero size.
- Continue flexing other lines when one line is inflexible.
- Add unit test for the first 2 fixes.
- UICollectionViewFlowLayout asks its delegate, which is ASCollectionView, for reference size of headers and footers. If a header or footer is unavailable, its backing collection element will be nil and a zero size should be returned immediately.
* Align touch and tracking system in ASControlNode to UIControl
Currently the touch and tracking system of ASControlNode does not align with the system of UIControl. ASControlNode does not even consider `beginTrackingWithTouch:withEvent:` or `continueTrackingWithTouch:withEvent:`.
This commit will change the ASControlNode logic around touch event handling and tracking to align with UIControl.
* Add assertion for layer backed nodes that would like to add an action target for a control event
* Adress comments