2372 Commits

Author SHA1 Message Date
Michal Ziman
873bae2eed [ASMapNode] Add custom pin annotation for static maps (#1890)
* Adds possibility to have custom annotation pins on static map. This resolves #1889.

* Removes wrong example for map annotations and adds some annotations to correct map example. #1889

* Static map node now uses specific property block to get annotation views.

* Changes self to strongSelf inside of the snapshotters completion block.

* MapNode: Adds statement in documentation.

* MapNode: Block for annotation view/image now returns UIImage and center offset is returned in inout param.

* MapNode and map example: Fixes from review.

* MapNode example: Gets image directly from custom annotation, without creating annotation view.
2016-08-22 10:44:29 -07:00
ricky
c0be871812 [ASViewController] Propagate the traits on willTransitionToTraitCollection (#2115)
Previously we were only propagating the trait collection on `viewWillTransitionToSize` since it is called shortly after `willTransitionToTraitCollection`. However, some important things can happen in that time “shortly after” (like collection view layout). As long as nothing changes from `willTransitionToTraitCollection` to `viewWillTransitionToSize` (which it shouldn’t) the traits will not be re-propagated anyhow.

Also make sure to use the `ASEnvironmentTraitCollectionMakeDefault` method when creating new envTraitCollection so the struct isn’t filled with junk.
2016-08-22 10:06:53 -07:00
Yue-Wang-Google
a38f3db6b0 set the right attributes for block properties. (#2113)
* set the right attributes for block properties.

* oops. should remove strong.

* Update ASImageNode.mm

* revert to use copy for blocks. See apple documentation below

https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC/WorkingwithBlocks/WorkingwithBlocks.html#//apple_ref/doc/uid/TP40011210-CH8-SW12

* make the block properties nonatomic.
2016-08-21 13:06:21 -07:00
Yue-Wang-Google
1951954ba5 remove non unicode char (#2109)
see https://github.com/facebook/AsyncDisplayKit/issues/2108
2016-08-19 17:51:41 -07:00
Adlai Holler
69e73065e5 Avoid accessing itemCountsFromDataSource off-main (#2106) 2016-08-19 12:10:19 -07:00
Adlai Holler
fa3a988b54 [ASPagerNode] Rename constrainedSizeForNodeAtIndexPath: to constrainedSizeForNodeAtIndex: for consistency (#2097) 2016-08-19 11:47:56 -07:00
Adlai Holler
0bd664f9ed Remove numberOfSectionsForSupplementaryNodeOfKind: Method (#2102)
* Add unit test to confirm that supplementary items must be contained within actual sections

* [ASLayoutInspecting] Deprecate collectionView:numberOfSectionsForSupplementaryNodeOfKind:

* Add another test to dig deeper into UICollectionView
2016-08-19 11:18:31 -07:00
Hannah Trosi
971d43ad4d [Build settings] add missing newlines at end of file 2016-08-18 15:01:41 -07:00
Michael Schneider
c409e79714 Fix accessibleElements warning in _ASDisplayView (#2100) 2016-08-18 13:12:19 -07:00
Adlai Holler
f61b7d5d5d [ASDisplayView] Remove some gunk (#2095) 2016-08-18 10:16:09 -07:00
Adlai Holler
00af76226d [ASDisplayNode] Clarify logic around calling setNeedsDisplay (#2094) 2016-08-18 09:45:43 -07:00
Adlai Holler
4baffea8f6 [ASTableView] Ignore table view cell layouts when there's no node assigned (#2091) 2016-08-17 19:58:40 -07:00
Garrett Moon
86d2ab617e I didn't really understand NSProxy (#2089)
* I didn't really understand NSProxy

But I think I do now :)

Previously I inherited from NSObject because I didn't think I needed
anything fancy, but it turns out NSProxy is *less* fancy than NSObject
and allows for overriding more methods. This change is probably purely
academic in that we don't use this class to forward NSObject specific
messages, but I believe this is the 'right thing'.

* Update comment, thanks @maicki!
2016-08-17 17:59:28 -07:00
Adlai Holler
99574a728c Make our snapshot testing possible without framework-private access, simplify (#2083) 2016-08-17 17:42:37 -07:00
Garrett Moon
7d21ccc184 [_ASDisplayViewAccessiblity] Fix accessibility in scroll views (#2079)
* Fixes issues with accessibility elements in scroll views

There are two changes here:

1. Because we can't reliably update the screen positions of accessibility elements
contained within a scroll view, we need to calculate them on demand, so we override
the accessibilityFrame method to do that.

2. Throwing away our calculated accessibility elements on frame change seemed to
cause the accessibility system to be confused.

Combining these two fixes together results in success, yay!

* Don't set the accessibilityFrame, getter is overridden.
2016-08-16 17:01:06 -07:00
Adlai Holler
05dba2263c Make ASWeakSet and NSArray+Diffing public, add support for large arrays (#2078) 2016-08-16 16:47:26 -07:00
Garrett Moon
eb497b7db1 ASCellNode was overriding old deprecated methods
It needs to override the new signatures as well.
2016-08-16 15:40:55 -07:00
Michael Schneider
c65b2efed7 [_ASDisplayViewAccessiblity] Improve accessibility support (#2060)
* First approach to improve accessiblity

* Clear accessibleElements in addSubview: and willRemoveSubview:

* Adjust comments and rename viewNode to node

* Create new accessible elements if screen coordinates of view changes

* Remove legacy clearing of accessibleElements

* Performance improvements

* Use bounds for screenFrame calculation and indexOfObjectIdentical: in indexOfAccessiblityElement:

* Add ASDK_ACCESSIBILITY_DISABLE compiler flag to disable custom accessibility code in ASDK

* No need to set a frame if a subnode view is an accessibility element and not layer backed
2016-08-16 10:27:14 -07:00
Hannah Troisi
14ccb0b886 [ASTextNode] placeholder image shouldn't draw for zero area strings (#2069)
* placeholder should not draw if area is zero

* styling fix

* super precision
2016-08-16 10:20:59 -07:00
Nikita Lutsenko
2091df9607 [ASTextNode] Fix highlighting when textContainerInsets are set. (#2073)
* [ASTextNode] Fix highlighting when textContainerInsets are set.

* Add ASTextNodeSnapshotTests to xcodeproj.

* Add snapshot test for container inset and highlighting.
2016-08-16 10:18:51 -07:00
Michael Schneider
365f739ce7 Fix ASPagerNode delegate and data source warning (#2076) 2016-08-15 20:58:50 -07:00
Michael Schneider
067e4998e2 Fix methods from ASCollectionDelegate are not passed through to pager delegate (#2074) 2016-08-15 17:23:39 -07:00
Michael Schneider
ee87695fc8 Don't use the default layout transition animation of no animation is wanted (#2075) 2016-08-15 17:23:02 -07:00
Michael Schneider
11215bf97f [Automatic Hierarchy Management] Rename IHM to automatic hierarchy management and move out of beta header (#2066)
* Rename automaticHierarchy to automaticallyManagesSubnodes

* Comment adjustments
2016-08-15 12:06:06 -07:00
David Rodrigues
f05ccea860 Fix wrong annotation which is causing a warning at compile time (#2072) 2016-08-15 11:26:10 -07:00
Michael Schneider
adcc9afb5a [Layout Transition] Add default fade in / out layout transition (#2052)
* Add default fade in / out layout transition

* Add example for layout transition

* Update for recent layout transition API changes

* To be able to do a layoutTransition the node needs to be loaded

* Rename layoutTransitionDuration to defaultLayoutTransitionDuration

* Expose default layout transition duration delay and options

* Use `UIViewAnimationOptionBeginFromCurrentState` for initial defaultLayoutTransitionOptions
2016-08-13 17:35:20 -07:00
Maximilian Szengel
43370fe6ff Expose AVPlayerLayer on ASVideoNode (#2028)
The playerLayer is needed for picture in picture support on the iPad (AVPictureInPictureController).
2016-08-13 17:28:19 -07:00
Michael Schneider
93be894e0c [ASCollectionView / ASPagerNode] Move constrainedSizeForNodeAtIndexPath from the DataSource to the Delegate (#2065)
* Move constrainedSizeForNodeAtIndexPath from the DataSource to the Delegate in ASCollectionView and ASPagerNode

* Fix ASPagerNode declaration of dataSource and delegate

As ASPagerDataSource does not inherit from ASCollectionDataSource it's not possible to declare it as property.

* Update comment
2016-08-12 15:37:23 -07:00
Garrett Moon
2c9e51e8f7 Add support for textContainerInset to ASTextNode (ala UITextView) (#2062)
* Add support for textContainerInset to ASTextNode (ala UITextView)

* Better comment, parens to increase readability. Thanks @schneider!

* Add textContainerInset snapshot test.
2016-08-12 12:07:00 -07:00
Flo
39cb188b9e [ASVideoNode] Improve playerStatus behaviour and image generation (#2024)
* [ASVideoNode] Use the videoComposition when generating images.

* [ASVideoNode] Improve playerState behaviour.

* [ASVideoNode] Use KVO on _player.rate to determine the playerState.
2016-08-12 12:06:02 -07:00
Hannah Troisi
3c0fea80ef Merge pull request #2023 from maicki/MSLayoutTransitionAPINaming
[Layout Transition API] Move Transition Layout API out of beta header and remove shouldMeasureAsync from API
2016-08-11 21:17:54 -07:00
Hannah Troisi
2040674aed Merge pull request #1767 from facebook/AHPercentToFraction
[ASRelativeDimensionType] Replace "percent" with "fraction" Where Appropriate
2016-08-11 20:33:34 -07:00
Adlai Holler
aedb83cfe3 [ASDataController] Remove Unused Batch Update Processing Code (#2054)
* [ASDataController] Remove dead batch updating code

* Address PR comments
2016-08-11 11:48:17 -07:00
Hannah Troisi
2afd063b10 [ASRangeController] Debug overlay to show the size and direction of display + fetchData ranges during scrolling. (#2008)
* Rebase ASRangeController diff with master.

* fix Table / CollectionNode debug label names
- now returns class names rather than generic ASTableNode, ASPagerNode
- ASPagerNode will be labeled as ASPagerNodeProxy (not sure how to get around this)

* refactor layout code: use ASDk's own resizeableRoundedCorner... methods

* Fixes and cleanup for manual layout version of range controller debug overlay.

I am working on a layout spec-based version, but it has some issues, so landing this to get the near-term value is probably the best next step.

* Remove .orig and .rej files.

* One last .orig file to remove.

* Final project file cleanup and tweaks to implementation for ASTableNode.

* fix build issues

* fix arrow directions
2016-08-11 11:23:07 -07:00
Hannah Troisi
7494b114aa Merge pull request #2041 from maicki/MSLayoutSpecChildChildrenProperty
[ASLayoutSpec] Make child and children a property
2016-08-11 10:56:31 -07:00
Adlai Holler
3f77a3d46c More Percent -> Fraction 2016-08-11 10:37:48 -07:00
Adlai Holler
e80a82f832 [ASDataController] Bail on waitUntilUpdatesAreCommitted if batch updating (#2053) 2016-08-10 14:51:10 -07:00
Michael Schneider
b84be07776 Make child and children on ASLayoutSpec a property 2016-08-10 10:33:13 -07:00
Michael Schneider
32058815f2 Move Transition Layout API out of beta header and remove shouldMeasureAsync from API
shouldMeasureAsync is enabled by default now.
2016-08-10 10:30:25 -07:00
Adlai Holler
eb9f86cfdb Replace "percent" with "fraction" where appropriate 2016-08-10 10:26:21 -07:00
Adlai Holler
49b65fd783 Revert "Fix if pending layout will be deallocated (#2038)" (#2051)
This reverts commit 2804d50220dabebc62b088b17d5ffe2347da1e36.
2016-08-09 16:10:21 -07:00
Hannah Troisi
893e601e81 Convert to type-generic math (#2050)
* [Optimization] Convert to type-generic math

* add std:: prefix in obj-c++ files

* more cleanup

* revert test changes

* convert min and max back to fmin/fmax
2016-08-09 15:31:37 -07:00
Michael Schneider
aba05a747c [ASThread] Add SharedLocker and SharedUnlocker that uses a shared pointer for the mutex (#2047)
* Add SharedLocker and SharedUnlocker that uses a shared pointer for the mutex

* Move ASTextKitContext to use Shared Locker
2016-08-09 15:20:31 -07:00
Michael Schneider
d9db780b0b [ASTextNode] Fix ASTextNode shadow is not rendering (#2042)
* Passing through shadow in renderer attribute

* Fix memory leak setting shadow color
2016-08-09 14:56:59 -07:00
Hannah Troisi
03c74452b2 [ASImageNode] fix scaling math (#2045)
* fix ASImageNode scaling

* convert to type-generic math
2016-08-09 13:45:19 -07:00
Michael Schneider
024b8afef5 Move NS_ASSUME_NONNULL_END to the end of the ASDisplayNode header (#2046) 2016-08-09 13:06:01 -07:00
Adlai Holler
1fbf8ad073 [ASDataController] Cancel if we lose our data source, fix bugs (#1987)
[ASRangeController] We're already on main thread, remove blocks

Make data source read-only, clarify what's asynchronous

[ASDataController] Clean up some interfaces

[ASDataController] A little more cleanup

[ASDataController] Cleanup

[ASDataController] Restore some changes, exit more often

[ASDataController] Use item counts that we already have rather than requerying them

[ASDataController] Revert weakifications

[ASDataController] Add a mechanism to measure how much work we avoided
2016-08-05 15:39:33 -07:00
ricky
39da5d2cb0 [ASTraitCollection] propagate window container size via ASTraitCollection in iOS7 (#2019) 2016-08-05 10:34:13 -07:00
Michael Schneider
2804d50220 Fix if pending layout will be deallocated (#2038)
The pending layout transition needs to stay alive at least until applySubnodeInsertions did finish execute as it can happen that with Implicit Hierarchy Management new nodes gonna be added that internally call setNeedsLayout what will invalidate and deallocate the transition in the middle of inserting nodes
2016-08-05 10:25:50 -07:00
David Rodrigues
70574243f7 Prevent API misuse at compile time (#2035)
Using Objective-C attributes, in this case `unavailable`, we can hide
unsupported APIs at compile time instead of detecting and warn about it
at runtime with a set of asserts.
2016-08-04 19:00:46 -07:00