4846 Commits

Author SHA1 Message Date
Yevgen Pogribnyi
e954b1045a [ASPrimitiveTraitCollection] Always treat preferredContentSize as a potential nil #trivial (#757)
* Fix ASPrimitiveTraitCollection initialization on iOS 9.
Add nil-value checks for preferredContentSizeCategory.

* * Mark -[ASTraitCollection init] as deprecated.
* Mark [ASViewController overrideDisplayTraitsWithWindowSize] as deprecated.

Code review changes:
* Remove unneeded nonnull annotations
* Add null check in ASTraitCollection constructor implementation
* Codestyle
* Add some documentation about ASPrimitiveTraitCollection vs ASTraitCollection usage

* Rename safeContentSizeCategory to AS_safeContentSizeCategory.

Remove safePrimitiveContentSizeCategory in favour of AS_safeContentSizeCategory.
2018-03-21 12:44:30 +00:00
Ariel Elkin
5385d8b3ed Update layout2-layout-element-properties.md (#844) 2018-03-20 15:32:52 +00:00
Michael Schneider
0b101135ba Handle nil backgroundColor in ASTextNode2 #trivial (#841)
* Handle nil backgroundColor

* Small improvement
2018-03-16 20:08:19 -07:00
Adlai Holler
15b695c917
Put back a flag that I removed (#839) 2018-03-16 15:21:38 -07:00
Adlai Holler
e6c98d364f
[NoCopyRendering] Use vm instead of malloc (#833)
* [Contexts] Use mmap directly for possible perf gain and to tag the memory as CGImage

* Wrap the mmap in an object

* Go straight to dataprovider

* Tweak it

* Remove wrong comment

* Finish that comment

* Address warnings
2018-03-16 15:13:26 -07:00
appleguy
a41cbb48b3
[ASWrapperCellNode] Introduce a new class allowing more control of UIKit passthrough cells. (#797)
* - [ASWrapperCellNode] Introduce a new class allowing more control of UIKit passthrough cells.

A few minor fixes to Collections behavior as well, including a new isSynchronized
API. The difference from processingUpdates is that after Synchronized, all animations
have also completed (or runloop turn if animations disabled, so .collectionViewLayout
can be relied on being fully in sync).

More upstreaming to come after this can land...

* Fix -[ASDataController clearData] to take no action before initial data loading.

* Empty commit to kick CI

* Spacing change to kick CI (since an empty commit doesn't work...)

* Tweak ASDataController changes to handle an edge case in _editingTransactionQueueCount management.

* Avoid excess cyclic calls to onDidFinishProcessingUpdates: by avoiding ASMainSerialQueue.

* Reverting my initial change as it wasn't the right approach, following the real fix before this.
2018-03-13 01:03:18 -07:00
Adlai Holler
5cafdb9062
[ASTextNode2] Fix background color drawing (#831)
* Fix TextNode2 not respecting background color

* ASTextNode2: Use locks and copies right

* Increment changelog

* Make the Dangerfile accept any license header with Pinterest in it
2018-03-12 13:42:33 -07:00
Ha Hyun soo
ed6da29057 Geektree0101 - Fix mensXP showcase indent on showcase table, attach vingle medium blog poster (#818) 2018-03-12 12:43:40 -07:00
Adlai Holler
9bffd88134
Fix Text Node Thread Sanitizer Warning (#830)
* Fix thread sanitizer warning in ASTextNodeRendererKey

* Update changelog

* Comment on missing class check
2018-03-12 10:42:24 -07:00
Alex Hill
d9d9a29365 [tvOS] Fixes errors when building against tvOS SDK (#728)
* [tvOS] Fixes errors when building against tvOS SDK

* Update CHANGELOG.md

* [tvOS] Fixes implicit conversion between UIViewAnimationCurve +
UIViewAnimationOptions

* Enable tvOS deployment target in Texture.podspec (for CI)

* [ASMultiplexImageNode] Fixes typo

* [tvOS] Fixes warnings related to @available guards in Xcode 9
[ASMultiplexImageNode] Enables support for Photos framework on tvOS 10+

[ASMultiplexImageNode] Fixes comment depth

[ASAvailability] Adjust logic in AS_AVAILABLE_IOS_TVOS to account for
both versions
Adjusts API_AVAILABLE to minimum deployment target

* [ASAvailability] Update AS_AVAILABLE_XXX fallbacks to function more like
the built-in solution (more accurately target OS by checking target)
Change AS_AVAILABLE_IOS -> AS_AVAILABLE_IOS_TVOS in places that shoud
allow for both

[ASAvailability] Simplify AS_AVAILABLE_IOS_TVOS

* [ASControlNode] Adds missing 'super' call in -[ASControlNode didLoad]
when targeting tvOS

* Fix API_AVAILABLE iOS requirement

* [ASDisplayNode] Fixes last of the linker warnings related to category
overrides. Removes methods already implemented in
ASDisplayNode+UIViewBridge category.
[ASControlNode] Moves tvOS category declaration to ASControlNode header
[ASImageNode] Moves tvOS category declaration to ASImageNode header
[ASControlNode+Private] Adds private category for ASControlNode to
access private selectors

* [NSParagraphStyle+ASText] Fixes typo related to testing

* [ASControlNode] Re-add helpful comment

* [ASTextKitCoreTextAdditions] Adds mappings for kCTParagraphStyleSpecifierMinimumLineSpacing, kCTParagraphStyleSpecifierMaximumLineSpacing, kCTParagraphStyleSpecifierLineSpacingAdjustment when mapping CTParagraphStyle onto NSParagraphStyle
[ASTextNode] Uses CoreText-cleansed attributed string when assigning ascender/descender to avoid crash when a CTParagraphStyle is passed as an attribute

* [AsyncDisplayKit] Update project file to include new/deleted files

* [ASControlNode+tvOS] Add missing Foundation import (whoops!)
[ASImageNode+tvOS] Add missing Foundation import (whoops!)

* Update podspec to only link AssetsLibrary framework on iOS

* [ASTextKitCoreTextAdditions] If kCTParagraphStyleAttributeName key-value
evaluates to an NSParagraphStyle, pass through to cleansed attributes. This
fixes a bug that would occur if a CTParagraphStyle was passed as an
attribute _alone_ (would not be caught by unsupported attributes
check)

* [ASMultiplexImageNode] Bump availability check to support < Xcode 9

* [ASTraitCollection] Fixes typo that was causing build to fail

* Clean up formatting to adhere to character/line limit + braces
2018-03-11 16:37:27 -07:00
Huy Nguyen
e0d07d07ef ASTextNode should avoid acquiring its lock multiple times #trivial (#820)
Since the lock was acquire before we try to access the renderer, we should call `-_locked_renderer` to avoid re-acquiring the same (recursive) lock.
2018-03-09 14:23:41 -08:00
Adlai Holler
6f1d2d1f1d
[ASTextNode] Fix locking, add test for issue #trivial (#825)
* A few small fixes plus a failing test for ASTextNode

* Change the approach

* Update changelog

* Eh screw null_resettable

* No need for changelog now
2018-03-09 14:23:27 -08:00
Garrett Moon
f99dd68a9f
[#trivial] fixes rendered image quality on networked image nodes which have their image directly set. (#826) 2018-03-08 16:21:54 -08:00
Garrett Moon
d70ab3e43c
[#trivial] I don't think we need this extra locked method. (#824) 2018-03-08 16:19:49 -08:00
Garrett Moon
63e1f4e9d9
Hopefully made this a bit more readabl. (#823) 2018-03-08 14:00:17 -08:00
appleguy
8b4a7cdab8 [ASDisplayNode] Add unit tests for layout z-order changes (with an open issue to fix). (#816) 2018-03-02 14:39:42 -08:00
Adlai Holler
a1055254f7
Replace pthread specifics with C11 thread-local variables (#811)
* Replace pthread specifics with C11 thread-local variables for speed and safety

* Increment changelog
2018-02-28 12:42:30 -08:00
Karthik M
6b57b1cf1a [ASDKGram Example] image_url has been changed from URL to Array by 500px. (#813) 2018-02-27 20:40:45 -08:00
Garrett Moon
8817a009c9 Upgrade dangerfile (#810)
* Upgrade dangerfile

* Allow cocoapods warnings for now :(
2018-02-26 13:16:38 -08:00
appleguy
223f1c9a36 [ASDisplayNode] Consolidate main thread initialization and allow apps to invoke it manually instead of +load. (#798)
* - [ASDisplayNode] Consolidate main thread initialization and allow apps to invoke it manually instead of +load.

Additionally this has a few minor fixes for Yoga support, and adds some basic
but universally valuable callbacks like -nodeDidLoad to ASNodeController.

* Small fix for handling _layoutVersion.

* Remove poking the scale accessor
2018-02-25 22:15:40 -08:00
Michael Schneider
236cdd799c
Fix UIResponder handling with view backing ASDisplayNode (#789)
* Add failing tests

* Fix responder chain handling in Texture

* Add mores tests that horrible fail

* Add Changelog.md entry

* Some fixes

* Update logic

* Add tests that prevents infinite loops if a custom view is overwriting UIResponder methods

* Add macro to forward methods in ASDisplayNode

* Add macro for forwarding responder methods in _ASDisplayView

* Remove junk

* Address first comments

* Update _ASDisplayView to cache responder forwarding methods

* Use XCTAssertEqual
2018-02-23 09:10:09 -08:00
Max Wang
2618c50073 New runloop queue to coalesce Interface state update calls. (#788)
* fix SIMULATE_WEB_RESPONSE not imported #449

* Coalesce interface state updates to ASCATransactionQueue before CATransaction commit.

This will avoid duplicate interface state delegate calls caused by view repeatly added/removed to/from hierarchy during controller animation transition.

* fix tests for new run loop queue

* Support for disabling ASCATransactionQueue

* Fix didExitHierarchy to use ASCATransactionQueue.

* merge range managed and none range managed for didExitHierarchy

* Revert "merge range managed and none range managed for didExitHierarchy"

This reverts commit f807efaa65ed5dbdb6622d06da542e01a53715fa.

* merge range managed and none range managed for didExitHierarchy

* remove metadata

* abstract queue to impl class methods

* Add tests

* Fix test fail because of shared object.

* guard _pendingInterfaceState access with lock

* name refactor

* Refactor from comments https://github.com/TextureGroup/Texture/pull/788/\#pullrequestreview-94849919

* Apply InterfaceState immediately after ASCATranactionQueue is processed and before next runloop started.

* refactor

* no op to start CI build

* remove unused var and kick off tests

* change lisence

* remove code for weak ref

* add change log and adjust license
2018-02-13 12:10:20 -08:00
John T McIntosh
6f34691481 Update IGListKit dependency to allow for updated versions (#802) 2018-02-13 12:08:31 -08:00
Adlai Holler
8b431733d3
Avoid triggering main thread assertions in collection/table dealloc #trivial (#803)
* Avoid triggering main thread assertions in ASCollectionNode/ASTableNode dealloc

* Put it back
2018-02-13 12:02:30 -08:00
Huy Nguyen
e2478fc799
[ASDisplayNode layout] Fix an issue that sometimes causes a node's pending layout to not be applied (#792)
* [ASDisplayNode layout] Fix an issue that causes a node's pending layout to not be applied

- Since the implementation of layout version (#428), if a node's pending and calculated layouts have the same current version as well as the same constrained size, the 2 layouts are considered equal and can be used interchangeably. A layout version check between the 2 layouts was added in #695. This PR adds a missing constrained size check.
- If the pending layout has the same version but a different constrained size compare to the calculated layout's, we can assume that the pending layout is newer and should be preferred over the calculated one. That is because layout operations always register their new layout as pending, which then (immediately or eventually) get applied to the node as calculated layout.
2018-02-12 21:04:58 +00:00
Kevin Bui
f0f3f9acfe Add missing scrollViewWillEndDragging passthrough delegate (#796)
* Add scrollViewWillEndDragging delegate

* Make sure delegate can respond to scrollViewWillEndDragging

* Add changes to CHANGELOG.md
2018-02-12 11:38:20 -08:00
Max Wang
479d40464e [ASTableNode & ASCollectionNode] Keepalive reference for node if their view is necessarily alive (has a superview). (#793)
* fix SIMULATE_WEB_RESPONSE not imported #449

* Fix to make rangeMode update in right time

* Keep collection/table node alive if view still in use.
2018-02-09 12:16:18 -08:00
appleguy
31227da577
[ASRangeController] Fix stability of "minimum" rangeMode if the app has more than one layout before scrolling. (#790)
This should result in memory savings in many apps, since errant relayouts are pretty common.
2018-02-09 11:04:00 -08:00
Huy Nguyen
b4a269aabf
[ASDisplayNode] Always return the thread-safe cornerRadius property, even in slow CALayer rounding mode (#749)
- Failing to do so will introduce race conditions in which the property was updated on a background thread but main thread has not executed the block that updates the property of the node's layer. During that window, the layer's property is out-of-date and can't be used.
- After this change, ASDisplayNode's cornerRadius is the only source of truth and users must always use it instead of CALayer's.
2018-02-08 17:08:04 +00:00
Michael Schneider
3ee52e5f3b Add #794 to changelog 2018-02-08 08:34:12 -08:00
Michael Schneider
600b6cb76d
Fix ASTextNode2 is accessing backgroundColor off main while sizing / layout is happening (#794) 2018-02-08 08:28:14 -08:00
Michael Schneider
5ea4d51596
Get CatDealsCollectionView example running again #trivial (#783)
* Get CatDealsCollectionView example running again

* Fix it for real and some other styling stuff

* Fix some warning

* Adjust headers
2018-02-02 11:41:19 -08:00
Adlai Holler
c6454214ac
Retain the reference color space (#784) 2018-02-02 10:36:17 -08:00
Michael Schneider
38b76e0eb2
Improve nullable annotations for _ASDisplayLayer and _ASDisplayView (#780) 2018-02-01 08:44:47 -08:00
Adlai Holler
1be4d8d088 Add #764 to the changelog 2018-02-01 06:45:07 -08:00
Vladyslav Chapaev
0f061b401e node tint color fix (#764) 2018-02-01 06:43:46 -08:00
Adlai Holler
0c4ccc5253
Improve ASNetworkImageNode delegate callout behavior (#778)
* Improve ASNetworkImageNode delegate callout behavior

* no message
2018-01-31 12:18:04 -08:00
Alex Hill
0bb53552b0 [ASCellNode] focusStyle mapping (#727)
* [ASCellNode] Adds mapping for UITableViewCell focusStyle

* Update CHANGELOG.md
2018-01-31 10:07:08 -08:00
Huy Nguyen
ea547270f2
[ASDisplayNode] Force a layout pass on a visible node as soon as it enters preload state (#779)
This reverts commit 2e9858837251cf16c9ffd19ba2eaeaa1012c8977 (#751).

The reason we can't wait for the coming CA's layout pass is that cell node visibility events occur before the pass, at which time the cell's subnodes don't have correct frames for impression tracking.

The root cause of this problem is that, right now, cell node visible states are set by ASRangeController well before the layout pass of the hosting collection/table view. That means we're "jumping the gun". The more I think about this, the more I agree with @Adlai-Holler that we need to treat visible state differently. That is, a node should only be visible (and thus get visibility events) after it's fully loaded, it's view/layer attached to the hierarchy and laid out by a CA transaction. In other words, at the end of the CA layout pass. Such change needs time and effort to be thoroughly reviewed and tested. Until then, let's roll with this fix.
2018-01-31 15:35:14 +00:00
Aaron Rosenberger
d6971980a3 Fixed: completeBatchFetching is called on a background thread (#731)
* Fixed breaking issue where completeBatchFetching is called on a background thread when no items are added to the collection

* Changed spaces to tabs for consistency

* Moved return statement for Code Review feedback

* Fixed the same issue in the Objective-C version of ASDKgram

* One more

* Update PhotoFeedModel.m

Fix header
2018-01-31 10:23:04 -05:00
Denis Morozov
511bec63a2 Fix capturing self in the block while loading image in ASNetworkImageNode (#777)
* Fix capturing self in the block while loading image in ASNetworkImageNode

* Restore re-strongify while switching on the main thread

* Update CHANGELOG.md
2018-01-31 10:20:00 -05:00
Michael Schneider
20e31f7d70
Fix synchronous state of node if +viewClass or +layerClass is overwritten #trivial (#776)
* Fix synchronous state of node if +viewClass is overwritten

* Also check for _layerClass overwrite for synchronous flag

* Update some code style
2018-01-31 07:07:38 -08:00
Adlai Holler
fef965f78e
Add support for providing additional info to network image node delegate (#775)
* Add support for piping arbitrary user info from ASImageDownloader to the ASNetworkImageNodeDelegate

* s/source/sourceType

* Fix stuff and take Michael's advice
2018-01-30 17:50:38 -05:00
Michael Schneider
196d76d82d
Expose asyncdisplaykit_node in _ASDisplayView same as in _ASDisplayLayer #trivial (#773)
* Expose asyncdisplaykit_node in _ASDisplayView same as in _ASDisplayLayer

* Change comment
2018-01-30 14:24:46 -08:00
Justin Swart
7ba4376b6f Update PINCache (#769) 2018-01-30 14:19:37 -05:00
Adlai Holler
2e94bb8120
Improve no-copy rendering experiment, remove +load method (#771)
* Improve graphics contexts experiment

* Update changelog

* Remove extra space

* Add a unit test for screen scale

* Fix typo and use unique value
2018-01-30 14:18:37 -05:00
Flatout73
b0c3e65da8 Fix misprint (#768) 2018-01-29 12:05:48 +00:00
Denis Morozov
3f27546ec8 Fix typos in layout2-layoutspec-types.md #trivial (#770) 2018-01-29 12:05:33 +00:00
Adlai Holler
c3ae4474d0
NoCopyRendering experiment: Fix possible memory leak if image node rendering is canceled #trivial (#765)
* Fix memory leak if image node rendering is canceled

* Update comment
2018-01-23 10:45:34 -08:00
Adlai Holler
9b8a919a93
Revert "Faster collection operations (#748)" (#759)
This reverts commit 5c13403ef75c030adc7a4d51a7792a9c6c1c348b.
2018-01-22 11:38:09 -08:00