579 Commits

Author SHA1 Message Date
appleguy
63efdbde8f [ASCollectionView] Call -invalidateFlowLayoutDelegateMetrics when rotating. #trivial (#616)
* [ASCollectionView] Ensure -invalidateFlowLayoutDelegateMetrics is called for UIKit passthrough cells.

This allows rotation to work properly when rotating UIKit passthrough
cells that need to change width.

* [ASCollectionView] No need to verify node is still in model to handle view-only notifications.
2017-10-31 13:20:58 +00:00
Adlai Holler
af99ff5ef2 Have ASNetworkImageNode report whether images were cached or not (#639)
* Have ASNetworkImageNode report whether images were cached or not.

* Update changelog

* Add fileURL case
2017-10-25 15:57:30 -07:00
appleguy
68f3468d91 [ASCollectionView] Improve performance and behavior of rotation / bounds changes. (#431)
* [ASCollectionView] Improve performance and behavior of rotation / bounds changes.

See #430 for details.

* Edit CHANGELOG.md

* [ASDataController] Implement -relayoutAllNodesWithInvalidationBlock:, to flush the ASMainSerialQueue before -invalidateLayout is called.

* Don't set download results if no longer in preload range. (#606)

Good catch by @djblake, if you scroll fast enough, you leave images
set on the image node because didExitPreloadRange (which would have
cleared it) was already called.

* Animated WebP support (#605)

* Updating to support animated WebP

* Fix a deadlock with display link

* Fix playhead issue.

* Fix up timing on iOS 10 and above

* Don't redraw the same frame over and over

* Clear out layer contents if we're an animated GIF on exit range

* Clear out cover image on exit of visible range

* Don't set cover image if we're no longer in display range.

* Don't clear out image if we're not an animated image

* Only set image if we're not already animating

* Get rid of changes to podfile

* Add CHANGELOG entry

* Update license

* Update PINRemoteImage

* Remove commented out lines in example

* [ASDataController] Add nullable specifier to invalidationBlock for relayout of nodes.
2017-10-24 13:12:52 +01:00
Garrett Moon
d31af734df Dispatch batch update to main #trivial (#626)
* Dispatch batch update to main

* TableView too
2017-10-20 15:01:38 -07:00
Garrett Moon
919ec8d32b Check if we need to do a batch update (#624)
* Check if we need to do a batch update

If we've changed our leading screens for batch fetching, we
may need to batch fetch.

* Add CHANGELOG entry
2017-10-20 09:23:07 -07:00
Michael Schneider
526a7cfb53 Fix name clash with YYText (#623) 2017-10-18 15:49:58 -07:00
Huy Nguyen
c12509e67a [ASTextKitComponents] Make sure Main Thread Checker isn't triggered during background calculations #trivial (#612)
* Add unit test

* Make sure TextKit components can calculate size in background without upsetting Main Thread Checker
- Add a new thread-safe text view bounds.
- Temporary components stack doesn't have a text view so it can be safely deallocated off main.

* Add ASTextKitComponentsTextView

* Remove unnecessary change

* Fix minor mistake

* ASTextKitComponentsTextView has only 1 initializer

* Minor change

* Switch to atomic property

* Remove manual synthesization
2017-10-17 14:20:20 +01:00
Mustafa Besnili
1e7d46196f Fix "This block and function declaration is not a prototype" warning. (#619) 2017-10-17 14:18:23 +01:00
Huy Nguyen
929bd4c60e [ASTextKitComponents] Temporary components can be deallocated off main (#610) 2017-10-10 16:03:30 +01:00
Garrett Moon
4dbb6441d7 Animated WebP support (#605)
* Updating to support animated WebP

* Fix a deadlock with display link

* Fix playhead issue.

* Fix up timing on iOS 10 and above

* Don't redraw the same frame over and over

* Clear out layer contents if we're an animated GIF on exit range

* Clear out cover image on exit of visible range

* Don't set cover image if we're no longer in display range.

* Don't clear out image if we're not an animated image

* Only set image if we're not already animating

* Get rid of changes to podfile

* Add CHANGELOG entry

* Update license

* Update PINRemoteImage

* Remove commented out lines in example
2017-10-09 11:48:32 -07:00
Garrett Moon
1705ec0140 Don't set download results if no longer in preload range. (#606)
Good catch by @djblake, if you scroll fast enough, you leave images
set on the image node because didExitPreloadRange (which would have
cleared it) was already called.
2017-10-09 10:13:28 -07:00
appleguy
c6e3dd7a5d [ASCollectionView] Fix index space translation of Flow Layout Delegate methods. (#467)
* [ASCollectionView] Fix index space translation of Flow Layout Delegate methods.

This includes a few other cleanups, including overflow of signed integer indices.

* [ASCollectionView] Improve code sharing of UIKit size method calls; ensure delegate invalidation re-fetches supplementary sizes too.

* [ASCollectionView] Final method ordering and doc-comment for new _sizeForUIKitCellWithKind:atIndexPath: method.
2017-10-09 17:19:46 +01:00
Flo
4a203db9fc [ASVideoNode] Time observer fix (#604)
* [ASVideoNode] Move time observer handling to player observers methods.

* Update CHANGELOG.md.
2017-10-06 15:04:36 +01:00
Michael Schneider
4379b31ac2 Add assertion in dealloc that it is on main in ASTextKitComponents (#603) 2017-10-05 09:06:50 -07:00
Michael Schneider
dd90978fb6 ASTextKitComponents needs to be deallocated on main (#598) 2017-10-04 14:52:49 +01:00
appleguy
7a07d9eb88 [PINCache] Set a default .byteLimit to reduce disk usage & startup time. (#595)
* [PINCache] Set a default .byteLimit to reduce disk usage & startup time.

This default is fairly low - only 20MB - but for most apps with images
in the size range of 10-50KB, this is still 400-1000 images.

Once some optimizations land to PINCache, we'll match the PINCache
default of 50MB to ensure the default better serves users with larger
objects in the cache.

Apps should preferably set their own byteLimit to an optimal value.

@garrettmoon - one interesting question for us is the best place to
set .byteLimit as an app. Digging into the ASPINRemoteImageDownloader
and doing this type cast is a bit complicated, so a passthrough API
to get the PIN* objects directly might be worthwhile.

* [PINCache] Declare necessary APIs to avoid a direct dependency.
2017-10-03 19:32:03 -07:00
Michael Schneider
5c6cd7c8d9 Move clearing out of ASTextKitComponents property delegates into ASTextKitComponents dealloc (#591) 2017-09-30 07:20:14 -07:00
Adlai Holler
5186a4317e Use Nil for class instead of nil (#589) 2017-09-27 20:12:18 -07:00
Michael Schneider
a103bab00a Clear ivar after scheduling for main thread deallocation #trivial (#590)
* Clear ivar after scheduling for main thread deallocation

After scheduling the ivar for main thread deallocation we have clear out the ivar, otherwise we can run into a race condition where the main queue is drained earlier than this node is deallocated and the ivar is still deallocated on a background thread

* First clear and than schedule
2017-09-27 13:42:02 -07:00
Garrett Moon
6c008974d6 Use node lock instead of separate one to avoid deadlocks. (#582)
* Use node lock instead of separate one to avoid deadlocks.

* Add CHANGELOG entry
2017-09-27 11:34:01 +01:00
Huy Nguyen
9e178dc0a6 [_ASPendingState] Make sure accessibility strings are not nil before allocating attributed strings for them #trivial (#581)
* Make sure accessibility strings are not nil before allocating attributed strings for them

- Fix crashes caused by https://github.com/TextureGroup/Texture/pull/554

* Update tests
2017-09-27 11:33:42 +01:00
Garrett Moon
40551c746b Rolling back CI to known version for now (#585)
* Rolling back CI to known version for now

* Fix availability in tests

* Commenting out for now to see if it builds

* Fix up the Swift framework test

* Fix availability
2017-09-27 09:23:30 +01:00
Huy Nguyen
8e0aa1ea73 Fix crashes caused by failing to unlock or destroy a static mutex while the app is being terminated (#577)
* Fix crashes caused by failing to unlock or destroy a static mutex while the app is being terminated

* Allocate static mutexes on the heap memory to avoid destruction at app exit

* ASThread to use ASDisplayNodeCAssert() instead of assert()
2017-09-22 11:53:41 +01:00
Alex Hüllmandel
76eccbf269 Added attributed versions of accessibilityLabel, accessibilityHint, accessibilityValue (#554)
* Added attributed versions of accessibilityLabel, accessibilityHint and accessibilityValue

* Follow conventions for property types

* Use curly braces

* Update changelog

* Follow conventions for property types in UIView+ASConvenience.h

* Add compatibility for Xcode 8

* Use isEqualToString instead of pointer comparison

* Only allocate attributed strings once. Use _setAttributedAccessibilityToViewAndProperty only for attributed properties.
2017-09-18 18:07:01 +01:00
Sev
d4846dc292 [ASElementMap] Fix indexPath's section or item is actually negative #trivial (#457)
* [ASElementMap] Fix indexPath's section or item is actually negative.

* Small code style changes
2017-09-18 16:18:14 +01:00
appleguy
e330e57668 [ASCornerRounding] Introduce .cornerRoundingType: CALayer, Precomposited, or Clip Corners. (#465)
* [ASCornerRounding] Initial (untested) implementation of ASCornerRounding features.

* [ASCornerRounding] Working version of both clip corners and precomposited corners.

* [ASCornerRounding] Improve factoring and documentation of corner rounding features.

* [ASCornerRounding] Some final fixups.

* Add entry to changelog for .cornerRoundingType
2017-09-18 13:02:51 +01:00
appleguy
cfc48679ba [Yoga] Add insertYogaNode:atIndex: method. Improve handling of relayouts. (#469)
* [Yoga] Add insertYogaNode:atIndex: method. Improve handling of relayouts.

* Add new "version" parameter to Yoga initialization of ASDisplayNodeLayout C++ struct.
2017-09-17 22:45:39 -07:00
Samuel Hsiung
008b847a7a Fix -[ASPagerNode view] triggering pendingState + nodeLoaded assert (#564) 2017-09-13 17:12:46 +01:00
Huy Nguyen
9df6909d71 [ASImageNode] Always dealloc images in a background queue (#561)
* ASImageNode to always dealloc its images in a background queue

* Update CHANGELOG
2017-09-11 13:33:30 -07:00
César Estébanez Tascón
002c2d6978 Mark ASRunLoopQueue as drained if it contains only NULLs (#558)
* Mark ASRunLoopQueue as drained if it contains only NULLs

* Update CHANGELOG.md

* Cover ASRunLoopQueue with tests

* Include PR link in CHANGELOG.md

* Replace license header of ASRunLoopQueueTests.m with correct one

* Insert a nil in _internalQueue to ensure compaction, instead of maintaining a state for _isQueueDrained
2017-09-11 13:32:25 -07:00
Huy Nguyen
7c7a4acf0e ASCollectionLayout to exclude content inset on scrollable directions from viewport size (#562) 2017-09-11 13:32:17 -07:00
Huy Nguyen
fcee108af5 [ASCollectionNode][ASTableNode] Add content inset bridging property (#560)
* Add content inset bridging property to table and collection nodes

* Fix CHANGELOG

* Fix typo

* Minor fixes
2017-09-11 19:20:32 +01:00
Garrett Moon
3c77d4a5da Adds support for specifying a quality indexed array of URLs (#557)
* Add support for downloading a set of URLs on ASNetworkImageNode

* Should be building now;

* Remove old unused code

* Add a changelog message

* Bump PINRemoteImage

* Huy's comments
2017-09-11 11:12:45 -07:00
Huy Nguyen
786963c6a9 [ASDisplayNode] Deprecate -displayWillStart in favor of -displayWillStartAsynchronously: (#536)
* Deprecate -[ASDisplayNode displayWillStart] in favor of -displayWillStartAsynchronously:

* Minor change

* Fix CHANGELOG

* Update CHANGELOG.md

* Update CHANGELOG.md
2017-09-08 18:04:43 +01:00
Huy Nguyen
d4b1f625aa [Gallery layout] Include the caller in properties providing methods (#533)
* Include the caller in ASCollectionGalleryLayoutPropertiesProviding's methods

* Update CHANGELOG.md
2017-09-08 17:05:06 +01:00
Adlai Holler
53e99cc762 Make ASWeakMapEntry Value Atomic (#555)
* Make ASWeakMapEntry value atomic

* Increment changelog

* Go a little nuts

* Update CHANGELOG.md
2017-09-08 15:17:35 +01:00
Eric Scheers
0bd18c8522 [ASDisplayNode] Notify rasterized subnodes that render pass has completed (#532)
* Notify rasterized subsides that render pass has completed

* Traverse entire subnode tree notifying all subnodes

* Add entry in changelog

* Retrieve rasterizesSubtree flag while holding instance lock

* Balance display delegate calls for rasterized subnodes
2017-09-07 21:05:30 +01:00
Huy Nguyen
4ba6f451f6 [Cleanup] Remove deprecated APIs (#529)
* Remove preferredFrameSize

* Remove -measure:

* Remove -measureWithSizeRange:

* Remove ASLayoutable

* Remove .name

* Remove deprecated style forwardings

That includes following properties that are declared on ASDisplayNode and ASLayoutSpec: spacingBefore, spacingAfter, flexGrow, flexShrink, flexBasis, alignSelf, ascender, descender, sizeRange and layoutPosition.

* Remove usesImplicitHierarchyManagement

* Remove deprecated range update callbacks:
-visibilityDidChange:
-visibleStateDidChange:
-displayStateDidChange:
-loadStateDidChange:

* Remove -clearFetchedData

* Remove -cancelLayoutTransitionsInProgress

* Remve ASDisplayNode+Deprecated.h

* Remove ASLayoutRangeTypeRender and ASLayoutRangeTypeFetchData

* Remove -[ASTableView clearContents]

* Remove reloadDataImmediately

* Remove ASStaticLayoutSpec

* Remove ASDimensionDeprecated

* Remove optional -pagerNode:constrainedSizeForNodeAtIndex: delegate method in ASPagerDelegate

* Remove suppressesInvalidCollectionUpdateExceptions

* Remove -[ASCollectionViewLayoutInspector initWithCollectionView]

* Remove ASVideoPlayerNode.loadAssetWhenNodeBecomesVisible

* Update CHANGELOG

* Update license of ASLayoutSpecTests.m

* Update examples/PagerNode

* Remove ASEnvironmentTraitCollection

* Remove -ASViewController.nodeConstrainedSize

* More on removing ASLayoutable
2017-09-07 19:25:42 +01:00
Yan S
19a9d29aa8 SEP-491 prerequisite: add textViewShouldBeginEditing: to ASEditableTextNodeDelegate (#535)
* SEP-491 prerequisite: add textViewShouldBeginEditing: to ASEditableTextNodeDelegate

* - added entry to CHANGELOG.md, addressed nit
2017-08-28 19:49:41 +01:00
appleguy
ccc5786032 [ASCollectionNode] Add -isProcessingUpdates and -onDidFinishProcessingUpdates: APIs. (#522)
* [ASCollectionNode] Add -isProcessingUpdates and -onDidFinishProcessingUpdates: APIs.

Over time, there have actually been a lot of legitimate uses for an API like this.
In fact, I'm not quite sure what has held us back from adding one!

I believe that at least some portion of -wait calls (even if less than 50%) could be
replaced with -onDidFinishProcessingUpdates:, which could potentially improve the
performance of applications using -wait by a significant amount.

Please take a close look at implementation correctness. Although I'm in a bit of a
rush, I'm aiming to make this properly documented and added a basic test -- but it
could certainly use some more detailed testing as a followup.

* [ASCollectionNode] Improvements to the implementation of -isProcessingUpdates and -onDidFinishProcessingUpdates:

* Add lock to ASMainSerialQueue count method.

* [ASTableNode] Implement -isProcessingUpdates and -onDidFinishProcessingUpdates:. Rename -waitUntil to consistent naming.
2017-08-23 11:16:21 +01:00
Adlai Holler
16ce3c9a33 Add a function to disable all logging at runtime (#528)
* Implement a runtime disable for all logging

* Update the changelog

* Inline the function

* Flip the scrip
2017-08-22 14:48:42 -07:00
Huy Nguyen
884a4f56f1 [Table and collection views] Consider content inset when calculating (default) element size range (#525)
* Table and collection views to consider their content inset when calculating element size range

* Update CHANGELOG

* Address comments

* -[ASPagerNode currentPageIndex] to use pageSize instead of bounds

* Update documentation in ASPagerNode

* Minor change
2017-08-22 14:14:01 -07:00
Phil Larson
359b5f0b5b ASImageNode+AnimatedImage playbackReadyCallback retain cycle (#520)
* ASImageNode+AnimatedImage playbackReadyCallback causes strong retain cycle

* Add CHANGELOG entry for #520
2017-08-21 12:49:11 +01:00
appleguy
5cf05f3c17 [Accessibility] Add .isAccessibilityContainer property, allowing automatic aggregation of children's a11y labels. (#468)
After consulting Apple documentation and working with some a11y experts,
we've found that aggregating objects that have a11y labels but are not
themselves interactable is significantly preferred for these users.

It makes it much quicker to navigate scrolling content if VoiceOver only
stops to select entire cells, and then allows drilling down into the cell
to select individual components. This implementation achieves that behavior.

We should consider enabling isAccessibilityContainer by default on ASCellNode.
This would be an improvement for 95% of a11y use cases. Aggregation can be
enabled or disabled on any node.
2017-08-20 13:17:05 -07:00
appleguy
65fabf49d7 [ASImageNode] Enable .clipsToBounds by default (fix .cornerRadius, GIFs overflow). (#466)
* [ASImageNode] Enable .clipsToBounds by default (fix .cornerRadius, GIFs overflow).

We've seen a number of bugs reported over time that .cornerRadius didn't work on
ASNetworkImageNode. This wasn't much of a concern because cornerRadius is very
inefficient anyway, and there are better ways to round corners, but it should
certainly work.

It turns out that clipsToBounds has been off for images, and this ultimately
was behind another issue recently seen wehre decoded GIFs would spill outside
the bounds area to overlap nearby content.

Although there is some risk of behavior change from this, I think the risk
is fairly small, and in most cases it will probably fix behaviors in a way
that doesn't cause problems for the app.

We should consider if this property should be on for all ASDisplayNodes,
but for now it would be a great step to be confident it's on for all
ASImageNodes.

* Update changelog for ImageNode Clipping.
2017-08-20 03:17:46 -07:00
Huy Nguyen
5e13ebac8b ASCollectionLayout improvements (#513)
- During the first layout calculation, measure more than just elements in the visible viewport.
- Remove unnecessary params in `-[ASCollectionLayoutState getAndRemoveUnmeasuredLayoutAttributesPageTableInRect`.]
2017-08-17 15:30:34 +01:00
Huy Nguyen
46e949460a ASCollectionLayout to return a zero content size if its state is unavailable (#509) 2017-08-17 14:43:54 +01:00
Adlai Holler
42b5633bcc Avoid re-entrant call to self.view when applying initial pending state (#510)
* Avoid re-entrant call to .view

* Increment the changelog
2017-08-15 08:04:12 -07:00
Jakub Kašpar
6b3e2ba4e0 [ASCoreAnimationExtras] Update documentation for resizbale images #trivial (#492)
* Update documentation for resizbale images

* Add documentation to ASDisplayNodeSetResizableContents
2017-08-12 08:03:42 -07:00
Adlai Holler
f58b0b3cd3 Rename the field again to nodeModel (#504)
* Rename the field to nodeModel

* A few more instances

* Fix method name
2017-08-10 16:11:12 -07:00