diff --git a/.gitignore b/.gitignore index adb7e5eecc..d30811860a 100644 --- a/.gitignore +++ b/.gitignore @@ -19,8 +19,6 @@ build *.swp -*.lock - *.gcov *.gcno *.gcda diff --git a/ASDK-Licenses/LICENSE b/ASDK-Licenses/LICENSE deleted file mode 100644 index 507edbd628..0000000000 --- a/ASDK-Licenses/LICENSE +++ /dev/null @@ -1,30 +0,0 @@ -BSD License - -For AsyncDisplayKit software - -Copyright (c) 2014-present, Facebook, Inc. All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name Facebook nor the names of its contributors may be used to - endorse or promote products derived from this software without specific - prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/ASDK-Licenses/PATENTS b/ASDK-Licenses/PATENTS deleted file mode 100644 index ce9e31cee3..0000000000 --- a/ASDK-Licenses/PATENTS +++ /dev/null @@ -1,33 +0,0 @@ -Additional Grant of Patent Rights Version 2 - -"Software" means the AsyncDisplayKit software distributed by Facebook, Inc. - -Facebook, Inc. ("Facebook") hereby grants to each recipient of the Software -("you") a perpetual, worldwide, royalty-free, non-exclusive, irrevocable -(subject to the termination provision below) license under any Necessary -Claims, to make, have made, use, sell, offer to sell, import, and otherwise -transfer the Software. For avoidance of doubt, no license is granted under -Facebook's rights in any patent claims that are infringed by (i) modifications -to the Software made by you or any third party or (ii) the Software in -combination with any software or other technology. - -The license granted hereunder will terminate, automatically and without notice, -if you (or any of your subsidiaries, corporate affiliates or agents) initiate -directly or indirectly, or take a direct financial interest in, any Patent -Assertion: (i) against Facebook or any of its subsidiaries or corporate -affiliates, (ii) against any party if such Patent Assertion arises in whole or -in part from any software, technology, product or service of Facebook or any of -its subsidiaries or corporate affiliates, or (iii) against any party relating -to the Software. Notwithstanding the foregoing, if Facebook or any of its -subsidiaries or corporate affiliates files a lawsuit alleging patent -infringement against you in the first instance, and you respond by filing a -patent infringement counterclaim in that lawsuit against that party that is -unrelated to the Software, the license granted hereunder will not terminate -under section (i) of this paragraph due to such counterclaim. - -A "Necessary Claim" is a claim of a patent owned by Facebook that is -necessarily infringed by the Software standing alone. - -A "Patent Assertion" is any lawsuit or other action alleging direct, indirect, -or contributory infringement or inducement to infringe any patent, including a -cross-claim or counterclaim. diff --git a/AsyncDisplayKit.xcodeproj/project.pbxproj b/AsyncDisplayKit.xcodeproj/project.pbxproj index 9045dccc09..f5a16279d9 100644 --- a/AsyncDisplayKit.xcodeproj/project.pbxproj +++ b/AsyncDisplayKit.xcodeproj/project.pbxproj @@ -31,6 +31,8 @@ 058D0A40195D057000B7D73C /* ASTextNodeTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 058D0A36195D057000B7D73C /* ASTextNodeTests.m */; }; 058D0A41195D057000B7D73C /* ASTextNodeWordKernerTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 058D0A37195D057000B7D73C /* ASTextNodeWordKernerTests.mm */; }; 05EA6FE71AC0966E00E35788 /* ASSnapshotTestCase.m in Sources */ = {isa = PBXBuildFile; fileRef = 05EA6FE61AC0966E00E35788 /* ASSnapshotTestCase.m */; }; + 0FAFDF7520EC1C90003A51C0 /* ASLayout+IGListKit.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FAFDF7320EC1C8F003A51C0 /* ASLayout+IGListKit.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 0FAFDF7620EC1C90003A51C0 /* ASLayout+IGListKit.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0FAFDF7420EC1C90003A51C0 /* ASLayout+IGListKit.mm */; }; 18C2ED7F1B9B7DE800F627B3 /* ASCollectionNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 18C2ED7C1B9B7DE800F627B3 /* ASCollectionNode.h */; settings = {ATTRIBUTES = (Public, ); }; }; 18C2ED831B9B7DE800F627B3 /* ASCollectionNode.mm in Sources */ = {isa = PBXBuildFile; fileRef = 18C2ED7D1B9B7DE800F627B3 /* ASCollectionNode.mm */; }; 1A6C000D1FAB4E2100D05926 /* ASCornerLayoutSpec.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A6C000B1FAB4E2000D05926 /* ASCornerLayoutSpec.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -108,13 +110,14 @@ 509E68641B3AEDB7009B9150 /* ASCollectionViewLayoutController.m in Sources */ = {isa = PBXBuildFile; fileRef = 205F0E1C1B373A2C007741D0 /* ASCollectionViewLayoutController.m */; }; 509E68651B3AEDC5009B9150 /* CoreGraphics+ASConvenience.h in Headers */ = {isa = PBXBuildFile; fileRef = 205F0E1F1B376416007741D0 /* CoreGraphics+ASConvenience.h */; settings = {ATTRIBUTES = (Public, ); }; }; 509E68661B3AEDD7009B9150 /* CoreGraphics+ASConvenience.m in Sources */ = {isa = PBXBuildFile; fileRef = 205F0E201B376416007741D0 /* CoreGraphics+ASConvenience.m */; }; - 636EA1A41C7FF4EC00EE152F /* NSArray+Diffing.m in Sources */ = {isa = PBXBuildFile; fileRef = DBC452DA1C5BF64600B16017 /* NSArray+Diffing.m */; }; + 636EA1A41C7FF4EC00EE152F /* NSArray+Diffing.mm in Sources */ = {isa = PBXBuildFile; fileRef = DBC452DA1C5BF64600B16017 /* NSArray+Diffing.mm */; }; 636EA1A51C7FF4EF00EE152F /* ASDefaultPlayButton.m in Sources */ = {isa = PBXBuildFile; fileRef = AEB7B0191C5962EA00662EF4 /* ASDefaultPlayButton.m */; }; 680346941CE4052A0009FEB4 /* ASNavigationController.h in Headers */ = {isa = PBXBuildFile; fileRef = 68FC85DC1CE29AB700EDD713 /* ASNavigationController.h */; settings = {ATTRIBUTES = (Public, ); }; }; 68355B341CB579B9001D4E68 /* ASImageNode+AnimatedImage.mm in Sources */ = {isa = PBXBuildFile; fileRef = 68355B2E1CB5799E001D4E68 /* ASImageNode+AnimatedImage.mm */; }; 68355B3E1CB57A60001D4E68 /* ASPINRemoteImageDownloader.m in Sources */ = {isa = PBXBuildFile; fileRef = 68355B361CB57A5A001D4E68 /* ASPINRemoteImageDownloader.m */; }; 68355B401CB57A69001D4E68 /* ASImageContainerProtocolCategories.m in Sources */ = {isa = PBXBuildFile; fileRef = 68355B381CB57A5A001D4E68 /* ASImageContainerProtocolCategories.m */; }; 68355B411CB57A6C001D4E68 /* ASImageContainerProtocolCategories.h in Headers */ = {isa = PBXBuildFile; fileRef = 68355B371CB57A5A001D4E68 /* ASImageContainerProtocolCategories.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 683F563720E409D700CEB7A3 /* ASDisplayNode+InterfaceState.h in Headers */ = {isa = PBXBuildFile; fileRef = 683F563620E409D600CEB7A3 /* ASDisplayNode+InterfaceState.h */; settings = {ATTRIBUTES = (Public, ); }; }; 68AF37DB1CBEF4D80077BF76 /* ASImageNode+AnimatedImagePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 68B8A4DB1CBD911D007E4543 /* ASImageNode+AnimatedImagePrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; 68B0277B1C1A79D60041016B /* ASDisplayNode+Beta.h in Headers */ = {isa = PBXBuildFile; fileRef = 68B027791C1A79CC0041016B /* ASDisplayNode+Beta.h */; settings = {ATTRIBUTES = (Public, ); }; }; 68B8A4E21CBDB958007E4543 /* ASWeakProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 68B8A4DF1CBDB958007E4543 /* ASWeakProxy.h */; settings = {ATTRIBUTES = (Private, ); }; }; @@ -131,6 +134,8 @@ 6900C5F41E8072DA00BCD75C /* ASImageNode+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 6900C5F31E8072DA00BCD75C /* ASImageNode+Private.h */; }; 6907C2581DC4ECFE00374C66 /* ASObjectDescriptionHelpers.h in Headers */ = {isa = PBXBuildFile; fileRef = 6907C2561DC4ECFE00374C66 /* ASObjectDescriptionHelpers.h */; settings = {ATTRIBUTES = (Public, ); }; }; 6907C25A1DC4ECFE00374C66 /* ASObjectDescriptionHelpers.m in Sources */ = {isa = PBXBuildFile; fileRef = 6907C2571DC4ECFE00374C66 /* ASObjectDescriptionHelpers.m */; }; + 690BC8C120F6D3490052A434 /* ASDisplayNodeCornerLayerDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 690BC8BF20F6D3490052A434 /* ASDisplayNodeCornerLayerDelegate.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 690BC8C220F6D3490052A434 /* ASDisplayNodeCornerLayerDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 690BC8C020F6D3490052A434 /* ASDisplayNodeCornerLayerDelegate.m */; }; 690C35621E055C5D00069B91 /* ASDimensionInternal.mm in Sources */ = {isa = PBXBuildFile; fileRef = 690C35601E055C5D00069B91 /* ASDimensionInternal.mm */; }; 690C35641E055C7B00069B91 /* ASDimensionInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 690C35631E055C7B00069B91 /* ASDimensionInternal.h */; settings = {ATTRIBUTES = (Public, ); }; }; 690ED58E1E36BCA6000627C0 /* ASLayoutElementStylePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 690ED58D1E36BCA6000627C0 /* ASLayoutElementStylePrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; @@ -143,7 +148,6 @@ 6947B0C01E36B4E30007C478 /* ASStackUnpositionedLayout.mm in Sources */ = {isa = PBXBuildFile; fileRef = 6947B0BD1E36B4E30007C478 /* ASStackUnpositionedLayout.mm */; }; 6947B0C31E36B5040007C478 /* ASStackPositionedLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = 6947B0C11E36B5040007C478 /* ASStackPositionedLayout.h */; settings = {ATTRIBUTES = (Private, ); }; }; 6947B0C51E36B5040007C478 /* ASStackPositionedLayout.mm in Sources */ = {isa = PBXBuildFile; fileRef = 6947B0C21E36B5040007C478 /* ASStackPositionedLayout.mm */; }; - 6959433F1D70815300B0EE1F /* ASDisplayNodeLayout.mm in Sources */ = {isa = PBXBuildFile; fileRef = 6959433C1D70815300B0EE1F /* ASDisplayNodeLayout.mm */; }; 695943401D70815300B0EE1F /* ASDisplayNodeLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = 6959433D1D70815300B0EE1F /* ASDisplayNodeLayout.h */; settings = {ATTRIBUTES = (Private, ); }; }; 695BE2551DC1245C008E6EA5 /* ASWrapperSpecSnapshotTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 695BE2541DC1245C008E6EA5 /* ASWrapperSpecSnapshotTests.mm */; }; 696F01EC1DD2AF450049FBD5 /* ASEventLog.h in Headers */ = {isa = PBXBuildFile; fileRef = 696F01EA1DD2AF450049FBD5 /* ASEventLog.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -153,7 +157,7 @@ 697796611D8AC8D3007E93D7 /* ASLayoutSpec+Subclasses.mm in Sources */ = {isa = PBXBuildFile; fileRef = 6977965E1D8AC8D3007E93D7 /* ASLayoutSpec+Subclasses.mm */; }; 697B315A1CFE4B410049936F /* ASEditableTextNodeTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 697B31591CFE4B410049936F /* ASEditableTextNodeTests.m */; }; 698371DB1E4379CD00437585 /* ASNodeController+Beta.h in Headers */ = {isa = PBXBuildFile; fileRef = 698371D91E4379CD00437585 /* ASNodeController+Beta.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 698371DC1E4379CD00437585 /* ASNodeController+Beta.m in Sources */ = {isa = PBXBuildFile; fileRef = 698371DA1E4379CD00437585 /* ASNodeController+Beta.m */; }; + 698371DC1E4379CD00437585 /* ASNodeController+Beta.mm in Sources */ = {isa = PBXBuildFile; fileRef = 698371DA1E4379CD00437585 /* ASNodeController+Beta.mm */; }; 698C8B621CAB49FC0052DC3F /* ASLayoutElementExtensibility.h in Headers */ = {isa = PBXBuildFile; fileRef = 698C8B601CAB49FC0052DC3F /* ASLayoutElementExtensibility.h */; settings = {ATTRIBUTES = (Public, ); }; }; 698DFF441E36B6C9002891F1 /* ASStackLayoutSpecUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 698DFF431E36B6C9002891F1 /* ASStackLayoutSpecUtilities.h */; settings = {ATTRIBUTES = (Private, ); }; }; 698DFF471E36B7E9002891F1 /* ASLayoutSpecUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 698DFF461E36B7E9002891F1 /* ASLayoutSpecUtilities.h */; settings = {ATTRIBUTES = (Private, ); }; }; @@ -180,8 +184,6 @@ 8BBBAB8D1CEBAF1E00107FC6 /* ASDefaultPlaybackButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 8B0768B21CE752EC002E1453 /* ASDefaultPlaybackButton.m */; }; 8BDA5FC71CDBDF91007D13B2 /* ASVideoPlayerNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 8BDA5FC31CDBDDE1007D13B2 /* ASVideoPlayerNode.h */; settings = {ATTRIBUTES = (Public, ); }; }; 8BDA5FC81CDBDF95007D13B2 /* ASVideoPlayerNode.mm in Sources */ = {isa = PBXBuildFile; fileRef = 8BDA5FC41CDBDDE1007D13B2 /* ASVideoPlayerNode.mm */; }; - 9019FBBD1ED8061D00C45F72 /* ASYogaLayoutSpec.h in Headers */ = {isa = PBXBuildFile; fileRef = 9019FBB91ED8061D00C45F72 /* ASYogaLayoutSpec.h */; }; - 9019FBBE1ED8061D00C45F72 /* ASYogaLayoutSpec.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9019FBBA1ED8061D00C45F72 /* ASYogaLayoutSpec.mm */; }; 9019FBBF1ED8061D00C45F72 /* ASYogaUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 9019FBBB1ED8061D00C45F72 /* ASYogaUtilities.h */; }; 9019FBC01ED8061D00C45F72 /* ASYogaUtilities.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9019FBBC1ED8061D00C45F72 /* ASYogaUtilities.mm */; }; 909C4C751F09C98B00D6B76F /* ASTextNode2.h in Headers */ = {isa = PBXBuildFile; fileRef = 909C4C731F09C98B00D6B76F /* ASTextNode2.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -225,6 +227,7 @@ ACF6ED611B178DC700DA7C62 /* ASOverlayLayoutSpecSnapshotTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = ACF6ED591B178DC700DA7C62 /* ASOverlayLayoutSpecSnapshotTests.mm */; }; ACF6ED621B178DC700DA7C62 /* ASRatioLayoutSpecSnapshotTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = ACF6ED5A1B178DC700DA7C62 /* ASRatioLayoutSpecSnapshotTests.mm */; }; ACF6ED631B178DC700DA7C62 /* ASStackLayoutSpecSnapshotTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = ACF6ED5B1B178DC700DA7C62 /* ASStackLayoutSpecSnapshotTests.mm */; }; + AE440175210FB7CF00B36DA2 /* ASTextKitFontSizeAdjusterTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = AE440174210FB7CF00B36DA2 /* ASTextKitFontSizeAdjusterTests.mm */; }; AE6987C11DD04E1000B9E458 /* ASPagerNodeTests.m in Sources */ = {isa = PBXBuildFile; fileRef = AE6987C01DD04E1000B9E458 /* ASPagerNodeTests.m */; }; AEEC47E41C21D3D200EC1693 /* ASVideoNodeTests.m in Sources */ = {isa = PBXBuildFile; fileRef = AEEC47E31C21D3D200EC1693 /* ASVideoNodeTests.m */; }; B13CA0F81C519EBA00E031AB /* ASCollectionViewLayoutFacilitatorProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = B13CA0F61C519E9400E031AB /* ASCollectionViewLayoutFacilitatorProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -332,6 +335,9 @@ CC224E962066CA6D00BBA57F /* configuration.json in Resources */ = {isa = PBXBuildFile; fileRef = CC224E952066CA6D00BBA57F /* configuration.json */; }; CC2F65EE1E5FFB1600DA57C9 /* ASMutableElementMap.h in Headers */ = {isa = PBXBuildFile; fileRef = CC2F65EC1E5FFB1600DA57C9 /* ASMutableElementMap.h */; }; CC2F65EF1E5FFB1600DA57C9 /* ASMutableElementMap.m in Sources */ = {isa = PBXBuildFile; fileRef = CC2F65ED1E5FFB1600DA57C9 /* ASMutableElementMap.m */; }; + CC35CEC320DD7F600006448D /* ASCollections.h in Headers */ = {isa = PBXBuildFile; fileRef = CC35CEC120DD7F600006448D /* ASCollections.h */; settings = {ATTRIBUTES = (Public, ); }; }; + CC35CEC420DD7F600006448D /* ASCollections.m in Sources */ = {isa = PBXBuildFile; fileRef = CC35CEC220DD7F600006448D /* ASCollections.m */; }; + CC35CEC620DD87280006448D /* ASCollectionsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = CC35CEC520DD87280006448D /* ASCollectionsTests.m */; }; CC3B20841C3F76D600798563 /* ASPendingStateController.h in Headers */ = {isa = PBXBuildFile; fileRef = CC3B20811C3F76D600798563 /* ASPendingStateController.h */; settings = {ATTRIBUTES = (Private, ); }; }; CC3B20861C3F76D600798563 /* ASPendingStateController.mm in Sources */ = {isa = PBXBuildFile; fileRef = CC3B20821C3F76D600798563 /* ASPendingStateController.mm */; }; CC3B208A1C3F7A5400798563 /* ASWeakSet.h in Headers */ = {isa = PBXBuildFile; fileRef = CC3B20871C3F7A5400798563 /* ASWeakSet.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -452,9 +458,6 @@ DECBD6EA1BE56E1900CF4905 /* ASButtonNode.mm in Sources */ = {isa = PBXBuildFile; fileRef = DECBD6E61BE56E1900CF4905 /* ASButtonNode.mm */; }; DEFAD8131CC48914000527C4 /* ASVideoNode.mm in Sources */ = {isa = PBXBuildFile; fileRef = AEEC47E01C20C2DD00EC1693 /* ASVideoNode.mm */; }; E51B78BF1F028ABF00E32604 /* ASLayoutFlatteningTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E51B78BD1F01A0EE00E32604 /* ASLayoutFlatteningTests.m */; }; - E52AC9BA1FEA90EB00AA4040 /* ASRectMap.mm in Sources */ = {isa = PBXBuildFile; fileRef = E52AC9B81FEA90EB00AA4040 /* ASRectMap.mm */; }; - E52AC9BB1FEA90EB00AA4040 /* ASRectMap.h in Headers */ = {isa = PBXBuildFile; fileRef = E52AC9B91FEA90EB00AA4040 /* ASRectMap.h */; settings = {ATTRIBUTES = (Private, ); }; }; - E52AC9C01FEA916C00AA4040 /* ASRectMapTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E52AC9BE1FEA915D00AA4040 /* ASRectMapTests.m */; }; E54E00721F1D3828000B30D7 /* ASPagerNode+Beta.h in Headers */ = {isa = PBXBuildFile; fileRef = E54E00711F1D3828000B30D7 /* ASPagerNode+Beta.h */; settings = {ATTRIBUTES = (Public, ); }; }; E54E81FC1EB357BD00FFE8E1 /* ASPageTable.h in Headers */ = {isa = PBXBuildFile; fileRef = E54E81FA1EB357BD00FFE8E1 /* ASPageTable.h */; }; E54E81FD1EB357BD00FFE8E1 /* ASPageTable.m in Sources */ = {isa = PBXBuildFile; fileRef = E54E81FB1EB357BD00FFE8E1 /* ASPageTable.m */; }; @@ -490,6 +493,7 @@ E5E281761E71C845006B67C2 /* ASCollectionLayoutState.mm in Sources */ = {isa = PBXBuildFile; fileRef = E5E281751E71C845006B67C2 /* ASCollectionLayoutState.mm */; }; E5E2D72E1EA780C4005C24C6 /* ASCollectionGalleryLayoutDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = E5E2D72D1EA780C4005C24C6 /* ASCollectionGalleryLayoutDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; }; E5E2D7301EA780DF005C24C6 /* ASCollectionGalleryLayoutDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = E5E2D72F1EA780DF005C24C6 /* ASCollectionGalleryLayoutDelegate.mm */; }; + F3F698D2211CAD4600800CB1 /* ASDisplayViewAccessibilityTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = F3F698D1211CAD4600800CB1 /* ASDisplayViewAccessibilityTests.mm */; }; F711994E1D20C21100568860 /* ASDisplayNodeExtrasTests.m in Sources */ = {isa = PBXBuildFile; fileRef = F711994D1D20C21100568860 /* ASDisplayNodeExtrasTests.m */; }; FA4FAF15200A850200E735BD /* ASControlNode+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = FA4FAF14200A850200E735BD /* ASControlNode+Private.h */; }; /* End PBXBuildFile section */ @@ -599,6 +603,8 @@ 058D0A44195D058D00B7D73C /* ASBaseDefines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASBaseDefines.h; sourceTree = ""; }; 05EA6FE61AC0966E00E35788 /* ASSnapshotTestCase.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASSnapshotTestCase.m; sourceTree = ""; }; 05F20AA31A15733C00DCA68A /* ASImageProtocols.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASImageProtocols.h; sourceTree = ""; }; + 0FAFDF7320EC1C8F003A51C0 /* ASLayout+IGListKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "ASLayout+IGListKit.h"; sourceTree = ""; }; + 0FAFDF7420EC1C90003A51C0 /* ASLayout+IGListKit.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "ASLayout+IGListKit.mm"; sourceTree = ""; }; 18C2ED7C1B9B7DE800F627B3 /* ASCollectionNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASCollectionNode.h; sourceTree = ""; }; 18C2ED7D1B9B7DE800F627B3 /* ASCollectionNode.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASCollectionNode.mm; sourceTree = ""; }; 1950C4481A3BB5C1005C8279 /* ASEqualityHelpers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASEqualityHelpers.h; sourceTree = ""; }; @@ -667,6 +673,7 @@ 68355B371CB57A5A001D4E68 /* ASImageContainerProtocolCategories.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASImageContainerProtocolCategories.h; sourceTree = ""; }; 68355B381CB57A5A001D4E68 /* ASImageContainerProtocolCategories.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASImageContainerProtocolCategories.m; sourceTree = ""; }; 68355B391CB57A5A001D4E68 /* ASPINRemoteImageDownloader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASPINRemoteImageDownloader.h; sourceTree = ""; }; + 683F563620E409D600CEB7A3 /* ASDisplayNode+InterfaceState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "ASDisplayNode+InterfaceState.h"; sourceTree = ""; }; 68B027791C1A79CC0041016B /* ASDisplayNode+Beta.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "ASDisplayNode+Beta.h"; sourceTree = ""; }; 68B8A4DB1CBD911D007E4543 /* ASImageNode+AnimatedImagePrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "ASImageNode+AnimatedImagePrivate.h"; sourceTree = ""; }; 68B8A4DF1CBDB958007E4543 /* ASWeakProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASWeakProxy.h; sourceTree = ""; }; @@ -684,6 +691,8 @@ 6900C5F31E8072DA00BCD75C /* ASImageNode+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "ASImageNode+Private.h"; sourceTree = ""; }; 6907C2561DC4ECFE00374C66 /* ASObjectDescriptionHelpers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASObjectDescriptionHelpers.h; sourceTree = ""; }; 6907C2571DC4ECFE00374C66 /* ASObjectDescriptionHelpers.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASObjectDescriptionHelpers.m; sourceTree = ""; }; + 690BC8BF20F6D3490052A434 /* ASDisplayNodeCornerLayerDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ASDisplayNodeCornerLayerDelegate.h; sourceTree = ""; }; + 690BC8C020F6D3490052A434 /* ASDisplayNodeCornerLayerDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ASDisplayNodeCornerLayerDelegate.m; sourceTree = ""; }; 690C35601E055C5D00069B91 /* ASDimensionInternal.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASDimensionInternal.mm; sourceTree = ""; }; 690C35631E055C7B00069B91 /* ASDimensionInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASDimensionInternal.h; sourceTree = ""; }; 690ED58D1E36BCA6000627C0 /* ASLayoutElementStylePrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASLayoutElementStylePrivate.h; sourceTree = ""; }; @@ -695,7 +704,6 @@ 6947B0BD1E36B4E30007C478 /* ASStackUnpositionedLayout.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASStackUnpositionedLayout.mm; sourceTree = ""; }; 6947B0C11E36B5040007C478 /* ASStackPositionedLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASStackPositionedLayout.h; sourceTree = ""; }; 6947B0C21E36B5040007C478 /* ASStackPositionedLayout.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASStackPositionedLayout.mm; sourceTree = ""; }; - 6959433C1D70815300B0EE1F /* ASDisplayNodeLayout.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASDisplayNodeLayout.mm; sourceTree = ""; }; 6959433D1D70815300B0EE1F /* ASDisplayNodeLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASDisplayNodeLayout.h; sourceTree = ""; }; 695BE2541DC1245C008E6EA5 /* ASWrapperSpecSnapshotTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASWrapperSpecSnapshotTests.mm; sourceTree = ""; }; 696F01EA1DD2AF450049FBD5 /* ASEventLog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASEventLog.h; sourceTree = ""; }; @@ -705,7 +713,7 @@ 6977965E1D8AC8D3007E93D7 /* ASLayoutSpec+Subclasses.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "ASLayoutSpec+Subclasses.mm"; sourceTree = ""; }; 697B31591CFE4B410049936F /* ASEditableTextNodeTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASEditableTextNodeTests.m; sourceTree = ""; }; 698371D91E4379CD00437585 /* ASNodeController+Beta.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "ASNodeController+Beta.h"; sourceTree = ""; }; - 698371DA1E4379CD00437585 /* ASNodeController+Beta.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "ASNodeController+Beta.m"; sourceTree = ""; }; + 698371DA1E4379CD00437585 /* ASNodeController+Beta.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "ASNodeController+Beta.mm"; sourceTree = ""; }; 698C8B601CAB49FC0052DC3F /* ASLayoutElementExtensibility.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASLayoutElementExtensibility.h; sourceTree = ""; }; 698DFF431E36B6C9002891F1 /* ASStackLayoutSpecUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASStackLayoutSpecUtilities.h; sourceTree = ""; }; 698DFF461E36B7E9002891F1 /* ASLayoutSpecUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASLayoutSpecUtilities.h; sourceTree = ""; }; @@ -734,8 +742,6 @@ 8B0768B21CE752EC002E1453 /* ASDefaultPlaybackButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASDefaultPlaybackButton.m; sourceTree = ""; }; 8BDA5FC31CDBDDE1007D13B2 /* ASVideoPlayerNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASVideoPlayerNode.h; sourceTree = ""; }; 8BDA5FC41CDBDDE1007D13B2 /* ASVideoPlayerNode.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASVideoPlayerNode.mm; sourceTree = ""; }; - 9019FBB91ED8061D00C45F72 /* ASYogaLayoutSpec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASYogaLayoutSpec.h; sourceTree = ""; }; - 9019FBBA1ED8061D00C45F72 /* ASYogaLayoutSpec.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASYogaLayoutSpec.mm; sourceTree = ""; }; 9019FBBB1ED8061D00C45F72 /* ASYogaUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASYogaUtilities.h; sourceTree = ""; }; 9019FBBC1ED8061D00C45F72 /* ASYogaUtilities.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASYogaUtilities.mm; sourceTree = ""; }; 909C4C731F09C98B00D6B76F /* ASTextNode2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASTextNode2.h; sourceTree = ""; }; @@ -805,6 +811,7 @@ ACF6ED591B178DC700DA7C62 /* ASOverlayLayoutSpecSnapshotTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASOverlayLayoutSpecSnapshotTests.mm; sourceTree = ""; }; ACF6ED5A1B178DC700DA7C62 /* ASRatioLayoutSpecSnapshotTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASRatioLayoutSpecSnapshotTests.mm; sourceTree = ""; }; ACF6ED5B1B178DC700DA7C62 /* ASStackLayoutSpecSnapshotTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASStackLayoutSpecSnapshotTests.mm; sourceTree = ""; }; + AE440174210FB7CF00B36DA2 /* ASTextKitFontSizeAdjusterTests.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = ASTextKitFontSizeAdjusterTests.mm; sourceTree = ""; }; AE6987C01DD04E1000B9E458 /* ASPagerNodeTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASPagerNodeTests.m; sourceTree = ""; }; AEB7B0181C5962EA00662EF4 /* ASDefaultPlayButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASDefaultPlayButton.h; sourceTree = ""; }; AEB7B0191C5962EA00662EF4 /* ASDefaultPlayButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASDefaultPlayButton.m; sourceTree = ""; }; @@ -839,6 +846,9 @@ CC2E317F1DAC353700EEE891 /* ASCollectionView+Undeprecated.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "ASCollectionView+Undeprecated.h"; sourceTree = ""; }; CC2F65EC1E5FFB1600DA57C9 /* ASMutableElementMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASMutableElementMap.h; sourceTree = ""; }; CC2F65ED1E5FFB1600DA57C9 /* ASMutableElementMap.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASMutableElementMap.m; sourceTree = ""; }; + CC35CEC120DD7F600006448D /* ASCollections.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ASCollections.h; sourceTree = ""; }; + CC35CEC220DD7F600006448D /* ASCollections.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ASCollections.m; sourceTree = ""; }; + CC35CEC520DD87280006448D /* ASCollectionsTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ASCollectionsTests.m; sourceTree = ""; }; CC3B20811C3F76D600798563 /* ASPendingStateController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASPendingStateController.h; sourceTree = ""; }; CC3B20821C3F76D600798563 /* ASPendingStateController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASPendingStateController.mm; sourceTree = ""; }; CC3B20871C3F7A5400798563 /* ASWeakSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASWeakSet.h; sourceTree = ""; }; @@ -960,7 +970,7 @@ DB55C2601C6408D6004EDCF5 /* _ASTransitionContext.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = _ASTransitionContext.m; path = ../_ASTransitionContext.m; sourceTree = ""; }; DB55C2651C641AE4004EDCF5 /* ASContextTransitioning.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASContextTransitioning.h; sourceTree = ""; }; DBC452D91C5BF64600B16017 /* NSArray+Diffing.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSArray+Diffing.h"; sourceTree = ""; }; - DBC452DA1C5BF64600B16017 /* NSArray+Diffing.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSArray+Diffing.m"; sourceTree = ""; }; + DBC452DA1C5BF64600B16017 /* NSArray+Diffing.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "NSArray+Diffing.mm"; sourceTree = ""; }; DBC452DD1C5C6A6A00B16017 /* ArrayDiffingTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = ArrayDiffingTests.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; DBC453211C5FD97200B16017 /* ASDisplayNodeImplicitHierarchyTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = ASDisplayNodeImplicitHierarchyTests.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; DBDB83921C6E879900D0098C /* ASPagerFlowLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASPagerFlowLayout.h; sourceTree = ""; }; @@ -975,9 +985,6 @@ E51B78BD1F01A0EE00E32604 /* ASLayoutFlatteningTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASLayoutFlatteningTests.m; sourceTree = ""; }; E52405B21C8FEF03004DC8E7 /* ASLayoutTransition.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASLayoutTransition.mm; sourceTree = ""; }; E52405B41C8FEF16004DC8E7 /* ASLayoutTransition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASLayoutTransition.h; sourceTree = ""; }; - E52AC9B81FEA90EB00AA4040 /* ASRectMap.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASRectMap.mm; sourceTree = ""; }; - E52AC9B91FEA90EB00AA4040 /* ASRectMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASRectMap.h; sourceTree = ""; }; - E52AC9BE1FEA915D00AA4040 /* ASRectMapTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASRectMapTests.m; sourceTree = ""; }; E54E00711F1D3828000B30D7 /* ASPagerNode+Beta.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "ASPagerNode+Beta.h"; sourceTree = ""; }; E54E81FA1EB357BD00FFE8E1 /* ASPageTable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASPageTable.h; sourceTree = ""; }; E54E81FB1EB357BD00FFE8E1 /* ASPageTable.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASPageTable.m; sourceTree = ""; }; @@ -1014,6 +1021,7 @@ E5E2D72D1EA780C4005C24C6 /* ASCollectionGalleryLayoutDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASCollectionGalleryLayoutDelegate.h; sourceTree = ""; }; E5E2D72F1EA780DF005C24C6 /* ASCollectionGalleryLayoutDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; lineEnding = 0; path = ASCollectionGalleryLayoutDelegate.mm; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; EFA731F0396842FF8AB635EE /* libPods-AsyncDisplayKitTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-AsyncDisplayKitTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + F3F698D1211CAD4600800CB1 /* ASDisplayViewAccessibilityTests.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = ASDisplayViewAccessibilityTests.mm; sourceTree = ""; }; F711994D1D20C21100568860 /* ASDisplayNodeExtrasTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASDisplayNodeExtrasTests.m; sourceTree = ""; }; FA4FAF14200A850200E735BD /* ASControlNode+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "ASControlNode+Private.h"; sourceTree = ""; }; FB07EABBCF28656C6297BC2D /* Pods-AsyncDisplayKitTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AsyncDisplayKitTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-AsyncDisplayKitTests/Pods-AsyncDisplayKitTests.debug.xcconfig"; sourceTree = ""; }; @@ -1115,6 +1123,8 @@ 058D09B1195D04C000B7D73C /* Source */ = { isa = PBXGroup; children = ( + CC35CEC120DD7F600006448D /* ASCollections.h */, + CC35CEC220DD7F600006448D /* ASCollections.m */, 058D0A42195D058D00B7D73C /* Base */, CCE04B1D1E313E99006AEBBB /* Collection Data Adapter */, DE89C1691DCEB9CC00D49D74 /* Debug */, @@ -1156,6 +1166,7 @@ 68B027791C1A79CC0041016B /* ASDisplayNode+Beta.h */, CC034A071E60BEB400626263 /* ASDisplayNode+Convenience.h */, CC034A081E60BEB400626263 /* ASDisplayNode+Convenience.m */, + 683F563620E409D600CEB7A3 /* ASDisplayNode+InterfaceState.h */, 69BCE3D71EC6513B007DCCAD /* ASDisplayNode+Layout.mm */, 058D09DA195D050800B7D73C /* ASDisplayNode+Subclasses.h */, 90FC784E1E4BFE1B00383C5A /* ASDisplayNode+Yoga.mm */, @@ -1182,7 +1193,7 @@ 055B9FA61A1C154B00035D6D /* ASNetworkImageNode.h */, 055B9FA71A1C154B00035D6D /* ASNetworkImageNode.mm */, 698371D91E4379CD00437585 /* ASNodeController+Beta.h */, - 698371DA1E4379CD00437585 /* ASNodeController+Beta.m */, + 698371DA1E4379CD00437585 /* ASNodeController+Beta.mm */, DBDB83921C6E879900D0098C /* ASPagerFlowLayout.h */, DBDB83931C6E879900D0098C /* ASPagerFlowLayout.m */, 25E327541C16819500A2170C /* ASPagerNode.h */, @@ -1238,6 +1249,7 @@ 058D09C5195D04C000B7D73C /* Tests */ = { isa = PBXGroup; children = ( + F3F698D1211CAD4600800CB1 /* ASDisplayViewAccessibilityTests.mm */, DBC452DD1C5C6A6A00B16017 /* ArrayDiffingTests.m */, AC026B571BD3F61800BBC17E /* ASAbsoluteLayoutSpecSnapshotTests.m */, 696FCB301D6E46050093471E /* ASBackgroundLayoutSpecSnapshotTests.mm */, @@ -1248,6 +1260,7 @@ CC051F1E1D7A286A006434CB /* ASCALayerTests.m */, ACF6ED531B178DC700DA7C62 /* ASCenterLayoutSpecSnapshotTests.mm */, CCDD148A1EEDCD9D0020834E /* ASCollectionModernDataSourceTests.m */, + CC35CEC520DD87280006448D /* ASCollectionsTests.m */, 2538B6F21BC5D2A2003CA0B4 /* ASCollectionViewFlowLayoutInspectorTests.m */, 9F06E5CC1B4CAF4200F015D8 /* ASCollectionViewTests.mm */, CCEDDDD8200C518800FFCD0A /* ASConfigurationTests.m */, @@ -1286,7 +1299,6 @@ CC8B05D51D73836400F54286 /* ASPerformanceTestContext.m */, CC7FD9E01BB5F750005CCB2B /* ASPhotosFrameworkImageRequestTests.m */, ACF6ED5A1B178DC700DA7C62 /* ASRatioLayoutSpecSnapshotTests.mm */, - E52AC9BE1FEA915D00AA4040 /* ASRectMapTests.m */, CCAA0B81206ADECB0057B336 /* ASRecursiveUnfairLockTests.m */, 7AB338681C55B97B0055FDE8 /* ASRelativeLayoutSpecSnapshotTests.mm */, 4E9127681F64157600499623 /* ASRunLoopQueueTests.m */, @@ -1298,8 +1310,10 @@ 3C9C128419E616EF00E942A0 /* ASTableViewTests.mm */, CC4981B21D1A02BE004E13CC /* ASTableViewThrashTests.m */, 058D0A33195D057000B7D73C /* ASTextKitCoreTextAdditionsTests.m */, + AE440174210FB7CF00B36DA2 /* ASTextKitFontSizeAdjusterTests.mm */, 254C6B531BF8FF2A003EC431 /* ASTextKitTests.mm */, 254C6B511BF8FE6D003EC431 /* ASTextKitTruncationTests.mm */, + C057D9BC20B5453D00FC9112 /* ASTextNode2SnapshotTests.m */, CC8B05D71D73979700F54286 /* ASTextNodePerformanceTests.m */, 81E95C131D62639600336598 /* ASTextNodeSnapshotTests.m */, 058D0A36195D057000B7D73C /* ASTextNodeTests.m */, @@ -1309,7 +1323,6 @@ 4496D0721FA9EA6B001CC8D5 /* ASTraitCollectionTests.m */, CC0AEEA31D66316E005D1C78 /* ASUICollectionViewTests.m */, AEEC47E31C21D3D200EC1693 /* ASVideoNodeTests.m */, - C057D9BC20B5453D00FC9112 /* ASTextNode2SnapshotTests.m */, CCA221D21D6FA7EF00AF6A0F /* ASViewControllerTests.m */, 83A7D95D1D446A6E00BF333E /* ASWeakMapTests.m */, CC3B208D1C3F7D0A00798563 /* ASWeakSetTests.m */, @@ -1408,7 +1421,7 @@ 205F0E1F1B376416007741D0 /* CoreGraphics+ASConvenience.h */, 205F0E201B376416007741D0 /* CoreGraphics+ASConvenience.m */, DBC452D91C5BF64600B16017 /* NSArray+Diffing.h */, - DBC452DA1C5BF64600B16017 /* NSArray+Diffing.m */, + DBC452DA1C5BF64600B16017 /* NSArray+Diffing.mm */, CC4981BA1D1C7F65004E13CC /* NSIndexSet+ASHelpers.h */, CC4981BB1D1C7F65004E13CC /* NSIndexSet+ASHelpers.m */, 058D09F5195D050800B7D73C /* NSMutableAttributedString+TextKitAdditions.h */, @@ -1471,9 +1484,10 @@ 058D0A0A195D050800B7D73C /* ASDisplayNode+DebugTiming.mm */, DE6EA3211C14000600183B10 /* ASDisplayNode+FrameworkPrivate.h */, 058D0A0B195D050800B7D73C /* ASDisplayNode+UIViewBridge.mm */, + 690BC8BF20F6D3490052A434 /* ASDisplayNodeCornerLayerDelegate.h */, + 690BC8C020F6D3490052A434 /* ASDisplayNodeCornerLayerDelegate.m */, 058D0A0C195D050800B7D73C /* ASDisplayNodeInternal.h */, 6959433D1D70815300B0EE1F /* ASDisplayNodeLayout.h */, - 6959433C1D70815300B0EE1F /* ASDisplayNodeLayout.mm */, CCA282C61E9EB64B0037E8B7 /* ASDisplayNodeTipState.h */, CCA282C71E9EB64B0037E8B7 /* ASDisplayNodeTipState.m */, 68B8A4DB1CBD911D007E4543 /* ASImageNode+AnimatedImagePrivate.h */, @@ -1491,8 +1505,6 @@ CCED5E402020D41600395C40 /* ASNetworkImageLoadInfo+Private.h */, CC3B20811C3F76D600798563 /* ASPendingStateController.h */, CC3B20821C3F76D600798563 /* ASPendingStateController.mm */, - E52AC9B91FEA90EB00AA4040 /* ASRectMap.h */, - E52AC9B81FEA90EB00AA4040 /* ASRectMap.mm */, CC55A70F1E52A0F200594372 /* ASResponderChainEnumerator.h */, CC55A7101E52A0F200594372 /* ASResponderChainEnumerator.m */, CC512B841DAC45C60054848E /* ASTableView+Undeprecated.h */, @@ -1627,6 +1639,8 @@ ACF6ED0A1B17843500DA7C62 /* ASInsetLayoutSpec.mm */, ACF6ED0B1B17843500DA7C62 /* ASLayout.h */, ACF6ED0C1B17843500DA7C62 /* ASLayout.mm */, + 0FAFDF7320EC1C8F003A51C0 /* ASLayout+IGListKit.h */, + 0FAFDF7420EC1C90003A51C0 /* ASLayout+IGListKit.mm */, ACF6ED111B17843500DA7C62 /* ASLayoutElement.h */, E55D86311CA8A14000A0C26F /* ASLayoutElement.mm */, 698C8B601CAB49FC0052DC3F /* ASLayoutElementExtensibility.h */, @@ -1645,8 +1659,6 @@ 9C49C36E1B853957000B0DD5 /* ASStackLayoutElement.h */, ACF6ED161B17843500DA7C62 /* ASStackLayoutSpec.h */, ACF6ED171B17843500DA7C62 /* ASStackLayoutSpec.mm */, - 9019FBB91ED8061D00C45F72 /* ASYogaLayoutSpec.h */, - 9019FBBA1ED8061D00C45F72 /* ASYogaLayoutSpec.mm */, 9019FBBB1ED8061D00C45F72 /* ASYogaUtilities.h */, 9019FBBC1ED8061D00C45F72 /* ASYogaUtilities.mm */, ); @@ -1844,6 +1856,7 @@ 69E0E8A71D356C9400627613 /* ASEqualityHelpers.h in Headers */, 698C8B621CAB49FC0052DC3F /* ASLayoutElementExtensibility.h in Headers */, 69F10C871C84C35D0026140C /* ASRangeControllerUpdateRangeProtocol+Beta.h in Headers */, + 0FAFDF7520EC1C90003A51C0 /* ASLayout+IGListKit.h in Headers */, B350623C1B010EFD0018CF92 /* _ASAsyncTransaction.h in Headers */, 68355B411CB57A6C001D4E68 /* ASImageContainerProtocolCategories.h in Headers */, 7630FFA81C9E267E007A7C0E /* ASVideoNode.h in Headers */, @@ -1915,6 +1928,8 @@ CC034A091E60BEB400626263 /* ASDisplayNode+Convenience.h in Headers */, 254C6B7E1BF94DF4003EC431 /* ASTextKitTailTruncater.h in Headers */, B35062491B010EFD0018CF92 /* _ASCoreAnimationExtras.h in Headers */, + 683F563720E409D700CEB7A3 /* ASDisplayNode+InterfaceState.h in Headers */, + 690BC8C120F6D3490052A434 /* ASDisplayNodeCornerLayerDelegate.h in Headers */, 68EE0DBE1C1B4ED300BA1B99 /* ASMainSerialQueue.h in Headers */, CCCCCCE11EC3EF060087FE10 /* ASTextUtilities.h in Headers */, B350624B1B010EFD0018CF92 /* _ASPendingState.h in Headers */, @@ -1940,7 +1955,6 @@ E5775B021F16759300CAC9BC /* ASCollectionLayoutCache.h in Headers */, E5775B001F13D25400CAC9BC /* ASCollectionLayoutState+Private.h in Headers */, E5667E8C1F33871300FA6FC0 /* _ASCollectionGalleryLayoutInfo.h in Headers */, - E52AC9BB1FEA90EB00AA4040 /* ASRectMap.h in Headers */, E5775AFC1F13CE9F00CAC9BC /* _ASCollectionGalleryLayoutItem.h in Headers */, E5855DF01EBB4D83003639AE /* ASCollectionLayoutDefines.h in Headers */, E5B5B9D11E9BAD9800A6B726 /* ASCollectionLayoutContext+Private.h in Headers */, @@ -1979,7 +1993,6 @@ CCF18FF41D2575E300DF5895 /* NSIndexSet+ASHelpers.h in Headers */, 83A7D95C1D44548100BF333E /* ASWeakMap.h in Headers */, E5711A2C1C840C81009619D4 /* ASCollectionElement.h in Headers */, - 9019FBBD1ED8061D00C45F72 /* ASYogaLayoutSpec.h in Headers */, 6947B0BE1E36B4E30007C478 /* ASStackUnpositionedLayout.h in Headers */, CC4C2A771D88E3BF0039ACAB /* ASTraceEvent.h in Headers */, 254C6B7B1BF94DF4003EC431 /* ASTextKitRenderer+Positioning.h in Headers */, @@ -2019,6 +2032,7 @@ CCCCCCDB1EC3EF060087FE10 /* ASTextLine.h in Headers */, 9C70F20E1CDBE9E5007D6C76 /* NSArray+Diffing.h in Headers */, CCCCCCE71EC3F0FC0087FE10 /* NSAttributedString+ASText.h in Headers */, + CC35CEC320DD7F600006448D /* ASCollections.h in Headers */, CC7AF196200D9BD500A21BDE /* ASExperimentalFeatures.h in Headers */, CCCCCCDF1EC3EF060087FE10 /* ASTextRunDelegate.h in Headers */, 9C49C3701B853961000B0DD5 /* ASStackLayoutElement.h in Headers */, @@ -2114,7 +2128,7 @@ isa = PBXProject; attributes = { CLASSPREFIX = AS; - LastUpgradeCheck = 0820; + LastUpgradeCheck = 0940; ORGANIZATIONNAME = Pinterest; TargetAttributes = { 057D02BE1AC0A66700C7AC3C = { @@ -2247,6 +2261,7 @@ buildActionMask = 2147483647; files = ( CCEDDDD9200C518800FFCD0A /* ASConfigurationTests.m in Sources */, + AE440175210FB7CF00B36DA2 /* ASTextKitFontSizeAdjusterTests.mm in Sources */, E51B78BF1F028ABF00E32604 /* ASLayoutFlatteningTests.m in Sources */, 4496D0731FA9EA6B001CC8D5 /* ASTraitCollectionTests.m in Sources */, 29CDC2E21AAE70D000833CA4 /* ASBasicImageDownloaderContextTests.m in Sources */, @@ -2277,6 +2292,7 @@ 4E9127691F64157600499623 /* ASRunLoopQueueTests.m in Sources */, CC4981B31D1A02BE004E13CC /* ASTableViewThrashTests.m in Sources */, CC54A81E1D7008B300296A24 /* ASDispatchTests.m in Sources */, + F3F698D2211CAD4600800CB1 /* ASDisplayViewAccessibilityTests.mm in Sources */, CCE4F9B31F0D60AC00062E4E /* ASIntegerMapTests.m in Sources */, 058D0A3B195D057000B7D73C /* ASDisplayNodeTestsHelper.m in Sources */, 83A7D95E1D446A6E00BF333E /* ASWeakMapTests.m in Sources */, @@ -2303,8 +2319,8 @@ 1A6C00111FAB4EDD00D05926 /* ASCornerLayoutSpecSnapshotTests.mm in Sources */, 254C6B541BF8FF2A003EC431 /* ASTextKitTests.mm in Sources */, 05EA6FE71AC0966E00E35788 /* ASSnapshotTestCase.m in Sources */, + CC35CEC620DD87280006448D /* ASCollectionsTests.m in Sources */, ACF6ED631B178DC700DA7C62 /* ASStackLayoutSpecSnapshotTests.mm in Sources */, - E52AC9C01FEA916C00AA4040 /* ASRectMapTests.m in Sources */, CCE4F9BA1F0DBB5000062E4E /* ASLayoutTestNode.mm in Sources */, CCAA0B82206ADECB0057B336 /* ASRecursiveUnfairLockTests.m in Sources */, 81E95C141D62639600336598 /* ASTextNodeSnapshotTests.m in Sources */, @@ -2334,7 +2350,6 @@ 3917EBD51E9C2FC400D04A01 /* _ASCollectionReusableView.m in Sources */, CCA282D11E9EBF6C0037E8B7 /* ASTipsWindow.m in Sources */, CCCCCCE41EC3EF060087FE10 /* NSParagraphStyle+ASText.m in Sources */, - E52AC9BA1FEA90EB00AA4040 /* ASRectMap.mm in Sources */, 8BBBAB8D1CEBAF1E00107FC6 /* ASDefaultPlaybackButton.m in Sources */, B30BF6541C59D889004FCD53 /* ASLayoutManager.m in Sources */, 92DD2FE71BF4D0850074C9DD /* ASMapNode.mm in Sources */, @@ -2355,7 +2370,7 @@ DEFAD8131CC48914000527C4 /* ASVideoNode.mm in Sources */, CCA282C11E9EAE010037E8B7 /* ASTip.m in Sources */, B350624C1B010EFD0018CF92 /* _ASPendingState.mm in Sources */, - 698371DC1E4379CD00437585 /* ASNodeController+Beta.m in Sources */, + 698371DC1E4379CD00437585 /* ASNodeController+Beta.mm in Sources */, CC6AA2DB1E9F03B900978E87 /* ASDisplayNode+Ancestry.m in Sources */, 509E68621B3AEDA5009B9150 /* ASAbstractLayoutController.mm in Sources */, 254C6B861BF94F8A003EC431 /* ASTextKitContext.mm in Sources */, @@ -2363,6 +2378,7 @@ E5B078001E69F4EB00C24B5B /* ASElementMap.m in Sources */, 9C8898BC1C738BA800D6B02E /* ASTextKitFontSizeAdjuster.mm in Sources */, 690ED59B1E36D118000627C0 /* ASImageNode+tvOS.m in Sources */, + 0FAFDF7620EC1C90003A51C0 /* ASLayout+IGListKit.mm in Sources */, CCDC9B4E200991D10063C1F8 /* ASGraphicsContext.m in Sources */, CCCCCCD81EC3EF060087FE10 /* ASTextInput.m in Sources */, 34EFC7621B701CA400AD841F /* ASBackgroundLayoutSpec.mm in Sources */, @@ -2397,7 +2413,7 @@ B350624E1B010EFD0018CF92 /* ASDisplayNode+AsyncDisplay.mm in Sources */, E5667E8E1F33872700FA6FC0 /* _ASCollectionGalleryLayoutInfo.m in Sources */, 25E327591C16819500A2170C /* ASPagerNode.m in Sources */, - 636EA1A41C7FF4EC00EE152F /* NSArray+Diffing.m in Sources */, + 636EA1A41C7FF4EC00EE152F /* NSArray+Diffing.mm in Sources */, B35062501B010EFD0018CF92 /* ASDisplayNode+DebugTiming.mm in Sources */, DEC146B91C37A16A004A0EE7 /* ASCollectionInternal.m in Sources */, 254C6B891BF94F8A003EC431 /* ASTextKitRenderer+Positioning.mm in Sources */, @@ -2421,6 +2437,7 @@ 68355B401CB57A69001D4E68 /* ASImageContainerProtocolCategories.m in Sources */, E5855DEF1EBB4D83003639AE /* ASCollectionLayoutDefines.m in Sources */, B35062031B010EFD0018CF92 /* ASImageNode.mm in Sources */, + 690BC8C220F6D3490052A434 /* ASDisplayNodeCornerLayerDelegate.m in Sources */, 254C6B821BF94F8A003EC431 /* ASTextKitComponents.mm in Sources */, 34EFC7601B701C8B00AD841F /* ASInsetLayoutSpec.mm in Sources */, AC6145441D8AFD4F003D62A2 /* ASSection.m in Sources */, @@ -2439,7 +2456,6 @@ 6907C25A1DC4ECFE00374C66 /* ASObjectDescriptionHelpers.m in Sources */, B35062051B010EFD0018CF92 /* ASMultiplexImageNode.mm in Sources */, B35062251B010EFD0018CF92 /* ASMutableAttributedStringBuilder.m in Sources */, - 9019FBBE1ED8061D00C45F72 /* ASYogaLayoutSpec.mm in Sources */, B35062071B010EFD0018CF92 /* ASNetworkImageNode.mm in Sources */, 34EFC76D1B701CF100AD841F /* ASOverlayLayoutSpec.mm in Sources */, 044285101BAA64EC00D16268 /* ASTwoDimensionalArrayUtils.m in Sources */, @@ -2447,6 +2463,7 @@ CCA282B51E9EA7310037E8B7 /* ASTipsController.m in Sources */, B35062271B010EFD0018CF92 /* ASRangeController.mm in Sources */, 0442850A1BAA63FE00D16268 /* ASBatchFetching.m in Sources */, + CC35CEC420DD7F600006448D /* ASCollections.m in Sources */, 68FC85E61CE29B9400EDD713 /* ASNavigationController.m in Sources */, CC4C2A791D88E3BF0039ACAB /* ASTraceEvent.m in Sources */, 34EFC76F1B701CF700AD841F /* ASRatioLayoutSpec.mm in Sources */, @@ -2480,7 +2497,6 @@ DB78412E1C6BCE1600A9E2B4 /* _ASTransitionContext.m in Sources */, B350620B1B010EFD0018CF92 /* ASTableView.mm in Sources */, B350620E1B010EFD0018CF92 /* ASTextNode.mm in Sources */, - 6959433F1D70815300B0EE1F /* ASDisplayNodeLayout.mm in Sources */, 68355B3E1CB57A60001D4E68 /* ASPINRemoteImageDownloader.m in Sources */, CC034A141E649F1300626263 /* AsyncDisplayKit+IGListKitMethods.m in Sources */, 509E68661B3AEDD7009B9150 /* CoreGraphics+ASConvenience.m in Sources */, diff --git a/AsyncDisplayKit.xcodeproj/xcshareddata/xcschemes/AsyncDisplayKit.xcscheme b/AsyncDisplayKit.xcodeproj/xcshareddata/xcschemes/AsyncDisplayKit.xcscheme index 2b3f7437cd..f06fd13c88 100644 --- a/AsyncDisplayKit.xcodeproj/xcshareddata/xcschemes/AsyncDisplayKit.xcscheme +++ b/AsyncDisplayKit.xcodeproj/xcshareddata/xcschemes/AsyncDisplayKit.xcscheme @@ -1,6 +1,6 @@ ASNodeController reference by removing weak proxy and objc associated objects. [Adlai Holler](https://github.com/Adlai-Holler) +- Remove CA transaction signpost injection because it causes more transactions and is too chatty. [Adlai Holler](https://github.com/Adlai-Holler) +- Optimize display node accessibility by not creating attributed & non-attributed copies of hint, label, and value. [Adlai Holler](https://github.com/Adlai-Holler) +- Add an experimental feature that reuses CTFramesetter objects in ASTextNode2 to improve performance. [Adlai Holler](https://github.com/Adlai-Holler) +- Add NS_DESIGNATED_INITIALIZER to ASViewController initWithNode: [Michael Schneider](https://github.com/maicki) [#1054](https://github.com/TextureGroup/Texture/pull/1054) +- Optimize text stack by removing unneeded copying. [Adlai Holler](https://github.com/Adlai-Holler) +- Renamed `accessibleElements` to `accessibilityElements` and removed the re-definition of the property in ASDisplayView. [Jia Wern Lim](https://github.com/jiawernlim) +- Remove double scaling of lineHeightMultiple & paragraphSpacing attributes in ASTextKitFontSizeAdjuster. [Eric Jensen](https://github.com/ejensen) +- Add a delegate callback for when the framework has initialized. [Adlai Holler](https://github.com/Adlai-Holler) +- Improve TextNode2 by skipping an unneeded copy during measurement. [Adlai Holler](https://github.com/Adlai-Holler) +- Improve locking around clearContents [Michael Schneider](https://github.com/maicki) +- Unlock before cleanup and calling out to subclass hooks for animated images. [Michael Schneider](https://github.com/maicki) [#1087](https://github.com/TextureGroup/Texture/pull/1087) +- [ASDisplayNode] Fix interface state update for layer backed nodes when layer thrashes (interface coaleascing case).[Max Wang](https://github.com/wsdwsd0829). [#1111](https://github.com/TextureGroup/Texture/pull/1111) +- [ASPINRemoteImageManager] Add a new API for setting a preconfigured PINRemoteImageManager. [Ernest Ma](https://github.com/ernestmama) [#1124](https://github.com/TextureGroup/Texture/pull/1124) +- Small optimization to the layout spec & yoga layout systems by eliminating array copies. [Adlai Holler](https://github.com/Adlai-Holler) +- Optimize layout process by removing `ASRectMap`. [Adlai Holler](https://github.com/Adlai-Holler) +- Remove necessity to use view to access rangeController in ASTableNode, ASCollectionNode. [Michael Schneider](https://github.com/maicki) +- Remove display node's reliance on shared_ptr. [Adlai Holler](https://github.com/Adlai-Holler) +- [ASCollectionView] Fix a crash that is caused by clearing a collection view's data while it's still being used. [Huy Nguyen](https://github.com/nguyenhuy) [#1154](https://github.com/TextureGroup/Texture/pull/1154) +- Clean up timing of layout tree flattening/ copying of unflattened tree for Weaver. [Michael Zuccarino](https://github.com/mikezucc) [#1157](https://github.com/TextureGroup/Texture/pull/1157) ## 2.7 - Fix pager node for interface coalescing. [Max Wang](https://github.com/wsdwsd0829) [#877](https://github.com/TextureGroup/Texture/pull/877) - [ASTextNode2] Upgrade lock safety by protecting all ivars (including rarely-changed ones). - User FLT_EPSILON in ASCeilPixelValue and ASFloorPixelValue to help with floating point precision errors when computing layouts for 3x devices. [Ricky Cancro](https://github.com/rcancro) [#838](https://github.com/TextureGroup/Texture/pull/864) -- Disable interface colescing and match to pre-colescing interface update behavior [Max Wang](https://github.com/wsdwsd0829) [#862](https://github.com/TextureGroup/Texture/pull/862) +- Disable interface colescing and match to pre-colescing interface update behavior [Max Wang](https://github.com/wsdwsd0829) [#862](https://github.com/TextureGroup/Texture/pull/862) - [ASDisplayNode] Add safeAreaInsets, layoutMargins and related properties to ASDisplayNode, with full support for older OS versions [Yevgen Pogribnyi](https://github.com/ypogribnyi) [#685](https://github.com/TextureGroup/Texture/pull/685) - [ASPINRemoteImageDownloader] Allow cache to provide animated image. [Max Wang](https://github.com/wsdwsd0829) [#850](https://github.com/TextureGroup/Texture/pull/850) - [tvOS] Fixes errors when building against tvOS SDK [Alex Hill](https://github.com/alexhillc) [#728](https://github.com/TextureGroup/Texture/pull/728) @@ -49,7 +93,8 @@ - Optimized ASNetworkImageNode loading and resolved edge cases where the image provided to the delegate was not the image that was loaded. [Adlai Holler](https://github.com/Adlai-Holler) [#778](https://github.com/TextureGroup/Texture/pull/778/) - Make `ASCellNode` tint color apply to table view cell accessories. [Vladyslav Chapaev](https://github.com/ShogunPhyched) [#764](https://github.com/TextureGroup/Texture/pull/764) - Fix ASTextNode2 is accessing backgroundColor off main while sizing / layout is happening. [Michael Schneider](https://github.com/maicki) [#794](https://github.com/TextureGroup/Texture/pull/778/) -- Pass scrollViewWillEndDragging delegation through in ASIGListAdapterDataSource for IGListKit integration. [#796](https://github.com/TextureGroup/Texture/pull/796) +- Pass scrollViewWillEndDragging delegation through in ASIGListAdapterDataSource for IGListKit integration. [#796](https://github.com/TextureGro +- up/Texture/pull/796) - Fix UIResponder handling with view backing ASDisplayNode. [Michael Schneider](https://github.com/maicki) [#789](https://github.com/TextureGroup/Texture/pull/789/) - Optimized thread-local storage by replacing pthread_specific with C11 thread-local variables. [Adlai Holler](https://github.com/Adlai-Holler) [#811](https://github.com/TextureGroup/Texture/pull/811/) - Fixed a thread-sanitizer warning in ASTextNode. [Adlai Holler](https://github.com/Adlai-Holler) [#830](https://github.com/TextureGroup/Texture/pull/830/) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 12274c0a44..22aded2d6e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -87,12 +87,8 @@ Copy and paste this to the top of your new file(s): // ASDisplayNode.mm // Texture // -// Copyright (c) 2017-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // ``` @@ -102,17 +98,9 @@ If you’ve modified an existing file, change the header to: // ASDisplayNode.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // ``` diff --git a/Dangerfile b/Dangerfile index edbbec21ec..60c90dfe2e 100644 --- a/Dangerfile +++ b/Dangerfile @@ -69,13 +69,8 @@ end # Ensure new files have proper header new_source_license_header = <<-HEREDOC -// Copyright (c) 2018-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 HEREDOC if has_added_source_files @@ -84,20 +79,11 @@ end # Ensure modified files have proper header modified_source_license_header = <<-HEREDOC -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) through the present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 HEREDOC if has_modified_source_files check_file_header(modified_source_files, [modified_source_license_header, new_source_license_header]) -end \ No newline at end of file +end diff --git a/LICENSE b/LICENSE index 8ce6c68398..c63a7c0a29 100644 --- a/LICENSE +++ b/LICENSE @@ -1,13 +1,7 @@ -The Texture project was created by Pinterest as a continuation, under a -different name and license, of the AsyncDisplayKit codebase originally developed -by Facebook. AsyncDisplayKit was originally released by Facebook under a BSD -license and additional patent grant. Those BSD and patent licenses govern use -of code in Texture contributed prior to 4/13/2017 (the original AsyncDisplayKit -code), and copies of the licenses are included in the /ASDK-Licenses directory -of this source tree for reference. +The Texture project was created by Pinterest as a continuation, under a different +name and license, of the AsyncDisplayKit codebase originally developed by Facebook. -All code contributed to Texture after 4/13/2017 is released by Pinterest under -the Apache License, Version 2.0. +All code in Texture is covered by the Apache License, Version 2.0. Apache License Version 2.0, January 2004 @@ -184,4 +178,4 @@ Apache License incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. - END OF TERMS AND CONDITIONS \ No newline at end of file + END OF TERMS AND CONDITIONS diff --git a/Podfile b/Podfile index 21e72482c1..dfb2350e8f 100644 --- a/Podfile +++ b/Podfile @@ -3,7 +3,7 @@ source 'https://github.com/CocoaPods/Specs.git' platform :ios, '9.0' target :'AsyncDisplayKitTests' do - pod 'OCMock', '~> 3.4' + pod 'OCMock', '=3.4.1' # 3.4.2 currently has issues. pod 'FBSnapshotTestCase/Core', '~> 2.1' pod 'JGMethodSwizzler', :git => 'https://github.com/JonasGessner/JGMethodSwizzler', :branch => 'master' diff --git a/Podfile.lock b/Podfile.lock new file mode 100644 index 0000000000..a0caeb263e --- /dev/null +++ b/Podfile.lock @@ -0,0 +1,62 @@ +PODS: + - FBSnapshotTestCase/Core (2.1.4) + - FLAnimatedImage (1.0.12) + - JGMethodSwizzler (2.0.1) + - OCMock (3.4.1) + - PINCache (3.0.1-beta.6): + - PINCache/Arc-exception-safe (= 3.0.1-beta.6) + - PINCache/Core (= 3.0.1-beta.6) + - PINCache/Arc-exception-safe (3.0.1-beta.6): + - PINCache/Core + - PINCache/Core (3.0.1-beta.6): + - PINOperation (~> 1.1.0) + - PINOperation (1.1.1) + - PINRemoteImage (3.0.0-beta.13): + - PINRemoteImage/FLAnimatedImage (= 3.0.0-beta.13) + - PINRemoteImage/PINCache (= 3.0.0-beta.13) + - PINRemoteImage/Core (3.0.0-beta.13): + - PINOperation + - PINRemoteImage/FLAnimatedImage (3.0.0-beta.13): + - FLAnimatedImage (>= 1.0) + - PINRemoteImage/Core + - PINRemoteImage/PINCache (3.0.0-beta.13): + - PINCache (= 3.0.1-beta.6) + - PINRemoteImage/Core + +DEPENDENCIES: + - FBSnapshotTestCase/Core (~> 2.1) + - JGMethodSwizzler (from `https://github.com/JonasGessner/JGMethodSwizzler`, branch `master`) + - OCMock (= 3.4.1) + - PINRemoteImage (= 3.0.0-beta.13) + +SPEC REPOS: + https://github.com/cocoapods/specs.git: + - FBSnapshotTestCase + - FLAnimatedImage + - OCMock + - PINCache + - PINOperation + - PINRemoteImage + +EXTERNAL SOURCES: + JGMethodSwizzler: + :branch: master + :git: https://github.com/JonasGessner/JGMethodSwizzler + +CHECKOUT OPTIONS: + JGMethodSwizzler: + :commit: 8791eccc5342224bd293b5867348657e3a240c7f + :git: https://github.com/JonasGessner/JGMethodSwizzler + +SPEC CHECKSUMS: + FBSnapshotTestCase: 094f9f314decbabe373b87cc339bea235a63e07a + FLAnimatedImage: 4a0b56255d9b05f18b6dd7ee06871be5d3b89e31 + JGMethodSwizzler: 7328146117fffa8a4038c42eb7cd3d4c75006f97 + OCMock: 2cd0716969bab32a2283ff3a46fd26a8c8b4c5e3 + PINCache: d195fdba255283f7e9900a55e3cced377f431f9b + PINOperation: a6219e6fc9db9c269eb7a7b871ac193bcf400aac + PINRemoteImage: d6d51c5d2adda55f1ce30c96e850b6c4ebd2856a + +PODFILE CHECKSUM: 42715d61f73cc22cc116bf80d7b268cb1f9e4742 + +COCOAPODS: 1.5.3 diff --git a/README.md b/README.md index 97cb293660..64e7f4ab33 100644 --- a/README.md +++ b/README.md @@ -44,4 +44,4 @@ We welcome any contributions. See the [CONTRIBUTING](https://github.com/textureg ## License -The Texture project was created by Pinterest as a continuation, under a different name and license, of the AsyncDisplayKit codebase originally developed by Facebook. AsyncDisplayKit was originally released by Facebook under a BSD license and additional patent grant. Those BSD and patent licenses govern use of code in Texture contributed prior to 4/13/2017 (the original AsyncDisplayKit code), and copies of the licenses are included in the root directory of this source tree for reference. All code contributed to Texture after 4/13/2017 is released by Pinterest under an Apache 2.0 license. +The Texture project is available for free use, as described by the [LICENSE](https://github.com/texturegroup/texture/blob/master/LICENSE) (Apache 2.0). diff --git a/Schemas/configuration.json b/Schemas/configuration.json index ab1d592b4b..33b1f43c35 100644 --- a/Schemas/configuration.json +++ b/Schemas/configuration.json @@ -19,7 +19,10 @@ "exp_unfair_lock", "exp_infer_layer_defaults", "exp_network_image_queue", - "exp_dealloc_queue_v2" + "exp_dealloc_queue_v2", + "exp_collection_teardown", + "exp_framesetter_cache", + "exp_clear_data_during_deallocation" ] } } diff --git a/Source/ASBlockTypes.h b/Source/ASBlockTypes.h index f0e2875e12..e1c7456019 100644 --- a/Source/ASBlockTypes.h +++ b/Source/ASBlockTypes.h @@ -2,17 +2,9 @@ // ASBlockTypes.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/ASButtonNode.h b/Source/ASButtonNode.h index 55f0e328c2..f43a544df1 100644 --- a/Source/ASButtonNode.h +++ b/Source/ASButtonNode.h @@ -2,17 +2,9 @@ // ASButtonNode.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/ASButtonNode.mm b/Source/ASButtonNode.mm index bd245262dc..f0ca75eed2 100644 --- a/Source/ASButtonNode.mm +++ b/Source/ASButtonNode.mm @@ -2,17 +2,9 @@ // ASButtonNode.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/ASCGImageBuffer.h b/Source/ASCGImageBuffer.h index 88f1fd9c3e..a77452622b 100644 --- a/Source/ASCGImageBuffer.h +++ b/Source/ASCGImageBuffer.h @@ -2,12 +2,8 @@ // ASCGImageBuffer.h // Texture // -// Copyright (c) 2018-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import @@ -25,7 +21,7 @@ AS_SUBCLASSING_RESTRICTED @property (readonly) void *mutableBytes NS_RETURNS_INNER_POINTER; /// Don't do any drawing or call any methods after calling this. -- (CGDataProviderRef)createDataProviderAndInvalidate; +- (CGDataProviderRef)createDataProviderAndInvalidate CF_RETURNS_RETAINED; @end diff --git a/Source/ASCGImageBuffer.m b/Source/ASCGImageBuffer.m index 8b236f65c6..5e0c3dc921 100644 --- a/Source/ASCGImageBuffer.m +++ b/Source/ASCGImageBuffer.m @@ -2,12 +2,8 @@ // ASCGImageBuffer.m // Texture // -// Copyright (c) 2018-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ASCGImageBuffer.h" diff --git a/Source/ASCellNode.h b/Source/ASCellNode.h index 6b0bbb5f10..f205a3518e 100644 --- a/Source/ASCellNode.h +++ b/Source/ASCellNode.h @@ -2,17 +2,9 @@ // ASCellNode.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK diff --git a/Source/ASCellNode.mm b/Source/ASCellNode.mm index 0fe617ce51..cc94ccdf59 100644 --- a/Source/ASCellNode.mm +++ b/Source/ASCellNode.mm @@ -2,17 +2,9 @@ // ASCellNode.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK diff --git a/Source/ASCollectionNode+Beta.h b/Source/ASCollectionNode+Beta.h index 3732137b22..80c8a3897b 100644 --- a/Source/ASCollectionNode+Beta.h +++ b/Source/ASCollectionNode+Beta.h @@ -2,17 +2,9 @@ // ASCollectionNode+Beta.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK diff --git a/Source/ASCollectionNode.h b/Source/ASCollectionNode.h index b22c103159..47033562e8 100644 --- a/Source/ASCollectionNode.h +++ b/Source/ASCollectionNode.h @@ -2,17 +2,9 @@ // ASCollectionNode.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK diff --git a/Source/ASCollectionNode.mm b/Source/ASCollectionNode.mm index d325e4c022..a313ff3969 100644 --- a/Source/ASCollectionNode.mm +++ b/Source/ASCollectionNode.mm @@ -2,17 +2,9 @@ // ASCollectionNode.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK @@ -39,9 +31,12 @@ #pragma mark - _ASCollectionPendingState -@interface _ASCollectionPendingState : NSObject -@property (weak, nonatomic) id delegate; -@property (weak, nonatomic) id dataSource; +@interface _ASCollectionPendingState : NSObject { +@public + std::vector> _tuningParameters; +} +@property (nonatomic, weak) id delegate; +@property (nonatomic, weak) id dataSource; @property (nonatomic) UICollectionViewLayout *collectionViewLayout; @property (nonatomic) ASLayoutRangeMode rangeMode; @property (nonatomic) BOOL allowsSelection; // default is YES @@ -49,7 +44,7 @@ @property (nonatomic) BOOL inverted; //default is NO @property (nonatomic) BOOL usesSynchronousDataLoading; @property (nonatomic) CGFloat leadingScreensForBatching; -@property (weak, nonatomic) id layoutInspector; +@property (nonatomic, weak) id layoutInspector; @property (nonatomic) BOOL alwaysBounceVertical; @property (nonatomic) BOOL alwaysBounceHorizontal; @property (nonatomic) UIEdgeInsets contentInset; @@ -61,11 +56,14 @@ @implementation _ASCollectionPendingState +#pragma mark Lifecycle + - (instancetype)init { self = [super init]; if (self) { _rangeMode = ASLayoutRangeModeUnspecified; + _tuningParameters = std::vector> (ASLayoutRangeModeCount, std::vector (ASLayoutRangeTypeCount, ASRangeTuningParametersZero)); _allowsSelection = YES; _allowsMultipleSelection = NO; _inverted = NO; @@ -75,23 +73,8 @@ } return self; } -@end -// TODO: Add support for tuning parameters in the pending state -#if 0 // This is not used yet, but will provide a way to avoid creating the view to set range values. -@implementation _ASCollectionPendingState { - std::vector> _tuningParameters; -} - -- (instancetype)init -{ - self = [super init]; - if (self) { - _tuningParameters = std::vector> (ASLayoutRangeModeCount, std::vector (ASLayoutRangeTypeCount)); - _rangeMode = ASLayoutRangeModeUnspecified; - } - return self; -} +#pragma mark Tuning Parameters - (ASRangeTuningParameters)tuningParametersForRangeType:(ASLayoutRangeType)rangeType { @@ -116,7 +99,6 @@ } @end -#endif #pragma mark - ASCollectionNode @@ -127,6 +109,7 @@ id _batchFetchingDelegate; } @property (nonatomic) _ASCollectionPendingState *pendingState; +@property (nonatomic, weak) ASRangeController *rangeController; @end @implementation ASCollectionNode @@ -197,17 +180,21 @@ ASCollectionView *view = self.view; view.collectionNode = self; + + _rangeController = view.rangeController; if (_pendingState) { _ASCollectionPendingState *pendingState = _pendingState; - self.pendingState = nil; - view.asyncDelegate = pendingState.delegate; - view.asyncDataSource = pendingState.dataSource; - view.inverted = pendingState.inverted; - view.allowsSelection = pendingState.allowsSelection; - view.allowsMultipleSelection = pendingState.allowsMultipleSelection; - view.usesSynchronousDataLoading = pendingState.usesSynchronousDataLoading; - view.layoutInspector = pendingState.layoutInspector; + self.pendingState = nil; + view.asyncDelegate = pendingState.delegate; + view.asyncDataSource = pendingState.dataSource; + view.inverted = pendingState.inverted; + view.allowsSelection = pendingState.allowsSelection; + view.allowsMultipleSelection = pendingState.allowsMultipleSelection; + view.usesSynchronousDataLoading = pendingState.usesSynchronousDataLoading; + view.layoutInspector = pendingState.layoutInspector; + view.showsVerticalScrollIndicator = pendingState.showsVerticalScrollIndicator; + view.showsHorizontalScrollIndicator = pendingState.showsHorizontalScrollIndicator; // Only apply these flags if they're enabled; the view might come with them turned on. if (pendingState.alwaysBounceVertical) { @@ -226,9 +213,24 @@ if (!CGPointEqualToPoint(contentOffset, CGPointZero)) { [view setContentOffset:contentOffset animated:pendingState.animatesContentOffset]; } - + + let tuningParametersVector = pendingState->_tuningParameters; + let tuningParametersVectorSize = tuningParametersVector.size(); + for (NSInteger rangeMode = 0; rangeMode < tuningParametersVectorSize; rangeMode++) { + let tuningparametersRangeModeVector = tuningParametersVector[rangeMode]; + let tuningParametersVectorRangeModeSize = tuningparametersRangeModeVector.size(); + for (NSInteger rangeType = 0; rangeType < tuningParametersVectorRangeModeSize; rangeType++) { + ASRangeTuningParameters tuningParameters = tuningparametersRangeModeVector[rangeType]; + if (!ASRangeTuningParametersEqualToRangeTuningParameters(tuningParameters, ASRangeTuningParametersZero)) { + [_rangeController setTuningParameters:tuningParameters + forRangeMode:(ASLayoutRangeMode)rangeMode + rangeType:(ASLayoutRangeType)rangeType]; + } + } + } + if (pendingState.rangeMode != ASLayoutRangeModeUnspecified) { - [view.rangeController updateCurrentRangeWithMode:pendingState.rangeMode]; + [_rangeController updateCurrentRangeWithMode:pendingState.rangeMode]; } // Don't need to set collectionViewLayout to the view as the layout was already used to init the view in view block. @@ -260,7 +262,7 @@ // We can get rid of this call later when ASDataController, ASRangeController and ASCollectionLayout can operate without the view. // TODO (ASCL) If this node supports async layout, kick off the initial data load without allocating the view if (ASHierarchyStateIncludesRangeManaged(self.hierarchyState) && CGRectEqualToRect(self.bounds, CGRectZero) == NO) { - [[self view] layoutIfNeeded]; + [self.view layoutIfNeeded]; } } @@ -292,12 +294,6 @@ return self.view.dataController; } -// TODO: Implement this without the view. -- (ASRangeController *)rangeController -{ - return self.view.rangeController; -} - - (_ASCollectionPendingState *)pendingState { if (!_pendingState && ![self isNodeLoaded]) { @@ -654,22 +650,30 @@ - (ASRangeTuningParameters)tuningParametersForRangeType:(ASLayoutRangeType)rangeType { - return [self.rangeController tuningParametersForRangeMode:ASLayoutRangeModeFull rangeType:rangeType]; + return [self tuningParametersForRangeMode:ASLayoutRangeModeFull rangeType:rangeType]; } - (void)setTuningParameters:(ASRangeTuningParameters)tuningParameters forRangeType:(ASLayoutRangeType)rangeType { - [self.rangeController setTuningParameters:tuningParameters forRangeMode:ASLayoutRangeModeFull rangeType:rangeType]; + [self setTuningParameters:tuningParameters forRangeMode:ASLayoutRangeModeFull rangeType:rangeType]; } - (ASRangeTuningParameters)tuningParametersForRangeMode:(ASLayoutRangeMode)rangeMode rangeType:(ASLayoutRangeType)rangeType { - return [self.rangeController tuningParametersForRangeMode:rangeMode rangeType:rangeType]; + if ([self pendingState]) { + return [_pendingState tuningParametersForRangeMode:rangeMode rangeType:rangeType]; + } else { + return [self.rangeController tuningParametersForRangeMode:rangeMode rangeType:rangeType]; + } } - (void)setTuningParameters:(ASRangeTuningParameters)tuningParameters forRangeMode:(ASLayoutRangeMode)rangeMode rangeType:(ASLayoutRangeType)rangeType { - return [self.rangeController setTuningParameters:tuningParameters forRangeMode:rangeMode rangeType:rangeType]; + if ([self pendingState]) { + [_pendingState setTuningParameters:tuningParameters forRangeMode:rangeMode rangeType:rangeType]; + } else { + return [self.rangeController setTuningParameters:tuningParameters forRangeMode:rangeMode rangeType:rangeType]; + } } #pragma mark - Selection @@ -817,7 +821,7 @@ [self.view registerSupplementaryNodeOfKind:elementKind]; } -- (void)performBatchAnimated:(BOOL)animated updates:(void (^)())updates completion:(void (^)(BOOL))completion +- (void)performBatchAnimated:(BOOL)animated updates:(NS_NOESCAPE void (^)())updates completion:(void (^)(BOOL))completion { ASDisplayNodeAssertMainThread(); if (self.nodeLoaded) { @@ -832,7 +836,7 @@ } } -- (void)performBatchUpdates:(void (^)())updates completion:(void (^)(BOOL))completion +- (void)performBatchUpdates:(NS_NOESCAPE void (^)())updates completion:(void (^)(BOOL))completion { [self performBatchAnimated:UIView.areAnimationsEnabled updates:updates completion:completion]; } diff --git a/Source/ASCollectionView.h b/Source/ASCollectionView.h index 9a0ecc7f73..740efc41d9 100644 --- a/Source/ASCollectionView.h +++ b/Source/ASCollectionView.h @@ -2,17 +2,9 @@ // ASCollectionView.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK diff --git a/Source/ASCollectionView.mm b/Source/ASCollectionView.mm index b0a26b68ca..8c8fc853e2 100644 --- a/Source/ASCollectionView.mm +++ b/Source/ASCollectionView.mm @@ -2,17 +2,9 @@ // ASCollectionView.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK #import @@ -23,6 +15,7 @@ #import #import #import +#import #import #import #import @@ -146,6 +139,12 @@ static NSString * const kReuseIdentifier = @"_ASCollectionReuseIdentifier"; * (0 sections) we always check at least once after each update (initial reload is the first update.) */ BOOL _hasEverCheckedForBatchFetchingDueToUpdate; + + /** + * Set during beginInteractiveMovementForItemAtIndexPath and UIGestureRecognizerStateEnded + * (or UIGestureRecognizerStateFailed, UIGestureRecognizerStateCancelled. + */ + BOOL _reordering; /** * Counter used to keep track of nested batch updates. @@ -324,8 +323,10 @@ static NSString * const kReuseIdentifier = @"_ASCollectionReuseIdentifier"; // Sometimes the UIKit classes can call back to their delegate even during deallocation, due to animation completion blocks etc. _isDeallocating = YES; - [self setAsyncDelegate:nil]; - [self setAsyncDataSource:nil]; + if (!ASActivateExperimentalFeature(ASExperimentalCollectionTeardown)) { + [self setAsyncDelegate:nil]; + [self setAsyncDataSource:nil]; + } // Data controller & range controller may own a ton of nodes, let's deallocate those off-main. ASPerformBackgroundDeallocation(&_dataController); @@ -575,7 +576,8 @@ static NSString * const kReuseIdentifier = @"_ASCollectionReuseIdentifier"; - (void)_asyncDelegateOrDataSourceDidChange { ASDisplayNodeAssertMainThread(); - if (_asyncDataSource == nil && _asyncDelegate == nil) { + + if (_asyncDataSource == nil && _asyncDelegate == nil && _isDeallocating && ASActivateExperimentalFeature(ASExperimentalClearDataDuringDeallocation)) { [_dataController clearData]; } } @@ -749,19 +751,7 @@ static NSString * const kReuseIdentifier = @"_ASCollectionReuseIdentifier"; - (NSArray *)convertIndexPathsToCollectionNode:(NSArray *)indexPaths { - if (indexPaths == nil) { - return nil; - } - - NSMutableArray *indexPathsArray = [NSMutableArray arrayWithCapacity:indexPaths.count]; - - for (NSIndexPath *indexPathInView in indexPaths) { - NSIndexPath *indexPath = [self convertIndexPathToCollectionNode:indexPathInView]; - if (indexPath != nil) { - [indexPathsArray addObject:indexPath]; - } - } - return indexPathsArray; + return ASArrayByFlatMapping(indexPaths, NSIndexPath *viewIndexPath, [self convertIndexPathToCollectionNode:viewIndexPath]); } - (ASCellNode *)supplementaryNodeForElementKind:(NSString *)elementKind atIndexPath:(NSIndexPath *)indexPath @@ -931,7 +921,7 @@ static NSString * const kReuseIdentifier = @"_ASCollectionReuseIdentifier"; } } -- (void)performBatchAnimated:(BOOL)animated updates:(void (^)())updates completion:(void (^)(BOOL))completion +- (void)performBatchAnimated:(BOOL)animated updates:(NS_NOESCAPE void (^)())updates completion:(void (^)(BOOL))completion { ASDisplayNodeAssertMainThread(); [self beginUpdates]; @@ -946,7 +936,7 @@ static NSString * const kReuseIdentifier = @"_ASCollectionReuseIdentifier"; [self endUpdatesAnimated:animated completion:completion]; } -- (void)performBatchUpdates:(void (^)())updates completion:(void (^)(BOOL))completion +- (void)performBatchUpdates:(NS_NOESCAPE void (^)())updates completion:(void (^)(BOOL))completion { // We capture the current state of whether animations are enabled if they don't provide us with one. [self performBatchAnimated:[UIView areAnimationsEnabled] updates:updates completion:completion]; @@ -1030,9 +1020,29 @@ static NSString * const kReuseIdentifier = @"_ASCollectionReuseIdentifier"; - (void)moveItemAtIndexPath:(NSIndexPath *)indexPath toIndexPath:(NSIndexPath *)newIndexPath { ASDisplayNodeAssertMainThread(); - [self performBatchUpdates:^{ - [_changeSet moveItemAtIndexPath:indexPath toIndexPath:newIndexPath animationOptions:kASCollectionViewAnimationNone]; - } completion:nil]; + if (!_reordering) { + [self performBatchUpdates:^{ + [_changeSet moveItemAtIndexPath:indexPath toIndexPath:newIndexPath animationOptions:kASCollectionViewAnimationNone]; + } completion:nil]; + } else { + [super moveItemAtIndexPath:indexPath toIndexPath:newIndexPath]; + } +} + +- (BOOL)beginInteractiveMovementForItemAtIndexPath:(NSIndexPath *)indexPath { + BOOL success = [super beginInteractiveMovementForItemAtIndexPath:indexPath]; + _reordering = success; + return success; +} + +- (void)endInteractiveMovement { + _reordering = NO; + [super endInteractiveMovement]; +} + +- (void)cancelInteractiveMovement { + _reordering = NO; + [super cancelInteractiveMovement]; } #pragma mark - @@ -1554,7 +1564,7 @@ static NSString * const kReuseIdentifier = @"_ASCollectionReuseIdentifier"; // If the data source implements canMoveItem, let them decide. if (_asyncDataSourceFlags.collectionNodeCanMoveItem) { - if (auto cellNode = [self nodeForItemAtIndexPath:indexPath]) { + if (let cellNode = [self nodeForItemAtIndexPath:indexPath]) { GET_COLLECTIONNODE_OR_RETURN(collectionNode, NO); return [_asyncDataSource collectionNode:collectionNode canMoveItemWithNode:cellNode]; } @@ -1570,7 +1580,7 @@ static NSString * const kReuseIdentifier = @"_ASCollectionReuseIdentifier"; // Inform the data source first, in case they call nodeForItemAtIndexPath:. // We want to make sure we return them the node for the item they have in mind. - if (auto collectionNode = self.collectionNode) { + if (let collectionNode = self.collectionNode) { [_asyncDataSource collectionNode:collectionNode moveItemAtIndexPath:sourceIndexPath toIndexPath:destinationIndexPath]; } @@ -2005,7 +2015,7 @@ static NSString * const kReuseIdentifier = @"_ASCollectionReuseIdentifier"; - (NSArray *)dataController:(ASDataController *)dataController supplementaryNodeKindsInSections:(NSIndexSet *)sections { if (_asyncDataSourceFlags.collectionNodeSupplementaryElementKindsInSection) { - auto kinds = [[NSMutableSet alloc] init]; + let kinds = [[NSMutableSet alloc] init]; GET_COLLECTIONNODE_OR_RETURN(collectionNode, @[]); [sections enumerateIndexesUsingBlock:^(NSUInteger section, BOOL * _Nonnull stop) { NSArray *kindsForSection = [_asyncDataSource collectionNode:collectionNode supplementaryElementKindsInSection:section]; @@ -2223,13 +2233,7 @@ static NSString * const kReuseIdentifier = @"_ASCollectionReuseIdentifier"; return; } - NSMutableArray *uikitIndexPaths = [NSMutableArray arrayWithCapacity:nodes.count]; - for (ASCellNode *node in nodes) { - NSIndexPath *uikitIndexPath = [self indexPathForNode:node]; - if (uikitIndexPath != nil) { - [uikitIndexPaths addObject:uikitIndexPath]; - } - } + let uikitIndexPaths = ASArrayByFlatMapping(nodes, ASCellNode *node, [self indexPathForNode:node]); [_layoutFacilitator collectionViewWillEditCellsAtIndexPaths:uikitIndexPaths batched:NO]; diff --git a/Source/ASCollectionViewLayoutFacilitatorProtocol.h b/Source/ASCollectionViewLayoutFacilitatorProtocol.h index 5358e9cec8..b60dd0e02f 100644 --- a/Source/ASCollectionViewLayoutFacilitatorProtocol.h +++ b/Source/ASCollectionViewLayoutFacilitatorProtocol.h @@ -2,17 +2,9 @@ // ASCollectionViewLayoutFacilitatorProtocol.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK diff --git a/Source/ASCollectionViewProtocols.h b/Source/ASCollectionViewProtocols.h index 8779ee15b2..ef18449f8e 100644 --- a/Source/ASCollectionViewProtocols.h +++ b/Source/ASCollectionViewProtocols.h @@ -2,17 +2,9 @@ // ASCollectionViewProtocols.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK diff --git a/Source/ASCollections.h b/Source/ASCollections.h new file mode 100644 index 0000000000..ca3b31c65c --- /dev/null +++ b/Source/ASCollections.h @@ -0,0 +1,38 @@ +// +// ASCollections.h +// Texture +// +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface NSArray<__covariant ObjectType> (ASCollections) + +/** + * Create an immutable NSArray from a C-array of strong pointers. + * + * Note: The memory for the array you pass in will be zero'd (to prevent ARC from releasing + * the references when the array goes out of scope.) + * + * Can be combined with vector like: + * vector vec; + * vec.push_back(@"foo"); + * vec.push_back(@"bar"); + * NSArray *arr = [NSArray arrayTransferring:vec.data() count:vec.size()] + * ** vec is now { nil, nil } ** + * + * Unfortunately making a convenience method to do this is currently impossible because + * vector can't be converted to vector by the compiler (silly). + * + * See the private __CFArrayCreateTransfer function. + */ ++ (NSArray *)arrayByTransferring:(ObjectType _Nonnull __strong * _Nonnull)pointers + count:(NSUInteger)count NS_RETURNS_RETAINED; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Source/ASCollections.m b/Source/ASCollections.m new file mode 100644 index 0000000000..4428d07389 --- /dev/null +++ b/Source/ASCollections.m @@ -0,0 +1,61 @@ +// +// ASCollections.m +// Texture +// +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 +// + +#import "ASCollections.h" + +/** + * A private allocator that signals to our retain callback to skip the retain. + * It behaves the same as the default allocator, but acts as a signal that we + * are creating a transfer array so we should skip the retain. + */ +static CFAllocatorRef gTransferAllocator; + +static const void *ASTransferRetain(CFAllocatorRef allocator, const void *val) { + if (allocator == gTransferAllocator) { + // Transfer allocator. Ignore retain and pass through. + return val; + } else { + // Other allocator. Retain like normal. + // This happens when they make a mutable copy. + return (&kCFTypeArrayCallBacks)->retain(allocator, val); + } +} + +@implementation NSArray (ASCollections) + ++ (NSArray *)arrayByTransferring:(__strong id *)pointers count:(NSUInteger)count NS_RETURNS_RETAINED +{ + // Custom callbacks that point to our ASTransferRetain callback. + static CFArrayCallBacks callbacks; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + callbacks = kCFTypeArrayCallBacks; + callbacks.retain = ASTransferRetain; + CFAllocatorContext ctx; + CFAllocatorGetContext(NULL, &ctx); + gTransferAllocator = CFAllocatorCreate(NULL, &ctx); + }); + + // NSZeroArray fast path. + if (count == 0) { + return @[]; // Does not actually call +array when optimized. + } + + // NSSingleObjectArray fast path. Retain/release here is worth it. + if (count == 1) { + NSArray *result = [[NSArray alloc] initWithObjects:pointers count:1]; + pointers[0] = nil; + return result; + } + + NSArray *result = (__bridge_transfer NSArray *)CFArrayCreate(gTransferAllocator, (const void **)(void *)pointers, count, &callbacks); + memset(pointers, 0, count * sizeof(id)); + return result; +} + +@end diff --git a/Source/ASConfiguration.h b/Source/ASConfiguration.h index af0d3ae098..c529dad801 100644 --- a/Source/ASConfiguration.h +++ b/Source/ASConfiguration.h @@ -2,12 +2,8 @@ // ASConfiguration.h // Texture // -// Copyright (c) 2018-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/ASConfiguration.m b/Source/ASConfiguration.m index 93c8c8fb04..7923f5837c 100644 --- a/Source/ASConfiguration.m +++ b/Source/ASConfiguration.m @@ -2,12 +2,8 @@ // ASConfiguration.m // Texture // -// Copyright (c) 2018-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import @@ -15,20 +11,21 @@ /// Not too performance-sensitive here. -/// Get this from C++, without the extra exception handling. -#define autotype __auto_type - @implementation ASConfiguration - (instancetype)initWithDictionary:(NSDictionary *)dictionary { if (self = [super init]) { - autotype featureStrings = ASDynamicCast(dictionary[@"experimental_features"], NSArray); - autotype version = ASDynamicCast(dictionary[@"version"], NSNumber).integerValue; - if (version != ASConfigurationSchemaCurrentVersion) { - NSLog(@"Texture warning: configuration schema is old version (%zd vs %zd)", version, ASConfigurationSchemaCurrentVersion); + if (dictionary != nil) { + let featureStrings = ASDynamicCast(dictionary[@"experimental_features"], NSArray); + let version = ASDynamicCast(dictionary[@"version"], NSNumber).integerValue; + if (version != ASConfigurationSchemaCurrentVersion) { + NSLog(@"Texture warning: configuration schema is old version (%ld vs %ld)", (long)version, (long)ASConfigurationSchemaCurrentVersion); + } + self.experimentalFeatures = ASExperimentalFeaturesFromArray(featureStrings); + } else { + self.experimentalFeatures = kNilOptions; } - self.experimentalFeatures = ASExperimentalFeaturesFromArray(featureStrings); } return self; } diff --git a/Source/ASConfigurationDelegate.h b/Source/ASConfigurationDelegate.h index 88055f0379..127ec3eb14 100644 --- a/Source/ASConfigurationDelegate.h +++ b/Source/ASConfigurationDelegate.h @@ -2,12 +2,8 @@ // ASConfigurationDelegate.h // Texture // -// Copyright (c) 2018-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import @@ -26,6 +22,16 @@ NS_ASSUME_NONNULL_BEGIN */ - (void)textureDidActivateExperimentalFeatures:(ASExperimentalFeatures)features; +@optional + +/** + * Texture framework initialized. This method is called synchronously + * on the main thread from ASInitializeFrameworkMainThread if you defined + * AS_INITIALIZE_FRAMEWORK_MANUALLY or from the default initialization point + * (currently +load) otherwise. + */ +- (void)textureDidInitialize; + @end NS_ASSUME_NONNULL_END diff --git a/Source/ASConfigurationInternal.h b/Source/ASConfigurationInternal.h index 0d2662acd7..8e744e65cd 100644 --- a/Source/ASConfigurationInternal.h +++ b/Source/ASConfigurationInternal.h @@ -2,12 +2,8 @@ // ASConfigurationInternal.h // Texture // -// Copyright (c) 2018-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // /// Note this has to be public because it's imported by public header ASThread.h =/ @@ -26,6 +22,11 @@ NS_ASSUME_NONNULL_BEGIN */ AS_EXTERN BOOL ASActivateExperimentalFeature(ASExperimentalFeatures option); +/** + * Notify the configuration delegate that the framework initialized, if needed. + */ +AS_EXTERN void ASNotifyInitialized(void); + AS_SUBCLASSING_RESTRICTED @interface ASConfigurationManager : NSObject diff --git a/Source/ASConfigurationInternal.m b/Source/ASConfigurationInternal.m index 9d7c1bcf5a..4fb9685ea8 100644 --- a/Source/ASConfigurationInternal.m +++ b/Source/ASConfigurationInternal.m @@ -2,15 +2,12 @@ // ASConfigurationInternal.m // Texture // -// Copyright (c) 2018-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ASConfigurationInternal.h" +#import #import #import #import @@ -20,6 +17,7 @@ @implementation ASConfigurationManager { ASConfiguration *_config; dispatch_queue_t _delegateQueue; + BOOL _frameworkInitialized; _Atomic(ASExperimentalFeatures) _activatedExperiments; } @@ -55,6 +53,21 @@ return self; } +- (void)frameworkDidInitialize +{ + ASDisplayNodeAssertMainThread(); + if (_frameworkInitialized) { + ASDisplayNodeFailAssert(@"Framework initialized twice."); + return; + } + _frameworkInitialized = YES; + + let delegate = _config.delegate; + if ([delegate respondsToSelector:@selector(textureDidInitialize)]) { + [delegate textureDidInitialize]; + } +} + - (BOOL)activateExperimentalFeature:(ASExperimentalFeatures)requested { if (_config == nil) { @@ -94,3 +107,8 @@ BOOL ASActivateExperimentalFeature(ASExperimentalFeatures feature) { return [ASGetSharedConfigMgr() activateExperimentalFeature:feature]; } + +void ASNotifyInitialized() +{ + [ASGetSharedConfigMgr() frameworkDidInitialize]; +} diff --git a/Source/ASContextTransitioning.h b/Source/ASContextTransitioning.h index f433b85f10..9802ecefc4 100644 --- a/Source/ASContextTransitioning.h +++ b/Source/ASContextTransitioning.h @@ -2,17 +2,9 @@ // ASContextTransitioning.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/ASControlNode+Subclasses.h b/Source/ASControlNode+Subclasses.h index f77f639435..2e9cdb2849 100644 --- a/Source/ASControlNode+Subclasses.h +++ b/Source/ASControlNode+Subclasses.h @@ -2,17 +2,9 @@ // ASControlNode+Subclasses.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/ASControlNode.h b/Source/ASControlNode.h index a3cc8b2369..0918fdb0b0 100644 --- a/Source/ASControlNode.h +++ b/Source/ASControlNode.h @@ -2,17 +2,9 @@ // ASControlNode.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/ASControlNode.mm b/Source/ASControlNode.mm index a3a18efe57..1256d2d629 100644 --- a/Source/ASControlNode.mm +++ b/Source/ASControlNode.mm @@ -2,17 +2,9 @@ // ASControlNode.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import @@ -303,7 +295,9 @@ CGRect _ASControlNodeGetExpandedBounds(ASControlNode *controlNode); // only show tap-able areas for views with 1 or more addTarget:action: pairs if ([ASControlNode enableHitTestDebug] && _debugHighlightOverlay == nil) { - ASPerformBlockOnMainThread(^{ + // do not use ASPerformBlockOnMainThread here, if it performs the block synchronously it will continue + // holding the lock while calling addSubnode. + dispatch_async(dispatch_get_main_queue(), ^{ // add a highlight overlay node with area of ASControlNode + UIEdgeInsets self.clipsToBounds = NO; _debugHighlightOverlay = [[ASImageNode alloc] init]; diff --git a/Source/ASDisplayNode+Beta.h b/Source/ASDisplayNode+Beta.h index cd42006ccb..e140721cc6 100644 --- a/Source/ASDisplayNode+Beta.h +++ b/Source/ASDisplayNode+Beta.h @@ -2,17 +2,9 @@ // ASDisplayNode+Beta.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/ASDisplayNode+Convenience.h b/Source/ASDisplayNode+Convenience.h index b5806b0f7f..3c00f67213 100644 --- a/Source/ASDisplayNode+Convenience.h +++ b/Source/ASDisplayNode+Convenience.h @@ -2,17 +2,9 @@ // ASDisplayNode+Convenience.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/ASDisplayNode+Convenience.m b/Source/ASDisplayNode+Convenience.m index 4e47f78ace..c5d2c981ed 100644 --- a/Source/ASDisplayNode+Convenience.m +++ b/Source/ASDisplayNode+Convenience.m @@ -2,17 +2,9 @@ // ASDisplayNode+Convenience.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ASDisplayNode+Convenience.h" diff --git a/Source/ASDisplayNode+InterfaceState.h b/Source/ASDisplayNode+InterfaceState.h new file mode 100644 index 0000000000..ec4414bb77 --- /dev/null +++ b/Source/ASDisplayNode+InterfaceState.h @@ -0,0 +1,119 @@ +// +// ASDisplayNode+InterfaceState.h +// Texture +// +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 +// + +#import + +/** + * Interface state is available on ASDisplayNode and ASViewController, and + * allows checking whether a node is in an interface situation where it is prudent to trigger certain + * actions: measurement, data loading, display, and visibility (the latter for animations or other onscreen-only effects). + * + * The defualt state, ASInterfaceStateNone, means that the element is not predicted to be onscreen soon and + * preloading should not be performed. Swift: use [] for the default behavior. + */ +typedef NS_OPTIONS(NSUInteger, ASInterfaceState) +{ + /** The element is not predicted to be onscreen soon and preloading should not be performed */ + ASInterfaceStateNone = 0, + /** The element may be added to a view soon that could become visible. Measure the layout, including size calculation. */ + ASInterfaceStateMeasureLayout = 1 << 0, + /** The element is likely enough to come onscreen that disk and/or network data required for display should be fetched. */ + ASInterfaceStatePreload = 1 << 1, + /** The element is very likely to become visible, and concurrent rendering should be executed for any -setNeedsDisplay. */ + ASInterfaceStateDisplay = 1 << 2, + /** The element is physically onscreen by at least 1 pixel. + In practice, all other bit fields should also be set when this flag is set. */ + ASInterfaceStateVisible = 1 << 3, + + /** + * The node is not contained in a cell but it is in a window. + * + * Currently we only set `interfaceState` to other values for + * nodes contained in table views or collection views. + */ + ASInterfaceStateInHierarchy = ASInterfaceStateMeasureLayout | ASInterfaceStatePreload | ASInterfaceStateDisplay | ASInterfaceStateVisible, +}; + +@protocol ASInterfaceStateDelegate + +/** + * @abstract Called whenever any bit in the ASInterfaceState bitfield is changed. + * @discussion Subclasses may use this to monitor when they become visible, should free cached data, and much more. + * @see ASInterfaceState + */ +- (void)interfaceStateDidChange:(ASInterfaceState)newState fromState:(ASInterfaceState)oldState; + +/** + * @abstract Called whenever the node becomes visible. + * @discussion Subclasses may use this to monitor when they become visible. + * @note This method is guaranteed to be called on main. + */ +- (void)didEnterVisibleState; + +/** + * @abstract Called whenever the node is no longer visible. + * @discussion Subclasses may use this to monitor when they are no longer visible. + * @note This method is guaranteed to be called on main. + */ +- (void)didExitVisibleState; + +/** + * @abstract Called whenever the the node has entered the display state. + * @discussion Subclasses may use this to monitor when a node should be rendering its content. + * @note This method is guaranteed to be called on main. + */ +- (void)didEnterDisplayState; + +/** + * @abstract Called whenever the the node has exited the display state. + * @discussion Subclasses may use this to monitor when a node should no longer be rendering its content. + * @note This method is guaranteed to be called on main. + */ +- (void)didExitDisplayState; + +/** + * @abstract Called whenever the the node has entered the preload state. + * @discussion Subclasses may use this to monitor data for a node should be preloaded, either from a local or remote source. + * @note This method is guaranteed to be called on main. + */ +- (void)didEnterPreloadState; + +/** + * @abstract Called whenever the the node has exited the preload state. + * @discussion Subclasses may use this to monitor whether preloading data for a node should be canceled. + * @note This method is guaranteed to be called on main. + */ +- (void)didExitPreloadState; + +/** + * @abstract Called when the node has completed applying the layout. + * @discussion Can be used for operations that are performed after layout has completed. + * @note This method is guaranteed to be called on main. + */ +- (void)nodeDidLayout; + +/** + * @abstract Called when the node loads. + * @discussion Can be used for operations that are performed after the node's view is available. + * @note This method is guaranteed to be called on main. + */ +- (void)nodeDidLoad; + +/** + * @abstract Indicates that the receiver and all subnodes have finished displaying. + * @discussion May be called more than once, for example if the receiver has a network image node. + * This is called after the first display pass even if network image nodes have not downloaded anything + * (text would be done, and other nodes that are ready to do their final display). Each render of + * every progressive jpeg network node would cause this to be called, so this hook could be called up to + * 1 + (pJPEGcount * pJPEGrenderCount) times. The render count depends on how many times the downloader calls + * the progressImage block. + * @note This method is guaranteed to be called on main. + */ +- (void)hierarchyDisplayDidFinish; + +@end diff --git a/Source/ASDisplayNode+Layout.mm b/Source/ASDisplayNode+Layout.mm index 843ce5f7a4..532cc73e9c 100644 --- a/Source/ASDisplayNode+Layout.mm +++ b/Source/ASDisplayNode+Layout.mm @@ -2,17 +2,9 @@ // ASDisplayNode+Layout.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) through the present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import @@ -82,19 +74,19 @@ ASLayout *layout = nil; NSUInteger version = _layoutVersion; - if (_calculatedDisplayNodeLayout->isValid(constrainedSize, parentSize, version)) { - ASDisplayNodeAssertNotNil(_calculatedDisplayNodeLayout->layout, @"-[ASDisplayNode layoutThatFits:parentSize:] _calculatedDisplayNodeLayout->layout should not be nil! %@", self); - layout = _calculatedDisplayNodeLayout->layout; - } else if (_pendingDisplayNodeLayout != nullptr && _pendingDisplayNodeLayout->isValid(constrainedSize, parentSize, version)) { - ASDisplayNodeAssertNotNil(_pendingDisplayNodeLayout->layout, @"-[ASDisplayNode layoutThatFits:parentSize:] _pendingDisplayNodeLayout->layout should not be nil! %@", self); - layout = _pendingDisplayNodeLayout->layout; + if (_calculatedDisplayNodeLayout.isValid(constrainedSize, parentSize, version)) { + ASDisplayNodeAssertNotNil(_calculatedDisplayNodeLayout.layout, @"-[ASDisplayNode layoutThatFits:parentSize:] _calculatedDisplayNodeLayout.layout should not be nil! %@", self); + layout = _calculatedDisplayNodeLayout.layout; + } else if (_pendingDisplayNodeLayout.isValid(constrainedSize, parentSize, version)) { + ASDisplayNodeAssertNotNil(_pendingDisplayNodeLayout.layout, @"-[ASDisplayNode layoutThatFits:parentSize:] _pendingDisplayNodeLayout.layout should not be nil! %@", self); + layout = _pendingDisplayNodeLayout.layout; } else { // Create a pending display node layout for the layout pass layout = [self calculateLayoutThatFits:constrainedSize restrictedToSize:self.style.size relativeToParentSize:parentSize]; as_log_verbose(ASLayoutLog(), "Established pending layout for %@ in %s", self, sel_getName(_cmd)); - _pendingDisplayNodeLayout = std::make_shared(layout, constrainedSize, parentSize, version); + _pendingDisplayNodeLayout = ASDisplayNodeLayout(layout, constrainedSize, parentSize,version); ASDisplayNodeAssertNotNil(layout, @"-[ASDisplayNode layoutThatFits:parentSize:] newly calculated layout should not be nil! %@", self); } @@ -168,16 +160,16 @@ ASLayoutElementStyleExtensibilityForwarding - (ASLayout *)calculatedLayout { ASDN::MutexLocker l(__instanceLock__); - return _calculatedDisplayNodeLayout->layout; + return _calculatedDisplayNodeLayout.layout; } - (CGSize)calculatedSize { ASDN::MutexLocker l(__instanceLock__); - if (_pendingDisplayNodeLayout != nullptr && _pendingDisplayNodeLayout->isValid(_layoutVersion)) { - return _pendingDisplayNodeLayout->layout.size; + if (_pendingDisplayNodeLayout.isValid(_layoutVersion)) { + return _pendingDisplayNodeLayout.layout.size; } - return _calculatedDisplayNodeLayout->layout.size; + return _calculatedDisplayNodeLayout.layout.size; } - (ASSizeRange)constrainedSizeForCalculatedLayout @@ -188,10 +180,11 @@ ASLayoutElementStyleExtensibilityForwarding - (ASSizeRange)_locked_constrainedSizeForCalculatedLayout { - if (_pendingDisplayNodeLayout != nullptr && _pendingDisplayNodeLayout->isValid(_layoutVersion)) { - return _pendingDisplayNodeLayout->constrainedSize; + ASAssertLocked(__instanceLock__); + if (_pendingDisplayNodeLayout.isValid(_layoutVersion)) { + return _pendingDisplayNodeLayout.constrainedSize; } - return _calculatedDisplayNodeLayout->constrainedSize; + return _calculatedDisplayNodeLayout.constrainedSize; } @end @@ -222,9 +215,10 @@ ASLayoutElementStyleExtensibilityForwarding */ - (void)_u_setNeedsLayoutFromAbove { - ASDisplayNodeAssertLockUnownedByCurrentThread(__instanceLock); - as_activity_create_for_scope("Set needs layout from above"); ASDisplayNodeAssertThreadAffinity(self); + ASAssertUnlocked(__instanceLock__); + + as_activity_create_for_scope("Set needs layout from above"); // Mark the node for layout in the next layout pass [self setNeedsLayout]; @@ -247,7 +241,7 @@ ASLayoutElementStyleExtensibilityForwarding - (void)_rootNodeDidInvalidateSize { ASDisplayNodeAssertThreadAffinity(self); - ASDisplayNodeAssertLockUnownedByCurrentThread(__instanceLock__); + ASAssertUnlocked(__instanceLock__); __instanceLock__.lock(); @@ -256,10 +250,10 @@ ASLayoutElementStyleExtensibilityForwarding // Figure out constrainedSize to use ASSizeRange constrainedSize = ASSizeRangeMake(boundsSizeForLayout); - if (_pendingDisplayNodeLayout != nullptr) { - constrainedSize = _pendingDisplayNodeLayout->constrainedSize; - } else if (_calculatedDisplayNodeLayout->layout != nil) { - constrainedSize = _calculatedDisplayNodeLayout->constrainedSize; + if (_pendingDisplayNodeLayout.layout != nil) { + constrainedSize = _pendingDisplayNodeLayout.constrainedSize; + } else if (_calculatedDisplayNodeLayout.layout != nil) { + constrainedSize = _calculatedDisplayNodeLayout.constrainedSize; } __instanceLock__.unlock(); @@ -277,7 +271,7 @@ ASLayoutElementStyleExtensibilityForwarding - (void)displayNodeDidInvalidateSizeNewSize:(CGSize)size { ASDisplayNodeAssertThreadAffinity(self); - ASDisplayNodeAssertLockUnownedByCurrentThread(__instanceLock__); + ASAssertUnlocked(__instanceLock__); // The default implementation of display node changes the size of itself to the new size CGRect oldBounds = self.bounds; @@ -299,139 +293,158 @@ ASLayoutElementStyleExtensibilityForwarding - (void)_u_measureNodeWithBoundsIfNecessary:(CGRect)bounds { - ASDisplayNodeAssertLockUnownedByCurrentThread(__instanceLock); - ASDN::MutexLocker l(__instanceLock__); - // Check if we are a subnode in a layout transition. - // In this case no measurement is needed as it's part of the layout transition - if ([self _isLayoutTransitionInvalid]) { - return; - } + ASAssertUnlocked(__instanceLock__); - CGSize boundsSizeForLayout = ASCeilSizeValues(bounds.size); - - // Prefer a newer and not yet applied _pendingDisplayNodeLayout over _calculatedDisplayNodeLayout - // If there is no such _pending, check if _calculated is valid to reuse (avoiding recalculation below). - BOOL pendingLayoutIsPreferred = NO; - if (_pendingDisplayNodeLayout != nullptr && _pendingDisplayNodeLayout->isValid(_layoutVersion)) { - NSUInteger calculatedVersion = _calculatedDisplayNodeLayout->version; - NSUInteger pendingVersion = _pendingDisplayNodeLayout->version; - if (pendingVersion > calculatedVersion) { - pendingLayoutIsPreferred = YES; // Newer _pending - } else if (pendingVersion == calculatedVersion - && !ASSizeRangeEqualToSizeRange(_pendingDisplayNodeLayout->constrainedSize, - _calculatedDisplayNodeLayout->constrainedSize)) { - pendingLayoutIsPreferred = YES; // _pending with a different constrained size + BOOL isInLayoutPendingState = NO; + { + ASDN::MutexLocker l(__instanceLock__); + // Check if we are a subnode in a layout transition. + // In this case no measurement is needed as it's part of the layout transition + if ([self _locked_isLayoutTransitionInvalid]) { + return; } - } - BOOL calculatedLayoutIsReusable = (_calculatedDisplayNodeLayout->isValid(_layoutVersion) - && (_calculatedDisplayNodeLayout->requestedLayoutFromAbove - || CGSizeEqualToSize(_calculatedDisplayNodeLayout->layout.size, boundsSizeForLayout))); - if (!pendingLayoutIsPreferred && calculatedLayoutIsReusable) { - return; - } - - as_activity_create_for_scope("Update node layout for current bounds"); - as_log_verbose(ASLayoutLog(), "Node %@, bounds size %@, calculatedSize %@, calculatedIsDirty %d", self, NSStringFromCGSize(boundsSizeForLayout), NSStringFromCGSize(_calculatedDisplayNodeLayout->layout.size), _calculatedDisplayNodeLayout->version < _layoutVersion.load()); - // _calculatedDisplayNodeLayout is not reusable we need to transition to a new one - [self cancelLayoutTransition]; - - BOOL didCreateNewContext = NO; - ASLayoutElementContext *context = ASLayoutElementGetCurrentContext(); - if (context == nil) { - context = [[ASLayoutElementContext alloc] init]; - ASLayoutElementPushContext(context); - didCreateNewContext = YES; - } - - // Figure out previous and pending layouts for layout transition - std::shared_ptr nextLayout = _pendingDisplayNodeLayout; - #define layoutSizeDifferentFromBounds !CGSizeEqualToSize(nextLayout->layout.size, boundsSizeForLayout) - - // nextLayout was likely created by a call to layoutThatFits:, check if it is valid and can be applied. - // If our bounds size is different than it, or invalid, recalculate. Use #define to avoid nullptr-> - BOOL pendingLayoutApplicable = NO; - if (nextLayout == nullptr) { - as_log_verbose(ASLayoutLog(), "No pending layout."); - } else if (nextLayout->version < _layoutVersion) { - as_log_verbose(ASLayoutLog(), "Pending layout is stale."); - } else if (layoutSizeDifferentFromBounds) { - as_log_verbose(ASLayoutLog(), "Pending layout size %@ doesn't match bounds size.", NSStringFromCGSize(nextLayout->layout.size)); - } else { - as_log_verbose(ASLayoutLog(), "Using pending layout %@.", nextLayout->layout); - pendingLayoutApplicable = YES; - } - if (!pendingLayoutApplicable) { - as_log_verbose(ASLayoutLog(), "Measuring with previous constrained size."); - // Use the last known constrainedSize passed from a parent during layout (if never, use bounds). - NSUInteger version = _layoutVersion; - ASSizeRange constrainedSize = [self _locked_constrainedSizeForLayoutPass]; - ASLayout *layout = [self calculateLayoutThatFits:constrainedSize - restrictedToSize:self.style.size - relativeToParentSize:boundsSizeForLayout]; - nextLayout = std::make_shared(layout, constrainedSize, boundsSizeForLayout, version); - // Now that the constrained size of pending layout might have been reused, the layout is useless - // Release it and any orphaned subnodes it retains - _pendingDisplayNodeLayout = nullptr; - } - - if (didCreateNewContext) { - ASLayoutElementPopContext(); - } - - // If our new layout's desired size for self doesn't match current size, ask our parent to update it. - // This can occur for either pre-calculated or newly-calculated layouts. - if (nextLayout->requestedLayoutFromAbove == NO - && CGSizeEqualToSize(boundsSizeForLayout, nextLayout->layout.size) == NO) { - as_log_verbose(ASLayoutLog(), "Layout size doesn't match bounds size. Requesting layout from above."); - // The layout that we have specifies that this node (self) would like to be a different size - // than it currently is. Because that size has been computed within the constrainedSize, we - // expect that calling setNeedsLayoutFromAbove will result in our parent resizing us to this. - // However, in some cases apps may manually interfere with this (setting a different bounds). - // In this case, we need to detect that we've already asked to be resized to match this - // particular ASLayout object, and shouldn't loop asking again unless we have a different ASLayout. - nextLayout->requestedLayoutFromAbove = YES; - __instanceLock__.unlock(); - [self _u_setNeedsLayoutFromAbove]; - __instanceLock__.lock(); - // Update the layout's version here because _u_setNeedsLayoutFromAbove calls __setNeedsLayout which in turn increases _layoutVersion - // Failing to do this will cause the layout to be invalid immediately - nextLayout->version = _layoutVersion; - } + CGSize boundsSizeForLayout = ASCeilSizeValues(bounds.size); - // Prepare to transition to nextLayout - ASDisplayNodeAssertNotNil(nextLayout->layout, @"nextLayout->layout should not be nil! %@", self); - _pendingLayoutTransition = [[ASLayoutTransition alloc] initWithNode:self - pendingLayout:nextLayout - previousLayout:_calculatedDisplayNodeLayout]; + // Prefer a newer and not yet applied _pendingDisplayNodeLayout over _calculatedDisplayNodeLayout + // If there is no such _pending, check if _calculated is valid to reuse (avoiding recalculation below). + BOOL pendingLayoutIsPreferred = NO; + if (_pendingDisplayNodeLayout.isValid(_layoutVersion)) { + NSUInteger calculatedVersion = _calculatedDisplayNodeLayout.version; + NSUInteger pendingVersion = _pendingDisplayNodeLayout.version; + if (pendingVersion > calculatedVersion) { + pendingLayoutIsPreferred = YES; // Newer _pending + } else if (pendingVersion == calculatedVersion + && !ASSizeRangeEqualToSizeRange(_pendingDisplayNodeLayout.constrainedSize, + _calculatedDisplayNodeLayout.constrainedSize)) { + pendingLayoutIsPreferred = YES; // _pending with a different constrained size + } + } + BOOL calculatedLayoutIsReusable = (_calculatedDisplayNodeLayout.isValid(_layoutVersion) + && (_calculatedDisplayNodeLayout.requestedLayoutFromAbove + || CGSizeEqualToSize(_calculatedDisplayNodeLayout.layout.size, boundsSizeForLayout))); + if (!pendingLayoutIsPreferred && calculatedLayoutIsReusable) { + return; + } + + as_activity_create_for_scope("Update node layout for current bounds"); + as_log_verbose(ASLayoutLog(), "Node %@, bounds size %@, calculatedSize %@, calculatedIsDirty %d", + self, + NSStringFromCGSize(boundsSizeForLayout), + NSStringFromCGSize(_calculatedDisplayNodeLayout->layout.size), + _calculatedDisplayNodeLayout->version < _layoutVersion); + // _calculatedDisplayNodeLayout is not reusable we need to transition to a new one + [self cancelLayoutTransition]; + + BOOL didCreateNewContext = NO; + ASLayoutElementContext *context = ASLayoutElementGetCurrentContext(); + if (context == nil) { + context = [[ASLayoutElementContext alloc] init]; + ASLayoutElementPushContext(context); + didCreateNewContext = YES; + } + + // Figure out previous and pending layouts for layout transition + ASDisplayNodeLayout nextLayout = _pendingDisplayNodeLayout; + #define layoutSizeDifferentFromBounds !CGSizeEqualToSize(nextLayout.layout.size, boundsSizeForLayout) + + // nextLayout was likely created by a call to layoutThatFits:, check if it is valid and can be applied. + // If our bounds size is different than it, or invalid, recalculate. Use #define to avoid nullptr-> + BOOL pendingLayoutApplicable = NO; + if (nextLayout.layout == nil) { + as_log_verbose(ASLayoutLog(), "No pending layout."); + } else if (!nextLayout.isValid(_layoutVersion)) { + as_log_verbose(ASLayoutLog(), "Pending layout is stale."); + } else if (layoutSizeDifferentFromBounds) { + as_log_verbose(ASLayoutLog(), "Pending layout size %@ doesn't match bounds size.", NSStringFromCGSize(nextLayout->layout.size)); + } else { + as_log_verbose(ASLayoutLog(), "Using pending layout %@.", nextLayout->layout); + pendingLayoutApplicable = YES; + } + + if (!pendingLayoutApplicable) { + as_log_verbose(ASLayoutLog(), "Measuring with previous constrained size."); + // Use the last known constrainedSize passed from a parent during layout (if never, use bounds). + NSUInteger version = _layoutVersion; + ASSizeRange constrainedSize = [self _locked_constrainedSizeForLayoutPass]; + ASLayout *layout = [self calculateLayoutThatFits:constrainedSize + restrictedToSize:self.style.size + relativeToParentSize:boundsSizeForLayout]; + nextLayout = ASDisplayNodeLayout(layout, constrainedSize, boundsSizeForLayout, version); + // Now that the constrained size of pending layout might have been reused, the layout is useless + // Release it and any orphaned subnodes it retains + _pendingDisplayNodeLayout.layout = nil; + } + + if (didCreateNewContext) { + ASLayoutElementPopContext(); + } + + // If our new layout's desired size for self doesn't match current size, ask our parent to update it. + // This can occur for either pre-calculated or newly-calculated layouts. + if (nextLayout.requestedLayoutFromAbove == NO + && CGSizeEqualToSize(boundsSizeForLayout, nextLayout.layout.size) == NO) { + as_log_verbose(ASLayoutLog(), "Layout size doesn't match bounds size. Requesting layout from above."); + // The layout that we have specifies that this node (self) would like to be a different size + // than it currently is. Because that size has been computed within the constrainedSize, we + // expect that calling setNeedsLayoutFromAbove will result in our parent resizing us to this. + // However, in some cases apps may manually interfere with this (setting a different bounds). + // In this case, we need to detect that we've already asked to be resized to match this + // particular ASLayout object, and shouldn't loop asking again unless we have a different ASLayout. + nextLayout.requestedLayoutFromAbove = YES; + + { + ASDN::MutexUnlocker u(__instanceLock__); + [self _u_setNeedsLayoutFromAbove]; + } + + // Update the layout's version here because _u_setNeedsLayoutFromAbove calls __setNeedsLayout which in turn increases _layoutVersion + // Failing to do this will cause the layout to be invalid immediately + nextLayout.version = _layoutVersion; + } + + // Prepare to transition to nextLayout + ASDisplayNodeAssertNotNil(nextLayout.layout, @"nextLayout->layout should not be nil! %@", self); + _pendingLayoutTransition = [[ASLayoutTransition alloc] initWithNode:self + pendingLayout:nextLayout + previousLayout:_calculatedDisplayNodeLayout]; + isInLayoutPendingState = ASHierarchyStateIncludesLayoutPending(_hierarchyState); + } // If a parent is currently executing a layout transition, perform our layout application after it. - if (ASHierarchyStateIncludesLayoutPending(_hierarchyState) == NO) { + if (isInLayoutPendingState == NO) { // If no transition, apply our new layout immediately (common case). [self _completePendingLayoutTransition]; } } +- (ASSizeRange)_constrainedSizeForLayoutPass +{ + ASDN::MutexLocker l(__instanceLock__); + return [self _locked_constrainedSizeForLayoutPass]; +} + - (ASSizeRange)_locked_constrainedSizeForLayoutPass { // TODO: The logic in -_u_setNeedsLayoutFromAbove seems correct and doesn't use this method. // logic seems correct. For what case does -this method need to do the CGSizeEqual checks? // IF WE CAN REMOVE BOUNDS CHECKS HERE, THEN WE CAN ALSO REMOVE "REQUESTED FROM ABOVE" CHECK - + + ASAssertLocked(__instanceLock__); + CGSize boundsSizeForLayout = ASCeilSizeValues(self.threadSafeBounds.size); - + // Checkout if constrained size of pending or calculated display node layout can be used - if (_pendingDisplayNodeLayout != nullptr - && (_pendingDisplayNodeLayout->requestedLayoutFromAbove - || CGSizeEqualToSize(_pendingDisplayNodeLayout->layout.size, boundsSizeForLayout))) { + if (_pendingDisplayNodeLayout.requestedLayoutFromAbove + || CGSizeEqualToSize(_pendingDisplayNodeLayout.layout.size, boundsSizeForLayout)) { // We assume the size from the last returned layoutThatFits: layout was applied so use the pending display node // layout constrained size - return _pendingDisplayNodeLayout->constrainedSize; - } else if (_calculatedDisplayNodeLayout->layout != nil - && (_calculatedDisplayNodeLayout->requestedLayoutFromAbove - || CGSizeEqualToSize(_calculatedDisplayNodeLayout->layout.size, boundsSizeForLayout))) { + return _pendingDisplayNodeLayout.constrainedSize; + } else if (_calculatedDisplayNodeLayout.layout != nil + && (_calculatedDisplayNodeLayout.requestedLayoutFromAbove + || CGSizeEqualToSize(_calculatedDisplayNodeLayout.layout.size, boundsSizeForLayout))) { // We assume the _calculatedDisplayNodeLayout is still valid and the frame is not different - return _calculatedDisplayNodeLayout->constrainedSize; + return _calculatedDisplayNodeLayout.constrainedSize; } else { // In this case neither the _pendingDisplayNodeLayout or the _calculatedDisplayNodeLayout constrained size can // be reused, so the current bounds is used. This is usual the case if a frame was set manually that differs to @@ -443,15 +456,15 @@ ASLayoutElementStyleExtensibilityForwarding - (void)_layoutSublayouts { ASDisplayNodeAssertThreadAffinity(self); - ASDisplayNodeAssertLockUnownedByCurrentThread(__instanceLock__); + ASAssertUnlocked(__instanceLock__); ASLayout *layout; { ASDN::MutexLocker l(__instanceLock__); - if (_calculatedDisplayNodeLayout->version < _layoutVersion) { + if (_calculatedDisplayNodeLayout.version < _layoutVersion) { return; } - layout = _calculatedDisplayNodeLayout->layout; + layout = _calculatedDisplayNodeLayout.layout; } for (ASDisplayNode *node in self.subnodes) { @@ -502,6 +515,7 @@ ASLayoutElementStyleExtensibilityForwarding - (BOOL)_locked_isLayoutTransitionInvalid { + ASAssertLocked(__instanceLock__); if (ASHierarchyStateIncludesLayoutPending(_hierarchyState)) { ASLayoutElementContext *context = ASLayoutElementGetCurrentContext(); if (context == nil || _pendingTransitionID != context.transitionID) { @@ -534,18 +548,10 @@ ASLayoutElementStyleExtensibilityForwarding measurementCompletion:(void(^)())completion { ASDisplayNodeAssertMainThread(); - - ASSizeRange sizeRange; - { - ASDN::MutexLocker l(__instanceLock__); - sizeRange = [self _locked_constrainedSizeForLayoutPass]; - } - - [self transitionLayoutWithSizeRange:sizeRange + [self transitionLayoutWithSizeRange:[self _constrainedSizeForLayoutPass] animated:animated shouldMeasureAsync:shouldMeasureAsync measurementCompletion:completion]; - } - (void)transitionLayoutWithSizeRange:(ASSizeRange)constrainedSize @@ -650,11 +656,11 @@ ASLayoutElementStyleExtensibilityForwarding ASDN::MutexLocker l(__instanceLock__); // Update calculated layout - auto previousLayout = _calculatedDisplayNodeLayout; - auto pendingLayout = std::make_shared(newLayout, - constrainedSize, - constrainedSize.max, - newLayoutVersion); + let previousLayout = _calculatedDisplayNodeLayout; + let pendingLayout = ASDisplayNodeLayout(newLayout, + constrainedSize, + constrainedSize.max, + newLayoutVersion); [self _locked_setCalculatedDisplayNodeLayout:pendingLayout]; // Setup pending layout transition for animation @@ -684,7 +690,7 @@ ASLayoutElementStyleExtensibilityForwarding } // Apply the subnode insertion immediately to be able to animate the nodes - [pendingLayoutTransition applySubnodeInsertions]; + [pendingLayoutTransition applySubnodeInsertionsAndMoves]; // Kick off animating the layout transition { @@ -771,10 +777,10 @@ ASLayoutElementStyleExtensibilityForwarding NSArray *removedSubnodes = [context removedSubnodes]; NSMutableArray *insertedSubnodes = [[context insertedSubnodes] mutableCopy]; - auto movedSubnodes = [[NSMutableArray alloc] init]; + let movedSubnodes = [[NSMutableArray alloc] init]; - auto insertedSubnodeContexts = [[NSMutableArray<_ASAnimatedTransitionContext *> alloc] init]; - auto removedSubnodeContexts = [[NSMutableArray<_ASAnimatedTransitionContext *> alloc] init]; + let insertedSubnodeContexts = [[NSMutableArray<_ASAnimatedTransitionContext *> alloc] init]; + let removedSubnodeContexts = [[NSMutableArray<_ASAnimatedTransitionContext *> alloc] init]; for (ASDisplayNode *subnode in [context subnodesForKey:ASTransitionContextToLayoutKey]) { if ([insertedSubnodes containsObject:subnode] == NO) { @@ -864,12 +870,18 @@ ASLayoutElementStyleExtensibilityForwarding */ - (void)_completePendingLayoutTransition { - __instanceLock__.lock(); - ASLayoutTransition *pendingLayoutTransition = _pendingLayoutTransition; - __instanceLock__.unlock(); + ASAssertUnlocked(__instanceLock__); + + ASLayoutTransition *pendingLayoutTransition; + { + ASDN::MutexLocker l(__instanceLock__); + pendingLayoutTransition = _pendingLayoutTransition; + if (pendingLayoutTransition != nil) { + [self _locked_setCalculatedDisplayNodeLayout:pendingLayoutTransition.pendingLayout]; + } + } if (pendingLayoutTransition != nil) { - [self _setCalculatedDisplayNodeLayout:pendingLayoutTransition.pendingLayout]; [self _completeLayoutTransition:pendingLayoutTransition]; [self _pendingLayoutTransitionDidComplete]; } @@ -888,6 +900,8 @@ ASLayoutElementStyleExtensibilityForwarding // Trampoline to the main thread if necessary if (ASDisplayNodeThreadIsMain() || layoutTransition.isSynchronous == NO) { + // Committing the layout transition will result in subnode insertions and removals, both of which must be called without the lock held + ASAssertUnlocked(__instanceLock__); [layoutTransition commitTransition]; } else { // Subnode insertions and removals need to happen always on the main thread if at least one subnode is already loaded @@ -907,11 +921,11 @@ ASLayoutElementStyleExtensibilityForwarding } NSArray *subnodes = [self subnodes]; - NSArray *sublayouts = _calculatedDisplayNodeLayout->layout.sublayouts; + NSArray *sublayouts = _calculatedDisplayNodeLayout.layout.sublayouts; - auto currentSubnodes = [[NSHashTable alloc] initWithOptions:NSHashTableObjectPointerPersonality + let currentSubnodes = [[NSHashTable alloc] initWithOptions:NSHashTableObjectPointerPersonality capacity:subnodes.count]; - auto layoutSubnodes = [[NSHashTable alloc] initWithOptions:NSHashTableObjectPointerPersonality + let layoutSubnodes = [[NSHashTable alloc] initWithOptions:NSHashTableObjectPointerPersonality capacity:sublayouts.count];; for (ASDisplayNode *subnode in subnodes) { [currentSubnodes addObject:subnode]; @@ -941,12 +955,13 @@ ASLayoutElementStyleExtensibilityForwarding - (void)_pendingLayoutTransitionDidComplete { // This assertion introduces a breaking behavior for nodes that has ASM enabled but also manually manage some subnodes. - // Let's gate it behind YOGA flag and remove it right after a branch cut. + // Let's gate it behind YOGA flag. #if YOGA [self _assertSubnodeState]; #endif // Subclass hook + ASAssertUnlocked(__instanceLock__); [self calculatedLayoutDidChange]; // Grab lock after calling out to subclass @@ -958,8 +973,7 @@ ASLayoutElementStyleExtensibilityForwarding if (_placeholderEnabled && !_placeholderImage && [self _locked_displaysAsynchronously]) { // Zero-sized nodes do not require a placeholder. - ASLayout *layout = _calculatedDisplayNodeLayout->layout; - CGSize layoutSize = (layout ? layout.size : CGSizeZero); + CGSize layoutSize = _calculatedDisplayNodeLayout.layout.size; if (layoutSize.width * layoutSize.height <= 0.0) { return; } @@ -983,24 +997,13 @@ ASLayoutElementStyleExtensibilityForwarding _pendingLayoutTransition = nil; } -- (void)_setCalculatedDisplayNodeLayout:(std::shared_ptr)displayNodeLayout +- (void)_locked_setCalculatedDisplayNodeLayout:(const ASDisplayNodeLayout &)displayNodeLayout { - ASDN::MutexLocker l(__instanceLock__); - [self _locked_setCalculatedDisplayNodeLayout:displayNodeLayout]; -} - -- (void)_locked_setCalculatedDisplayNodeLayout:(std::shared_ptr)displayNodeLayout -{ - ASDisplayNodeAssertTrue(displayNodeLayout->layout.layoutElement == self); - ASDisplayNodeAssertTrue(displayNodeLayout->layout.size.width >= 0.0); - ASDisplayNodeAssertTrue(displayNodeLayout->layout.size.height >= 0.0); + ASAssertLocked(__instanceLock__); + ASDisplayNodeAssertTrue(displayNodeLayout.layout.layoutElement == self); + ASDisplayNodeAssertTrue(displayNodeLayout.layout.size.width >= 0.0); + ASDisplayNodeAssertTrue(displayNodeLayout.layout.size.height >= 0.0); - // Flatten the layout if it wasn't done before (@see -calculateLayoutThatFits:). - if ([ASDisplayNode shouldStoreUnflattenedLayouts]) { - _unflattenedLayout = displayNodeLayout->layout; - displayNodeLayout->layout = [_unflattenedLayout filteredNodeLayoutTree]; - } - _calculatedDisplayNodeLayout = displayNodeLayout; } diff --git a/Source/ASDisplayNode+Subclasses.h b/Source/ASDisplayNode+Subclasses.h index ad69624101..9e20d274c1 100644 --- a/Source/ASDisplayNode+Subclasses.h +++ b/Source/ASDisplayNode+Subclasses.h @@ -2,17 +2,9 @@ // ASDisplayNode+Subclasses.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import @@ -42,74 +34,6 @@ NS_ASSUME_NONNULL_BEGIN * variables. */ -@protocol ASInterfaceStateDelegate -@required - -/** - * @abstract Called whenever any bit in the ASInterfaceState bitfield is changed. - * @discussion Subclasses may use this to monitor when they become visible, should free cached data, and much more. - * @see ASInterfaceState - */ -- (void)interfaceStateDidChange:(ASInterfaceState)newState fromState:(ASInterfaceState)oldState; - -/** - * @abstract Called whenever the node becomes visible. - * @discussion Subclasses may use this to monitor when they become visible. - * @note This method is guaranteed to be called on main. - */ -- (void)didEnterVisibleState; - -/** - * @abstract Called whenever the node is no longer visible. - * @discussion Subclasses may use this to monitor when they are no longer visible. - * @note This method is guaranteed to be called on main. - */ -- (void)didExitVisibleState; - -/** - * @abstract Called whenever the the node has entered the display state. - * @discussion Subclasses may use this to monitor when a node should be rendering its content. - * @note This method is guaranteed to be called on main. - */ -- (void)didEnterDisplayState; - -/** - * @abstract Called whenever the the node has exited the display state. - * @discussion Subclasses may use this to monitor when a node should no longer be rendering its content. - * @note This method is guaranteed to be called on main. - */ -- (void)didExitDisplayState; - -/** - * @abstract Called whenever the the node has entered the preload state. - * @discussion Subclasses may use this to monitor data for a node should be preloaded, either from a local or remote source. - * @note This method is guaranteed to be called on main. - */ -- (void)didEnterPreloadState; - -/** - * @abstract Called whenever the the node has exited the preload state. - * @discussion Subclasses may use this to monitor whether preloading data for a node should be canceled. - * @note This method is guaranteed to be called on main. - */ -- (void)didExitPreloadState; - -/** - * @abstract Called when the node has completed applying the layout. - * @discussion Can be used for operations that are performed after layout has completed. - * @note This method is guaranteed to be called on main. - */ -- (void)nodeDidLayout; - -/** - * @abstract Called when the node loads. - * @discussion Can be used for operations that are performed after the node's view is available. - * @note This method is guaranteed to be called on main. - */ -- (void)nodeDidLoad; - -@end - @interface ASDisplayNode (Subclassing) #pragma mark - Properties diff --git a/Source/ASDisplayNode+Yoga.mm b/Source/ASDisplayNode+Yoga.mm index ea5af2bb67..8f4cfdc63a 100644 --- a/Source/ASDisplayNode+Yoga.mm +++ b/Source/ASDisplayNode+Yoga.mm @@ -2,17 +2,9 @@ // ASDisplayNode+Yoga.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import @@ -20,8 +12,8 @@ #if YOGA /* YOGA */ #import -#import #import +#import #import #import #import @@ -164,10 +156,12 @@ ASDisplayNodeAssert(childCount == self.yogaChildren.count, @"Yoga tree should always be in sync with .yogaNodes array! %@", self.yogaChildren); - NSMutableArray *sublayouts = [NSMutableArray arrayWithCapacity:childCount]; + ASLayout *rawSublayouts[childCount]; + int i = 0; for (ASDisplayNode *subnode in self.yogaChildren) { - [sublayouts addObject:[subnode layoutForYogaNode]]; + rawSublayouts[i++] = [subnode layoutForYogaNode]; } + let sublayouts = [NSArray arrayByTransferring:rawSublayouts count:childCount]; // The layout for self should have position CGPointNull, but include the calculated size. CGSize size = CGSizeMake(YGNodeLayoutGetWidth(yogaNode), YGNodeLayoutGetHeight(yogaNode)); @@ -215,7 +209,7 @@ // For the root node in a Yoga tree, make sure to preserve the constrainedSize originally provided. // This will be used for all relayouts triggered by children, since they escalate to root. ASSizeRange range = parentNode ? ASSizeRangeUnconstrained : self.constrainedSizeForCalculatedLayout; - _pendingDisplayNodeLayout = std::make_shared(layout, range, parentSize, _layoutVersion); + _pendingDisplayNodeLayout = ASDisplayNodeLayout(layout, range, parentSize, _layoutVersion); } } @@ -299,7 +293,7 @@ // Reset accessible elements, since layout may have changed. ASPerformBlockOnMainThread(^{ - [(_ASDisplayView *)self.view setAccessibleElements:nil]; + [(_ASDisplayView *)self.view setAccessibilityElements:nil]; }); ASDisplayNodePerformBlockOnEveryYogaChild(self, ^(ASDisplayNode * _Nonnull node) { diff --git a/Source/ASDisplayNode.h b/Source/ASDisplayNode.h index 764a8be7ac..2a5efaebdd 100644 --- a/Source/ASDisplayNode.h +++ b/Source/ASDisplayNode.h @@ -2,17 +2,9 @@ // ASDisplayNode.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #pragma once @@ -22,6 +14,7 @@ #import #import #import +#import #import #import #import @@ -32,6 +25,10 @@ NS_ASSUME_NONNULL_BEGIN #define ASDisplayNodeLoggingEnabled 0 +#ifndef AS_MAX_INTERFACE_STATE_DELEGATES +#define AS_MAX_INTERFACE_STATE_DELEGATES 4 +#endif + @class ASDisplayNode; @protocol ASContextTransitioning; @@ -71,37 +68,6 @@ typedef ASLayoutSpec * _Nonnull(^ASLayoutSpecBlock)(__kindof ASDisplayNode *node */ typedef void (^ASDisplayNodeNonFatalErrorBlock)(NSError *error); -/** - * Interface state is available on ASDisplayNode and ASViewController, and - * allows checking whether a node is in an interface situation where it is prudent to trigger certain - * actions: measurement, data loading, display, and visibility (the latter for animations or other onscreen-only effects). - * - * The defualt state, ASInterfaceStateNone, means that the element is not predicted to be onscreen soon and - * preloading should not be performed. Swift: use [] for the default behavior. - */ -typedef NS_OPTIONS(NSUInteger, ASInterfaceState) -{ - /** The element is not predicted to be onscreen soon and preloading should not be performed */ - ASInterfaceStateNone = 0, - /** The element may be added to a view soon that could become visible. Measure the layout, including size calculation. */ - ASInterfaceStateMeasureLayout = 1 << 0, - /** The element is likely enough to come onscreen that disk and/or network data required for display should be fetched. */ - ASInterfaceStatePreload = 1 << 1, - /** The element is very likely to become visible, and concurrent rendering should be executed for any -setNeedsDisplay. */ - ASInterfaceStateDisplay = 1 << 2, - /** The element is physically onscreen by at least 1 pixel. - In practice, all other bit fields should also be set when this flag is set. */ - ASInterfaceStateVisible = 1 << 3, - - /** - * The node is not contained in a cell but it is in a window. - * - * Currently we only set `interfaceState` to other values for - * nodes contained in table views or collection views. - */ - ASInterfaceStateInHierarchy = ASInterfaceStateMeasureLayout | ASInterfaceStatePreload | ASInterfaceStateDisplay | ASInterfaceStateVisible, -}; - typedef NS_ENUM(NSInteger, ASCornerRoundingType) { ASCornerRoundingTypeDefaultSlowCALayer, ASCornerRoundingTypePrecomposited, @@ -299,6 +265,26 @@ AS_EXTERN NSInteger const ASDefaultDrawingPriority; */ @property (readonly) ASInterfaceState interfaceState; +/** + * @abstract Adds a delegate to receive notifications on interfaceState changes. + * + * @warning This must be called from the main thread. + * There is a hard limit on the number of delegates a node can have; see + * AS_MAX_INTERFACE_STATE_DELEGATES above. + * + * @see ASInterfaceState + */ +- (void)addInterfaceStateDelegate:(id )interfaceStateDelegate; + +/** + * @abstract Removes a delegate from receiving notifications on interfaceState changes. + * + * @warning This must be called from the main thread. + * + * @see ASInterfaceState + */ +- (void)removeInterfaceStateDelegate:(id )interfaceStateDelegate; + /** * @abstract Class property that allows to set a block that can be called on non-fatal errors. This * property can be useful for cases when Async Display Kit can recover from an abnormal behavior, but @@ -643,10 +629,10 @@ AS_EXTERN NSInteger const ASDefaultDrawingPriority; */ - (void)layoutIfNeeded; -@property CGRect frame; // default=CGRectZero -@property CGRect bounds; // default=CGRectZero -@property CGPoint position; // default=CGPointZero -@property CGFloat alpha; // default=1.0f +@property CGRect frame; // default=CGRectZero +@property CGRect bounds; // default=CGRectZero +@property CGPoint position; // default=CGPointZero +@property CGFloat alpha; // default=1.0f /* @abstract Sets the corner rounding method to use on the ASDisplayNode. * There are three types of corner rounding provided by Texture: CALayer, Precomposited, and Clipping. @@ -670,7 +656,7 @@ AS_EXTERN NSInteger const ASDefaultDrawingPriority; * * @default ASCornerRoundingTypeDefaultSlowCALayer */ -@property ASCornerRoundingType cornerRoundingType; // default=Slow CALayer .cornerRadius (offscreen rendering) +@property ASCornerRoundingType cornerRoundingType; // default=ASCornerRoundingTypeDefaultSlowCALayer .cornerRadius (offscreen rendering) /** @abstract The radius to use when rounding corners of the ASDisplayNode. * @@ -679,24 +665,24 @@ AS_EXTERN NSInteger const ASDefaultDrawingPriority; */ @property CGFloat cornerRadius; // default=0.0 -@property BOOL clipsToBounds; // default==NO -@property (getter=isHidden) BOOL hidden; // default==NO -@property (getter=isOpaque) BOOL opaque; // default==YES +@property BOOL clipsToBounds; // default==NO +@property (getter=isHidden) BOOL hidden; // default==NO +@property (getter=isOpaque) BOOL opaque; // default==YES -@property (nullable) id contents; // default=nil -@property CGRect contentsRect; // default={0,0,1,1}. @see CALayer.h for details. -@property CGRect contentsCenter; // default={0,0,1,1}. @see CALayer.h for details. -@property CGFloat contentsScale; // default=1.0f. See @contentsScaleForDisplay for details. -@property CGFloat rasterizationScale; // default=1.0f. +@property (nullable) id contents; // default=nil +@property CGRect contentsRect; // default={0,0,1,1}. @see CALayer.h for details. +@property CGRect contentsCenter; // default={0,0,1,1}. @see CALayer.h for details. +@property CGFloat contentsScale; // default=1.0f. See @contentsScaleForDisplay for details. +@property CGFloat rasterizationScale; // default=1.0f. -@property CGPoint anchorPoint; // default={0.5, 0.5} -@property CGFloat zPosition; // default=0.0 -@property CATransform3D transform; // default=CATransform3DIdentity -@property CATransform3D subnodeTransform; // default=CATransform3DIdentity +@property CGPoint anchorPoint; // default={0.5, 0.5} +@property CGFloat zPosition; // default=0.0 +@property CATransform3D transform; // default=CATransform3DIdentity +@property CATransform3D subnodeTransform; // default=CATransform3DIdentity @property (getter=isUserInteractionEnabled) BOOL userInteractionEnabled; // default=YES (NO for layer-backed nodes) #if TARGET_OS_IOS -@property (getter=isExclusiveTouch) BOOL exclusiveTouch; // default=NO +@property (getter=isExclusiveTouch) BOOL exclusiveTouch; // default=NO #endif /** @@ -705,10 +691,10 @@ AS_EXTERN NSInteger const ASDefaultDrawingPriority; * @discussion In contrast to UIView, setting a transparent color will not set opaque = NO. * This only affects nodes that implement +drawRect like ASTextNode. */ -@property (nullable, copy) UIColor *backgroundColor; // default=nil +@property (nullable, copy) UIColor *backgroundColor; // default=nil -@property (null_resettable, copy) UIColor *tintColor; // default=Blue -- (void)tintColorDidChange; // Notifies the node when the tintColor has changed. +@property (null_resettable, copy) UIColor *tintColor; // default=Blue +- (void)tintColorDidChange; // Notifies the node when the tintColor has changed. /** * @abstract A flag used to determine how a node lays out its content when its bounds change. @@ -718,24 +704,24 @@ AS_EXTERN NSInteger const ASDefaultDrawingPriority; * Thus, UIViewContentModeRedraw is not allowed; use needsDisplayOnBoundsChange = YES instead, and pick an appropriate * contentMode for your content while it's being re-rendered. */ -@property UIViewContentMode contentMode; // default=UIViewContentModeScaleToFill -@property (copy) NSString *contentsGravity; // Use .contentMode in preference when possible. -@property UISemanticContentAttribute semanticContentAttribute; +@property UIViewContentMode contentMode; // default=UIViewContentModeScaleToFill +@property (copy) NSString *contentsGravity; // Use .contentMode in preference when possible. +@property UISemanticContentAttribute semanticContentAttribute; -@property (nullable) CGColorRef shadowColor; // default=opaque rgb black -@property CGFloat shadowOpacity; // default=0.0 -@property CGSize shadowOffset; // default=(0, -3) -@property CGFloat shadowRadius; // default=3 -@property CGFloat borderWidth; // default=0 -@property (nullable) CGColorRef borderColor; // default=opaque rgb black +@property (nullable) CGColorRef shadowColor; // default=opaque rgb black +@property CGFloat shadowOpacity; // default=0.0 +@property CGSize shadowOffset; // default=(0, -3) +@property CGFloat shadowRadius; // default=3 +@property CGFloat borderWidth; // default=0 +@property (nullable) CGColorRef borderColor; // default=opaque rgb black -@property BOOL allowsGroupOpacity; -@property BOOL allowsEdgeAntialiasing; -@property unsigned int edgeAntialiasingMask; // default==all values from CAEdgeAntialiasingMask +@property BOOL allowsGroupOpacity; +@property BOOL allowsEdgeAntialiasing; +@property unsigned int edgeAntialiasingMask; // default==all values from CAEdgeAntialiasingMask -@property BOOL needsDisplayOnBoundsChange; // default==NO -@property BOOL autoresizesSubviews; // default==YES (undefined for layer-backed nodes) -@property UIViewAutoresizing autoresizingMask; // default==UIViewAutoresizingNone (undefined for layer-backed nodes) +@property BOOL needsDisplayOnBoundsChange; // default==NO +@property BOOL autoresizesSubviews; // default==YES (undefined for layer-backed nodes) +@property UIViewAutoresizing autoresizingMask; // default==UIViewAutoresizingNone (undefined for layer-backed nodes) /** * @abstract Content margins diff --git a/Source/ASDisplayNode.mm b/Source/ASDisplayNode.mm index 11a1221d50..9c91a3acce 100644 --- a/Source/ASDisplayNode.mm +++ b/Source/ASDisplayNode.mm @@ -2,17 +2,9 @@ // ASDisplayNode.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import @@ -35,7 +27,9 @@ #import #import #import +#import #import +#import #import #import #import @@ -45,6 +39,7 @@ #import #import #import +#import #import #import #import @@ -71,7 +66,6 @@ NSInteger const ASDefaultDrawingPriority = ASDefaultTransactionPriority; @protocol CALayerDelegate; @interface ASDisplayNode () - /** * See ASDisplayNodeInternal.h for ivars */ @@ -154,6 +148,8 @@ static ASDisplayNodeMethodOverrides GetASDisplayNodeMethodOverrides(Class c) ASDisplayNodeCAssertNotNil(c, @"class is required"); ASDisplayNodeMethodOverrides overrides = ASDisplayNodeMethodOverrideNone; + + // Handling touches if (ASDisplayNodeSubclassOverridesSelector(c, @selector(touchesBegan:withEvent:))) { overrides |= ASDisplayNodeMethodOverrideTouchesBegan; } @@ -166,13 +162,32 @@ static ASDisplayNodeMethodOverrides GetASDisplayNodeMethodOverrides(Class c) if (ASDisplayNodeSubclassOverridesSelector(c, @selector(touchesEnded:withEvent:))) { overrides |= ASDisplayNodeMethodOverrideTouchesEnded; } + + // Responder chain + if (ASDisplayNodeSubclassOverridesSelector(c, @selector(canBecomeFirstResponder))) { + overrides |= ASDisplayNodeMethodOverrideCanBecomeFirstResponder; + } + if (ASDisplayNodeSubclassOverridesSelector(c, @selector(becomeFirstResponder))) { + overrides |= ASDisplayNodeMethodOverrideBecomeFirstResponder; + } + if (ASDisplayNodeSubclassOverridesSelector(c, @selector(canResignFirstResponder))) { + overrides |= ASDisplayNodeMethodOverrideCanResignFirstResponder; + } + if (ASDisplayNodeSubclassOverridesSelector(c, @selector(resignFirstResponder))) { + overrides |= ASDisplayNodeMethodOverrideResignFirstResponder; + } + if (ASDisplayNodeSubclassOverridesSelector(c, @selector(isFirstResponder))) { + overrides |= ASDisplayNodeMethodOverrideIsFirstResponder; + } + + // Layout related methods if (ASDisplayNodeSubclassOverridesSelector(c, @selector(layoutSpecThatFits:))) { overrides |= ASDisplayNodeMethodOverrideLayoutSpecThatFits; } if (ASDisplayNodeSubclassOverridesSelector(c, @selector(calculateLayoutThatFits:)) || ASDisplayNodeSubclassOverridesSelector(c, @selector(calculateLayoutThatFits: - restrictedToSize: - relativeToParentSize:))) { + restrictedToSize: + relativeToParentSize:))) { overrides |= ASDisplayNodeMethodOverrideCalcLayoutThatFits; } if (ASDisplayNodeSubclassOverridesSelector(c, @selector(calculateSizeThatFits:))) { @@ -277,8 +292,6 @@ static ASDisplayNodeMethodOverrides GetASDisplayNodeMethodOverrides(Class c) _primitiveTraitCollection = ASPrimitiveTraitCollectionMakeDefault(); - _calculatedDisplayNodeLayout = std::make_shared(); - _pendingDisplayNodeLayout = nullptr; _layoutVersion = 1; _defaultLayoutTransitionDuration = 0.2; @@ -395,6 +408,11 @@ ASSynthesizeLockingMethodsWithMutex(__instanceLock__); setFlag(Synchronous, YES); } +- (ASDisplayNodeMethodOverrides)methodOverrides +{ + return _methodOverrides; +} + - (void)onDidLoad:(ASDisplayNodeDidLoadBlock)body { ASDN::MutexLocker l(__instanceLock__); @@ -439,11 +457,14 @@ ASSynthesizeLockingMethodsWithMutex(__instanceLock__); - (BOOL)_locked_shouldLoadViewOrLayer { + ASAssertLocked(__instanceLock__); return !_flags.isDeallocating && !(_hierarchyState & ASHierarchyStateRasterized); } - (UIView *)_locked_viewToLoad { + ASAssertLocked(__instanceLock__); + UIView *view = nil; if (_viewBlock) { view = _viewBlock(); @@ -482,6 +503,7 @@ ASSynthesizeLockingMethodsWithMutex(__instanceLock__); - (CALayer *)_locked_layerToLoad { + ASAssertLocked(__instanceLock__); ASDisplayNodeAssert(_flags.layerBacked, @"_layerToLoad is only for layer-backed nodes"); CALayer *layer = nil; @@ -500,6 +522,8 @@ ASSynthesizeLockingMethodsWithMutex(__instanceLock__); - (void)_locked_loadViewOrLayer { + ASAssertLocked(__instanceLock__); + if (_flags.layerBacked) { TIME_SCOPED(_debugTimeToCreateView); _layer = [self _locked_layerToLoad]; @@ -528,7 +552,7 @@ ASSynthesizeLockingMethodsWithMutex(__instanceLock__); - (void)_didLoad { ASDisplayNodeAssertMainThread(); - ASDisplayNodeAssertLockUnownedByCurrentThread(__instanceLock__); + ASAssertUnlocked(__instanceLock__); ASDisplayNodeLogEvent(self, @"didLoad"); as_log_verbose(ASNodeLog(), "didLoad %@", self); TIME_SCOPED(_debugTimeForDidLoad); @@ -536,15 +560,15 @@ ASSynthesizeLockingMethodsWithMutex(__instanceLock__); [self didLoad]; __instanceLock__.lock(); - NSArray *onDidLoadBlocks = [_onDidLoadBlocks copy]; - _onDidLoadBlocks = nil; + let onDidLoadBlocks = ASTransferStrong(_onDidLoadBlocks); __instanceLock__.unlock(); for (ASDisplayNodeDidLoadBlock block in onDidLoadBlocks) { block(self); } - - [_interfaceStateDelegate nodeDidLoad]; + [self enumerateInterfaceStateDelegates:^(id del) { + [del nodeDidLoad]; + }]; } - (void)didLoad @@ -559,7 +583,7 @@ ASSynthesizeLockingMethodsWithMutex(__instanceLock__); if (ASDisplayNodeThreadIsMain()) { // Because the view and layer can only be created and destroyed on Main, that is also the only thread // where the state of this property can change. As an optimization, we can avoid locking. - return [self _locked_isNodeLoaded]; + return _loaded(self); } else { ASDN::MutexLocker l(__instanceLock__); return [self _locked_isNodeLoaded]; @@ -568,7 +592,8 @@ ASSynthesizeLockingMethodsWithMutex(__instanceLock__); - (BOOL)_locked_isNodeLoaded { - return (_view != nil || (_layer != nil && _flags.layerBacked)); + ASAssertLocked(__instanceLock__); + return _loaded(self); } #pragma mark - Misc Setter / Getter @@ -671,6 +696,7 @@ ASSynthesizeLockingMethodsWithMutex(__instanceLock__); - (_ASDisplayLayer *)_locked_asyncLayer { + ASAssertLocked(__instanceLock__); return [_layer isKindOfClass:[_ASDisplayLayer class]] ? (_ASDisplayLayer *)_layer : nil; } @@ -729,6 +755,7 @@ ASSynthesizeLockingMethodsWithMutex(__instanceLock__); - (CGRect)_locked_threadSafeBounds { + ASAssertLocked(__instanceLock__); return _threadSafeBounds; } @@ -841,6 +868,18 @@ ASSynthesizeLockingMethodsWithMutex(__instanceLock__); _automaticallyRelayoutOnLayoutMarginsChanges = flag; } +- (void)__setNodeController:(ASNodeController *)controller +{ + // See docs for why we don't lock. + if (controller.shouldInvertStrongReference) { + _strongNodeController = controller; + _weakNodeController = nil; + } else { + _weakNodeController = controller; + _strongNodeController = nil; + } +} + #pragma mark - UIResponder #define HANDLE_NODE_RESPONDER_METHOD(__sel) \ @@ -989,7 +1028,7 @@ ASSynthesizeLockingMethodsWithMutex(__instanceLock__); - (void)__layout { ASDisplayNodeAssertThreadAffinity(self); - ASDisplayNodeAssertLockUnownedByCurrentThread(__instanceLock__); + ASAssertUnlocked(__instanceLock__); BOOL loaded = NO; { @@ -1015,10 +1054,11 @@ ASSynthesizeLockingMethodsWithMutex(__instanceLock__); // This method will confirm that the layout is up to date (and update if needed). // Importantly, it will also APPLY the layout to all of our subnodes if (unless parent is transitioning). - __instanceLock__.unlock(); - [self _u_measureNodeWithBoundsIfNecessary:bounds]; - __instanceLock__.lock(); - + { + ASDN::MutexUnlocker u(__instanceLock__); + [self _u_measureNodeWithBoundsIfNecessary:bounds]; + } + [self _locked_layoutPlaceholderIfNecessary]; } @@ -1040,7 +1080,7 @@ ASSynthesizeLockingMethodsWithMutex(__instanceLock__); { // Hook for subclasses ASDisplayNodeAssertMainThread(); - ASDisplayNodeAssertLockUnownedByCurrentThread(__instanceLock__); + ASAssertUnlocked(__instanceLock__); ASDisplayNodeAssertTrue(self.isNodeLoaded); } @@ -1050,11 +1090,13 @@ ASSynthesizeLockingMethodsWithMutex(__instanceLock__); restrictedToSize:(ASLayoutElementSize)size relativeToParentSize:(CGSize)parentSize { - // We only want one calculateLayout signpost interval per thread. -#ifndef MINIMAL_ASDK - static _Thread_local NSInteger tls_callDepth; as_activity_scope_verbose(as_activity_create("Calculate node layout", AS_ACTIVITY_CURRENT, OS_ACTIVITY_FLAG_DEFAULT)); as_log_verbose(ASLayoutLog(), "Calculating layout for %@ sizeRange %@", self, NSStringFromASSizeRange(constrainedSize)); + +#if AS_KDEBUG_ENABLE + // We only want one calculateLayout signpost interval per thread. + // Currently there is no fallback for profiling i386, since it's not useful. + static _Thread_local NSInteger tls_callDepth; if (tls_callDepth++ == 0) { ASSignpostStart(ASSignpostCalculateLayout); } @@ -1063,13 +1105,14 @@ ASSynthesizeLockingMethodsWithMutex(__instanceLock__); ASSizeRange styleAndParentSize = ASLayoutElementSizeResolve(self.style.size, parentSize); const ASSizeRange resolvedRange = ASSizeRangeIntersect(constrainedSize, styleAndParentSize); ASLayout *result = [self calculateLayoutThatFits:resolvedRange]; -#ifndef MINIMAL_ASDK as_log_verbose(ASLayoutLog(), "Calculated layout %@", result); +#if AS_KDEBUG_ENABLE if (--tls_callDepth == 0) { ASSignpostEnd(ASSignpostCalculateLayout); } #endif + return result; } @@ -1177,11 +1220,11 @@ ASSynthesizeLockingMethodsWithMutex(__instanceLock__); } ASDisplayNodeLogEvent(self, @"computedLayout: %@", layout); - // Return the (original) unflattened layout if it needs to be stored. The layout will be flattened later on (@see _locked_setCalculatedDisplayNodeLayout:). - // Otherwise, flatten it right away. - if (! [ASDisplayNode shouldStoreUnflattenedLayouts]) { - layout = [layout filteredNodeLayoutTree]; + // PR #1157: Reduces accuracy of _unflattenedLayout for debugging/Weaver + if ([ASDisplayNode shouldStoreUnflattenedLayouts]) { + _unflattenedLayout = layout; } + layout = [layout filteredNodeLayoutTree]; return layout; } @@ -1197,6 +1240,7 @@ ASSynthesizeLockingMethodsWithMutex(__instanceLock__); - (id)_locked_layoutElementThatFits:(ASSizeRange)constrainedSize { + ASAssertLocked(__instanceLock__); __ASDisplayNodeCheckForLayoutMethodOverrides; BOOL measureLayoutSpec = _measurementOptions & ASDisplayNodePerformanceMeasurementOptionLayoutSpec; @@ -1227,9 +1271,11 @@ ASSynthesizeLockingMethodsWithMutex(__instanceLock__); { // Hook for subclasses ASDisplayNodeAssertMainThread(); - ASDisplayNodeAssertLockUnownedByCurrentThread(__instanceLock__); + ASAssertUnlocked(__instanceLock__); ASDisplayNodeAssertTrue(self.isNodeLoaded); - [_interfaceStateDelegate nodeDidLayout]; + [self enumerateInterfaceStateDelegates:^(id del) { + [del nodeDidLayout]; + }]; } #pragma mark Layout Transition @@ -1277,6 +1323,7 @@ NSString * const ASRenderingEngineDidDisplayNodesScheduledBeforeTimestamp = @"AS */ - (BOOL)_locked_displaysAsynchronously { + ASAssertLocked(__instanceLock__); return checkFlag(Synchronous) == NO && _flags.displaysAsynchronously; } @@ -1451,6 +1498,10 @@ NSString * const ASRenderingEngineDidDisplayNodesScheduledBeforeTimestamp = @"AS if (_pendingDisplayNodes.isEmpty) { [self hierarchyDisplayDidFinish]; + [self enumerateInterfaceStateDelegates:^(id delegate) { + [delegate hierarchyDisplayDidFinish]; + }]; + BOOL placeholderShouldPersist = [self placeholderShouldPersist]; __instanceLock__.lock(); @@ -1591,7 +1642,7 @@ void recursivelyTriggerDisplayForLayer(CALayer *layer, BOOL shouldBlock) } CGSize boundsSize = self.bounds.size; - for (int idx = 0; idx < 4; idx++) { + for (int idx = 0; idx < NUM_CLIP_CORNER_LAYERS; idx++) { BOOL isTop = (idx == 0 || idx == 1); BOOL isRight = (idx == 1 || idx == 2); if (_clipCornerLayers[idx]) { @@ -1605,7 +1656,7 @@ void recursivelyTriggerDisplayForLayer(CALayer *layer, BOOL shouldBlock) - (void)_updateClipCornerLayerContentsWithRadius:(CGFloat)radius backgroundColor:(UIColor *)backgroundColor { ASPerformBlockOnMainThread(^{ - for (int idx = 0; idx < 4; idx++) { + for (int idx = 0; idx < NUM_CLIP_CORNER_LAYERS; idx++) { // Layers are, in order: Top Left, Top Right, Bottom Right, Bottom Left. // anchorPoint is Bottom Left at 0,0 and Top Right at 1,1. BOOL isTop = (idx == 0 || idx == 1); @@ -1642,16 +1693,21 @@ void recursivelyTriggerDisplayForLayer(CALayer *layer, BOOL shouldBlock) ASPerformBlockOnMainThread(^{ ASDisplayNodeAssertMainThread(); if (visible) { - for (int idx = 0; idx < 4; idx++) { + for (int idx = 0; idx < NUM_CLIP_CORNER_LAYERS; idx++) { if (_clipCornerLayers[idx] == nil) { + static ASDisplayNodeCornerLayerDelegate *clipCornerLayers; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + clipCornerLayers = [[ASDisplayNodeCornerLayerDelegate alloc] init]; + }); _clipCornerLayers[idx] = [[CALayer alloc] init]; _clipCornerLayers[idx].zPosition = 99999; - _clipCornerLayers[idx].delegate = self; + _clipCornerLayers[idx].delegate = clipCornerLayers; } } [self _updateClipCornerLayerContentsWithRadius:_cornerRadius backgroundColor:self.backgroundColor]; } else { - for (int idx = 0; idx < 4; idx++) { + for (int idx = 0; idx < NUM_CLIP_CORNER_LAYERS; idx++) { [_clipCornerLayers[idx] removeFromSuperlayer]; _clipCornerLayers[idx] = nil; } @@ -2053,7 +2109,7 @@ ASDISPLAYNODE_INLINE BOOL subtreeIsRasterized(ASDisplayNode *node) { - (ASDisplayNode *)supernode { #if CHECK_LOCKING_SAFETY - if (__instanceLock__.ownedByCurrentThread()) { + if (__instanceLock__.locked()) { NSLog(@"WARNING: Accessing supernode while holding recursive instance lock of this node is worrisome. It's likely that you will soon try to acquire the supernode's lock, and this can easily cause deadlocks."); } #endif @@ -2147,7 +2203,7 @@ ASDISPLAYNODE_INLINE BOOL subtreeIsRasterized(ASDisplayNode *node) { /* * Central private helper method that should eventually be called if submethods add, insert or replace subnodes - * This method is called with thread affinity. + * This method is called with thread affinity and without lock held. * * @param subnode The subnode to insert * @param subnodeIndex The index in _subnodes to insert it @@ -2157,7 +2213,9 @@ ASDISPLAYNODE_INLINE BOOL subtreeIsRasterized(ASDisplayNode *node) { */ - (void)_insertSubnode:(ASDisplayNode *)subnode atSubnodeIndex:(NSInteger)subnodeIndex sublayerIndex:(NSInteger)sublayerIndex andRemoveSubnode:(ASDisplayNode *)oldSubnode { - ASDisplayNodeAssertLockUnownedByCurrentThread(__instanceLock__); + ASDisplayNodeAssertThreadAffinity(self); + ASAssertUnlocked(__instanceLock__); + as_log_verbose(ASNodeLog(), "Insert subnode %@ at index %zd of %@ and remove subnode %@", subnode, subnodeIndex, self, oldSubnode); if (subnode == nil || subnode == self) { @@ -2185,7 +2243,7 @@ ASDISPLAYNODE_INLINE BOOL subtreeIsRasterized(ASDisplayNode *node) { NSUInteger subnodesCount = _subnodes.count; __instanceLock__.unlock(); if (subnodeIndex > subnodesCount || subnodeIndex < 0) { - ASDisplayNodeFailAssert(@"Cannot insert a subnode at index %zd. Count is %zd", subnodeIndex, subnodesCount); + ASDisplayNodeFailAssert(@"Cannot insert a subnode at index %ld. Count is %ld", (long)subnodeIndex, (long)subnodesCount); return; } @@ -2365,6 +2423,7 @@ ASDISPLAYNODE_INLINE BOOL subtreeIsRasterized(ASDisplayNode *node) { - (void)_insertSubnode:(ASDisplayNode *)subnode belowSubnode:(ASDisplayNode *)below { ASDisplayNodeAssertThreadAffinity(self); + ASAssertUnlocked(__instanceLock__); if (subnode == nil) { ASDisplayNodeFailAssert(@"Cannot insert a nil subnode"); @@ -2428,6 +2487,7 @@ ASDISPLAYNODE_INLINE BOOL subtreeIsRasterized(ASDisplayNode *node) { - (void)_insertSubnode:(ASDisplayNode *)subnode aboveSubnode:(ASDisplayNode *)above { ASDisplayNodeAssertThreadAffinity(self); + ASAssertUnlocked(__instanceLock__); if (subnode == nil) { ASDisplayNodeFailAssert(@"Cannot insert a nil subnode"); @@ -2489,6 +2549,7 @@ ASDISPLAYNODE_INLINE BOOL subtreeIsRasterized(ASDisplayNode *node) { - (void)_insertSubnode:(ASDisplayNode *)subnode atIndex:(NSInteger)idx { ASDisplayNodeAssertThreadAffinity(self); + ASAssertUnlocked(__instanceLock__); if (subnode == nil) { ASDisplayNodeFailAssert(@"Cannot insert a nil subnode"); @@ -2500,7 +2561,7 @@ ASDISPLAYNODE_INLINE BOOL subtreeIsRasterized(ASDisplayNode *node) { ASDN::MutexLocker l(__instanceLock__); if (idx > _subnodes.count || idx < 0) { - ASDisplayNodeFailAssert(@"Cannot insert a subnode at index %zd. Count is %zd", idx, _subnodes.count); + ASDisplayNodeFailAssert(@"Cannot insert a subnode at index %ld. Count is %ld", (long)idx, (long)_subnodes.count); return; } @@ -2525,7 +2586,7 @@ ASDISPLAYNODE_INLINE BOOL subtreeIsRasterized(ASDisplayNode *node) { - (void)_removeSubnode:(ASDisplayNode *)subnode { ASDisplayNodeAssertThreadAffinity(self); - ASDisplayNodeAssertLockUnownedByCurrentThread(__instanceLock__); + ASAssertUnlocked(__instanceLock__); // Don't call self.supernode here because that will retain/autorelease the supernode. This method -_removeSupernode: is often called while tearing down a node hierarchy, and the supernode in question might be in the middle of its -dealloc. The supernode is never messaged, only compared by value, so this is safe. // The particular issue that triggers this edge case is when a node calls -removeFromSupernode on a subnode from within its own -dealloc method. @@ -2551,7 +2612,7 @@ ASDISPLAYNODE_INLINE BOOL subtreeIsRasterized(ASDisplayNode *node) { - (void)_removeFromSupernode { ASDisplayNodeAssertThreadAffinity(self); - ASDisplayNodeAssertLockUnownedByCurrentThread(__instanceLock__); + ASAssertUnlocked(__instanceLock__); __instanceLock__.lock(); __weak ASDisplayNode *supernode = _supernode; @@ -2565,7 +2626,7 @@ ASDISPLAYNODE_INLINE BOOL subtreeIsRasterized(ASDisplayNode *node) { - (void)_removeFromSupernodeIfEqualTo:(ASDisplayNode *)supernode { ASDisplayNodeAssertThreadAffinity(self); - ASDisplayNodeAssertLockUnownedByCurrentThread(__instanceLock__); + ASAssertUnlocked(__instanceLock__); __instanceLock__.lock(); @@ -2658,6 +2719,7 @@ ASDISPLAYNODE_INLINE BOOL subtreeIsRasterized(ASDisplayNode *node) { - (void)_locked_layoutPlaceholderIfNecessary { + ASAssertLocked(__instanceLock__); if ([self _locked_shouldHavePlaceholderLayer]) { [self _locked_setupPlaceholderLayerIfNeeded]; } @@ -2667,12 +2729,14 @@ ASDISPLAYNODE_INLINE BOOL subtreeIsRasterized(ASDisplayNode *node) { - (BOOL)_locked_shouldHavePlaceholderLayer { + ASAssertLocked(__instanceLock__); return (_placeholderEnabled && [self _implementsDisplay]); } - (void)_locked_setupPlaceholderLayerIfNeeded { ASDisplayNodeAssertMainThread(); + ASAssertLocked(__instanceLock__); if (!_placeholderLayer) { _placeholderLayer = [CALayer layer]; @@ -2720,7 +2784,7 @@ ASDISPLAYNODE_INLINE BOOL subtreeIsRasterized(ASDisplayNode *node) { { ASDisplayNodeAssertMainThread(); ASDisplayNodeAssert(!_flags.isEnteringHierarchy, @"Should not cause recursive __enterHierarchy"); - ASDisplayNodeAssertLockUnownedByCurrentThread(__instanceLock__); + ASAssertUnlocked(__instanceLock__); ASDisplayNodeLogEvent(self, @"enterHierarchy"); // Profiling has shown that locking this method is beneficial, so each of the property accesses don't have to lock and unlock. @@ -2769,7 +2833,7 @@ ASDISPLAYNODE_INLINE BOOL subtreeIsRasterized(ASDisplayNode *node) { { ASDisplayNodeAssertMainThread(); ASDisplayNodeAssert(!_flags.isExitingHierarchy, @"Should not cause recursive __exitHierarchy"); - ASDisplayNodeAssertLockUnownedByCurrentThread(__instanceLock__); + ASAssertUnlocked(__instanceLock__); ASDisplayNodeLogEvent(self, @"exitHierarchy"); // Profiling has shown that locking this method is beneficial, so each of the property accesses don't have to lock and unlock. @@ -2779,9 +2843,7 @@ ASDISPLAYNODE_INLINE BOOL subtreeIsRasterized(ASDisplayNode *node) { _flags.isExitingHierarchy = YES; _flags.isInHierarchy = NO; - [self._locked_asyncLayer cancelAsyncDisplay]; - - // Don't call -didExitHierarchy while holding __instanceLock__. + // Don't call -didExitHierarchy while holding __instanceLock__. // This method and subsequent ones (i.e -interfaceState and didExit(.*)State) // don't expect that they are called while the lock is being held. // More importantly, didExit(.*)State methods are meant to be overriden by clients. @@ -2876,10 +2938,19 @@ ASDISPLAYNODE_INLINE BOOL subtreeIsRasterized(ASDisplayNode *node) { ASDisplayNodeAssertMainThread(); ASDisplayNodeAssert(_flags.isEnteringHierarchy, @"You should never call -willEnterHierarchy directly. Appearance is automatically managed by ASDisplayNode"); ASDisplayNodeAssert(!_flags.isExitingHierarchy, @"ASDisplayNode inconsistency. __enterHierarchy and __exitHierarchy are mutually exclusive"); - ASDisplayNodeAssertLockUnownedByCurrentThread(__instanceLock__); + ASAssertUnlocked(__instanceLock__); if (![self supportsRangeManagedInterfaceState]) { self.interfaceState = ASInterfaceStateInHierarchy; + } else if (ASCATransactionQueue.sharedQueue.isEnabled) { + __instanceLock__.lock(); + ASInterfaceState state = _preExitingInterfaceState; + _preExitingInterfaceState = ASInterfaceStateNone; + __instanceLock__.unlock(); + // Layer thrash happened, revert to before exiting. + if (state != ASInterfaceStateNone) { + self.interfaceState = state; + } } } @@ -2888,7 +2959,7 @@ ASDISPLAYNODE_INLINE BOOL subtreeIsRasterized(ASDisplayNode *node) { ASDisplayNodeAssert(!_flags.isEnteringHierarchy, @"You should never call -didEnterHierarchy directly. Appearance is automatically managed by ASDisplayNode"); ASDisplayNodeAssert(!_flags.isExitingHierarchy, @"ASDisplayNode inconsistency. __enterHierarchy and __exitHierarchy are mutually exclusive"); ASDisplayNodeAssert(_flags.isInHierarchy, @"ASDisplayNode inconsistency. __enterHierarchy and __exitHierarchy are mutually exclusive"); - ASDisplayNodeAssertLockUnownedByCurrentThread(__instanceLock__); + ASAssertUnlocked(__instanceLock__); } - (void)didExitHierarchy @@ -2896,7 +2967,7 @@ ASDISPLAYNODE_INLINE BOOL subtreeIsRasterized(ASDisplayNode *node) { ASDisplayNodeAssertMainThread(); ASDisplayNodeAssert(_flags.isExitingHierarchy, @"You should never call -didExitHierarchy directly. Appearance is automatically managed by ASDisplayNode"); ASDisplayNodeAssert(!_flags.isEnteringHierarchy, @"ASDisplayNode inconsistency. __enterHierarchy and __exitHierarchy are mutually exclusive"); - ASDisplayNodeAssertLockUnownedByCurrentThread(__instanceLock__); + ASAssertUnlocked(__instanceLock__); // This case is important when tearing down hierarchies. We must deliver a visibileStateDidChange:NO callback, as part our API guarantee that this method can be used for // things like data analytics about user content viewing. We cannot call the method in the dealloc as any incidental retain operations in client code would fail. @@ -2918,6 +2989,8 @@ ASDISPLAYNODE_INLINE BOOL subtreeIsRasterized(ASDisplayNode *node) { unsigned isStillInHierarchy = _flags.isInHierarchy; BOOL isVisible = ASInterfaceStateIncludesVisible(_pendingInterfaceState); ASInterfaceState newState = (_pendingInterfaceState & ~ASInterfaceStateVisible); + // layer may be thrashed, we need to remember the state so we can reset if it enters in same runloop later. + _preExitingInterfaceState = _pendingInterfaceState; __instanceLock__.unlock(); if (!isStillInHierarchy && isVisible) { #if ENABLE_NEW_EXIT_HIERARCHY_BEHAVIOR @@ -3018,7 +3091,7 @@ ASDISPLAYNODE_INLINE BOOL subtreeIsRasterized(ASDisplayNode *node) { ASDisplayNodeAssertMainThread(); // This method manages __instanceLock__ itself, to ensure the lock is not held while didEnter/Exit(.*)State methods are called, thus avoid potential deadlocks - ASDisplayNodeAssertLockUnownedByCurrentThread(__instanceLock__); + ASAssertUnlocked(__instanceLock__); ASInterfaceState oldState = ASInterfaceStateNone; ASInterfaceState newState = ASInterfaceStateNone; @@ -3035,6 +3108,7 @@ ASDISPLAYNODE_INLINE BOOL subtreeIsRasterized(ASDisplayNode *node) { return; } _interfaceState = newState; + _preExitingInterfaceState = ASInterfaceStateNone; } // It should never be possible for a node to be visible but not be allowed / expected to display. @@ -3077,8 +3151,10 @@ ASDISPLAYNODE_INLINE BOOL subtreeIsRasterized(ASDisplayNode *node) { [self setDisplaySuspended:YES]; //schedule clear contents on next runloop dispatch_async(dispatch_get_main_queue(), ^{ - ASDN::MutexLocker l(__instanceLock__); - if (ASInterfaceStateIncludesDisplay(_interfaceState) == NO) { + __instanceLock__.lock(); + ASInterfaceState interfaceState = _interfaceState; + __instanceLock__.unlock(); + if (ASInterfaceStateIncludesDisplay(interfaceState) == NO) { [self clearContents]; } }); @@ -3095,8 +3171,10 @@ ASDISPLAYNODE_INLINE BOOL subtreeIsRasterized(ASDisplayNode *node) { [[self asyncLayer] cancelAsyncDisplay]; //schedule clear contents on next runloop dispatch_async(dispatch_get_main_queue(), ^{ - ASDN::MutexLocker l(__instanceLock__); - if (ASInterfaceStateIncludesDisplay(_interfaceState) == NO) { + __instanceLock__.lock(); + ASInterfaceState interfaceState = _interfaceState; + __instanceLock__.unlock(); + if (ASInterfaceStateIncludesDisplay(interfaceState) == NO) { [self clearContents]; } }); @@ -3145,8 +3223,11 @@ ASDISPLAYNODE_INLINE BOOL subtreeIsRasterized(ASDisplayNode *node) { - (void)interfaceStateDidChange:(ASInterfaceState)newState fromState:(ASInterfaceState)oldState { // Subclass hook - ASDisplayNodeAssertLockUnownedByCurrentThread(__instanceLock__); - [_interfaceStateDelegate interfaceStateDidChange:newState fromState:oldState]; + ASAssertUnlocked(__instanceLock__); + ASDisplayNodeAssertMainThread(); + [self enumerateInterfaceStateDelegates:^(id del) { + [del interfaceStateDidChange:newState fromState:oldState]; + }]; } - (BOOL)shouldScheduleDisplayWithNewInterfaceState:(ASInterfaceState)newInterfaceState @@ -3156,6 +3237,30 @@ ASDISPLAYNODE_INLINE BOOL subtreeIsRasterized(ASDisplayNode *node) { return willDisplay && (willDisplay != nowDisplay); } +- (void)addInterfaceStateDelegate:(id )interfaceStateDelegate +{ + ASDN::MutexLocker l(__instanceLock__); + _hasHadInterfaceStateDelegates = YES; + for (int i = 0; i < AS_MAX_INTERFACE_STATE_DELEGATES; i++) { + if (_interfaceStateDelegates[i] == nil) { + _interfaceStateDelegates[i] = interfaceStateDelegate; + return; + } + } + ASDisplayNodeFailAssert(@"Exceeded interface state delegate limit: %d", AS_MAX_INTERFACE_STATE_DELEGATES); +} + +- (void)removeInterfaceStateDelegate:(id )interfaceStateDelegate +{ + ASDN::MutexLocker l(__instanceLock__); + for (int i = 0; i < AS_MAX_INTERFACE_STATE_DELEGATES; i++) { + if (_interfaceStateDelegates[i] == interfaceStateDelegate) { + _interfaceStateDelegates[i] = nil; + break; + } + } +} + - (BOOL)isVisible { ASDN::MutexLocker l(__instanceLock__); @@ -3166,8 +3271,10 @@ ASDISPLAYNODE_INLINE BOOL subtreeIsRasterized(ASDisplayNode *node) { { // subclass override ASDisplayNodeAssertMainThread(); - ASDisplayNodeAssertLockUnownedByCurrentThread(__instanceLock__); - [_interfaceStateDelegate didEnterVisibleState]; + ASAssertUnlocked(__instanceLock__); + [self enumerateInterfaceStateDelegates:^(id del) { + [del didEnterVisibleState]; + }]; #if AS_ENABLE_TIPS [ASTipsController.shared nodeDidAppear:self]; #endif @@ -3177,8 +3284,10 @@ ASDISPLAYNODE_INLINE BOOL subtreeIsRasterized(ASDisplayNode *node) { { // subclass override ASDisplayNodeAssertMainThread(); - ASDisplayNodeAssertLockUnownedByCurrentThread(__instanceLock__); - [_interfaceStateDelegate didExitVisibleState]; + ASAssertUnlocked(__instanceLock__); + [self enumerateInterfaceStateDelegates:^(id del) { + [del didExitVisibleState]; + }]; } - (BOOL)isInDisplayState @@ -3191,16 +3300,20 @@ ASDISPLAYNODE_INLINE BOOL subtreeIsRasterized(ASDisplayNode *node) { { // subclass override ASDisplayNodeAssertMainThread(); - ASDisplayNodeAssertLockUnownedByCurrentThread(__instanceLock__); - [_interfaceStateDelegate didEnterDisplayState]; + ASAssertUnlocked(__instanceLock__); + [self enumerateInterfaceStateDelegates:^(id del) { + [del didEnterDisplayState]; + }]; } - (void)didExitDisplayState { // subclass override ASDisplayNodeAssertMainThread(); - ASDisplayNodeAssertLockUnownedByCurrentThread(__instanceLock__); - [_interfaceStateDelegate didExitDisplayState]; + ASAssertUnlocked(__instanceLock__); + [self enumerateInterfaceStateDelegates:^(id del) { + [del didExitDisplayState]; + }]; } - (BOOL)isInPreloadState @@ -3237,7 +3350,7 @@ ASDISPLAYNODE_INLINE BOOL subtreeIsRasterized(ASDisplayNode *node) { - (void)didEnterPreloadState { ASDisplayNodeAssertMainThread(); - ASDisplayNodeAssertLockUnownedByCurrentThread(__instanceLock__); + ASAssertUnlocked(__instanceLock__); // If this node has ASM enabled and is not yet visible, force a layout pass to apply its applicable pending layout, if any, // so that its subnodes are inserted/deleted and start preloading right away. @@ -3250,20 +3363,26 @@ ASDISPLAYNODE_INLINE BOOL subtreeIsRasterized(ASDisplayNode *node) { if (self.automaticallyManagesSubnodes) { [self layoutIfNeeded]; } - - [_interfaceStateDelegate didEnterPreloadState]; + [self enumerateInterfaceStateDelegates:^(id del) { + [del didEnterPreloadState]; + }]; } - (void)didExitPreloadState { ASDisplayNodeAssertMainThread(); - ASDisplayNodeAssertLockUnownedByCurrentThread(__instanceLock__); - [_interfaceStateDelegate didExitPreloadState]; + ASAssertUnlocked(__instanceLock__); + [self enumerateInterfaceStateDelegates:^(id del) { + [del didExitPreloadState]; + }]; } - (void)clearContents { ASDisplayNodeAssertMainThread(); + ASAssertUnlocked(__instanceLock__); + + ASDN::MutexLocker l(__instanceLock__); if (_flags.canClearContentsOfLayer) { // No-op if these haven't been created yet, as that guarantees they don't have contents that needs to be released. _layer.contents = nil; @@ -3282,7 +3401,29 @@ ASDISPLAYNODE_INLINE BOOL subtreeIsRasterized(ASDisplayNode *node) { }); } +- (void)enumerateInterfaceStateDelegates:(void (NS_NOESCAPE ^)(id))block +{ + ASAssertUnlocked(__instanceLock__); + id dels[AS_MAX_INTERFACE_STATE_DELEGATES]; + int count = 0; + { + ASLockScopeSelf(); + // Fast path for non-delegating nodes. + if (!_hasHadInterfaceStateDelegates) { + return; + } + + for (int i = 0; i < AS_MAX_INTERFACE_STATE_DELEGATES; i++) { + if ((dels[count] = _interfaceStateDelegates[i])) { + count++; + } + } + } + for (int i = 0; i < count; i++) { + block(dels[i]); + } +} #pragma mark - Gesture Recognizing @@ -3358,6 +3499,7 @@ ASDISPLAYNODE_INLINE BOOL subtreeIsRasterized(ASDisplayNode *node) { - (void)_locked_applyPendingStateToViewOrLayer { ASDisplayNodeAssertMainThread(); + ASAssertLocked(__instanceLock__); ASDisplayNodeAssert(self.nodeLoaded, @"must have a view or layer"); TIME_SCOPED(_debugTimeToApplyPendingState); @@ -3377,7 +3519,7 @@ ASDISPLAYNODE_INLINE BOOL subtreeIsRasterized(ASDisplayNode *node) { - (void)applyPendingViewState { ASDisplayNodeAssertMainThread(); - ASDisplayNodeAssertLockUnownedByCurrentThread(__instanceLock__); + ASAssertUnlocked(__instanceLock__); ASDN::MutexLocker l(__instanceLock__); // FIXME: Ideally we'd call this as soon as the node receives -setNeedsLayout @@ -3396,6 +3538,7 @@ ASDISPLAYNODE_INLINE BOOL subtreeIsRasterized(ASDisplayNode *node) { - (void)_locked_applyPendingViewState { ASDisplayNodeAssertMainThread(); + ASAssertLocked(__instanceLock__); ASDisplayNodeAssert([self _locked_isNodeLoaded], @"Expected node to be loaded before applying pending state."); if (_flags.layerBacked) { @@ -3596,7 +3739,7 @@ ASDISPLAYNODE_INLINE BOOL subtreeIsRasterized(ASDisplayNode *node) { - (NSString *)debugDescription { ASPushMainThreadAssertionsDisabled(); - auto result = ASObjectDescriptionMake(self, [self propertiesForDebugDescription]); + let result = ASObjectDescriptionMake(self, [self propertiesForDebugDescription]); ASPopMainThreadAssertionsDisabled(); return result; } @@ -3668,26 +3811,24 @@ ASDISPLAYNODE_INLINE BOOL subtreeIsRasterized(ASDisplayNode *node) { { ASPushMainThreadAssertionsDisabled(); ASDN::MutexLocker l(__instanceLock__); - auto props = [NSMutableArray array]; + let props = [[NSMutableArray alloc] init]; [props addObject:@{ @"layoutVersion": @(_layoutVersion.load()) }]; [props addObject:@{ @"bounds": [NSValue valueWithCGRect:self.bounds] }]; - if (_calculatedDisplayNodeLayout != nullptr) { - ASDisplayNodeLayout c = *_calculatedDisplayNodeLayout; - [props addObject:@{ @"calculatedLayout": c.layout }]; - [props addObject:@{ @"calculatedVersion": @(c.version) }]; - [props addObject:@{ @"calculatedConstrainedSize" : NSStringFromASSizeRange(c.constrainedSize) }]; - if (c.requestedLayoutFromAbove) { + if (_calculatedDisplayNodeLayout.layout) { + [props addObject:@{ @"calculatedLayout": _calculatedDisplayNodeLayout.layout }]; + [props addObject:@{ @"calculatedVersion": @(_calculatedDisplayNodeLayout.version) }]; + [props addObject:@{ @"calculatedConstrainedSize" : NSStringFromASSizeRange(_calculatedDisplayNodeLayout.constrainedSize) }]; + if (_calculatedDisplayNodeLayout.requestedLayoutFromAbove) { [props addObject:@{ @"calculatedRequestedLayoutFromAbove": @"YES" }]; } } - if (_pendingDisplayNodeLayout != nullptr) { - ASDisplayNodeLayout p = *_pendingDisplayNodeLayout; - [props addObject:@{ @"pendingLayout": p.layout }]; - [props addObject:@{ @"pendingVersion": @(p.version) }]; - [props addObject:@{ @"pendingConstrainedSize" : NSStringFromASSizeRange(p.constrainedSize) }]; - if (p.requestedLayoutFromAbove) { + if (_pendingDisplayNodeLayout.layout) { + [props addObject:@{ @"pendingLayout": _pendingDisplayNodeLayout.layout }]; + [props addObject:@{ @"pendingVersion": @(_pendingDisplayNodeLayout.version) }]; + [props addObject:@{ @"pendingConstrainedSize" : NSStringFromASSizeRange(_pendingDisplayNodeLayout.constrainedSize) }]; + if (_pendingDisplayNodeLayout.requestedLayoutFromAbove) { [props addObject:@{ @"pendingRequestedLayoutFromAbove": (id)kCFNull }]; } } diff --git a/Source/ASDisplayNodeExtras.h b/Source/ASDisplayNodeExtras.h index b47eb5c6ea..09512ead9b 100644 --- a/Source/ASDisplayNodeExtras.h +++ b/Source/ASDisplayNodeExtras.h @@ -2,17 +2,9 @@ // ASDisplayNodeExtras.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import @@ -30,7 +22,7 @@ #define ASSetDebugName(node, format, ...) node.debugName = [NSString stringWithFormat:format, __VA_ARGS__] #define ASSetDebugNames(...) _ASSetDebugNames(self.class, @"" # __VA_ARGS__, __VA_ARGS__, nil) #else - #define ASSetDebugName(node, name) + #define ASSetDebugName(node, format, ...) #define ASSetDebugNames(...) #endif @@ -216,6 +208,6 @@ AS_EXTERN void ASDisplayNodeDisableHierarchyNotifications(ASDisplayNode *node); AS_EXTERN void ASDisplayNodeEnableHierarchyNotifications(ASDisplayNode *node); // Not to be called directly. -AS_EXTERN void _ASSetDebugNames(Class owningClass, NSString *names, ASDisplayNode *object, ...); +AS_EXTERN void _ASSetDebugNames(Class owningClass, NSString *names, ASDisplayNode * _Nullable object, ...); NS_ASSUME_NONNULL_END diff --git a/Source/ASDisplayNodeExtras.mm b/Source/ASDisplayNodeExtras.mm index 01e8ff17ec..d1be1576e3 100644 --- a/Source/ASDisplayNodeExtras.mm +++ b/Source/ASDisplayNodeExtras.mm @@ -2,17 +2,9 @@ // ASDisplayNodeExtras.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/ASEditableTextNode.h b/Source/ASEditableTextNode.h index b768f1bb4c..8a3d3d69a0 100644 --- a/Source/ASEditableTextNode.h +++ b/Source/ASEditableTextNode.h @@ -2,17 +2,9 @@ // ASEditableTextNode.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import @@ -211,7 +203,7 @@ NS_ASSUME_NONNULL_BEGIN - (void)editableTextNodeDidUpdateText:(ASEditableTextNode *)editableTextNode; /** - @abstract Indicates to the delegate that teh text node has finished editing. + @abstract Indicates to the delegate that the text node has finished editing. @param editableTextNode An editable text node. @discussion The invocation of this method coincides with the keyboard animating to become hidden. */ diff --git a/Source/ASEditableTextNode.mm b/Source/ASEditableTextNode.mm index e67edd595e..18d3ce435e 100644 --- a/Source/ASEditableTextNode.mm +++ b/Source/ASEditableTextNode.mm @@ -2,17 +2,9 @@ // ASEditableTextNode.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/ASExperimentalFeatures.h b/Source/ASExperimentalFeatures.h index 570ed95fd1..626975636c 100644 --- a/Source/ASExperimentalFeatures.h +++ b/Source/ASExperimentalFeatures.h @@ -2,12 +2,8 @@ // ASExperimentalFeatures.h // Texture // -// Copyright (c) 2018-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import @@ -25,7 +21,9 @@ typedef NS_OPTIONS(NSUInteger, ASExperimentalFeatures) { ASExperimentalUnfairLock = 1 << 3, // exp_unfair_lock ASExperimentalLayerDefaults = 1 << 4, // exp_infer_layer_defaults ASExperimentalNetworkImageQueue = 1 << 5, // exp_network_image_queue - ASExperimentalDeallocQueue = 1 << 6, // exp_dealloc_queue_v2 + ASExperimentalCollectionTeardown = 1 << 6, // exp_collection_teardown + ASExperimentalFramesetterCache = 1 << 7, // exp_framesetter_cache + ASExperimentalClearDataDuringDeallocation = 1 << 8, // exp_clear_data_during_deallocation ASExperimentalFeatureAll = 0xFFFFFFFF }; diff --git a/Source/ASExperimentalFeatures.m b/Source/ASExperimentalFeatures.m index 90772f4311..73abea48b6 100644 --- a/Source/ASExperimentalFeatures.m +++ b/Source/ASExperimentalFeatures.m @@ -2,16 +2,14 @@ // ASExperimentalFeatures.m // Texture // -// Copyright (c) 2018-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import +#import + NSArray *ASExperimentalFeaturesGetNames(ASExperimentalFeatures flags) { NSArray *allNames = ASCreateOnce((@[@"exp_graphics_contexts", @@ -20,7 +18,10 @@ NSArray *ASExperimentalFeaturesGetNames(ASExperimentalFeatures flags @"exp_unfair_lock", @"exp_infer_layer_defaults", @"exp_network_image_queue", - @"exp_dealloc_queue_v2"])); + @"exp_dealloc_queue_v2", + @"exp_collection_teardown", + @"exp_framesetter_cache", + @"exp_clear_data_during_deallocation"])); if (flags == ASExperimentalFeatureAll) { return allNames; diff --git a/Source/ASImageNode+AnimatedImage.mm b/Source/ASImageNode+AnimatedImage.mm index 0a617eb665..fd093d0785 100644 --- a/Source/ASImageNode+AnimatedImage.mm +++ b/Source/ASImageNode+AnimatedImage.mm @@ -2,17 +2,9 @@ // ASImageNode+AnimatedImage.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK @@ -23,6 +15,7 @@ #import #import #import +#import #import #import #import @@ -54,11 +47,13 @@ NSString *const ASAnimatedImageDefaultRunLoopMode = NSRunLoopCommonModes; - (void)_locked_setAnimatedImage:(id )animatedImage { + ASAssertLocked(__instanceLock__); + if (ASObjectIsEqual(_animatedImage, animatedImage) && (animatedImage == nil || animatedImage.playbackReady)) { return; } - id previousAnimatedImage = _animatedImage; + __block id previousAnimatedImage = _animatedImage; _animatedImage = animatedImage; @@ -79,22 +74,35 @@ NSString *const ASAnimatedImageDefaultRunLoopMode = NSRunLoopCommonModes; [self _locked_setShouldAnimate:YES]; } } else { - // Clean up after ourselves. - self.contents = nil; - [self setCoverImage:nil]; - } - - [self animatedImageSet:_animatedImage previousAnimatedImage:previousAnimatedImage]; + // Clean up after ourselves. - // Animated image can take while to dealloc, do it off the main queue - if (previousAnimatedImage != nil) { - ASPerformBackgroundDeallocation(&previousAnimatedImage); + // Don't bother using a `_locked` version for setting contnst as it should be pretty safe calling it with + // reaquire the lock and would add overhead to introduce this version + self.contents = nil; + [self _locked_setCoverImage:nil]; } + + // Push calling subclass to the next runloop cycle + // We have to schedule the block on the common modes otherwise the tracking mode will not be included and it will + // not fire e.g. while scrolling down + CFRunLoopPerformBlock(CFRunLoopGetCurrent(), kCFRunLoopCommonModes, ^(void) { + [self animatedImageSet:animatedImage previousAnimatedImage:previousAnimatedImage]; + + // Animated image can take while to dealloc, do it off the main queue + if (previousAnimatedImage != nil) { + ASPerformBackgroundDeallocation(&previousAnimatedImage); + } + }); + // Don't need to wakeup the runloop as the current is already running + // CFRunLoopWakeUp(runLoop); // Should not be necessary } - (void)animatedImageSet:(id )newAnimatedImage previousAnimatedImage:(id )previousAnimatedImage { - //Subclasses may override + // Subclass hook should not be called with the lock held + ASAssertUnlocked(__instanceLock__); + + // Subclasses may override } - (id )animatedImage @@ -128,6 +136,8 @@ NSString *const ASAnimatedImageDefaultRunLoopMode = NSRunLoopCommonModes; - (void)_locked_setCoverImageCompleted:(UIImage *)coverImage { + ASAssertLocked(__instanceLock__); + _displayLinkLock.lock(); BOOL setCoverImage = (_displayLink == nil) || _displayLink.paused; _displayLinkLock.unlock(); @@ -145,6 +155,8 @@ NSString *const ASAnimatedImageDefaultRunLoopMode = NSRunLoopCommonModes; - (void)_locked_setCoverImage:(UIImage *)coverImage { + ASAssertLocked(__instanceLock__); + //If we're a network image node, we want to set the default image so //that it will correctly be restored if it exits the range. #ifndef MINIMAL_ASDK @@ -185,6 +197,8 @@ NSString *const ASAnimatedImageDefaultRunLoopMode = NSRunLoopCommonModes; - (void)_locked_setShouldAnimate:(BOOL)shouldAnimate { + ASAssertLocked(__instanceLock__); + // This test is explicitly done and not ASPerformBlockOnMainThread as this would perform the block immediately // on main if called on main thread and we have to call methods locked or unlocked based on which thread we are on if (ASDisplayNodeThreadIsMain()) { @@ -218,6 +232,8 @@ NSString *const ASAnimatedImageDefaultRunLoopMode = NSRunLoopCommonModes; - (void)_locked_startAnimating { + ASAssertLocked(__instanceLock__); + // It should be safe to call self.interfaceState in this case as it will only grab the lock of the superclass if (!ASInterfaceStateIncludesVisible(self.interfaceState)) { return; @@ -261,6 +277,7 @@ NSString *const ASAnimatedImageDefaultRunLoopMode = NSRunLoopCommonModes; - (void)_locked_stopAnimating { ASDisplayNodeAssertMainThread(); + ASAssertLocked(__instanceLock__); #if ASAnimatedImageDebug NSLog(@"stopping animation: %p", self); diff --git a/Source/ASImageNode.h b/Source/ASImageNode.h index 14cf5f021b..902591c4f6 100644 --- a/Source/ASImageNode.h +++ b/Source/ASImageNode.h @@ -2,17 +2,9 @@ // ASImageNode.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import @@ -186,9 +178,8 @@ typedef UIImage * _Nullable (^asimagenode_modification_block_t)(UIImage *image); * * @discussion This method is for subclasses to override so they can know if an animated image * has been set on the node. - * @warning this method is called with the node's lock held. */ -- (void)animatedImageSet:(id )newAnimatedImage previousAnimatedImage:(id )previousAnimatedImage; +- (void)animatedImageSet:(nullable id )newAnimatedImage previousAnimatedImage:(nullable id )previousAnimatedImage ASDISPLAYNODE_REQUIRES_SUPER; @end #endif diff --git a/Source/ASImageNode.mm b/Source/ASImageNode.mm index 15d5658d0a..a36748475e 100644 --- a/Source/ASImageNode.mm +++ b/Source/ASImageNode.mm @@ -2,17 +2,9 @@ // ASImageNode.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import @@ -230,7 +222,7 @@ typedef void (^ASImageNodeDrawParametersBlock)(ASWeakMapEntry *entry); - (CGSize)calculateSizeThatFits:(CGSize)constrainedSize { - auto image = ASLockedSelf(_image); + let image = ASLockedSelf(_image); if (image == nil) { return [super calculateSizeThatFits:constrainedSize]; @@ -249,6 +241,7 @@ typedef void (^ASImageNodeDrawParametersBlock)(ASWeakMapEntry *entry); - (void)_locked_setImage:(UIImage *)image { + ASAssertLocked(__instanceLock__); if (ASObjectIsEqual(_image, image)) { return; } @@ -334,7 +327,7 @@ typedef void (^ASImageNodeDrawParametersBlock)(ASWeakMapEntry *entry); return drawParameters; } -+ (UIImage *)displayWithParameters:(id)parameter isCancelled:(asdisplaynode_iscancelled_block_t)isCancelled ++ (UIImage *)displayWithParameters:(id)parameter isCancelled:(NS_NOESCAPE asdisplaynode_iscancelled_block_t)isCancelled { ASImageNodeDrawParameters *drawParameter = (ASImageNodeDrawParameters *)parameter; @@ -605,10 +598,9 @@ static ASDN::StaticMutex& cacheLock = *new ASDN::StaticMutex; - (void)clearContents { [super clearContents]; - - __instanceLock__.lock(); - _weakCacheEntry = nil; // release contents from the cache. - __instanceLock__.unlock(); + + ASDN::MutexLocker l(__instanceLock__); + _weakCacheEntry = nil; // release contents from the cache. } #pragma mark - Cropping diff --git a/Source/ASLocking.h b/Source/ASLocking.h index 1e53a150ea..3e284dc26c 100644 --- a/Source/ASLocking.h +++ b/Source/ASLocking.h @@ -2,12 +2,8 @@ // ASLocking.h // Texture // -// Copyright (c) 2018-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import @@ -107,7 +103,7 @@ NS_INLINE void ASUnlockSet(ASLockSet *lockSet) { */ NS_INLINE ASLockSet ASLockSequence(NS_NOESCAPE ASLockSequenceBlock body) { - __block ASLockSet locks = (ASLockSet){0}; + __block ASLockSet locks = (ASLockSet){0, {}}; BOOL (^addLock)(id) = ^(id obj) { // nil lock = ignore. diff --git a/Source/ASMainThreadDeallocation.h b/Source/ASMainThreadDeallocation.h index a2aa8249f0..391b6bb696 100644 --- a/Source/ASMainThreadDeallocation.h +++ b/Source/ASMainThreadDeallocation.h @@ -2,12 +2,8 @@ // ASMainThreadDeallocation.h // Texture // -// Copyright (c) 2018-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/ASMainThreadDeallocation.mm b/Source/ASMainThreadDeallocation.mm index 36c13421cd..0bf6d19806 100644 --- a/Source/ASMainThreadDeallocation.mm +++ b/Source/ASMainThreadDeallocation.mm @@ -2,12 +2,8 @@ // ASMainThreadDeallocation.mm // Texture // -// Copyright (c) 2018-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import @@ -146,7 +142,7 @@ + (BOOL)needsMainThreadDeallocation { - auto name = class_getName(self); + let name = class_getName(self); if (0 == strncmp(name, "AV", 2) || 0 == strncmp(name, "UI", 2) || 0 == strncmp(name, "CA", 2)) { return YES; } diff --git a/Source/ASMapNode.h b/Source/ASMapNode.h index a5e7711565..9ddc2b6ffc 100644 --- a/Source/ASMapNode.h +++ b/Source/ASMapNode.h @@ -2,23 +2,16 @@ // ASMapNode.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // -#ifndef MINIMAL_ASDK +#import +#import +#if TARGET_OS_IOS && AS_USE_MAPKIT #import -#if TARGET_OS_IOS #import NS_ASSUME_NONNULL_BEGIN @@ -97,5 +90,3 @@ typedef NS_OPTIONS(NSUInteger, ASMapNodeShowAnnotationsOptions) NS_ASSUME_NONNULL_END #endif - -#endif diff --git a/Source/ASMapNode.mm b/Source/ASMapNode.mm index a57e4aef1a..1c204ab974 100644 --- a/Source/ASMapNode.mm +++ b/Source/ASMapNode.mm @@ -2,26 +2,15 @@ // ASMapNode.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // -#ifndef MINIMAL_ASDK - -#import - -#if TARGET_OS_IOS #import +#if TARGET_OS_IOS && AS_USE_MAPKIT + #import #import @@ -450,6 +439,4 @@ } @end -#endif - -#endif +#endif // TARGET_OS_IOS && AS_USE_MAPKIT diff --git a/Source/ASMultiplexImageNode.h b/Source/ASMultiplexImageNode.h index 852a445360..42342422a9 100644 --- a/Source/ASMultiplexImageNode.h +++ b/Source/ASMultiplexImageNode.h @@ -2,17 +2,9 @@ // ASMultiplexImageNode.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK diff --git a/Source/ASMultiplexImageNode.mm b/Source/ASMultiplexImageNode.mm index a3052ff15c..338f408cbe 100644 --- a/Source/ASMultiplexImageNode.mm +++ b/Source/ASMultiplexImageNode.mm @@ -2,22 +2,14 @@ // ASMultiplexImageNode.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK #import -#if TARGET_OS_IOS +#if TARGET_OS_IOS && AS_USE_ASSETS_LIBRARY #import #endif @@ -25,12 +17,15 @@ #import #import #import -#import #import #import #import #import +#if AS_USE_PHOTOS +#import +#endif + #if AS_PIN_REMOTE_IMAGE #import #else @@ -39,7 +34,9 @@ NSString *const ASMultiplexImageNodeErrorDomain = @"ASMultiplexImageNodeErrorDomain"; +#if AS_USE_ASSETS_LIBRARY static NSString *const kAssetsLibraryURLScheme = @"assets-library"; +#endif static const CGSize kMinReleaseImageOnBackgroundSize = {20.0, 20.0}; @@ -133,7 +130,7 @@ typedef void(^ASMultiplexImageLoadCompletionBlock)(UIImage *image, id imageIdent */ - (void)_fetchImageWithIdentifierFromCache:(id)imageIdentifier URL:(NSURL *)imageURL completion:(void (^)(UIImage *image))completionBlock; -#if TARGET_OS_IOS +#if TARGET_OS_IOS && AS_USE_ASSETS_LIBRARY /** @abstract Loads the image corresponding to the given assetURL from the device's Assets Library. @param imageIdentifier The identifier for the image to be loaded. May not be nil. @@ -143,6 +140,7 @@ typedef void(^ASMultiplexImageLoadCompletionBlock)(UIImage *image, id imageIdent - (void)_loadALAssetWithIdentifier:(id)imageIdentifier URL:(NSURL *)assetURL completion:(void (^)(UIImage *image, NSError *error))completionBlock; #endif +#if AS_USE_PHOTOS /** @abstract Loads the image corresponding to the given image request from the Photos framework. @param imageIdentifier The identifier for the image to be loaded. May not be nil. @@ -150,6 +148,7 @@ typedef void(^ASMultiplexImageLoadCompletionBlock)(UIImage *image, id imageIdent @param completionBlock The block to be performed when the image has been loaded, if possible. May not be nil. */ - (void)_loadPHAssetWithRequest:(ASPhotosFrameworkImageRequest *)request identifier:(id)imageIdentifier completion:(void (^)(UIImage *image, NSError *error))completionBlock API_AVAILABLE(ios(8.0), tvos(10.0)); +#endif /** @abstract Downloads the image corresponding to the given imageIdentifier from the given URL. @@ -413,8 +412,11 @@ typedef void(^ASMultiplexImageLoadCompletionBlock)(UIImage *image, id imageIdent #pragma mark - Core Internal - (void)_setDisplayedImageIdentifier:(id)displayedImageIdentifier withImage:(UIImage *)image { - if (ASObjectIsEqual(displayedImageIdentifier, _displayedImageIdentifier)) + ASDisplayNodeAssertMainThread(); + + if (ASObjectIsEqual(_displayedImageIdentifier, displayedImageIdentifier)) { return; + } _displayedImageIdentifier = displayedImageIdentifier; @@ -620,7 +622,7 @@ typedef void(^ASMultiplexImageLoadCompletionBlock)(UIImage *image, id imageIdent return; } -#if TARGET_OS_IOS +#if TARGET_OS_IOS && AS_USE_ASSETS_LIBRARY // If it's an assets-library URL, we need to fetch it from the assets library. if ([[nextImageURL scheme] isEqualToString:kAssetsLibraryURLScheme]) { // Load the asset. @@ -633,6 +635,7 @@ typedef void(^ASMultiplexImageLoadCompletionBlock)(UIImage *image, id imageIdent } #endif +#if AS_USE_PHOTOS if (AS_AVAILABLE_IOS_TVOS(9, 10)) { // Likewise, if it's a Photos asset, we need to fetch it accordingly. if (ASPhotosFrameworkImageRequest *request = [ASPhotosFrameworkImageRequest requestWithURL:nextImageURL]) { @@ -644,6 +647,7 @@ typedef void(^ASMultiplexImageLoadCompletionBlock)(UIImage *image, id imageIdent return; } } +#endif // Otherwise, it's a web URL that we can download. // First, check the cache. @@ -677,7 +681,7 @@ typedef void(^ASMultiplexImageLoadCompletionBlock)(UIImage *image, id imageIdent }]; }]; } -#if TARGET_OS_IOS +#if TARGET_OS_IOS && AS_USE_ASSETS_LIBRARY - (void)_loadALAssetWithIdentifier:(id)imageIdentifier URL:(NSURL *)assetURL completion:(void (^)(UIImage *image, NSError *error))completionBlock { ASDisplayNodeAssertNotNil(imageIdentifier, @"imageIdentifier is required"); @@ -702,6 +706,8 @@ typedef void(^ASMultiplexImageLoadCompletionBlock)(UIImage *image, id imageIdent #pragma clang diagnostic pop } #endif + +#if AS_USE_PHOTOS - (void)_loadPHAssetWithRequest:(ASPhotosFrameworkImageRequest *)request identifier:(id)imageIdentifier completion:(void (^)(UIImage *image, NSError *error))completionBlock { ASDisplayNodeAssertNotNil(imageIdentifier, @"imageIdentifier is required"); @@ -789,6 +795,7 @@ typedef void(^ASMultiplexImageLoadCompletionBlock)(UIImage *image, id imageIdent _phImageRequestOperation = newImageRequestOp; [phImageRequestQueue addOperation:newImageRequestOp]; } +#endif - (void)_fetchImageWithIdentifierFromCache:(id)imageIdentifier URL:(NSURL *)imageURL completion:(void (^)(UIImage *image))completionBlock { @@ -892,6 +899,7 @@ typedef void(^ASMultiplexImageLoadCompletionBlock)(UIImage *image, id imageIdent @end +#if AS_USE_PHOTOS @implementation NSURL (ASPhotosFrameworkURLs) + (NSURL *)URLWithAssetLocalIdentifier:(NSString *)assetLocalIdentifier targetSize:(CGSize)targetSize contentMode:(PHImageContentMode)contentMode options:(PHImageRequestOptions *)options NS_RETURNS_RETAINED diff --git a/Source/ASNavigationController.h b/Source/ASNavigationController.h index 98e3b8cb23..4f7ac12df4 100644 --- a/Source/ASNavigationController.h +++ b/Source/ASNavigationController.h @@ -2,17 +2,9 @@ // ASNavigationController.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK diff --git a/Source/ASNavigationController.m b/Source/ASNavigationController.m index 85a2104381..a985b91c5b 100644 --- a/Source/ASNavigationController.m +++ b/Source/ASNavigationController.m @@ -2,17 +2,9 @@ // ASNavigationController.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK #import diff --git a/Source/ASNetworkImageLoadInfo.h b/Source/ASNetworkImageLoadInfo.h index 6db366a9cd..55c4b49a7a 100644 --- a/Source/ASNetworkImageLoadInfo.h +++ b/Source/ASNetworkImageLoadInfo.h @@ -2,12 +2,8 @@ // ASNetworkImageLoadInfo.h // Texture // -// Copyright (c) 2018-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/ASNetworkImageLoadInfo.m b/Source/ASNetworkImageLoadInfo.m index 00baa1bf7c..f0f0554430 100644 --- a/Source/ASNetworkImageLoadInfo.m +++ b/Source/ASNetworkImageLoadInfo.m @@ -2,12 +2,8 @@ // ASNetworkImageLoadInfo.m // Texture // -// Copyright (c) 2018-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/ASNetworkImageNode.h b/Source/ASNetworkImageNode.h index 09a7bf05b7..b32bcb0c43 100644 --- a/Source/ASNetworkImageNode.h +++ b/Source/ASNetworkImageNode.h @@ -2,17 +2,9 @@ // ASNetworkImageNode.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK @@ -58,6 +50,11 @@ NS_ASSUME_NONNULL_BEGIN */ @property (nullable, weak) id delegate; +/** + * The delegate will receive callbacks on main thread. Default to YES. + */ +@property (class) BOOL useMainThreadDelegateCallbacks; + /** * The image to display. * @@ -158,7 +155,7 @@ NS_ASSUME_NONNULL_BEGIN * @param image The newly-loaded image. * @param info Additional information about the image load. * - * @discussion Called on a background queue. + * @discussion Called on the main thread if useMainThreadDelegateCallbacks=YES (the default), otherwise on a background thread. */ - (void)imageNode:(ASNetworkImageNode *)imageNode didLoadImage:(UIImage *)image info:(ASNetworkImageLoadInfo *)info; @@ -168,7 +165,7 @@ NS_ASSUME_NONNULL_BEGIN * @param imageNode The sender. * @param image The newly-loaded image. * - * @discussion Called on a background queue. + * @discussion Called on the main thread if useMainThreadDelegateCallbacks=YES (the default), otherwise on a background thread. */ - (void)imageNode:(ASNetworkImageNode *)imageNode didLoadImage:(UIImage *)image; @@ -187,7 +184,7 @@ NS_ASSUME_NONNULL_BEGIN * @param imageNode The sender. * @param error The error with details. * - * @discussion Called on a background queue. + * @discussion Called on the main thread if useMainThreadDelegateCallbacks=YES (the default), otherwise on a background thread. */ - (void)imageNode:(ASNetworkImageNode *)imageNode didFailWithError:(NSError *)error; diff --git a/Source/ASNetworkImageNode.mm b/Source/ASNetworkImageNode.mm old mode 100755 new mode 100644 index 59d5e0a4ca..8a40093bc2 --- a/Source/ASNetworkImageNode.mm +++ b/Source/ASNetworkImageNode.mm @@ -2,17 +2,9 @@ // ASNetworkImageNode.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK @@ -21,6 +13,7 @@ #import #import #import +#import #import #import #import @@ -86,6 +79,8 @@ @implementation ASNetworkImageNode +static std::atomic_bool _useMainThreadDelegateCallbacks(true); + @dynamic image; - (instancetype)initWithCache:(id)cache downloader:(id)downloader @@ -150,6 +145,8 @@ - (void)_locked_setImage:(UIImage *)image { + ASAssertLocked(__instanceLock__); + BOOL imageWasSetExternally = (image != nil); BOOL shouldCancelAndClear = imageWasSetExternally && (imageWasSetExternally != _imageWasSetExternally); _imageWasSetExternally = imageWasSetExternally; @@ -176,6 +173,7 @@ - (void)_locked__setImage:(UIImage *)image { + ASAssertLocked(__instanceLock__); [super _locked_setImage:image]; } @@ -352,7 +350,7 @@ // Call out to the delegate. if (_delegateFlags.delegateDidLoadImageWithInfo) { ASUnlockScope(self); - auto info = [[ASNetworkImageLoadInfo alloc] initWithURL:url sourceType:ASNetworkImageSourceSynchronousCache downloadIdentifier:nil userInfo:nil]; + let info = [[ASNetworkImageLoadInfo alloc] initWithURL:url sourceType:ASNetworkImageSourceSynchronousCache downloadIdentifier:nil userInfo:nil]; [_delegate imageNode:self didLoadImage:result info:info]; } else if (_delegateFlags.delegateDidLoadImage) { ASUnlockScope(self); @@ -427,6 +425,16 @@ [self _lazilyLoadImageIfNecessary]; } ++ (void)setUseMainThreadDelegateCallbacks:(BOOL)useMainThreadDelegateCallbacks +{ + _useMainThreadDelegateCallbacks = useMainThreadDelegateCallbacks; +} + ++ (BOOL)useMainThreadDelegateCallbacks +{ + return _useMainThreadDelegateCallbacks; +} + #pragma mark - Progress - (void)handleProgressImage:(UIImage *)progressImage progress:(CGFloat)progress downloadIdentifier:(nullable id)downloadIdentifier @@ -509,6 +517,8 @@ - (void)_locked_cancelDownloadAndClearImageWithResumePossibility:(BOOL)storeResume { + ASAssertLocked(__instanceLock__); + [self _locked_cancelImageDownloadWithResumePossibility:storeResume]; [self _locked_setAnimatedImage:nil]; @@ -533,6 +543,8 @@ - (void)_locked_cancelImageDownloadWithResumePossibility:(BOOL)storeResume { + ASAssertLocked(__instanceLock__); + if (!_downloadIdentifier) { return; } @@ -630,7 +642,7 @@ } else { // First try to load the path directly, for efficiency assuming a developer who // doesn't want caching is trying to be as minimal as possible. - auto nonAnimatedImage = [[UIImage alloc] initWithContentsOfFile:URL.path]; + var nonAnimatedImage = [[UIImage alloc] initWithContentsOfFile:URL.path]; if (nonAnimatedImage == nil) { // If we couldn't find it, execute an -imageNamed:-like search so we can find resources even if the // extension is not provided in the path. This allows the same path to work regardless of shouldCacheImage. @@ -643,7 +655,7 @@ // If the file may be an animated gif and then created an animated image. id animatedImage = nil; if (_downloaderFlags.downloaderImplementsAnimatedImage) { - auto data = [[NSData alloc] initWithContentsOfURL:URL]; + let data = [[NSData alloc] initWithContentsOfURL:URL]; if (data != nil) { animatedImage = [_downloader animatedImageWithData:data]; @@ -666,7 +678,7 @@ if (_delegateFlags.delegateDidLoadImageWithInfo) { ASUnlockScope(self); - auto info = [[ASNetworkImageLoadInfo alloc] initWithURL:URL sourceType:ASNetworkImageSourceFileURL downloadIdentifier:nil userInfo:nil]; + let info = [[ASNetworkImageLoadInfo alloc] initWithURL:URL sourceType:ASNetworkImageSourceFileURL downloadIdentifier:nil userInfo:nil]; [delegate imageNode:self didLoadImage:self.image info:info]; } else if (_delegateFlags.delegateDidLoadImage) { ASUnlockScope(self); @@ -675,7 +687,7 @@ }); } else { __weak __typeof__(self) weakSelf = self; - auto finished = ^(id imageContainer, NSError *error, id downloadIdentifier, ASNetworkImageSourceType imageSource, id userInfo) { + let finished = ^(id imageContainer, NSError *error, id downloadIdentifier, ASNetworkImageSourceType imageSource, id userInfo) { ASPerformBlockOnBackgroundThread(^{ __typeof__(self) strongSelf = weakSelf; if (strongSelf == nil) { @@ -721,7 +733,7 @@ if (newImage) { if (_delegateFlags.delegateDidLoadImageWithInfo) { calloutBlock = ^(ASNetworkImageNode *strongSelf) { - auto info = [[ASNetworkImageLoadInfo alloc] initWithURL:URL sourceType:imageSource downloadIdentifier:downloadIdentifier userInfo:userInfo]; + let info = [[ASNetworkImageLoadInfo alloc] initWithURL:URL sourceType:imageSource downloadIdentifier:downloadIdentifier userInfo:userInfo]; [delegate imageNode:strongSelf didLoadImage:newImage info:info]; }; } else if (_delegateFlags.delegateDidLoadImage) { @@ -736,11 +748,15 @@ } if (calloutBlock) { - ASPerformBlockOnMainThread(^{ - if (auto strongSelf = weakSelf) { - calloutBlock(strongSelf); - } - }); + if (ASNetworkImageNode.useMainThreadDelegateCallbacks) { + ASPerformBlockOnMainThread(^{ + if (auto strongSelf = weakSelf) { + calloutBlock(strongSelf); + } + }); + } else { + calloutBlock(self); + } } }); }; diff --git a/Source/ASNodeController+Beta.h b/Source/ASNodeController+Beta.h index a1411226e4..e5bcc29622 100644 --- a/Source/ASNodeController+Beta.h +++ b/Source/ASNodeController+Beta.h @@ -2,17 +2,9 @@ // ASNodeController+Beta.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import @@ -46,6 +38,8 @@ - (void)interfaceStateDidChange:(ASInterfaceState)newState fromState:(ASInterfaceState)oldState ASDISPLAYNODE_REQUIRES_SUPER; +- (void)hierarchyDisplayDidFinish ASDISPLAYNODE_REQUIRES_SUPER; + @end @interface ASDisplayNode (ASNodeController) diff --git a/Source/ASNodeController+Beta.m b/Source/ASNodeController+Beta.m deleted file mode 100644 index 1bd873e763..0000000000 --- a/Source/ASNodeController+Beta.m +++ /dev/null @@ -1,149 +0,0 @@ -// -// ASNodeController+Beta.m -// Texture -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import - -#define _node (_shouldInvertStrongReference ? _weakNode : _strongNode) - -@interface ASDisplayNode (ASNodeControllerOwnership) - -// This property exists for debugging purposes. Don't use __nodeController in production code. -@property (nonatomic, readonly) ASNodeController *__nodeController; - -// These setters are mutually exclusive. Setting one will clear the relationship of the other. -- (void)__setNodeControllerStrong:(ASNodeController *)nodeController; -- (void)__setNodeControllerWeak:(ASNodeController *)nodeController; - -@end - -@implementation ASNodeController -{ - ASDisplayNode *_strongNode; - __weak ASDisplayNode *_weakNode; -} - -- (instancetype)init -{ - self = [super init]; - if (self) { - - } - return self; -} - -- (void)loadNode -{ - self.node = [[ASDisplayNode alloc] init]; -} - -- (ASDisplayNode *)node -{ - if (_node == nil) { - [self loadNode]; - } - return _node; -} - -- (void)setupReferencesWithNode:(ASDisplayNode *)node -{ - if (_shouldInvertStrongReference) { - // The node should own the controller; weak reference from controller to node. - _weakNode = node; - [node __setNodeControllerStrong:self]; - _strongNode = nil; - } else { - // The controller should own the node; weak reference from node to controller. - _strongNode = node; - [node __setNodeControllerWeak:self]; - _weakNode = nil; - } - - node.interfaceStateDelegate = self; -} - -- (void)setNode:(ASDisplayNode *)node -{ - [self setupReferencesWithNode:node]; -} - -- (void)setShouldInvertStrongReference:(BOOL)shouldInvertStrongReference -{ - if (_shouldInvertStrongReference != shouldInvertStrongReference) { - // Because the BOOL controls which ivar we access, get the node before toggling. - ASDisplayNode *node = _node; - _shouldInvertStrongReference = shouldInvertStrongReference; - [self setupReferencesWithNode:node]; - } -} - -// subclass overrides -- (void)nodeDidLoad {} -- (void)nodeDidLayout {} - -- (void)didEnterVisibleState {} -- (void)didExitVisibleState {} - -- (void)didEnterDisplayState {} -- (void)didExitDisplayState {} - -- (void)didEnterPreloadState {} -- (void)didExitPreloadState {} - -- (void)interfaceStateDidChange:(ASInterfaceState)newState - fromState:(ASInterfaceState)oldState {} - -@end - -@implementation ASDisplayNode (ASNodeControllerOwnership) - -- (ASNodeController *)__nodeController -{ - ASNodeController *nodeController = nil; - id object = objc_getAssociatedObject(self, @selector(__nodeController)); - - if ([object isKindOfClass:[ASWeakProxy class]]) { - nodeController = (ASNodeController *)[(ASWeakProxy *)object target]; - } else { - nodeController = (ASNodeController *)object; - } - - return nodeController; -} - -- (void)__setNodeControllerStrong:(ASNodeController *)nodeController -{ - objc_setAssociatedObject(self, @selector(__nodeController), nodeController, OBJC_ASSOCIATION_RETAIN_NONATOMIC); -} - -- (void)__setNodeControllerWeak:(ASNodeController *)nodeController -{ - // Associated objects don't support weak references. Since assign can become a dangling pointer, use ASWeakProxy. - ASWeakProxy *nodeControllerProxy = [ASWeakProxy weakProxyWithTarget:nodeController]; - objc_setAssociatedObject(self, @selector(__nodeController), nodeControllerProxy, OBJC_ASSOCIATION_RETAIN_NONATOMIC); -} - -@end - -@implementation ASDisplayNode (ASNodeController) - -- (ASNodeController *)nodeController { - return self.__nodeController; -} - -@end diff --git a/Source/ASNodeController+Beta.mm b/Source/ASNodeController+Beta.mm new file mode 100644 index 0000000000..201b3cfb93 --- /dev/null +++ b/Source/ASNodeController+Beta.mm @@ -0,0 +1,93 @@ +// +// ASNodeController+Beta.mm +// Texture +// +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 +// + +#import +#import +#import +#import + +#define _node (_shouldInvertStrongReference ? _weakNode : _strongNode) + +@implementation ASNodeController +{ + ASDisplayNode *_strongNode; + __weak ASDisplayNode *_weakNode; +} + +- (void)loadNode +{ + self.node = [[ASDisplayNode alloc] init]; +} + +- (ASDisplayNode *)node +{ + if (_node == nil) { + [self loadNode]; + } + return _node; +} + +- (void)setupReferencesWithNode:(ASDisplayNode *)node +{ + if (_shouldInvertStrongReference) { + // The node should own the controller; weak reference from controller to node. + _weakNode = node; + _strongNode = nil; + } else { + // The controller should own the node; weak reference from node to controller. + _strongNode = node; + _weakNode = nil; + } + + [node __setNodeController:self]; + [node addInterfaceStateDelegate:self]; +} + +- (void)setNode:(ASDisplayNode *)node +{ + [self setupReferencesWithNode:node]; +} + +- (void)setShouldInvertStrongReference:(BOOL)shouldInvertStrongReference +{ + if (_shouldInvertStrongReference != shouldInvertStrongReference) { + // Because the BOOL controls which ivar we access, get the node before toggling. + ASDisplayNode *node = _node; + _shouldInvertStrongReference = shouldInvertStrongReference; + [self setupReferencesWithNode:node]; + } +} + +// subclass overrides +- (void)nodeDidLoad {} +- (void)nodeDidLayout {} + +- (void)didEnterVisibleState {} +- (void)didExitVisibleState {} + +- (void)didEnterDisplayState {} +- (void)didExitDisplayState {} + +- (void)didEnterPreloadState {} +- (void)didExitPreloadState {} + +- (void)interfaceStateDidChange:(ASInterfaceState)newState + fromState:(ASInterfaceState)oldState {} + +- (void)hierarchyDisplayDidFinish {} + +@end + +@implementation ASDisplayNode (ASNodeController) + +- (ASNodeController *)nodeController { + return _weakNodeController ?: _strongNodeController; +} + +@end diff --git a/Source/ASPagerFlowLayout.h b/Source/ASPagerFlowLayout.h index 69362b559b..8b2f7e2684 100644 --- a/Source/ASPagerFlowLayout.h +++ b/Source/ASPagerFlowLayout.h @@ -2,17 +2,9 @@ // ASPagerFlowLayout.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK diff --git a/Source/ASPagerFlowLayout.m b/Source/ASPagerFlowLayout.m index a2f06bee72..4b24a9e39e 100644 --- a/Source/ASPagerFlowLayout.m +++ b/Source/ASPagerFlowLayout.m @@ -2,17 +2,9 @@ // ASPagerFlowLayout.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK diff --git a/Source/ASPagerNode+Beta.h b/Source/ASPagerNode+Beta.h index 0df52aae4a..c4de4f45de 100644 --- a/Source/ASPagerNode+Beta.h +++ b/Source/ASPagerNode+Beta.h @@ -2,12 +2,8 @@ // ASPagerNode+Beta.h // Texture // -// Copyright (c) 2017-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK diff --git a/Source/ASPagerNode.h b/Source/ASPagerNode.h index b92d186ab0..b20f187f67 100644 --- a/Source/ASPagerNode.h +++ b/Source/ASPagerNode.h @@ -2,17 +2,9 @@ // ASPagerNode.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK diff --git a/Source/ASPagerNode.m b/Source/ASPagerNode.m index b4b5861edc..2ab57973d7 100644 --- a/Source/ASPagerNode.m +++ b/Source/ASPagerNode.m @@ -2,17 +2,9 @@ // ASPagerNode.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK diff --git a/Source/ASRangeManagingNode.h b/Source/ASRangeManagingNode.h index 2716efbe4f..c331a77bee 100644 --- a/Source/ASRangeManagingNode.h +++ b/Source/ASRangeManagingNode.h @@ -2,12 +2,8 @@ // ASRangeManagingNode.h // Texture // -// Copyright (c) 2017-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/ASRunLoopQueue.h b/Source/ASRunLoopQueue.h index 84f557438f..5cb6d2f7a7 100644 --- a/Source/ASRunLoopQueue.h +++ b/Source/ASRunLoopQueue.h @@ -2,17 +2,9 @@ // ASRunLoopQueue.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/ASRunLoopQueue.mm b/Source/ASRunLoopQueue.mm index 1ac258b2b9..0463c6221b 100644 --- a/Source/ASRunLoopQueue.mm +++ b/Source/ASRunLoopQueue.mm @@ -2,17 +2,9 @@ // ASRunLoopQueue.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import @@ -39,172 +31,21 @@ static void runLoopSourceCallback(void *info) { #pragma mark - ASDeallocQueue -@interface ASDeallocQueueV1 : ASDeallocQueue -@end -@interface ASDeallocQueueV2 : ASDeallocQueue -@end - -@implementation ASDeallocQueue +@implementation ASDeallocQueue { + std::vector _queue; + ASDN::Mutex _lock; +} + (ASDeallocQueue *)sharedDeallocationQueue NS_RETURNS_RETAINED { static ASDeallocQueue *deallocQueue = nil; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ - if (ASActivateExperimentalFeature(ASExperimentalDeallocQueue)) { - deallocQueue = [[ASDeallocQueueV2 alloc] init]; - } else { - deallocQueue = [[ASDeallocQueueV1 alloc] init]; - } + deallocQueue = [[ASDeallocQueue alloc] init]; }); return deallocQueue; } -- (void)releaseObjectInBackground:(id _Nullable __strong *)objectPtr -{ - ASDisplayNodeFailAssert(@"Abstract method."); -} - -@end - -@implementation ASDeallocQueueV1 { - NSThread *_thread; - NSCondition *_condition; - std::deque _queue; - ASDN::RecursiveMutex _queueLock; -} - -- (void)releaseObjectInBackground:(id _Nullable __strong *)objectPtr -{ - if (objectPtr != NULL && *objectPtr != nil) { - ASDN::MutexLocker l(_queueLock); - _queue.push_back(*objectPtr); - *objectPtr = nil; - } -} - -- (void)threadMain -{ - @autoreleasepool { - __unsafe_unretained __typeof__(self) weakSelf = self; - // 100ms timer. No resources are wasted in between, as the thread sleeps, and each check is fast. - // This time is fast enough for most use cases without excessive churn. - CFRunLoopTimerRef timer = CFRunLoopTimerCreateWithHandler(NULL, -1, 0.1, 0, 0, ^(CFRunLoopTimerRef timer) { - weakSelf->_queueLock.lock(); - if (weakSelf->_queue.size() == 0) { - weakSelf->_queueLock.unlock(); - return; - } - // The scope below is entered while already locked. @autorelease is crucial here; see PR 2890. - NSInteger count; - @autoreleasepool { -#if ASRunLoopQueueLoggingEnabled - NSLog(@"ASDeallocQueue Processing: %lu objects destroyed", weakSelf->_queue.size()); -#endif - // Sometimes we release 10,000 objects at a time. Don't hold the lock while releasing. - std::deque currentQueue = weakSelf->_queue; - count = currentQueue.size(); - ASSignpostStartCustom(ASSignpostDeallocQueueDrain, self, count); - weakSelf->_queue = std::deque(); - weakSelf->_queueLock.unlock(); - currentQueue.clear(); - } - ASSignpostEndCustom(ASSignpostDeallocQueueDrain, self, count, ASSignpostColorDefault); - }); - - CFRunLoopRef runloop = CFRunLoopGetCurrent(); - CFRunLoopAddTimer(runloop, timer, kCFRunLoopCommonModes); - - [_condition lock]; - [_condition signal]; - // At this moment, -init is signalled that the thread is guaranteed to be finished starting. - [_condition unlock]; - - // Keep processing events until the runloop is stopped. - CFRunLoopRun(); - - CFRunLoopTimerInvalidate(timer); - CFRunLoopRemoveTimer(runloop, timer, kCFRunLoopCommonModes); - CFRelease(timer); - - [_condition lock]; - [_condition signal]; - // At this moment, -stop is signalled that the thread is guaranteed to be finished exiting. - [_condition unlock]; - } -} - -- (instancetype)init -{ - if ((self = [super init])) { - _condition = [[NSCondition alloc] init]; - - _thread = [[NSThread alloc] initWithTarget:self selector:@selector(threadMain) object:nil]; - _thread.name = @"ASDeallocQueue"; - - // Use condition to ensure NSThread has finished starting. - [_condition lock]; - [_thread start]; - [_condition wait]; - [_condition unlock]; - } - return self; -} - -- (void)stop -{ - if (!_thread) { - return; - } - - [_condition lock]; - [self performSelector:@selector(_stop) onThread:_thread withObject:nil waitUntilDone:NO]; - [_condition wait]; - // At this moment, the thread is guaranteed to be finished running. - [_condition unlock]; - _thread = nil; -} - -- (void)drain -{ - [self performSelector:@selector(_drain) onThread:_thread withObject:nil waitUntilDone:YES]; -} - -- (void)_drain -{ - while (true) { - @autoreleasepool { - _queueLock.lock(); - std::deque currentQueue = _queue; - _queue = std::deque(); - _queueLock.unlock(); - - if (currentQueue.empty()) { - return; - } else { - currentQueue.clear(); - } - } - } -} - -- (void)_stop -{ - CFRunLoopStop(CFRunLoopGetCurrent()); -} - -- (void)dealloc -{ - [self stop]; -} - -@end - -@implementation ASDeallocQueueV2 { - std::vector _queue; - ASDN::Mutex _lock; -} - - (void)dealloc { ASDisplayNodeFailAssert(@"Singleton should not dealloc."); @@ -215,13 +56,13 @@ static void runLoopSourceCallback(void *info) { NSParameterAssert(objectPtr != NULL); // Cast to CFType so we can manipulate retain count manually. - auto cfPtr = (CFTypeRef *)(void *)objectPtr; + let cfPtr = (CFTypeRef *)(void *)objectPtr; if (!cfPtr || !*cfPtr) { return; } _lock.lock(); - auto isFirstEntry = _queue.empty(); + let isFirstEntry = _queue.empty(); // Push the pointer into our queue and clear their pointer. // This "steals" the +1 from ARC and nils their pointer so they can't // access or release the object. @@ -239,9 +80,9 @@ static void runLoopSourceCallback(void *info) { - (void)drain { _lock.lock(); - auto q = std::move(_queue); + let q = std::move(_queue); _lock.unlock(); - for (auto ref : q) { + for (let ref : q) { // NOTE: Could check that retain count is 1 and retry later if not. CFRelease(ref); } @@ -249,85 +90,18 @@ static void runLoopSourceCallback(void *info) { @end -#if AS_KDEBUG_ENABLE -/** - * This is real, private CA API. Valid as of iOS 10. - */ -typedef enum { - kCATransactionPhasePreLayout, - kCATransactionPhasePreCommit, - kCATransactionPhasePostCommit, -} CATransactionPhase; - -@interface CATransaction (Private) -+ (void)addCommitHandler:(void(^)(void))block forPhase:(CATransactionPhase)phase; -+ (int)currentState; -@end -#endif - -#pragma mark - ASAbstractRunLoopQueue - -@interface ASAbstractRunLoopQueue (Private) -+ (void)load; -+ (void)registerCATransactionObservers; -@end - @implementation ASAbstractRunLoopQueue - (instancetype)init { - if (self != [super init]) { + self = [super init]; + if (self == nil) { return nil; } ASDisplayNodeAssert(self.class != [ASAbstractRunLoopQueue class], @"Should never create instances of abstract class ASAbstractRunLoopQueue."); return self; } -#if AS_KDEBUG_ENABLE -+ (void)load -{ - [self registerCATransactionObservers]; -} - -+ (void)registerCATransactionObservers -{ - static BOOL privateCAMethodsExist; - static dispatch_block_t preLayoutHandler; - static dispatch_block_t preCommitHandler; - static dispatch_block_t postCommitHandler; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - privateCAMethodsExist = [CATransaction respondsToSelector:@selector(addCommitHandler:forPhase:)]; - privateCAMethodsExist &= [CATransaction respondsToSelector:@selector(currentState)]; - if (!privateCAMethodsExist) { - NSLog(@"Private CA methods are gone."); - } - preLayoutHandler = ^{ - ASSignpostStartCustom(ASSignpostCATransactionLayout, 0, [CATransaction currentState]); - }; - preCommitHandler = ^{ - int state = [CATransaction currentState]; - ASSignpostEndCustom(ASSignpostCATransactionLayout, 0, state, ASSignpostColorDefault); - ASSignpostStartCustom(ASSignpostCATransactionCommit, 0, state); - }; - postCommitHandler = ^{ - ASSignpostEndCustom(ASSignpostCATransactionCommit, 0, [CATransaction currentState], ASSignpostColorDefault); - // Can't add new observers inside an observer. rdar://problem/31253952 - dispatch_async(dispatch_get_main_queue(), ^{ - [self registerCATransactionObservers]; - }); - }; - }); - - if (privateCAMethodsExist) { - [CATransaction addCommitHandler:preLayoutHandler forPhase:kCATransactionPhasePreLayout]; - [CATransaction addCommitHandler:preCommitHandler forPhase:kCATransactionPhasePreCommit]; - [CATransaction addCommitHandler:postCommitHandler forPhase:kCATransactionPhasePostCommit]; - } -} - -#endif // AS_KDEBUG_ENABLE - @end #pragma mark - ASRunLoopQueue @@ -482,11 +256,11 @@ typedef enum { } // itemsToProcess will be empty if _queueConsumer == nil so no need to check again. - auto count = itemsToProcess.size(); + let count = itemsToProcess.size(); if (count > 0) { as_activity_scope_verbose(as_activity_create("Process run loop queue batch", _rootActivity, OS_ACTIVITY_FLAG_DEFAULT)); - auto itemsEnd = itemsToProcess.cend(); - for (auto iterator = itemsToProcess.begin(); iterator < itemsEnd; iterator++) { + let itemsEnd = itemsToProcess.cend(); + for (var iterator = itemsToProcess.begin(); iterator < itemsEnd; iterator++) { __unsafe_unretained id value = *iterator; _queueConsumer(value, isQueueDrained && iterator == itemsEnd - 1); as_log_verbose(ASDisplayLog(), "processed %@", value); @@ -705,11 +479,11 @@ static int const kASASCATransactionQueuePostOrder = 3000000; } // itemsToProcess will be empty if _queueConsumer == nil so no need to check again. - auto count = itemsToProcess.size(); + let count = itemsToProcess.size(); if (count > 0) { as_activity_scope_verbose(as_activity_create("Process run loop queue batch", _rootActivity, OS_ACTIVITY_FLAG_DEFAULT)); - auto itemsEnd = itemsToProcess.cend(); - for (auto iterator = itemsToProcess.begin(); iterator < itemsEnd; iterator++) { + let itemsEnd = itemsToProcess.cend(); + for (var iterator = itemsToProcess.begin(); iterator < itemsEnd; iterator++) { __unsafe_unretained id value = *iterator; [value prepareForCATransactionCommit]; as_log_verbose(ASDisplayLog(), "processed %@", value); diff --git a/Source/ASScrollNode.h b/Source/ASScrollNode.h index 972bbb425f..1137e89ede 100644 --- a/Source/ASScrollNode.h +++ b/Source/ASScrollNode.h @@ -2,17 +2,9 @@ // ASScrollNode.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/ASScrollNode.mm b/Source/ASScrollNode.mm index a7458f19df..c155b4749b 100644 --- a/Source/ASScrollNode.mm +++ b/Source/ASScrollNode.mm @@ -2,17 +2,9 @@ // ASScrollNode.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/ASSectionController.h b/Source/ASSectionController.h index 82558a42c5..5710d5a2b1 100644 --- a/Source/ASSectionController.h +++ b/Source/ASSectionController.h @@ -2,17 +2,9 @@ // ASSectionController.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK diff --git a/Source/ASSupplementaryNodeSource.h b/Source/ASSupplementaryNodeSource.h index 5cacdf6158..53a5af4ac3 100644 --- a/Source/ASSupplementaryNodeSource.h +++ b/Source/ASSupplementaryNodeSource.h @@ -2,17 +2,9 @@ // ASSupplementaryNodeSource.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK diff --git a/Source/ASTabBarController.h b/Source/ASTabBarController.h index dbc05a8215..7479f7ac85 100644 --- a/Source/ASTabBarController.h +++ b/Source/ASTabBarController.h @@ -2,17 +2,9 @@ // ASTabBarController.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK diff --git a/Source/ASTabBarController.m b/Source/ASTabBarController.m index 424beba5be..e04055ba81 100644 --- a/Source/ASTabBarController.m +++ b/Source/ASTabBarController.m @@ -2,17 +2,9 @@ // ASTabBarController.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK diff --git a/Source/ASTableNode+Beta.h b/Source/ASTableNode+Beta.h index c2b27fa971..6d580bdc43 100644 --- a/Source/ASTableNode+Beta.h +++ b/Source/ASTableNode+Beta.h @@ -2,12 +2,8 @@ // ASTableNode+Beta.h // Texture // -// Copyright (c) 2017-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/ASTableNode.h b/Source/ASTableNode.h index 7d9913ca23..397ccb4786 100644 --- a/Source/ASTableNode.h +++ b/Source/ASTableNode.h @@ -2,17 +2,9 @@ // ASTableNode.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK #import @@ -39,8 +31,8 @@ NS_ASSUME_NONNULL_BEGIN @property (readonly) ASTableView *view; // These properties can be set without triggering the view to be created, so it's fine to set them in -init. -@property (nullable, weak, nonatomic) id delegate; -@property (nullable, weak, nonatomic) id dataSource; +@property (nonatomic, weak) id delegate; +@property (nonatomic, weak) id dataSource; /** * The number of screens left to scroll before the delegate -tableNode:beginBatchFetchingWithContext: is called. diff --git a/Source/ASTableNode.mm b/Source/ASTableNode.mm index 74a79e7d02..c17086c744 100644 --- a/Source/ASTableNode.mm +++ b/Source/ASTableNode.mm @@ -2,17 +2,9 @@ // ASTableNode.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK @@ -34,9 +26,12 @@ #pragma mark - _ASTablePendingState -@interface _ASTablePendingState : NSObject -@property (weak, nonatomic) id delegate; -@property (weak, nonatomic) id dataSource; +@interface _ASTablePendingState : NSObject { +@public + std::vector> _tuningParameters; +} +@property (nonatomic, weak) id delegate; +@property (nonatomic, weak) id dataSource; @property (nonatomic) ASLayoutRangeMode rangeMode; @property (nonatomic) BOOL allowsSelection; @property (nonatomic) BOOL allowsSelectionDuringEditing; @@ -48,14 +43,19 @@ @property (nonatomic) CGPoint contentOffset; @property (nonatomic) BOOL animatesContentOffset; @property (nonatomic) BOOL automaticallyAdjustsContentOffset; + @end @implementation _ASTablePendingState + +#pragma mark - Lifecycle + - (instancetype)init { self = [super init]; if (self) { _rangeMode = ASLayoutRangeModeUnspecified; + _tuningParameters = std::vector> (ASLayoutRangeModeCount, std::vector (ASLayoutRangeTypeCount, ASRangeTuningParametersZero)); _allowsSelection = YES; _allowsSelectionDuringEditing = NO; _allowsMultipleSelection = NO; @@ -70,6 +70,30 @@ return self; } +#pragma mark Tuning Parameters + +- (ASRangeTuningParameters)tuningParametersForRangeType:(ASLayoutRangeType)rangeType +{ + return [self tuningParametersForRangeMode:ASLayoutRangeModeFull rangeType:rangeType]; +} + +- (void)setTuningParameters:(ASRangeTuningParameters)tuningParameters forRangeType:(ASLayoutRangeType)rangeType +{ + return [self setTuningParameters:tuningParameters forRangeMode:ASLayoutRangeModeFull rangeType:rangeType]; +} + +- (ASRangeTuningParameters)tuningParametersForRangeMode:(ASLayoutRangeMode)rangeMode rangeType:(ASLayoutRangeType)rangeType +{ + ASDisplayNodeAssert(rangeMode < _tuningParameters.size() && rangeType < _tuningParameters[rangeMode].size(), @"Requesting a range that is OOB for the configured tuning parameters"); + return _tuningParameters[rangeMode][rangeType]; +} + +- (void)setTuningParameters:(ASRangeTuningParameters)tuningParameters forRangeMode:(ASLayoutRangeMode)rangeMode rangeType:(ASLayoutRangeType)rangeType +{ + ASDisplayNodeAssert(rangeMode < _tuningParameters.size() && rangeType < _tuningParameters[rangeMode].size(), @"Setting a range that is OOB for the configured tuning parameters"); + _tuningParameters[rangeMode][rangeType] = tuningParameters; +} + @end #pragma mark - ASTableView @@ -81,6 +105,7 @@ } @property (nonatomic) _ASTablePendingState *pendingState; +@property (nonatomic, weak) ASRangeController *rangeController; @end @implementation ASTableNode @@ -125,9 +150,11 @@ ASTableView *view = self.view; view.tableNode = self; + + _rangeController = view.rangeController; if (_pendingState) { - _ASTablePendingState *pendingState = _pendingState; + _ASTablePendingState *pendingState = _pendingState; view.asyncDelegate = pendingState.delegate; view.asyncDataSource = pendingState.dataSource; view.inverted = pendingState.inverted; @@ -138,8 +165,23 @@ view.contentInset = pendingState.contentInset; self.pendingState = nil; + let tuningParametersVector = pendingState->_tuningParameters; + let tuningParametersVectorSize = tuningParametersVector.size(); + for (NSInteger rangeMode = 0; rangeMode < tuningParametersVectorSize; rangeMode++) { + let tuningparametersRangeModeVector = tuningParametersVector[rangeMode]; + let tuningParametersVectorRangeModeSize = tuningparametersRangeModeVector.size(); + for (NSInteger rangeType = 0; rangeType < tuningParametersVectorRangeModeSize; rangeType++) { + ASRangeTuningParameters tuningParameters = tuningparametersRangeModeVector[rangeType]; + if (!ASRangeTuningParametersEqualToRangeTuningParameters(tuningParameters, ASRangeTuningParametersZero)) { + [_rangeController setTuningParameters:tuningParameters + forRangeMode:(ASLayoutRangeMode)rangeMode + rangeType:(ASLayoutRangeType)rangeType]; + } + } + } + if (pendingState.rangeMode != ASLayoutRangeModeUnspecified) { - [view.rangeController updateCurrentRangeWithMode:pendingState.rangeMode]; + [_rangeController updateCurrentRangeWithMode:pendingState.rangeMode]; } [view setContentOffset:pendingState.contentOffset animated:pendingState.animatesContentOffset]; @@ -168,7 +210,7 @@ [super didEnterPreloadState]; // Intentionally allocate the view here and trigger a layout pass on it, which in turn will trigger the intial data load. // We can get rid of this call later when ASDataController, ASRangeController and ASCollectionLayout can operate without the view. - [[self view] layoutIfNeeded]; + [self.view layoutIfNeeded]; } #if ASRangeControllerLoggingEnabled @@ -199,12 +241,6 @@ return self.view.dataController; } -// TODO: Implement this without the view. -- (ASRangeController *)rangeController -{ - return self.view.rangeController; -} - - (_ASTablePendingState *)pendingState { if (!_pendingState && ![self isNodeLoaded]) { @@ -485,22 +521,30 @@ ASLayoutElementCollectionTableSetTraitCollection(_environmentStateLock) - (ASRangeTuningParameters)tuningParametersForRangeType:(ASLayoutRangeType)rangeType { - return [self.rangeController tuningParametersForRangeMode:ASLayoutRangeModeFull rangeType:rangeType]; + return [self tuningParametersForRangeMode:ASLayoutRangeModeFull rangeType:rangeType]; } - (void)setTuningParameters:(ASRangeTuningParameters)tuningParameters forRangeType:(ASLayoutRangeType)rangeType { - [self.rangeController setTuningParameters:tuningParameters forRangeMode:ASLayoutRangeModeFull rangeType:rangeType]; + [self setTuningParameters:tuningParameters forRangeMode:ASLayoutRangeModeFull rangeType:rangeType]; } - (ASRangeTuningParameters)tuningParametersForRangeMode:(ASLayoutRangeMode)rangeMode rangeType:(ASLayoutRangeType)rangeType { - return [self.rangeController tuningParametersForRangeMode:rangeMode rangeType:rangeType]; + if ([self pendingState]) { + return [_pendingState tuningParametersForRangeMode:rangeMode rangeType:rangeType]; + } else { + return [self.rangeController tuningParametersForRangeMode:rangeMode rangeType:rangeType]; + } } - (void)setTuningParameters:(ASRangeTuningParameters)tuningParameters forRangeMode:(ASLayoutRangeMode)rangeMode rangeType:(ASLayoutRangeType)rangeType { - return [self.rangeController setTuningParameters:tuningParameters forRangeMode:rangeMode rangeType:rangeType]; + if ([self pendingState]) { + [_pendingState setTuningParameters:tuningParameters forRangeMode:rangeMode rangeType:rangeType]; + } else { + return [self.rangeController setTuningParameters:tuningParameters forRangeMode:rangeMode rangeType:rangeType]; + } } #pragma mark - Selection @@ -686,7 +730,7 @@ ASLayoutElementCollectionTableSetTraitCollection(_environmentStateLock) [self.view relayoutItems]; } -- (void)performBatchAnimated:(BOOL)animated updates:(void (^)())updates completion:(void (^)(BOOL))completion +- (void)performBatchAnimated:(BOOL)animated updates:(NS_NOESCAPE void (^)())updates completion:(void (^)(BOOL))completion { ASDisplayNodeAssertMainThread(); if (self.nodeLoaded) { @@ -703,7 +747,7 @@ ASLayoutElementCollectionTableSetTraitCollection(_environmentStateLock) } } -- (void)performBatchUpdates:(void (^)())updates completion:(void (^)(BOOL))completion +- (void)performBatchUpdates:(NS_NOESCAPE void (^)())updates completion:(void (^)(BOOL))completion { [self performBatchAnimated:YES updates:updates completion:completion]; } diff --git a/Source/ASTableView.h b/Source/ASTableView.h index eb0d83cac9..3f627beb11 100644 --- a/Source/ASTableView.h +++ b/Source/ASTableView.h @@ -2,17 +2,9 @@ // ASTableView.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK diff --git a/Source/ASTableView.mm b/Source/ASTableView.mm index 708ef25514..81e0527dd7 100644 --- a/Source/ASTableView.mm +++ b/Source/ASTableView.mm @@ -2,17 +2,9 @@ // ASTableView.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK @@ -25,6 +17,8 @@ #import #import #import +#import +#import #import #import #import @@ -372,8 +366,10 @@ static NSString * const kCellReuseIdentifier = @"_ASTableViewCell"; // Sometimes the UIKit classes can call back to their delegate even during deallocation. _isDeallocating = YES; - [self setAsyncDelegate:nil]; - [self setAsyncDataSource:nil]; + if (!ASActivateExperimentalFeature(ASExperimentalCollectionTeardown)) { + [self setAsyncDelegate:nil]; + [self setAsyncDataSource:nil]; + } // Data controller & range controller may own a ton of nodes, let's deallocate those off-main ASPerformBackgroundDeallocation(&_dataController); @@ -673,7 +669,7 @@ static NSString * const kCellReuseIdentifier = @"_ASTableViewCell"; - (NSArray *)visibleNodes { - auto elements = [self visibleElementsForRangeController:_rangeController]; + let elements = [self visibleElementsForRangeController:_rangeController]; return ASArrayByFlatMapping(elements, ASCollectionElement *e, e.node); } @@ -759,7 +755,7 @@ static NSString * const kCellReuseIdentifier = @"_ASTableViewCell"; NSArray *nodes = [_cellsForLayoutUpdates allObjects]; [_cellsForLayoutUpdates removeAllObjects]; - auto nodesSizeChanged = [[NSMutableArray alloc] init]; + let nodesSizeChanged = [[NSMutableArray alloc] init]; [_dataController relayoutNodes:nodes nodesSizeChanged:nodesSizeChanged]; if (nodesSizeChanged.count > 0) { [self requeryNodeHeights]; diff --git a/Source/ASTableViewInternal.h b/Source/ASTableViewInternal.h index 9bbdb23815..b887e9323b 100644 --- a/Source/ASTableViewInternal.h +++ b/Source/ASTableViewInternal.h @@ -2,17 +2,9 @@ // ASTableViewInternal.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK diff --git a/Source/ASTableViewProtocols.h b/Source/ASTableViewProtocols.h index 0c0e679719..56de956724 100644 --- a/Source/ASTableViewProtocols.h +++ b/Source/ASTableViewProtocols.h @@ -2,17 +2,9 @@ // ASTableViewProtocols.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK diff --git a/Source/ASTextNode+Beta.h b/Source/ASTextNode+Beta.h index a0bbdbbcea..09259bd7f4 100644 --- a/Source/ASTextNode+Beta.h +++ b/Source/ASTextNode+Beta.h @@ -2,17 +2,9 @@ // ASTextNode+Beta.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/ASTextNode.h b/Source/ASTextNode.h index d1d1c734e2..b6c676a3a6 100644 --- a/Source/ASTextNode.h +++ b/Source/ASTextNode.h @@ -2,17 +2,9 @@ // ASTextNode.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/ASTextNode.mm b/Source/ASTextNode.mm index 428a19b2ce..1de1117dd9 100644 --- a/Source/ASTextNode.mm +++ b/Source/ASTextNode.mm @@ -2,17 +2,9 @@ // ASTextNode.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import @@ -26,9 +18,10 @@ #import #import #import +#import +#import #import #import -#import #import #import @@ -191,7 +184,12 @@ static ASTextKitRenderer *rendererForAttributes(ASTextKitAttributes attributes, NSAttributedString *_attributedText; NSAttributedString *_truncationAttributedText; + NSAttributedString *_additionalTruncationMessage; NSAttributedString *_composedTruncationText; + NSArray *_pointSizeScaleFactors; + NSLineBreakMode _truncationMode; + + NSUInteger _maximumNumberOfLines; NSString *_highlightedLinkAttributeName; id _highlightedLinkAttributeValue; @@ -338,17 +336,20 @@ static NSArray *DefaultLinkAttributeNames = @[ NSLinkAttributeName ]; - (ASTextKitRenderer *)_locked_renderer { + ASAssertLocked(__instanceLock__); return [self _locked_rendererWithBounds:[self _locked_threadSafeBounds]]; } - (ASTextKitRenderer *)_locked_rendererWithBounds:(CGRect)bounds { + ASAssertLocked(__instanceLock__); bounds = UIEdgeInsetsInsetRect(bounds, _textContainerInset); return rendererForAttributes([self _locked_rendererAttributes], bounds.size); } - (ASTextKitAttributes)_locked_rendererAttributes { + ASAssertLocked(__instanceLock__); return { .attributedString = _attributedText, .truncationAttributedString = [self _locked_composedTruncationText], @@ -500,7 +501,7 @@ static NSArray *DefaultLinkAttributeNames = @[ NSLinkAttributeName ]; textContainerInsets:_textContainerInset]; } -+ (void)drawRect:(CGRect)bounds withParameters:(id)parameters isCancelled:(asdisplaynode_iscancelled_block_t)isCancelledBlock isRasterizing:(BOOL)isRasterizing ++ (void)drawRect:(CGRect)bounds withParameters:(id)parameters isCancelled:(NS_NOESCAPE asdisplaynode_iscancelled_block_t)isCancelledBlock isRasterizing:(BOOL)isRasterizing { ASTextNodeDrawParameter *drawParameter = (ASTextNodeDrawParameter *)parameters; UIColor *backgroundColor = (isRasterizing || drawParameter == nil) ? nil : drawParameter->_backgroundColor; @@ -648,7 +649,7 @@ static NSArray *DefaultLinkAttributeNames = @[ NSLinkAttributeName ]; } // Ask our delegate if a long-press on an attribute is relevant - if ([_delegate respondsToSelector:@selector(textNode:shouldLongPressLinkAttribute:value:atPoint:)]) { + if ([self _pendingLinkTap] && [_delegate respondsToSelector:@selector(textNode:shouldLongPressLinkAttribute:value:atPoint:)]) { return [_delegate textNode:self shouldLongPressLinkAttribute:_highlightedLinkAttributeName value:_highlightedLinkAttributeValue @@ -854,7 +855,7 @@ static CGRect ASTextNodeAdjustRenderRectForShadowPadding(CGRect rendererRect, UI ASLockScopeSelf(); NSArray *rects = [[self _locked_renderer] rectsForTextRange:textRange measureOption:measureOption]; - auto adjustedRects = [[NSMutableArray alloc] init]; + let adjustedRects = [[NSMutableArray alloc] init]; for (NSValue *rectValue in rects) { CGRect rect = [rectValue CGRectValue]; @@ -1175,6 +1176,11 @@ static NSAttributedString *DefaultTruncationAttributedString() } } +- (NSAttributedString *)additionalTruncationMessage +{ + return ASLockedSelf(_additionalTruncationMessage); +} + - (void)setTruncationMode:(NSLineBreakMode)truncationMode { if (ASLockedSelfCompareAssign(_truncationMode, truncationMode)) { @@ -1182,18 +1188,28 @@ static NSAttributedString *DefaultTruncationAttributedString() } } +- (NSLineBreakMode)truncationMode +{ + return ASLockedSelf(_truncationMode); +} + - (BOOL)isTruncated { return ASLockedSelf([[self _locked_renderer] isTruncated]); } -- (void)setPointSizeScaleFactors:(NSArray *)pointSizeScaleFactors +- (void)setPointSizeScaleFactors:(NSArray *)pointSizeScaleFactors { if (ASLockedSelfCompareAssignCopy(_pointSizeScaleFactors, pointSizeScaleFactors)) { [self setNeedsDisplay]; } } +- (NSArray *)pointSizeScaleFactors +{ + return ASLockedSelf(_pointSizeScaleFactors); +} + - (void)setMaximumNumberOfLines:(NSUInteger)maximumNumberOfLines { if (ASLockedSelfCompareAssign(_maximumNumberOfLines, maximumNumberOfLines)) { @@ -1201,6 +1217,11 @@ static NSAttributedString *DefaultTruncationAttributedString() } } +- (NSUInteger)maximumNumberOfLines +{ + return ASLockedSelf(_maximumNumberOfLines); +} + - (NSUInteger)lineCount { return ASLockedSelf([[self _locked_renderer] lineCount]); @@ -1247,6 +1268,7 @@ static NSAttributedString *DefaultTruncationAttributedString() */ - (NSAttributedString *)_locked_composedTruncationText { + ASAssertLocked(__instanceLock__); if (_composedTruncationText == nil) { if (_truncationAttributedText != nil && _additionalTruncationMessage != nil) { NSMutableAttributedString *newComposedTruncationString = [[NSMutableAttributedString alloc] initWithAttributedString:_truncationAttributedText]; @@ -1272,6 +1294,7 @@ static NSAttributedString *DefaultTruncationAttributedString() */ - (NSAttributedString *)_locked_prepareTruncationStringForDrawing:(NSAttributedString *)truncationString { + ASAssertLocked(__instanceLock__); truncationString = ASCleanseAttributedStringOfCoreTextAttributes(truncationString); NSMutableAttributedString *truncationMutableString = [truncationString mutableCopy]; // Grab the attributes from the full string @@ -1283,7 +1306,7 @@ static NSAttributedString *DefaultTruncationAttributedString() NSDictionary *originalStringAttributes = [originalString attributesAtIndex:originalStringLength-1 effectiveRange:NULL]; [truncationString enumerateAttributesInRange:NSMakeRange(0, truncationString.length) options:0 usingBlock: ^(NSDictionary *attributes, NSRange range, BOOL *stop) { - NSMutableDictionary *futureTruncationAttributes = [NSMutableDictionary dictionaryWithDictionary:originalStringAttributes]; + NSMutableDictionary *futureTruncationAttributes = [originalStringAttributes mutableCopy]; [futureTruncationAttributes addEntriesFromDictionary:attributes]; [truncationMutableString setAttributes:futureTruncationAttributes range:range]; }]; @@ -1315,36 +1338,29 @@ static NSAttributedString *DefaultTruncationAttributedString() } #endif -+ (id)allocWithZone:(struct _NSZone *)zone +// All direct descendants of ASTextNode get their superclass replaced by ASTextNode2. ++ (void)initialize { - // If they're not experimenting, just forward. - if (!ASActivateExperimentalFeature(ASExperimentalTextNode)) { - return [super allocWithZone:zone]; - } - - // We are plain ASTextNode. Just swap in an ASTextNode2 instead. - if (self == [ASTextNode class]) { - return (ASTextNode *)[ASTextNode2 allocWithZone:zone]; - } - - // We are descended from ASTextNode. We need to change the superclass for the - // ASTextNode subclass to ASTextNode2. - // Walk up the class hierarchy until we find ASTextNode. - // Note: This may be called on multiple threads simultaneously. - Class s; - for (Class c = self; c != Nil && c != [ASTextNode class]; c = s) { - s = class_getSuperclass(c); - if (s == [ASTextNode class]) { + // Texture requires that node subclasses call [super initialize] + [super initialize]; + + if (class_getSuperclass(self) == [ASTextNode class] + && ASActivateExperimentalFeature(ASExperimentalTextNode)) { #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" - // Direct descendent. Update superclass of c and end. - class_setSuperclass(c, [ASTextNode2 class]); + class_setSuperclass(self, [ASTextNode2 class]); #pragma clang diagnostic pop - break; - } } +} - return [super allocWithZone:zone]; +// For direct allocations of ASTextNode itself, we override allocWithZone: ++ (id)allocWithZone:(struct _NSZone *)zone +{ + if (ASActivateExperimentalFeature(ASExperimentalTextNode)) { + return (ASTextNode *)[ASTextNode2 allocWithZone:zone]; + } else { + return [super allocWithZone:zone]; + } } @end diff --git a/Source/ASTextNode2.h b/Source/ASTextNode2.h index fcff5b60a7..7718672515 100644 --- a/Source/ASTextNode2.h +++ b/Source/ASTextNode2.h @@ -2,12 +2,8 @@ // ASTextNode2.h // Texture // -// Copyright (c) 2017-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/ASTextNode2.mm b/Source/ASTextNode2.mm index 53eec80293..aaa215e672 100644 --- a/Source/ASTextNode2.mm +++ b/Source/ASTextNode2.mm @@ -2,12 +2,8 @@ // ASTextNode2.mm // Texture // -// Copyright (c) 2017-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import @@ -19,8 +15,9 @@ #import #import #import -#import #import +#import +#import #import #import @@ -235,16 +232,12 @@ static NSArray *DefaultLinkAttributeNames = @[ NSLinkAttributeName ]; ASLockScopeSelf(); - ASTextContainer *container = [_textContainer copy]; - NSAttributedString *attributedText = self.attributedText; - container.size = constrainedSize; + _textContainer.size = constrainedSize; [self _ensureTruncationText]; - NSMutableAttributedString *mutableText = [attributedText mutableCopy]; + NSMutableAttributedString *mutableText = [_attributedText mutableCopy]; [self prepareAttributedString:mutableText]; - ASTextLayout *layout = [ASTextNode2 compatibleLayoutWithContainer:container text:mutableText]; - - [self setNeedsDisplay]; + ASTextLayout *layout = [ASTextNode2 compatibleLayoutWithContainer:_textContainer text:mutableText]; return layout.textBoundingSize; } @@ -346,7 +339,9 @@ static NSArray *DefaultLinkAttributeNames = @[ NSLinkAttributeName ]; if (_shadowOpacity > 0 && (_shadowRadius != 0 || !CGSizeEqualToSize(_shadowOffset, CGSizeZero)) && CGColorGetAlpha(_shadowColor) > 0) { NSShadow *shadow = [[NSShadow alloc] init]; if (_shadowOpacity != 1) { - shadow.shadowColor = [UIColor colorWithCGColor:CGColorCreateCopyWithAlpha(_shadowColor, _shadowOpacity * CGColorGetAlpha(_shadowColor))]; + CGColorRef shadowColorRef = CGColorCreateCopyWithAlpha(_shadowColor, _shadowOpacity * CGColorGetAlpha(_shadowColor)); + shadow.shadowColor = [UIColor colorWithCGColor:shadowColorRef]; + CGColorRelease(shadowColorRef); } else { shadow.shadowColor = [UIColor colorWithCGColor:_shadowColor]; } @@ -362,9 +357,12 @@ static NSArray *DefaultLinkAttributeNames = @[ NSLinkAttributeName ]; { ASLockScopeSelf(); [self _ensureTruncationText]; + + // Unlike layout, here we must copy the container since drawing is asynchronous. ASTextContainer *copiedContainer = [_textContainer copy]; copiedContainer.size = self.bounds.size; - NSMutableAttributedString *mutableText = [self.attributedText mutableCopy] ?: [[NSMutableAttributedString alloc] init]; + [copiedContainer makeImmutable]; + NSMutableAttributedString *mutableText = [_attributedText mutableCopy] ?: [[NSMutableAttributedString alloc] init]; [self prepareAttributedString:mutableText]; @@ -406,7 +404,7 @@ static NSArray *DefaultLinkAttributeNames = @[ NSLinkAttributeName ]; CGRect containerBounds = (CGRect){ .size = container.size }; { - for (auto &t : cacheValue->_layouts) { + for (let &t : cacheValue->_layouts) { CGSize constrainedSize = std::get<0>(t); ASTextLayout *layout = std::get<1>(t); @@ -467,7 +465,7 @@ static NSArray *DefaultLinkAttributeNames = @[ NSLinkAttributeName ]; return layout; } -+ (void)drawRect:(CGRect)bounds withParameters:(NSDictionary *)layoutDict isCancelled:(asdisplaynode_iscancelled_block_t)isCancelledBlock isRasterizing:(BOOL)isRasterizing ++ (void)drawRect:(CGRect)bounds withParameters:(NSDictionary *)layoutDict isCancelled:(NS_NOESCAPE asdisplaynode_iscancelled_block_t)isCancelledBlock isRasterizing:(BOOL)isRasterizing { ASTextContainer *container = layoutDict[@"container"]; NSAttributedString *text = layoutDict[@"text"]; @@ -530,7 +528,9 @@ static NSArray *DefaultLinkAttributeNames = @[ NSLinkAttributeName ]; // For now, assume that a tap inside this text, but outside the text range is a tap on the // truncation token. if (![layout textRangeAtPoint:point]) { - *inAdditionalTruncationMessageOut = YES; + if (inAdditionalTruncationMessageOut != NULL) { + *inAdditionalTruncationMessageOut = YES; + } return nil; } @@ -948,7 +948,7 @@ static NSArray *DefaultLinkAttributeNames = @[ NSLinkAttributeName ]; } } -- (NSArray *)pointSizeScaleFactors +- (NSArray *)pointSizeScaleFactors { return ASLockedSelf(_pointSizeScaleFactors); } @@ -1094,7 +1094,7 @@ static NSAttributedString *DefaultTruncationAttributedString() */ - (NSAttributedString *)_locked_composedTruncationText { - ASDisplayNodeAssertLockOwnedByCurrentThread(__instanceLock__); + ASAssertLocked(__instanceLock__); if (_composedTruncationText == nil) { if (_truncationAttributedText != nil && _additionalTruncationMessage != nil) { NSMutableAttributedString *newComposedTruncationString = [[NSMutableAttributedString alloc] initWithAttributedString:_truncationAttributedText]; @@ -1120,7 +1120,7 @@ static NSAttributedString *DefaultTruncationAttributedString() */ - (NSAttributedString *)_locked_prepareTruncationStringForDrawing:(NSAttributedString *)truncationString { - ASDisplayNodeAssertLockOwnedByCurrentThread(__instanceLock__); + ASAssertLocked(__instanceLock__); NSMutableAttributedString *truncationMutableString = [truncationString mutableCopy]; // Grab the attributes from the full string if (_attributedText.length > 0) { @@ -1131,7 +1131,7 @@ static NSAttributedString *DefaultTruncationAttributedString() NSDictionary *originalStringAttributes = [originalString attributesAtIndex:originalStringLength-1 effectiveRange:NULL]; [truncationString enumerateAttributesInRange:NSMakeRange(0, truncationString.length) options:0 usingBlock: ^(NSDictionary *attributes, NSRange range, BOOL *stop) { - NSMutableDictionary *futureTruncationAttributes = [NSMutableDictionary dictionaryWithDictionary:originalStringAttributes]; + NSMutableDictionary *futureTruncationAttributes = [originalStringAttributes mutableCopy]; [futureTruncationAttributes addEntriesFromDictionary:attributes]; [truncationMutableString setAttributes:futureTruncationAttributes range:range]; }]; diff --git a/Source/ASTextNodeCommon.h b/Source/ASTextNodeCommon.h index 0ff51b4021..c702561e63 100644 --- a/Source/ASTextNodeCommon.h +++ b/Source/ASTextNodeCommon.h @@ -2,12 +2,8 @@ // ASTextNodeCommon.h // Texture // -// Copyright (c) 2018-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/ASVideoNode.h b/Source/ASVideoNode.h index 3e7eae7e4c..e7dbcaa6ab 100644 --- a/Source/ASVideoNode.h +++ b/Source/ASVideoNode.h @@ -2,17 +2,9 @@ // ASVideoNode.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK diff --git a/Source/ASVideoNode.mm b/Source/ASVideoNode.mm index f72bd8deeb..de3ec563a4 100644 --- a/Source/ASVideoNode.mm +++ b/Source/ASVideoNode.mm @@ -2,17 +2,9 @@ // ASVideoNode.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK #import @@ -338,6 +330,7 @@ static NSString * const kRate = @"rate"; if (self.playerState != ASVideoNodePlayerStatePlaying) { self.playerState = ASVideoNodePlayerStateReadyToPlay; if (_shouldBePlaying && ASInterfaceStateIncludesVisible(self.interfaceState)) { + ASUnlockScope(self); [self play]; } } @@ -360,6 +353,8 @@ static NSString * const kRate = @"rate"; if (self.playerState == ASVideoNodePlayerStateLoading && _delegateFlags.delegateVideoNodeDidRecoverFromStall) { [self.delegate videoNodeDidRecoverFromStall:self]; } + + ASUnlockScope(self); [self play]; // autoresume after buffer catches up } } else if ([keyPath isEqualToString:kplaybackBufferEmpty]) { diff --git a/Source/ASVideoPlayerNode.h b/Source/ASVideoPlayerNode.h index 45c4b47d5d..2bee0d97c3 100644 --- a/Source/ASVideoPlayerNode.h +++ b/Source/ASVideoPlayerNode.h @@ -2,17 +2,9 @@ // ASVideoPlayerNode.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK diff --git a/Source/ASVideoPlayerNode.mm b/Source/ASVideoPlayerNode.mm index b8ce2507dd..6a6e385035 100644 --- a/Source/ASVideoPlayerNode.mm +++ b/Source/ASVideoPlayerNode.mm @@ -2,17 +2,9 @@ // ASVideoPlayerNode.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import @@ -27,6 +19,7 @@ #import #import #import +#import #import static void *ASVideoPlayerNodeContext = &ASVideoPlayerNodeContext; @@ -209,10 +202,8 @@ static void *ASVideoPlayerNodeContext = &ASVideoPlayerNodeContext; - (void)didLoad { [super didLoad]; - { - ASLockScopeSelf(); - [self createControls]; - } + + [self createControls]; } - (void)didEnterPreloadState @@ -284,15 +275,23 @@ static void *ASVideoPlayerNodeContext = &ASVideoPlayerNodeContext; if (_delegateFlags.delegateCustomControls && _delegateFlags.delegateLayoutSpecForControls) { NSDictionary *customControls = [_delegate videoPlayerNodeCustomControls:self]; + std::vector subnodes; for (id key in customControls) { id node = customControls[key]; if (![node isKindOfClass:[ASDisplayNode class]]) { continue; } - [self addSubnode:node]; + subnodes.push_back(node); [_cachedControls setObject:node forKey:key]; } + + { + ASUnlockScope(self); + for (var subnode : subnodes) { + [self addSubnode:subnode]; + } + } } } @@ -315,14 +314,21 @@ static void *ASVideoPlayerNodeContext = &ASVideoPlayerNodeContext; - (void)removeControls { - for (ASDisplayNode *node in [_cachedControls objectEnumerator]) { - [node removeFromSupernode]; + NSMutableDictionary *cachedControls = nil; + { + ASLockScope(self); + + // Grab the cached controls for removing it + cachedControls = [_cachedControls copy]; + [self _locked_cleanCachedControls]; } - [self cleanCachedControls]; + for (ASDisplayNode *node in [cachedControls objectEnumerator]) { + [node removeFromSupernode]; + } } -- (void)cleanCachedControls +- (void)_locked_cleanCachedControls { [_cachedControls removeAllObjects]; @@ -335,6 +341,8 @@ static void *ASVideoPlayerNodeContext = &ASVideoPlayerNodeContext; - (void)_locked_createPlaybackButton { + ASAssertLocked(__instanceLock__); + if (_playbackButtonNode == nil) { _playbackButtonNode = [[ASDefaultPlaybackButton alloc] init]; _playbackButtonNode.style.preferredSize = CGSizeMake(16.0, 22.0); @@ -353,11 +361,16 @@ static void *ASVideoPlayerNodeContext = &ASVideoPlayerNodeContext; [_cachedControls setObject:_playbackButtonNode forKey:@(ASVideoPlayerNodeControlTypePlaybackButton)]; } - [self addSubnode:_playbackButtonNode]; + { + ASUnlockScope(self); + [self addSubnode:_playbackButtonNode]; + } } - (void)_locked_createFullScreenButton { + ASAssertLocked(__instanceLock__); + if (_fullScreenButtonNode == nil) { _fullScreenButtonNode = [[ASButtonNode alloc] init]; _fullScreenButtonNode.style.preferredSize = CGSizeMake(16.0, 22.0); @@ -370,11 +383,16 @@ static void *ASVideoPlayerNodeContext = &ASVideoPlayerNodeContext; [_cachedControls setObject:_fullScreenButtonNode forKey:@(ASVideoPlayerNodeControlTypeFullScreenButton)]; } - [self addSubnode:_fullScreenButtonNode]; + { + ASUnlockScope(self); + [self addSubnode:_fullScreenButtonNode]; + } } - (void)_locked_createElapsedTextField { + ASAssertLocked(__instanceLock__); + if (_elapsedTextNode == nil) { _elapsedTextNode = [[ASTextNode alloc] init]; _elapsedTextNode.attributedText = [self timeLabelAttributedStringForString:@"00:00" @@ -383,11 +401,16 @@ static void *ASVideoPlayerNodeContext = &ASVideoPlayerNodeContext; [_cachedControls setObject:_elapsedTextNode forKey:@(ASVideoPlayerNodeControlTypeElapsedText)]; } - [self addSubnode:_elapsedTextNode]; + { + ASUnlockScope(self); + [self addSubnode:_elapsedTextNode]; + } } - (void)_locked_createDurationTextField { + ASAssertLocked(__instanceLock__); + if (_durationTextNode == nil) { _durationTextNode = [[ASTextNode alloc] init]; _durationTextNode.attributedText = [self timeLabelAttributedStringForString:@"00:00" @@ -397,11 +420,16 @@ static void *ASVideoPlayerNodeContext = &ASVideoPlayerNodeContext; [_cachedControls setObject:_durationTextNode forKey:@(ASVideoPlayerNodeControlTypeDurationText)]; } [self updateDurationTimeLabel]; - [self addSubnode:_durationTextNode]; + { + ASUnlockScope(self); + [self addSubnode:_durationTextNode]; + } } - (void)_locked_createScrubber { + ASAssertLocked(__instanceLock__); + if (_scrubberNode == nil) { __weak __typeof__(self) weakSelf = self; _scrubberNode = [[ASDisplayNode alloc] initWithViewBlock:^UIView * _Nonnull { @@ -440,12 +468,16 @@ static void *ASVideoPlayerNodeContext = &ASVideoPlayerNodeContext; [_cachedControls setObject:_scrubberNode forKey:@(ASVideoPlayerNodeControlTypeScrubber)]; } - - [self addSubnode:_scrubberNode]; + { + ASUnlockScope(self); + [self addSubnode:_scrubberNode]; + } } - (void)_locked_createControlFlexGrowSpacer { + ASAssertLocked(__instanceLock__); + if (_controlFlexGrowSpacerSpec == nil) { _controlFlexGrowSpacerSpec = [[ASStackLayoutSpec alloc] init]; _controlFlexGrowSpacerSpec.style.flexGrow = 1.0; @@ -611,7 +643,6 @@ static void *ASVideoPlayerNodeContext = &ASVideoPlayerNodeContext; ASLockScopeSelf(); if (!_spinnerNode) { - __weak __typeof__(self) weakSelf = self; _spinnerNode = [[ASDisplayNode alloc] initWithViewBlock:^UIView *{ __typeof__(self) strongSelf = weakSelf; @@ -630,24 +661,32 @@ static void *ASVideoPlayerNodeContext = &ASVideoPlayerNodeContext; return spinnnerView; }]; - _spinnerNode.style.preferredSize = CGSizeMake(44.0, 44.0); - - [self addSubnode:_spinnerNode]; - [self setNeedsLayout]; + + let spinnerNode = _spinnerNode; + { + ASUnlockScope(self); + [self addSubnode:spinnerNode]; + [self setNeedsLayout]; + } } [(UIActivityIndicatorView *)_spinnerNode.view startAnimating]; } - (void)removeSpinner { - ASLockScopeSelf(); - - if (!_spinnerNode) { - return; + ASDisplayNode *spinnerNode = nil; + { + ASLockScopeSelf(); + if (!_spinnerNode) { + return; + } + + spinnerNode = _spinnerNode; + _spinnerNode = nil; } - [_spinnerNode removeFromSupernode]; - _spinnerNode = nil; + + [spinnerNode removeFromSupernode]; } - (void)didTapPlaybackButton:(ASControlNode*)node diff --git a/Source/ASViewController.h b/Source/ASViewController.h index 87a0ddf3a9..18c1be5456 100644 --- a/Source/ASViewController.h +++ b/Source/ASViewController.h @@ -2,17 +2,9 @@ // ASViewController.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK @@ -46,7 +38,7 @@ typedef ASTraitCollection * _Nonnull (^ASDisplayTraitsForTraitWindowSizeBlock)(C * * @see ASVisibilityDepth */ -- (instancetype)initWithNode:(DisplayNodeType)node; +- (instancetype)initWithNode:(DisplayNodeType)node NS_DESIGNATED_INITIALIZER; NS_ASSUME_NONNULL_END diff --git a/Source/ASViewController.mm b/Source/ASViewController.mm index 8d9373edf4..f294c65175 100644 --- a/Source/ASViewController.mm +++ b/Source/ASViewController.mm @@ -2,17 +2,9 @@ // ASViewController.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK @@ -36,6 +28,9 @@ UIEdgeInsets _fallbackAdditionalSafeAreaInsets; } +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wobjc-designated-initializers" + - (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { if (!(self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) { @@ -58,6 +53,8 @@ return self; } +#pragma clang diagnostic pop + - (instancetype)initWithNode:(ASDisplayNode *)node { if (!(self = [super initWithNibName:nil bundle:nil])) { diff --git a/Source/ASVisibilityProtocols.h b/Source/ASVisibilityProtocols.h index 7f94bf6ae3..837e848269 100644 --- a/Source/ASVisibilityProtocols.h +++ b/Source/ASVisibilityProtocols.h @@ -2,17 +2,9 @@ // ASVisibilityProtocols.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/ASVisibilityProtocols.m b/Source/ASVisibilityProtocols.m index 4078793292..9ee52c433f 100644 --- a/Source/ASVisibilityProtocols.m +++ b/Source/ASVisibilityProtocols.m @@ -2,17 +2,9 @@ // ASVisibilityProtocols.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/AsyncDisplayKit+IGListKitMethods.h b/Source/AsyncDisplayKit+IGListKitMethods.h index 8c7002dca8..aa0de42510 100644 --- a/Source/AsyncDisplayKit+IGListKitMethods.h +++ b/Source/AsyncDisplayKit+IGListKitMethods.h @@ -2,17 +2,9 @@ // AsyncDisplayKit+IGListKitMethods.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/AsyncDisplayKit+IGListKitMethods.m b/Source/AsyncDisplayKit+IGListKitMethods.m index 186909729c..50d7a219f8 100644 --- a/Source/AsyncDisplayKit+IGListKitMethods.m +++ b/Source/AsyncDisplayKit+IGListKitMethods.m @@ -2,17 +2,9 @@ // AsyncDisplayKit+IGListKitMethods.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/AsyncDisplayKit.h b/Source/AsyncDisplayKit.h index 5093b204ef..c22327c2a1 100644 --- a/Source/AsyncDisplayKit.h +++ b/Source/AsyncDisplayKit.h @@ -2,17 +2,9 @@ // AsyncDisplayKit.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK @@ -100,6 +92,7 @@ #import #import #import +#import #import #import #import @@ -140,3 +133,4 @@ #import #import +#import diff --git a/Source/Base/ASAssert.h b/Source/Base/ASAssert.h index 863a52466d..e838c86dd1 100644 --- a/Source/Base/ASAssert.h +++ b/Source/Base/ASAssert.h @@ -2,17 +2,9 @@ // ASAssert.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #pragma once diff --git a/Source/Base/ASAssert.m b/Source/Base/ASAssert.m index 14a60255a6..73bee34ea9 100644 --- a/Source/Base/ASAssert.m +++ b/Source/Base/ASAssert.m @@ -2,37 +2,57 @@ // ASAssert.m // Texture // -// Copyright (c) 2017-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import +#import + +#if AS_TLS_AVAILABLE -#ifndef MINIMAL_ASDK static _Thread_local int tls_mainThreadAssertionsDisabledCount; -#endif - BOOL ASMainThreadAssertionsAreDisabled() { -#ifdef MINIMAL_ASDK - return false; -#else return tls_mainThreadAssertionsDisabledCount > 0; -#endif } void ASPushMainThreadAssertionsDisabled() { -#ifndef MINIMAL_ASDK tls_mainThreadAssertionsDisabledCount += 1; -#endif } void ASPopMainThreadAssertionsDisabled() { -#ifndef MINIMAL_ASDK tls_mainThreadAssertionsDisabledCount -= 1; ASDisplayNodeCAssert(tls_mainThreadAssertionsDisabledCount >= 0, @"Attempt to pop thread assertion-disabling without corresponding push."); -#endif } + +#else + +#import + +static pthread_key_t ASMainThreadAssertionsDisabledKey() { + static pthread_key_t k; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + pthread_key_create(&k, NULL); + }); + return k; +} + +BOOL ASMainThreadAssertionsAreDisabled() { + return (pthread_getspecific(ASMainThreadAssertionsDisabledKey()) > 0); +} + +void ASPushMainThreadAssertionsDisabled() { + let key = ASMainThreadAssertionsDisabledKey(); + let oldVal = pthread_getspecific(key); + pthread_setspecific(key, oldVal + 1); +} + +void ASPopMainThreadAssertionsDisabled() { + let key = ASMainThreadAssertionsDisabledKey(); + let oldVal = pthread_getspecific(key); + pthread_setspecific(key, oldVal - 1); + ASDisplayNodeCAssert(oldVal > 0, @"Attempt to pop thread assertion-disabling without corresponding push."); +} + +#endif // AS_TLS_AVAILABLE diff --git a/Source/Base/ASAvailability.h b/Source/Base/ASAvailability.h index c05ddd3fa6..88e9e3fbe0 100644 --- a/Source/Base/ASAvailability.h +++ b/Source/Base/ASAvailability.h @@ -2,23 +2,33 @@ // ASAvailability.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import #pragma once +#ifdef __i386__ + #define AS_TLS_AVAILABLE 0 +#else + #define AS_TLS_AVAILABLE 1 +#endif + +#ifndef AS_USE_PHOTOS +# define AS_USE_PHOTOS 0 +#endif + +#ifndef AS_USE_MAPKIT +# define AS_USE_MAPKIT 0 +#endif + +#ifndef AS_USE_ASSETS_LIBRARY +# define AS_USE_ASSETS_LIBRARY 0 +#endif + #ifndef kCFCoreFoundationVersionNumber_iOS_10_0 #define kCFCoreFoundationVersionNumber_iOS_10_0 1348.00 #endif diff --git a/Source/Base/ASBaseDefines.h b/Source/Base/ASBaseDefines.h old mode 100755 new mode 100644 index 4150b8aed2..959e15d839 --- a/Source/Base/ASBaseDefines.h +++ b/Source/Base/ASBaseDefines.h @@ -2,22 +2,23 @@ // ASBaseDefines.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // -#import +#import #define AS_EXTERN FOUNDATION_EXTERN +#define unowned __unsafe_unretained + +#if defined(__cplusplus) +# define var auto +# define let const auto +#else +# define var __auto_type +# define let const __auto_type +#endif #ifdef __GNUC__ # define ASDISPLAYNODE_GNUC(major, minor) \ @@ -213,13 +214,33 @@ /** * Create a new array by mapping `collection` over `work`, ignoring nil. */ -#define ASArrayByFlatMapping(collection, decl, work) ({ \ - NSMutableArray *a = [[NSMutableArray alloc] init]; \ - for (decl in collection) {\ - id result = work; \ - if (result != nil) { \ - [a addObject:result]; \ +#define ASArrayByFlatMapping(collectionArg, decl, work) ({ \ + id __collection = collectionArg; \ + NSArray *__result; \ + if (__collection) { \ + id __buf[[__collection count]]; \ + NSUInteger __i = 0; \ + for (decl in __collection) {\ + if ((__buf[__i] = work)) { \ + __i++; \ + } \ } \ + __result = [NSArray arrayByTransferring:__buf count:__i]; \ } \ - a; \ + __result; \ +}) + +/** + * Capture-and-clear a strong reference without the intervening retain/release pair. + * + * E.g. let localVar = ASTransferStrong(_myIvar); + * Post-condition: localVar has the strong value from _myIvar and _myIvar is nil. + * No retain/release is emitted when the optimizer is on. + */ +#define ASTransferStrong(lvalue) ({ \ + CFTypeRef *__rawPtr = (CFTypeRef *)(void *)(&(lvalue)); \ + CFTypeRef __cfValue = *__rawPtr; \ + *__rawPtr = NULL; \ + __typeof(lvalue) __result = (__bridge_transfer __typeof(lvalue))__cfValue; \ + __result; \ }) diff --git a/Source/Base/ASDisplayNode+Ancestry.h b/Source/Base/ASDisplayNode+Ancestry.h index 6c5815db88..2c61cee00c 100644 --- a/Source/Base/ASDisplayNode+Ancestry.h +++ b/Source/Base/ASDisplayNode+Ancestry.h @@ -2,17 +2,9 @@ // ASDisplayNode+Ancestry.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Base/ASDisplayNode+Ancestry.m b/Source/Base/ASDisplayNode+Ancestry.m index 566cc8bd33..33b53b18fc 100644 --- a/Source/Base/ASDisplayNode+Ancestry.m +++ b/Source/Base/ASDisplayNode+Ancestry.m @@ -2,17 +2,9 @@ // ASDisplayNode+Ancestry.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ASDisplayNode+Ancestry.h" diff --git a/Source/Base/ASEqualityHelpers.h b/Source/Base/ASEqualityHelpers.h index 9bdfb2edef..602459547b 100644 --- a/Source/Base/ASEqualityHelpers.h +++ b/Source/Base/ASEqualityHelpers.h @@ -2,17 +2,9 @@ // ASEqualityHelpers.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Base/ASLog.h b/Source/Base/ASLog.h index 99da08cc17..ccab4b8e58 100644 --- a/Source/Base/ASLog.h +++ b/Source/Base/ASLog.h @@ -2,17 +2,9 @@ // ASLog.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Base/ASLog.m b/Source/Base/ASLog.m index e1c42ea79d..8dcd8a8f34 100644 --- a/Source/Base/ASLog.m +++ b/Source/Base/ASLog.m @@ -2,12 +2,8 @@ // ASLog.m // Texture // -// Copyright (c) 2017-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Base/ASSignpost.h b/Source/Base/ASSignpost.h index fa2635003c..a841794417 100644 --- a/Source/Base/ASSignpost.h +++ b/Source/Base/ASSignpost.h @@ -2,12 +2,8 @@ // ASSignpost.h // Texture // -// Copyright (c) 2017-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // /// The signposts we use. Signposts are grouped by color. The SystemTrace.tracetemplate file diff --git a/Source/Debug/AsyncDisplayKit+Debug.h b/Source/Debug/AsyncDisplayKit+Debug.h index 235c2d0bd1..2f0826289a 100644 --- a/Source/Debug/AsyncDisplayKit+Debug.h +++ b/Source/Debug/AsyncDisplayKit+Debug.h @@ -2,17 +2,9 @@ // AsyncDisplayKit+Debug.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Debug/AsyncDisplayKit+Debug.m b/Source/Debug/AsyncDisplayKit+Debug.m index 992ad5d912..558439f904 100644 --- a/Source/Debug/AsyncDisplayKit+Debug.m +++ b/Source/Debug/AsyncDisplayKit+Debug.m @@ -2,17 +2,9 @@ // AsyncDisplayKit+Debug.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Debug/AsyncDisplayKit+Tips.h b/Source/Debug/AsyncDisplayKit+Tips.h index 33f5707a98..6232746a57 100644 --- a/Source/Debug/AsyncDisplayKit+Tips.h +++ b/Source/Debug/AsyncDisplayKit+Tips.h @@ -2,17 +2,9 @@ // AsyncDisplayKit+Tips.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Debug/AsyncDisplayKit+Tips.m b/Source/Debug/AsyncDisplayKit+Tips.m index 3b1f461a22..19a955b68c 100644 --- a/Source/Debug/AsyncDisplayKit+Tips.m +++ b/Source/Debug/AsyncDisplayKit+Tips.m @@ -2,17 +2,9 @@ // AsyncDisplayKit+Tips.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "AsyncDisplayKit+Tips.h" diff --git a/Source/Details/ASAbstractLayoutController.h b/Source/Details/ASAbstractLayoutController.h index c5ffc740e0..6de7801fb6 100644 --- a/Source/Details/ASAbstractLayoutController.h +++ b/Source/Details/ASAbstractLayoutController.h @@ -2,17 +2,9 @@ // ASAbstractLayoutController.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Details/ASAbstractLayoutController.mm b/Source/Details/ASAbstractLayoutController.mm index 391c381f2d..f63a3ca86c 100644 --- a/Source/Details/ASAbstractLayoutController.mm +++ b/Source/Details/ASAbstractLayoutController.mm @@ -2,17 +2,9 @@ // ASAbstractLayoutController.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Details/ASBasicImageDownloader.h b/Source/Details/ASBasicImageDownloader.h index d2cf3caa71..d5f8169745 100644 --- a/Source/Details/ASBasicImageDownloader.h +++ b/Source/Details/ASBasicImageDownloader.h @@ -2,17 +2,9 @@ // ASBasicImageDownloader.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK diff --git a/Source/Details/ASBasicImageDownloader.mm b/Source/Details/ASBasicImageDownloader.mm index 1a0c245746..156d7f9512 100644 --- a/Source/Details/ASBasicImageDownloader.mm +++ b/Source/Details/ASBasicImageDownloader.mm @@ -2,17 +2,9 @@ // ASBasicImageDownloader.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK #import @@ -245,7 +237,7 @@ static const char *kContextKey = NSStringFromClass(ASBasicImageDownloaderContext // cause significant performance issues. dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ // associate metadata with it - NSMutableDictionary *callbackData = [[NSMutableDictionary alloc] init]; + let callbackData = [[NSMutableDictionary alloc] init]; callbackData[kASBasicImageDownloaderContextCallbackQueue] = callbackQueue ? : dispatch_get_main_queue(); if (downloadProgress) { @@ -256,7 +248,7 @@ static const char *kContextKey = NSStringFromClass(ASBasicImageDownloaderContext callbackData[kASBasicImageDownloaderContextCompletionBlock] = [completion copy]; } - [context addCallbackData:[NSDictionary dictionaryWithDictionary:callbackData]]; + [context addCallbackData:[[NSDictionary alloc] initWithDictionary:callbackData]]; // Create new task if necessary NSURLSessionDownloadTask *task = (NSURLSessionDownloadTask *)[context createSessionTaskIfNecessaryWithBlock:^(){return [_session downloadTaskWithURL:URL];}]; diff --git a/Source/Details/ASBatchContext.h b/Source/Details/ASBatchContext.h index c4ba99911b..bbe92b8c34 100644 --- a/Source/Details/ASBatchContext.h +++ b/Source/Details/ASBatchContext.h @@ -2,17 +2,9 @@ // ASBatchContext.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK diff --git a/Source/Details/ASBatchContext.m b/Source/Details/ASBatchContext.m index cdb5caac19..9dbaff0a4f 100644 --- a/Source/Details/ASBatchContext.m +++ b/Source/Details/ASBatchContext.m @@ -2,17 +2,9 @@ // ASBatchContext.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK diff --git a/Source/Details/ASBatchFetchingDelegate.h b/Source/Details/ASBatchFetchingDelegate.h index 972a03b182..3b35115026 100644 --- a/Source/Details/ASBatchFetchingDelegate.h +++ b/Source/Details/ASBatchFetchingDelegate.h @@ -2,12 +2,8 @@ // ASBatchFetchingDelegate.h // Texture // -// Copyright (c) 2017-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Details/ASCollectionElement.h b/Source/Details/ASCollectionElement.h index 0e53a0a633..ea8fc697c4 100644 --- a/Source/Details/ASCollectionElement.h +++ b/Source/Details/ASCollectionElement.h @@ -2,17 +2,9 @@ // ASCollectionElement.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK diff --git a/Source/Details/ASCollectionElement.mm b/Source/Details/ASCollectionElement.mm index 7b24843708..5b7b33862b 100644 --- a/Source/Details/ASCollectionElement.mm +++ b/Source/Details/ASCollectionElement.mm @@ -2,17 +2,9 @@ // ASCollectionElement.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK diff --git a/Source/Details/ASCollectionFlowLayoutDelegate.h b/Source/Details/ASCollectionFlowLayoutDelegate.h index 82c4babd90..ba6e5b48ed 100644 --- a/Source/Details/ASCollectionFlowLayoutDelegate.h +++ b/Source/Details/ASCollectionFlowLayoutDelegate.h @@ -2,17 +2,9 @@ // ASCollectionFlowLayoutDelegate.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK diff --git a/Source/Details/ASCollectionFlowLayoutDelegate.m b/Source/Details/ASCollectionFlowLayoutDelegate.m index 5a0d9c02d8..3e3bbb5e44 100644 --- a/Source/Details/ASCollectionFlowLayoutDelegate.m +++ b/Source/Details/ASCollectionFlowLayoutDelegate.m @@ -2,17 +2,9 @@ // ASCollectionFlowLayoutDelegate.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK @@ -24,6 +16,7 @@ #import #import #import +#import #import #import #import @@ -61,7 +54,7 @@ + (ASCollectionLayoutState *)calculateLayoutWithContext:(ASCollectionLayoutContext *)context { ASElementMap *elements = context.elements; - NSMutableArray *children = ASArrayByFlatMapping(elements.itemElements, ASCollectionElement *element, element.node); + NSArray *children = ASArrayByFlatMapping(elements.itemElements, ASCollectionElement *element, element.node); if (children.count == 0) { return [[ASCollectionLayoutState alloc] initWithContext:context]; } diff --git a/Source/Details/ASCollectionGalleryLayoutDelegate.h b/Source/Details/ASCollectionGalleryLayoutDelegate.h index 0004db9f3e..c6d1df2cb7 100644 --- a/Source/Details/ASCollectionGalleryLayoutDelegate.h +++ b/Source/Details/ASCollectionGalleryLayoutDelegate.h @@ -2,12 +2,8 @@ // ASCollectionGalleryLayoutDelegate.h // Texture // -// Copyright (c) 2017-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK diff --git a/Source/Details/ASCollectionGalleryLayoutDelegate.mm b/Source/Details/ASCollectionGalleryLayoutDelegate.mm index bca291f0fa..94d1f0de36 100644 --- a/Source/Details/ASCollectionGalleryLayoutDelegate.mm +++ b/Source/Details/ASCollectionGalleryLayoutDelegate.mm @@ -2,12 +2,8 @@ // ASCollectionGalleryLayoutDelegate.mm // Texture // -// Copyright (c) 2017-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK @@ -19,6 +15,7 @@ #import #import #import +#import #import #import #import @@ -104,9 +101,9 @@ return [[ASCollectionLayoutState alloc] initWithContext:context]; } - NSMutableArray<_ASGalleryLayoutItem *> *children = ASArrayByFlatMapping(elements.itemElements, - ASCollectionElement *element, - [[_ASGalleryLayoutItem alloc] initWithItemSize:itemSize collectionElement:element]); + NSArray<_ASGalleryLayoutItem *> *children = ASArrayByFlatMapping(elements.itemElements, + ASCollectionElement *element, + [[_ASGalleryLayoutItem alloc] initWithItemSize:itemSize collectionElement:element]); if (children.count == 0) { return [[ASCollectionLayoutState alloc] initWithContext:context]; } diff --git a/Source/Details/ASCollectionInternal.h b/Source/Details/ASCollectionInternal.h index 8d687c1d13..90bd56273c 100644 --- a/Source/Details/ASCollectionInternal.h +++ b/Source/Details/ASCollectionInternal.h @@ -2,17 +2,9 @@ // ASCollectionInternal.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK diff --git a/Source/Details/ASCollectionInternal.m b/Source/Details/ASCollectionInternal.m index 5408f81d11..0d50fe3463 100644 --- a/Source/Details/ASCollectionInternal.m +++ b/Source/Details/ASCollectionInternal.m @@ -2,16 +2,8 @@ // ASCollectionInternal.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // diff --git a/Source/Details/ASCollectionLayoutContext.h b/Source/Details/ASCollectionLayoutContext.h index f5d0ef54a1..f5e875f561 100644 --- a/Source/Details/ASCollectionLayoutContext.h +++ b/Source/Details/ASCollectionLayoutContext.h @@ -2,17 +2,9 @@ // ASCollectionLayoutContext.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK diff --git a/Source/Details/ASCollectionLayoutContext.m b/Source/Details/ASCollectionLayoutContext.m index ad8b8177cf..4596f20b87 100644 --- a/Source/Details/ASCollectionLayoutContext.m +++ b/Source/Details/ASCollectionLayoutContext.m @@ -2,12 +2,8 @@ // ASCollectionLayoutContext.m // Texture // -// Copyright (c) 2017-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK diff --git a/Source/Details/ASCollectionLayoutDelegate.h b/Source/Details/ASCollectionLayoutDelegate.h index b18689ac2d..d92a8c0ab7 100644 --- a/Source/Details/ASCollectionLayoutDelegate.h +++ b/Source/Details/ASCollectionLayoutDelegate.h @@ -2,17 +2,9 @@ // ASCollectionLayoutDelegate.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK diff --git a/Source/Details/ASCollectionLayoutState.h b/Source/Details/ASCollectionLayoutState.h index 0ef8ca1778..461f4b1296 100644 --- a/Source/Details/ASCollectionLayoutState.h +++ b/Source/Details/ASCollectionLayoutState.h @@ -2,17 +2,9 @@ // ASCollectionLayoutState.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK diff --git a/Source/Details/ASCollectionLayoutState.mm b/Source/Details/ASCollectionLayoutState.mm index 32299645a7..351b51f243 100644 --- a/Source/Details/ASCollectionLayoutState.mm +++ b/Source/Details/ASCollectionLayoutState.mm @@ -2,12 +2,8 @@ // ASCollectionLayoutState.mm // Texture // -// Copyright (c) 2017-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK @@ -161,7 +157,7 @@ elementToLayoutAttributesTable:[NSMapTable elementToLayoutAttributesTable]]; } // Use a set here because some items may span multiple pages - auto result = [[NSMutableSet alloc] init]; + let result = [[NSMutableSet alloc] init]; for (id pagePtr in pages) { ASPageCoordinate page = (ASPageCoordinate)pagePtr; NSArray *allAttrs = [_pageToLayoutAttributesTable objectForPage:page]; diff --git a/Source/Details/ASCollectionViewLayoutController.h b/Source/Details/ASCollectionViewLayoutController.h index 178bfdba34..9441486b54 100644 --- a/Source/Details/ASCollectionViewLayoutController.h +++ b/Source/Details/ASCollectionViewLayoutController.h @@ -2,17 +2,9 @@ // ASCollectionViewLayoutController.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK diff --git a/Source/Details/ASCollectionViewLayoutController.m b/Source/Details/ASCollectionViewLayoutController.m index d132313d5c..100efce21a 100644 --- a/Source/Details/ASCollectionViewLayoutController.m +++ b/Source/Details/ASCollectionViewLayoutController.m @@ -2,17 +2,9 @@ // ASCollectionViewLayoutController.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK diff --git a/Source/Details/ASCollectionViewLayoutInspector.h b/Source/Details/ASCollectionViewLayoutInspector.h index d5f0d05d95..be812b68a3 100644 --- a/Source/Details/ASCollectionViewLayoutInspector.h +++ b/Source/Details/ASCollectionViewLayoutInspector.h @@ -2,17 +2,9 @@ // ASCollectionViewLayoutInspector.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK diff --git a/Source/Details/ASCollectionViewLayoutInspector.m b/Source/Details/ASCollectionViewLayoutInspector.m index a39c74fd52..22deff0f75 100644 --- a/Source/Details/ASCollectionViewLayoutInspector.m +++ b/Source/Details/ASCollectionViewLayoutInspector.m @@ -2,17 +2,9 @@ // ASCollectionViewLayoutInspector.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK #import diff --git a/Source/Details/ASDataController.h b/Source/Details/ASDataController.h index b9dd006eed..9fca4a209a 100644 --- a/Source/Details/ASDataController.h +++ b/Source/Details/ASDataController.h @@ -2,17 +2,9 @@ // ASDataController.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK diff --git a/Source/Details/ASDataController.mm b/Source/Details/ASDataController.mm index 3de6c238c9..80e2130e05 100644 --- a/Source/Details/ASDataController.mm +++ b/Source/Details/ASDataController.mm @@ -2,17 +2,9 @@ // ASDataController.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK @@ -151,14 +143,13 @@ typedef void (^ASDataControllerSynchronizationBlock)(); #pragma mark - Cell Layout -- (void)_allocateNodesFromElements:(NSArray *)elements completion:(ASDataControllerCompletionBlock)completionHandler +- (void)_allocateNodesFromElements:(NSArray *)elements { ASSERT_ON_EDITING_QUEUE; NSUInteger nodeCount = elements.count; __weak id weakDataSource = _dataSource; if (nodeCount == 0 || weakDataSource == nil) { - completionHandler(); return; } @@ -167,30 +158,23 @@ typedef void (^ASDataControllerSynchronizationBlock)(); { as_activity_create_for_scope("Data controller batch"); - dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); + // TODO: Should we use USER_INITIATED here since the user is probably waiting? + dispatch_queue_t queue = dispatch_get_global_queue(QOS_CLASS_DEFAULT, 0); ASDispatchApply(nodeCount, queue, 0, ^(size_t i) { - __strong id strongDataSource = weakDataSource; - if (strongDataSource == nil) { + if (!weakDataSource) { return; } - // Allocate the node. - ASCollectionElement *context = elements[i]; - ASCellNode *node = context.node; - if (node == nil) { - ASDisplayNodeAssertNotNil(node, @"Node block created nil node; %@, %@", self, strongDataSource); - node = [[ASCellNode alloc] init]; // Fallback to avoid crash for production apps. - } - + unowned ASCollectionElement *element = elements[i]; + unowned ASCellNode *node = element.node; // Layout the node if the size range is valid. - ASSizeRange sizeRange = context.constrainedSize; + ASSizeRange sizeRange = element.constrainedSize; if (ASSizeRangeHasSignificantArea(sizeRange)) { [self _layoutNode:node withConstrainedSize:sizeRange]; } }); } - completionHandler(); ASSignpostEndCustom(ASSignpostDataControllerBatch, self, 0, (weakDataSource != nil ? ASSignpostColorDefault : ASSignpostColorRed)); } @@ -216,7 +200,7 @@ typedef void (^ASDataControllerSynchronizationBlock)(); return @[]; } - auto indexPaths = [[NSMutableArray alloc] init]; + let indexPaths = [[NSMutableArray alloc] init]; if ([kind isEqualToString:ASDataControllerRowNodeKind]) { std::vector counts = [self itemCountsFromDataSource]; [sections enumerateRangesUsingBlock:^(NSRange range, BOOL * _Nonnull stop) { @@ -650,30 +634,11 @@ typedef void (^ASDataControllerSynchronizationBlock)(); __block __unused os_activity_scope_state_s preparationScope = {}; // unused if deployment target < iOS10 as_activity_scope_enter(as_activity_create("Prepare nodes for collection update", AS_ACTIVITY_CURRENT, OS_ACTIVITY_FLAG_DEFAULT), &preparationScope); - dispatch_block_t completion = ^() { - [_mainSerialQueue performBlockOnMainThread:^{ - as_activity_scope_leave(&preparationScope); - // Step 4: Inform the delegate - [_delegate dataController:self updateWithChangeSet:changeSet updates:^{ - // Step 5: Deploy the new data as "completed" - // - // Note that since the backing collection view might be busy responding to user events (e.g scrolling), - // it will not consume the batch update blocks immediately. - // As a result, in a short intermidate time, the view will still be relying on the old data source state. - // Thus, we can't just swap the new map immediately before step 4, but until this update block is executed. - // (https://github.com/TextureGroup/Texture/issues/378) - self.visibleMap = newMap; - }]; - }]; - --_editingTransactionGroupCount; - }; - // Step 3: Call the layout delegate if possible. Otherwise, allocate and layout all elements if (canDelegate) { [layoutDelegateClass calculateLayoutWithContext:layoutContext]; - completion(); } else { - auto elementsToProcess = [[NSMutableArray alloc] init]; + let elementsToProcess = [[NSMutableArray alloc] init]; for (ASCollectionElement *element in newMap) { ASCellNode *nodeIfAllocated = element.nodeIfAllocated; if (nodeIfAllocated.shouldUseUIKitCell) { @@ -684,8 +649,24 @@ typedef void (^ASDataControllerSynchronizationBlock)(); [elementsToProcess addObject:element]; } } - [self _allocateNodesFromElements:elementsToProcess completion:completion]; + [self _allocateNodesFromElements:elementsToProcess]; } + + // Step 4: Inform the delegate on main thread + [_mainSerialQueue performBlockOnMainThread:^{ + as_activity_scope_leave(&preparationScope); + [_delegate dataController:self updateWithChangeSet:changeSet updates:^{ + // Step 5: Deploy the new data as "completed" + // + // Note that since the backing collection view might be busy responding to user events (e.g scrolling), + // it will not consume the batch update blocks immediately. + // As a result, in a short intermidate time, the view will still be relying on the old data source state. + // Thus, we can't just swap the new map immediately before step 4, but until this update block is executed. + // (https://github.com/TextureGroup/Texture/issues/378) + self.visibleMap = newMap; + }]; + }]; + --_editingTransactionGroupCount; }); if (_usesSynchronousDataLoading) { @@ -829,10 +810,10 @@ typedef void (^ASDataControllerSynchronizationBlock)(); } id dataSource = self.dataSource; - auto visibleMap = self.visibleMap; - auto pendingMap = self.pendingMap; + let visibleMap = self.visibleMap; + let pendingMap = self.pendingMap; for (ASCellNode *node in nodes) { - auto element = node.collectionElement; + let element = node.collectionElement; NSIndexPath *indexPathInPendingMap = [pendingMap indexPathForElement:element]; // Ensure the element is present in both maps or skip it. If it's not in the visible map, // then we can't check the presented size. If it's not in the pending map, we can't get the constrained size. diff --git a/Source/Details/ASDelegateProxy.h b/Source/Details/ASDelegateProxy.h index 862598a647..7ed406b6db 100644 --- a/Source/Details/ASDelegateProxy.h +++ b/Source/Details/ASDelegateProxy.h @@ -2,17 +2,9 @@ // ASDelegateProxy.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import @@ -34,7 +26,7 @@ @interface ASDelegateProxy : NSProxy -- (instancetype)initWithTarget:(id )target interceptor:(id )interceptor; +- (instancetype)initWithTarget:(id)target interceptor:(id )interceptor; // This method must be overridden by a subclass. - (BOOL)interceptsSelector:(SEL)selector; diff --git a/Source/Details/ASDelegateProxy.m b/Source/Details/ASDelegateProxy.m index b8314153a6..ba60c23b6b 100644 --- a/Source/Details/ASDelegateProxy.m +++ b/Source/Details/ASDelegateProxy.m @@ -2,17 +2,9 @@ // ASDelegateProxy.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import @@ -141,16 +133,11 @@ @implementation ASDelegateProxy { id __weak _interceptor; - id __weak _target; + id __weak _target; } -- (instancetype)initWithTarget:(id )target interceptor:(id )interceptor +- (instancetype)initWithTarget:(id)target interceptor:(id )interceptor { - // -[NSProxy init] is undefined - if (!self) { - return nil; - } - ASDisplayNodeAssert(interceptor, @"interceptor must not be nil"); _target = target ? : [NSNull null]; @@ -161,8 +148,9 @@ - (BOOL)conformsToProtocol:(Protocol *)aProtocol { - if (_target) { - return [_target conformsToProtocol:aProtocol]; + id target = _target; + if (target) { + return [target conformsToProtocol:aProtocol]; } else { return [super conformsToProtocol:aProtocol]; } @@ -183,8 +171,9 @@ if ([self interceptsSelector:aSelector]) { return _interceptor; } else { - if (_target) { - return [_target respondsToSelector:aSelector] ? _target : nil; + id target = _target; + if (target) { + return [target respondsToSelector:aSelector] ? target : nil; } else { // The _interceptor needs to be nilled out in this scenario. For that a strong reference needs to be created // to be able to nil out the _interceptor but still let it know that the proxy target has deallocated diff --git a/Source/Details/ASElementMap.h b/Source/Details/ASElementMap.h index 50d0e4beac..1ea0ef58d4 100644 --- a/Source/Details/ASElementMap.h +++ b/Source/Details/ASElementMap.h @@ -2,17 +2,9 @@ // ASElementMap.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK diff --git a/Source/Details/ASElementMap.m b/Source/Details/ASElementMap.m index 395c8bec12..721ce3db29 100644 --- a/Source/Details/ASElementMap.m +++ b/Source/Details/ASElementMap.m @@ -2,17 +2,9 @@ // ASElementMap.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK @@ -246,7 +238,7 @@ NSInteger sectionCount = _sectionsOfItems.count; if (section >= sectionCount || section < 0) { if (assert) { - ASDisplayNodeFailAssert(@"Invalid section index %zd when there are only %zd sections!", section, sectionCount); + ASDisplayNodeFailAssert(@"Invalid section index %ld when there are only %ld sections!", (long)section, (long)sectionCount); } return NO; } else { @@ -274,7 +266,7 @@ NSInteger item = indexPath.item; if (item >= itemCount || item < 0) { if (assert) { - ASDisplayNodeFailAssert(@"Invalid item index %zd in section %zd which only has %zd items!", item, section, itemCount); + ASDisplayNodeFailAssert(@"Invalid item index %ld in section %ld which only has %ld items!", (long)item, (long)section, (long)itemCount); } return NO; } diff --git a/Source/Details/ASEventLog.h b/Source/Details/ASEventLog.h index 379ae53a72..9a147f259d 100644 --- a/Source/Details/ASEventLog.h +++ b/Source/Details/ASEventLog.h @@ -2,17 +2,9 @@ // ASEventLog.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Details/ASEventLog.mm b/Source/Details/ASEventLog.mm index 1389f93577..00bdbb5581 100644 --- a/Source/Details/ASEventLog.mm +++ b/Source/Details/ASEventLog.mm @@ -2,17 +2,9 @@ // ASEventLog.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Details/ASGraphicsContext.h b/Source/Details/ASGraphicsContext.h index 336ebbc469..d22d3806b0 100644 --- a/Source/Details/ASGraphicsContext.h +++ b/Source/Details/ASGraphicsContext.h @@ -2,12 +2,8 @@ // ASGraphicsContext.h // Texture // -// Copyright (c) 2018-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Details/ASGraphicsContext.m b/Source/Details/ASGraphicsContext.m index efe9658558..26255a58ae 100644 --- a/Source/Details/ASGraphicsContext.m +++ b/Source/Details/ASGraphicsContext.m @@ -2,12 +2,8 @@ // ASGraphicsContext.m // Texture // -// Copyright (c) 2018-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ASGraphicsContext.h" diff --git a/Source/Details/ASHashing.h b/Source/Details/ASHashing.h index 6177a74fe7..084d74078a 100644 --- a/Source/Details/ASHashing.h +++ b/Source/Details/ASHashing.h @@ -2,12 +2,8 @@ // ASHashing.h // Texture // -// Copyright (c) 2017-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Details/ASHashing.m b/Source/Details/ASHashing.m index 9f6d0f2349..2863e2dc58 100644 --- a/Source/Details/ASHashing.m +++ b/Source/Details/ASHashing.m @@ -2,12 +2,8 @@ // ASHashing.m // Texture // -// Copyright (c) 2017-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Details/ASHighlightOverlayLayer.h b/Source/Details/ASHighlightOverlayLayer.h index 2880abbd62..aff6694bf1 100644 --- a/Source/Details/ASHighlightOverlayLayer.h +++ b/Source/Details/ASHighlightOverlayLayer.h @@ -2,17 +2,9 @@ // ASHighlightOverlayLayer.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Details/ASHighlightOverlayLayer.mm b/Source/Details/ASHighlightOverlayLayer.mm index ac298308d2..03cf468165 100644 --- a/Source/Details/ASHighlightOverlayLayer.mm +++ b/Source/Details/ASHighlightOverlayLayer.mm @@ -2,17 +2,9 @@ // ASHighlightOverlayLayer.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Details/ASImageContainerProtocolCategories.h b/Source/Details/ASImageContainerProtocolCategories.h index 529056238c..44ddc354fd 100644 --- a/Source/Details/ASImageContainerProtocolCategories.h +++ b/Source/Details/ASImageContainerProtocolCategories.h @@ -2,17 +2,9 @@ // ASImageContainerProtocolCategories.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Details/ASImageContainerProtocolCategories.m b/Source/Details/ASImageContainerProtocolCategories.m index 546dc3fda5..1df6a9111f 100644 --- a/Source/Details/ASImageContainerProtocolCategories.m +++ b/Source/Details/ASImageContainerProtocolCategories.m @@ -2,17 +2,9 @@ // ASImageContainerProtocolCategories.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Details/ASImageProtocols.h b/Source/Details/ASImageProtocols.h index a686a7ace6..10ad85db35 100644 --- a/Source/Details/ASImageProtocols.h +++ b/Source/Details/ASImageProtocols.h @@ -2,17 +2,9 @@ // ASImageProtocols.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Details/ASIntegerMap.h b/Source/Details/ASIntegerMap.h index 75f6d0f610..ece6f5a8bf 100644 --- a/Source/Details/ASIntegerMap.h +++ b/Source/Details/ASIntegerMap.h @@ -2,12 +2,8 @@ // ASIntegerMap.h // Texture // -// Copyright (c) 2017-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Details/ASIntegerMap.mm b/Source/Details/ASIntegerMap.mm index e80ab7bfa1..afdbc6eb12 100644 --- a/Source/Details/ASIntegerMap.mm +++ b/Source/Details/ASIntegerMap.mm @@ -2,12 +2,8 @@ // ASIntegerMap.mm // Texture // -// Copyright (c) 2017-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ASIntegerMap.h" @@ -102,7 +98,7 @@ return NSNotFound; } - auto result = _map.find(key); + let result = _map.find(key); return result != _map.end() ? result->second : NSNotFound; } @@ -122,9 +118,10 @@ return self; } - auto result = [[ASIntegerMap alloc] init]; - for (auto it = _map.begin(); it != _map.end(); it++) { - result->_map[it->second] = it->first; + let result = [[ASIntegerMap alloc] init]; + + for (let &e : _map) { + result->_map[e.second] = e.first; } return result; } @@ -137,7 +134,7 @@ return self; } - auto newMap = [[ASIntegerMap allocWithZone:zone] init]; + let newMap = [[ASIntegerMap allocWithZone:zone] init]; newMap->_map = _map; return newMap; } @@ -155,8 +152,8 @@ } else { // { 1->2 3->4 5->6 } NSMutableString *str = [NSMutableString string]; - for (auto it = _map.begin(); it != _map.end(); it++) { - [str appendFormat:@" %zd->%zd", it->first, it->second]; + for (let &e : _map) { + [str appendFormat:@" %ld->%ld", (long)e.first, (long)e.second]; } // Remove leading space if (str.length > 0) { @@ -179,7 +176,7 @@ return YES; } - if (auto otherMap = ASDynamicCast(object, ASIntegerMap)) { + if (let otherMap = ASDynamicCast(object, ASIntegerMap)) { return otherMap->_map == _map; } return NO; diff --git a/Source/Details/ASLayoutController.h b/Source/Details/ASLayoutController.h index 3e8aa6dce8..d0e2f60907 100644 --- a/Source/Details/ASLayoutController.h +++ b/Source/Details/ASLayoutController.h @@ -2,17 +2,9 @@ // ASLayoutController.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Details/ASLayoutRangeType.h b/Source/Details/ASLayoutRangeType.h index 421dc995f6..d4af470c06 100644 --- a/Source/Details/ASLayoutRangeType.h +++ b/Source/Details/ASLayoutRangeType.h @@ -2,17 +2,9 @@ // ASLayoutRangeType.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Details/ASMainSerialQueue.h b/Source/Details/ASMainSerialQueue.h index e94451d64c..405164f75d 100644 --- a/Source/Details/ASMainSerialQueue.h +++ b/Source/Details/ASMainSerialQueue.h @@ -2,17 +2,9 @@ // ASMainSerialQueue.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Details/ASMainSerialQueue.mm b/Source/Details/ASMainSerialQueue.mm index 4a3d929c18..6a9baee50c 100644 --- a/Source/Details/ASMainSerialQueue.mm +++ b/Source/Details/ASMainSerialQueue.mm @@ -2,17 +2,9 @@ // ASMainSerialQueue.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Details/ASMutableAttributedStringBuilder.h b/Source/Details/ASMutableAttributedStringBuilder.h index c6ecbea75c..d531549a0e 100644 --- a/Source/Details/ASMutableAttributedStringBuilder.h +++ b/Source/Details/ASMutableAttributedStringBuilder.h @@ -2,17 +2,9 @@ // ASMutableAttributedStringBuilder.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Details/ASMutableAttributedStringBuilder.m b/Source/Details/ASMutableAttributedStringBuilder.m index 4137a92def..65a2333711 100644 --- a/Source/Details/ASMutableAttributedStringBuilder.m +++ b/Source/Details/ASMutableAttributedStringBuilder.m @@ -2,17 +2,9 @@ // ASMutableAttributedStringBuilder.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Details/ASObjectDescriptionHelpers.h b/Source/Details/ASObjectDescriptionHelpers.h index c3eb7053ec..5a2823bd99 100644 --- a/Source/Details/ASObjectDescriptionHelpers.h +++ b/Source/Details/ASObjectDescriptionHelpers.h @@ -2,17 +2,9 @@ // ASObjectDescriptionHelpers.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Details/ASObjectDescriptionHelpers.m b/Source/Details/ASObjectDescriptionHelpers.m index b34872868c..db69a7bf1b 100644 --- a/Source/Details/ASObjectDescriptionHelpers.m +++ b/Source/Details/ASObjectDescriptionHelpers.m @@ -2,17 +2,9 @@ // ASObjectDescriptionHelpers.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Details/ASPINRemoteImageDownloader.h b/Source/Details/ASPINRemoteImageDownloader.h index 9d1b8a2e12..898e2501b3 100644 --- a/Source/Details/ASPINRemoteImageDownloader.h +++ b/Source/Details/ASPINRemoteImageDownloader.h @@ -2,17 +2,9 @@ // ASPINRemoteImageDownloader.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK @@ -36,7 +28,6 @@ NS_ASSUME_NONNULL_BEGIN * This is the default downloader used by network backed image nodes if PINRemoteImage and PINCache are * available. It uses PINRemoteImage's features to provide caching and progressive image downloads. */ -@property (class, readonly) ASPINRemoteImageDownloader *sharedDownloader; + (ASPINRemoteImageDownloader *)sharedDownloader NS_RETURNS_RETAINED; @@ -50,6 +41,16 @@ NS_ASSUME_NONNULL_BEGIN */ + (void)setSharedImageManagerWithConfiguration:(nullable NSURLSessionConfiguration *)configuration; +/** + * Sets a custom preconfigured PINRemoteImageManager that will be used by @c ASNetworkImageNodes and @c ASMultiplexImageNodes + * while loading images off the network. This must be specified early in the application lifecycle before + * `sharedDownloader` is accessed. If nil is passed in as the PINRemoteImageManager, it will create + * a default image manager with a nil session configuration. + * + * @param preconfiguredPINRemoteImageManager The preconfigured remote image manager that will be used by `sharedDownloader` + */ ++ (void)setSharedPreconfiguredRemoteImageManager:(nullable PINRemoteImageManager *)preconfiguredPINRemoteImageManager; + /** * The shared instance of a @c PINRemoteImageManager used by all @c ASPINRemoteImageDownloaders * diff --git a/Source/Details/ASPINRemoteImageDownloader.m b/Source/Details/ASPINRemoteImageDownloader.m index beb83fe990..a73d889aaa 100644 --- a/Source/Details/ASPINRemoteImageDownloader.m +++ b/Source/Details/ASPINRemoteImageDownloader.m @@ -2,17 +2,9 @@ // ASPINRemoteImageDownloader.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK @@ -47,11 +39,9 @@ #if PIN_ANIMATED_AVAILABLE @interface ASPINRemoteImageDownloader () - @end @interface PINCachedAnimatedImage (ASPINRemoteImageDownloader) - @end @implementation PINCachedAnimatedImage (ASPINRemoteImageDownloader) @@ -108,8 +98,8 @@ @end - static ASPINRemoteImageDownloader *sharedDownloader = nil; +static PINRemoteImageManager *sharedPINRemoteImageManager = nil; @interface ASPINRemoteImageDownloader () @end @@ -129,43 +119,55 @@ static ASPINRemoteImageDownloader *sharedDownloader = nil; + (void)setSharedImageManagerWithConfiguration:(nullable NSURLSessionConfiguration *)configuration { NSAssert(sharedDownloader == nil, @"Singleton has been created and session can no longer be configured."); - __unused PINRemoteImageManager *sharedManager = [self sharedPINRemoteImageManagerWithConfiguration:configuration]; + NSAssert1(sharedPINRemoteImageManager == nil, @"An instance of %@ has been set. Either configuration or preconfigured image manager can be set at a time and only once.", [[sharedPINRemoteImageManager class] description]); + __unused PINRemoteImageManager *sharedManager = [self sharedPINRemoteImageManagerWithConfiguration:configuration preconfiguredPINRemoteImageManager:nil]; } -+ (PINRemoteImageManager *)sharedPINRemoteImageManagerWithConfiguration:(NSURLSessionConfiguration *)configuration ++ (void)setSharedPreconfiguredRemoteImageManager:(nullable PINRemoteImageManager *)preconfiguredPINRemoteImageManager { - static ASPINRemoteImageManager *sharedPINRemoteImageManager; + NSAssert(sharedDownloader == nil, @"Singleton has been created and session can no longer be configured."); + NSAssert1(sharedPINRemoteImageManager == nil, @"An instance of %@ has been set. Either configuration or preconfigured image manager can be set at a time and only once.", [[sharedPINRemoteImageManager class] description]); + __unused PINRemoteImageManager *sharedManager = [self sharedPINRemoteImageManagerWithConfiguration:nil preconfiguredPINRemoteImageManager:preconfiguredPINRemoteImageManager]; +} + ++ (PINRemoteImageManager *)sharedPINRemoteImageManagerWithConfiguration:(NSURLSessionConfiguration *)configuration preconfiguredPINRemoteImageManager:(PINRemoteImageManager *)preconfiguredPINRemoteImageManager +{ + NSAssert(!(configuration != nil && preconfiguredPINRemoteImageManager != nil), @"Either configuration or preconfigured image manager can be set at a time."); static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ + if (preconfiguredPINRemoteImageManager) { + sharedPINRemoteImageManager = preconfiguredPINRemoteImageManager; + } else { #if PIN_ANIMATED_AVAILABLE - // Check that Carthage users have linked both PINRemoteImage & PINCache by testing for one file each - if (!(NSClassFromString(@"PINRemoteImageManager"))) { - NSException *e = [NSException - exceptionWithName:@"FrameworkSetupException" - reason:@"Missing the path to the PINRemoteImage framework." - userInfo:nil]; - @throw e; - } - if (!(NSClassFromString(@"PINCache"))) { - NSException *e = [NSException - exceptionWithName:@"FrameworkSetupException" - reason:@"Missing the path to the PINCache framework." - userInfo:nil]; - @throw e; - } - sharedPINRemoteImageManager = [[ASPINRemoteImageManager alloc] initWithSessionConfiguration:configuration - alternativeRepresentationProvider:[self sharedDownloader]]; + // Check that Carthage users have linked both PINRemoteImage & PINCache by testing for one file each + if (!(NSClassFromString(@"PINRemoteImageManager"))) { + NSException *e = [NSException + exceptionWithName:@"FrameworkSetupException" + reason:@"Missing the path to the PINRemoteImage framework." + userInfo:nil]; + @throw e; + } + if (!(NSClassFromString(@"PINCache"))) { + NSException *e = [NSException + exceptionWithName:@"FrameworkSetupException" + reason:@"Missing the path to the PINCache framework." + userInfo:nil]; + @throw e; + } + sharedPINRemoteImageManager = [[ASPINRemoteImageManager alloc] initWithSessionConfiguration:configuration + alternativeRepresentationProvider:[self sharedDownloader]]; #else - sharedPINRemoteImageManager = [[ASPINRemoteImageManager alloc] initWithSessionConfiguration:configuration]; + sharedPINRemoteImageManager = [[ASPINRemoteImageManager alloc] initWithSessionConfiguration:configuration]; #endif + } }); return sharedPINRemoteImageManager; } - (PINRemoteImageManager *)sharedPINRemoteImageManager { - return [ASPINRemoteImageDownloader sharedPINRemoteImageManagerWithConfiguration:nil]; + return [ASPINRemoteImageDownloader sharedPINRemoteImageManagerWithConfiguration:nil preconfiguredPINRemoteImageManager:nil]; } - (BOOL)sharedImageManagerSupportsMemoryRemoval diff --git a/Source/Details/ASPageTable.h b/Source/Details/ASPageTable.h index ecd98337c5..7e01e933a6 100644 --- a/Source/Details/ASPageTable.h +++ b/Source/Details/ASPageTable.h @@ -2,12 +2,8 @@ // ASPageTable.h // Texture // -// Copyright (c) 2017-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK diff --git a/Source/Details/ASPageTable.m b/Source/Details/ASPageTable.m index fcc4054598..15b43dca9f 100644 --- a/Source/Details/ASPageTable.m +++ b/Source/Details/ASPageTable.m @@ -2,12 +2,8 @@ // ASPageTable.m // Texture // -// Copyright (c) 2017-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK diff --git a/Source/Details/ASPhotosFrameworkImageRequest.h b/Source/Details/ASPhotosFrameworkImageRequest.h index 22198279cd..2ca24bfbee 100644 --- a/Source/Details/ASPhotosFrameworkImageRequest.h +++ b/Source/Details/ASPhotosFrameworkImageRequest.h @@ -2,20 +2,15 @@ // ASPhotosFrameworkImageRequest.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // -#ifndef MINIMAL_ASDK +#import + +#if AS_USE_PHOTOS + #import #import #import @@ -74,4 +69,5 @@ API_AVAILABLE(ios(8.0), tvos(10.0)) @end NS_ASSUME_NONNULL_END -#endif + +#endif // AS_USE_PHOTOS diff --git a/Source/Details/ASPhotosFrameworkImageRequest.m b/Source/Details/ASPhotosFrameworkImageRequest.m index cac0ed612c..942000bb6f 100644 --- a/Source/Details/ASPhotosFrameworkImageRequest.m +++ b/Source/Details/ASPhotosFrameworkImageRequest.m @@ -2,20 +2,15 @@ // ASPhotosFrameworkImageRequest.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -#ifndef MINIMAL_ASDK + #import + +#if AS_USE_PHOTOS + #import NSString *const ASPhotosURLScheme = @"ph"; @@ -160,4 +155,5 @@ static NSString *const _ASPhotosURLQueryKeyCropHeight = @"crop_h"; } @end -#endif \ No newline at end of file + +#endif // AS_USE_PHOTOS diff --git a/Source/Details/ASRangeController.h b/Source/Details/ASRangeController.h index a942ccd657..625da6b992 100644 --- a/Source/Details/ASRangeController.h +++ b/Source/Details/ASRangeController.h @@ -2,17 +2,9 @@ // ASRangeController.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK diff --git a/Source/Details/ASRangeController.mm b/Source/Details/ASRangeController.mm index 2840cf4113..27ebb59d5e 100644 --- a/Source/Details/ASRangeController.mm +++ b/Source/Details/ASRangeController.mm @@ -2,17 +2,9 @@ // ASRangeController.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK @@ -226,7 +218,7 @@ static UIApplicationState __ApplicationState = UIApplicationStateActive; // TODO: Consider if we need to use this codepath, or can rely on something more similar to the data & display ranges // Example: ... = [_layoutController indexPathsForScrolling:scrollDirection rangeType:ASLayoutRangeTypeVisible]; - auto visibleElements = [_dataSource visibleElementsForRangeController:self]; + var visibleElements = [_dataSource visibleElementsForRangeController:self]; NSHashTable *newVisibleNodes = [NSHashTable hashTableWithOptions:NSHashTableObjectPointerPersonality]; ASSignpostStart(ASSignpostRangeControllerUpdate); @@ -527,6 +519,7 @@ static UIApplicationState __ApplicationState = UIApplicationStateActive; // Skip the many method calls of the recursive operation if the top level cell node already has the right interfaceState. - (void)clearContents { + ASDisplayNodeAssertMainThread(); for (ASCollectionElement *element in [_dataSource elementMapForRangeController:self]) { ASCellNode *node = element.nodeIfAllocated; if (ASInterfaceStateIncludesDisplay(node.interfaceState)) { @@ -537,6 +530,7 @@ static UIApplicationState __ApplicationState = UIApplicationStateActive; - (void)clearPreloadedData { + ASDisplayNodeAssertMainThread(); for (ASCollectionElement *element in [_dataSource elementMapForRangeController:self]) { ASCellNode *node = element.nodeIfAllocated; if (ASInterfaceStateIncludesPreload(node.interfaceState)) { diff --git a/Source/Details/ASRangeControllerUpdateRangeProtocol+Beta.h b/Source/Details/ASRangeControllerUpdateRangeProtocol+Beta.h index 4b15f8961f..5bc4fae301 100644 --- a/Source/Details/ASRangeControllerUpdateRangeProtocol+Beta.h +++ b/Source/Details/ASRangeControllerUpdateRangeProtocol+Beta.h @@ -2,17 +2,9 @@ // ASRangeControllerUpdateRangeProtocol+Beta.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK diff --git a/Source/Details/ASRecursiveUnfairLock.h b/Source/Details/ASRecursiveUnfairLock.h index 3b5ef11de7..48aab7f307 100644 --- a/Source/Details/ASRecursiveUnfairLock.h +++ b/Source/Details/ASRecursiveUnfairLock.h @@ -2,12 +2,8 @@ // ASRecursiveUnfairLock.h // Texture // -// Copyright (c) 2018-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Details/ASRecursiveUnfairLock.m b/Source/Details/ASRecursiveUnfairLock.m index a07b751c4a..7e5cac3681 100644 --- a/Source/Details/ASRecursiveUnfairLock.m +++ b/Source/Details/ASRecursiveUnfairLock.m @@ -2,12 +2,8 @@ // ASRecursiveUnfairLock.m // Texture // -// Copyright (c) 2018-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ASRecursiveUnfairLock.h" diff --git a/Source/Details/ASScrollDirection.h b/Source/Details/ASScrollDirection.h index 6a89b6f09a..41538ed31b 100644 --- a/Source/Details/ASScrollDirection.h +++ b/Source/Details/ASScrollDirection.h @@ -2,17 +2,9 @@ // ASScrollDirection.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Details/ASScrollDirection.m b/Source/Details/ASScrollDirection.m index fa123c6a18..4edc8ec259 100644 --- a/Source/Details/ASScrollDirection.m +++ b/Source/Details/ASScrollDirection.m @@ -2,17 +2,9 @@ // ASScrollDirection.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Details/ASSectionContext.h b/Source/Details/ASSectionContext.h index 10b96e9b3c..e7d4a190a4 100644 --- a/Source/Details/ASSectionContext.h +++ b/Source/Details/ASSectionContext.h @@ -2,17 +2,9 @@ // ASSectionContext.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK diff --git a/Source/Details/ASTableLayoutController.h b/Source/Details/ASTableLayoutController.h index e57500f224..c294c2ecb4 100644 --- a/Source/Details/ASTableLayoutController.h +++ b/Source/Details/ASTableLayoutController.h @@ -2,17 +2,9 @@ // ASTableLayoutController.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK diff --git a/Source/Details/ASTableLayoutController.m b/Source/Details/ASTableLayoutController.m index 479791b5cd..dd6d9d0302 100644 --- a/Source/Details/ASTableLayoutController.m +++ b/Source/Details/ASTableLayoutController.m @@ -2,17 +2,9 @@ // ASTableLayoutController.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK #import diff --git a/Source/Details/ASThread.h b/Source/Details/ASThread.h index c03fe46b26..bdcfd26189 100644 --- a/Source/Details/ASThread.h +++ b/Source/Details/ASThread.h @@ -2,17 +2,9 @@ // ASThread.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import @@ -106,15 +98,19 @@ ASDISPLAYNODE_INLINE void _ASUnlockScopeCleanup(id __strong *lockPtr) #define TIME_LOCKER 0 /** * Enable this flag to collect information on the owning thread and ownership level of a mutex. - * These properties are useful to determine if a mutext has been acquired and in case of a recursive mutex, how many times that happened. + * These properties are useful to determine if a mutex has been acquired and in case of a recursive mutex, how many times that happened. * - * This flag also enable locking assertions (e.g ASDisplayNodeAssertLockUnownedByCurrentThread(node)). + * This flag also enable locking assertions (e.g ASAssertUnlocked(node)). * The assertions are useful when you want to indicate and enforce the locking policy/expectation of methods. * To determine when and which methods acquired a (recursive) mutex (to debug deadlocks, for example), * put breakpoints at some assertions. When the breakpoints hit, walk through stack trace frames * and check ownership count of the mutex. */ +#if ASDISPLAYNODE_ASSERTIONS_ENABLED +#define CHECK_LOCKING_SAFETY 1 +#else #define CHECK_LOCKING_SAFETY 0 +#endif #if TIME_LOCKER #import @@ -138,11 +134,11 @@ ASDISPLAYNODE_INLINE void _ASUnlockScopeCleanup(id __strong *lockPtr) * and check ownership count of the mutex. */ #if CHECK_LOCKING_SAFETY -#define ASDisplayNodeAssertLockUnownedByCurrentThread(lock) ASDisplayNodeAssertFalse(lock.ownedByCurrentThread()) -#define ASDisplayNodeAssertLockOwnedByCurrentThread(lock) ASDisplayNodeAssert(lock.ownedByCurrentThread()) +#define ASAssertUnlocked(lock) ASDisplayNodeAssertFalse(lock.locked()) +#define ASAssertLocked(lock) ASDisplayNodeAssert(lock.locked(), @"Lock must be held by current thread") #else -#define ASDisplayNodeAssertLockUnownedByCurrentThread(lock) -#define ASDisplayNodeAssertLockOwnedByCurrentThread(lock) +#define ASAssertUnlocked(lock) +#define ASAssertLocked(lock) #endif namespace ASDN { @@ -283,7 +279,7 @@ namespace ASDN { return os_unfair_lock_trylock(&_unfair); } } else { - auto result = pthread_mutex_trylock(&_m); + let result = pthread_mutex_trylock(&_m); if (result == 0) { return true; } else if (result == EBUSY) { @@ -346,7 +342,7 @@ namespace ASDN { pthread_mutex_t *mutex () { return &_m; } #if CHECK_LOCKING_SAFETY - bool ownedByCurrentThread() { + bool locked() { return _count > 0 && pthread_mach_thread_np(pthread_self()) == _owner; } #endif diff --git a/Source/Details/ASTraceEvent.h b/Source/Details/ASTraceEvent.h index 48c45cec6c..8ca7b32fa6 100644 --- a/Source/Details/ASTraceEvent.h +++ b/Source/Details/ASTraceEvent.h @@ -2,17 +2,9 @@ // ASTraceEvent.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Details/ASTraceEvent.m b/Source/Details/ASTraceEvent.m index d3d4ff6a5d..0325fbf901 100644 --- a/Source/Details/ASTraceEvent.m +++ b/Source/Details/ASTraceEvent.m @@ -2,17 +2,9 @@ // ASTraceEvent.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Details/ASTraitCollection.h b/Source/Details/ASTraitCollection.h index bd0ce1b9d6..72dedd616c 100644 --- a/Source/Details/ASTraitCollection.h +++ b/Source/Details/ASTraitCollection.h @@ -2,17 +2,9 @@ // ASTraitCollection.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // diff --git a/Source/Details/ASTraitCollection.m b/Source/Details/ASTraitCollection.m index e03db0f45d..56c29c5cbe 100644 --- a/Source/Details/ASTraitCollection.m +++ b/Source/Details/ASTraitCollection.m @@ -2,17 +2,9 @@ // ASTraitCollection.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Details/ASWeakProxy.h b/Source/Details/ASWeakProxy.h index 4a24905135..7396474b1c 100644 --- a/Source/Details/ASWeakProxy.h +++ b/Source/Details/ASWeakProxy.h @@ -2,17 +2,9 @@ // ASWeakProxy.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Details/ASWeakProxy.m b/Source/Details/ASWeakProxy.m index 721191bc0a..cfcb1aca5c 100644 --- a/Source/Details/ASWeakProxy.m +++ b/Source/Details/ASWeakProxy.m @@ -2,17 +2,9 @@ // ASWeakProxy.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Details/ASWeakSet.h b/Source/Details/ASWeakSet.h index 7d6b8d8d05..cc435dec0e 100644 --- a/Source/Details/ASWeakSet.h +++ b/Source/Details/ASWeakSet.h @@ -2,17 +2,9 @@ // ASWeakSet.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Details/ASWeakSet.m b/Source/Details/ASWeakSet.m index 82d5014891..7d05dbed6e 100644 --- a/Source/Details/ASWeakSet.m +++ b/Source/Details/ASWeakSet.m @@ -2,17 +2,9 @@ // ASWeakSet.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Details/CoreGraphics+ASConvenience.h b/Source/Details/CoreGraphics+ASConvenience.h index 9eeef3192f..a0805f1701 100644 --- a/Source/Details/CoreGraphics+ASConvenience.h +++ b/Source/Details/CoreGraphics+ASConvenience.h @@ -2,17 +2,9 @@ // CoreGraphics+ASConvenience.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Details/CoreGraphics+ASConvenience.m b/Source/Details/CoreGraphics+ASConvenience.m index 92169ffe4e..0f78cf1bee 100644 --- a/Source/Details/CoreGraphics+ASConvenience.m +++ b/Source/Details/CoreGraphics+ASConvenience.m @@ -2,17 +2,9 @@ // CoreGraphics+ASConvenience.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Details/NSArray+Diffing.h b/Source/Details/NSArray+Diffing.h index 3a1729337f..c463903144 100644 --- a/Source/Details/NSArray+Diffing.h +++ b/Source/Details/NSArray+Diffing.h @@ -2,21 +2,67 @@ // NSArray+Diffing.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import +/** + * These changes can be used to transform `self` to `array` by applying them in (any) order, *without shifting* the + * other elements. This can be done (in an NSMutableArray) by calling `setObject:atIndexedSubscript:` (or just use + * [subscripting] directly) for insertions from `array` into `self` (not the seemingly more apt `insertObject:atIndex`!), + * and using the same method for deletions from `self` (*set* a `[NSNull null]` as opposed to `removeObject:atIndex:`). + * After all inserts/deletes have been applied, there will be no nulls left (except possibly at the end of the array if + * `[array count] < [self count]`) + + * Some examples: + * in: ab c + * out: abdc + * diff: ..+. + * + * in: abcd + * out: dcba + * dif: ---.+++ + * + * in: abcd + * out: ab d + * diff: ..-. + * + * in: a bcd + * out: adbc + * diff: .+..- + * + * If `moves` pointer is passed in, instances where one element moves to another location are detected and reported, + * possibly replacing pairs of delete/insert. The process for transforming an array remains the same, however now it is + * important to apply the moves in order and not overwrite an element that needs to be moved somewhere else. + * + * the same examples, with moves: + * in: ab c + * out: abdc + * diff: ..+. + * + * in: abcd + * out: dcba + * diff: 321. + * + * in: abcd + * out: ab d + * diff: ..-. + * + * in: abcd + * out: adbc + * diff: .312 + * + * Other notes: + * + * No index will be both moved from and deleted. + * Each index 0...[self count] will be either moved from or deleted. If it is moved to the same location, we omit it. + * Each index 0...[array count] will be the destination of ONE move or ONE insert. + * Knowing these things means any two of the three (delete, move, insert) implies the third. + */ + @interface NSArray (Diffing) /** @@ -35,4 +81,12 @@ */ - (void)asdk_diffWithArray:(NSArray *)array insertions:(NSIndexSet **)insertions deletions:(NSIndexSet **)deletions compareBlock:(BOOL (^)(id lhs, id rhs))comparison; +/** + * @abstract Compares two arrays, providing the insertion, deletion, and move indexes needed to transform into the target array. + * @discussion This compares the equality of each object with `isEqual:`. + * This diffing algorithm uses a bottom-up memoized longest common subsequence solution to identify differences. + * It runs in O(mn) complexity. + * The moves are returned in ascending order of their destination index. + */ +- (void)asdk_diffWithArray:(NSArray *)array insertions:(NSIndexSet **)insertions deletions:(NSIndexSet **)deletions moves:(NSArray **)moves; @end diff --git a/Source/Details/NSArray+Diffing.m b/Source/Details/NSArray+Diffing.m deleted file mode 100644 index ee0ba0ff3e..0000000000 --- a/Source/Details/NSArray+Diffing.m +++ /dev/null @@ -1,113 +0,0 @@ -// -// NSArray+Diffing.m -// Texture -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -@implementation NSArray (Diffing) - -- (void)asdk_diffWithArray:(NSArray *)array insertions:(NSIndexSet **)insertions deletions:(NSIndexSet **)deletions -{ - [self asdk_diffWithArray:array insertions:insertions deletions:deletions compareBlock:^BOOL(id lhs, id rhs) { - return [lhs isEqual:rhs]; - }]; -} - -- (void)asdk_diffWithArray:(NSArray *)array insertions:(NSIndexSet **)insertions deletions:(NSIndexSet **)deletions compareBlock:(BOOL (^)(id lhs, id rhs))comparison -{ - NSAssert(comparison != nil, @"Comparison block is required"); - NSIndexSet *commonIndexes = [self _asdk_commonIndexesWithArray:array compareBlock:comparison]; - - if (insertions) { - NSArray *commonObjects = [self objectsAtIndexes:commonIndexes]; - NSMutableIndexSet *insertionIndexes = [[NSMutableIndexSet alloc] init]; - for (NSInteger i = 0, j = 0; i < commonObjects.count || j < array.count;) { - if (i < commonObjects.count && j < array.count && comparison(commonObjects[i], array[j])) { - i++; j++; - } else { - [insertionIndexes addIndex:j]; - j++; - } - } - *insertions = insertionIndexes; - } - - if (deletions) { - NSMutableIndexSet *deletionIndexes = [[NSMutableIndexSet alloc] init]; - for (NSInteger i = 0; i < self.count; i++) { - if (![commonIndexes containsIndex:i]) { - [deletionIndexes addIndex:i]; - } - } - *deletions = deletionIndexes; - } -} - -- (NSIndexSet *)_asdk_commonIndexesWithArray:(NSArray *)array compareBlock:(BOOL (^)(id lhs, id rhs))comparison -{ - NSAssert(comparison != nil, @"Comparison block is required"); - - NSInteger selfCount = self.count; - NSInteger arrayCount = array.count; - - // Allocate the diff map in the heap so we don't blow the stack for large arrays. - NSInteger **lengths = NULL; - lengths = (NSInteger **)malloc(sizeof(NSInteger*) * (selfCount+1)); - if (lengths == NULL) { - ASDisplayNodeFailAssert(@"Failed to allocate memory for diffing"); - return nil; - } - - for (NSInteger i = 0; i <= selfCount; i++) { - lengths[i] = (NSInteger *)malloc(sizeof(NSInteger) * (arrayCount+1)); - if (lengths[i] == NULL) { - ASDisplayNodeFailAssert(@"Failed to allocate memory for diffing"); - return nil; - } - id selfObj = i > 0 ? self[i-1] : nil; - for (NSInteger j = 0; j <= arrayCount; j++) { - if (i == 0 || j == 0) { - lengths[i][j] = 0; - } else if (comparison(selfObj, array[j-1])) { - lengths[i][j] = 1 + lengths[i-1][j-1]; - } else { - lengths[i][j] = MAX(lengths[i-1][j], lengths[i][j-1]); - } - } - } - - NSMutableIndexSet *common = [[NSMutableIndexSet alloc] init]; - NSInteger i = selfCount, j = arrayCount; - while(i > 0 && j > 0) { - if (comparison(self[i-1], array[j-1])) { - [common addIndex:(i-1)]; - i--; j--; - } else if (lengths[i-1][j] > lengths[i][j-1]) { - i--; - } else { - j--; - } - } - - for (NSInteger i = 0; i <= selfCount; i++) { - free(lengths[i]); - } - free(lengths); - return common; -} - -@end diff --git a/Source/Details/NSArray+Diffing.mm b/Source/Details/NSArray+Diffing.mm new file mode 100644 index 0000000000..83d32fea68 --- /dev/null +++ b/Source/Details/NSArray+Diffing.mm @@ -0,0 +1,177 @@ +// +// NSArray+Diffing.mm +// Texture +// +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 +// + +#import +#import +#import +#import + +@implementation NSArray (Diffing) + +typedef BOOL (^compareBlock)(id _Nonnull lhs, id _Nonnull rhs); + +- (void)asdk_diffWithArray:(NSArray *)array insertions:(NSIndexSet **)insertions deletions:(NSIndexSet **)deletions +{ + [self asdk_diffWithArray:array insertions:insertions deletions:deletions moves:nil compareBlock:[NSArray defaultCompareBlock]]; +} + +- (void)asdk_diffWithArray:(NSArray *)array insertions:(NSIndexSet **)insertions deletions:(NSIndexSet **)deletions + compareBlock:(compareBlock)comparison +{ + [self asdk_diffWithArray:array insertions:insertions deletions:deletions moves:nil compareBlock:comparison]; +} + +- (void)asdk_diffWithArray:(NSArray *)array insertions:(NSIndexSet **)insertions deletions:(NSIndexSet **)deletions + moves:(NSArray **)moves +{ + [self asdk_diffWithArray:array insertions:insertions deletions:deletions moves:moves + compareBlock:[NSArray defaultCompareBlock]]; +} + +- (void)asdk_diffWithArray:(NSArray *)array insertions:(NSIndexSet **)insertions deletions:(NSIndexSet **)deletions + moves:(NSArray **)moves compareBlock:(compareBlock)comparison +{ + struct NSObjectHash + { + std::size_t operator()(id k) const { return (std::size_t) [k hash]; }; + }; + struct NSObjectCompare + { + bool operator()(id lhs, id rhs) const { return (bool) [lhs isEqual:rhs]; }; + }; + std::unordered_multimap potentialMoves; + + NSAssert(comparison != nil, @"Comparison block is required"); + NSAssert(moves == nil || comparison == [NSArray defaultCompareBlock], @"move detection requires isEqual: and hash (no custom compare)"); + NSMutableArray *moveIndexPaths = nil; + NSMutableIndexSet *insertionIndexes = nil, *deletionIndexes = nil; + if (moves) { + moveIndexPaths = [NSMutableArray new]; + } + NSMutableIndexSet *commonIndexes = [self _asdk_commonIndexesWithArray:array compareBlock:comparison]; + + if (deletions || moves) { + deletionIndexes = [NSMutableIndexSet indexSet]; + NSUInteger i = 0; + for (id element in self) { + if (![commonIndexes containsIndex:i]) { + [deletionIndexes addIndex:i]; + } + if (moves) { + potentialMoves.insert(std::pair(element, i)); + } + ++i; + } + } + + if (insertions || moves) { + insertionIndexes = [NSMutableIndexSet indexSet]; + NSArray *commonObjects = [self objectsAtIndexes:commonIndexes]; + for (NSUInteger i = 0, j = 0; j < array.count; j++) { + auto moveFound = potentialMoves.find(array[j]); + NSUInteger movedFrom = NSNotFound; + if (moveFound != potentialMoves.end() && moveFound->second != j) { + movedFrom = moveFound->second; + potentialMoves.erase(moveFound); + [moveIndexPaths addObject:[NSIndexPath indexPathForItem:j inSection:movedFrom]]; + } + if (i < commonObjects.count && j < array.count && comparison(commonObjects[i], array[j])) { + i++; + } else { + if (movedFrom != NSNotFound) { + // moves will coalesce a delete / insert - the insert is just not done, and here we remove the delete: + [deletionIndexes removeIndex:movedFrom]; + // OR a move will have come from the LCS: + if ([commonIndexes containsIndex:movedFrom]) { + [commonIndexes removeIndex:movedFrom]; + commonObjects = [self objectsAtIndexes:commonIndexes]; + } + } else { + [insertionIndexes addIndex:j]; + } + } + } + } + + if (moves) {*moves = moveIndexPaths;} + if (deletions) {*deletions = deletionIndexes;} + if (insertions) {*insertions = insertionIndexes;} +} + +// https://github.com/raywenderlich/swift-algorithm-club/tree/master/Longest%20Common%20Subsequence is not exactly this code (obviously), but +// is a good commentary on the algorithm. +- (NSMutableIndexSet *)_asdk_commonIndexesWithArray:(NSArray *)array compareBlock:(BOOL (^)(id lhs, id rhs))comparison +{ + NSAssert(comparison != nil, @"Comparison block is required"); + + NSInteger selfCount = self.count; + NSInteger arrayCount = array.count; + + // Allocate the diff map in the heap so we don't blow the stack for large arrays. + NSInteger **lengths = NULL; + lengths = (NSInteger **)malloc(sizeof(NSInteger*) * (selfCount+1)); + if (lengths == NULL) { + ASDisplayNodeFailAssert(@"Failed to allocate memory for diffing"); + return nil; + } + // Fill in a LCS length matrix: + for (NSInteger i = 0; i <= selfCount; i++) { + lengths[i] = (NSInteger *)malloc(sizeof(NSInteger) * (arrayCount+1)); + if (lengths[i] == NULL) { + ASDisplayNodeFailAssert(@"Failed to allocate memory for diffing"); + return nil; + } + id selfObj = i > 0 ? self[i-1] : nil; + for (NSInteger j = 0; j <= arrayCount; j++) { + if (i == 0 || j == 0) { + lengths[i][j] = 0; + } else if (comparison(selfObj, array[j-1])) { + lengths[i][j] = 1 + lengths[i-1][j-1]; + } else { + lengths[i][j] = MAX(lengths[i-1][j], lengths[i][j-1]); + } + } + } + // Backtrack to fill in indices based on length matrix: + NSMutableIndexSet *common = [NSMutableIndexSet indexSet]; + NSInteger i = selfCount, j = arrayCount; + while(i > 0 && j > 0) { + if (comparison(self[i-1], array[j-1])) { + [common addIndex:(i-1)]; + i--; j--; + } else if (lengths[i-1][j] > lengths[i][j-1]) { + i--; + } else { + j--; + } + } + + for (NSInteger i = 0; i <= selfCount; i++) { + free(lengths[i]); + } + free(lengths); + return common; +} + +static compareBlock defaultCompare = nil; + ++ (compareBlock)defaultCompareBlock +{ + static dispatch_once_t onceToken; + + dispatch_once(&onceToken, ^{ + defaultCompare = ^BOOL(id lhs, id rhs) { + return [lhs isEqual:rhs]; + }; + }); + + return defaultCompare; +} + +@end diff --git a/Source/Details/NSIndexSet+ASHelpers.h b/Source/Details/NSIndexSet+ASHelpers.h index 2ac42f96b4..cab7c94310 100644 --- a/Source/Details/NSIndexSet+ASHelpers.h +++ b/Source/Details/NSIndexSet+ASHelpers.h @@ -2,17 +2,9 @@ // NSIndexSet+ASHelpers.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Details/NSIndexSet+ASHelpers.m b/Source/Details/NSIndexSet+ASHelpers.m index cc097e15e5..c38cb4c1b5 100644 --- a/Source/Details/NSIndexSet+ASHelpers.m +++ b/Source/Details/NSIndexSet+ASHelpers.m @@ -2,17 +2,9 @@ // NSIndexSet+ASHelpers.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // // UIKit indexPath helpers diff --git a/Source/Details/NSMutableAttributedString+TextKitAdditions.h b/Source/Details/NSMutableAttributedString+TextKitAdditions.h index 49ff968194..afb96722c6 100644 --- a/Source/Details/NSMutableAttributedString+TextKitAdditions.h +++ b/Source/Details/NSMutableAttributedString+TextKitAdditions.h @@ -2,17 +2,9 @@ // NSMutableAttributedString+TextKitAdditions.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Details/NSMutableAttributedString+TextKitAdditions.m b/Source/Details/NSMutableAttributedString+TextKitAdditions.m index aff849ae17..85c59b2af4 100644 --- a/Source/Details/NSMutableAttributedString+TextKitAdditions.m +++ b/Source/Details/NSMutableAttributedString+TextKitAdditions.m @@ -2,17 +2,9 @@ // NSMutableAttributedString+TextKitAdditions.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Details/Transactions/_ASAsyncTransaction.h b/Source/Details/Transactions/_ASAsyncTransaction.h index f22de659bc..245c62b295 100644 --- a/Source/Details/Transactions/_ASAsyncTransaction.h +++ b/Source/Details/Transactions/_ASAsyncTransaction.h @@ -2,17 +2,9 @@ // _ASAsyncTransaction.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Details/Transactions/_ASAsyncTransaction.mm b/Source/Details/Transactions/_ASAsyncTransaction.mm index cdec27c3e4..b4b8adf6a9 100644 --- a/Source/Details/Transactions/_ASAsyncTransaction.mm +++ b/Source/Details/Transactions/_ASAsyncTransaction.mm @@ -2,17 +2,9 @@ // _ASAsyncTransaction.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // // We need this import for UITrackingRunLoopMode diff --git a/Source/Details/Transactions/_ASAsyncTransactionContainer+Private.h b/Source/Details/Transactions/_ASAsyncTransactionContainer+Private.h index 8dd3c8d509..003184c586 100644 --- a/Source/Details/Transactions/_ASAsyncTransactionContainer+Private.h +++ b/Source/Details/Transactions/_ASAsyncTransactionContainer+Private.h @@ -2,17 +2,9 @@ // _ASAsyncTransactionContainer+Private.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Details/Transactions/_ASAsyncTransactionContainer.h b/Source/Details/Transactions/_ASAsyncTransactionContainer.h index 83610c046b..53fe40f809 100644 --- a/Source/Details/Transactions/_ASAsyncTransactionContainer.h +++ b/Source/Details/Transactions/_ASAsyncTransactionContainer.h @@ -2,17 +2,9 @@ // _ASAsyncTransactionContainer.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #pragma once diff --git a/Source/Details/Transactions/_ASAsyncTransactionContainer.m b/Source/Details/Transactions/_ASAsyncTransactionContainer.m index 6f216145a2..4a77b06705 100644 --- a/Source/Details/Transactions/_ASAsyncTransactionContainer.m +++ b/Source/Details/Transactions/_ASAsyncTransactionContainer.m @@ -2,17 +2,9 @@ // _ASAsyncTransactionContainer.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Details/Transactions/_ASAsyncTransactionGroup.h b/Source/Details/Transactions/_ASAsyncTransactionGroup.h index b6aeafc3b6..cd0b216c06 100644 --- a/Source/Details/Transactions/_ASAsyncTransactionGroup.h +++ b/Source/Details/Transactions/_ASAsyncTransactionGroup.h @@ -2,17 +2,9 @@ // _ASAsyncTransactionGroup.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Details/Transactions/_ASAsyncTransactionGroup.m b/Source/Details/Transactions/_ASAsyncTransactionGroup.m index dd2f04be27..f9b1b9e017 100644 --- a/Source/Details/Transactions/_ASAsyncTransactionGroup.m +++ b/Source/Details/Transactions/_ASAsyncTransactionGroup.m @@ -2,17 +2,9 @@ // _ASAsyncTransactionGroup.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Details/UICollectionViewLayout+ASConvenience.h b/Source/Details/UICollectionViewLayout+ASConvenience.h index ae5d9e5247..78e55a17bd 100644 --- a/Source/Details/UICollectionViewLayout+ASConvenience.h +++ b/Source/Details/UICollectionViewLayout+ASConvenience.h @@ -2,17 +2,9 @@ // UICollectionViewLayout+ASConvenience.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Details/UICollectionViewLayout+ASConvenience.m b/Source/Details/UICollectionViewLayout+ASConvenience.m index 6f7633c71c..dfbba66693 100644 --- a/Source/Details/UICollectionViewLayout+ASConvenience.m +++ b/Source/Details/UICollectionViewLayout+ASConvenience.m @@ -2,17 +2,9 @@ // UICollectionViewLayout+ASConvenience.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK diff --git a/Source/Details/UIView+ASConvenience.h b/Source/Details/UIView+ASConvenience.h index 9d9f64ae33..30d58a07a0 100644 --- a/Source/Details/UIView+ASConvenience.h +++ b/Source/Details/UIView+ASConvenience.h @@ -2,17 +2,9 @@ // UIView+ASConvenience.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Details/_ASCollectionReusableView.h b/Source/Details/_ASCollectionReusableView.h index 3cd958697b..bb38bb25bf 100644 --- a/Source/Details/_ASCollectionReusableView.h +++ b/Source/Details/_ASCollectionReusableView.h @@ -2,17 +2,9 @@ // _ASCollectionReusableView.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK diff --git a/Source/Details/_ASCollectionReusableView.m b/Source/Details/_ASCollectionReusableView.m index 8f1ff1b03b..c104b8bea6 100644 --- a/Source/Details/_ASCollectionReusableView.m +++ b/Source/Details/_ASCollectionReusableView.m @@ -2,17 +2,9 @@ // _ASCollectionReusableView.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK diff --git a/Source/Details/_ASCollectionViewCell.h b/Source/Details/_ASCollectionViewCell.h index 23f0d57620..cf08d0d508 100644 --- a/Source/Details/_ASCollectionViewCell.h +++ b/Source/Details/_ASCollectionViewCell.h @@ -2,17 +2,9 @@ // _ASCollectionViewCell.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK diff --git a/Source/Details/_ASCollectionViewCell.m b/Source/Details/_ASCollectionViewCell.m index 41a92d1ae7..6d1f7d6358 100644 --- a/Source/Details/_ASCollectionViewCell.m +++ b/Source/Details/_ASCollectionViewCell.m @@ -2,17 +2,9 @@ // _ASCollectionViewCell.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK diff --git a/Source/Details/_ASDisplayLayer.h b/Source/Details/_ASDisplayLayer.h index 1fbeede745..e69ab71fd0 100644 --- a/Source/Details/_ASDisplayLayer.h +++ b/Source/Details/_ASDisplayLayer.h @@ -2,17 +2,9 @@ // _ASDisplayLayer.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Details/_ASDisplayLayer.mm b/Source/Details/_ASDisplayLayer.mm index efe1ff8992..a7478f1883 100644 --- a/Source/Details/_ASDisplayLayer.mm +++ b/Source/Details/_ASDisplayLayer.mm @@ -2,17 +2,9 @@ // _ASDisplayLayer.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Details/_ASDisplayView.h b/Source/Details/_ASDisplayView.h index 36f3a00d6d..519fde85fa 100644 --- a/Source/Details/_ASDisplayView.h +++ b/Source/Details/_ASDisplayView.h @@ -2,17 +2,9 @@ // _ASDisplayView.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Details/_ASDisplayView.mm b/Source/Details/_ASDisplayView.mm index dc1ca12b6c..a77fe728d1 100644 --- a/Source/Details/_ASDisplayView.mm +++ b/Source/Details/_ASDisplayView.mm @@ -2,17 +2,9 @@ // _ASDisplayView.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import @@ -85,8 +77,8 @@ static _ASDisplayViewMethodOverrides GetASDisplayViewMethodOverrides(Class c) BOOL _inHitTest; BOOL _inPointInside; - NSArray *_accessibleElements; - CGRect _lastAccessibleElementsFrame; + NSArray *_accessibilityElements; + CGRect _lastAccessibilityElementsFrame; _ASDisplayViewMethodOverrides _methodOverrides; } @@ -291,7 +283,7 @@ static _ASDisplayViewMethodOverrides GetASDisplayViewMethodOverrides(Class c) [super addSubview:view]; #ifndef ASDK_ACCESSIBILITY_DISABLE - self.accessibleElements = nil; + self.accessibilityElements = nil; #endif } @@ -300,7 +292,7 @@ static _ASDisplayViewMethodOverrides GetASDisplayViewMethodOverrides(Class c) [super willRemoveSubview:subview]; #ifndef ASDK_ACCESSIBILITY_DISABLE - self.accessibleElements = nil; + self.accessibilityElements = nil; #endif } @@ -454,25 +446,24 @@ static _ASDisplayViewMethodOverrides GetASDisplayViewMethodOverrides(Class c) #pragma mark UIResponder Handling -#define IMPLEMENT_RESPONDER_METHOD(__sel, __methodOverride) \ +#define IMPLEMENT_RESPONDER_METHOD(__sel, __nodeMethodOverride, __viewMethodOverride) \ - (BOOL)__sel\ {\ ASDisplayNode *node = _asyncdisplaykit_node; /* Create strong reference to weak ivar. */ \ - SEL sel = @selector(__sel); \ - /* Prevent an infinite loop in here if [super canBecomeFirstResponder] was called on a - / _ASDisplayView subclass */ \ - if (self->_methodOverrides & __methodOverride) { \ - /* Check if we can call through to ASDisplayNode subclass directly */ \ - if (ASDisplayNodeSubclassOverridesSelector([node class], sel)) { \ - return [node __sel]; \ - } else { \ - /* Call through to views superclass as we expect super was called from the - _ASDisplayView subclass and a node subclass does not overwrite canBecomeFirstResponder */ \ - return [self __##__sel]; \ - } \ + /* Check if we can call through to ASDisplayNode subclass directly */ \ + if (node.methodOverrides & __nodeMethodOverride) { \ + return [node __sel]; \ } else { \ - /* Call through to internal node __canBecomeFirstResponder that will consider the view in responding */ \ - return [node __##__sel]; \ + /* Prevent an infinite loop in here if [super __sel] was called on a \ + / _ASDisplayView subclass */ \ + if (self->_methodOverrides & __viewMethodOverride) { \ + /* Call through to views superclass as we expect super was called from the + _ASDisplayView subclass and a node subclass does not overwrite __sel */ \ + return [self __##__sel]; \ + } else { \ + /* Call through to internal node __sel method that will consider the view in responding */ \ + return [node __##__sel]; \ + } \ } \ }\ /* All __ prefixed methods are called from ASDisplayNode to let the view decide in what UIResponder state they \ @@ -482,11 +473,21 @@ are not overridden by a ASDisplayNode subclass */ \ return [super __sel]; \ } \ -IMPLEMENT_RESPONDER_METHOD(canBecomeFirstResponder, _ASDisplayViewMethodOverrideCanBecomeFirstResponder); -IMPLEMENT_RESPONDER_METHOD(becomeFirstResponder, _ASDisplayViewMethodOverrideBecomeFirstResponder); -IMPLEMENT_RESPONDER_METHOD(canResignFirstResponder, _ASDisplayViewMethodOverrideCanResignFirstResponder); -IMPLEMENT_RESPONDER_METHOD(resignFirstResponder, _ASDisplayViewMethodOverrideResignFirstResponder); -IMPLEMENT_RESPONDER_METHOD(isFirstResponder, _ASDisplayViewMethodOverrideIsFirstResponder); +IMPLEMENT_RESPONDER_METHOD(canBecomeFirstResponder, + ASDisplayNodeMethodOverrideCanBecomeFirstResponder, + _ASDisplayViewMethodOverrideCanBecomeFirstResponder); +IMPLEMENT_RESPONDER_METHOD(becomeFirstResponder, + ASDisplayNodeMethodOverrideBecomeFirstResponder, + _ASDisplayViewMethodOverrideBecomeFirstResponder); +IMPLEMENT_RESPONDER_METHOD(canResignFirstResponder, + ASDisplayNodeMethodOverrideCanResignFirstResponder, + _ASDisplayViewMethodOverrideCanResignFirstResponder); +IMPLEMENT_RESPONDER_METHOD(resignFirstResponder, + ASDisplayNodeMethodOverrideResignFirstResponder, + _ASDisplayViewMethodOverrideResignFirstResponder); +IMPLEMENT_RESPONDER_METHOD(isFirstResponder, + ASDisplayNodeMethodOverrideIsFirstResponder, + _ASDisplayViewMethodOverrideIsFirstResponder); - (BOOL)canPerformAction:(SEL)action withSender:(id)sender { diff --git a/Source/Details/_ASDisplayViewAccessiblity.h b/Source/Details/_ASDisplayViewAccessiblity.h index 5edd82e23f..9d0bf0719a 100644 --- a/Source/Details/_ASDisplayViewAccessiblity.h +++ b/Source/Details/_ASDisplayViewAccessiblity.h @@ -2,22 +2,16 @@ // _ASDisplayViewAccessiblity.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import #import -@interface _ASDisplayView (UIAccessibilityContainer) -@property (copy, nonatomic) NSArray *accessibleElements; -@end +// WARNING: When dealing with accessibility elements, please use the `accessibilityElements` +// property instead of the older methods e.g. `accessibilityElementCount()`. While the older methods +// should still work as long as accessibility is enabled, this framework provides no guarantees on +// their correctness. For details, see +// https://developer.apple.com/documentation/objectivec/nsobject/1615147-accessibilityelements diff --git a/Source/Details/_ASDisplayViewAccessiblity.mm b/Source/Details/_ASDisplayViewAccessiblity.mm index 1f336ac529..284eacb3ae 100644 --- a/Source/Details/_ASDisplayViewAccessiblity.mm +++ b/Source/Details/_ASDisplayViewAccessiblity.mm @@ -2,17 +2,9 @@ // _ASDisplayViewAccessiblity.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef ASDK_ACCESSIBILITY_DISABLE @@ -243,7 +235,7 @@ static void CollectAccessibilityElementsForView(_ASDisplayView *view, NSMutableA } @interface _ASDisplayView () { - NSArray *_accessibleElements; + NSArray *_accessibilityElements; } @end @@ -252,43 +244,29 @@ static void CollectAccessibilityElementsForView(_ASDisplayView *view, NSMutableA #pragma mark - UIAccessibility -- (void)setAccessibleElements:(NSArray *)accessibleElements +- (void)setAccessibilityElements:(NSArray *)accessibilityElements { - _accessibleElements = nil; + ASDisplayNodeAssertMainThread(); + _accessibilityElements = nil; } -- (NSArray *)accessibleElements +- (NSArray *)accessibilityElements { + ASDisplayNodeAssertMainThread(); + ASDisplayNode *viewNode = self.asyncdisplaykit_node; if (viewNode == nil) { return @[]; } - - if (_accessibleElements != nil) { - return _accessibleElements; + + if (_accessibilityElements == nil) { + NSMutableArray *accessibilityElements = [[NSMutableArray alloc] init]; + CollectAccessibilityElementsForView(self, accessibilityElements); + SortAccessibilityElements(accessibilityElements); + _accessibilityElements = accessibilityElements; } - NSMutableArray *accessibleElements = [[NSMutableArray alloc] init]; - CollectAccessibilityElementsForView(self, accessibleElements); - SortAccessibilityElements(accessibleElements); - _accessibleElements = accessibleElements; - - return _accessibleElements; -} - -- (NSInteger)accessibilityElementCount -{ - return self.accessibleElements.count; -} - -- (id)accessibilityElementAtIndex:(NSInteger)index -{ - return self.accessibleElements[index]; -} - -- (NSInteger)indexOfAccessibilityElement:(id)element -{ - return [self.accessibleElements indexOfObjectIdenticalTo:element]; + return _accessibilityElements; } @end diff --git a/Source/IGListAdapter+AsyncDisplayKit.h b/Source/IGListAdapter+AsyncDisplayKit.h index b5de9a7901..76b53c1933 100644 --- a/Source/IGListAdapter+AsyncDisplayKit.h +++ b/Source/IGListAdapter+AsyncDisplayKit.h @@ -2,17 +2,9 @@ // IGListAdapter+AsyncDisplayKit.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/IGListAdapter+AsyncDisplayKit.m b/Source/IGListAdapter+AsyncDisplayKit.m index 8f64ee0358..757a96d560 100644 --- a/Source/IGListAdapter+AsyncDisplayKit.m +++ b/Source/IGListAdapter+AsyncDisplayKit.m @@ -2,17 +2,9 @@ // IGListAdapter+AsyncDisplayKit.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Layout/ASAbsoluteLayoutElement.h b/Source/Layout/ASAbsoluteLayoutElement.h index e2227ecbbd..109816de20 100644 --- a/Source/Layout/ASAbsoluteLayoutElement.h +++ b/Source/Layout/ASAbsoluteLayoutElement.h @@ -2,17 +2,9 @@ // ASAbsoluteLayoutElement.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Layout/ASAbsoluteLayoutSpec.h b/Source/Layout/ASAbsoluteLayoutSpec.h index b518af4d0a..61bfbf8cd5 100644 --- a/Source/Layout/ASAbsoluteLayoutSpec.h +++ b/Source/Layout/ASAbsoluteLayoutSpec.h @@ -2,17 +2,9 @@ // ASAbsoluteLayoutSpec.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Layout/ASAbsoluteLayoutSpec.mm b/Source/Layout/ASAbsoluteLayoutSpec.mm index eede9ab766..e5edb272d8 100644 --- a/Source/Layout/ASAbsoluteLayoutSpec.mm +++ b/Source/Layout/ASAbsoluteLayoutSpec.mm @@ -2,21 +2,14 @@ // ASAbsoluteLayoutSpec.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import +#import #import #import #import @@ -72,7 +65,8 @@ }; NSArray *children = self.children; - NSMutableArray *sublayouts = [NSMutableArray arrayWithCapacity:children.count]; + ASLayout *rawSublayouts[children.count]; + int i = 0; for (id child in children) { CGPoint layoutPosition = child.style.layoutPosition; @@ -85,13 +79,14 @@ ASLayout *sublayout = [child layoutThatFits:childConstraint parentSize:size]; sublayout.position = layoutPosition; - [sublayouts addObject:sublayout]; + rawSublayouts[i++] = sublayout; } - + let sublayouts = [NSArray arrayByTransferring:rawSublayouts count:i]; + if (_sizing == ASAbsoluteLayoutSpecSizingSizeToFit || isnan(size.width)) { size.width = constrainedSize.min.width; for (ASLayout *sublayout in sublayouts) { - size.width = MAX(size.width, sublayout.position.x + sublayout.size.width); + size.width = MAX(size.width, sublayout.position.x + sublayout.size.width); } } diff --git a/Source/Layout/ASAsciiArtBoxCreator.h b/Source/Layout/ASAsciiArtBoxCreator.h index 2eca66e52a..83c7bec414 100644 --- a/Source/Layout/ASAsciiArtBoxCreator.h +++ b/Source/Layout/ASAsciiArtBoxCreator.h @@ -2,17 +2,9 @@ // ASAsciiArtBoxCreator.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Layout/ASAsciiArtBoxCreator.m b/Source/Layout/ASAsciiArtBoxCreator.m index e018978bd1..5b2488648e 100644 --- a/Source/Layout/ASAsciiArtBoxCreator.m +++ b/Source/Layout/ASAsciiArtBoxCreator.m @@ -2,17 +2,9 @@ // ASAsciiArtBoxCreator.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Layout/ASBackgroundLayoutSpec.h b/Source/Layout/ASBackgroundLayoutSpec.h index 883a9256bf..032a240bbd 100644 --- a/Source/Layout/ASBackgroundLayoutSpec.h +++ b/Source/Layout/ASBackgroundLayoutSpec.h @@ -2,17 +2,9 @@ // ASBackgroundLayoutSpec.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Layout/ASBackgroundLayoutSpec.mm b/Source/Layout/ASBackgroundLayoutSpec.mm index 1cdf270a75..30664fd92b 100644 --- a/Source/Layout/ASBackgroundLayoutSpec.mm +++ b/Source/Layout/ASBackgroundLayoutSpec.mm @@ -2,17 +2,9 @@ // ASBackgroundLayoutSpec.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import @@ -20,6 +12,7 @@ #import #import +#import static NSUInteger const kForegroundChildIndex = 0; static NSUInteger const kBackgroundChildIndex = 1; @@ -56,17 +49,19 @@ static NSUInteger const kBackgroundChildIndex = 1; { ASLayout *contentsLayout = [self.child layoutThatFits:constrainedSize parentSize:parentSize]; - NSMutableArray *sublayouts = [NSMutableArray arrayWithCapacity:2]; + ASLayout *rawSublayouts[2]; + int i = 0; if (self.background) { // Size background to exactly the same size. ASLayout *backgroundLayout = [self.background layoutThatFits:ASSizeRangeMake(contentsLayout.size) parentSize:parentSize]; backgroundLayout.position = CGPointZero; - [sublayouts addObject:backgroundLayout]; + rawSublayouts[i++] = backgroundLayout; } contentsLayout.position = CGPointZero; - [sublayouts addObject:contentsLayout]; + rawSublayouts[i++] = contentsLayout; + let sublayouts = [NSArray arrayByTransferring:rawSublayouts count:i]; return [ASLayout layoutWithLayoutElement:self size:contentsLayout.size sublayouts:sublayouts]; } diff --git a/Source/Layout/ASCenterLayoutSpec.h b/Source/Layout/ASCenterLayoutSpec.h index 132bd5edc7..dd1f99aa5a 100644 --- a/Source/Layout/ASCenterLayoutSpec.h +++ b/Source/Layout/ASCenterLayoutSpec.h @@ -2,17 +2,9 @@ // ASCenterLayoutSpec.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Layout/ASCenterLayoutSpec.mm b/Source/Layout/ASCenterLayoutSpec.mm index 230768faa3..107f317c0c 100644 --- a/Source/Layout/ASCenterLayoutSpec.mm +++ b/Source/Layout/ASCenterLayoutSpec.mm @@ -2,17 +2,9 @@ // ASCenterLayoutSpec.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Layout/ASCornerLayoutSpec.h b/Source/Layout/ASCornerLayoutSpec.h index 0ce9f3cee2..799c9c28c3 100644 --- a/Source/Layout/ASCornerLayoutSpec.h +++ b/Source/Layout/ASCornerLayoutSpec.h @@ -2,12 +2,8 @@ // ASCornerLayoutSpec.h // Texture // -// Copyright (c) 2017-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Layout/ASCornerLayoutSpec.mm b/Source/Layout/ASCornerLayoutSpec.mm index d2b88c70b9..6663b28935 100644 --- a/Source/Layout/ASCornerLayoutSpec.mm +++ b/Source/Layout/ASCornerLayoutSpec.mm @@ -2,12 +2,8 @@ // ASCornerLayoutSpec.mm // Texture // -// Copyright (c) 2017-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Layout/ASDimension.h b/Source/Layout/ASDimension.h index 462406eedb..0cad40d278 100644 --- a/Source/Layout/ASDimension.h +++ b/Source/Layout/ASDimension.h @@ -2,17 +2,9 @@ // ASDimension.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #pragma once diff --git a/Source/Layout/ASDimension.mm b/Source/Layout/ASDimension.mm index 2fd9cf63dd..4f581d7efd 100644 --- a/Source/Layout/ASDimension.mm +++ b/Source/Layout/ASDimension.mm @@ -2,17 +2,9 @@ // ASDimension.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import @@ -97,8 +89,8 @@ struct _Range { ASSizeRange ASSizeRangeIntersect(ASSizeRange sizeRange, ASSizeRange otherSizeRange) { - auto w = _Range({sizeRange.min.width, sizeRange.max.width}).intersect({otherSizeRange.min.width, otherSizeRange.max.width}); - auto h = _Range({sizeRange.min.height, sizeRange.max.height}).intersect({otherSizeRange.min.height, otherSizeRange.max.height}); + let w = _Range({sizeRange.min.width, sizeRange.max.width}).intersect({otherSizeRange.min.width, otherSizeRange.max.width}); + let h = _Range({sizeRange.min.height, sizeRange.max.height}).intersect({otherSizeRange.min.height, otherSizeRange.max.height}); return {{w.min, h.min}, {w.max, h.max}}; } diff --git a/Source/Layout/ASDimensionInternal.h b/Source/Layout/ASDimensionInternal.h index c853f425b2..df8f05600c 100644 --- a/Source/Layout/ASDimensionInternal.h +++ b/Source/Layout/ASDimensionInternal.h @@ -2,17 +2,9 @@ // ASDimensionInternal.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Layout/ASDimensionInternal.mm b/Source/Layout/ASDimensionInternal.mm index 1774a99367..8af3555252 100644 --- a/Source/Layout/ASDimensionInternal.mm +++ b/Source/Layout/ASDimensionInternal.mm @@ -2,17 +2,9 @@ // ASDimensionInternal.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Layout/ASInsetLayoutSpec.h b/Source/Layout/ASInsetLayoutSpec.h index a4bee3a764..8e22fe9bd2 100644 --- a/Source/Layout/ASInsetLayoutSpec.h +++ b/Source/Layout/ASInsetLayoutSpec.h @@ -2,17 +2,9 @@ // ASInsetLayoutSpec.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Layout/ASInsetLayoutSpec.mm b/Source/Layout/ASInsetLayoutSpec.mm index 23e0feace5..450480f1c4 100644 --- a/Source/Layout/ASInsetLayoutSpec.mm +++ b/Source/Layout/ASInsetLayoutSpec.mm @@ -2,17 +2,9 @@ // ASInsetLayoutSpec.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Layout/ASLayout+IGListKit.h b/Source/Layout/ASLayout+IGListKit.h new file mode 100644 index 0000000000..6f6753da2c --- /dev/null +++ b/Source/Layout/ASLayout+IGListKit.h @@ -0,0 +1,15 @@ +// +// ASLayout+IGListKit.h +// Texture +// +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 +// + +#if AS_IG_LIST_KIT +#import +#import +@interface ASLayout(IGListKit) +@end + +#endif // AS_IG_LIST_KIT diff --git a/Source/Layout/ASLayout+IGListKit.mm b/Source/Layout/ASLayout+IGListKit.mm new file mode 100644 index 0000000000..f9cc139e9c --- /dev/null +++ b/Source/Layout/ASLayout+IGListKit.mm @@ -0,0 +1,30 @@ +// +// ASLayout+IGListKit.mm +// Texture +// +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 +// +#import +#if AS_IG_LIST_KIT +#import "ASLayout+IGListKit.h" + +@interface ASLayout() { +@public + id _layoutElement; +} +@end + +@implementation ASLayout(IGListKit) + +- (id )diffIdentifier +{ + return self->_layoutElement; +} + +- (BOOL)isEqualToDiffableObject:(id )other +{ + return [self isEqual:other]; +} +@end +#endif // AS_IG_LIST_KIT diff --git a/Source/Layout/ASLayout.h b/Source/Layout/ASLayout.h index 6e0841b3a2..af4ecd9847 100644 --- a/Source/Layout/ASLayout.h +++ b/Source/Layout/ASLayout.h @@ -2,17 +2,9 @@ // ASLayout.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #pragma once @@ -130,16 +122,14 @@ AS_EXTERN ASLayout *ASCalculateLayout(idlayoutElement, const AS */ + (instancetype)layoutWithLayoutElement:(id)layoutElement size:(CGSize)size NS_RETURNS_RETAINED AS_WARN_UNUSED_RESULT; + /** * Traverses the existing layout tree and generates a new tree that represents only ASDisplayNode layouts */ - (ASLayout *)filteredNodeLayoutTree NS_RETURNS_RETAINED AS_WARN_UNUSED_RESULT; -@end - -@interface ASLayout (Unavailable) - - (instancetype)init NS_UNAVAILABLE; +- (instancetype)new NS_UNAVAILABLE; @end @@ -149,15 +139,11 @@ AS_EXTERN ASLayout *ASCalculateLayout(idlayoutElement, const AS /** * Set to YES to tell all ASLayout instances to retain their sublayout elements. Defaults to NO. - * Can be overridden at instance level. + * See `-retainSublayoutLayoutElements` to control this per-instance. + * + * Note: Weaver relies on this API. */ -+ (void)setShouldRetainSublayoutLayoutElements:(BOOL)shouldRetain; - -/** - * Whether or not ASLayout instances should retain their sublayout elements. - * Can be overridden at instance level. - */ -+ (BOOL)shouldRetainSublayoutLayoutElements; +@property (class) BOOL shouldRetainSublayoutLayoutElements; /** * Recrusively output the description of the layout tree. diff --git a/Source/Layout/ASLayout.mm b/Source/Layout/ASLayout.mm index 607a1c6483..ed92714481 100644 --- a/Source/Layout/ASLayout.mm +++ b/Source/Layout/ASLayout.mm @@ -2,23 +2,17 @@ // ASLayout.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import +#import #import +#import #import #import #import @@ -26,7 +20,6 @@ #import #import #import -#import CGPoint const ASPointNull = {NAN, NAN}; @@ -55,39 +48,11 @@ ASDISPLAYNODE_INLINE AS_WARN_UNUSED_RESULT BOOL ASLayoutIsDisplayNodeType(ASLayo return layout.type == ASLayoutElementTypeDisplayNode; } -ASDISPLAYNODE_INLINE AS_WARN_UNUSED_RESULT BOOL ASLayoutIsFlattened(ASLayout *layout) -{ - // A layout is flattened if its position is null, and all of its sublayouts are of type displaynode with no sublayouts. - if (! ASPointIsNull(layout.position)) { - return NO; - } - - for (ASLayout *sublayout in layout.sublayouts) { - if (ASLayoutIsDisplayNodeType(sublayout) == NO || sublayout.sublayouts.count > 0) { - return NO; - } - } - - return YES; -} - @interface ASLayout () { ASLayoutElementType _layoutElementType; + std::atomic_bool _retainSublayoutElements; } - -/* - * Caches all sublayouts if set to YES or destroys the sublayout cache if set to NO. Defaults to NO - */ -@property (nonatomic) BOOL retainSublayoutLayoutElements; - -/** - * Array for explicitly retain sublayout layout elements in case they are created and references in layoutSpecThatFits: and no one else will hold a strong reference on it - */ -@property (nonatomic) NSMutableArray> *sublayoutLayoutElements; - -@property (nonatomic, readonly) ASRectMap *elementToRectMap; - @end @implementation ASLayout @@ -115,7 +80,7 @@ static std::atomic_bool static_retainsSublayoutLayoutElements = ATOMIC_VAR_INIT( self = [super init]; if (self) { -#if DEBUG +#if ASDISPLAYNODE_ASSERTIONS_ENABLED for (ASLayout *sublayout in sublayouts) { ASDisplayNodeAssert(ASPointIsNull(sublayout.position) == NO, @"Invalid position is not allowed in sublayout."); } @@ -127,7 +92,7 @@ static std::atomic_bool static_retainsSublayoutLayoutElements = ATOMIC_VAR_INIT( _layoutElementType = layoutElement.layoutElementType; if (!ASIsCGSizeValidForSize(size)) { - ASDisplayNodeAssert(NO, @"layoutSize is invalid and unsafe to provide to Core Animation! Release configurations will force to 0, 0. Size = %@, node = %@", NSStringFromCGSize(size), layoutElement); + ASDisplayNodeFailAssert(@"layoutSize is invalid and unsafe to provide to Core Animation! Release configurations will force to 0, 0. Size = %@, node = %@", NSStringFromCGSize(size), layoutElement); size = CGSizeZero; } else { size = CGSizeMake(ASCeilPixelValue(size.width), ASCeilPixelValue(size.height)); @@ -140,27 +105,16 @@ static std::atomic_bool static_retainsSublayoutLayoutElements = ATOMIC_VAR_INIT( _position = position; } - _sublayouts = sublayouts != nil ? [sublayouts copy] : @[]; - - if (_sublayouts.count > 0) { - _elementToRectMap = [ASRectMap rectMapForWeakObjectPointers]; - for (ASLayout *layout in sublayouts) { - [_elementToRectMap setRect:layout.frame forKey:layout.layoutElement]; - } - } + _sublayouts = [sublayouts copy] ?: @[]; - self.retainSublayoutLayoutElements = [ASLayout shouldRetainSublayoutLayoutElements]; + if ([ASLayout shouldRetainSublayoutLayoutElements]) { + [self retainSublayoutElements]; + } } return self; } -- (instancetype)init -{ - ASDisplayNodeAssert(NO, @"Use the designated initializer"); - return [self init]; -} - #pragma mark - Class Constructors + (instancetype)layoutWithLayoutElement:(id)layoutElement @@ -192,83 +146,107 @@ static std::atomic_bool static_retainsSublayoutLayoutElements = ATOMIC_VAR_INIT( sublayouts:nil]; } -#pragma mark - Sublayout Elements Caching - -- (void)setRetainSublayoutLayoutElements:(BOOL)retainSublayoutLayoutElements +- (void)dealloc { - if (_retainSublayoutLayoutElements != retainSublayoutLayoutElements) { - _retainSublayoutLayoutElements = retainSublayoutLayoutElements; - - if (retainSublayoutLayoutElements == NO) { - _sublayoutLayoutElements = nil; - } else { - // Add sublayouts layout elements to an internal array to retain it while the layout lives - NSUInteger sublayoutCount = _sublayouts.count; - if (sublayoutCount > 0) { - _sublayoutLayoutElements = [NSMutableArray arrayWithCapacity:sublayoutCount]; - for (ASLayout *sublayout in _sublayouts) { - [_sublayoutLayoutElements addObject:sublayout.layoutElement]; - } + if (_retainSublayoutElements.load()) { + for (ASLayout *sublayout in _sublayouts) { + // We retained this, so there's no risk of it deallocating on us. + if (let cfElement = (__bridge CFTypeRef)sublayout->_layoutElement) { + CFRelease(cfElement); } } } } +#pragma mark - Sublayout Elements Caching + +- (void)retainSublayoutElements +{ + if (_retainSublayoutElements.exchange(true)) { + return; + } + + for (ASLayout *sublayout in _sublayouts) { + // CFBridgingRetain atomically casts and retains. We need the atomicity. + CFBridgingRetain(sublayout->_layoutElement); + } +} + #pragma mark - Layout Flattening +- (BOOL)isFlattened +{ + // A layout is flattened if its position is null, and all of its sublayouts are of type displaynode with no sublayouts. + if (!ASPointIsNull(_position)) { + return NO; + } + + for (ASLayout *sublayout in _sublayouts) { + if (ASLayoutIsDisplayNodeType(sublayout) == NO || sublayout->_sublayouts.count > 0) { + return NO; + } + } + + return YES; +} + - (ASLayout *)filteredNodeLayoutTree NS_RETURNS_RETAINED { - if (ASLayoutIsFlattened(self)) { - // All flattened layouts must have this flag enabled - // to ensure sublayout elements are retained until the layouts are applied. - self.retainSublayoutLayoutElements = YES; + if ([self isFlattened]) { + // All flattened layouts must retain sublayout elements until they are applied. + [self retainSublayoutElements]; return self; } struct Context { - ASLayout *layout; + unowned ASLayout *layout; CGPoint absolutePosition; }; // Queue used to keep track of sublayouts while traversing this layout in a DFS fashion. std::deque queue; - for (ASLayout *sublayout in self.sublayouts) { + for (ASLayout *sublayout in _sublayouts) { queue.push_back({sublayout, sublayout.position}); } - NSMutableArray *flattenedSublayouts = [[NSMutableArray alloc] init]; + std::vector flattenedSublayouts; while (!queue.empty()) { const Context context = std::move(queue.front()); queue.pop_front(); - ASLayout *layout = context.layout; - const NSArray *sublayouts = layout.sublayouts; - const NSUInteger sublayoutsCount = sublayouts.count; + unowned ASLayout *layout = context.layout; + // Direct ivar access to avoid retain/release, use existing +1. + const NSUInteger sublayoutsCount = layout->_sublayouts.count; const CGPoint absolutePosition = context.absolutePosition; if (ASLayoutIsDisplayNodeType(layout)) { if (sublayoutsCount > 0 || CGPointEqualToPoint(ASCeilPointValues(absolutePosition), layout.position) == NO) { // Only create a new layout if the existing one can't be reused, which means it has either some sublayouts or an invalid absolute position. - layout = [ASLayout layoutWithLayoutElement:layout.layoutElement - size:layout.size - position:absolutePosition - sublayouts:@[]]; + let newLayout = [ASLayout layoutWithLayoutElement:layout->_layoutElement + size:layout.size + position:absolutePosition + sublayouts:@[]]; + flattenedSublayouts.push_back(newLayout); + } else { + flattenedSublayouts.push_back(layout); } - [flattenedSublayouts addObject:layout]; - } else if (sublayoutsCount > 0){ - std::vector sublayoutContexts; - for (ASLayout *sublayout in sublayouts) { - sublayoutContexts.push_back({sublayout, absolutePosition + sublayout.position}); + } else if (sublayoutsCount > 0) { + // Fast-reverse-enumerate the sublayouts array by copying it into a C-array and push_front'ing each into the queue. + unowned ASLayout *rawSublayouts[sublayoutsCount]; + [layout->_sublayouts getObjects:rawSublayouts range:NSMakeRange(0, sublayoutsCount)]; + for (NSInteger i = sublayoutsCount - 1; i >= 0; i--) { + queue.push_front({rawSublayouts[i], absolutePosition + rawSublayouts[i].position}); } - queue.insert(queue.cbegin(), sublayoutContexts.begin(), sublayoutContexts.end()); } } - ASLayout *layout = [ASLayout layoutWithLayoutElement:_layoutElement size:_size sublayouts:flattenedSublayouts]; - // All flattened layouts must have this flag enabled - // to ensure sublayout elements are retained until the layouts are applied. - layout.retainSublayoutLayoutElements = YES; + NSArray *array = [NSArray arrayByTransferring:flattenedSublayouts.data() count:flattenedSublayouts.size()]; + // flattenedSublayouts is now all nils. + + ASLayout *layout = [ASLayout layoutWithLayoutElement:_layoutElement size:_size sublayouts:array]; + // All flattened layouts must retain sublayout elements until they are applied. + [layout retainSublayoutElements]; return layout; } @@ -276,6 +254,8 @@ static std::atomic_bool static_retainsSublayoutLayoutElements = ATOMIC_VAR_INIT( - (BOOL)isEqual:(id)object { + if (self == object) return YES; + ASLayout *layout = ASDynamicCast(object, ASLayout); if (layout == nil) { return NO; @@ -303,7 +283,12 @@ static std::atomic_bool static_retainsSublayoutLayoutElements = ATOMIC_VAR_INIT( - (CGRect)frameForElement:(id)layoutElement { - return _elementToRectMap ? [_elementToRectMap rectForKey:layoutElement] : CGRectNull; + for (ASLayout *l in _sublayouts) { + if (l->_layoutElement == layoutElement) { + return l.frame; + } + } + return CGRectNull; } - (CGRect)frame @@ -341,11 +326,11 @@ static std::atomic_bool static_retainsSublayoutLayoutElements = ATOMIC_VAR_INIT( NSMutableArray *result = [NSMutableArray array]; [result addObject:@{ @"size" : [NSValue valueWithCGSize:self.size] }]; - if (auto layoutElement = self.layoutElement) { + if (let layoutElement = self.layoutElement) { [result addObject:@{ @"layoutElement" : layoutElement }]; } - auto pos = self.position; + let pos = self.position; if (!ASPointIsNull(pos)) { [result addObject:@{ @"position" : [NSValue valueWithCGPoint:pos] }]; } @@ -378,7 +363,7 @@ static std::atomic_bool static_retainsSublayoutLayoutElements = ATOMIC_VAR_INIT( ASLayout *ASCalculateLayout(id layoutElement, const ASSizeRange sizeRange, const CGSize parentSize) { - ASDisplayNodeCAssertNotNil(layoutElement, @"Not valid layoutElement passed in."); + NSCParameterAssert(layoutElement != nil); return [layoutElement layoutThatFits:sizeRange parentSize:parentSize]; } diff --git a/Source/Layout/ASLayoutElement.h b/Source/Layout/ASLayoutElement.h index 417550aa01..c4ba689cfc 100644 --- a/Source/Layout/ASLayoutElement.h +++ b/Source/Layout/ASLayoutElement.h @@ -2,17 +2,9 @@ // ASLayoutElement.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Layout/ASLayoutElement.mm b/Source/Layout/ASLayoutElement.mm index a5286eeae1..da5abbd623 100644 --- a/Source/Layout/ASLayoutElement.mm +++ b/Source/Layout/ASLayoutElement.mm @@ -2,17 +2,9 @@ // ASLayoutElement.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import @@ -51,66 +43,68 @@ CGSize const ASLayoutElementParentSizeUndefined = {ASLayoutElementParentDimensio int32_t const ASLayoutElementContextInvalidTransitionID = 0; int32_t const ASLayoutElementContextDefaultTransitionID = ASLayoutElementContextInvalidTransitionID + 1; -#ifdef MINIMAL_ASDK -static ASLayoutElementContext *mainThreadTlsContext = nil; +#if AS_TLS_AVAILABLE -static ASLayoutElementContext *get_tls_context() { - if ([NSThread isMainThread]) { - return mainThreadTlsContext; - } else { - return [NSThread currentThread].threadDictionary[@"ASDK_tls_context"]; - } -} - -static void set_tls_context(ASLayoutElementContext *value) { - if ([NSThread isMainThread]) { - mainThreadTlsContext = value; - } else { - if (value != nil) { - [NSThread currentThread].threadDictionary[@"ASDK_tls_context"] = value; - } else { - [[NSThread currentThread].threadDictionary removeObjectForKey:@"ASDK_tls_context"]; - } - } -} -#else static _Thread_local __unsafe_unretained ASLayoutElementContext *tls_context; -#endif void ASLayoutElementPushContext(ASLayoutElementContext *context) { -#ifdef MINIMAL_ASDK - // NOTE: It would be easy to support nested contexts – just use an NSMutableArray here. - ASDisplayNodeCAssertNil(get_tls_context(), @"Nested ASLayoutElementContexts aren't supported."); - - ; - set_tls_context(context); -#else // NOTE: It would be easy to support nested contexts – just use an NSMutableArray here. ASDisplayNodeCAssertNil(tls_context, @"Nested ASLayoutElementContexts aren't supported."); tls_context = (__bridge ASLayoutElementContext *)(__bridge_retained CFTypeRef)context; -#endif } ASLayoutElementContext *ASLayoutElementGetCurrentContext() { // Don't retain here. Caller will retain if it wants to! - return get_tls_context(); + return tls_context; } void ASLayoutElementPopContext() { -#ifdef MINIMAL_ASDK - ASDisplayNodeCAssertNotNil(get_tls_context(), @"Attempt to pop context when there wasn't a context!"); - set_tls_context(nil); -#else ASDisplayNodeCAssertNotNil(tls_context, @"Attempt to pop context when there wasn't a context!"); CFRelease((__bridge CFTypeRef)tls_context); tls_context = nil; #endif } +#else + +static pthread_key_t ASLayoutElementContextKey() { + static pthread_key_t k; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + pthread_key_create(&k, NULL); + }); + return k; +} +void ASLayoutElementPushContext(ASLayoutElementContext *context) +{ + // NOTE: It would be easy to support nested contexts – just use an NSMutableArray here. + ASDisplayNodeCAssertNil(pthread_getspecific(ASLayoutElementContextKey()), @"Nested ASLayoutElementContexts aren't supported."); + + let cfCtx = (__bridge_retained CFTypeRef)context; + pthread_setspecific(ASLayoutElementContextKey(), cfCtx); +} + +ASLayoutElementContext *ASLayoutElementGetCurrentContext() +{ + // Don't retain here. Caller will retain if it wants to! + let ctxPtr = pthread_getspecific(ASLayoutElementContextKey()); + return (__bridge ASLayoutElementContext *)ctxPtr; +} + +void ASLayoutElementPopContext() +{ + let ctx = (CFTypeRef)pthread_getspecific(ASLayoutElementContextKey()); + ASDisplayNodeCAssertNotNil(ctx, @"Attempt to pop context when there wasn't a context!"); + CFRelease(ctx); + pthread_setspecific(ASLayoutElementContextKey(), NULL); +} + +#endif // AS_TLS_AVAILABLE + #pragma mark - ASLayoutElementStyle NSString * const ASLayoutElementStyleWidthProperty = @"ASLayoutElementStyleWidthProperty"; diff --git a/Source/Layout/ASLayoutElementExtensibility.h b/Source/Layout/ASLayoutElementExtensibility.h index 1afddd9c91..f46b63e812 100644 --- a/Source/Layout/ASLayoutElementExtensibility.h +++ b/Source/Layout/ASLayoutElementExtensibility.h @@ -2,17 +2,9 @@ // ASLayoutElementExtensibility.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Layout/ASLayoutElementPrivate.h b/Source/Layout/ASLayoutElementPrivate.h index 263b2f84de..cf699f42a2 100644 --- a/Source/Layout/ASLayoutElementPrivate.h +++ b/Source/Layout/ASLayoutElementPrivate.h @@ -2,17 +2,9 @@ // ASLayoutElementPrivate.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Layout/ASLayoutSpec+Subclasses.h b/Source/Layout/ASLayoutSpec+Subclasses.h index 17ddc20bdc..34bf6e069f 100644 --- a/Source/Layout/ASLayoutSpec+Subclasses.h +++ b/Source/Layout/ASLayoutSpec+Subclasses.h @@ -2,17 +2,9 @@ // ASLayoutSpec+Subclasses.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Layout/ASLayoutSpec+Subclasses.mm b/Source/Layout/ASLayoutSpec+Subclasses.mm index 9e98806152..17ff53e6c5 100644 --- a/Source/Layout/ASLayoutSpec+Subclasses.mm +++ b/Source/Layout/ASLayoutSpec+Subclasses.mm @@ -2,17 +2,9 @@ // ASLayoutSpec+Subclasses.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Layout/ASLayoutSpec.h b/Source/Layout/ASLayoutSpec.h index 7bc7f3ef4c..c7aa01c386 100644 --- a/Source/Layout/ASLayoutSpec.h +++ b/Source/Layout/ASLayoutSpec.h @@ -2,17 +2,9 @@ // ASLayoutSpec.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Layout/ASLayoutSpec.mm b/Source/Layout/ASLayoutSpec.mm index 7b70df4e3d..dc8827d705 100644 --- a/Source/Layout/ASLayoutSpec.mm +++ b/Source/Layout/ASLayoutSpec.mm @@ -2,17 +2,9 @@ // ASLayoutSpec.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import @@ -20,6 +12,7 @@ #import +#import #import #import #import @@ -120,14 +113,12 @@ ASLayoutElementLayoutCalculationDefaults { ASDisplayNodeAssert(self.isMutable, @"Cannot set properties when layout spec is not mutable"); - [_childrenArray removeAllObjects]; - - NSUInteger i = 0; +#if ASDISPLAYNODE_ASSERTIONS_ENABLED for (id child in children) { ASDisplayNodeAssert([child conformsToProtocol:NSProtocolFromString(@"ASLayoutElement")], @"Child %@ of spec %@ is not an ASLayoutElement!", child, self); - _childrenArray[i] = child; - i += 1; } +#endif + [_childrenArray setArray:children]; } - (nullable NSArray> *)children @@ -165,10 +156,10 @@ ASLayoutElementStyleExtensibilityForwarding - (NSMutableArray *)propertiesForDescription { - auto result = [NSMutableArray array]; + let result = [NSMutableArray array]; if (NSArray *children = self.children) { // Use tiny descriptions because these trees can get nested very deep. - auto tinyDescriptions = ASArrayByFlatMapping(children, id object, ASObjectDescriptionMakeTiny(object)); + let tinyDescriptions = ASArrayByFlatMapping(children, id object, ASObjectDescriptionMakeTiny(object)); [result addObject:@{ @"children": tinyDescriptions }]; } return result; @@ -298,7 +289,9 @@ ASSynthesizeLockingMethodsWithMutex(__instanceLock__) - (ASLayout *)calculateLayoutThatFits:(ASSizeRange)constrainedSize { NSArray *children = self.children; - NSMutableArray *sublayouts = [NSMutableArray arrayWithCapacity:children.count]; + let count = children.count; + ASLayout *rawSublayouts[count]; + int i = 0; CGSize size = constrainedSize.min; for (id child in children) { @@ -308,9 +301,9 @@ ASSynthesizeLockingMethodsWithMutex(__instanceLock__) size.width = MAX(size.width, sublayout.size.width); size.height = MAX(size.height, sublayout.size.height); - [sublayouts addObject:sublayout]; + rawSublayouts[i++] = sublayout; } - + let sublayouts = [NSArray arrayByTransferring:rawSublayouts count:i]; return [ASLayout layoutWithLayoutElement:self size:size sublayouts:sublayouts]; } diff --git a/Source/Layout/ASOverlayLayoutSpec.h b/Source/Layout/ASOverlayLayoutSpec.h index b40c9d4e02..a29a72b750 100644 --- a/Source/Layout/ASOverlayLayoutSpec.h +++ b/Source/Layout/ASOverlayLayoutSpec.h @@ -2,17 +2,9 @@ // ASOverlayLayoutSpec.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Layout/ASOverlayLayoutSpec.mm b/Source/Layout/ASOverlayLayoutSpec.mm index 77f8239da9..f1cbe48848 100644 --- a/Source/Layout/ASOverlayLayoutSpec.mm +++ b/Source/Layout/ASOverlayLayoutSpec.mm @@ -2,22 +2,15 @@ // ASOverlayLayoutSpec.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import #import #import +#import static NSUInteger const kUnderlayChildIndex = 0; static NSUInteger const kOverlayChildIndex = 1; @@ -78,14 +71,17 @@ static NSUInteger const kOverlayChildIndex = 1; { ASLayout *contentsLayout = [self.child layoutThatFits:constrainedSize parentSize:parentSize]; contentsLayout.position = CGPointZero; - NSMutableArray *sublayouts = [NSMutableArray arrayWithObject:contentsLayout]; + ASLayout *rawSublayouts[2]; + int i = 0; + rawSublayouts[i++] = contentsLayout; if (self.overlay) { ASLayout *overlayLayout = [self.overlay layoutThatFits:ASSizeRangeMake(contentsLayout.size) parentSize:contentsLayout.size]; overlayLayout.position = CGPointZero; - [sublayouts addObject:overlayLayout]; + rawSublayouts[i++] = overlayLayout; } + let sublayouts = [NSArray arrayByTransferring:rawSublayouts count:i]; return [ASLayout layoutWithLayoutElement:self size:contentsLayout.size sublayouts:sublayouts]; } diff --git a/Source/Layout/ASRatioLayoutSpec.h b/Source/Layout/ASRatioLayoutSpec.h index bc3e6edbec..b70e6fe7fb 100644 --- a/Source/Layout/ASRatioLayoutSpec.h +++ b/Source/Layout/ASRatioLayoutSpec.h @@ -2,17 +2,9 @@ // ASRatioLayoutSpec.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Layout/ASRatioLayoutSpec.mm b/Source/Layout/ASRatioLayoutSpec.mm index aec3a9c8f1..38987402c4 100644 --- a/Source/Layout/ASRatioLayoutSpec.mm +++ b/Source/Layout/ASRatioLayoutSpec.mm @@ -2,17 +2,9 @@ // ASRatioLayoutSpec.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import @@ -83,7 +75,7 @@ } // Choose the size closest to the desired ratio. - const auto &bestSize = std::max_element(sizeOptions.begin(), sizeOptions.end(), [&](const CGSize &a, const CGSize &b){ + let &bestSize = std::max_element(sizeOptions.begin(), sizeOptions.end(), [&](const CGSize &a, const CGSize &b){ return std::fabs((a.height / a.width) - _ratio) > std::fabs((b.height / b.width) - _ratio); }); diff --git a/Source/Layout/ASRelativeLayoutSpec.h b/Source/Layout/ASRelativeLayoutSpec.h index a4f7774b47..9b260d9ccc 100644 --- a/Source/Layout/ASRelativeLayoutSpec.h +++ b/Source/Layout/ASRelativeLayoutSpec.h @@ -2,17 +2,9 @@ // ASRelativeLayoutSpec.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Layout/ASRelativeLayoutSpec.mm b/Source/Layout/ASRelativeLayoutSpec.mm index b14795d27f..f096ce51d4 100644 --- a/Source/Layout/ASRelativeLayoutSpec.mm +++ b/Source/Layout/ASRelativeLayoutSpec.mm @@ -2,17 +2,9 @@ // ASRelativeLayoutSpec.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Layout/ASStackLayoutDefines.h b/Source/Layout/ASStackLayoutDefines.h index 8490a5389a..8a86be1b5a 100644 --- a/Source/Layout/ASStackLayoutDefines.h +++ b/Source/Layout/ASStackLayoutDefines.h @@ -2,17 +2,9 @@ // ASStackLayoutDefines.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Layout/ASStackLayoutElement.h b/Source/Layout/ASStackLayoutElement.h index 9288b71b7b..46b263b4ff 100644 --- a/Source/Layout/ASStackLayoutElement.h +++ b/Source/Layout/ASStackLayoutElement.h @@ -2,17 +2,9 @@ // ASStackLayoutElement.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Layout/ASStackLayoutSpec.h b/Source/Layout/ASStackLayoutSpec.h index 65788a2f5a..535758ac7b 100644 --- a/Source/Layout/ASStackLayoutSpec.h +++ b/Source/Layout/ASStackLayoutSpec.h @@ -2,17 +2,9 @@ // ASStackLayoutSpec.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Layout/ASStackLayoutSpec.mm b/Source/Layout/ASStackLayoutSpec.mm index 3952ab6e8b..93a693b1c9 100644 --- a/Source/Layout/ASStackLayoutSpec.mm +++ b/Source/Layout/ASStackLayoutSpec.mm @@ -2,17 +2,9 @@ // ASStackLayoutSpec.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import @@ -20,6 +12,7 @@ #import #import +#import #import #import #import @@ -159,12 +152,14 @@ self.style.ascender = stackChildren.front().style.ascender; self.style.descender = stackChildren.back().style.descender; } - - auto sublayouts = [[NSMutableArray alloc] init]; + + ASLayout *rawSublayouts[positionedLayout.items.size()]; + int i = 0; for (const auto &item : positionedLayout.items) { - [sublayouts addObject:item.layout]; + rawSublayouts[i++] = item.layout; } + let sublayouts = [NSArray arrayByTransferring:rawSublayouts count:i]; return [ASLayout layoutWithLayoutElement:self size:positionedLayout.size sublayouts:sublayouts]; } diff --git a/Source/Layout/ASYogaLayoutSpec.h b/Source/Layout/ASYogaLayoutSpec.h deleted file mode 100644 index 75c9d09bec..0000000000 --- a/Source/Layout/ASYogaLayoutSpec.h +++ /dev/null @@ -1,24 +0,0 @@ -// -// ASYogaLayoutSpec.h -// Texture -// -// Copyright (c) 2017-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#if YOGA /* YOGA */ - -#import -#import - -@interface ASYogaLayoutSpec : ASLayoutSpec -@property (nonatomic, nonnull) ASDisplayNode *rootNode; -@end - -#endif /* YOGA */ diff --git a/Source/Layout/ASYogaLayoutSpec.mm b/Source/Layout/ASYogaLayoutSpec.mm deleted file mode 100644 index e0cc80e512..0000000000 --- a/Source/Layout/ASYogaLayoutSpec.mm +++ /dev/null @@ -1,177 +0,0 @@ -// -// ASYogaLayoutSpec.mm -// Texture -// -// Copyright (c) 2017-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#if YOGA /* YOGA */ - -#import -#import -#import -#import -#import - -#define YOGA_LAYOUT_LOGGING 0 - -@implementation ASYogaLayoutSpec - -- (ASLayout *)layoutForYogaNode:(YGNodeRef)yogaNode -{ - BOOL isRootNode = (YGNodeGetParent(yogaNode) == NULL); - uint32_t childCount = YGNodeGetChildCount(yogaNode); - - NSMutableArray *sublayouts = [NSMutableArray arrayWithCapacity:childCount]; - for (uint32_t i = 0; i < childCount; i++) { - [sublayouts addObject:[self layoutForYogaNode:YGNodeGetChild(yogaNode, i)]]; - } - - id layoutElement = (__bridge id )YGNodeGetContext(yogaNode); - CGSize size = CGSizeMake(YGNodeLayoutGetWidth(yogaNode), YGNodeLayoutGetHeight(yogaNode)); - - if (isRootNode) { - // The layout for root should have position CGPointNull, but include the calculated size. - return [ASLayout layoutWithLayoutElement:layoutElement size:size sublayouts:sublayouts]; - } else { - CGPoint position = CGPointMake(YGNodeLayoutGetLeft(yogaNode), YGNodeLayoutGetTop(yogaNode)); - return [ASLayout layoutWithLayoutElement:layoutElement size:size position:position sublayouts:nil]; - } -} - -- (void)destroyYogaNode:(YGNodeRef)yogaNode -{ - // Release the __bridge_retained Context object. - __unused id element = (__bridge_transfer id)YGNodeGetContext(yogaNode); - YGNodeFree(yogaNode); -} - -- (void)setupYogaNode:(YGNodeRef)yogaNode forElement:(id )element withParentYogaNode:(YGNodeRef)parentYogaNode -{ - ASLayoutElementStyle *style = element.style; - - // Retain the Context object. This must be explicitly released with a __bridge_transfer; YGNodeFree() is not sufficient. - YGNodeSetContext(yogaNode, (__bridge_retained void *)element); - - YGNodeStyleSetDirection (yogaNode, style.direction); - - YGNodeStyleSetFlexWrap (yogaNode, style.flexWrap); - YGNodeStyleSetFlexGrow (yogaNode, style.flexGrow); - YGNodeStyleSetFlexShrink (yogaNode, style.flexShrink); - YGNODE_STYLE_SET_DIMENSION (yogaNode, FlexBasis, style.flexBasis); - - YGNodeStyleSetFlexDirection (yogaNode, yogaFlexDirection(style.flexDirection)); - YGNodeStyleSetJustifyContent(yogaNode, yogaJustifyContent(style.justifyContent)); - YGNodeStyleSetAlignSelf (yogaNode, yogaAlignSelf(style.alignSelf)); - ASStackLayoutAlignItems alignItems = style.alignItems; - if (alignItems != ASStackLayoutAlignItemsNotSet) { - YGNodeStyleSetAlignItems(yogaNode, yogaAlignItems(alignItems)); - } - - YGNodeStyleSetPositionType (yogaNode, style.positionType); - ASEdgeInsets position = style.position; - ASEdgeInsets margin = style.margin; - ASEdgeInsets padding = style.padding; - ASEdgeInsets border = style.border; - - YGEdge edge = YGEdgeLeft; - for (int i = 0; i < YGEdgeAll + 1; ++i) { - YGNODE_STYLE_SET_DIMENSION_WITH_EDGE(yogaNode, Position, dimensionForEdgeWithEdgeInsets(edge, position), edge); - YGNODE_STYLE_SET_DIMENSION_WITH_EDGE(yogaNode, Margin, dimensionForEdgeWithEdgeInsets(edge, margin), edge); - YGNODE_STYLE_SET_DIMENSION_WITH_EDGE(yogaNode, Padding, dimensionForEdgeWithEdgeInsets(edge, padding), edge); - YGNODE_STYLE_SET_FLOAT_WITH_EDGE(yogaNode, Border, dimensionForEdgeWithEdgeInsets(edge, border), edge); - edge = (YGEdge)(edge + 1); - } - - CGFloat aspectRatio = style.aspectRatio; - if (aspectRatio > FLT_EPSILON && aspectRatio < CGFLOAT_MAX / 2.0) { - YGNodeStyleSetAspectRatio(yogaNode, aspectRatio); - } - - // For the root node, we use rootConstrainedSize above. For children, consult the style for their size. - if (parentYogaNode != NULL) { - YGNodeInsertChild(parentYogaNode, yogaNode, YGNodeGetChildCount(parentYogaNode)); - - YGNODE_STYLE_SET_DIMENSION(yogaNode, Width, style.width); - YGNODE_STYLE_SET_DIMENSION(yogaNode, Height, style.height); - - YGNODE_STYLE_SET_DIMENSION(yogaNode, MinWidth, style.minWidth); - YGNODE_STYLE_SET_DIMENSION(yogaNode, MinHeight, style.minHeight); - - YGNODE_STYLE_SET_DIMENSION(yogaNode, MaxWidth, style.maxWidth); - YGNODE_STYLE_SET_DIMENSION(yogaNode, MaxHeight, style.maxHeight); - - YGNodeSetMeasureFunc(yogaNode, &ASLayoutElementYogaMeasureFunc); - } - - // TODO(appleguy): STYLE SETTER METHODS LEFT TO IMPLEMENT: YGNodeStyleSetOverflow, YGNodeStyleSetFlex -} - -- (ASLayout *)calculateLayoutThatFits:(ASSizeRange)constrainedSize - restrictedToSize:(ASLayoutElementSize)layoutElementSize - relativeToParentSize:(CGSize)parentSize -{ - ASSizeRange styleAndParentSize = ASLayoutElementSizeResolve(layoutElementSize, parentSize); - const ASSizeRange rootConstrainedSize = ASSizeRangeIntersect(constrainedSize, styleAndParentSize); - - YGNodeRef rootYogaNode = YGNodeNew(); - - // YGNodeCalculateLayout currently doesn't offer the ability to pass a minimum size (max is passed there). - // Apply the constrainedSize.min directly to the root node so that layout accounts for it. - YGNodeStyleSetMinWidth (rootYogaNode, yogaFloatForCGFloat(rootConstrainedSize.min.width)); - YGNodeStyleSetMinHeight(rootYogaNode, yogaFloatForCGFloat(rootConstrainedSize.min.height)); - - // It's crucial to set these values. YGNodeCalculateLayout has unusual behavior for its width and height parameters: - // 1. If no maximum size set, infer this means YGMeasureModeExactly. Even if a small minWidth & minHeight are set, - // these will never be used because the output size of the root will always exactly match this value. - // 2. If a maximum size is set, infer that this means YGMeasureModeAtMost, and allow down to the min* values in output. - YGNodeStyleSetMaxWidthPercent(rootYogaNode, 100.0); - YGNodeStyleSetMaxHeightPercent(rootYogaNode, 100.0); - - [self setupYogaNode:rootYogaNode forElement:self.rootNode withParentYogaNode:NULL]; - for (id child in self.children) { - YGNodeRef yogaNode = YGNodeNew(); - [self setupYogaNode:yogaNode forElement:child withParentYogaNode:rootYogaNode]; - } - - // It is crucial to use yogaFloat... to convert CGFLOAT_MAX into YGUndefined here. - YGNodeCalculateLayout(rootYogaNode, - yogaFloatForCGFloat(rootConstrainedSize.max.width), - yogaFloatForCGFloat(rootConstrainedSize.max.height), - YGDirectionInherit); - - ASLayout *layout = [self layoutForYogaNode:rootYogaNode]; - -#if YOGA_LAYOUT_LOGGING - // Concurrent layouts will interleave the NSLog messages unless we serialize. - // Use @synchornize rather than trampolining to the main thread so the tree state isn't changed. - @synchronized ([ASDisplayNode class]) { - NSLog(@"****************************************************************************"); - NSLog(@"******************** STARTING YOGA -> ASLAYOUT CREATION ********************"); - NSLog(@"****************************************************************************"); - NSLog(@"node = %@", self.rootNode); - NSLog(@"style = %@", self.rootNode.style); - YGNodePrint(rootYogaNode, (YGPrintOptions)(YGPrintOptionsStyle | YGPrintOptionsLayout)); - } - NSLog(@"rootConstraint = (%@, %@), layout = %@, sublayouts = %@", NSStringFromCGSize(rootConstrainedSize.min), NSStringFromCGSize(rootConstrainedSize.max), layout, layout.sublayouts); -#endif - - while(YGNodeGetChildCount(rootYogaNode) > 0) { - YGNodeRef yogaNode = YGNodeGetChild(rootYogaNode, 0); - [self destroyYogaNode:yogaNode]; - } - [self destroyYogaNode:rootYogaNode]; - - return layout; -} - -@end - -#endif /* YOGA */ diff --git a/Source/Layout/ASYogaUtilities.h b/Source/Layout/ASYogaUtilities.h index aac1eaf240..cad80ecb0f 100644 --- a/Source/Layout/ASYogaUtilities.h +++ b/Source/Layout/ASYogaUtilities.h @@ -2,12 +2,8 @@ // ASYogaUtilities.h // Texture // -// Copyright (c) 2017-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Layout/ASYogaUtilities.mm b/Source/Layout/ASYogaUtilities.mm index 47a6119a8a..2cca2307c3 100644 --- a/Source/Layout/ASYogaUtilities.mm +++ b/Source/Layout/ASYogaUtilities.mm @@ -2,12 +2,8 @@ // ASYogaUtilities.mm // Texture // -// Copyright (c) 2017-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Private/ASBasicImageDownloaderInternal.h b/Source/Private/ASBasicImageDownloaderInternal.h index 6d9fb5b61a..ba06e0bc81 100644 --- a/Source/Private/ASBasicImageDownloaderInternal.h +++ b/Source/Private/ASBasicImageDownloaderInternal.h @@ -2,17 +2,9 @@ // ASBasicImageDownloaderInternal.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // @interface ASBasicImageDownloaderContext : NSObject diff --git a/Source/Private/ASBatchFetching.h b/Source/Private/ASBatchFetching.h index e0746ab0fd..0358bf12cc 100644 --- a/Source/Private/ASBatchFetching.h +++ b/Source/Private/ASBatchFetching.h @@ -2,17 +2,9 @@ // ASBatchFetching.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK diff --git a/Source/Private/ASBatchFetching.m b/Source/Private/ASBatchFetching.m index 9365b505b1..ee39e6d4e6 100644 --- a/Source/Private/ASBatchFetching.m +++ b/Source/Private/ASBatchFetching.m @@ -2,17 +2,9 @@ // ASBatchFetching.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK diff --git a/Source/Private/ASCellNode+Internal.h b/Source/Private/ASCellNode+Internal.h index c3f1d23037..4c3e63d652 100644 --- a/Source/Private/ASCellNode+Internal.h +++ b/Source/Private/ASCellNode+Internal.h @@ -2,17 +2,9 @@ // ASCellNode+Internal.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK diff --git a/Source/Private/ASCollectionLayout.h b/Source/Private/ASCollectionLayout.h index e956e135ac..6ba15e96eb 100644 --- a/Source/Private/ASCollectionLayout.h +++ b/Source/Private/ASCollectionLayout.h @@ -2,12 +2,8 @@ // ASCollectionLayout.h // Texture // -// Copyright (c) 2017-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK diff --git a/Source/Private/ASCollectionLayout.mm b/Source/Private/ASCollectionLayout.mm index 72dde7eb55..59697f0820 100644 --- a/Source/Private/ASCollectionLayout.mm +++ b/Source/Private/ASCollectionLayout.mm @@ -2,17 +2,9 @@ // ASCollectionLayout.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK diff --git a/Source/Private/ASCollectionLayoutCache.h b/Source/Private/ASCollectionLayoutCache.h index 9a71b802c0..857e43683f 100644 --- a/Source/Private/ASCollectionLayoutCache.h +++ b/Source/Private/ASCollectionLayoutCache.h @@ -2,12 +2,8 @@ // ASCollectionLayoutCache.h // Texture // -// Copyright (c) 2017-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK diff --git a/Source/Private/ASCollectionLayoutCache.mm b/Source/Private/ASCollectionLayoutCache.mm index d79f512e1a..cf68dcd5d2 100644 --- a/Source/Private/ASCollectionLayoutCache.mm +++ b/Source/Private/ASCollectionLayoutCache.mm @@ -2,12 +2,8 @@ // ASCollectionLayoutCache.mm // Texture // -// Copyright (c) 2017-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK @@ -64,7 +60,7 @@ } ASDN::MutexLocker l(__instanceLock__); - auto innerMap = [_map objectForKey:elements]; + var innerMap = [_map objectForKey:elements]; if (innerMap == nil) { innerMap = [NSMapTable strongToStrongObjectsMapTable]; [_map setObject:innerMap forKey:elements]; diff --git a/Source/Private/ASCollectionLayoutContext+Private.h b/Source/Private/ASCollectionLayoutContext+Private.h index b188040bd8..2ff68e17bc 100644 --- a/Source/Private/ASCollectionLayoutContext+Private.h +++ b/Source/Private/ASCollectionLayoutContext+Private.h @@ -2,17 +2,9 @@ // ASCollectionLayoutContext+Private.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK diff --git a/Source/Private/ASCollectionLayoutDefines.h b/Source/Private/ASCollectionLayoutDefines.h index 3c05cae4ae..61a8ac4e88 100644 --- a/Source/Private/ASCollectionLayoutDefines.h +++ b/Source/Private/ASCollectionLayoutDefines.h @@ -2,12 +2,8 @@ // ASCollectionLayoutDefines.h // Texture // -// Copyright (c) 2017-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Private/ASCollectionLayoutDefines.m b/Source/Private/ASCollectionLayoutDefines.m index ba1abb0b8f..0087af536a 100644 --- a/Source/Private/ASCollectionLayoutDefines.m +++ b/Source/Private/ASCollectionLayoutDefines.m @@ -2,12 +2,8 @@ // ASCollectionLayoutDefines.m // Texture // -// Copyright (c) 2017-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Private/ASCollectionLayoutState+Private.h b/Source/Private/ASCollectionLayoutState+Private.h index 3181610daa..c4d6013332 100644 --- a/Source/Private/ASCollectionLayoutState+Private.h +++ b/Source/Private/ASCollectionLayoutState+Private.h @@ -2,12 +2,8 @@ // ASCollectionLayoutState+Private.h // Texture // -// Copyright (c) 2017-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK diff --git a/Source/Private/ASCollectionView+Undeprecated.h b/Source/Private/ASCollectionView+Undeprecated.h index 3be3911abc..050e029313 100644 --- a/Source/Private/ASCollectionView+Undeprecated.h +++ b/Source/Private/ASCollectionView+Undeprecated.h @@ -2,17 +2,9 @@ // ASCollectionView+Undeprecated.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK diff --git a/Source/Private/ASCollectionViewFlowLayoutInspector.h b/Source/Private/ASCollectionViewFlowLayoutInspector.h index a6beb02729..0553dcd0b6 100644 --- a/Source/Private/ASCollectionViewFlowLayoutInspector.h +++ b/Source/Private/ASCollectionViewFlowLayoutInspector.h @@ -2,17 +2,9 @@ // ASCollectionViewFlowLayoutInspector.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK diff --git a/Source/Private/ASCollectionViewFlowLayoutInspector.m b/Source/Private/ASCollectionViewFlowLayoutInspector.m index 44acad23ea..79230de4cb 100644 --- a/Source/Private/ASCollectionViewFlowLayoutInspector.m +++ b/Source/Private/ASCollectionViewFlowLayoutInspector.m @@ -2,17 +2,9 @@ // ASCollectionViewFlowLayoutInspector.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK #import diff --git a/Source/Private/ASControlNode+Private.h b/Source/Private/ASControlNode+Private.h index f3249c11c9..02f54a20ec 100644 --- a/Source/Private/ASControlNode+Private.h +++ b/Source/Private/ASControlNode+Private.h @@ -2,17 +2,9 @@ // ASControlNode+Private.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Private/ASControlTargetAction.h b/Source/Private/ASControlTargetAction.h index 6ec5be8896..5a3595c5d3 100644 --- a/Source/Private/ASControlTargetAction.h +++ b/Source/Private/ASControlTargetAction.h @@ -2,17 +2,9 @@ // ASControlTargetAction.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Private/ASControlTargetAction.m b/Source/Private/ASControlTargetAction.m index d3e18fb558..ea822db2fc 100644 --- a/Source/Private/ASControlTargetAction.m +++ b/Source/Private/ASControlTargetAction.m @@ -2,17 +2,9 @@ // ASControlTargetAction.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Private/ASDefaultPlayButton.h b/Source/Private/ASDefaultPlayButton.h index 3295fc2bbd..e3bc15246d 100644 --- a/Source/Private/ASDefaultPlayButton.h +++ b/Source/Private/ASDefaultPlayButton.h @@ -2,17 +2,9 @@ // ASDefaultPlayButton.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Private/ASDefaultPlayButton.m b/Source/Private/ASDefaultPlayButton.m index 4cef2b35f3..133db9a7e2 100644 --- a/Source/Private/ASDefaultPlayButton.m +++ b/Source/Private/ASDefaultPlayButton.m @@ -2,17 +2,9 @@ // ASDefaultPlayButton.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Private/ASDefaultPlaybackButton.h b/Source/Private/ASDefaultPlaybackButton.h index 869d9cd3ea..ae7e245dc0 100644 --- a/Source/Private/ASDefaultPlaybackButton.h +++ b/Source/Private/ASDefaultPlaybackButton.h @@ -2,17 +2,9 @@ // ASDefaultPlaybackButton.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Private/ASDefaultPlaybackButton.m b/Source/Private/ASDefaultPlaybackButton.m index bb5c8f539e..ecc276069c 100644 --- a/Source/Private/ASDefaultPlaybackButton.m +++ b/Source/Private/ASDefaultPlaybackButton.m @@ -2,17 +2,9 @@ // ASDefaultPlaybackButton.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Private/ASDispatch.h b/Source/Private/ASDispatch.h index 22893aba09..e20941806f 100644 --- a/Source/Private/ASDispatch.h +++ b/Source/Private/ASDispatch.h @@ -2,17 +2,9 @@ // ASDispatch.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Private/ASDispatch.m b/Source/Private/ASDispatch.m index 14c60eb6d3..f73281dfda 100644 --- a/Source/Private/ASDispatch.m +++ b/Source/Private/ASDispatch.m @@ -2,12 +2,8 @@ // ASDispatch.m // Texture // -// Copyright (c) 2017-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Private/ASDisplayNode+AsyncDisplay.mm b/Source/Private/ASDisplayNode+AsyncDisplay.mm index 2cf772aecf..d473780e4f 100644 --- a/Source/Private/ASDisplayNode+AsyncDisplay.mm +++ b/Source/Private/ASDisplayNode+AsyncDisplay.mm @@ -2,17 +2,9 @@ // ASDisplayNode+AsyncDisplay.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Private/ASDisplayNode+DebugTiming.h b/Source/Private/ASDisplayNode+DebugTiming.h index e8f9c42a9b..f6935224a9 100644 --- a/Source/Private/ASDisplayNode+DebugTiming.h +++ b/Source/Private/ASDisplayNode+DebugTiming.h @@ -2,17 +2,9 @@ // ASDisplayNode+DebugTiming.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Private/ASDisplayNode+DebugTiming.mm b/Source/Private/ASDisplayNode+DebugTiming.mm index 39620295bb..d9311a10d9 100644 --- a/Source/Private/ASDisplayNode+DebugTiming.mm +++ b/Source/Private/ASDisplayNode+DebugTiming.mm @@ -2,17 +2,9 @@ // ASDisplayNode+DebugTiming.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Private/ASDisplayNode+FrameworkPrivate.h b/Source/Private/ASDisplayNode+FrameworkPrivate.h index 589d60c22c..2101565bf3 100644 --- a/Source/Private/ASDisplayNode+FrameworkPrivate.h +++ b/Source/Private/ASDisplayNode+FrameworkPrivate.h @@ -2,17 +2,9 @@ // ASDisplayNode+FrameworkPrivate.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // // @@ -138,9 +130,6 @@ __unused static NSString * _Nonnull NSStringFromASHierarchyStateChange(ASHierarc // Returns the bounds of the node without reaching the view or layer - (CGRect)_locked_threadSafeBounds; -// delegate to inform of ASInterfaceState changes (used by ASNodeController) -@property (nonatomic, weak) id interfaceStateDelegate; - // The -pendingInterfaceState holds the value that will be applied to -interfaceState by the // ASCATransactionQueue. If already applied, it matches -interfaceState. Thread-safe access. @property (nonatomic, readonly) ASInterfaceState pendingInterfaceState; @@ -300,6 +289,11 @@ __unused static NSString * _Nonnull NSStringFromASHierarchyStateChange(ASHierarc */ - (BOOL)_isLayoutTransitionInvalid; +/** + * Same as @c -_isLayoutTransitionInvalid but must be called with the node's instance lock held. + */ +- (BOOL)_locked_isLayoutTransitionInvalid; + /** * Internal method that can be overriden by subclasses to add specific behavior after the measurement of a layout * transition did finish. @@ -307,7 +301,7 @@ __unused static NSString * _Nonnull NSStringFromASHierarchyStateChange(ASHierarc - (void)_layoutTransitionMeasurementDidFinish; /** - * Informs the node that hte pending layout transition did complete + * Informs the node that the pending layout transition did complete */ - (void)_completePendingLayoutTransition; diff --git a/Source/Private/ASDisplayNode+UIViewBridge.mm b/Source/Private/ASDisplayNode+UIViewBridge.mm index f91397371d..ff92459f38 100644 --- a/Source/Private/ASDisplayNode+UIViewBridge.mm +++ b/Source/Private/ASDisplayNode+UIViewBridge.mm @@ -2,17 +2,9 @@ // ASDisplayNode+UIViewBridge.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import @@ -41,8 +33,6 @@ #define DISPLAYNODE_USE_LOCKS 1 -#define __loaded(node) (node->_view != nil || (node->_layer != nil && node->_flags.layerBacked)) - #if DISPLAYNODE_USE_LOCKS #define _bridge_prologue_read ASDN::MutexLocker l(__instanceLock__); ASDisplayNodeAssertThreadAffinity(self) #define _bridge_prologue_write ASDN::MutexLocker l(__instanceLock__) @@ -59,7 +49,7 @@ /// returns NO. Otherwise, the pending state can be scheduled and flushed *before* you get a chance /// to apply it. ASDISPLAYNODE_INLINE BOOL ASDisplayNodeShouldApplyBridgedWriteToView(ASDisplayNode *node) { - BOOL loaded = __loaded(node); + BOOL loaded = _loaded(node); if (ASDisplayNodeThreadIsMain()) { return loaded; } else { @@ -70,7 +60,7 @@ ASDISPLAYNODE_INLINE BOOL ASDisplayNodeShouldApplyBridgedWriteToView(ASDisplayNo } }; -#define _getFromViewOrLayer(layerProperty, viewAndPendingViewStateProperty) __loaded(self) ? \ +#define _getFromViewOrLayer(layerProperty, viewAndPendingViewStateProperty) _loaded(self) ? \ (_view ? _view.viewAndPendingViewStateProperty : _layer.layerProperty )\ : ASDisplayNodeGetPendingState(self).viewAndPendingViewStateProperty @@ -80,9 +70,9 @@ ASDISPLAYNODE_INLINE BOOL ASDisplayNodeShouldApplyBridgedWriteToView(ASDisplayNo #define _setToViewOnly(viewAndPendingViewStateProperty, viewAndPendingViewStateExpr) BOOL shouldApply = ASDisplayNodeShouldApplyBridgedWriteToView(self); \ if (shouldApply) { _view.viewAndPendingViewStateProperty = (viewAndPendingViewStateExpr); } else { ASDisplayNodeGetPendingState(self).viewAndPendingViewStateProperty = (viewAndPendingViewStateExpr); } -#define _getFromViewOnly(viewAndPendingViewStateProperty) __loaded(self) ? _view.viewAndPendingViewStateProperty : ASDisplayNodeGetPendingState(self).viewAndPendingViewStateProperty +#define _getFromViewOnly(viewAndPendingViewStateProperty) _loaded(self) ? _view.viewAndPendingViewStateProperty : ASDisplayNodeGetPendingState(self).viewAndPendingViewStateProperty -#define _getFromLayer(layerProperty) __loaded(self) ? _layer.layerProperty : ASDisplayNodeGetPendingState(self).layerProperty +#define _getFromLayer(layerProperty) _loaded(self) ? _layer.layerProperty : ASDisplayNodeGetPendingState(self).layerProperty #define _setToLayer(layerProperty, layerValueExpr) BOOL shouldApply = ASDisplayNodeShouldApplyBridgedWriteToView(self); \ if (shouldApply) { _layer.layerProperty = (layerValueExpr); } else { ASDisplayNodeGetPendingState(self).layerProperty = (layerValueExpr); } @@ -298,70 +288,78 @@ if (shouldApply) { _layer.layerProperty = (layerValueExpr); } else { ASDisplayNo - (void)setFrame:(CGRect)rect { - _bridge_prologue_write; - - // For classes like ASTableNode, ASCollectionNode, ASScrollNode and similar - make sure UIView gets setFrame: - struct ASDisplayNodeFlags flags = _flags; - BOOL specialPropertiesHandling = ASDisplayNodeNeedsSpecialPropertiesHandling(checkFlag(Synchronous), flags.layerBacked); - - BOOL nodeLoaded = __loaded(self); + BOOL setToView = NO; + BOOL setToLayer = NO; + CGRect newBounds = CGRectZero; + CGPoint newPosition = CGPointZero; + BOOL nodeLoaded = NO; BOOL isMainThread = ASDisplayNodeThreadIsMain(); - if (!specialPropertiesHandling) { - BOOL canReadProperties = isMainThread || !nodeLoaded; - if (canReadProperties) { - // We don't have to set frame directly, and we can read current properties. - // Compute a new bounds and position and set them on self. - CALayer *layer = _layer; - BOOL useLayer = (layer != nil); - CGPoint origin = (useLayer ? layer.bounds.origin : self.bounds.origin); - CGPoint anchorPoint = (useLayer ? layer.anchorPoint : self.anchorPoint); + { + _bridge_prologue_write; - CGRect newBounds = CGRectZero; - CGPoint newPosition = CGPointZero; - ASBoundsAndPositionForFrame(rect, origin, anchorPoint, &newBounds, &newPosition); + // For classes like ASTableNode, ASCollectionNode, ASScrollNode and similar - make sure UIView gets setFrame: + struct ASDisplayNodeFlags flags = _flags; + BOOL specialPropertiesHandling = ASDisplayNodeNeedsSpecialPropertiesHandling(checkFlag(Synchronous), flags.layerBacked); - if (ASIsCGRectValidForLayout(newBounds) == NO || ASIsCGPositionValidForLayout(newPosition) == NO) { - ASDisplayNodeAssertNonFatal(NO, @"-[ASDisplayNode setFrame:] - The new frame (%@) is invalid and unsafe to be set.", NSStringFromCGRect(rect)); - return; - } - - if (useLayer) { - layer.bounds = newBounds; - layer.position = newPosition; + nodeLoaded = _loaded(self); + if (!specialPropertiesHandling) { + BOOL canReadProperties = isMainThread || !nodeLoaded; + if (canReadProperties) { + // We don't have to set frame directly, and we can read current properties. + // Compute a new bounds and position and set them on self. + CALayer *layer = _layer; + CGPoint origin = (nodeLoaded ? layer.bounds.origin : self.bounds.origin); + CGPoint anchorPoint = (nodeLoaded ? layer.anchorPoint : self.anchorPoint); + + ASBoundsAndPositionForFrame(rect, origin, anchorPoint, &newBounds, &newPosition); + + if (ASIsCGRectValidForLayout(newBounds) == NO || ASIsCGPositionValidForLayout(newPosition) == NO) { + ASDisplayNodeAssertNonFatal(NO, @"-[ASDisplayNode setFrame:] - The new frame (%@) is invalid and unsafe to be set.", NSStringFromCGRect(rect)); + return; + } + + if (nodeLoaded) { + setToLayer = YES; + } else { + self.bounds = newBounds; + self.position = newPosition; + } } else { - self.bounds = newBounds; - self.position = newPosition; + // We don't have to set frame directly, but we can't read properties. + // Store the frame in our pending state, and it'll get decomposed into + // bounds and position when the pending state is applied. + _ASPendingState *pendingState = ASDisplayNodeGetPendingState(self); + if (nodeLoaded && !pendingState.hasChanges) { + [[ASPendingStateController sharedInstance] registerNode:self]; + } + pendingState.frame = rect; } } else { - // We don't have to set frame directly, but we can't read properties. - // Store the frame in our pending state, and it'll get decomposed into - // bounds and position when the pending state is applied. - _ASPendingState *pendingState = ASDisplayNodeGetPendingState(self); - if (nodeLoaded && !pendingState.hasChanges) { - [[ASPendingStateController sharedInstance] registerNode:self]; + if (nodeLoaded && isMainThread) { + // We do have to set frame directly, and we're on main thread with a loaded node. + // Just set the frame on the view. + // NOTE: Frame is only defined when transform is identity because we explicitly diverge from CALayer behavior and define frame without transform. + setToView = YES; + } else { + // We do have to set frame directly, but either the node isn't loaded or we're on a non-main thread. + // Set the frame on the pending state, and it'll call setFrame: when applied. + _ASPendingState *pendingState = ASDisplayNodeGetPendingState(self); + if (nodeLoaded && !pendingState.hasChanges) { + [[ASPendingStateController sharedInstance] registerNode:self]; + } + pendingState.frame = rect; } - pendingState.frame = rect; - } - } else { - if (nodeLoaded && isMainThread) { - // We do have to set frame directly, and we're on main thread with a loaded node. - // Just set the frame on the view. - // NOTE: Frame is only defined when transform is identity because we explicitly diverge from CALayer behavior and define frame without transform. -//#if DEBUG -// // Checking if the transform is identity is expensive, so disable when unnecessary. We have assertions on in Release, so DEBUG is the only way I know of. -// ASDisplayNodeAssert(CATransform3DIsIdentity(self.transform), @"-[ASDisplayNode setFrame:] - self.transform must be identity in order to set the frame property. (From Apple's UIView documentation: If the transform property is not the identity transform, the value of this property is undefined and therefore should be ignored.)"); -//#endif - _view.frame = rect; - } else { - // We do have to set frame directly, but either the node isn't loaded or we're on a non-main thread. - // Set the frame on the pending state, and it'll call setFrame: when applied. - _ASPendingState *pendingState = ASDisplayNodeGetPendingState(self); - if (nodeLoaded && !pendingState.hasChanges) { - [[ASPendingStateController sharedInstance] registerNode:self]; - } - pendingState.frame = rect; } } + + if (setToView) { + ASDisplayNodeAssertTrue(nodeLoaded && isMainThread); + _view.frame = rect; + } else if (setToLayer) { + ASDisplayNodeAssertTrue(nodeLoaded && isMainThread); + _layer.bounds = newBounds; + _layer.position = newPosition; + } } - (void)setNeedsDisplay @@ -416,7 +414,7 @@ if (shouldApply) { _layer.layerProperty = (layerValueExpr); } else { ASDisplayNo { _bridge_prologue_write; shouldApply = ASDisplayNodeShouldApplyBridgedWriteToView(self); - loaded = __loaded(self); + loaded = _loaded(self); viewOrLayer = _view ?: _layer; if (shouldApply == NO && loaded) { // The node is loaded but we're not on main. @@ -447,7 +445,7 @@ if (shouldApply) { _layer.layerProperty = (layerValueExpr); } else { ASDisplayNo { _bridge_prologue_write; shouldApply = ASDisplayNodeShouldApplyBridgedWriteToView(self); - loaded = __loaded(self); + loaded = _loaded(self); viewOrLayer = _view ?: _layer; if (shouldApply == NO && loaded) { // The node is loaded but we're not on main. @@ -658,7 +656,7 @@ if (shouldApply) { _layer.layerProperty = (layerValueExpr); } else { ASDisplayNo - (UIViewContentMode)contentMode { _bridge_prologue_read; - if (__loaded(self)) { + if (_loaded(self)) { if (_flags.layerBacked) { return ASDisplayNodeUIContentModeFromCAContentsGravity(_layer.contentsGravity); } else { @@ -912,7 +910,7 @@ if (shouldApply) { _layer.layerProperty = (layerValueExpr); } else { ASDisplayNo _bridge_prologue_read; if (AS_AVAILABLE_IOS(11.0)) { - if (!_flags.layerBacked && __loaded(self)) { + if (!_flags.layerBacked && _loaded(self)) { return self.view.safeAreaInsets; } } @@ -941,7 +939,7 @@ if (shouldApply) { _layer.layerProperty = (layerValueExpr); } else { ASDisplayNo } } - shouldNotifyAboutUpdate = __loaded(self) && (!AS_AT_LEAST_IOS11 || _flags.layerBacked); + shouldNotifyAboutUpdate = _loaded(self) && (!AS_AT_LEAST_IOS11 || _flags.layerBacked); } if (shouldNotifyAboutUpdate) { @@ -978,6 +976,7 @@ if (shouldApply) { _layer.layerProperty = (layerValueExpr); } else { ASDisplayNo - (BOOL)_locked_insetsLayoutMarginsFromSafeArea { + ASAssertLocked(__instanceLock__); if (AS_AVAILABLE_IOS(11.0)) { if (!_flags.layerBacked) { return _getFromViewOnly(insetsLayoutMarginsFromSafeArea); @@ -999,7 +998,7 @@ if (shouldApply) { _layer.layerProperty = (layerValueExpr); } else { ASDisplayNo // - In case the node is loaded // - Check if the node has a view and get the value from the view if loaded or from the pending state // - If view is not available, e.g. the node is layer backed return the property value -#define _getAccessibilityFromViewOrProperty(nodeProperty, viewAndPendingViewStateProperty) __loaded(self) ? \ +#define _getAccessibilityFromViewOrProperty(nodeProperty, viewAndPendingViewStateProperty) _loaded(self) ? \ (_view ? _view.viewAndPendingViewStateProperty : nodeProperty )\ : ASDisplayNodeGetPendingState(self).viewAndPendingViewStateProperty diff --git a/Source/Private/ASDisplayNodeCornerLayerDelegate.h b/Source/Private/ASDisplayNodeCornerLayerDelegate.h new file mode 100644 index 0000000000..cb95e9fbf6 --- /dev/null +++ b/Source/Private/ASDisplayNodeCornerLayerDelegate.h @@ -0,0 +1,13 @@ +// +// ASDisplayNodeCornerLayerDelegate.h +// Texture +// +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 +// + +#import + +@interface ASDisplayNodeCornerLayerDelegate : NSObject +@end diff --git a/Source/Private/ASDisplayNodeCornerLayerDelegate.m b/Source/Private/ASDisplayNodeCornerLayerDelegate.m new file mode 100644 index 0000000000..8973570224 --- /dev/null +++ b/Source/Private/ASDisplayNodeCornerLayerDelegate.m @@ -0,0 +1,19 @@ +// +// ASDisplayNodeCornerLayerDelegate.m +// Texture +// +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 +// + +#import "ASDisplayNodeCornerLayerDelegate.h" + +@implementation ASDisplayNodeCornerLayerDelegate + +- (id)actionForLayer:(CALayer *)layer forKey:(NSString *)event +{ + return (id)kCFNull; +} + +@end diff --git a/Source/Private/ASDisplayNodeInternal.h b/Source/Private/ASDisplayNodeInternal.h index 18c93f103d..5f9092ffaa 100644 --- a/Source/Private/ASDisplayNodeInternal.h +++ b/Source/Private/ASDisplayNodeInternal.h @@ -2,17 +2,9 @@ // ASDisplayNodeInternal.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // // @@ -34,6 +26,7 @@ NS_ASSUME_NONNULL_BEGIN @protocol _ASDisplayLayerDelegate; @class _ASDisplayLayer; @class _ASPendingState; +@class ASNodeController; struct ASDisplayNodeFlags; BOOL ASDisplayNodeSubclassOverridesSelector(Class subclass, SEL selector); @@ -44,14 +37,19 @@ _ASPendingState * ASDisplayNodeGetPendingState(ASDisplayNode * node); typedef NS_OPTIONS(NSUInteger, ASDisplayNodeMethodOverrides) { - ASDisplayNodeMethodOverrideNone = 0, - ASDisplayNodeMethodOverrideTouchesBegan = 1 << 0, - ASDisplayNodeMethodOverrideTouchesCancelled = 1 << 1, - ASDisplayNodeMethodOverrideTouchesEnded = 1 << 2, - ASDisplayNodeMethodOverrideTouchesMoved = 1 << 3, - ASDisplayNodeMethodOverrideLayoutSpecThatFits = 1 << 4, - ASDisplayNodeMethodOverrideCalcLayoutThatFits = 1 << 5, - ASDisplayNodeMethodOverrideCalcSizeThatFits = 1 << 6, + ASDisplayNodeMethodOverrideNone = 0, + ASDisplayNodeMethodOverrideTouchesBegan = 1 << 0, + ASDisplayNodeMethodOverrideTouchesCancelled = 1 << 1, + ASDisplayNodeMethodOverrideTouchesEnded = 1 << 2, + ASDisplayNodeMethodOverrideTouchesMoved = 1 << 3, + ASDisplayNodeMethodOverrideLayoutSpecThatFits = 1 << 4, + ASDisplayNodeMethodOverrideCalcLayoutThatFits = 1 << 5, + ASDisplayNodeMethodOverrideCalcSizeThatFits = 1 << 6, + ASDisplayNodeMethodOverrideCanBecomeFirstResponder= 1 << 7, + ASDisplayNodeMethodOverrideBecomeFirstResponder = 1 << 8, + ASDisplayNodeMethodOverrideCanResignFirstResponder= 1 << 9, + ASDisplayNodeMethodOverrideResignFirstResponder = 1 << 10, + ASDisplayNodeMethodOverrideIsFirstResponder = 1 << 11, }; typedef NS_OPTIONS(uint_least32_t, ASDisplayNodeAtomicFlags) @@ -60,6 +58,9 @@ typedef NS_OPTIONS(uint_least32_t, ASDisplayNodeAtomicFlags) YogaLayoutInProgress = 1 << 1, }; +// Can be called without the node's lock. Client is responsible for thread safety. +#define _loaded(node) (node->_layer != nil) + #define checkFlag(flag) ((_atomicFlags.load() & flag) != 0) // Returns the old value of the flag as a BOOL. #define setFlag(flag, x) (((x ? _atomicFlags.fetch_or(flag) \ @@ -73,6 +74,8 @@ AS_EXTERN NSString * const ASRenderingEngineDidDisplayNodesScheduledBeforeTimest #define TIME_DISPLAYNODE_OPS 0 // If you're using this information frequently, try: (DEBUG || PROFILE) +#define NUM_CLIP_CORNER_LAYERS 4 + @interface ASDisplayNode () <_ASTransitionContextCompletionDelegate> { @package @@ -80,6 +83,8 @@ AS_EXTERN NSString * const ASRenderingEngineDidDisplayNodesScheduledBeforeTimest _ASPendingState *_pendingViewState; ASInterfaceState _pendingInterfaceState; + ASInterfaceState _preExitingInterfaceState; + UIView *_view; CALayer *_layer; @@ -125,6 +130,9 @@ AS_EXTERN NSString * const ASRenderingEngineDidDisplayNodesScheduledBeforeTimest ASDisplayNode * __weak _supernode; NSMutableArray *_subnodes; + ASNodeController *_strongNodeController; + __weak ASNodeController *_weakNodeController; + // Set this to nil whenever you modify _subnodes NSArray *_cachedSubnodes; @@ -156,8 +164,8 @@ AS_EXTERN NSString * const ASRenderingEngineDidDisplayNodesScheduledBeforeTimest std::atomic _pendingTransitionID; ASLayoutTransition *_pendingLayoutTransition; - std::shared_ptr _calculatedDisplayNodeLayout; - std::shared_ptr _pendingDisplayNodeLayout; + ASDisplayNodeLayout _calculatedDisplayNodeLayout; + ASDisplayNodeLayout _pendingDisplayNodeLayout; /// Sentinel for layout data. Incremented when we get -setNeedsLayout / -invalidateCalculatedLayout. /// Starts at 1. @@ -178,7 +186,7 @@ AS_EXTERN NSString * const ASRenderingEngineDidDisplayNodesScheduledBeforeTimest CGFloat _cornerRadius; ASCornerRoundingType _cornerRoundingType; - CALayer *_clipCornerLayers[4]; + CALayer *_clipCornerLayers[NUM_CLIP_CORNER_LAYERS]; ASDisplayNodeContextModifier _willDisplayNodeContentWithRenderingContext; ASDisplayNodeContextModifier _didDisplayNodeContentWithRenderingContext; @@ -241,6 +249,10 @@ AS_EXTERN NSString * const ASRenderingEngineDidDisplayNodesScheduledBeforeTimest NSTimeInterval _debugTimeToAddSubnodeViews; NSTimeInterval _debugTimeForDidLoad; #endif + + /// Fast path: tells whether we've ever had an interface state delegate before. + BOOL _hasHadInterfaceStateDelegates; + __weak id _interfaceStateDelegates[AS_MAX_INTERFACE_STATE_DELEGATES]; } + (void)scheduleNodeForRecursiveDisplay:(ASDisplayNode *)node; @@ -249,7 +261,7 @@ AS_EXTERN NSString * const ASRenderingEngineDidDisplayNodesScheduledBeforeTimest @property (nullable, nonatomic, readonly) _ASDisplayLayer *asyncLayer; /// Bitmask to check which methods an object overrides. -@property (nonatomic, readonly) ASDisplayNodeMethodOverrides methodOverrides; +- (ASDisplayNodeMethodOverrides)methodOverrides; /** * Invoked before a call to setNeedsLayout to the underlying view @@ -261,6 +273,16 @@ AS_EXTERN NSString * const ASRenderingEngineDidDisplayNodesScheduledBeforeTimest */ - (void)__setNeedsDisplay; +/** + * Setup the node -> controller reference. Strong or weak is based on + * the "shouldInvertStrongReference" property of the controller. + * + * Note: To prevent lock-ordering deadlocks, this method does not take the node's lock. + * In practice, changing the node controller of a node multiple times is not + * supported behavior. + */ +- (void)__setNodeController:(ASNodeController *)controller; + /** * Called whenever the node needs to layout its subnodes and, if it's already loaded, its subviews. Executes the layout pass for the node * @@ -312,6 +334,13 @@ AS_EXTERN NSString * const ASRenderingEngineDidDisplayNodesScheduledBeforeTimest - (void)applyPendingViewState; +/** + * Makes a local copy of the interface state delegates then calls the block on each. + * + * Lock is not held during block invocation. Method must not be called with the lock held. + */ +- (void)enumerateInterfaceStateDelegates:(void(NS_NOESCAPE ^)(id delegate))block; + /** * // TODO: NOT YET IMPLEMENTED * diff --git a/Source/Private/ASDisplayNodeLayout.h b/Source/Private/ASDisplayNodeLayout.h index 45d15230a0..ba8d9c273e 100644 --- a/Source/Private/ASDisplayNodeLayout.h +++ b/Source/Private/ASDisplayNodeLayout.h @@ -2,17 +2,9 @@ // ASDisplayNodeLayout.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #pragma once @@ -51,10 +43,16 @@ struct ASDisplayNodeLayout { /** * Returns whether this is valid for a given version */ - BOOL isValid(NSUInteger version); + BOOL isValid(NSUInteger versionArg) { + return layout != nil && version >= versionArg; + } /** * Returns whether this is valid for a given constrained size, parent size, and version */ - BOOL isValid(ASSizeRange constrainedSize, CGSize parentSize, NSUInteger version); + BOOL isValid(ASSizeRange theConstrainedSize, CGSize theParentSize, NSUInteger versionArg) { + return isValid(versionArg) + && CGSizeEqualToSize(parentSize, theParentSize) + && ASSizeRangeEqualToSizeRange(constrainedSize, theConstrainedSize); + } }; diff --git a/Source/Private/ASDisplayNodeLayout.mm b/Source/Private/ASDisplayNodeLayout.mm deleted file mode 100644 index 15d51fd490..0000000000 --- a/Source/Private/ASDisplayNodeLayout.mm +++ /dev/null @@ -1,30 +0,0 @@ -// -// ASDisplayNodeLayout.mm -// Texture -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -BOOL ASDisplayNodeLayout::isValid(NSUInteger versionArg) -{ - return layout != nil && version >= versionArg; -} - -BOOL ASDisplayNodeLayout::isValid(ASSizeRange theConstrainedSize, CGSize theParentSize, NSUInteger versionArg) -{ - return isValid(versionArg) - && CGSizeEqualToSize(parentSize, theParentSize) - && ASSizeRangeEqualToSizeRange(constrainedSize, theConstrainedSize); -} diff --git a/Source/Private/ASDisplayNodeTipState.h b/Source/Private/ASDisplayNodeTipState.h index 7b195934dc..1e1ef20726 100644 --- a/Source/Private/ASDisplayNodeTipState.h +++ b/Source/Private/ASDisplayNodeTipState.h @@ -2,17 +2,9 @@ // ASDisplayNodeTipState.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Private/ASDisplayNodeTipState.m b/Source/Private/ASDisplayNodeTipState.m index 430dce5d36..8050d27346 100644 --- a/Source/Private/ASDisplayNodeTipState.m +++ b/Source/Private/ASDisplayNodeTipState.m @@ -2,17 +2,9 @@ // ASDisplayNodeTipState.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ASDisplayNodeTipState.h" diff --git a/Source/Private/ASIGListAdapterBasedDataSource.h b/Source/Private/ASIGListAdapterBasedDataSource.h index c46eca4b55..44380bc070 100644 --- a/Source/Private/ASIGListAdapterBasedDataSource.h +++ b/Source/Private/ASIGListAdapterBasedDataSource.h @@ -2,17 +2,9 @@ // ASIGListAdapterBasedDataSource.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Private/ASIGListAdapterBasedDataSource.m b/Source/Private/ASIGListAdapterBasedDataSource.m index ab18636228..a489acf950 100644 --- a/Source/Private/ASIGListAdapterBasedDataSource.m +++ b/Source/Private/ASIGListAdapterBasedDataSource.m @@ -2,17 +2,9 @@ // ASIGListAdapterBasedDataSource.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import @@ -115,6 +107,11 @@ typedef struct { [self.delegate scrollViewDidEndDragging:scrollView willDecelerate:decelerate]; } +- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView +{ + [self.delegate scrollViewDidEndDecelerating:scrollView]; +} + - (BOOL)shouldBatchFetchForCollectionNode:(ASCollectionNode *)collectionNode { NSInteger sectionCount = [self numberOfSectionsInCollectionNode:collectionNode]; diff --git a/Source/Private/ASImageNode+AnimatedImagePrivate.h b/Source/Private/ASImageNode+AnimatedImagePrivate.h index 4c17e4de32..a186173f26 100644 --- a/Source/Private/ASImageNode+AnimatedImagePrivate.h +++ b/Source/Private/ASImageNode+AnimatedImagePrivate.h @@ -2,17 +2,9 @@ // ASImageNode+AnimatedImagePrivate.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Private/ASImageNode+CGExtras.h b/Source/Private/ASImageNode+CGExtras.h index 187f4833b4..01b546443b 100644 --- a/Source/Private/ASImageNode+CGExtras.h +++ b/Source/Private/ASImageNode+CGExtras.h @@ -2,17 +2,9 @@ // ASImageNode+CGExtras.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Private/ASImageNode+CGExtras.m b/Source/Private/ASImageNode+CGExtras.m index f8c118ea05..acbd6857e1 100644 --- a/Source/Private/ASImageNode+CGExtras.m +++ b/Source/Private/ASImageNode+CGExtras.m @@ -2,17 +2,9 @@ // ASImageNode+CGExtras.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Private/ASImageNode+Private.h b/Source/Private/ASImageNode+Private.h index a4fbfcd62c..8de78c8784 100644 --- a/Source/Private/ASImageNode+Private.h +++ b/Source/Private/ASImageNode+Private.h @@ -2,17 +2,9 @@ // ASImageNode+Private.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #pragma once diff --git a/Source/Private/ASInternalHelpers.h b/Source/Private/ASInternalHelpers.h index 537ba4a619..e6d3811c79 100644 --- a/Source/Private/ASInternalHelpers.h +++ b/Source/Private/ASInternalHelpers.h @@ -2,17 +2,9 @@ // ASInternalHelpers.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ASAvailability.h" diff --git a/Source/Private/ASInternalHelpers.m b/Source/Private/ASInternalHelpers.m index d34f15d352..484560aa89 100644 --- a/Source/Private/ASInternalHelpers.m +++ b/Source/Private/ASInternalHelpers.m @@ -2,17 +2,9 @@ // ASInternalHelpers.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import @@ -22,6 +14,7 @@ #import #import +#import #import #import @@ -61,6 +54,7 @@ void ASInitializeFrameworkMainThread(void) allowsGroupOpacityFromUIKitOrNil = @(layer.allowsGroupOpacity); allowsEdgeAntialiasingFromUIKitOrNil = @(layer.allowsEdgeAntialiasing); } + ASNotifyInitialized(); } BOOL ASSubclassOverridesSelector(Class superclass, Class subclass, SEL selector) diff --git a/Source/Private/ASLayerBackingTipProvider.h b/Source/Private/ASLayerBackingTipProvider.h index f2be45eb44..0cc3d03b61 100644 --- a/Source/Private/ASLayerBackingTipProvider.h +++ b/Source/Private/ASLayerBackingTipProvider.h @@ -2,17 +2,9 @@ // ASLayerBackingTipProvider.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ASTipProvider.h" diff --git a/Source/Private/ASLayerBackingTipProvider.m b/Source/Private/ASLayerBackingTipProvider.m index c2d0f5aa22..9a5932faa8 100644 --- a/Source/Private/ASLayerBackingTipProvider.m +++ b/Source/Private/ASLayerBackingTipProvider.m @@ -2,17 +2,9 @@ // ASLayerBackingTipProvider.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ASLayerBackingTipProvider.h" diff --git a/Source/Private/ASLayoutTransition.h b/Source/Private/ASLayoutTransition.h index a34dd2e72a..f2bcf9b253 100644 --- a/Source/Private/ASLayoutTransition.h +++ b/Source/Private/ASLayoutTransition.h @@ -2,17 +2,9 @@ // ASLayoutTransition.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import @@ -23,8 +15,6 @@ #import #import -#import - NS_ASSUME_NONNULL_BEGIN #pragma mark - ASLayoutElementTransition @@ -60,12 +50,12 @@ AS_SUBCLASSING_RESTRICTED /** * Previous layout to transition from */ -@property (nonatomic, readonly) std::shared_ptr previousLayout; +@property (nonatomic, readonly) const ASDisplayNodeLayout &previousLayout NS_RETURNS_INNER_POINTER; /** * Pending layout to transition to */ -@property (nonatomic, readonly) std::shared_ptr pendingLayout; +@property (nonatomic, readonly) const ASDisplayNodeLayout &pendingLayout NS_RETURNS_INNER_POINTER; /** * Returns if the layout transition needs to happen synchronously @@ -76,8 +66,8 @@ AS_SUBCLASSING_RESTRICTED * Returns a newly initialized layout transition */ - (instancetype)initWithNode:(ASDisplayNode *)node - pendingLayout:(std::shared_ptr)pendingLayout - previousLayout:(std::shared_ptr)previousLayout NS_DESIGNATED_INITIALIZER; + pendingLayout:(const ASDisplayNodeLayout &)pendingLayout + previousLayout:(const ASDisplayNodeLayout &)previousLayout NS_DESIGNATED_INITIALIZER; /** * Insert and remove subnodes that were added or removed between the previousLayout and the pendingLayout @@ -85,20 +75,18 @@ AS_SUBCLASSING_RESTRICTED - (void)commitTransition; /** - * Insert all new subnodes that were added between the previous layout and the pending layout + * Insert all new subnodes that were added and move the subnodes that moved between the previous layout and + * the pending layout. */ -- (void)applySubnodeInsertions; +- (void)applySubnodeInsertionsAndMoves; /** * Remove all subnodes that are removed between the previous layout and the pending layout */ - (void)applySubnodeRemovals; -@end - -@interface ASLayoutTransition (Unavailable) - -- (instancetype)init __unavailable; +- (instancetype)init NS_UNAVAILABLE; +- (instancetype)new NS_UNAVAILABLE; @end diff --git a/Source/Private/ASLayoutTransition.mm b/Source/Private/ASLayoutTransition.mm index 85cfcd2085..1e482afa63 100644 --- a/Source/Private/ASLayoutTransition.mm +++ b/Source/Private/ASLayoutTransition.mm @@ -2,17 +2,9 @@ // ASLayoutTransition.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import @@ -25,10 +17,11 @@ #import #import -#import -#import -#import +#if AS_IG_LIST_KIT +#import +#import +#endif /** * Search the whole layout stack if at least one layout has a layoutElement object that can not be layed out asynchronous. @@ -66,12 +59,14 @@ static inline BOOL ASLayoutCanTransitionAsynchronous(ASLayout *layout) { NSArray *_insertedSubnodes; NSArray *_removedSubnodes; std::vector _insertedSubnodePositions; - std::vector _removedSubnodePositions; + std::vector> _subnodeMoves; + ASDisplayNodeLayout _pendingLayout; + ASDisplayNodeLayout _previousLayout; } - (instancetype)initWithNode:(ASDisplayNode *)node - pendingLayout:(std::shared_ptr)pendingLayout - previousLayout:(std::shared_ptr)previousLayout + pendingLayout:(const ASDisplayNodeLayout &)pendingLayout + previousLayout:(const ASDisplayNodeLayout &)previousLayout { self = [super init]; if (self) { @@ -84,41 +79,52 @@ static inline BOOL ASLayoutCanTransitionAsynchronous(ASLayout *layout) { return self; } -- (instancetype)init -{ - ASDisplayNodeAssert(NO, @"Use the designated initializer"); - return [self init]; -} - - (BOOL)isSynchronous { ASDN::MutexSharedLocker l(__instanceLock__); - return !ASLayoutCanTransitionAsynchronous(_pendingLayout->layout); + return !ASLayoutCanTransitionAsynchronous(_pendingLayout.layout); } - (void)commitTransition { - [self applySubnodeInsertions]; [self applySubnodeRemovals]; + [self applySubnodeInsertionsAndMoves]; } -- (void)applySubnodeInsertions +- (void)applySubnodeInsertionsAndMoves { ASDN::MutexSharedLocker l(__instanceLock__); [self calculateSubnodeOperationsIfNeeded]; // Create an activity even if no subnodes affected. - as_activity_create_for_scope("Apply subnode insertions"); - if (_insertedSubnodes.count == 0) { + as_activity_create_for_scope("Apply subnode insertions and moves"); + if (_insertedSubnodePositions.size() == 0 && _subnodeMoves.size() == 0) { return; } ASDisplayNodeLogEvent(_node, @"insertSubnodes: %@", _insertedSubnodes); NSUInteger i = 0; - for (ASDisplayNode *node in _insertedSubnodes) { + NSUInteger j = 0; + for (auto const &move : _subnodeMoves) { + [move.first _removeFromSupernodeIfEqualTo:_node]; + } + j = 0; + while (i < _insertedSubnodePositions.size() && j < _subnodeMoves.size()) { NSUInteger p = _insertedSubnodePositions[i]; - [_node _insertSubnode:node atIndex:p]; - i += 1; + NSUInteger q = _subnodeMoves[j].second; + if (p < q) { + [_node _insertSubnode:_insertedSubnodes[i] atIndex:p]; + i++; + } else { + [_node _insertSubnode:_subnodeMoves[j].first atIndex:q]; + j++; + } + } + for (; i < _insertedSubnodePositions.size(); ++i) { + [_node _insertSubnode:_insertedSubnodes[i] atIndex:_insertedSubnodePositions[i]]; + } + for (; j < _subnodeMoves.size(); ++j) { + [_node _insertSubnode:_subnodeMoves[j].first atIndex:_subnodeMoves[j].second]; } } @@ -137,7 +143,9 @@ static inline BOOL ASLayoutCanTransitionAsynchronous(ASLayout *layout) { // In this case we should only remove the subnode if it's still a subnode of 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 be removed from the new node instead of _node - [subnode _removeFromSupernodeIfEqualTo:_node]; + if (_node.automaticallyManagesSubnodes) { + [subnode _removeFromSupernodeIfEqualTo:_node]; + } } } @@ -150,27 +158,46 @@ static inline BOOL ASLayoutCanTransitionAsynchronous(ASLayout *layout) { // Create an activity even if no subnodes affected. as_activity_create_for_scope("Calculate subnode operations"); - ASLayout *previousLayout = _previousLayout->layout; - ASLayout *pendingLayout = _pendingLayout->layout; + ASLayout *previousLayout = _previousLayout.layout; + ASLayout *pendingLayout = _pendingLayout.layout; if (previousLayout) { +#if AS_IG_LIST_KIT + // IGListDiff completes in linear time O(m+n), so use it if we have it: + IGListIndexSetResult *result = IGListDiff(previousLayout.sublayouts, pendingLayout.sublayouts, IGListDiffEquality); + _insertedSubnodePositions = findNodesInLayoutAtIndexes(pendingLayout, result.inserts, &_insertedSubnodes); + findNodesInLayoutAtIndexes(previousLayout, result.deletes, &_removedSubnodes); + for (IGListMoveIndex *move in result.moves) { + _subnodeMoves.push_back(std::make_pair(previousLayout.sublayouts[move.from].layoutElement, move.to)); + } + + // Sort by ascending order of move destinations, this will allow easy loop of `insertSubnode:AtIndex` later. + std::sort(_subnodeMoves.begin(), _subnodeMoves.end(), [](std::pair, NSUInteger> a, + std::pair b) { + return a.second < b.second; + }); +#else NSIndexSet *insertions, *deletions; - [previousLayout.sublayouts asdk_diffWithArray:pendingLayout.sublayouts + NSArray *moves; + NSArray *previousNodes = [previousLayout.sublayouts valueForKey:@"layoutElement"]; + NSArray *pendingNodes = [pendingLayout.sublayouts valueForKey:@"layoutElement"]; + [previousNodes asdk_diffWithArray:pendingNodes insertions:&insertions deletions:&deletions - compareBlock:^BOOL(ASLayout *lhs, ASLayout *rhs) { - return ASObjectIsEqual(lhs.layoutElement, rhs.layoutElement); - }]; + moves:&moves]; + _insertedSubnodePositions = findNodesInLayoutAtIndexes(pendingLayout, insertions, &_insertedSubnodes); - _removedSubnodePositions = findNodesInLayoutAtIndexesWithFilteredNodes(previousLayout, - deletions, - _insertedSubnodes, - &_removedSubnodes); + _removedSubnodes = [previousNodes objectsAtIndexes:deletions]; + // These should arrive sorted in ascending order of move destinations. + for (NSIndexPath *move in moves) { + _subnodeMoves.push_back(std::make_pair(previousLayout.sublayouts[([move indexAtPosition:0])].layoutElement, + [move indexAtPosition:1])); + } +#endif } else { NSIndexSet *indexes = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, [pendingLayout.sublayouts count])]; _insertedSubnodePositions = findNodesInLayoutAtIndexes(pendingLayout, indexes, &_insertedSubnodes); _removedSubnodes = nil; - _removedSubnodePositions.clear(); } _calculatedSubnodeOperations = YES; } @@ -201,9 +228,9 @@ static inline BOOL ASLayoutCanTransitionAsynchronous(ASLayout *layout) { { ASDN::MutexSharedLocker l(__instanceLock__); if ([key isEqualToString:ASTransitionContextFromLayoutKey]) { - return _previousLayout->layout; + return _previousLayout.layout; } else if ([key isEqualToString:ASTransitionContextToLayoutKey]) { - return _pendingLayout->layout; + return _pendingLayout.layout; } else { return nil; } @@ -213,9 +240,9 @@ static inline BOOL ASLayoutCanTransitionAsynchronous(ASLayout *layout) { { ASDN::MutexSharedLocker l(__instanceLock__); if ([key isEqualToString:ASTransitionContextFromLayoutKey]) { - return _previousLayout->constrainedSize; + return _previousLayout.constrainedSize; } else if ([key isEqualToString:ASTransitionContextToLayoutKey]) { - return _pendingLayout->constrainedSize; + return _pendingLayout.constrainedSize; } else { return ASSizeRangeMake(CGSizeZero, CGSizeZero); } @@ -235,6 +262,7 @@ static inline std::vector findNodesInLayoutAtIndexes(ASLayout *layou /** * @abstract Stores the nodes at the given indexes in the `storedNodes` array, storing indexes in a `storedPositions` c++ vector. + * Call only with a flattened layout. * @discussion If the node exists in the `filteredNodes` array, the node is not added to `storedNodes`. */ static inline std::vector findNodesInLayoutAtIndexesWithFilteredNodes(ASLayout *layout, @@ -252,9 +280,9 @@ static inline std::vector findNodesInLayoutAtIndexesWithFilteredNode for (ASLayout *sublayout in layout.sublayouts) { if (idx > lastIndex) { break; } if (idx >= firstIndex && [indexes containsIndex:idx]) { - ASDisplayNode *node = (ASDisplayNode *)sublayout.layoutElement; + ASDisplayNode *node = (ASDisplayNode *)(sublayout.layoutElement); ASDisplayNodeCAssert(node, @"ASDisplayNode was deallocated before it was added to a subnode. It's likely the case that you use automatically manages subnodes and allocate a ASDisplayNode in layoutSpecThatFits: and don't have any strong reference to it."); - // Ignore the odd case in which a non-node sublayout is accessed and the type cast fails + ASDisplayNodeCAssert([node isKindOfClass:[ASDisplayNode class]], @"sublayout is an ASLayout, but not an ASDisplayNode - only call findNodesInLayoutAtIndexesWithFilteredNodes with a flattened layout (all sublayouts are ASDisplayNodes)."); if (node != nil) { BOOL notFiltered = (filteredNodes == nil || [filteredNodes indexOfObjectIdenticalTo:node] == NSNotFound); if (notFiltered) { diff --git a/Source/Private/ASMutableElementMap.h b/Source/Private/ASMutableElementMap.h index 8386862996..ed4f0b5ff4 100644 --- a/Source/Private/ASMutableElementMap.h +++ b/Source/Private/ASMutableElementMap.h @@ -2,17 +2,9 @@ // ASMutableElementMap.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK diff --git a/Source/Private/ASMutableElementMap.m b/Source/Private/ASMutableElementMap.m index 2be29893b5..1e2e203a21 100644 --- a/Source/Private/ASMutableElementMap.m +++ b/Source/Private/ASMutableElementMap.m @@ -2,17 +2,9 @@ // ASMutableElementMap.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK @@ -144,7 +136,7 @@ typedef NSMutableDictionary * _Nonnull obj, BOOL * _Nonnull stop) { deepCopy[key] = [obj mutableCopy]; }]; diff --git a/Source/Private/ASNetworkImageLoadInfo+Private.h b/Source/Private/ASNetworkImageLoadInfo+Private.h index a77d48af6a..36e423b535 100644 --- a/Source/Private/ASNetworkImageLoadInfo+Private.h +++ b/Source/Private/ASNetworkImageLoadInfo+Private.h @@ -2,12 +2,8 @@ // ASNetworkImageLoadInfo+Private.h // Texture // -// Copyright (c) 2018-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Private/ASPendingStateController.h b/Source/Private/ASPendingStateController.h index 259bf75c7c..b50a7c1f94 100644 --- a/Source/Private/ASPendingStateController.h +++ b/Source/Private/ASPendingStateController.h @@ -2,17 +2,9 @@ // ASPendingStateController.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Private/ASPendingStateController.mm b/Source/Private/ASPendingStateController.mm index 187078d14b..89dedfa597 100644 --- a/Source/Private/ASPendingStateController.mm +++ b/Source/Private/ASPendingStateController.mm @@ -2,17 +2,9 @@ // ASPendingStateController.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Private/ASRectMap.h b/Source/Private/ASRectMap.h deleted file mode 100644 index e4b05d7cb0..0000000000 --- a/Source/Private/ASRectMap.h +++ /dev/null @@ -1,52 +0,0 @@ -// -// ASRectMap.h -// Texture -// -// Copyright (c) 2017-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -/** - * A category for indexing weak pointers to CGRects. Similar to ASIntegerMap. - */ -@interface ASRectMap : NSObject - -/** - * Creates a new rect map. The keys are never retained. - */ -+ (ASRectMap *)rectMapForWeakObjectPointers NS_RETURNS_RETAINED; - -/** - * Retrieves the rect for a given key, or CGRectNull if the key is not found. - * - * @param key An object to lookup the rect for. - */ -- (CGRect)rectForKey:(id)key; - -/** - * Sets the given rect for the associated key. Key *will not be retained!* - * - * @param rect The rect to store as value. - * @param key The key to use for the rect. - */ -- (void)setRect:(CGRect)rect forKey:(id)key; - -/** - * Removes the rect for the given key, if one exists. - * - * @param key The key to remove. - */ -- (void)removeRectForKey:(id)key; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Source/Private/ASRectMap.mm b/Source/Private/ASRectMap.mm deleted file mode 100644 index 2e4398c32a..0000000000 --- a/Source/Private/ASRectMap.mm +++ /dev/null @@ -1,78 +0,0 @@ -// -// ASRectMap.mm -// Texture -// -// Copyright (c) 2017-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "ASRectMap.h" -#import "ASObjectDescriptionHelpers.h" -#import -#import - -@implementation ASRectMap { - std::unordered_map _map; -} - -+ (ASRectMap *)rectMapForWeakObjectPointers NS_RETURNS_RETAINED -{ - return [[self alloc] init]; -} - -- (CGRect)rectForKey:(id)key -{ - auto result = _map.find((__bridge void *)key); - if (result != _map.end()) { - // result->first is the key; result->second is the value, a CGRect. - return result->second; - } else { - return CGRectNull; - } -} - -- (void)setRect:(CGRect)rect forKey:(id)key -{ - if (key) { - _map[(__bridge void *)key] = rect; - } -} - -- (void)removeRectForKey:(id)key -{ - if (key) { - _map.erase((__bridge void *)key); - } -} - -- (id)copyWithZone:(NSZone *)zone -{ - ASRectMap *copy = [ASRectMap rectMapForWeakObjectPointers]; - copy->_map = _map; - return copy; -} - -- (NSMutableArray *)propertiesForDescription -{ - NSMutableArray *result = [NSMutableArray array]; - - // { ptr1->rect1 ptr2->rect2 ptr3->rect3 } - NSMutableString *str = [NSMutableString string]; - for (auto it = _map.begin(); it != _map.end(); it++) { - [str appendFormat:@" %@->%@", it->first, NSStringFromCGRect(it->second)]; - } - [result addObject:@{ @"ASRectMap": str }]; - - return result; -} - -- (NSString *)description -{ - return ASObjectDescriptionMakeWithoutObject([self propertiesForDescription]); -} - -@end diff --git a/Source/Private/ASResponderChainEnumerator.h b/Source/Private/ASResponderChainEnumerator.h index df548136b3..dcd2e1c4c4 100644 --- a/Source/Private/ASResponderChainEnumerator.h +++ b/Source/Private/ASResponderChainEnumerator.h @@ -2,17 +2,9 @@ // ASResponderChainEnumerator.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Private/ASResponderChainEnumerator.m b/Source/Private/ASResponderChainEnumerator.m index 35b16db0ba..a127c64c1e 100644 --- a/Source/Private/ASResponderChainEnumerator.m +++ b/Source/Private/ASResponderChainEnumerator.m @@ -2,17 +2,9 @@ // ASResponderChainEnumerator.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ASResponderChainEnumerator.h" diff --git a/Source/Private/ASSection.h b/Source/Private/ASSection.h index 55b4d9ec10..92b6a17170 100644 --- a/Source/Private/ASSection.h +++ b/Source/Private/ASSection.h @@ -2,17 +2,9 @@ // ASSection.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK diff --git a/Source/Private/ASSection.m b/Source/Private/ASSection.m index d3eb5adb85..77e53df71d 100644 --- a/Source/Private/ASSection.m +++ b/Source/Private/ASSection.m @@ -2,17 +2,9 @@ // ASSection.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK diff --git a/Source/Private/ASTableView+Undeprecated.h b/Source/Private/ASTableView+Undeprecated.h index 4ca5b35088..46c54368a6 100644 --- a/Source/Private/ASTableView+Undeprecated.h +++ b/Source/Private/ASTableView+Undeprecated.h @@ -2,17 +2,9 @@ // ASTableView+Undeprecated.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Private/ASTip.h b/Source/Private/ASTip.h index d6aed639a9..5ac6ac18bc 100644 --- a/Source/Private/ASTip.h +++ b/Source/Private/ASTip.h @@ -2,17 +2,9 @@ // ASTip.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Private/ASTip.m b/Source/Private/ASTip.m index c96723b9ab..fde1bbc587 100644 --- a/Source/Private/ASTip.m +++ b/Source/Private/ASTip.m @@ -2,17 +2,9 @@ // ASTip.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ASTip.h" diff --git a/Source/Private/ASTipNode.h b/Source/Private/ASTipNode.h index e5942142b2..d01637d869 100644 --- a/Source/Private/ASTipNode.h +++ b/Source/Private/ASTipNode.h @@ -2,17 +2,9 @@ // ASTipNode.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Private/ASTipNode.m b/Source/Private/ASTipNode.m index 9eadb04691..a4fe4bf4e5 100644 --- a/Source/Private/ASTipNode.m +++ b/Source/Private/ASTipNode.m @@ -2,17 +2,9 @@ // ASTipNode.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ASTipNode.h" diff --git a/Source/Private/ASTipProvider.h b/Source/Private/ASTipProvider.h index 93855bcd8b..e2aba6c5d9 100644 --- a/Source/Private/ASTipProvider.h +++ b/Source/Private/ASTipProvider.h @@ -2,17 +2,9 @@ // ASTipProvider.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Private/ASTipProvider.m b/Source/Private/ASTipProvider.m index a6a40457b9..7787997376 100644 --- a/Source/Private/ASTipProvider.m +++ b/Source/Private/ASTipProvider.m @@ -2,17 +2,9 @@ // ASTipProvider.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ASTipProvider.h" diff --git a/Source/Private/ASTipsController.h b/Source/Private/ASTipsController.h index 959d464384..fceeb92f60 100644 --- a/Source/Private/ASTipsController.h +++ b/Source/Private/ASTipsController.h @@ -2,17 +2,9 @@ // ASTipsController.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Private/ASTipsController.m b/Source/Private/ASTipsController.m index b3d67e7bb7..d12b3189bf 100644 --- a/Source/Private/ASTipsController.m +++ b/Source/Private/ASTipsController.m @@ -2,17 +2,9 @@ // ASTipsController.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ASTipsController.h" diff --git a/Source/Private/ASTipsWindow.h b/Source/Private/ASTipsWindow.h index 339071f2f3..fab52510fc 100644 --- a/Source/Private/ASTipsWindow.h +++ b/Source/Private/ASTipsWindow.h @@ -2,17 +2,9 @@ // ASTipsWindow.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Private/ASTipsWindow.m b/Source/Private/ASTipsWindow.m index 19d26edbe7..a330fc7d59 100644 --- a/Source/Private/ASTipsWindow.m +++ b/Source/Private/ASTipsWindow.m @@ -2,17 +2,9 @@ // ASTipsWindow.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ASTipsWindow.h" diff --git a/Source/Private/ASTwoDimensionalArrayUtils.h b/Source/Private/ASTwoDimensionalArrayUtils.h index ac9c9d92b1..6a3c9bb5ce 100644 --- a/Source/Private/ASTwoDimensionalArrayUtils.h +++ b/Source/Private/ASTwoDimensionalArrayUtils.h @@ -2,17 +2,9 @@ // ASTwoDimensionalArrayUtils.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Private/ASTwoDimensionalArrayUtils.m b/Source/Private/ASTwoDimensionalArrayUtils.m index d1ce81360e..c9c2b658d8 100644 --- a/Source/Private/ASTwoDimensionalArrayUtils.m +++ b/Source/Private/ASTwoDimensionalArrayUtils.m @@ -2,17 +2,9 @@ // ASTwoDimensionalArrayUtils.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import @@ -55,14 +47,14 @@ void ASDeleteElementsInTwoDimensionalArrayAtIndexPaths(NSMutableArray *mutableAr for (NSIndexPath *indexPath in indexPaths) { NSInteger section = indexPath.section; if (section >= mutableArray.count) { - ASDisplayNodeCFailAssert(@"Invalid section index %zd – only %zd sections", section, mutableArray.count); + ASDisplayNodeCFailAssert(@"Invalid section index %ld – only %ld sections", (long)section, (long)mutableArray.count); continue; } NSMutableArray *subarray = mutableArray[section]; NSInteger item = indexPath.item; if (item >= subarray.count) { - ASDisplayNodeCFailAssert(@"Invalid item index %zd – only %zd items in section %zd", item, subarray.count, section); + ASDisplayNodeCFailAssert(@"Invalid item index %ld – only %ld items in section %ld", (long)item, (long)subarray.count, (long)section); continue; } [subarray removeObjectAtIndex:item]; diff --git a/Source/Private/ASWeakMap.h b/Source/Private/ASWeakMap.h index 1a0b372667..1f413ca7ae 100644 --- a/Source/Private/ASWeakMap.h +++ b/Source/Private/ASWeakMap.h @@ -2,17 +2,9 @@ // ASWeakMap.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Private/ASWeakMap.m b/Source/Private/ASWeakMap.m index 4ca09c953e..42f192f9c6 100644 --- a/Source/Private/ASWeakMap.m +++ b/Source/Private/ASWeakMap.m @@ -2,17 +2,9 @@ // ASWeakMap.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Private/Layout/ASLayoutElementStylePrivate.h b/Source/Private/Layout/ASLayoutElementStylePrivate.h index 55675dc1b1..375be772e9 100644 --- a/Source/Private/Layout/ASLayoutElementStylePrivate.h +++ b/Source/Private/Layout/ASLayoutElementStylePrivate.h @@ -2,17 +2,9 @@ // ASLayoutElementStylePrivate.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #pragma once diff --git a/Source/Private/Layout/ASLayoutSpecPrivate.h b/Source/Private/Layout/ASLayoutSpecPrivate.h index f8813afebc..0a4a39b5d5 100644 --- a/Source/Private/Layout/ASLayoutSpecPrivate.h +++ b/Source/Private/Layout/ASLayoutSpecPrivate.h @@ -2,17 +2,9 @@ // ASLayoutSpecPrivate.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Private/Layout/ASLayoutSpecUtilities.h b/Source/Private/Layout/ASLayoutSpecUtilities.h index 7bef9a98d1..62a3d9177b 100644 --- a/Source/Private/Layout/ASLayoutSpecUtilities.h +++ b/Source/Private/Layout/ASLayoutSpecUtilities.h @@ -2,17 +2,9 @@ // ASLayoutSpecUtilities.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Private/Layout/ASStackLayoutSpecUtilities.h b/Source/Private/Layout/ASStackLayoutSpecUtilities.h index dbb2c74352..6c708e0408 100644 --- a/Source/Private/Layout/ASStackLayoutSpecUtilities.h +++ b/Source/Private/Layout/ASStackLayoutSpecUtilities.h @@ -2,17 +2,9 @@ // ASStackLayoutSpecUtilities.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Private/Layout/ASStackPositionedLayout.h b/Source/Private/Layout/ASStackPositionedLayout.h index c9ed7fafdf..103ec3a280 100644 --- a/Source/Private/Layout/ASStackPositionedLayout.h +++ b/Source/Private/Layout/ASStackPositionedLayout.h @@ -2,17 +2,9 @@ // ASStackPositionedLayout.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Private/Layout/ASStackPositionedLayout.mm b/Source/Private/Layout/ASStackPositionedLayout.mm index 9b1ba020a7..727db5d2dd 100644 --- a/Source/Private/Layout/ASStackPositionedLayout.mm +++ b/Source/Private/Layout/ASStackPositionedLayout.mm @@ -2,17 +2,9 @@ // ASStackPositionedLayout.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Private/Layout/ASStackUnpositionedLayout.h b/Source/Private/Layout/ASStackUnpositionedLayout.h index 4347a4b0c9..989b4c2f11 100644 --- a/Source/Private/Layout/ASStackUnpositionedLayout.h +++ b/Source/Private/Layout/ASStackUnpositionedLayout.h @@ -2,17 +2,9 @@ // ASStackUnpositionedLayout.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Private/Layout/ASStackUnpositionedLayout.mm b/Source/Private/Layout/ASStackUnpositionedLayout.mm index 1dff933485..47141a7f7b 100644 --- a/Source/Private/Layout/ASStackUnpositionedLayout.mm +++ b/Source/Private/Layout/ASStackUnpositionedLayout.mm @@ -2,17 +2,9 @@ // ASStackUnpositionedLayout.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Private/TextExperiment/Component/ASTextDebugOption.h b/Source/Private/TextExperiment/Component/ASTextDebugOption.h old mode 100755 new mode 100644 index c5d18d74bb..efa7808c87 --- a/Source/Private/TextExperiment/Component/ASTextDebugOption.h +++ b/Source/Private/TextExperiment/Component/ASTextDebugOption.h @@ -1,12 +1,9 @@ // // ASTextDebugOption.h -// Modified from YYText +// Texture // -// Created by ibireme on 15/4/8. -// Copyright (c) 2015 ibireme. -// -// This source code is licensed under the MIT-style license found in the -// LICENSE file in the root directory of this source tree. +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Private/TextExperiment/Component/ASTextDebugOption.m b/Source/Private/TextExperiment/Component/ASTextDebugOption.m old mode 100755 new mode 100644 index 2e0a706eaa..6b74b0990b --- a/Source/Private/TextExperiment/Component/ASTextDebugOption.m +++ b/Source/Private/TextExperiment/Component/ASTextDebugOption.m @@ -1,12 +1,9 @@ // // ASTextDebugOption.m -// Modified from YYText +// Texture // -// Created by ibireme on 15/4/8. -// Copyright (c) 2015 ibireme. -// -// This source code is licensed under the MIT-style license found in the -// LICENSE file in the root directory of this source tree. +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ASTextDebugOption.h" diff --git a/Source/Private/TextExperiment/Component/ASTextInput.h b/Source/Private/TextExperiment/Component/ASTextInput.h old mode 100755 new mode 100644 index f3bdb03d96..9a6cbd13d1 --- a/Source/Private/TextExperiment/Component/ASTextInput.h +++ b/Source/Private/TextExperiment/Component/ASTextInput.h @@ -2,17 +2,9 @@ // ASTextInput.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) through the present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Private/TextExperiment/Component/ASTextInput.m b/Source/Private/TextExperiment/Component/ASTextInput.m old mode 100755 new mode 100644 index a56426b161..07bc6cb6d5 --- a/Source/Private/TextExperiment/Component/ASTextInput.m +++ b/Source/Private/TextExperiment/Component/ASTextInput.m @@ -2,17 +2,9 @@ // ASTextInput.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) through the present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Private/TextExperiment/Component/ASTextLayout.h b/Source/Private/TextExperiment/Component/ASTextLayout.h old mode 100755 new mode 100644 index 544d9f5f33..46bc8ccf52 --- a/Source/Private/TextExperiment/Component/ASTextLayout.h +++ b/Source/Private/TextExperiment/Component/ASTextLayout.h @@ -2,17 +2,9 @@ // ASTextLayout.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) through the present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import @@ -67,6 +59,9 @@ AS_EXTERN const CGSize ASTextContainerMaxSize; /// Creates a container with the specified path. @param path The path. + (instancetype)containerWithPath:(nullable UIBezierPath *)path NS_RETURNS_RETAINED; +/// Mark this immutable, so you get free copies going forward. +- (void)makeImmutable; + /// The constrained size. (if the size is larger than ASTextContainerMaxSize, it will be clipped) @property CGSize size; @@ -225,8 +220,6 @@ AS_EXTERN const CGSize ASTextContainerMaxSize; @property (nonatomic, readonly) NSAttributedString *text; ///< The text range in full text @property (nonatomic, readonly) NSRange range; -///< CTFrameSetter -@property (nonatomic, readonly) CTFramesetterRef frameSetter; ///< CTFrame @property (nonatomic, readonly) CTFrameRef frame; ///< Array of `ASTextLine`, no truncated diff --git a/Source/Private/TextExperiment/Component/ASTextLayout.m b/Source/Private/TextExperiment/Component/ASTextLayout.m old mode 100755 new mode 100644 index 2f475908b8..5c0b0cda53 --- a/Source/Private/TextExperiment/Component/ASTextLayout.m +++ b/Source/Private/TextExperiment/Component/ASTextLayout.m @@ -2,25 +2,22 @@ // ASTextLayout.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) through the present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import + +#import +#import #import #import #import #import +#import + const CGSize ASTextContainerMaxSize = (CGSize){0x100000, 0x100000}; typedef struct { @@ -130,26 +127,36 @@ static CGColorRef ASTextGetCGColor(CGColorRef color) { return self; } -- (id)copyWithZone:(NSZone *)zone { - ASTextContainer *one = [self.class new]; +- (id)copyForced:(BOOL)forceCopy +{ dispatch_semaphore_wait(_lock, DISPATCH_TIME_FOREVER); + if (_readonly && !forceCopy) { + dispatch_semaphore_signal(_lock); + return self; + } + + ASTextContainer *one = [self.class new]; one->_size = _size; one->_insets = _insets; one->_path = _path; - one->_exclusionPaths = _exclusionPaths.copy; + one->_exclusionPaths = [_exclusionPaths copy]; one->_pathFillEvenOdd = _pathFillEvenOdd; one->_pathLineWidth = _pathLineWidth; one->_verticalForm = _verticalForm; one->_maximumNumberOfRows = _maximumNumberOfRows; one->_truncationType = _truncationType; - one->_truncationToken = _truncationToken.copy; + one->_truncationToken = [_truncationToken copy]; one->_linePositionModifier = [(NSObject *)_linePositionModifier copy]; dispatch_semaphore_signal(_lock); return one; } -- (id)mutableCopyWithZone:(nullable NSZone *)zone { - return [self copyWithZone:zone]; +- (id)copyWithZone:(NSZone *)zone { + return [self copyForced:NO]; +} + +- (id)mutableCopyWithZone:(NSZone *)zone { + return [self copyForced:YES]; } - (void)encodeWithCoder:(NSCoder *)aCoder { @@ -185,18 +192,25 @@ static CGColorRef ASTextGetCGColor(CGColorRef color) { return self; } +- (void)makeImmutable +{ + dispatch_semaphore_wait(_lock, DISPATCH_TIME_FOREVER); + _readonly = YES; + dispatch_semaphore_signal(_lock); +} + #define Getter(...) \ dispatch_semaphore_wait(_lock, DISPATCH_TIME_FOREVER); \ __VA_ARGS__; \ dispatch_semaphore_signal(_lock); #define Setter(...) \ -if (_readonly) { \ -@throw [NSException exceptionWithName:NSInternalInconsistencyException \ -reason:@"Cannot change the property of the 'container' in 'ASTextLayout'." userInfo:nil]; \ -return; \ -} \ dispatch_semaphore_wait(_lock, DISPATCH_TIME_FOREVER); \ +if (__builtin_expect(_readonly, NO)) { \ + ASDisplayNodeFailAssert(@"Attempt to modify immutable text container."); \ + dispatch_semaphore_signal(_lock); \ + return; \ +} \ __VA_ARGS__; \ dispatch_semaphore_signal(_lock); @@ -320,7 +334,6 @@ dispatch_semaphore_signal(_lock); @property (nonatomic) NSAttributedString *text; @property (nonatomic) NSRange range; -@property (nonatomic) CTFramesetterRef frameSetter; @property (nonatomic) CTFrameRef frame; @property (nonatomic) NSArray *lines; @property (nonatomic) ASTextLine *truncatedLine; @@ -404,11 +417,10 @@ dispatch_semaphore_signal(_lock); if (lineRowsIndex) free(lineRowsIndex); \ return nil; } - text = text.mutableCopy; - container = container.copy; + container = [container copy]; if (!text || !container) return nil; if (range.location + range.length > text.length) return nil; - container->_readonly = YES; + [container makeImmutable]; maximumNumberOfRows = container.maximumNumberOfRows; // It may use larger constraint size when create CTFrame with @@ -484,10 +496,71 @@ dispatch_semaphore_signal(_lock); frameAttrs[(id)kCTFrameProgressionAttributeName] = @(kCTFrameProgressionRightToLeft); } - // create CoreText objects - ctSetter = CTFramesetterCreateWithAttributedString((CFAttributedStringRef)text); + /* + * Framesetter cache. + * Framesetters can only be used by one thread at a time. + * Create a CFSet with no callbacks (raw pointers) to keep track of which + * framesetters are in use on other threads. If the one for our string is already in use, + * just create a new one. This should be pretty rare. + */ + static pthread_mutex_t busyFramesettersLock = PTHREAD_MUTEX_INITIALIZER; + static NSCache *framesetterCache; + static CFMutableSetRef busyFramesetters; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + if (ASActivateExperimentalFeature(ASExperimentalFramesetterCache)) { + framesetterCache = [[NSCache alloc] init]; + framesetterCache.name = @"org.TextureGroup.Texture.framesetterCache"; + busyFramesetters = CFSetCreateMutable(NULL, 0, NULL); + } + }); + + BOOL haveCached = NO, useCached = NO; + if (framesetterCache) { + // Check if there's one in the cache. + ctSetter = (__bridge_retained CTFramesetterRef)[framesetterCache objectForKey:text]; + + if (ctSetter) { + haveCached = YES; + + // Check-and-set busy on the cached one. + pthread_mutex_lock(&busyFramesettersLock); + BOOL busy = CFSetContainsValue(busyFramesetters, ctSetter); + if (!busy) { + CFSetAddValue(busyFramesetters, ctSetter); + useCached = YES; + } + pthread_mutex_unlock(&busyFramesettersLock); + + // Release if it was busy. + if (busy) { + CFRelease(ctSetter); + ctSetter = NULL; + } + } + } + + // Create a framesetter if needed. + if (!ctSetter) { + ctSetter = CTFramesetterCreateWithAttributedString((CFAttributedStringRef)text); + } + if (!ctSetter) FAIL_AND_RETURN ctFrame = CTFramesetterCreateFrame(ctSetter, ASTextCFRangeFromNSRange(range), cgPath, (CFDictionaryRef)frameAttrs); + + // Return to cache. + if (framesetterCache) { + if (useCached) { + // If reused: mark available. + pthread_mutex_lock(&busyFramesettersLock); + CFSetRemoveValue(busyFramesetters, ctSetter); + pthread_mutex_unlock(&busyFramesettersLock); + } else if (!haveCached) { + // If first framesetter, add to cache. + [framesetterCache setObject:(__bridge id)ctSetter forKey:text]; + } + } + if (!ctFrame) FAIL_AND_RETURN lines = [NSMutableArray new]; ctLines = CTFrameGetLines(ctFrame); @@ -857,8 +930,7 @@ dispatch_semaphore_signal(_lock); if (attachments.count == 0) { attachments = attachmentRanges = attachmentRects = nil; } - - layout.frameSetter = ctSetter; + layout.frame = ctFrame; layout.lines = lines; layout.truncatedLine = truncatedLine; @@ -903,14 +975,6 @@ dispatch_semaphore_signal(_lock); return layouts; } -- (void)setFrameSetter:(CTFramesetterRef)frameSetter { - if (_frameSetter != frameSetter) { - if (frameSetter) CFRetain(frameSetter); - if (_frameSetter) CFRelease(_frameSetter); - _frameSetter = frameSetter; - } -} - - (void)setFrame:(CTFrameRef)frame { if (_frame != frame) { if (frame) CFRetain(frame); @@ -920,7 +984,6 @@ dispatch_semaphore_signal(_lock); } - (void)dealloc { - if (_frameSetter) CFRelease(_frameSetter); if (_frame) CFRelease(_frame); if (_lineRowsIndex) free(_lineRowsIndex); if (_lineRowsEdge) free(_lineRowsEdge); @@ -1959,7 +2022,7 @@ dispatch_semaphore_signal(_lock); range = [self _correctedRangeWithEdge:range]; BOOL isVertical = _container.verticalForm; - NSMutableArray *rects = [[NSMutableArray alloc] init]; + NSMutableArray *rects = [[NSMutableArray alloc] init]; if (!range) return rects; NSUInteger startLineIndex = [self lineIndexForPosition:range.start]; diff --git a/Source/Private/TextExperiment/Component/ASTextLine.h b/Source/Private/TextExperiment/Component/ASTextLine.h old mode 100755 new mode 100644 index af0a394ebf..acb02e991b --- a/Source/Private/TextExperiment/Component/ASTextLine.h +++ b/Source/Private/TextExperiment/Component/ASTextLine.h @@ -2,17 +2,9 @@ // ASTextLine.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) through the present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Private/TextExperiment/Component/ASTextLine.m b/Source/Private/TextExperiment/Component/ASTextLine.m old mode 100755 new mode 100644 index a0b8a173d0..672b18c7a9 --- a/Source/Private/TextExperiment/Component/ASTextLine.m +++ b/Source/Private/TextExperiment/Component/ASTextLine.m @@ -2,17 +2,9 @@ // ASTextLine.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) through the present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import @@ -153,7 +145,7 @@ - (NSString *)description { NSMutableString *desc = @"".mutableCopy; NSRange range = self.range; - [desc appendFormat:@" row:%zd range:%tu,%tu",self, self.row, range.location, range.length]; + [desc appendFormat:@" row:%ld range:%tu,%tu", self, (long)self.row, range.location, range.length]; [desc appendFormat:@" position:%@",NSStringFromCGPoint(self.position)]; [desc appendFormat:@" bounds:%@",NSStringFromCGRect(self.bounds)]; return desc; diff --git a/Source/Private/TextExperiment/String/ASTextAttribute.h b/Source/Private/TextExperiment/String/ASTextAttribute.h old mode 100755 new mode 100644 index 49e868131b..2d9e3771a0 --- a/Source/Private/TextExperiment/String/ASTextAttribute.h +++ b/Source/Private/TextExperiment/String/ASTextAttribute.h @@ -2,17 +2,9 @@ // ASTextAttribute.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) through the present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Private/TextExperiment/String/ASTextAttribute.m b/Source/Private/TextExperiment/String/ASTextAttribute.m old mode 100755 new mode 100644 index f5bb64224c..fb4b01b6f2 --- a/Source/Private/TextExperiment/String/ASTextAttribute.m +++ b/Source/Private/TextExperiment/String/ASTextAttribute.m @@ -2,17 +2,9 @@ // ASTextAttribute.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) through the present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ASTextAttribute.h" diff --git a/Source/Private/TextExperiment/String/ASTextRunDelegate.h b/Source/Private/TextExperiment/String/ASTextRunDelegate.h old mode 100755 new mode 100644 index 62683420b5..3d3bf11c2c --- a/Source/Private/TextExperiment/String/ASTextRunDelegate.h +++ b/Source/Private/TextExperiment/String/ASTextRunDelegate.h @@ -1,12 +1,9 @@ // // ASTextRunDelegate.h -// ASText +// Texture // -// Created by ibireme on 14/10/14. -// Copyright (c) 2015 ibireme. -// -// This source code is licensed under the MIT-style license found in the -// LICENSE file in the root directory of this source tree. +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Private/TextExperiment/String/ASTextRunDelegate.m b/Source/Private/TextExperiment/String/ASTextRunDelegate.m old mode 100755 new mode 100644 index f7739f0c8d..aa4154a91c --- a/Source/Private/TextExperiment/String/ASTextRunDelegate.m +++ b/Source/Private/TextExperiment/String/ASTextRunDelegate.m @@ -1,12 +1,9 @@ // // ASTextRunDelegate.m -// ASText +// Texture // -// Created by ibireme on 14/10/14. -// Copyright (c) 2015 ibireme. -// -// This source code is licensed under the MIT-style license found in the -// LICENSE file in the root directory of this source tree. +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Private/TextExperiment/Utility/ASTextUtilities.h b/Source/Private/TextExperiment/Utility/ASTextUtilities.h old mode 100755 new mode 100644 index 024fb269c4..f21a931ba8 --- a/Source/Private/TextExperiment/Utility/ASTextUtilities.h +++ b/Source/Private/TextExperiment/Utility/ASTextUtilities.h @@ -1,12 +1,9 @@ // // ASTextUtilities.h -// Modified from YYText +// Texture // -// Created by ibireme on 15/4/6. -// Copyright (c) 2015 ibireme. -// -// This source code is licensed under the MIT-style license found in the -// LICENSE file in the root directory of this source tree. +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Private/TextExperiment/Utility/ASTextUtilities.m b/Source/Private/TextExperiment/Utility/ASTextUtilities.m old mode 100755 new mode 100644 index 17e6971355..624f73e924 --- a/Source/Private/TextExperiment/Utility/ASTextUtilities.m +++ b/Source/Private/TextExperiment/Utility/ASTextUtilities.m @@ -1,12 +1,9 @@ // // ASTextUtilities.m -// Modified from YYText +// Texture // -// Created by ibireme on 15/4/6. -// Copyright (c) 2015 ibireme. -// -// This source code is licensed under the MIT-style license found in the -// LICENSE file in the root directory of this source tree. +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ASTextUtilities.h" diff --git a/Source/Private/TextExperiment/Utility/NSAttributedString+ASText.h b/Source/Private/TextExperiment/Utility/NSAttributedString+ASText.h old mode 100755 new mode 100644 index dfae840d32..ef44fb4f35 --- a/Source/Private/TextExperiment/Utility/NSAttributedString+ASText.h +++ b/Source/Private/TextExperiment/Utility/NSAttributedString+ASText.h @@ -1,12 +1,9 @@ // // NSAttributedString+ASText.h -// Modified from YYText +// Texture // -// Created by ibireme on 14/10/7. -// Copyright (c) 2015 ibireme. -// -// This source code is licensed under the MIT-style license found in the -// LICENSE file in the root directory of this source tree. +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Private/TextExperiment/Utility/NSAttributedString+ASText.m b/Source/Private/TextExperiment/Utility/NSAttributedString+ASText.m old mode 100755 new mode 100644 index 1b05bbf73a..134effc161 --- a/Source/Private/TextExperiment/Utility/NSAttributedString+ASText.m +++ b/Source/Private/TextExperiment/Utility/NSAttributedString+ASText.m @@ -1,12 +1,9 @@ // // NSAttributedString+ASText.m -// Modified from YYText +// Texture // -// Created by ibireme on 14/10/7. -// Copyright (c) 2015 ibireme. -// -// This source code is licensed under the MIT-style license found in the -// LICENSE file in the root directory of this source tree. +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Private/TextExperiment/Utility/NSParagraphStyle+ASText.h b/Source/Private/TextExperiment/Utility/NSParagraphStyle+ASText.h old mode 100755 new mode 100644 index b7c21f8121..a7c0aec5ff --- a/Source/Private/TextExperiment/Utility/NSParagraphStyle+ASText.h +++ b/Source/Private/TextExperiment/Utility/NSParagraphStyle+ASText.h @@ -1,12 +1,9 @@ // // NSParagraphStyle+ASText.h -// Modified from YYText +// Texture // -// Created by ibireme on 14/10/7. -// Copyright (c) 2015 ibireme. -// -// This source code is licensed under the MIT-style license found in the -// LICENSE file in the root directory of this source tree. +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Private/TextExperiment/Utility/NSParagraphStyle+ASText.m b/Source/Private/TextExperiment/Utility/NSParagraphStyle+ASText.m old mode 100755 new mode 100644 index 2374e4021a..94680d3f00 --- a/Source/Private/TextExperiment/Utility/NSParagraphStyle+ASText.m +++ b/Source/Private/TextExperiment/Utility/NSParagraphStyle+ASText.m @@ -1,12 +1,9 @@ // // NSParagraphStyle+ASText.m -// Modified from YYText +// Texture // -// Created by ibireme on 14/10/7. -// Copyright (c) 2015 ibireme. -// -// This source code is licensed under the MIT-style license found in the -// LICENSE file in the root directory of this source tree. +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Private/_ASCollectionGalleryLayoutInfo.h b/Source/Private/_ASCollectionGalleryLayoutInfo.h index 72dfc7db62..6d7c91e5e5 100644 --- a/Source/Private/_ASCollectionGalleryLayoutInfo.h +++ b/Source/Private/_ASCollectionGalleryLayoutInfo.h @@ -2,12 +2,8 @@ // _ASCollectionGalleryLayoutInfo.h // Texture // -// Copyright (c) 2017-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Private/_ASCollectionGalleryLayoutInfo.m b/Source/Private/_ASCollectionGalleryLayoutInfo.m index 4dc9209d0b..8cca556bac 100644 --- a/Source/Private/_ASCollectionGalleryLayoutInfo.m +++ b/Source/Private/_ASCollectionGalleryLayoutInfo.m @@ -2,12 +2,8 @@ // _ASCollectionGalleryLayoutInfo.m // Texture // -// Copyright (c) 2017-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Private/_ASCollectionGalleryLayoutItem.h b/Source/Private/_ASCollectionGalleryLayoutItem.h index 350944e6ab..21df3bcdc0 100644 --- a/Source/Private/_ASCollectionGalleryLayoutItem.h +++ b/Source/Private/_ASCollectionGalleryLayoutItem.h @@ -2,12 +2,8 @@ // _ASCollectionGalleryLayoutItem.h // Texture // -// Copyright (c) 2017-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK diff --git a/Source/Private/_ASCollectionGalleryLayoutItem.mm b/Source/Private/_ASCollectionGalleryLayoutItem.mm index d503b6cef9..582d7983cc 100644 --- a/Source/Private/_ASCollectionGalleryLayoutItem.mm +++ b/Source/Private/_ASCollectionGalleryLayoutItem.mm @@ -2,12 +2,8 @@ // _ASCollectionGalleryLayoutItem.mm // Texture // -// Copyright (c) 2017-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK diff --git a/Source/Private/_ASCoreAnimationExtras.h b/Source/Private/_ASCoreAnimationExtras.h index e4a15ddf3e..5937f3012c 100644 --- a/Source/Private/_ASCoreAnimationExtras.h +++ b/Source/Private/_ASCoreAnimationExtras.h @@ -2,17 +2,9 @@ // _ASCoreAnimationExtras.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Private/_ASCoreAnimationExtras.mm b/Source/Private/_ASCoreAnimationExtras.mm index 34a515abd2..bac2f44ba7 100644 --- a/Source/Private/_ASCoreAnimationExtras.mm +++ b/Source/Private/_ASCoreAnimationExtras.mm @@ -2,17 +2,9 @@ // _ASCoreAnimationExtras.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import @@ -26,6 +18,11 @@ void ASDisplayNodeSetupLayerContentsWithResizableImage(CALayer *layer, UIImage * void ASDisplayNodeSetResizableContents(id obj, UIImage *image) { + // FIXME (https://github.com/TextureGroup/Texture/issues/1046): This method does not currently handle UIImageResizingModeTile, which is the default. + // See also https://developer.apple.com/documentation/uikit/uiimage/1624157-resizingmode?language=objc + // I'm not sure of a way to use CALayer directly to perform such tiling on the GPU, though the stretch is handled by the GPU, + // and CALayer.h documents the fact that contentsCenter is used to stretch the pixels. + if (image) { ASDisplayNodeCAssert(image.resizingMode == UIImageResizingModeStretch || UIEdgeInsetsEqualToEdgeInsets(image.capInsets, UIEdgeInsetsZero), @"Image insets must be all-zero or resizingMode has to be UIImageResizingModeStretch. XCode assets default value is UIImageResizingModeTile which is not supported by Texture because of GPU-accelerated CALayer features."); @@ -98,7 +95,7 @@ static const struct _UIContentModeStringLUTEntry UIContentModeDescriptionLUT[] = NSString *ASDisplayNodeNSStringFromUIContentMode(UIViewContentMode contentMode) { - for (auto &e : UIContentModeDescriptionLUT) { + for (let &e : UIContentModeDescriptionLUT) { if (e.contentMode == contentMode) { return e.string; } @@ -108,7 +105,7 @@ NSString *ASDisplayNodeNSStringFromUIContentMode(UIViewContentMode contentMode) UIViewContentMode ASDisplayNodeUIContentModeFromNSString(NSString *string) { - for (auto &e : UIContentModeDescriptionLUT) { + for (let &e : UIContentModeDescriptionLUT) { if (ASObjectIsEqual(e.string, string)) { return e.contentMode; } @@ -118,12 +115,12 @@ UIViewContentMode ASDisplayNodeUIContentModeFromNSString(NSString *string) NSString *const ASDisplayNodeCAContentsGravityFromUIContentMode(UIViewContentMode contentMode) { - for (auto &e : UIContentModeCAGravityLUT) { + for (let &e : UIContentModeCAGravityLUT) { if (e.contentMode == contentMode) { return e.string; } } - ASDisplayNodeCAssert(contentMode == UIViewContentModeRedraw, @"Encountered an unknown contentMode %zd. Is this a new version of iOS?", contentMode); + ASDisplayNodeCAssert(contentMode == UIViewContentModeRedraw, @"Encountered an unknown contentMode %ld. Is this a new version of iOS?", (long)contentMode); // Redraw is ok to return nil. return nil; } @@ -140,7 +137,7 @@ UIViewContentMode ASDisplayNodeUIContentModeFromCAContentsGravity(NSString *cons return cachedModes[foundCacheIndex]; } - for (auto &e : UIContentModeCAGravityLUT) { + for (let &e : UIContentModeCAGravityLUT) { if (ASObjectIsEqual(e.string, contentsGravity)) { UIViewContentMode foundContentMode = e.contentMode; diff --git a/Source/Private/_ASHierarchyChangeSet.h b/Source/Private/_ASHierarchyChangeSet.h index 44e9de450d..402f2be3ff 100644 --- a/Source/Private/_ASHierarchyChangeSet.h +++ b/Source/Private/_ASHierarchyChangeSet.h @@ -2,17 +2,9 @@ // _ASHierarchyChangeSet.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK diff --git a/Source/Private/_ASHierarchyChangeSet.mm b/Source/Private/_ASHierarchyChangeSet.mm index 047c51c225..b852ea2ecd 100644 --- a/Source/Private/_ASHierarchyChangeSet.mm +++ b/Source/Private/_ASHierarchyChangeSet.mm @@ -2,23 +2,16 @@ // _ASHierarchyChangeSet.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #ifndef MINIMAL_ASDK #import #import +#import #import #import #import @@ -239,7 +232,7 @@ NSString *NSStringFromASHierarchyChangeType(_ASHierarchyChangeType changeType) - (NSIndexSet *)indexesForItemChangesOfType:(_ASHierarchyChangeType)changeType inSection:(NSUInteger)section { [self _ensureCompleted]; - auto result = [[NSMutableIndexSet alloc] init]; + let result = [[NSMutableIndexSet alloc] init]; for (_ASHierarchyItemChange *change in [self itemChangesOfType:changeType]) { [result addIndexes:[NSIndexSet as_indexSetFromIndexPaths:change.indexPaths inSection:section]]; } @@ -281,10 +274,10 @@ NSString *NSStringFromASHierarchyChangeType(_ASHierarchyChangeType changeType) if (_itemMappings == nil) { _itemMappings = [[NSMutableArray alloc] init]; - auto insertMap = [_ASHierarchyItemChange sectionToIndexSetMapFromChanges:_originalInsertItemChanges]; - auto deleteMap = [_ASHierarchyItemChange sectionToIndexSetMapFromChanges:_originalDeleteItemChanges]; + let insertMap = [_ASHierarchyItemChange sectionToIndexSetMapFromChanges:_originalInsertItemChanges]; + let deleteMap = [_ASHierarchyItemChange sectionToIndexSetMapFromChanges:_originalDeleteItemChanges]; NSInteger oldSection = 0; - for (auto oldCount : _oldItemCounts) { + for (let oldCount : _oldItemCounts) { NSInteger newSection = [self newSectionForOldSection:oldSection]; ASIntegerMap *table; if (newSection == NSNotFound) { @@ -499,7 +492,7 @@ NSString *NSStringFromASHierarchyChangeType(_ASHierarchyChangeType changeType) for (_ASHierarchyItemChange *change in _reloadItemChanges) { NSAssert(change.changeType == _ASHierarchyChangeTypeReload, @"It must be a reload change to be in here"); - auto newIndexPaths = ASArrayByFlatMapping(change.indexPaths, NSIndexPath *indexPath, [self newIndexPathForOldIndexPath:indexPath]); + let newIndexPaths = ASArrayByFlatMapping(change.indexPaths, NSIndexPath *indexPath, [self newIndexPathForOldIndexPath:indexPath]); // All reload changes are translated into deletes and inserts // We delete the items that needs reload together with other deleted items, at their original index @@ -537,7 +530,7 @@ NSString *NSStringFromASHierarchyChangeType(_ASHierarchyChangeType changeType) NSInteger deletedSectionCount = _deletedSections.count; // Assert that the new section count is correct. if (newSectionCount != oldSectionCount + insertedSectionCount - deletedSectionCount) { - ASFailUpdateValidation(@"Invalid number of sections. The number of sections after the update (%zd) must be equal to the number of sections before the update (%zd) plus or minus the number of sections inserted or deleted (%tu inserted, %tu deleted)", newSectionCount, oldSectionCount, insertedSectionCount, deletedSectionCount); + ASFailUpdateValidation(@"Invalid number of sections. The number of sections after the update (%ld) must be equal to the number of sections before the update (%ld) plus or minus the number of sections inserted or deleted (%ld inserted, %ld deleted)", (long)newSectionCount, (long)oldSectionCount, (long)insertedSectionCount, (long)deletedSectionCount); return; } @@ -549,7 +542,7 @@ NSString *NSStringFromASHierarchyChangeType(_ASHierarchyChangeType changeType) invalidSectionDelete = [_deletedSections indexGreaterThanIndex:oldSectionCount - 1]; } if (invalidSectionDelete != NSNotFound) { - ASFailUpdateValidation(@"Attempt to delete section %zd but there are only %zd sections before the update.", invalidSectionDelete, oldSectionCount); + ASFailUpdateValidation(@"Attempt to delete section %ld but there are only %ld sections before the update.", (long)invalidSectionDelete, (long)oldSectionCount); return; } @@ -559,14 +552,14 @@ NSString *NSStringFromASHierarchyChangeType(_ASHierarchyChangeType changeType) NSInteger section = indexPath.section; NSInteger item = indexPath.item; if (section >= oldSectionCount) { - ASFailUpdateValidation(@"Attempt to delete item %zd from section %zd, but there are only %zd sections before the update.", item, section, oldSectionCount); + ASFailUpdateValidation(@"Attempt to delete item %ld from section %ld, but there are only %ld sections before the update.", (long)item, (long)section, (long)oldSectionCount); return; } // Assert that item delete happened to a valid item. NSInteger oldItemCount = _oldItemCounts[section]; if (item >= oldItemCount) { - ASFailUpdateValidation(@"Attempt to delete item %zd from section %zd, which only contains %zd items before the update.", item, section, oldItemCount); + ASFailUpdateValidation(@"Attempt to delete item %ld from section %ld, which only contains %ld items before the update.", (long)item, (long)section, (long)oldItemCount); return; } } @@ -578,14 +571,14 @@ NSString *NSStringFromASHierarchyChangeType(_ASHierarchyChangeType changeType) NSInteger item = indexPath.item; // Assert that item insert happened in a valid section. if (section >= newSectionCount) { - ASFailUpdateValidation(@"Attempt to insert item %zd into section %zd, but there are only %zd sections after the update.", item, section, newSectionCount); + ASFailUpdateValidation(@"Attempt to insert item %ld into section %ld, but there are only %ld sections after the update.", (long)item, (long)section, (long)newSectionCount); return; } // Assert that item delete happened to a valid item. NSInteger newItemCount = _newItemCounts[section]; if (item >= newItemCount) { - ASFailUpdateValidation(@"Attempt to insert item %zd into section %zd, which only contains %zd items after the update.", item, section, newItemCount); + ASFailUpdateValidation(@"Attempt to insert item %ld into section %ld, which only contains %ld items after the update.", (long)item, (long)section, (long)newItemCount); return; } } @@ -599,7 +592,7 @@ NSString *NSStringFromASHierarchyChangeType(_ASHierarchyChangeType changeType) invalidSectionInsert = [_insertedSections indexGreaterThanIndex:newSectionCount - 1]; } if (invalidSectionInsert != NSNotFound) { - ASFailUpdateValidation(@"Attempt to insert section %zd but there are only %zd sections after the update.", invalidSectionInsert, newSectionCount); + ASFailUpdateValidation(@"Attempt to insert section %ld but there are only %ld sections after the update.", (long)invalidSectionInsert, (long)newSectionCount); return; } @@ -632,7 +625,7 @@ NSString *NSStringFromASHierarchyChangeType(_ASHierarchyChangeType changeType) NSInteger insertedItemCount = originalInsertedItems.count; NSInteger deletedItemCount = originalDeletedItems.count; if (newItemCount != oldItemCount + insertedItemCount - deletedItemCount) { - ASFailUpdateValidation(@"Invalid number of items in section %zd. The number of items after the update (%zd) must be equal to the number of items before the update (%zd) plus or minus the number of items inserted or deleted (%zd inserted, %zd deleted).", oldSection, newItemCount, oldItemCount, insertedItemCount, deletedItemCount); + ASFailUpdateValidation(@"Invalid number of items in section %ld. The number of items after the update (%ld) must be equal to the number of items before the update (%ld) plus or minus the number of items inserted or deleted (%ld inserted, %ld deleted).", (long)oldSection, (long)newItemCount, (long)oldItemCount, (long)insertedItemCount, (long)deletedItemCount); return; } } @@ -753,7 +746,7 @@ NSString *NSStringFromASHierarchyChangeType(_ASHierarchyChangeType changeType) NSMutableArray *result = [[NSMutableArray alloc] init]; __block ASDataControllerAnimationOptions currentOptions = 0; - auto currentIndexes = [[NSMutableIndexSet alloc] init]; + let currentIndexes = [[NSMutableIndexSet alloc] init]; BOOL reverse = type == _ASHierarchyChangeTypeDelete || type == _ASHierarchyChangeTypeOriginalDelete; NSEnumerationOptions options = reverse ? NSEnumerationReverse : kNilOptions; @@ -792,7 +785,7 @@ NSString *NSStringFromASHierarchyChangeType(_ASHierarchyChangeType changeType) + (NSMutableIndexSet *)allIndexesInSectionChanges:(NSArray<_ASHierarchySectionChange *> *)changes { - auto indexes = [[NSMutableIndexSet alloc] init]; + let indexes = [[NSMutableIndexSet alloc] init]; for (_ASHierarchySectionChange *change in changes) { [indexes addIndexes:change.indexSet]; } @@ -919,10 +912,10 @@ NSString *NSStringFromASHierarchyChangeType(_ASHierarchyChangeType changeType) ASDisplayNodeAssert(ASHierarchyChangeTypeIsFinal(type), @"Attempt to sort and coalesce item changes of intermediary type %@. Why?", NSStringFromASHierarchyChangeType(type)); // Lookup table [NSIndexPath: AnimationOptions] - NSMutableDictionary *animationOptions = [NSMutableDictionary new]; + let animationOptions = [[NSMutableDictionary alloc] init]; // All changed index paths, sorted - NSMutableArray *allIndexPaths = [[NSMutableArray alloc] init]; + let allIndexPaths = [[NSMutableArray alloc] init]; for (_ASHierarchyItemChange *change in changes) { for (NSIndexPath *indexPath in change.indexPaths) { @@ -937,10 +930,10 @@ NSString *NSStringFromASHierarchyChangeType(_ASHierarchyChangeType changeType) [allIndexPaths sortUsingSelector:sorting]; // Create new changes by grouping sorted changes by animation option - auto result = [[NSMutableArray<_ASHierarchyItemChange *> alloc] init]; + let result = [[NSMutableArray<_ASHierarchyItemChange *> alloc] init]; ASDataControllerAnimationOptions currentOptions = 0; - auto currentIndexPaths = [[NSMutableArray alloc] init]; + let currentIndexPaths = [[NSMutableArray alloc] init]; for (NSIndexPath *indexPath in allIndexPaths) { ASDataControllerAnimationOptions options = [animationOptions[indexPath] integerValue]; diff --git a/Source/Private/_ASPendingState.h b/Source/Private/_ASPendingState.h index 246e892a7e..0a96e7a8ad 100644 --- a/Source/Private/_ASPendingState.h +++ b/Source/Private/_ASPendingState.h @@ -2,17 +2,9 @@ // _ASPendingState.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/Private/_ASPendingState.mm b/Source/Private/_ASPendingState.mm index a87707bb67..a38185e006 100644 --- a/Source/Private/_ASPendingState.mm +++ b/Source/Private/_ASPendingState.mm @@ -2,17 +2,9 @@ // _ASPendingState.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import @@ -607,92 +599,92 @@ static UIColor *defaultTintColor = nil; - (NSString *)accessibilityLabel { + if (_flags.setAccessibilityAttributedLabel) { + return accessibilityAttributedLabel.string; + } return accessibilityLabel; } - (void)setAccessibilityLabel:(NSString *)newAccessibilityLabel { - if (! ASObjectIsEqual(accessibilityLabel, newAccessibilityLabel)) { - _flags.setAccessibilityLabel = YES; - _flags.setAccessibilityAttributedLabel = YES; - accessibilityLabel = newAccessibilityLabel ? [newAccessibilityLabel copy] : nil; - accessibilityAttributedLabel = newAccessibilityLabel ? [[NSAttributedString alloc] initWithString:newAccessibilityLabel] : nil; - } + ASCompareAssignCopy(accessibilityLabel, newAccessibilityLabel); + _flags.setAccessibilityLabel = YES; + _flags.setAccessibilityAttributedLabel = NO; } - (NSAttributedString *)accessibilityAttributedLabel { + if (_flags.setAccessibilityLabel) { + return [[NSAttributedString alloc] initWithString:accessibilityLabel]; + } return accessibilityAttributedLabel; } - (void)setAccessibilityAttributedLabel:(NSAttributedString *)newAccessibilityAttributedLabel { - if (! ASObjectIsEqual(accessibilityAttributedLabel, newAccessibilityAttributedLabel)) { - _flags.setAccessibilityAttributedLabel = YES; - _flags.setAccessibilityLabel = YES; - accessibilityAttributedLabel = newAccessibilityAttributedLabel ? [newAccessibilityAttributedLabel copy] : nil; - accessibilityLabel = newAccessibilityAttributedLabel ? [newAccessibilityAttributedLabel.string copy] : nil; - } + ASCompareAssignCopy(accessibilityAttributedLabel, newAccessibilityAttributedLabel); + _flags.setAccessibilityAttributedLabel = YES; + _flags.setAccessibilityLabel = NO; } - (NSString *)accessibilityHint { + if (_flags.setAccessibilityAttributedHint) { + return accessibilityAttributedHint.string; + } return accessibilityHint; } - (void)setAccessibilityHint:(NSString *)newAccessibilityHint { - if (! ASObjectIsEqual(accessibilityHint, newAccessibilityHint)) { - _flags.setAccessibilityHint = YES; - _flags.setAccessibilityAttributedHint = YES; - accessibilityHint = newAccessibilityHint ? [newAccessibilityHint copy] : nil; - accessibilityAttributedHint = newAccessibilityHint ? [[NSAttributedString alloc] initWithString:newAccessibilityHint] : nil; - } + ASCompareAssignCopy(accessibilityHint, newAccessibilityHint); + _flags.setAccessibilityHint = YES; + _flags.setAccessibilityAttributedHint = NO; } - (NSAttributedString *)accessibilityAttributedHint { + if (_flags.setAccessibilityHint) { + return [[NSAttributedString alloc] initWithString:accessibilityHint]; + } return accessibilityAttributedHint; } - (void)setAccessibilityAttributedHint:(NSAttributedString *)newAccessibilityAttributedHint { - if (! ASObjectIsEqual(accessibilityAttributedHint, newAccessibilityAttributedHint)) { - _flags.setAccessibilityAttributedHint = YES; - _flags.setAccessibilityHint = YES; - accessibilityAttributedHint = newAccessibilityAttributedHint ? [newAccessibilityAttributedHint copy] : nil; - accessibilityHint = newAccessibilityAttributedHint ? [newAccessibilityAttributedHint.string copy] : nil; - } + ASCompareAssignCopy(accessibilityAttributedHint, newAccessibilityAttributedHint); + _flags.setAccessibilityAttributedHint = YES; + _flags.setAccessibilityHint = NO; } - (NSString *)accessibilityValue { + if (_flags.setAccessibilityAttributedValue) { + return accessibilityAttributedValue.string; + } return accessibilityValue; } - (void)setAccessibilityValue:(NSString *)newAccessibilityValue { - if (! ASObjectIsEqual(accessibilityValue, newAccessibilityValue)) { - _flags.setAccessibilityValue = YES; - _flags.setAccessibilityAttributedValue = YES; - accessibilityValue = newAccessibilityValue ? [newAccessibilityValue copy] : nil; - accessibilityAttributedValue = newAccessibilityValue ? [[NSAttributedString alloc] initWithString:newAccessibilityValue] : nil; - } + ASCompareAssignCopy(accessibilityValue, newAccessibilityValue); + _flags.setAccessibilityValue = YES; + _flags.setAccessibilityAttributedValue = NO; } - (NSAttributedString *)accessibilityAttributedValue { + if (_flags.setAccessibilityValue) { + return [[NSAttributedString alloc] initWithString:accessibilityValue]; + } return accessibilityAttributedValue; } - (void)setAccessibilityAttributedValue:(NSAttributedString *)newAccessibilityAttributedValue { - if (! ASObjectIsEqual(accessibilityAttributedValue, newAccessibilityAttributedValue)) { - _flags.setAccessibilityAttributedValue = YES; - _flags.setAccessibilityValue = YES; - accessibilityAttributedValue = newAccessibilityAttributedValue? [newAccessibilityAttributedValue copy] : nil; - accessibilityValue = newAccessibilityAttributedValue ? [newAccessibilityAttributedValue.string copy] : nil; - } + ASCompareAssignCopy(accessibilityAttributedValue, newAccessibilityAttributedValue); + _flags.setAccessibilityAttributedValue = YES; + _flags.setAccessibilityValue = NO; } - (UIAccessibilityTraits)accessibilityTraits @@ -1087,20 +1079,23 @@ static UIColor *defaultTintColor = nil; if (flags.setAccessibilityLabel) view.accessibilityLabel = accessibilityLabel; - if (AS_AT_LEAST_IOS11 && flags.setAccessibilityAttributedLabel) - [view setValue:accessibilityAttributedLabel forKey:@"accessibilityAttributedLabel"]; - if (flags.setAccessibilityHint) view.accessibilityHint = accessibilityHint; - if (AS_AT_LEAST_IOS11 && flags.setAccessibilityAttributedHint) - [view setValue:accessibilityAttributedHint forKey:@"accessibilityAttributedHint"]; - if (flags.setAccessibilityValue) view.accessibilityValue = accessibilityValue; - if (AS_AT_LEAST_IOS11 && flags.setAccessibilityAttributedValue) - [view setValue:accessibilityAttributedValue forKey:@"accessibilityAttributedValue"]; + if (AS_AVAILABLE_IOS(11)) { + if (flags.setAccessibilityAttributedLabel) { + view.accessibilityAttributedLabel = accessibilityAttributedLabel; + } + if (flags.setAccessibilityAttributedHint) { + view.accessibilityAttributedHint = accessibilityAttributedHint; + } + if (flags.setAccessibilityAttributedValue) { + view.accessibilityAttributedValue = accessibilityAttributedValue; + } + } if (flags.setAccessibilityTraits) view.accessibilityTraits = accessibilityTraits; diff --git a/Source/Private/_ASScopeTimer.h b/Source/Private/_ASScopeTimer.h index 9e4af4c7b7..543e7c2f12 100644 --- a/Source/Private/_ASScopeTimer.h +++ b/Source/Private/_ASScopeTimer.h @@ -2,17 +2,9 @@ // _ASScopeTimer.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #pragma once diff --git a/Source/TextKit/ASLayoutManager.h b/Source/TextKit/ASLayoutManager.h index 6d0b21b118..1396bf203e 100644 --- a/Source/TextKit/ASLayoutManager.h +++ b/Source/TextKit/ASLayoutManager.h @@ -2,17 +2,9 @@ // ASLayoutManager.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/TextKit/ASLayoutManager.m b/Source/TextKit/ASLayoutManager.m index b603f654e7..08370a4bfb 100644 --- a/Source/TextKit/ASLayoutManager.m +++ b/Source/TextKit/ASLayoutManager.m @@ -2,17 +2,9 @@ // ASLayoutManager.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/TextKit/ASTextKitAttributes.h b/Source/TextKit/ASTextKitAttributes.h old mode 100755 new mode 100644 index 6398c9f846..7f9fbd9b65 --- a/Source/TextKit/ASTextKitAttributes.h +++ b/Source/TextKit/ASTextKitAttributes.h @@ -2,17 +2,9 @@ // ASTextKitAttributes.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #pragma once diff --git a/Source/TextKit/ASTextKitAttributes.mm b/Source/TextKit/ASTextKitAttributes.mm old mode 100755 new mode 100644 index abe55c81d7..131771ab63 --- a/Source/TextKit/ASTextKitAttributes.mm +++ b/Source/TextKit/ASTextKitAttributes.mm @@ -2,17 +2,9 @@ // ASTextKitAttributes.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/TextKit/ASTextKitComponents.h b/Source/TextKit/ASTextKitComponents.h index 2460b8c48a..e5b516d1b3 100644 --- a/Source/TextKit/ASTextKitComponents.h +++ b/Source/TextKit/ASTextKitComponents.h @@ -2,17 +2,9 @@ // ASTextKitComponents.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/TextKit/ASTextKitComponents.mm b/Source/TextKit/ASTextKitComponents.mm index 23bf1f5f1b..eeff17607d 100644 --- a/Source/TextKit/ASTextKitComponents.mm +++ b/Source/TextKit/ASTextKitComponents.mm @@ -2,17 +2,9 @@ // ASTextKitComponents.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/TextKit/ASTextKitContext.h b/Source/TextKit/ASTextKitContext.h old mode 100755 new mode 100644 index 8de63a1bf1..bed137434a --- a/Source/TextKit/ASTextKitContext.h +++ b/Source/TextKit/ASTextKitContext.h @@ -2,17 +2,9 @@ // ASTextKitContext.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/TextKit/ASTextKitContext.mm b/Source/TextKit/ASTextKitContext.mm old mode 100755 new mode 100644 index f8b3d15655..0995a66f66 --- a/Source/TextKit/ASTextKitContext.mm +++ b/Source/TextKit/ASTextKitContext.mm @@ -2,17 +2,9 @@ // ASTextKitContext.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import @@ -70,9 +62,9 @@ return self; } -- (void)performBlockWithLockedTextKitComponents:(void (^)(NSLayoutManager *, - NSTextStorage *, - NSTextContainer *))block +- (void)performBlockWithLockedTextKitComponents:(NS_NOESCAPE void (^)(NSLayoutManager *, + NSTextStorage *, + NSTextContainer *))block { ASDN::MutexSharedLocker l(__instanceLock__); if (block) { diff --git a/Source/TextKit/ASTextKitCoreTextAdditions.h b/Source/TextKit/ASTextKitCoreTextAdditions.h index 4579d5c118..117a89ed34 100644 --- a/Source/TextKit/ASTextKitCoreTextAdditions.h +++ b/Source/TextKit/ASTextKitCoreTextAdditions.h @@ -2,17 +2,9 @@ // ASTextKitCoreTextAdditions.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/TextKit/ASTextKitCoreTextAdditions.m b/Source/TextKit/ASTextKitCoreTextAdditions.m index 012d02a885..9b8de67a63 100644 --- a/Source/TextKit/ASTextKitCoreTextAdditions.m +++ b/Source/TextKit/ASTextKitCoreTextAdditions.m @@ -2,17 +2,9 @@ // ASTextKitCoreTextAdditions.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/TextKit/ASTextKitEntityAttribute.h b/Source/TextKit/ASTextKitEntityAttribute.h old mode 100755 new mode 100644 index 23e9983fd2..ddaf586a07 --- a/Source/TextKit/ASTextKitEntityAttribute.h +++ b/Source/TextKit/ASTextKitEntityAttribute.h @@ -2,17 +2,9 @@ // ASTextKitEntityAttribute.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/TextKit/ASTextKitEntityAttribute.m b/Source/TextKit/ASTextKitEntityAttribute.m old mode 100755 new mode 100644 index 4664b24980..fde0621cf5 --- a/Source/TextKit/ASTextKitEntityAttribute.m +++ b/Source/TextKit/ASTextKitEntityAttribute.m @@ -2,17 +2,9 @@ // ASTextKitEntityAttribute.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/TextKit/ASTextKitFontSizeAdjuster.h b/Source/TextKit/ASTextKitFontSizeAdjuster.h index 2a647e3306..ca2c2338d5 100644 --- a/Source/TextKit/ASTextKitFontSizeAdjuster.h +++ b/Source/TextKit/ASTextKitFontSizeAdjuster.h @@ -2,17 +2,9 @@ // ASTextKitFontSizeAdjuster.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/TextKit/ASTextKitFontSizeAdjuster.mm b/Source/TextKit/ASTextKitFontSizeAdjuster.mm index dce59597fc..3837771239 100644 --- a/Source/TextKit/ASTextKitFontSizeAdjuster.mm +++ b/Source/TextKit/ASTextKitFontSizeAdjuster.mm @@ -2,17 +2,9 @@ // ASTextKitFontSizeAdjuster.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // @@ -87,8 +79,6 @@ paragraphStyle.tailIndent = (paragraphStyle.tailIndent * scaleFactor); paragraphStyle.minimumLineHeight = (paragraphStyle.minimumLineHeight * scaleFactor); paragraphStyle.maximumLineHeight = (paragraphStyle.maximumLineHeight * scaleFactor); - paragraphStyle.lineHeightMultiple = (paragraphStyle.lineHeightMultiple * scaleFactor); - paragraphStyle.paragraphSpacing = (paragraphStyle.paragraphSpacing * scaleFactor); [attrString removeAttribute:NSParagraphStyleAttributeName range:range]; [attrString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:range]; @@ -214,7 +204,7 @@ if (longestWordFits == NO) { // we need to check the longest word to make sure it fits - longestWordFits = std::ceil((longestWordSize.width * adjustedScale) <= _constrainedSize.width); + longestWordFits = std::ceil((longestWordSize.width * adjustedScale) <= _constrainedSize.width); } // if the longest word fits, go ahead and check max line and height. If it didn't fit continue to the next scale factor diff --git a/Source/TextKit/ASTextKitRenderer+Positioning.h b/Source/TextKit/ASTextKitRenderer+Positioning.h old mode 100755 new mode 100644 index 3ee402f224..ebcf229671 --- a/Source/TextKit/ASTextKitRenderer+Positioning.h +++ b/Source/TextKit/ASTextKitRenderer+Positioning.h @@ -2,17 +2,9 @@ // ASTextKitRenderer+Positioning.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/TextKit/ASTextKitRenderer+Positioning.mm b/Source/TextKit/ASTextKitRenderer+Positioning.mm old mode 100755 new mode 100644 index b0f6c39b16..a97e189b41 --- a/Source/TextKit/ASTextKitRenderer+Positioning.mm +++ b/Source/TextKit/ASTextKitRenderer+Positioning.mm @@ -2,17 +2,9 @@ // ASTextKitRenderer+Positioning.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/TextKit/ASTextKitRenderer+TextChecking.h b/Source/TextKit/ASTextKitRenderer+TextChecking.h old mode 100755 new mode 100644 index 107209dcc1..b1d1cab8c3 --- a/Source/TextKit/ASTextKitRenderer+TextChecking.h +++ b/Source/TextKit/ASTextKitRenderer+TextChecking.h @@ -2,17 +2,9 @@ // ASTextKitRenderer+TextChecking.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/TextKit/ASTextKitRenderer+TextChecking.mm b/Source/TextKit/ASTextKitRenderer+TextChecking.mm old mode 100755 new mode 100644 index ff3d57a935..527f82af28 --- a/Source/TextKit/ASTextKitRenderer+TextChecking.mm +++ b/Source/TextKit/ASTextKitRenderer+TextChecking.mm @@ -2,17 +2,9 @@ // ASTextKitRenderer+TextChecking.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/TextKit/ASTextKitRenderer.h b/Source/TextKit/ASTextKitRenderer.h old mode 100755 new mode 100644 index 995d47898c..e6ea9eefaf --- a/Source/TextKit/ASTextKitRenderer.h +++ b/Source/TextKit/ASTextKitRenderer.h @@ -2,17 +2,9 @@ // ASTextKitRenderer.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/TextKit/ASTextKitRenderer.mm b/Source/TextKit/ASTextKitRenderer.mm old mode 100755 new mode 100644 index 0f5e8ac99e..a11283bd86 --- a/Source/TextKit/ASTextKitRenderer.mm +++ b/Source/TextKit/ASTextKitRenderer.mm @@ -2,17 +2,9 @@ // ASTextKitRenderer.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/TextKit/ASTextKitShadower.h b/Source/TextKit/ASTextKitShadower.h old mode 100755 new mode 100644 index f8adad41c5..1bec5aff80 --- a/Source/TextKit/ASTextKitShadower.h +++ b/Source/TextKit/ASTextKitShadower.h @@ -2,17 +2,9 @@ // ASTextKitShadower.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/TextKit/ASTextKitShadower.mm b/Source/TextKit/ASTextKitShadower.mm old mode 100755 new mode 100644 index 2715438252..714d93a0e7 --- a/Source/TextKit/ASTextKitShadower.mm +++ b/Source/TextKit/ASTextKitShadower.mm @@ -2,17 +2,9 @@ // ASTextKitShadower.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/TextKit/ASTextKitTailTruncater.h b/Source/TextKit/ASTextKitTailTruncater.h old mode 100755 new mode 100644 index 26f2fb127a..027a27e405 --- a/Source/TextKit/ASTextKitTailTruncater.h +++ b/Source/TextKit/ASTextKitTailTruncater.h @@ -2,17 +2,9 @@ // ASTextKitTailTruncater.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/TextKit/ASTextKitTailTruncater.mm b/Source/TextKit/ASTextKitTailTruncater.mm old mode 100755 new mode 100644 index b160fbb1e2..1c4d73f496 --- a/Source/TextKit/ASTextKitTailTruncater.mm +++ b/Source/TextKit/ASTextKitTailTruncater.mm @@ -2,17 +2,9 @@ // ASTextKitTailTruncater.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/TextKit/ASTextKitTruncating.h b/Source/TextKit/ASTextKitTruncating.h old mode 100755 new mode 100644 index 04005be0f6..8374f37b18 --- a/Source/TextKit/ASTextKitTruncating.h +++ b/Source/TextKit/ASTextKitTruncating.h @@ -2,17 +2,9 @@ // ASTextKitTruncating.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/TextKit/ASTextNodeTypes.h b/Source/TextKit/ASTextNodeTypes.h index 2e70b0c1e7..694d9ca7fa 100644 --- a/Source/TextKit/ASTextNodeTypes.h +++ b/Source/TextKit/ASTextNodeTypes.h @@ -2,17 +2,9 @@ // ASTextNodeTypes.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #pragma once diff --git a/Source/TextKit/ASTextNodeWordKerner.h b/Source/TextKit/ASTextNodeWordKerner.h index b5c1923882..855cddbd54 100644 --- a/Source/TextKit/ASTextNodeWordKerner.h +++ b/Source/TextKit/ASTextNodeWordKerner.h @@ -2,17 +2,9 @@ // ASTextNodeWordKerner.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/TextKit/ASTextNodeWordKerner.m b/Source/TextKit/ASTextNodeWordKerner.m index d9f6fba02c..fc577d51a4 100644 --- a/Source/TextKit/ASTextNodeWordKerner.m +++ b/Source/TextKit/ASTextNodeWordKerner.m @@ -2,17 +2,9 @@ // ASTextNodeWordKerner.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/UIImage+ASConvenience.h b/Source/UIImage+ASConvenience.h index 7b02d13328..b24c97d1c5 100644 --- a/Source/UIImage+ASConvenience.h +++ b/Source/UIImage+ASConvenience.h @@ -2,17 +2,9 @@ // UIImage+ASConvenience.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/UIImage+ASConvenience.m b/Source/UIImage+ASConvenience.m index c1d0751e39..557049d311 100644 --- a/Source/UIImage+ASConvenience.m +++ b/Source/UIImage+ASConvenience.m @@ -2,17 +2,9 @@ // UIImage+ASConvenience.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/UIResponder+AsyncDisplayKit.h b/Source/UIResponder+AsyncDisplayKit.h index 42dbe49402..17afab3ae2 100644 --- a/Source/UIResponder+AsyncDisplayKit.h +++ b/Source/UIResponder+AsyncDisplayKit.h @@ -2,17 +2,9 @@ // UIResponder+AsyncDisplayKit.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/UIResponder+AsyncDisplayKit.m b/Source/UIResponder+AsyncDisplayKit.m index a80544d686..8c3ec24de3 100644 --- a/Source/UIResponder+AsyncDisplayKit.m +++ b/Source/UIResponder+AsyncDisplayKit.m @@ -2,17 +2,9 @@ // UIResponder+AsyncDisplayKit.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "UIResponder+AsyncDisplayKit.h" diff --git a/Source/_ASTransitionContext.h b/Source/_ASTransitionContext.h index 54d72397ca..44c4906c39 100644 --- a/Source/_ASTransitionContext.h +++ b/Source/_ASTransitionContext.h @@ -2,17 +2,9 @@ // _ASTransitionContext.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/_ASTransitionContext.m b/Source/_ASTransitionContext.m index b796d7a72d..a75a3ca434 100644 --- a/Source/_ASTransitionContext.m +++ b/Source/_ASTransitionContext.m @@ -2,17 +2,9 @@ // _ASTransitionContext.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/tvOS/ASControlNode+tvOS.m b/Source/tvOS/ASControlNode+tvOS.m index 77e5418629..8a878eb235 100644 --- a/Source/tvOS/ASControlNode+tvOS.m +++ b/Source/tvOS/ASControlNode+tvOS.m @@ -2,17 +2,9 @@ // ASControlNode+tvOS.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Source/tvOS/ASImageNode+tvOS.m b/Source/tvOS/ASImageNode+tvOS.m index 9482fdc8c1..1bd1ef4599 100644 --- a/Source/tvOS/ASImageNode+tvOS.m +++ b/Source/tvOS/ASImageNode+tvOS.m @@ -2,17 +2,9 @@ // ASImageNode+tvOS.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/SubspecWorkspaces/ASDKListKit/ASDKListKitTests/ASListKitTestAdapterDataSource.h b/SubspecWorkspaces/ASDKListKit/ASDKListKitTests/ASListKitTestAdapterDataSource.h index d14c9eef90..c3cdab0bad 100644 --- a/SubspecWorkspaces/ASDKListKit/ASDKListKitTests/ASListKitTestAdapterDataSource.h +++ b/SubspecWorkspaces/ASDKListKit/ASDKListKitTests/ASListKitTestAdapterDataSource.h @@ -2,17 +2,9 @@ // ASListKitTestAdapterDataSource.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/SubspecWorkspaces/ASDKListKit/ASDKListKitTests/ASListKitTestAdapterDataSource.m b/SubspecWorkspaces/ASDKListKit/ASDKListKitTests/ASListKitTestAdapterDataSource.m index b9a86160a4..b0cd9a8a6d 100644 --- a/SubspecWorkspaces/ASDKListKit/ASDKListKitTests/ASListKitTestAdapterDataSource.m +++ b/SubspecWorkspaces/ASDKListKit/ASDKListKitTests/ASListKitTestAdapterDataSource.m @@ -2,17 +2,9 @@ // ASListKitTestAdapterDataSource.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ASListKitTestAdapterDataSource.h" diff --git a/SubspecWorkspaces/ASDKListKit/ASDKListKitTests/ASListKitTests.m b/SubspecWorkspaces/ASDKListKit/ASDKListKitTests/ASListKitTests.m index 28b6205d7f..1bb2c6fed0 100644 --- a/SubspecWorkspaces/ASDKListKit/ASDKListKitTests/ASListKitTests.m +++ b/SubspecWorkspaces/ASDKListKit/ASDKListKitTests/ASListKitTests.m @@ -2,17 +2,9 @@ // ASListKitTests.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/SubspecWorkspaces/ASDKListKit/ASDKListKitTests/ASListTestCellNode.h b/SubspecWorkspaces/ASDKListKit/ASDKListKitTests/ASListTestCellNode.h index d9d4c44ac4..e0a4ad7f44 100644 --- a/SubspecWorkspaces/ASDKListKit/ASDKListKitTests/ASListTestCellNode.h +++ b/SubspecWorkspaces/ASDKListKit/ASDKListKitTests/ASListTestCellNode.h @@ -2,17 +2,9 @@ // ASListTestCellNode.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/SubspecWorkspaces/ASDKListKit/ASDKListKitTests/ASListTestCellNode.m b/SubspecWorkspaces/ASDKListKit/ASDKListKitTests/ASListTestCellNode.m index 4963f36280..cd3bfb3a8d 100644 --- a/SubspecWorkspaces/ASDKListKit/ASDKListKitTests/ASListTestCellNode.m +++ b/SubspecWorkspaces/ASDKListKit/ASDKListKitTests/ASListTestCellNode.m @@ -2,17 +2,9 @@ // ASListTestCellNode.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ASListTestCellNode.h" diff --git a/SubspecWorkspaces/ASDKListKit/ASDKListKitTests/ASListTestObject.h b/SubspecWorkspaces/ASDKListKit/ASDKListKitTests/ASListTestObject.h index a4dbf7c047..1362ebf560 100644 --- a/SubspecWorkspaces/ASDKListKit/ASDKListKitTests/ASListTestObject.h +++ b/SubspecWorkspaces/ASDKListKit/ASDKListKitTests/ASListTestObject.h @@ -2,17 +2,9 @@ // ASListTestObject.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/SubspecWorkspaces/ASDKListKit/ASDKListKitTests/ASListTestObject.m b/SubspecWorkspaces/ASDKListKit/ASDKListKitTests/ASListTestObject.m index 4b815361b9..64cd83649b 100644 --- a/SubspecWorkspaces/ASDKListKit/ASDKListKitTests/ASListTestObject.m +++ b/SubspecWorkspaces/ASDKListKit/ASDKListKitTests/ASListTestObject.m @@ -2,17 +2,9 @@ // ASListTestObject.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ASListTestObject.h" diff --git a/SubspecWorkspaces/ASDKListKit/ASDKListKitTests/ASListTestSection.h b/SubspecWorkspaces/ASDKListKit/ASDKListKitTests/ASListTestSection.h index 6e21457f90..d62e21b1f6 100644 --- a/SubspecWorkspaces/ASDKListKit/ASDKListKitTests/ASListTestSection.h +++ b/SubspecWorkspaces/ASDKListKit/ASDKListKitTests/ASListTestSection.h @@ -2,17 +2,9 @@ // ASListTestSection.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/SubspecWorkspaces/ASDKListKit/ASDKListKitTests/ASListTestSection.m b/SubspecWorkspaces/ASDKListKit/ASDKListKitTests/ASListTestSection.m index 1d17605de4..edf939b7c0 100644 --- a/SubspecWorkspaces/ASDKListKit/ASDKListKitTests/ASListTestSection.m +++ b/SubspecWorkspaces/ASDKListKit/ASDKListKitTests/ASListTestSection.m @@ -2,17 +2,9 @@ // ASListTestSection.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ASListTestSection.h" diff --git a/SubspecWorkspaces/ASDKListKit/ASDKListKitTests/ASListTestSupplementaryNode.h b/SubspecWorkspaces/ASDKListKit/ASDKListKitTests/ASListTestSupplementaryNode.h index 7ec2b83609..c4f40e4ab7 100644 --- a/SubspecWorkspaces/ASDKListKit/ASDKListKitTests/ASListTestSupplementaryNode.h +++ b/SubspecWorkspaces/ASDKListKit/ASDKListKitTests/ASListTestSupplementaryNode.h @@ -2,17 +2,9 @@ // ASListTestSupplementaryNode.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/SubspecWorkspaces/ASDKListKit/ASDKListKitTests/ASListTestSupplementaryNode.m b/SubspecWorkspaces/ASDKListKit/ASDKListKitTests/ASListTestSupplementaryNode.m index 367200b77e..a10f6a8f69 100644 --- a/SubspecWorkspaces/ASDKListKit/ASDKListKitTests/ASListTestSupplementaryNode.m +++ b/SubspecWorkspaces/ASDKListKit/ASDKListKitTests/ASListTestSupplementaryNode.m @@ -2,17 +2,9 @@ // ASListTestSupplementaryNode.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ASListTestSupplementaryNode.h" diff --git a/SubspecWorkspaces/ASDKListKit/ASDKListKitTests/ASListTestSupplementarySource.h b/SubspecWorkspaces/ASDKListKit/ASDKListKitTests/ASListTestSupplementarySource.h index 37cb4816f4..acdec1ef94 100644 --- a/SubspecWorkspaces/ASDKListKit/ASDKListKitTests/ASListTestSupplementarySource.h +++ b/SubspecWorkspaces/ASDKListKit/ASDKListKitTests/ASListTestSupplementarySource.h @@ -2,17 +2,9 @@ // ASListTestSupplementarySource.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/SubspecWorkspaces/ASDKListKit/ASDKListKitTests/ASListTestSupplementarySource.m b/SubspecWorkspaces/ASDKListKit/ASDKListKitTests/ASListTestSupplementarySource.m index 30e44749a1..07410131e2 100644 --- a/SubspecWorkspaces/ASDKListKit/ASDKListKitTests/ASListTestSupplementarySource.m +++ b/SubspecWorkspaces/ASDKListKit/ASDKListKitTests/ASListTestSupplementarySource.m @@ -2,17 +2,9 @@ // ASListTestSupplementarySource.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ASListTestSupplementarySource.h" diff --git a/Tests/ASAbsoluteLayoutSpecSnapshotTests.m b/Tests/ASAbsoluteLayoutSpecSnapshotTests.m index c78dca2a49..2715872cdc 100644 --- a/Tests/ASAbsoluteLayoutSpecSnapshotTests.m +++ b/Tests/ASAbsoluteLayoutSpecSnapshotTests.m @@ -2,19 +2,9 @@ // ASAbsoluteLayoutSpecSnapshotTests.m // Texture // -// Created by Huy Nguyen on 18/10/15. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ASLayoutSpecSnapshotTestsHelper.h" diff --git a/Tests/ASBackgroundLayoutSpecSnapshotTests.mm b/Tests/ASBackgroundLayoutSpecSnapshotTests.mm index 6429447331..1a6b4fc7c8 100644 --- a/Tests/ASBackgroundLayoutSpecSnapshotTests.mm +++ b/Tests/ASBackgroundLayoutSpecSnapshotTests.mm @@ -1,18 +1,10 @@ // -// ASOverlayLayoutSpecSnapshotTests.mm +// ASBackgroundLayoutSpecSnapshotTests.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ASLayoutSpecSnapshotTestsHelper.h" diff --git a/Tests/ASBasicImageDownloaderContextTests.m b/Tests/ASBasicImageDownloaderContextTests.m index c92149234b..8414abf007 100644 --- a/Tests/ASBasicImageDownloaderContextTests.m +++ b/Tests/ASBasicImageDownloaderContextTests.m @@ -2,17 +2,9 @@ // ASBasicImageDownloaderContextTests.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Tests/ASBasicImageDownloaderTests.m b/Tests/ASBasicImageDownloaderTests.m index 6144b5c253..5eb6da503b 100644 --- a/Tests/ASBasicImageDownloaderTests.m +++ b/Tests/ASBasicImageDownloaderTests.m @@ -2,19 +2,9 @@ // ASBasicImageDownloaderTests.m // Texture // -// Created by Victor Mayorov on 10/06/15. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Tests/ASBatchFetchingTests.m b/Tests/ASBatchFetchingTests.m index 97eab3576c..76cc6455ba 100644 --- a/Tests/ASBatchFetchingTests.m +++ b/Tests/ASBatchFetchingTests.m @@ -2,17 +2,9 @@ // ASBatchFetchingTests.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Tests/ASBridgedPropertiesTests.mm b/Tests/ASBridgedPropertiesTests.mm index 82b5d3350c..8e4a202eb8 100644 --- a/Tests/ASBridgedPropertiesTests.mm +++ b/Tests/ASBridgedPropertiesTests.mm @@ -2,19 +2,9 @@ // ASBridgedPropertiesTests.mm // Texture // -// Created by Adlai Holler on 1/7/16. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Tests/ASCALayerTests.m b/Tests/ASCALayerTests.m index 1ff20d396c..3527a272bb 100644 --- a/Tests/ASCALayerTests.m +++ b/Tests/ASCALayerTests.m @@ -2,17 +2,9 @@ // ASCALayerTests.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Tests/ASCenterLayoutSpecSnapshotTests.mm b/Tests/ASCenterLayoutSpecSnapshotTests.mm index 2275b14ce1..d0352bb446 100644 --- a/Tests/ASCenterLayoutSpecSnapshotTests.mm +++ b/Tests/ASCenterLayoutSpecSnapshotTests.mm @@ -2,17 +2,9 @@ // ASCenterLayoutSpecSnapshotTests.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ASLayoutSpecSnapshotTestsHelper.h" diff --git a/Tests/ASCollectionModernDataSourceTests.m b/Tests/ASCollectionModernDataSourceTests.m index ff084a7b16..d13db9e6cd 100644 --- a/Tests/ASCollectionModernDataSourceTests.m +++ b/Tests/ASCollectionModernDataSourceTests.m @@ -2,12 +2,8 @@ // ASCollectionModernDataSourceTests.m // Texture // -// Copyright (c) 2017-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import @@ -308,8 +304,7 @@ [self expectDataSourceCountMethods]; // Combine reloads + inserts and expect them to load content for all of them, in ascending order. - NSMutableDictionary *insertsPlusReloads = [NSMutableDictionary dictionary]; - [insertsPlusReloads addEntriesFromDictionary:insertedItems]; + NSMutableDictionary *insertsPlusReloads = [[NSMutableDictionary alloc] initWithDictionary:insertedItems]; // Go through reloaded sections and add all their items into `insertsPlusReloads` [reloadedSectionIndexes enumerateIndexesUsingBlock:^(NSUInteger section, BOOL * _Nonnull stop) { diff --git a/Tests/ASCollectionViewFlowLayoutInspectorTests.m b/Tests/ASCollectionViewFlowLayoutInspectorTests.m index f24a1b0f54..c90270df08 100644 --- a/Tests/ASCollectionViewFlowLayoutInspectorTests.m +++ b/Tests/ASCollectionViewFlowLayoutInspectorTests.m @@ -2,17 +2,9 @@ // ASCollectionViewFlowLayoutInspectorTests.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Tests/ASCollectionViewTests.mm b/Tests/ASCollectionViewTests.mm index 8ed0994779..92fb349e89 100644 --- a/Tests/ASCollectionViewTests.mm +++ b/Tests/ASCollectionViewTests.mm @@ -2,17 +2,9 @@ // ASCollectionViewTests.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import @@ -377,6 +369,17 @@ XCTAssertTrue(ASRangeTuningParametersEqualToRangeTuningParameters(preloadParams, [collectionView tuningParametersForRangeType:ASLayoutRangeTypePreload])); } +// Informations to test: https://github.com/TextureGroup/Texture/issues/1094 +- (void)testThatCollectionNodeCanHandleNilRangeController +{ + UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; + ASCollectionNode *collectionNode = [[ASCollectionNode alloc] initWithCollectionViewLayout:layout]; + [collectionNode recursivelySetInterfaceState:ASInterfaceStateDisplay]; + [collectionNode setHierarchyState:ASHierarchyStateRangeManaged]; + [collectionNode recursivelySetInterfaceState:ASInterfaceStateNone]; + ASCATransactionQueueWait(nil); +} + /** * This may seem silly, but we had issues where the runtime sometimes wouldn't correctly report * conformances declared on categories. diff --git a/Tests/ASCollectionsTests.m b/Tests/ASCollectionsTests.m new file mode 100644 index 0000000000..348798e6d3 --- /dev/null +++ b/Tests/ASCollectionsTests.m @@ -0,0 +1,55 @@ +// +// ASCollectionsTests.m +// Texture +// +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 +// + +#import +#import + +@interface ASCollectionsTests : XCTestCase + +@end + +@implementation ASCollectionsTests + +- (void)testTransferArray { + id objs[2]; + objs[0] = [NSObject new]; + id o0 = objs[0]; + objs[1] = [NSObject new]; + __weak id w0 = objs[0]; + __weak id w1 = objs[1]; + CFTypeRef cf0 = (__bridge CFTypeRef)objs[0]; + CFTypeRef cf1 = (__bridge CFTypeRef)objs[1]; + XCTAssertEqual(CFGetRetainCount(cf0), 2); + XCTAssertEqual(CFGetRetainCount(cf1), 1); + NSArray *arr = [NSArray arrayByTransferring:objs count:2]; + XCTAssertNil(objs[0]); + XCTAssertNil(objs[1]); + XCTAssertEqual(CFGetRetainCount(cf0), 2); + XCTAssertEqual(CFGetRetainCount(cf1), 1); + NSArray *immutableCopy = [arr copy]; + XCTAssertEqual(immutableCopy, arr); + XCTAssertEqual(CFGetRetainCount(cf0), 2); + XCTAssertEqual(CFGetRetainCount(cf1), 1); + NSMutableArray *mc = [arr mutableCopy]; + XCTAssertEqual(CFGetRetainCount(cf0), 3); + XCTAssertEqual(CFGetRetainCount(cf1), 2); + arr = nil; + immutableCopy = nil; + XCTAssertEqual(CFGetRetainCount(cf0), 2); + XCTAssertEqual(CFGetRetainCount(cf1), 1); + [mc removeObjectAtIndex:0]; + XCTAssertEqual(CFGetRetainCount(cf0), 1); + XCTAssertEqual(CFGetRetainCount(cf1), 1); + [mc removeObjectAtIndex:0]; + XCTAssertEqual(CFGetRetainCount(cf0), 1); + XCTAssertNil(w1); + o0 = nil; + XCTAssertNil(w0); +} + +@end diff --git a/Tests/ASConfigurationTests.m b/Tests/ASConfigurationTests.m index cd7ed1034e..c16cb79e0f 100644 --- a/Tests/ASConfigurationTests.m +++ b/Tests/ASConfigurationTests.m @@ -2,12 +2,8 @@ // ASConfigurationTests.m // Texture // -// Copyright (c) 2018-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Tests/ASControlNodeTests.m b/Tests/ASControlNodeTests.m index 1961037e2f..95207ce9d6 100644 --- a/Tests/ASControlNodeTests.m +++ b/Tests/ASControlNodeTests.m @@ -2,17 +2,9 @@ // ASControlNodeTests.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Tests/ASCornerLayoutSpecSnapshotTests.mm b/Tests/ASCornerLayoutSpecSnapshotTests.mm index a9e20f7c5f..2c496cd595 100644 --- a/Tests/ASCornerLayoutSpecSnapshotTests.mm +++ b/Tests/ASCornerLayoutSpecSnapshotTests.mm @@ -2,12 +2,8 @@ // ASCornerLayoutSpecSnapshotTests.mm // Texture // -// Copyright (c) 2017-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ASLayoutSpecSnapshotTestsHelper.h" diff --git a/Tests/ASDimensionTests.mm b/Tests/ASDimensionTests.mm index 6832dc5e88..4cc64f2f6b 100644 --- a/Tests/ASDimensionTests.mm +++ b/Tests/ASDimensionTests.mm @@ -2,17 +2,9 @@ // ASDimensionTests.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Tests/ASDispatchTests.m b/Tests/ASDispatchTests.m index f159f5e9da..64c3412f35 100644 --- a/Tests/ASDispatchTests.m +++ b/Tests/ASDispatchTests.m @@ -2,17 +2,9 @@ // ASDispatchTests.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Tests/ASDisplayLayerTests.m b/Tests/ASDisplayLayerTests.m index 5f20e928e0..b65dc3fc4a 100644 --- a/Tests/ASDisplayLayerTests.m +++ b/Tests/ASDisplayLayerTests.m @@ -2,17 +2,9 @@ // ASDisplayLayerTests.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import @@ -217,7 +209,7 @@ static _ASDisplayLayerTestDelegateClassModes _class_modes; } // DANGER: Don't use the delegate as the parameters in real code; this is not thread-safe and just for accounting in unit tests! -+ (UIImage *)displayWithParameters:(_ASDisplayLayerTestDelegate *)delegate isCancelled:(asdisplaynode_iscancelled_block_t)sentinelBlock ++ (UIImage *)displayWithParameters:(_ASDisplayLayerTestDelegate *)delegate isCancelled:(NS_NOESCAPE asdisplaynode_iscancelled_block_t)sentinelBlock { UIImage *contents = bogusImage(); if (delegate->_displayLayerBlock != NULL) { @@ -228,7 +220,7 @@ static _ASDisplayLayerTestDelegateClassModes _class_modes; } // DANGER: Don't use the delegate as the parameters in real code; this is not thread-safe and just for accounting in unit tests! -+ (void)drawRect:(CGRect)bounds withParameters:(_ASDisplayLayerTestDelegate *)delegate isCancelled:(asdisplaynode_iscancelled_block_t)sentinelBlock isRasterizing:(BOOL)isRasterizing ++ (void)drawRect:(CGRect)bounds withParameters:(_ASDisplayLayerTestDelegate *)delegate isCancelled:(NS_NOESCAPE asdisplaynode_iscancelled_block_t)sentinelBlock isRasterizing:(BOOL)isRasterizing { __atomic_add_fetch(&delegate->_drawRectCount, 1, __ATOMIC_SEQ_CST); } diff --git a/Tests/ASDisplayNodeAppearanceTests.m b/Tests/ASDisplayNodeAppearanceTests.m index f636e7830e..70f9265da7 100644 --- a/Tests/ASDisplayNodeAppearanceTests.m +++ b/Tests/ASDisplayNodeAppearanceTests.m @@ -2,17 +2,9 @@ // ASDisplayNodeAppearanceTests.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Tests/ASDisplayNodeExtrasTests.m b/Tests/ASDisplayNodeExtrasTests.m index bd8e2556f9..8635118388 100644 --- a/Tests/ASDisplayNodeExtrasTests.m +++ b/Tests/ASDisplayNodeExtrasTests.m @@ -2,8 +2,8 @@ // ASDisplayNodeExtrasTests.m // Texture // -// Created by Kiel Gillard on 27/06/2016. -// Copyright © 2016 Facebook. All rights reserved. +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Tests/ASDisplayNodeImplicitHierarchyTests.m b/Tests/ASDisplayNodeImplicitHierarchyTests.m index 383d5cfd9a..d856002bed 100644 --- a/Tests/ASDisplayNodeImplicitHierarchyTests.m +++ b/Tests/ASDisplayNodeImplicitHierarchyTests.m @@ -2,17 +2,9 @@ // ASDisplayNodeImplicitHierarchyTests.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import @@ -150,7 +142,11 @@ ASDisplayNode *node1 = [[ASDisplayNode alloc] init]; ASDisplayNode *node2 = [[ASDisplayNode alloc] init]; ASDisplayNode *node3 = [[ASDisplayNode alloc] init]; - + + node1.debugName = @"a"; + node2.debugName = @"b"; + node3.debugName = @"c"; + // As we will involve a stack spec we have to give the nodes an intrinsic content size node1.style.preferredSize = kSize; node2.style.preferredSize = kSize; diff --git a/Tests/ASDisplayNodeLayoutTests.mm b/Tests/ASDisplayNodeLayoutTests.mm index 00512e8012..0165f45754 100644 --- a/Tests/ASDisplayNodeLayoutTests.mm +++ b/Tests/ASDisplayNodeLayoutTests.mm @@ -2,17 +2,9 @@ // ASDisplayNodeLayoutTests.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ASXCTExtensions.h" diff --git a/Tests/ASDisplayNodeSnapshotTests.m b/Tests/ASDisplayNodeSnapshotTests.m index 4062be015e..8d67e3cd08 100644 --- a/Tests/ASDisplayNodeSnapshotTests.m +++ b/Tests/ASDisplayNodeSnapshotTests.m @@ -2,8 +2,8 @@ // ASDisplayNodeSnapshotTests.m // Texture // -// Created by Adlai Holler on 8/16/16. -// Copyright © 2016 Facebook. All rights reserved. +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ASSnapshotTestCase.h" diff --git a/Tests/ASDisplayNodeTests.mm b/Tests/ASDisplayNodeTests.mm index 9e66a9ac04..ab443e5952 100644 --- a/Tests/ASDisplayNodeTests.mm +++ b/Tests/ASDisplayNodeTests.mm @@ -2,17 +2,9 @@ // ASDisplayNodeTests.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import @@ -26,6 +18,7 @@ #import #import #import +#import #import "ASDisplayNodeTestsHelper.h" #import #import @@ -189,6 +182,11 @@ for (ASDisplayNode *n in @[ nodes ]) {\ _displayWillStartCount++; } +- (CALayer *__strong (*)[NUM_CLIP_CORNER_LAYERS])clipCornerLayers +{ + return &self->_clipCornerLayers; +} + @end @interface ASSynchronousTestDisplayNodeViaViewClass : ASDisplayNode @@ -268,6 +266,14 @@ for (ASDisplayNode *n in @[ nodes ]) {\ @end +@interface ASTestResponderNodeWithOverride : ASDisplayNode +@end +@implementation ASTestResponderNodeWithOverride +- (BOOL)canBecomeFirstResponder { + return YES; +} +@end + @interface ASTestViewController: ASViewController @end @implementation ASTestViewController @@ -358,6 +364,21 @@ for (ASDisplayNode *n in @[ nodes ]) {\ XCTAssertFalse([textNode.view isFirstResponder]); } +- (void)testResponderOverrrideCanBecomeFirstResponder +{ + UIWindow *window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; + ASTestResponderNodeWithOverride *node = [[ASTestResponderNodeWithOverride alloc] init]; + + // We have to add the text node to a window otherwise the responder methods responses are undefined + // This will also create the backing view of the node + [window addSubnode:node]; + [window makeKeyAndVisible]; + + XCTAssertTrue([node canBecomeFirstResponder]); + XCTAssertTrue([node becomeFirstResponder]); + XCTAssertTrue([window firstResponder] == node.view); +} + - (void)testUnsupportedResponderSetupWillThrow { ASTestResponderNode *node = [[ASTestResponderNode alloc] init]; @@ -2397,6 +2418,77 @@ static bool stringContainsPointer(NSString *description, id p) { XCTAssertThrowsSpecificNamed([node calculateLayoutThatFits:ASSizeRangeMake(CGSizeMake(100, 100))], NSException, NSInternalInconsistencyException); } +- (void)testThatStackSpecOrdersSubnodesCorrectlyRandomness +{ + // This test ensures that the z-order of nodes matches the stack spec, including after several random relayouts / transitions. + ASDisplayNode *node = [[ASDisplayNode alloc] init]; + node.automaticallyManagesSubnodes = YES; + + DeclareNodeNamed(a); + DeclareNodeNamed(b); + DeclareNodeNamed(c); + DeclareNodeNamed(d); + DeclareNodeNamed(e); + DeclareNodeNamed(f); + DeclareNodeNamed(g); + DeclareNodeNamed(h); + DeclareNodeNamed(i); + DeclareNodeNamed(j); + + NSMutableArray *allNodes = [@[a, b, c, d, e, f, g, h, i, j] mutableCopy]; + NSArray *testPrevious = @[]; + NSArray __block *testPending = @[]; + + int len1 = 1 + arc4random_uniform(9); + for (NSUInteger n = 0; n < len1; n++) { // shuffle and add + [allNodes exchangeObjectAtIndex:n withObjectAtIndex:n + arc4random_uniform(10 - (uint32_t) n)]; + testPrevious = [testPrevious arrayByAddingObject:allNodes[n]]; + } + + __block NSUInteger testCount = 0; + node.layoutSpecBlock = ^(ASDisplayNode *node, ASSizeRange size) { + ASStackLayoutSpec *stack = [ASStackLayoutSpec verticalStackLayoutSpec]; + + if (testCount++ == 0) { + stack.children = testPrevious; + } + else { + testPending = @[]; + int len2 = 1 + arc4random_uniform(9); + for (NSUInteger n = 0; n < len2; n++) { // shuffle and add + [allNodes exchangeObjectAtIndex:n withObjectAtIndex:n + arc4random_uniform(10 - (uint32_t) n)]; + testPending = [testPending arrayByAddingObject:allNodes[n]]; + } + stack.children = testPending; + } + + return stack; + }; + + ASDisplayNodeSizeToFitSize(node, CGSizeMake(100, 100)); + [node.view layoutIfNeeded]; + + // Because automaticallyManagesSubnodes is used, the subnodes array is constructed from the layout spec's children. + NSString *expected = [[testPrevious valueForKey:@"debugName"] componentsJoinedByString:@","]; + XCTAssert([node.subnodes isEqualToArray:testPrevious], @"subnodes: %@, array: %@", node.subnodes, testPrevious); + XCTAssertNodeSubnodeSubviewSublayerOrder(node, YES /* isLoaded */, NO /* isLayerBacked */, + expected, @"Initial order"); + + for (NSUInteger n = 0; n < 25; n++) { + [node invalidateCalculatedLayout]; + [node.view setNeedsLayout]; + [node.view layoutIfNeeded]; + + + XCTAssert([node.subnodes isEqualToArray:testPending], @"subnodes: %@, array: %@", node.subnodes, testPending); + expected = [[testPending valueForKey:@"debugName"] componentsJoinedByString:@","]; + + XCTAssertEqualObjects(orderStringFromSubnodes(node), expected, @"Incorrect node order for Random order #%ld", (unsigned long) n); + XCTAssertEqualObjects(orderStringFromSubviews(node.view), expected, @"Incorrect subviews for Random order #%ld", (unsigned long) n); + XCTAssertEqualObjects(orderStringFromSublayers(node.layer), expected, @"Incorrect sublayers for Random order #%ld", (unsigned long) n); + } +} + - (void)testThatStackSpecOrdersSubnodesCorrectly { // This test ensures that the z-order of nodes matches the stack spec, including after relayout / transition. @@ -2407,14 +2499,26 @@ static bool stringContainsPointer(NSString *description, id p) { DeclareNodeNamed(b); DeclareNodeNamed(c); DeclareNodeNamed(d); + DeclareNodeNamed(e); NSArray *nodesForwardOrder = @[a, b, c, d]; NSArray *nodesReverseOrder = @[d, c, b, a]; + NSArray *addAndMoveOrder = @[a, b, e, d, c]; __block BOOL flipItemOrder = NO; + __block NSUInteger testCount = 0; node.layoutSpecBlock = ^(ASDisplayNode *node, ASSizeRange size) { ASStackLayoutSpec *stack = [ASStackLayoutSpec verticalStackLayoutSpec]; - stack.children = flipItemOrder ? nodesReverseOrder : nodesForwardOrder; + switch(testCount) { + case 0: + stack.children = nodesForwardOrder; break; + case 1: + stack.children = nodesReverseOrder; break; + case 2: + default: + stack.children = addAndMoveOrder; break; + } + testCount++; return stack; }; @@ -2428,13 +2532,22 @@ static bool stringContainsPointer(NSString *description, id p) { flipItemOrder = YES; [node invalidateCalculatedLayout]; + [node.view setNeedsLayout]; [node.view layoutIfNeeded]; // In this case, it's critical that the items are in the new order so that event handling and apparent z-position are correct. // FIXME: The reversal case is not currently passing. - // XCTAssert([node.subnodes isEqualToArray:nodesReverseOrder], @"subnodes: %@, array: %@", node.subnodes, nodesReverseOrder); - // XCTAssertNodeSubnodeSubviewSublayerOrder(node, YES /* isLoaded */, NO /* isLayerBacked */, - // @"d,c,b,a", @"Reverse order"); + XCTAssert([node.subnodes isEqualToArray:nodesReverseOrder], @"subnodes: %@, array: %@", node.subnodes, nodesReverseOrder); + XCTAssertNodeSubnodeSubviewSublayerOrder(node, YES /* isLoaded */, NO /* isLayerBacked */, + @"d,c,b,a", @"Reverse order"); + + [node invalidateCalculatedLayout]; + [node.view setNeedsLayout]; + [node.view layoutIfNeeded]; + XCTAssert([node.subnodes isEqualToArray:addAndMoveOrder], @"subnodes: %@, array: %@", node.subnodes, addAndMoveOrder); + XCTAssertNodeSubnodeSubviewSublayerOrder(node, YES /* isLoaded */, NO /* isLayerBacked */, + @"a,b,e,d,c", @"AddAndMove order"); + } - (void)testThatOverlaySpecOrdersSubnodesCorrectly @@ -2578,4 +2691,16 @@ static bool stringContainsPointer(NSString *description, id p) { XCTAssertTrue([node isSynchronous], @"Node should be synchronous if viewClass is ovewritten and not a subclass of _ASDisplayView"); } +- (void)testCornerRoundingTypeClippingRoundedCornersIsUsingASDisplayNodeCornerLayerDelegate +{ + ASTestDisplayNode *node = [[ASTestDisplayNode alloc] init]; + node.cornerRoundingType = ASCornerRoundingTypeClipping; + node.cornerRadius = 10.0; + auto l = node.clipCornerLayers; + for (int i = 0; i < NUM_CLIP_CORNER_LAYERS; i++) { + CALayer *cornerLayer = (*l)[i]; + XCTAssertTrue([cornerLayer.delegate isKindOfClass:[ASDisplayNodeCornerLayerDelegate class]], @""); + } +} + @end diff --git a/Tests/ASDisplayNodeTestsHelper.h b/Tests/ASDisplayNodeTestsHelper.h index 2d071bcf83..4e884f4428 100644 --- a/Tests/ASDisplayNodeTestsHelper.h +++ b/Tests/ASDisplayNodeTestsHelper.h @@ -2,17 +2,9 @@ // ASDisplayNodeTestsHelper.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Tests/ASDisplayNodeTestsHelper.m b/Tests/ASDisplayNodeTestsHelper.m index 6dbd9b7945..3d625414e5 100644 --- a/Tests/ASDisplayNodeTestsHelper.m +++ b/Tests/ASDisplayNodeTestsHelper.m @@ -2,17 +2,9 @@ // ASDisplayNodeTestsHelper.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ASDisplayNodeTestsHelper.h" diff --git a/Tests/ASDisplayViewAccessibilityTests.mm b/Tests/ASDisplayViewAccessibilityTests.mm new file mode 100644 index 0000000000..e35d1fa0bf --- /dev/null +++ b/Tests/ASDisplayViewAccessibilityTests.mm @@ -0,0 +1,42 @@ +// +// ASDisplayViewAccessibilityTests.mm +// Texture +// +// Copyright (c) 2018-present, Pinterest, Inc. All rights reserved. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// + +#import + +#import +#import + +@interface ASDisplayViewAccessibilityTests : XCTestCase +@end + +@implementation ASDisplayViewAccessibilityTests + +- (void)testAccessibilityElementsAccessors +{ + // Setup nodes with accessibility info + ASDisplayNode *node = nil; + ASDisplayNode *subnode = nil; + node = [[ASDisplayNode alloc] init]; + subnode = [[ASDisplayNode alloc] init]; + NSString *label = @"foo"; + subnode.isAccessibilityElement = YES; + subnode.accessibilityLabel = label; + [node addSubnode:subnode]; + XCTAssertEqualObjects([node.view.accessibilityElements.firstObject accessibilityLabel], label); + // NOTE: The following tests will fail unless accessibility is enabled, e.g. by turning the + // accessibility inspector on. See https://github.com/TextureGroup/Texture/pull/1069 for details. + /*XCTAssertEqualObjects([[node.view accessibilityElementAtIndex:0] accessibilityLabel], label); + XCTAssertEqual(node.view.accessibilityElementCount, 1); + XCTAssertEqual([node.view indexOfAccessibilityElement:node.view.accessibilityElements.firstObject], 0);*/ +} + +@end diff --git a/Tests/ASEditableTextNodeTests.m b/Tests/ASEditableTextNodeTests.m index abeb63426e..a7bbad223a 100644 --- a/Tests/ASEditableTextNodeTests.m +++ b/Tests/ASEditableTextNodeTests.m @@ -2,19 +2,9 @@ // ASEditableTextNodeTests.m // Texture // -// Created by Michael Schneider on 5/31/16. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Tests/ASImageNodeSnapshotTests.m b/Tests/ASImageNodeSnapshotTests.m index c3bdb8cd36..f9c0ca71f9 100644 --- a/Tests/ASImageNodeSnapshotTests.m +++ b/Tests/ASImageNodeSnapshotTests.m @@ -2,17 +2,9 @@ // ASImageNodeSnapshotTests.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ASSnapshotTestCase.h" diff --git a/Tests/ASInsetLayoutSpecSnapshotTests.mm b/Tests/ASInsetLayoutSpecSnapshotTests.mm index 275b7cde03..d6047d35f3 100644 --- a/Tests/ASInsetLayoutSpecSnapshotTests.mm +++ b/Tests/ASInsetLayoutSpecSnapshotTests.mm @@ -2,17 +2,9 @@ // ASInsetLayoutSpecSnapshotTests.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ASLayoutSpecSnapshotTestsHelper.h" diff --git a/Tests/ASIntegerMapTests.m b/Tests/ASIntegerMapTests.m index 7afdccf1c3..a79086a614 100644 --- a/Tests/ASIntegerMapTests.m +++ b/Tests/ASIntegerMapTests.m @@ -2,12 +2,8 @@ // ASIntegerMapTests.m // Texture // -// Copyright (c) 2017-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ASTestCase.h" diff --git a/Tests/ASLayoutElementStyleTests.m b/Tests/ASLayoutElementStyleTests.m index ebec4bbd53..4afd67ec4c 100644 --- a/Tests/ASLayoutElementStyleTests.m +++ b/Tests/ASLayoutElementStyleTests.m @@ -1,18 +1,10 @@ // -// ASLayoutElementStyleTests.mm +// ASLayoutElementStyleTests.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Tests/ASLayoutEngineTests.mm b/Tests/ASLayoutEngineTests.mm index 719a84d5ee..76d0a7e6ff 100644 --- a/Tests/ASLayoutEngineTests.mm +++ b/Tests/ASLayoutEngineTests.mm @@ -2,12 +2,8 @@ // ASLayoutEngineTests.mm // Texture // -// Copyright (c) 2017-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ASTestCase.h" @@ -298,7 +294,7 @@ // are common to both fixture2 and fixture4 are available from the cache. } else { // Incorrect behavior: nodeC will get measured against its new bounds on main. - auto cPendingSize = [fixture2 layoutForNode:nodeC].size; + let cPendingSize = [fixture2 layoutForNode:nodeC].size; OCMExpect([nodeC.mock calculateLayoutThatFits:ASSizeRangeMake(cPendingSize)]).onMainThread(); } [window layoutIfNeeded]; @@ -368,16 +364,16 @@ - (void)verifyFixture:(ASTLayoutFixture *)fixture { - auto expected = fixture.layout; + let expected = fixture.layout; // Ensure expected == frames - auto frames = [fixture.rootNode currentLayoutBasedOnFrames]; + let frames = [fixture.rootNode currentLayoutBasedOnFrames]; if (![expected isEqual:frames]) { XCTFail(@"\n*** Layout verification failed – frames don't match expected. ***\nGot:\n%@\nExpected:\n%@", [frames recursiveDescription], [expected recursiveDescription]); } // Ensure expected == calculatedLayout - auto calculated = fixture.rootNode.calculatedLayout; + let calculated = fixture.rootNode.calculatedLayout; if (![expected isEqual:calculated]) { XCTFail(@"\n*** Layout verification failed – calculated layout doesn't match expected. ***\nGot:\n%@\nExpected:\n%@", [calculated recursiveDescription], [expected recursiveDescription]); } @@ -406,22 +402,22 @@ */ - (ASTLayoutFixture *)createFixture1 { - auto fixture = [[ASTLayoutFixture alloc] init]; + let fixture = [[ASTLayoutFixture alloc] init]; // nodeB [fixture addSizeRange:{{0, 0}, {INFINITY, 1}} forNode:nodeB]; - auto layoutB = [ASLayout layoutWithLayoutElement:nodeB size:{1,1} position:{0,0} sublayouts:nil]; + let layoutB = [ASLayout layoutWithLayoutElement:nodeB size:{1,1} position:{0,0} sublayouts:nil]; // nodeC [fixture addSizeRange:{{0, 0}, {INFINITY, 1}} forNode:nodeC]; - auto layoutC = [ASLayout layoutWithLayoutElement:nodeC size:{2,1} position:{4,0} sublayouts:nil]; + let layoutC = [ASLayout layoutWithLayoutElement:nodeC size:{2,1} position:{4,0} sublayouts:nil]; // nodeD [fixture addSizeRange:{{0, 0}, {INFINITY, 1}} forNode:nodeD]; - auto layoutD = [ASLayout layoutWithLayoutElement:nodeD size:{1,1} position:{9,0} sublayouts:nil]; + let layoutD = [ASLayout layoutWithLayoutElement:nodeD size:{1,1} position:{9,0} sublayouts:nil]; [fixture addSizeRange:{{10, 1}, {10, 1}} forNode:nodeA]; - auto layoutA = [ASLayout layoutWithLayoutElement:nodeA size:{10,1} position:ASPointNull sublayouts:@[ layoutB, layoutC, layoutD ]]; + let layoutA = [ASLayout layoutWithLayoutElement:nodeA size:{10,1} position:ASPointNull sublayouts:@[ layoutB, layoutC, layoutD ]]; fixture.layout = layoutA; [fixture.layoutSpecBlocks setObject:fixture1and3and5NodeALayoutSpecBlock forKey:nodeA]; @@ -441,22 +437,22 @@ */ - (ASTLayoutFixture *)createFixture2 { - auto fixture = [[ASTLayoutFixture alloc] init]; + let fixture = [[ASTLayoutFixture alloc] init]; // nodeB [fixture addSizeRange:{{0, 0}, {INFINITY, 1}} forNode:nodeB]; - auto layoutB = [ASLayout layoutWithLayoutElement:nodeB size:{1,1} position:{0,0} sublayouts:nil]; + let layoutB = [ASLayout layoutWithLayoutElement:nodeB size:{1,1} position:{0,0} sublayouts:nil]; // nodeC [fixture addSizeRange:{{0, 0}, {INFINITY, 1}} forNode:nodeC]; - auto layoutC = [ASLayout layoutWithLayoutElement:nodeC size:{4,1} position:{3,0} sublayouts:nil]; + let layoutC = [ASLayout layoutWithLayoutElement:nodeC size:{4,1} position:{3,0} sublayouts:nil]; // nodeE [fixture addSizeRange:{{0, 0}, {INFINITY, 1}} forNode:nodeE]; - auto layoutE = [ASLayout layoutWithLayoutElement:nodeE size:{1,1} position:{9,0} sublayouts:nil]; + let layoutE = [ASLayout layoutWithLayoutElement:nodeE size:{1,1} position:{9,0} sublayouts:nil]; [fixture addSizeRange:{{10, 1}, {10, 1}} forNode:nodeA]; - auto layoutA = [ASLayout layoutWithLayoutElement:nodeA size:{10,1} position:ASPointNull sublayouts:@[ layoutB, layoutC, layoutE ]]; + let layoutA = [ASLayout layoutWithLayoutElement:nodeA size:{10,1} position:ASPointNull sublayouts:@[ layoutB, layoutC, layoutE ]]; fixture.layout = layoutA; ASLayoutSpecBlock specBlockA = ^ASLayoutSpec * _Nonnull(__kindof ASDisplayNode * _Nonnull node, ASSizeRange constrainedSize) { @@ -477,24 +473,24 @@ */ - (ASTLayoutFixture *)createFixture3 { - auto fixture = [[ASTLayoutFixture alloc] init]; + let fixture = [[ASTLayoutFixture alloc] init]; // nodeB wants 8,1 but it will settle for 7,1 [fixture setReturnedSize:{8,1} forNode:nodeB]; [fixture addSizeRange:{{0, 0}, {INFINITY, 1}} forNode:nodeB]; [fixture addSizeRange:{{7, 0}, {7, 1}} forNode:nodeB]; - auto layoutB = [ASLayout layoutWithLayoutElement:nodeB size:{7,1} position:{0,0} sublayouts:nil]; + let layoutB = [ASLayout layoutWithLayoutElement:nodeB size:{7,1} position:{0,0} sublayouts:nil]; // nodeC [fixture addSizeRange:{{0, 0}, {INFINITY, 1}} forNode:nodeC]; - auto layoutC = [ASLayout layoutWithLayoutElement:nodeC size:{2,1} position:{7,0} sublayouts:nil]; + let layoutC = [ASLayout layoutWithLayoutElement:nodeC size:{2,1} position:{7,0} sublayouts:nil]; // nodeD [fixture addSizeRange:{{0, 0}, {INFINITY, 1}} forNode:nodeD]; - auto layoutD = [ASLayout layoutWithLayoutElement:nodeD size:{1,1} position:{9,0} sublayouts:nil]; + let layoutD = [ASLayout layoutWithLayoutElement:nodeD size:{1,1} position:{9,0} sublayouts:nil]; [fixture addSizeRange:{{10, 1}, {10, 1}} forNode:nodeA]; - auto layoutA = [ASLayout layoutWithLayoutElement:nodeA size:{10,1} position:ASPointNull sublayouts:@[ layoutB, layoutC, layoutD ]]; + let layoutA = [ASLayout layoutWithLayoutElement:nodeA size:{10,1} position:ASPointNull sublayouts:@[ layoutB, layoutC, layoutD ]]; fixture.layout = layoutA; [fixture.layoutSpecBlocks setObject:fixture1and3and5NodeALayoutSpecBlock forKey:nodeA]; @@ -520,22 +516,22 @@ */ - (ASTLayoutFixture *)createFixture4 { - auto fixture = [[ASTLayoutFixture alloc] init]; + let fixture = [[ASTLayoutFixture alloc] init]; // nodeB [fixture addSizeRange:{{0, 0}, {INFINITY, 1}} forNode:nodeB]; - auto layoutB = [ASLayout layoutWithLayoutElement:nodeB size:{1,1} position:{0,0} sublayouts:nil]; + let layoutB = [ASLayout layoutWithLayoutElement:nodeB size:{1,1} position:{0,0} sublayouts:nil]; // nodeD [fixture addSizeRange:{{0, 0}, {INFINITY, 1}} forNode:nodeD]; - auto layoutD = [ASLayout layoutWithLayoutElement:nodeD size:{2,1} position:{4,0} sublayouts:nil]; + let layoutD = [ASLayout layoutWithLayoutElement:nodeD size:{2,1} position:{4,0} sublayouts:nil]; // nodeE [fixture addSizeRange:{{0, 0}, {INFINITY, 1}} forNode:nodeE]; - auto layoutE = [ASLayout layoutWithLayoutElement:nodeE size:{1,1} position:{9,0} sublayouts:nil]; + let layoutE = [ASLayout layoutWithLayoutElement:nodeE size:{1,1} position:{9,0} sublayouts:nil]; [fixture addSizeRange:{{10, 1}, {10, 1}} forNode:nodeA]; - auto layoutA = [ASLayout layoutWithLayoutElement:nodeA size:{10,1} position:ASPointNull sublayouts:@[ layoutB, layoutD, layoutE ]]; + let layoutA = [ASLayout layoutWithLayoutElement:nodeA size:{10,1} position:ASPointNull sublayouts:@[ layoutB, layoutD, layoutE ]]; fixture.layout = layoutA; ASLayoutSpecBlock specBlockA = ^ASLayoutSpec * _Nonnull(__kindof ASDisplayNode * _Nonnull node, ASSizeRange constrainedSize) { @@ -552,22 +548,22 @@ */ - (ASTLayoutFixture *)createFixture5 { - auto fixture = [[ASTLayoutFixture alloc] init]; + let fixture = [[ASTLayoutFixture alloc] init]; // nodeB [fixture addSizeRange:{{0, 0}, {INFINITY, 1}} forNode:nodeB]; - auto layoutB = [ASLayout layoutWithLayoutElement:nodeB size:{1,1} position:{0,0} sublayouts:nil]; + let layoutB = [ASLayout layoutWithLayoutElement:nodeB size:{1,1} position:{0,0} sublayouts:nil]; // nodeC [fixture addSizeRange:{{0, 0}, {INFINITY, 1}} forNode:nodeC]; - auto layoutC = [ASLayout layoutWithLayoutElement:nodeC size:{2,1} position:{4,0} sublayouts:nil]; + let layoutC = [ASLayout layoutWithLayoutElement:nodeC size:{2,1} position:{4,0} sublayouts:nil]; // nodeD [fixture addSizeRange:{{0, 0}, {INFINITY, 1}} forNode:nodeD]; - auto layoutD = [ASLayout layoutWithLayoutElement:nodeD size:{1,1} position:{9,0} sublayouts:nil]; + let layoutD = [ASLayout layoutWithLayoutElement:nodeD size:{1,1} position:{9,0} sublayouts:nil]; [fixture addSizeRange:{{15, 1}, {15, 1}} forNode:nodeA]; - auto layoutA = [ASLayout layoutWithLayoutElement:nodeA size:{15,1} position:ASPointNull sublayouts:@[ layoutB, layoutC, layoutD ]]; + let layoutA = [ASLayout layoutWithLayoutElement:nodeA size:{15,1} position:ASPointNull sublayouts:@[ layoutB, layoutC, layoutD ]]; fixture.layout = layoutA; [fixture.layoutSpecBlocks setObject:fixture1and3and5NodeALayoutSpecBlock forKey:nodeA]; diff --git a/Tests/ASLayoutFlatteningTests.m b/Tests/ASLayoutFlatteningTests.m index fb04a95090..fb9870c03d 100644 --- a/Tests/ASLayoutFlatteningTests.m +++ b/Tests/ASLayoutFlatteningTests.m @@ -2,12 +2,8 @@ // ASLayoutFlatteningTests.m // Texture // -// Copyright (c) 2017-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Tests/ASLayoutSpecSnapshotTestsHelper.h b/Tests/ASLayoutSpecSnapshotTestsHelper.h index cfea40af36..740017ee9e 100644 --- a/Tests/ASLayoutSpecSnapshotTestsHelper.h +++ b/Tests/ASLayoutSpecSnapshotTestsHelper.h @@ -2,17 +2,9 @@ // ASLayoutSpecSnapshotTestsHelper.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ASSnapshotTestCase.h" diff --git a/Tests/ASLayoutSpecSnapshotTestsHelper.m b/Tests/ASLayoutSpecSnapshotTestsHelper.m index bc3fde6b3f..d7385cda95 100644 --- a/Tests/ASLayoutSpecSnapshotTestsHelper.m +++ b/Tests/ASLayoutSpecSnapshotTestsHelper.m @@ -2,17 +2,9 @@ // ASLayoutSpecSnapshotTestsHelper.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ASLayoutSpecSnapshotTestsHelper.h" diff --git a/Tests/ASLayoutSpecTests.m b/Tests/ASLayoutSpecTests.m index cb67b99ac9..257e645499 100644 --- a/Tests/ASLayoutSpecTests.m +++ b/Tests/ASLayoutSpecTests.m @@ -2,17 +2,9 @@ // ASLayoutSpecTests.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Tests/ASLayoutTestNode.h b/Tests/ASLayoutTestNode.h index 8bdd0f28cc..231447abe1 100644 --- a/Tests/ASLayoutTestNode.h +++ b/Tests/ASLayoutTestNode.h @@ -2,12 +2,8 @@ // ASLayoutTestNode.h // Texture // -// Copyright (c) 2017-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Tests/ASLayoutTestNode.mm b/Tests/ASLayoutTestNode.mm index 3a112422a7..8367c09938 100644 --- a/Tests/ASLayoutTestNode.mm +++ b/Tests/ASLayoutTestNode.mm @@ -2,12 +2,8 @@ // ASLayoutTestNode.mm // Texture // -// Copyright (c) 2017-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ASLayoutTestNode.h" @@ -39,7 +35,7 @@ - (ASLayout *)_currentLayoutBasedOnFramesForRootNode:(BOOL)isRootNode { - auto sublayouts = [NSMutableArray array]; + let sublayouts = [[NSMutableArray alloc] init]; for (ASLayoutTestNode *subnode in self.subnodes) { [sublayouts addObject:[subnode _currentLayoutBasedOnFramesForRootNode:NO]]; } @@ -64,7 +60,7 @@ return [super calculateLayoutThatFits:constrainedSize]; } else { // Interestingly, the infra will auto-clamp sizes from calculateSizeThatFits, but not from calculateLayoutThatFits. - auto size = ASSizeRangeClamp(constrainedSize, self.testSize); + let size = ASSizeRangeClamp(constrainedSize, self.testSize); return [ASLayout layoutWithLayoutElement:self size:size]; } } diff --git a/Tests/ASMultiplexImageNodeTests.m b/Tests/ASMultiplexImageNodeTests.m index 71b1fe05e4..56e3b11199 100644 --- a/Tests/ASMultiplexImageNodeTests.m +++ b/Tests/ASMultiplexImageNodeTests.m @@ -2,17 +2,9 @@ // ASMultiplexImageNodeTests.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Tests/ASMutableAttributedStringBuilderTests.m b/Tests/ASMutableAttributedStringBuilderTests.m index dd98130fef..9999b6d4b4 100644 --- a/Tests/ASMutableAttributedStringBuilderTests.m +++ b/Tests/ASMutableAttributedStringBuilderTests.m @@ -2,17 +2,9 @@ // ASMutableAttributedStringBuilderTests.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Tests/ASNavigationControllerTests.m b/Tests/ASNavigationControllerTests.m index 80f6ba87fa..b964029b83 100644 --- a/Tests/ASNavigationControllerTests.m +++ b/Tests/ASNavigationControllerTests.m @@ -2,12 +2,8 @@ // ASNavigationControllerTests.m // Texture // -// Copyright (c) 2017-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Tests/ASNetworkImageNodeTests.m b/Tests/ASNetworkImageNodeTests.m index 13959fdfe1..1dcc363e09 100644 --- a/Tests/ASNetworkImageNodeTests.m +++ b/Tests/ASNetworkImageNodeTests.m @@ -2,12 +2,8 @@ // ASNetworkImageNodeTests.m // Texture // -// Copyright (c) 2018-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Tests/ASOverlayLayoutSpecSnapshotTests.mm b/Tests/ASOverlayLayoutSpecSnapshotTests.mm index 9b9cc68277..a50baa9ef4 100644 --- a/Tests/ASOverlayLayoutSpecSnapshotTests.mm +++ b/Tests/ASOverlayLayoutSpecSnapshotTests.mm @@ -2,17 +2,9 @@ // ASOverlayLayoutSpecSnapshotTests.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ASLayoutSpecSnapshotTestsHelper.h" diff --git a/Tests/ASPagerNodeTests.m b/Tests/ASPagerNodeTests.m index f34b57f56b..76ea96c53b 100644 --- a/Tests/ASPagerNodeTests.m +++ b/Tests/ASPagerNodeTests.m @@ -2,17 +2,9 @@ // ASPagerNodeTests.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Tests/ASPerformanceTestContext.h b/Tests/ASPerformanceTestContext.h index d60f53b1ae..49196d451c 100644 --- a/Tests/ASPerformanceTestContext.h +++ b/Tests/ASPerformanceTestContext.h @@ -2,12 +2,8 @@ // ASPerformanceTestContext.h // Texture // -// Copyright (c) 2018-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Tests/ASPerformanceTestContext.m b/Tests/ASPerformanceTestContext.m index ee6027aff7..6064a8af9c 100644 --- a/Tests/ASPerformanceTestContext.m +++ b/Tests/ASPerformanceTestContext.m @@ -2,8 +2,9 @@ // ASPerformanceTestContext.m // Texture // -// Created by Adlai Holler on 8/28/16. -// Copyright © 2016 Facebook. All rights reserved. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import @@ -24,7 +25,7 @@ { self = [super init]; if (self != nil) { - _userInfo = [NSMutableDictionary dictionary]; + _userInfo = [[NSMutableDictionary alloc] init]; } return self; } diff --git a/Tests/ASPhotosFrameworkImageRequestTests.m b/Tests/ASPhotosFrameworkImageRequestTests.m index 0a2c7870ec..dc753bb927 100644 --- a/Tests/ASPhotosFrameworkImageRequestTests.m +++ b/Tests/ASPhotosFrameworkImageRequestTests.m @@ -2,21 +2,13 @@ // ASPhotosFrameworkImageRequestTests.m // Texture // -// Created by Adlai Holler on 9/25/15. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // +#if AS_USE_PHOTOS + #import #import @@ -69,3 +61,5 @@ static NSString *const kTestAssetID = @"testAssetID"; } @end + +#endif diff --git a/Tests/ASRatioLayoutSpecSnapshotTests.mm b/Tests/ASRatioLayoutSpecSnapshotTests.mm index 8aafa6610b..f5bad2723f 100644 --- a/Tests/ASRatioLayoutSpecSnapshotTests.mm +++ b/Tests/ASRatioLayoutSpecSnapshotTests.mm @@ -2,17 +2,9 @@ // ASRatioLayoutSpecSnapshotTests.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ASLayoutSpecSnapshotTestsHelper.h" diff --git a/Tests/ASRectMapTests.m b/Tests/ASRectMapTests.m deleted file mode 100644 index 357f3879a6..0000000000 --- a/Tests/ASRectMapTests.m +++ /dev/null @@ -1,51 +0,0 @@ -// -// ASRectMapTests.m -// Texture -// -// Created by Adlai Holler on 2/24/17. -// Copyright © 2017 Facebook. All rights reserved. -// - -#import - -#import "ASRectMap.h" -#import "ASXCTExtensions.h" - -@interface ASRectMapTests : XCTestCase -@end - -@implementation ASRectMapTests - -- (void)testThatItStoresRects -{ - ASRectMap *table = [ASRectMap rectMapForWeakObjectPointers]; - NSObject *key0 = [[NSObject alloc] init]; - NSObject *key1 = [[NSObject alloc] init]; - ASXCTAssertEqualRects([table rectForKey:key0], CGRectNull); - ASXCTAssertEqualRects([table rectForKey:key1], CGRectNull); - CGRect rect0 = CGRectMake(0, 0, 100, 100); - CGRect rect1 = CGRectMake(0, 0, 50, 50); - [table setRect:rect0 forKey:key0]; - [table setRect:rect1 forKey:key1]; - - ASXCTAssertEqualRects([table rectForKey:key0], rect0); - ASXCTAssertEqualRects([table rectForKey:key1], rect1); -} - - -- (void)testCopying -{ - ASRectMap *table = [ASRectMap rectMapForWeakObjectPointers]; - NSObject *key = [[NSObject alloc] init]; - ASXCTAssertEqualRects([table rectForKey:key], CGRectNull); - CGRect rect0 = CGRectMake(0, 0, 100, 100); - CGRect rect1 = CGRectMake(0, 0, 50, 50); - [table setRect:rect0 forKey:key]; - ASRectMap *copy = [table copy]; - [copy setRect:rect1 forKey:key]; - - ASXCTAssertEqualRects([table rectForKey:key], rect0); - ASXCTAssertEqualRects([copy rectForKey:key], rect1); -} - -@end diff --git a/Tests/ASRecursiveUnfairLockTests.m b/Tests/ASRecursiveUnfairLockTests.m index 56c0245b44..38ba7d57d8 100644 --- a/Tests/ASRecursiveUnfairLockTests.m +++ b/Tests/ASRecursiveUnfairLockTests.m @@ -2,12 +2,8 @@ // ASRecursiveUnfairLockTests.m // Texture // -// Copyright (c) 2018-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ASTestCase.h" diff --git a/Tests/ASRelativeLayoutSpecSnapshotTests.mm b/Tests/ASRelativeLayoutSpecSnapshotTests.mm index 8a11564c3b..93887a9ce8 100644 --- a/Tests/ASRelativeLayoutSpecSnapshotTests.mm +++ b/Tests/ASRelativeLayoutSpecSnapshotTests.mm @@ -2,17 +2,9 @@ // ASRelativeLayoutSpecSnapshotTests.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ASLayoutSpecSnapshotTestsHelper.h" diff --git a/Tests/ASRunLoopQueueTests.m b/Tests/ASRunLoopQueueTests.m index b355094163..89eff024fe 100644 --- a/Tests/ASRunLoopQueueTests.m +++ b/Tests/ASRunLoopQueueTests.m @@ -2,12 +2,8 @@ // ASRunLoopQueueTests.m // Texture // -// Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ASTestCase.h" diff --git a/Tests/ASScrollNodeTests.m b/Tests/ASScrollNodeTests.m index 56b3fd731b..f0d8fe2079 100644 --- a/Tests/ASScrollNodeTests.m +++ b/Tests/ASScrollNodeTests.m @@ -2,12 +2,8 @@ // ASScrollNodeTests.m // Texture // -// Copyright (c) 2017-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Tests/ASSnapshotTestCase.h b/Tests/ASSnapshotTestCase.h index 580b487b9a..f2b3d99e0c 100644 --- a/Tests/ASSnapshotTestCase.h +++ b/Tests/ASSnapshotTestCase.h @@ -2,17 +2,9 @@ // ASSnapshotTestCase.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Tests/ASSnapshotTestCase.m b/Tests/ASSnapshotTestCase.m index a929bb1594..9fc4e8fd09 100644 --- a/Tests/ASSnapshotTestCase.m +++ b/Tests/ASSnapshotTestCase.m @@ -2,17 +2,9 @@ // ASSnapshotTestCase.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ASSnapshotTestCase.h" diff --git a/Tests/ASStackLayoutSpecSnapshotTests.mm b/Tests/ASStackLayoutSpecSnapshotTests.mm index 7f4c3251f6..ac6a2a254d 100644 --- a/Tests/ASStackLayoutSpecSnapshotTests.mm +++ b/Tests/ASStackLayoutSpecSnapshotTests.mm @@ -2,17 +2,9 @@ // ASStackLayoutSpecSnapshotTests.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ASLayoutSpecSnapshotTestsHelper.h" diff --git a/Tests/ASTLayoutFixture.h b/Tests/ASTLayoutFixture.h index e9395dd372..ed97169168 100644 --- a/Tests/ASTLayoutFixture.h +++ b/Tests/ASTLayoutFixture.h @@ -2,12 +2,8 @@ // ASTLayoutFixture.h // Texture // -// Copyright (c) 2017-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Tests/ASTLayoutFixture.mm b/Tests/ASTLayoutFixture.mm index 2232e91904..694f03e4e8 100644 --- a/Tests/ASTLayoutFixture.mm +++ b/Tests/ASTLayoutFixture.mm @@ -2,12 +2,8 @@ // ASTLayoutFixture.mm // Texture // -// Copyright (c) 2017-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ASTLayoutFixture.h" @@ -37,9 +33,9 @@ - (void)addSizeRange:(ASSizeRange)sizeRange forNode:(ASLayoutTestNode *)node { - auto ranges = [_sizeRanges objectForKey:node]; + var ranges = [_sizeRanges objectForKey:node]; if (ranges == nil) { - ranges = [NSMutableArray array]; + ranges = [[NSMutableArray alloc] init]; [_sizeRanges setObject:ranges forKey:node]; } [ranges addObject:[NSValue valueWithBytes:&sizeRange objCType:@encode(ASSizeRange)]]; @@ -52,7 +48,7 @@ - (ASSizeRange)firstSizeRangeForNode:(ASLayoutTestNode *)node { - auto val = [_sizeRanges objectForKey:node].firstObject; + let val = [_sizeRanges objectForKey:node].firstObject; ASSizeRange r; [val getValue:&r]; return r; @@ -104,7 +100,7 @@ - (NSSet *)allNodes { - auto allLayouts = [NSMutableArray array]; + let allLayouts = [NSMutableArray array]; [ASTLayoutFixture collectAllLayoutsFromLayout:self.layout array:allLayouts]; return [NSSet setWithArray:[allLayouts valueForKey:@"layoutElement"]]; } @@ -113,7 +109,7 @@ { // Update layoutSpecBlock for parent nodes, set automatic subnode management for (ASDisplayNode *node in _layoutSpecBlocks) { - auto block = [_layoutSpecBlocks objectForKey:node]; + let block = [_layoutSpecBlocks objectForKey:node]; if (node.layoutSpecBlock != block) { node.automaticallyManagesSubnodes = YES; node.layoutSpecBlock = block; @@ -128,9 +124,9 @@ /// to the layout size if needed, then call -setNeedsLayout - (void)setTestSizesOfLeafNodesInLayout:(ASLayout *)layout { - auto node = (ASLayoutTestNode *)layout.layoutElement; + let node = (ASLayoutTestNode *)layout.layoutElement; if (layout.sublayouts.count == 0) { - auto override = [self.returnedSizes objectForKey:node]; + let override = [self.returnedSizes objectForKey:node]; node.testSize = override ? override.CGSizeValue : layout.size; } else { node.testSize = CGSizeZero; diff --git a/Tests/ASTabBarControllerTests.m b/Tests/ASTabBarControllerTests.m index 0e6d9b3d31..b933222c9f 100644 --- a/Tests/ASTabBarControllerTests.m +++ b/Tests/ASTabBarControllerTests.m @@ -2,12 +2,8 @@ // ASTabBarControllerTests.m // Texture // -// Copyright (c) 2017-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Tests/ASTableViewTests.mm b/Tests/ASTableViewTests.mm index dbd5672cf0..afb412c7bc 100644 --- a/Tests/ASTableViewTests.mm +++ b/Tests/ASTableViewTests.mm @@ -2,17 +2,9 @@ // ASTableViewTests.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Tests/ASTableViewThrashTests.m b/Tests/ASTableViewThrashTests.m index 3c76390ac8..df17ca4ba7 100644 --- a/Tests/ASTableViewThrashTests.m +++ b/Tests/ASTableViewThrashTests.m @@ -2,17 +2,9 @@ // ASTableViewThrashTests.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Tests/ASTextKitCoreTextAdditionsTests.m b/Tests/ASTextKitCoreTextAdditionsTests.m index fbf4a5ded3..4a17e0660d 100644 --- a/Tests/ASTextKitCoreTextAdditionsTests.m +++ b/Tests/ASTextKitCoreTextAdditionsTests.m @@ -2,17 +2,9 @@ // ASTextKitCoreTextAdditionsTests.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Tests/ASTextKitFontSizeAdjusterTests.mm b/Tests/ASTextKitFontSizeAdjusterTests.mm new file mode 100644 index 0000000000..2f9cc0157f --- /dev/null +++ b/Tests/ASTextKitFontSizeAdjusterTests.mm @@ -0,0 +1,47 @@ +// +// ASTextKitFontSizeAdjusterTests.mm +// Texture +// +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 +// + +#import +#import + +@interface ASFontSizeAdjusterTests : XCTestCase + +@end + +@implementation ASFontSizeAdjusterTests + +- (void)testFontSizeAdjusterAttributes +{ + NSMutableParagraphStyle *paragraphStyle = [NSMutableParagraphStyle new]; + paragraphStyle.lineHeightMultiple = 2.0; + paragraphStyle.lineSpacing = 2.0; + paragraphStyle.paragraphSpacing = 4.0; + paragraphStyle.firstLineHeadIndent = 6.0; + paragraphStyle.headIndent = 8.0; + paragraphStyle.tailIndent = 10.0; + paragraphStyle.minimumLineHeight = 12.0; + paragraphStyle.maximumLineHeight = 14.0; + + NSMutableAttributedString *string = [[NSMutableAttributedString alloc] initWithString:@"Lorem ipsum dolor sit amet" + attributes:@{ NSParagraphStyleAttributeName: paragraphStyle }]; + + [ASTextKitFontSizeAdjuster adjustFontSizeForAttributeString:string withScaleFactor:0.5]; + + NSParagraphStyle *adjustedParagraphStyle = [string attribute:NSParagraphStyleAttributeName atIndex:0 effectiveRange:nil]; + + XCTAssertEqual(adjustedParagraphStyle.lineHeightMultiple, 2.0); + XCTAssertEqual(adjustedParagraphStyle.lineSpacing, 1.0); + XCTAssertEqual(adjustedParagraphStyle.paragraphSpacing, 2.0); + XCTAssertEqual(adjustedParagraphStyle.firstLineHeadIndent, 3.0); + XCTAssertEqual(adjustedParagraphStyle.headIndent, 4.0); + XCTAssertEqual(adjustedParagraphStyle.tailIndent, 5.0); + XCTAssertEqual(adjustedParagraphStyle.minimumLineHeight, 6.0); + XCTAssertEqual(adjustedParagraphStyle.maximumLineHeight, 7.0); +} + +@end diff --git a/Tests/ASTextKitTests.mm b/Tests/ASTextKitTests.mm index 6872061787..1d765efe4c 100644 --- a/Tests/ASTextKitTests.mm +++ b/Tests/ASTextKitTests.mm @@ -2,17 +2,9 @@ // ASTextKitTests.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Tests/ASTextKitTruncationTests.mm b/Tests/ASTextKitTruncationTests.mm index 9b0a39f99c..647c31867a 100644 --- a/Tests/ASTextKitTruncationTests.mm +++ b/Tests/ASTextKitTruncationTests.mm @@ -2,17 +2,9 @@ // ASTextKitTruncationTests.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Tests/ASTextNode2SnapshotTests.m b/Tests/ASTextNode2SnapshotTests.m index 680433e971..aba895c323 100644 --- a/Tests/ASTextNode2SnapshotTests.m +++ b/Tests/ASTextNode2SnapshotTests.m @@ -1,13 +1,9 @@ // -// ASTextNode2SnapshotTests.mm +// ASTextNode2SnapshotTests.m // Texture // -// Copyright (c) 2017-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // diff --git a/Tests/ASTextNodePerformanceTests.m b/Tests/ASTextNodePerformanceTests.m index f5c62e53a5..ac22bf5bb8 100644 --- a/Tests/ASTextNodePerformanceTests.m +++ b/Tests/ASTextNodePerformanceTests.m @@ -2,12 +2,8 @@ // ASTextNodePerformanceTests.m // Texture // -// Copyright (c) 2018-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Tests/ASTextNodeSnapshotTests.m b/Tests/ASTextNodeSnapshotTests.m index c81f5241a3..068c3896b3 100644 --- a/Tests/ASTextNodeSnapshotTests.m +++ b/Tests/ASTextNodeSnapshotTests.m @@ -2,18 +2,9 @@ // ASTextNodeSnapshotTests.m // Texture // -// Created by Garrett Moon on 8/12/16. -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ASSnapshotTestCase.h" @@ -137,4 +128,20 @@ ASSnapshotVerifyNode(textNode, nil); } +- (void)testFontPointSizeScaling +{ + NSMutableParagraphStyle *paragraphStyle = [NSMutableParagraphStyle new]; + paragraphStyle.lineHeightMultiple = 0.5; + paragraphStyle.lineSpacing = 2.0; + + ASTextNode *textNode = [[ASTextNode alloc] init]; + textNode.style.maxSize = CGSizeMake(60, 80); + textNode.pointSizeScaleFactors = @[@0.5]; + textNode.attributedText = [[NSAttributedString alloc] initWithString:@"Quality is an important thing" + attributes:@{ NSParagraphStyleAttributeName: paragraphStyle }]; + + ASDisplayNodeSizeToFitSizeRange(textNode, ASSizeRangeMake(CGSizeZero, CGSizeMake(INFINITY, INFINITY))); + ASSnapshotVerifyNode(textNode, nil); +} + @end diff --git a/Tests/ASTextNodeTests.m b/Tests/ASTextNodeTests.m index c6ec58d204..daf8cf7d79 100644 --- a/Tests/ASTextNodeTests.m +++ b/Tests/ASTextNodeTests.m @@ -2,17 +2,9 @@ // ASTextNodeTests.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Tests/ASTextNodeWordKernerTests.mm b/Tests/ASTextNodeWordKernerTests.mm index b4c760de7d..7b9773574b 100644 --- a/Tests/ASTextNodeWordKernerTests.mm +++ b/Tests/ASTextNodeWordKernerTests.mm @@ -2,17 +2,9 @@ // ASTextNodeWordKernerTests.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Tests/ASTraitCollectionTests.m b/Tests/ASTraitCollectionTests.m index aa106d75ec..ab201b16d4 100644 --- a/Tests/ASTraitCollectionTests.m +++ b/Tests/ASTraitCollectionTests.m @@ -2,12 +2,8 @@ // ASTraitCollectionTests.m // Texture // -// Copyright (c) 2017-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Tests/ASUICollectionViewTests.m b/Tests/ASUICollectionViewTests.m index ec7a51fa2d..8d8a9b9d38 100644 --- a/Tests/ASUICollectionViewTests.m +++ b/Tests/ASUICollectionViewTests.m @@ -2,17 +2,9 @@ // ASUICollectionViewTests.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Tests/ASVideoNodeTests.m b/Tests/ASVideoNodeTests.m index 57e9be4826..6a4311cfce 100644 --- a/Tests/ASVideoNodeTests.m +++ b/Tests/ASVideoNodeTests.m @@ -2,17 +2,9 @@ // ASVideoNodeTests.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Tests/ASViewControllerTests.m b/Tests/ASViewControllerTests.m index 3fa91d87f5..df050da613 100644 --- a/Tests/ASViewControllerTests.m +++ b/Tests/ASViewControllerTests.m @@ -2,17 +2,9 @@ // ASViewControllerTests.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Tests/ASWeakMapTests.m b/Tests/ASWeakMapTests.m index 21e2dde8a7..4158f0e88c 100644 --- a/Tests/ASWeakMapTests.m +++ b/Tests/ASWeakMapTests.m @@ -2,19 +2,9 @@ // ASWeakMapTests.m // Texture // -// Created by Chris Danford on 7/23/16. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Tests/ASWeakSetTests.m b/Tests/ASWeakSetTests.m index 59b3f577d9..6f64372e3d 100644 --- a/Tests/ASWeakSetTests.m +++ b/Tests/ASWeakSetTests.m @@ -2,19 +2,9 @@ // ASWeakSetTests.m // Texture // -// Created by Adlai Holler on 1/7/16. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Tests/ASWrapperSpecSnapshotTests.mm b/Tests/ASWrapperSpecSnapshotTests.mm index 5f8e0e88b9..91ddd45fe5 100644 --- a/Tests/ASWrapperSpecSnapshotTests.mm +++ b/Tests/ASWrapperSpecSnapshotTests.mm @@ -2,17 +2,9 @@ // ASWrapperSpecSnapshotTests.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // diff --git a/Tests/ArrayDiffingTests.m b/Tests/ArrayDiffingTests.m index 5d25bfde7e..45010ffc07 100644 --- a/Tests/ArrayDiffingTests.m +++ b/Tests/ArrayDiffingTests.m @@ -2,19 +2,9 @@ // ArrayDiffingTests.m // Texture // -// Created by Levi McCallum on 1/29/16. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import @@ -127,7 +117,8 @@ @[@0, @1, @2], ], ]; - + + long n = 0; for (NSArray *test in tests) { NSIndexSet *insertions, *deletions; [test[0] asdk_diffWithArray:test[1] insertions:&insertions deletions:&deletions]; @@ -135,17 +126,186 @@ NSMutableIndexSet *mutableDeletions = [deletions mutableCopy]; for (NSNumber *index in (NSArray *)test[2]) { - XCTAssert([mutableInsertions containsIndex:[index integerValue]]); + XCTAssert([mutableInsertions containsIndex:[index integerValue]], @"Test #%ld: insertions %@ does not contain %@", + n, insertions, index); [mutableInsertions removeIndex:[index integerValue]]; } for (NSNumber *index in (NSArray *)test[3]) { - XCTAssert([mutableDeletions containsIndex:[index integerValue]]); + XCTAssert([mutableDeletions containsIndex:[index integerValue]], @"Test #%ld: deletions %@ does not contain %@", + n, deletions, index + ); [mutableDeletions removeIndex:[index integerValue]]; } - XCTAssert([mutableInsertions count] == 0, @"Unaccounted insertions: %@", mutableInsertions); - XCTAssert([mutableDeletions count] == 0, @"Unaccounted deletions: %@", mutableDeletions); + XCTAssert([mutableInsertions count] == 0, @"Test #%ld: Unaccounted insertions: %@", n, mutableInsertions); + XCTAssert([mutableDeletions count] == 0, @"Test #%ld: Unaccounted deletions: %@", n, mutableDeletions); + n++; } } +- (void)testDiffingInsertsDeletesAndMoves +{ + NSArray *tests = @[ + @[ + @[@"a", @"b"], + @[@"b", @"a"], + @[], + @[], + @[[NSIndexPath indexPathWithIndexes:(NSUInteger[]) {1, 0} length:2], + [NSIndexPath indexPathWithIndexes:(NSUInteger[]) {0, 1} length:2] + ]], + @[ + @[@"bob", @"alice", @"dave"], + @[@"bob", @"alice", @"dave", @"gary"], + @[@3], + @[], + @[]], + @[ + @[@"a", @"b", @"c", @"d"], + @[@"d", @"c", @"b", @"a"], + @[], + @[], + @[[NSIndexPath indexPathWithIndexes:(NSUInteger[]){3, 0} length:2], + [NSIndexPath indexPathWithIndexes:(NSUInteger[]){2, 1} length:2], + [NSIndexPath indexPathWithIndexes:(NSUInteger[]){1, 2} length:2], + [NSIndexPath indexPathWithIndexes:(NSUInteger[]){0, 3} length:2] + ]], + @[ + @[@"bob", @"alice", @"dave"], + @[@"bob", @"gary", @"dave", @"alice"], + @[@1], + @[], + @[[NSIndexPath indexPathWithIndexes:(NSUInteger[]) {1, 3} length:2] + ]], + @[ + @[@"bob", @"alice", @"dave"], + @[@"bob", @"alice"], + @[], + @[@2], + @[]], + @[ + @[@"bob", @"alice", @"dave"], + @[], + @[], + @[@0, @1, @2], + @[]], + @[ + @[@"bob", @"alice", @"dave"], + @[@"gary", @"alice", @"dave", @"jack"], + @[@0, @3], + @[@0], + @[]], + @[ + @[@"bob", @"alice", @"dave", @"judy", @"lynda", @"tony"], + @[@"gary", @"bob", @"suzy", @"tony"], + @[@0, @2], + @[@1, @2, @3, @4], + @[[NSIndexPath indexPathWithIndexes:(NSUInteger[]){0, 1} length:2], + [NSIndexPath indexPathWithIndexes:(NSUInteger[]){5, 3} length:2] + ]], + @[ + @[@"bob", @"alice", @"dave", @"judy"], + @[@"judy", @"dave", @"alice", @"bob"], + @[], + @[], + @[[NSIndexPath indexPathWithIndexes:(NSUInteger[]){3, 0} length:2], + [NSIndexPath indexPathWithIndexes:(NSUInteger[]){2, 1} length:2], + [NSIndexPath indexPathWithIndexes:(NSUInteger[]){1, 2} length:2], + [NSIndexPath indexPathWithIndexes:(NSUInteger[]){0, 3} length:2] + ]] + + ]; + + long n = 0; + for (NSArray *test in tests) { + NSIndexSet *insertions, *deletions; + NSArray *moves; + [test[0] asdk_diffWithArray:test[1] insertions:&insertions deletions:&deletions moves:&moves]; + NSMutableIndexSet *mutableInsertions = [insertions mutableCopy]; + NSMutableIndexSet *mutableDeletions = [deletions mutableCopy]; + + for (NSNumber *index in (NSArray *) test[2]) { + XCTAssert([mutableInsertions containsIndex:[index integerValue]], @"Test #%ld, insertions does not contain %ld", + n, (long)[index integerValue]); + [mutableInsertions removeIndex:(NSUInteger) [index integerValue]]; + } + for (NSNumber *index in (NSArray *) test[3]) { + XCTAssert([mutableDeletions containsIndex:[index integerValue]], @"Test #%ld, deletions does not contain %ld", + n, (long)[index integerValue]); + [mutableDeletions removeIndex:(NSUInteger) [index integerValue]]; + } + + XCTAssert([mutableInsertions count] == 0, @"Test #%ld, Unaccounted insertions: %@", n, mutableInsertions); + XCTAssert([mutableDeletions count] == 0, @"Test #%ld, Unaccounted deletions: %@", n, mutableDeletions); + + XCTAssert([moves isEqual:test[4]], @"Test #%ld, %@ !isEqual: %@", n, moves, test[4]); + n++; + } +} + +- (void)testArrayDiffingRebuildingWithRandomElements +{ + NSArray *original = @[]; + NSArray *pending = @[]; + + NSIndexSet *insertions = nil; + NSIndexSet *deletions = nil; + NSArray *moves; + + for (int testNumber = 0; testNumber <= 25; testNumber++) { + int len = arc4random_uniform(10); + for (int j = 0; j < len; j++) { + original = [original arrayByAddingObject:@(arc4random_uniform(25))]; + } + len = arc4random_uniform(10); + for (int j = 0; j < len; j++) { + pending = [pending arrayByAddingObject:@(arc4random_uniform(25))]; + } + // Some sequences that presented issues in the past: + if (testNumber == 0) { + original = @[@20, @11, @14, @2, @14, @5, @4, @18, @0]; + pending = @[@9, @18, @18, @19, @20, @18, @22, @10, @3]; + } + if (testNumber == 1) { + original = @[@5, @9, @21, @11, @5, @9, @8]; + pending = @[@2, @12, @17, @19, @9, @1, @8, @5, @21]; + } + if (testNumber == 2) { + original = @[@14, @14, @12, @8, @20, @4, @0, @10]; + pending = @[@14]; + } + + [original asdk_diffWithArray:pending insertions:&insertions deletions:&deletions moves:&moves]; + + NSMutableArray *deletionsList = [NSMutableArray new]; + [deletions enumerateIndexesUsingBlock:^(NSUInteger idx, BOOL *stop) { + [deletionsList addObject:@(idx)]; + }]; + NSMutableArray *insertionsList = [NSMutableArray new]; + [insertions enumerateIndexesUsingBlock:^(NSUInteger idx, BOOL *stop) { + [insertionsList addObject:@(idx)]; + }]; + + NSUInteger i = 0; + NSUInteger j = 0; + NSMutableArray *test = [NSMutableArray new]; + for (NSUInteger count = 0; count < [pending count]; count++) { + if (i < [insertionsList count] && [insertionsList[i] unsignedIntegerValue] == count) { + [test addObject:pending[[insertionsList[i] unsignedIntegerValue]]]; + i++; + } else if (j < [moves count] && [moves[j] indexAtPosition:1] == count) { + [test addObject:original[[moves[j] indexAtPosition:0]]]; + j++; + } else { + [test addObject:original[count]]; + } + } + + XCTAssert([test isEqualToArray:pending], @"Did not mutate to expected new array:\n [%@] -> [%@], actual: [%@]\ninsertions: %@\nmoves: %@\ndeletions: %@", + [original componentsJoinedByString:@","], [pending componentsJoinedByString:@","], [test componentsJoinedByString:@","], + insertions, moves, deletions); + original = @[]; + pending = @[]; + } +} @end diff --git a/Tests/Common/ASDisplayNode+OCMock.m b/Tests/Common/ASDisplayNode+OCMock.m index 4fd0db028b..051ae9e807 100644 --- a/Tests/Common/ASDisplayNode+OCMock.m +++ b/Tests/Common/ASDisplayNode+OCMock.m @@ -2,12 +2,8 @@ // ASDisplayNode+OCMock.m // Texture // -// Copyright (c) 2017-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Tests/Common/ASTestCase.h b/Tests/Common/ASTestCase.h index bbcf073362..4e8850c247 100644 --- a/Tests/Common/ASTestCase.h +++ b/Tests/Common/ASTestCase.h @@ -2,17 +2,9 @@ // ASTestCase.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) through the present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Tests/Common/ASTestCase.m b/Tests/Common/ASTestCase.m index 9a2f7d1d71..7e9d20bf2f 100644 --- a/Tests/Common/ASTestCase.m +++ b/Tests/Common/ASTestCase.m @@ -2,17 +2,9 @@ // ASTestCase.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) through the present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ASTestCase.h" diff --git a/Tests/Common/ASXCTExtensions.h b/Tests/Common/ASXCTExtensions.h index 574b7a7175..2d882f922a 100644 --- a/Tests/Common/ASXCTExtensions.h +++ b/Tests/Common/ASXCTExtensions.h @@ -1,10 +1,10 @@ -/** - * XCTest extensions for CGGeometry. - * - * Prefer these to XCTAssert(CGRectEqualToRect(...)) because you get output - * that tells you what went wrong. - * Could use NSValue, but using strings makes the description messages shorter. - */ +// +// ASXCTExtensions.h +// Texture +// +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 +// #import diff --git a/Tests/Common/NSInvocation+ASTestHelpers.h b/Tests/Common/NSInvocation+ASTestHelpers.h index da64096e32..3248cdd283 100644 --- a/Tests/Common/NSInvocation+ASTestHelpers.h +++ b/Tests/Common/NSInvocation+ASTestHelpers.h @@ -2,12 +2,8 @@ // NSInvocation+ASTestHelpers.h // Texture // -// Copyright (c) 2017-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Tests/Common/NSInvocation+ASTestHelpers.m b/Tests/Common/NSInvocation+ASTestHelpers.m index d442a2011e..5fe505c1f7 100644 --- a/Tests/Common/NSInvocation+ASTestHelpers.m +++ b/Tests/Common/NSInvocation+ASTestHelpers.m @@ -2,12 +2,8 @@ // NSInvocation+ASTestHelpers.m // Texture // -// Copyright (c) 2017-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "NSInvocation+ASTestHelpers.h" diff --git a/Tests/Common/OCMockObject+ASAdditions.h b/Tests/Common/OCMockObject+ASAdditions.h index 49c3503060..2ad99e676e 100644 --- a/Tests/Common/OCMockObject+ASAdditions.h +++ b/Tests/Common/OCMockObject+ASAdditions.h @@ -2,12 +2,8 @@ // OCMockObject+ASAdditions.h // Texture // -// Copyright (c) 2017-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Tests/Common/OCMockObject+ASAdditions.m b/Tests/Common/OCMockObject+ASAdditions.m index 50fabd5eb6..3ed0930244 100644 --- a/Tests/Common/OCMockObject+ASAdditions.m +++ b/Tests/Common/OCMockObject+ASAdditions.m @@ -2,12 +2,8 @@ // OCMockObject+ASAdditions.m // Texture // -// Copyright (c) 2017-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "OCMockObject+ASAdditions.h" diff --git a/Tests/Common/debugbreak.h b/Tests/Common/debugbreak.h index 5405e40de7..96f1e9e59a 100644 --- a/Tests/Common/debugbreak.h +++ b/Tests/Common/debugbreak.h @@ -2,12 +2,8 @@ // debugbreak.h // Texture // -// Copyright (c) 2017-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // /* Copyright (c) 2011-2015, Scott Tsai diff --git a/Tests/ReferenceImages_64/ASTextNodeSnapshotTests/testFontPointSizeScaling@2x.png b/Tests/ReferenceImages_64/ASTextNodeSnapshotTests/testFontPointSizeScaling@2x.png new file mode 100644 index 0000000000..111bd50048 Binary files /dev/null and b/Tests/ReferenceImages_64/ASTextNodeSnapshotTests/testFontPointSizeScaling@2x.png differ diff --git a/Tests/ReferenceImages_iOS_10/ASTextNodeSnapshotTests/testFontPointSizeScaling@2x.png b/Tests/ReferenceImages_iOS_10/ASTextNodeSnapshotTests/testFontPointSizeScaling@2x.png new file mode 100644 index 0000000000..111bd50048 Binary files /dev/null and b/Tests/ReferenceImages_iOS_10/ASTextNodeSnapshotTests/testFontPointSizeScaling@2x.png differ diff --git a/Tests/TestHost/AppDelegate.h b/Tests/TestHost/AppDelegate.h index d9bc76ef51..1cdc488736 100644 --- a/Tests/TestHost/AppDelegate.h +++ b/Tests/TestHost/AppDelegate.h @@ -2,17 +2,9 @@ // AppDelegate.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Tests/TestHost/AppDelegate.m b/Tests/TestHost/AppDelegate.m index 51bf905c2f..bf5baf6f9e 100644 --- a/Tests/TestHost/AppDelegate.m +++ b/Tests/TestHost/AppDelegate.m @@ -1,18 +1,10 @@ // -// AppDelegate.mm +// AppDelegate.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "AppDelegate.h" diff --git a/Tests/TestHost/main.m b/Tests/TestHost/main.m index 27c659b765..65850400e4 100644 --- a/Tests/TestHost/main.m +++ b/Tests/TestHost/main.m @@ -2,17 +2,9 @@ // main.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/Texture.podspec b/Texture.podspec index 6b87ba1465..c64e8df22c 100644 --- a/Texture.podspec +++ b/Texture.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |spec| spec.name = 'Texture' spec.version = '2.7' - spec.license = { :type => 'BSD and Apache 2', } + spec.license = { :type => 'Apache 2', } spec.homepage = 'http://texturegroup.org' spec.authors = { 'Huy Nguyen' => 'huy@pinterest.com', 'Garrett Moon' => 'garrett@excitedpixel.com', 'Scott Goodson' => 'scottgoodson@gmail.com', 'Michael Schneider' => 'schneider@pinterest.com', 'Adlai Holler' => 'adlai@pinterest.com' } spec.summary = 'Smooth asynchronous user interfaces for iOS apps.' @@ -11,55 +11,72 @@ Pod::Spec.new do |spec| spec.documentation_url = 'http://texturegroup.org/appledoc/' - spec.ios.weak_frameworks = 'AssetsLibrary' - spec.weak_frameworks = 'Photos','MapKit' - spec.ios.deployment_target = '9.0' spec.tvos.deployment_target = '9.0' # Subspecs spec.subspec 'Core' do |core| + core.compiler_flags = '-fno-exceptions' core.public_header_files = [ - 'Source/*.h', - 'Source/Details/**/*.h', - 'Source/Layout/**/*.h', - 'Source/Base/*.h', - 'Source/Debug/**/*.h', - 'Source/TextKit/ASTextNodeTypes.h', - 'Source/TextKit/ASTextKitComponents.h' + 'Source/*.h', + 'Source/Details/**/*.h', + 'Source/Layout/**/*.h', + 'Source/Base/*.h', + 'Source/Debug/**/*.h', + 'Source/TextKit/ASTextNodeTypes.h', + 'Source/TextKit/ASTextKitComponents.h' ] core.source_files = [ - 'Source/**/*.{h,m,mm}', - 'Base/*.{h,m}', + 'Source/**/*.{h,m,mm}', + 'Base/*.{h,m}', - # Most TextKit components are not public because the C++ content - # in the headers will cause build errors when using - # `use_frameworks!` on 0.39.0 & Swift 2.1. - # See https://github.com/facebook/AsyncDisplayKit/issues/1153 - 'Source/TextKit/*.h', + # Most TextKit components are not public because the C++ content + # in the headers will cause build errors when using + # `use_frameworks!` on 0.39.0 & Swift 2.1. + # See https://github.com/facebook/AsyncDisplayKit/issues/1153 + 'Source/TextKit/*.h', ] end spec.subspec 'PINRemoteImage' do |pin| - pin.dependency 'PINRemoteImage/iOS', '= 3.0.0-beta.13' - pin.dependency 'PINRemoteImage/PINCache' - pin.dependency 'Texture/Core' + pin.dependency 'PINRemoteImage/iOS', '= 3.0.0-beta.13' + pin.dependency 'PINRemoteImage/PINCache' + pin.dependency 'Texture/Core' end spec.subspec 'IGListKit' do |igl| - igl.dependency 'IGListKit', '~> 3.0' - igl.dependency 'Texture/Core' + igl.dependency 'IGListKit', '~> 3.0' + igl.dependency 'Texture/Core' end spec.subspec 'Yoga' do |yoga| - yoga.xcconfig = { 'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) YOGA=1' } - yoga.dependency 'Yoga', '1.6.0' - yoga.dependency 'Texture/Core' + yoga.xcconfig = { 'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) YOGA=1' } + yoga.dependency 'Yoga', '1.6.0' + yoga.dependency 'Texture/Core' end - # Include optional PINRemoteImage module - spec.default_subspec = 'PINRemoteImage' + spec.subspec 'MapKit' do |map| + map.frameworks = 'MapKit' + map.xcconfig = { 'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) AS_USE_MAPKIT=1' } + map.dependency 'Texture/Core' + end + + spec.subspec 'Photos' do |photos| + photos.frameworks = 'Photos' + photos.xcconfig = { 'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) AS_USE_PHOTOS=1' } + photos.dependency 'Texture/Core' + end + + spec.subspec 'AssetsLibrary' do |assetslib| + assetslib.frameworks = 'AssetsLibrary' + assetslib.xcconfig = { 'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) AS_USE_ASSETS_LIBRARY=1' } + assetslib.dependency 'Texture/Core' + end + + # Include these by default for backwards compatibility. + # This will change in 3.0. + spec.default_subspecs = 'PINRemoteImage', 'MapKit', 'AssetsLibrary', 'Photos' spec.social_media_url = 'https://twitter.com/TextureiOS' spec.library = 'c++' diff --git a/docs/_data/nav_docs.yml b/docs/_data/nav_docs.yml index 91e76d3434..6b4b7b8072 100755 --- a/docs/_data/nav_docs.yml +++ b/docs/_data/nav_docs.yml @@ -44,7 +44,6 @@ - title: Advanced Technologies items: - asvisibility - - asenvironment - asrunloopqueue - title: Node Containers items: diff --git a/docs/_docs/asrunloopqueue.md b/docs/_docs/asrunloopqueue.md index cd2e978c22..f40f532ed8 100755 --- a/docs/_docs/asrunloopqueue.md +++ b/docs/_docs/asrunloopqueue.md @@ -2,7 +2,7 @@ title: ASRunLoopQueue layout: docs permalink: /docs/asrunloopqueue.html -prevPage: asenvironment.html +prevPage: asvisibility.html --- Even with main thread work, Texture is able to dramatically reduce its impact on the user experience by way of the rather amazing ASRunLoopQueue. diff --git a/docs/_docs/automatic-layout-basics.md b/docs/_docs/automatic-layout-basics.md index 8a830b1cd4..128a1040d4 100755 --- a/docs/_docs/automatic-layout-basics.md +++ b/docs/_docs/automatic-layout-basics.md @@ -6,7 +6,7 @@ prevPage: scroll-node.html nextPage: automatic-layout-containers.html --- -##Box Model Layout +## Box Model Layout ASLayout is an automatic, asynchronous, purely Objective-C box model layout feature. It is a simplified version of CSS flex box, loosely inspired by ComponentKit’s Layout. It is designed to make your layouts extensible and reusable. @@ -14,7 +14,7 @@ ASLayout is an automatic, asynchronous, purely Objective-C box model layout feat `` instances (all ASDisplayNodes and subclasses) do not have any size or position information. Instead, Texture calls the `layoutSpecThatFits:` method with a given size constraint and the component must return a structure describing both its size, and the position and sizes of its children. -##Terminology +## Terminology The terminology is a bit confusing, so here is a brief description of all of the Texture automatic layout players: @@ -30,7 +30,7 @@ Every ASLayoutSpec must act on at least one child. The ASLayoutSpec has the resp You don’t need to be aware of **`ASLayout`** except to know that it represents a computed immutable layout tree and is returned by objects conforming to the `` protocol. -##Layout for UIKit Components: +## Layout for UIKit Components: - for UIViews that are added directly, you will still need to manually lay it out in `didLoad:` - for UIViews that are added via `[ASDisplayNode initWithViewBlock:]` or its variants, you can then include it in `layoutSpecThatFits:` diff --git a/docs/_docs/automatic-layout-containers.md b/docs/_docs/automatic-layout-containers.md index 436d9c6efb..b612b37c78 100755 --- a/docs/_docs/automatic-layout-containers.md +++ b/docs/_docs/automatic-layout-containers.md @@ -10,13 +10,13 @@ Texture includes a library of `layoutSpec` components that can be composed to de The **child(ren) of a layoutSpec may be a node, a layoutSpec or a combination of the two types.** In the below image, an `ASStackLayoutSpec` (vertical) containing a text node and an image node, is wrapped in another `ASStackLayoutSpec` (horizontal) with another text node. - + Both nodes and layoutSpecs conform to the `` protocol. Any `ASLayoutable` object may be the child of a layoutSpec. ASLayoutable properties may be applied to `ASLayoutable` objects to create complex UI designs. ### Single Child layoutSpecs - +
@@ -39,10 +39,10 @@ Both nodes and layoutSpecs conform to the `` protocol. Any `ASLay - + - + @@ -70,7 +70,7 @@ The following layoutSpecs may contain one or more children.
LayoutSpec Description
ASRatioLayoutSpec

Lays out a component at a fixed aspect ratio (which can be scaled).

This spec is great for objects that do not have an intrinisic size, such as ASNetworkImageNodes and ASVideoNodes.

Lays out a component at a fixed aspect ratio (which can be scaled).

This spec is great for objects that do not have an intrinisic size, such as ASNetworkImageNodes and ASVideoNodes.

ASRelativeLayoutSpecASRelativeLayoutSpec

Lays out a component and positions it within the layout bounds according to vertical and horizontal positional specifiers. Similar to the “9-part” image areas, a child can be positioned at any of the 4 corners, or the middle of any of the 4 edges, as well as the center.

-# ASLayoutable Properties +### ASLayoutable Properties The following properties can be applied to both nodes _and_ `layoutSpec`s; both conform to the `ASLayoutable` protocol. @@ -184,7 +184,7 @@ An overlay spec requires the underlay object (object to which the overlay item w An inset spec requires its object to have an intrinsic size. It adds the inset padding to this size to calculate the final size of the inset spec. - + ### Best Practices - Texture layout is called on a background thread. Do not access the device screen bounds, or any other UIKit methods in `layoutSpecThatFits:`. diff --git a/docs/_docs/cell-node.md b/docs/_docs/cell-node.md index 10fa271cfe..60b1cfad3f 100755 --- a/docs/_docs/cell-node.md +++ b/docs/_docs/cell-node.md @@ -138,5 +138,5 @@ Using this option does not eliminate all of the performance advantages of Textur UITableViewCell has properties like selectionStyle, accessoryType and seperatorInset that many of us use sometimes to give the Cell more detail. For this case ASCellNode has the same (passthrough) properties that can be used.
-UIKits UITableViewCell contains ASCellNode as a subview. Depending how your ASLayoutSpec is defined it may occure that your Layout overlays the UITableViewCell.accessoryView and therefore not visible. Make sure that your Layout doesn't overlays any UITableViewCell's specific properties. +UIKits UITableViewCell contains ASCellNode as a subview. Depending how your ASLayoutSpec is defined it may occur that your Layout overlays the UITableViewCell.accessoryView and therefore is not visible. Make sure that your Layout doesn't overlay any of UITableViewCell's specific properties.
diff --git a/docs/_docs/containers-ascollectionnode.md b/docs/_docs/containers-ascollectionnode.md index e59771e61a..780e5c3ad9 100755 --- a/docs/_docs/containers-ascollectionnode.md +++ b/docs/_docs/containers-ascollectionnode.md @@ -204,7 +204,7 @@ As discussed in the previous section Right now, cells will grow to fit their constrained size and will be laid out by whatever `UICollectionViewLayout` you provide. -Soon, there will be a method such as `ASTableNode`'s `-constrainedSizeForRow:` but at the moment, if you'd like to constrain the size of a cell used in a collection node, you need to wrap your layoutSpec object in an `ASStaticLayoutSpec` and provide it with a +You can also constrain cells used in a collection node using `ASCollectionNode`'s `-constrainedSizeForItemAtIndexPath:`. ### Examples @@ -225,4 +225,4 @@ The most detailed example of laying out the cells of an `ASCollectionNode` is th Note that these UIKit cells will **not** have the performance benefits of `ASCellNodes` (like preloading, async layout, and async drawing), even when mixed within the same `ASCollectionNode`. -However, this interoperability allows developers the flexibility to test out the framework without needing to convert all of their cells at once. Read more here. \ No newline at end of file +However, this interoperability allows developers the flexibility to test out the framework without needing to convert all of their cells at once. Read more here. diff --git a/docs/_docs/containers-asviewcontroller.md b/docs/_docs/containers-asviewcontroller.md index f3a5d8e5d3..8b4fd3648d 100755 --- a/docs/_docs/containers-asviewcontroller.md +++ b/docs/_docs/containers-asviewcontroller.md @@ -62,6 +62,6 @@ init(models: [Model]) {
-Conversion Tip: If your app already has a complex view controller hierarchy, it is perfectly fine to have all of them subclass ASViewController. That is to say, even if you don't use ASViewController's designated initializer -initiWithNode:, and only use the ASViewController in the manner of a traditional UIViewController, this will give you the additional node support if you choose to adopt it in different areas your application. +Conversion Tip: If your app already has a complex view controller hierarchy, it is perfectly fine to have all of them subclass ASViewController. That is to say, even if you don't use ASViewController's designated initializer -initWithNode:, and only use the ASViewController in the manner of a traditional UIViewController, this will give you the additional node support if you choose to adopt it in different areas your application.
diff --git a/docs/_docs/corner-rounding.md b/docs/_docs/corner-rounding.md index a69f8fa6a2..1163ed3fe9 100755 --- a/docs/_docs/corner-rounding.md +++ b/docs/_docs/corner-rounding.md @@ -97,3 +97,130 @@ CALayer's `.shouldRasterize` is unrelated to Texture `node.shouldRasterizeDescen Use this flowchart to select the most performant strategy to round a set of corners. corner rounding strategy flowchart + +## Texture Support + +The following code exemplifies different ways how to archive corner rounding within Texture: + +### Use `.cornerRadius` + +
+SwiftObjective-C +
+
+CGFloat cornerRadius = 20.0;
+    
+_photoImageNode.cornerRoundingType = ASCornerRoundingTypeDefaultSlowCALayer;
+_photoImageNode.cornerRadius = cornerRadius;
+
+ +
+
+ + +### Use precomposition for rounding corners + +
+SwiftObjective-C +
+
+CGFloat cornerRadius = 20.0;
+    
+_photoImageNode.cornerRoundingType = ASCornerRoundingTypePrecomposited;
+_photoImageNode.cornerRadius = cornerRadius;
+
+ +
+
+ + +### Use clipping for rounding corners + +
+SwiftObjective-C +
+
+CGFloat cornerRadius = 20.0;
+
+_photoImageNode.cornerRoundingType = ASCornerRoundingTypeClipping;
+_photoImageNode.backgroundColor = [UIColor whiteColor];
+_photoImageNode.cornerRadius = cornerRadius;
+
+ +
+
+ + +### Use `willDisplayNodeContentWithRenderingContext` to set a clipping path for the content for rounding corners + +
+SwiftObjective-C +
+
+CGFloat cornerRadius = 20.0;
+    
+// Use the screen scale for corner radius to respect content scale
+CGFloat screenScale = UIScreen.mainScreen.scale;
+_photoImageNode.willDisplayNodeContentWithRenderingContext = ^(CGContextRef context, id drawParameters) {
+    CGRect bounds = CGContextGetClipBoundingBox(context);
+    CGFloat radius = cornerRadius * screenScale; 
+    UIImage *overlay = [UIImage as_resizableRoundedImageWithCornerRadius:radius
+                                                             cornerColor:[UIColor clearColor]
+                                                               fillColor:[UIColor clearColor]];
+    [overlay drawInRect:bounds];
+    [[UIBezierPath bezierPathWithRoundedRect:bounds cornerRadius:radius] addClip];
+};
+
+
+ +
+
+ +### Use `ASImageNode` extras to round the image and add a border. + +This is great for example to round avatar images. + +
+SwiftObjective-C +
+
+CGFloat cornerRadius = 20.0;
+
+_photoImageNode.imageModificationBlock = ASImageNodeRoundBorderModificationBlock(5.0, [UIColor orangeColor]);
+
+ +
+
diff --git a/docs/_docs/layout2-layout-element-properties.md b/docs/_docs/layout2-layout-element-properties.md index 21ed56b113..18735a8cdf 100755 --- a/docs/_docs/layout2-layout-element-properties.md +++ b/docs/_docs/layout2-layout-element-properties.md @@ -22,42 +22,42 @@ nextPage: layout2-api-sizing.html Description - `CGFloat .style.spacingBefore` + CGFloat .style.spacingBefore Additional space to place before this object in the stacking direction. - `CGFloat .style.spacingAfter` + CGFloat .style.spacingAfter Additional space to place after this object in the stacking direction. - `CGFloat .style.flexGrow` + CGFloat .style.flexGrow If the sum of childrens' stack dimensions is less than the minimum size, should this object grow? - `CGFloat .style.flexShrink` + CGFloat .style.flexShrink If the sum of childrens' stack dimensions is greater than the maximum size, should this object shrink? - `ASDimension .style.flexBasis` - Specifies the initial size for this object, in the stack dimension (horizontal or vertical), before the `flexGrow` / `flexShrink` properties are applied and the remaining space is distributed. + ASDimension .style.flexBasis + Specifies the initial size for this object, in the stack dimension (horizontal or vertical), before the flexGrow / flexShrink properties are applied and the remaining space is distributed. - `ASStackLayoutAlignSelf .style.alignSelf` + ASStackLayoutAlignSelf .style.alignSelf Orientation of the object along cross axis, overriding alignItems. Options include:
    -
  • `ASStackLayoutAlignSelfAuto`
  • -
  • `ASStackLayoutAlignSelfStart`
  • -
  • `ASStackLayoutAlignSelfEnd`
  • -
  • `ASStackLayoutAlignSelfCenter`
  • -
  • `ASStackLayoutAlignSelfStretch`
  • +
  • ASStackLayoutAlignSelfAuto
  • +
  • ASStackLayoutAlignSelfStart
  • +
  • ASStackLayoutAlignSelfEnd
  • +
  • ASStackLayoutAlignSelfCenter
  • +
  • ASStackLayoutAlignSelfStretch
- `CGFloat .style.ascender` + CGFloat .style.ascender Used for baseline alignment. The distance from the top of the object to its baseline. - `CGFloat .style.descender` + CGFloat .style.descender Used for baseline alignment. The distance from the baseline of the object to its bottom. @@ -75,8 +75,8 @@ nextPage: layout2-api-sizing.html Description - `CGPoint .style.layoutPosition` - The `CGPoint` position of this object within its `ASAbsoluteLayoutSpec` parent spec. + CGPoint .style.layoutPosition + The CGPoint position of this object within its ASAbsoluteLayoutSpec parent spec. @@ -92,55 +92,55 @@ nextPage: layout2-api-sizing.html Description - `ASDimension .style.width` - The `width` property specifies the width of the content area of an `ASLayoutElement`. The `minWidth` and `maxWidth` properties override `width`. Defaults to `ASDimensionAuto`. + ASDimension .style.width + The width property specifies the width of the content area of an ASLayoutElement. The minWidth and maxWidth properties override width. Defaults to ASDimensionAuto. - `ASDimension .style.height` - The `height` property specifies the height of the content area of an `ASLayoutElement`. The `minHeight` and `maxHeight` properties override `height`. Defaults to `ASDimensionAuto`. + ASDimension .style.height + The height property specifies the height of the content area of an ASLayoutElement. The minHeight and maxHeight properties override height. Defaults to ASDimensionAuto. - `ASDimension .style.minWidth` - The `minWidth` property is used to set the minimum width of a given element. It prevents the used value of the `width` property from becoming smaller than the value specified for `minWidth`. The value of `minWidth` overrides both `maxWidth` and `width`. Defaults to `ASDimensionAuto`. + ASDimension .style.minWidth + The minWidth property is used to set the minimum width of a given element. It prevents the used value of the width property from becoming smaller than the value specified for minWidth. The value of minWidth overrides both maxWidth and width. Defaults to ASDimensionAuto. - `ASDimension .style.maxWidth` - The `maxWidth` property is used to set the maximum width of a given element. It prevents the used value of the `width` property from becoming larger than the value specified for `maxWidth`. The value of `maxWidth` overrides `width`, but `minWidth` overrides `maxWidth`. Defaults to `ASDimensionAuto`. + ASDimension .style.maxWidth + The maxWidth property is used to set the maximum width of a given element. It prevents the used value of the width property from becoming larger than the value specified for maxWidth. The value of maxWidth overrides width, but minWidth overrides maxWidth. Defaults to ASDimensionAuto. - `ASDimension .style.minHeight` - The `minHeight` property is used to set the minimum height of a given element. It prevents the used value of the `height` property from becoming smaller than the value specified for `minHeight`. The value of `minHeight` overrides both `maxHeight` and `height`. Defaults to `ASDimensionAuto`. + ASDimension .style.minHeight + The minHeight property is used to set the minimum height of a given element. It prevents the used value of the height property from becoming smaller than the value specified for minHeight. The value of minHeight overrides both maxHeight and height. Defaults to ASDimensionAuto. - `ASDimension .style.maxHeight` - The `maxHeight` property is used to set the maximum height of a given element. It prevents the used value of the `height` property from becoming larger than the value specified for `maxHeight`. The value of `maxHeight` overrides `height`, but `minHeight` overrides `maxHeight`. Defaults to `ASDimensionAuto` + ASDimension .style.maxHeight + The maxHeight property is used to set the maximum height of a given element. It prevents the used value of the height property from becoming larger than the value specified for maxHeight. The value of maxHeight overrides height, but minHeight overrides maxHeight. Defaults to ASDimensionAuto - `CGSize .style.preferredSize` + CGSize .style.preferredSize

Provides a suggested size for a layout element. If the optional minSize or maxSize are provided, and the preferredSize exceeds these, the minSize or maxSize will be enforced. If this optional value is not provided, the layout element’s size will default to it’s intrinsic content size provided calculateSizeThatFits:

This method is optional, but one of either preferredSize or preferredLayoutSize is required for nodes that either have no intrinsic content size or should be laid out at a different size than its intrinsic content size. For example, this property could be set on an ASImageNode to display at a size different from the underlying image size.

Warning: calling the getter when the size's width or height are relative will cause an assert.

- `CGSize .style.minSize` + CGSize .style.minSize

An optional property that provides a minimum size bound for a layout element. If provided, this restriction will always be enforced. If a parent layout element’s minimum size is smaller than its child’s minimum size, the child’s minimum size will be enforced and its size will extend out of the layout spec’s.

For example, if you set a preferred relative width of 50% and a minimum width of 200 points on an element in a full screen container, this would result in a width of 160 points on an iPhone screen. However, since 160 pts is lower than the minimum width of 200 pts, the minimum width would be used.

- `CGSize .style.maxSize` + CGSize .style.maxSize

An optional property that provides a maximum size bound for a layout element. If provided, this restriction will always be enforced. If a child layout element’s maximum size is smaller than its parent, the child’s maximum size will be enforced and its size will extend out of the layout spec’s.

For example, if you set a preferred relative width of 50% and a maximum width of 120 points on an element in a full screen container, this would result in a width of 160 points on an iPhone screen. However, since 160 pts is higher than the maximum width of 120 pts, the maximum width would be used.

- `ASLayoutSize .style.preferredLayoutSize` - Provides a suggested RELATIVE size for a layout element. An ASLayoutSize uses percentages rather than points to specify layout. E.g. width should be 50% of the parent’s width. If the optional minLayoutSize or maxLayoutSize are provided, and the preferredLayoutSize exceeds these, the minLayoutSize or maxLayoutSize will be enforced. If this optional value is not provided, the layout element’s size will default to its intrinsic content size provided `calculateSizeThatFits:` + ASLayoutSize .style.preferredLayoutSize + Provides a suggested RELATIVE size for a layout element. An ASLayoutSize uses percentages rather than points to specify layout. E.g. width should be 50% of the parent’s width. If the optional minLayoutSize or maxLayoutSize are provided, and the preferredLayoutSize exceeds these, the minLayoutSize or maxLayoutSize will be enforced. If this optional value is not provided, the layout element’s size will default to its intrinsic content size provided calculateSizeThatFits: - `ASLayoutSize .style.minLayoutSize` + ASLayoutSize .style.minLayoutSize An optional property that provides a minimum RELATIVE size bound for a layout element. If provided, this restriction will always be enforced. If a parent layout element’s minimum relative size is smaller than its child’s minimum relative size, the child’s minimum relative size will be enforced and its size will extend out of the layout spec’s. - `ASLayoutSize .style.maxLayoutSize` + ASLayoutSize .style.maxLayoutSize An optional property that provides a maximum RELATIVE size bound for a layout element. If provided, this restriction will always be enforced. If a parent layout element’s maximum relative size is smaller than its child’s maximum relative size, the child’s maximum relative size will be enforced and its size will extend out of the layout spec’s. diff --git a/docs/_docs/layout2-layoutspec-types.md b/docs/_docs/layout2-layoutspec-types.md index f382df0d42..e0ce92fde5 100755 --- a/docs/_docs/layout2-layoutspec-types.md +++ b/docs/_docs/layout2-layoutspec-types.md @@ -19,6 +19,7 @@ The following `ASLayoutSpec` subclasses can be used to compose simple or very co
  • ASRelativeLayoutSpec
  • ASAbsoluteLayoutSpec
  • +
  • ASCornerLayoutSpec
  • You may also subclass `ASLayoutSpec` in order to make your own, custom layout specs. @@ -434,6 +435,48 @@ override func layoutSpecThatFits(_ constrainedSize: ASSizeRange) -> ASLayoutSpec +## ASCornerLayoutSpec +`ASCornerLayoutSpec` is a new convenient layout spec for fast corner element layout. The easy way to position an element in corner is to use declarative code expression rather than manual coordinate calculation, and ASCornerLayoutSpec can achieve this goal. + + + +`ASCornerLayoutSpec` takes good care of its own size calculation. The best scenario to explain this would be the case that adding a small badge view at the corner of user's avatar image and there is no need to worry about the fact that little-exceeded badge frame (which out of avatar image frame) may affect the whole layout size. By default, the size of corner element will not be added to layout size, only if you manually turn on the `wrapsCorner` property. + +`ASCornerLayoutSpec` is introduced from version 2.7 and above. + +
    + + Swift + Objective-C + + +
    +
    +- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize
    +{
    +  ...
    +  // Layout the center of badge to the top right corner of avatar.
    +  ASCornerLayoutSpec *cornerSpec = [ASCornerLayoutSpec cornerLayoutSpecWithChild:self.avatarNode corner:self.badgeNode location:ASCornerLayoutLocationTopRight];
    +  // Slightly shift center of badge inside of avatar.
    +  cornerSpec.offset = CGPointMake(-3, 3);
    +  ...
    +}
    +
    + + +
    +
    + ## ASLayoutSpec `ASLayoutSpec` is the main class from that all layout spec's are subclassed. It's main job is to handle all the children management, but it also can be used to create custom layout specs. Only the super advanced should want / need to create a custom subclasses of `ASLayoutSpec` though. Instead try to use provided layout specs and compose them together to create more advanced layouts. diff --git a/docs/_docs/node-overview.md b/docs/_docs/node-overview.md index 6f3b4ca1a7..c4f6d413cd 100755 --- a/docs/_docs/node-overview.md +++ b/docs/_docs/node-overview.md @@ -8,7 +8,7 @@ nextPage: subclassing.html Texture offers the following nodes. -A key advantage of using nodes over UIKit components is that **all nodes preform layout and display off of the main thread**, so that the main thread is available to immediately respond to user interaction events. +A key advantage of using nodes over UIKit components is that **all nodes perform layout and display off of the main thread**, so that the main thread is available to immediately respond to user interaction events. diff --git a/docs/_docs/team.md b/docs/_docs/team.md index 307b6a9047..e3a9643912 100755 --- a/docs/_docs/team.md +++ b/docs/_docs/team.md @@ -13,7 +13,7 @@ permalink: /docs/team.html - + diff --git a/docs/showcase.md b/docs/showcase.md index 1eaddbf0df..711a55406d 100755 --- a/docs/showcase.md +++ b/docs/showcase.md @@ -26,7 +26,7 @@ permalink: /showcase.html
    Pinterest
    - Re-architecting Pinterest's iOS app + Re-architecting Pinterest's iOS app + +

    Michael Schneider (@maicki) is especially passionate about API design and recently led the re-architecture of the layout API for the 2.0 release. As our resident layout expert, Michael volunteers much of his own time to help developers on Texture's public slack channel. Previous, Michael worked on Pocket for iOS, Mac and Chrome and the Instapaper Mac app.

    Michael Schneider (@maicki) is especially passionate about API design and recently led the re-architecture of the layout API for the 2.0 release. As our resident layout expert, Michael volunteers much of his own time to help developers on Texture's public slack channel. Before he joined Pinterest, Michael worked on Pocket for iOS, Mac and Chrome and Read Later an Instapaper and Pocket Mac app.

    @@ -256,6 +256,12 @@ permalink: /showcase.html
    Apollo for Reddit
    + +
    + Wishpoke +
    diff --git a/examples/ASCollectionView/Sample/AppDelegate.h b/examples/ASCollectionView/Sample/AppDelegate.h index b977c7498f..db20870a31 100644 --- a/examples/ASCollectionView/Sample/AppDelegate.h +++ b/examples/ASCollectionView/Sample/AppDelegate.h @@ -1,18 +1,10 @@ // // AppDelegate.h -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/ASCollectionView/Sample/AppDelegate.m b/examples/ASCollectionView/Sample/AppDelegate.m index 393711a864..ad36676ae0 100644 --- a/examples/ASCollectionView/Sample/AppDelegate.m +++ b/examples/ASCollectionView/Sample/AppDelegate.m @@ -1,18 +1,10 @@ // // AppDelegate.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "AppDelegate.h" diff --git a/examples/ASCollectionView/Sample/ItemNode.h b/examples/ASCollectionView/Sample/ItemNode.h index e50983f7e5..73eb2629e6 100644 --- a/examples/ASCollectionView/Sample/ItemNode.h +++ b/examples/ASCollectionView/Sample/ItemNode.h @@ -1,18 +1,10 @@ // // ItemNode.h -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/ASCollectionView/Sample/ItemNode.m b/examples/ASCollectionView/Sample/ItemNode.m index 2f61c4ff46..b9850a4b9e 100644 --- a/examples/ASCollectionView/Sample/ItemNode.m +++ b/examples/ASCollectionView/Sample/ItemNode.m @@ -1,18 +1,10 @@ // // ItemNode.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ItemNode.h" diff --git a/examples/ASCollectionView/Sample/PresentingViewController.h b/examples/ASCollectionView/Sample/PresentingViewController.h index f0c2a76e37..44c07c6a76 100644 --- a/examples/ASCollectionView/Sample/PresentingViewController.h +++ b/examples/ASCollectionView/Sample/PresentingViewController.h @@ -1,20 +1,10 @@ // // PresentingViewController.h -// Sample +// Texture // -// Created by Tom King on 12/23/15. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/ASCollectionView/Sample/PresentingViewController.m b/examples/ASCollectionView/Sample/PresentingViewController.m index 38a34fc357..b2d1d5e812 100644 --- a/examples/ASCollectionView/Sample/PresentingViewController.m +++ b/examples/ASCollectionView/Sample/PresentingViewController.m @@ -1,20 +1,10 @@ // // PresentingViewController.m -// Sample +// Texture // -// Created by Tom King on 12/23/15. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "PresentingViewController.h" diff --git a/examples/ASCollectionView/Sample/SupplementaryNode.h b/examples/ASCollectionView/Sample/SupplementaryNode.h index 906fc50bdc..b29ec002b2 100644 --- a/examples/ASCollectionView/Sample/SupplementaryNode.h +++ b/examples/ASCollectionView/Sample/SupplementaryNode.h @@ -1,18 +1,10 @@ // // SupplementaryNode.h -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/ASCollectionView/Sample/SupplementaryNode.m b/examples/ASCollectionView/Sample/SupplementaryNode.m index b1b1b905c9..f4847ff00b 100644 --- a/examples/ASCollectionView/Sample/SupplementaryNode.m +++ b/examples/ASCollectionView/Sample/SupplementaryNode.m @@ -1,18 +1,10 @@ // // SupplementaryNode.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "SupplementaryNode.h" diff --git a/examples/ASCollectionView/Sample/ViewController.h b/examples/ASCollectionView/Sample/ViewController.h index fc52c022f2..c8a0626291 100644 --- a/examples/ASCollectionView/Sample/ViewController.h +++ b/examples/ASCollectionView/Sample/ViewController.h @@ -1,18 +1,10 @@ // // ViewController.h -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/ASCollectionView/Sample/ViewController.m b/examples/ASCollectionView/Sample/ViewController.m index 10c974776f..687635ee68 100644 --- a/examples/ASCollectionView/Sample/ViewController.m +++ b/examples/ASCollectionView/Sample/ViewController.m @@ -2,17 +2,9 @@ // ViewController.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ViewController.h" diff --git a/examples/ASCollectionView/Sample/main.m b/examples/ASCollectionView/Sample/main.m index d5794dca4c..65850400e4 100644 --- a/examples/ASCollectionView/Sample/main.m +++ b/examples/ASCollectionView/Sample/main.m @@ -1,18 +1,10 @@ // // main.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/ASDKLayoutTransition/Sample/AppDelegate.h b/examples/ASDKLayoutTransition/Sample/AppDelegate.h index 27e560aafe..19db03c153 100644 --- a/examples/ASDKLayoutTransition/Sample/AppDelegate.h +++ b/examples/ASDKLayoutTransition/Sample/AppDelegate.h @@ -1,18 +1,10 @@ // // AppDelegate.h -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/ASDKLayoutTransition/Sample/AppDelegate.m b/examples/ASDKLayoutTransition/Sample/AppDelegate.m index c62355c06c..d0fd66f775 100644 --- a/examples/ASDKLayoutTransition/Sample/AppDelegate.m +++ b/examples/ASDKLayoutTransition/Sample/AppDelegate.m @@ -1,18 +1,10 @@ // // AppDelegate.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "AppDelegate.h" diff --git a/examples/ASDKLayoutTransition/Sample/ViewController.h b/examples/ASDKLayoutTransition/Sample/ViewController.h index fc52c022f2..c8a0626291 100644 --- a/examples/ASDKLayoutTransition/Sample/ViewController.h +++ b/examples/ASDKLayoutTransition/Sample/ViewController.h @@ -1,18 +1,10 @@ // // ViewController.h -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/ASDKLayoutTransition/Sample/ViewController.m b/examples/ASDKLayoutTransition/Sample/ViewController.m index dd8d375d13..e5d019b1d1 100644 --- a/examples/ASDKLayoutTransition/Sample/ViewController.m +++ b/examples/ASDKLayoutTransition/Sample/ViewController.m @@ -1,18 +1,10 @@ // // ViewController.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ViewController.h" diff --git a/examples/ASDKLayoutTransition/Sample/main.m b/examples/ASDKLayoutTransition/Sample/main.m index 756080fb2b..511cd1a7ac 100644 --- a/examples/ASDKLayoutTransition/Sample/main.m +++ b/examples/ASDKLayoutTransition/Sample/main.m @@ -1,18 +1,10 @@ // // main.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/ASDKTube/Sample/AppDelegate.h b/examples/ASDKTube/Sample/AppDelegate.h index 27e560aafe..19db03c153 100644 --- a/examples/ASDKTube/Sample/AppDelegate.h +++ b/examples/ASDKTube/Sample/AppDelegate.h @@ -1,18 +1,10 @@ // // AppDelegate.h -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/ASDKTube/Sample/AppDelegate.m b/examples/ASDKTube/Sample/AppDelegate.m index 738b215110..9ceabb213e 100644 --- a/examples/ASDKTube/Sample/AppDelegate.m +++ b/examples/ASDKTube/Sample/AppDelegate.m @@ -1,18 +1,10 @@ // // AppDelegate.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "AppDelegate.h" diff --git a/examples/ASDKTube/Sample/Controller/VideoFeedNodeController.h b/examples/ASDKTube/Sample/Controller/VideoFeedNodeController.h index 3ac85916a1..131bb38ef7 100644 --- a/examples/ASDKTube/Sample/Controller/VideoFeedNodeController.h +++ b/examples/ASDKTube/Sample/Controller/VideoFeedNodeController.h @@ -1,20 +1,10 @@ // // VideoFeedNodeController.h -// Sample +// Texture // -// Created by Erekle on 5/15/16. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/ASDKTube/Sample/Controller/VideoFeedNodeController.m b/examples/ASDKTube/Sample/Controller/VideoFeedNodeController.m index af5770f5c2..b6e53ba7a5 100644 --- a/examples/ASDKTube/Sample/Controller/VideoFeedNodeController.m +++ b/examples/ASDKTube/Sample/Controller/VideoFeedNodeController.m @@ -1,20 +1,10 @@ // // VideoFeedNodeController.m -// Sample +// Texture // -// Created by Erekle on 5/15/16. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "VideoFeedNodeController.h" diff --git a/examples/ASDKTube/Sample/Models/Utilities.h b/examples/ASDKTube/Sample/Models/Utilities.h index 9bcb5deee1..4fd689f18b 100644 --- a/examples/ASDKTube/Sample/Models/Utilities.h +++ b/examples/ASDKTube/Sample/Models/Utilities.h @@ -1,20 +1,10 @@ // // Utilities.h -// Sample +// Texture // -// Created by Hannah Troisi on 3/9/16. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #include @interface UIColor (Additions) @@ -48,4 +38,4 @@ color:(UIColor *)color firstWordColor:(UIColor *)firstWordColor; -@end \ No newline at end of file +@end diff --git a/examples/ASDKTube/Sample/Models/Utilities.m b/examples/ASDKTube/Sample/Models/Utilities.m index e28bf22736..c9998154c8 100644 --- a/examples/ASDKTube/Sample/Models/Utilities.m +++ b/examples/ASDKTube/Sample/Models/Utilities.m @@ -1,20 +1,10 @@ // // Utilities.m -// Sample +// Texture // -// Created by Hannah Troisi on 3/9/16. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "Utilities.h" diff --git a/examples/ASDKTube/Sample/Models/VideoModel.h b/examples/ASDKTube/Sample/Models/VideoModel.h index 11efb81ef2..c912ab45fe 100644 --- a/examples/ASDKTube/Sample/Models/VideoModel.h +++ b/examples/ASDKTube/Sample/Models/VideoModel.h @@ -1,20 +1,10 @@ // // VideoModel.h -// Sample +// Texture // -// Created by Erekle on 5/14/16. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/ASDKTube/Sample/Models/VideoModel.m b/examples/ASDKTube/Sample/Models/VideoModel.m index ee82898cbd..46cd7f3da1 100644 --- a/examples/ASDKTube/Sample/Models/VideoModel.m +++ b/examples/ASDKTube/Sample/Models/VideoModel.m @@ -1,20 +1,10 @@ // // VideoModel.m -// Sample +// Texture // -// Created by Erekle on 5/14/16. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "VideoModel.h" diff --git a/examples/ASDKTube/Sample/Nodes/VideoContentCell.h b/examples/ASDKTube/Sample/Nodes/VideoContentCell.h index 598f8f9950..2a386f9241 100644 --- a/examples/ASDKTube/Sample/Nodes/VideoContentCell.h +++ b/examples/ASDKTube/Sample/Nodes/VideoContentCell.h @@ -1,20 +1,10 @@ // // VideoContentCell.h -// Sample +// Texture // -// Created by Erekle on 5/14/16. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/ASDKTube/Sample/Nodes/VideoContentCell.m b/examples/ASDKTube/Sample/Nodes/VideoContentCell.m index dac4ce77ce..fac4e389db 100644 --- a/examples/ASDKTube/Sample/Nodes/VideoContentCell.m +++ b/examples/ASDKTube/Sample/Nodes/VideoContentCell.m @@ -1,20 +1,10 @@ // // VideoContentCell.m -// Sample +// Texture // -// Created by Erekle on 5/14/16. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "VideoContentCell.h" diff --git a/examples/ASDKTube/Sample/ViewController.h b/examples/ASDKTube/Sample/ViewController.h index db689fe324..560b6a2d03 100644 --- a/examples/ASDKTube/Sample/ViewController.h +++ b/examples/ASDKTube/Sample/ViewController.h @@ -1,18 +1,10 @@ // // ViewController.h -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/ASDKTube/Sample/ViewController.m b/examples/ASDKTube/Sample/ViewController.m index 9cd1e72d98..0fe3274501 100644 --- a/examples/ASDKTube/Sample/ViewController.m +++ b/examples/ASDKTube/Sample/ViewController.m @@ -1,18 +1,10 @@ // // ViewController.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ViewController.h" diff --git a/examples/ASDKTube/Sample/WindowWithStatusBarUnderlay.h b/examples/ASDKTube/Sample/WindowWithStatusBarUnderlay.h index 51c3bc26ef..025f3ba4fe 100644 --- a/examples/ASDKTube/Sample/WindowWithStatusBarUnderlay.h +++ b/examples/ASDKTube/Sample/WindowWithStatusBarUnderlay.h @@ -1,20 +1,10 @@ // // WindowWithStatusBarUnderlay.h -// Sample +// Texture // -// Created by Hannah Troisi on 4/10/16. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/ASDKTube/Sample/WindowWithStatusBarUnderlay.m b/examples/ASDKTube/Sample/WindowWithStatusBarUnderlay.m index d153a30cea..944e5307b5 100644 --- a/examples/ASDKTube/Sample/WindowWithStatusBarUnderlay.m +++ b/examples/ASDKTube/Sample/WindowWithStatusBarUnderlay.m @@ -1,20 +1,10 @@ // // WindowWithStatusBarUnderlay.m -// Sample +// Texture // -// Created by Erekle on 5/15/16. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "WindowWithStatusBarUnderlay.h" diff --git a/examples/ASDKTube/Sample/main.m b/examples/ASDKTube/Sample/main.m index 756080fb2b..511cd1a7ac 100644 --- a/examples/ASDKTube/Sample/main.m +++ b/examples/ASDKTube/Sample/main.m @@ -1,18 +1,10 @@ // // main.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/ASDKgram/Sample.xcodeproj/project.pbxproj b/examples/ASDKgram/Sample.xcodeproj/project.pbxproj index abafabf31f..08713d5b1b 100644 --- a/examples/ASDKgram/Sample.xcodeproj/project.pbxproj +++ b/examples/ASDKgram/Sample.xcodeproj/project.pbxproj @@ -278,8 +278,6 @@ 05E2127D19D4DB510098F589 /* Sources */, 05E2127E19D4DB510098F589 /* Frameworks */, 05E2127F19D4DB510098F589 /* Resources */, - F012A6F39E0149F18F564F50 /* [CP] Copy Pods Resources */, - 06770D39D4186D6446B1BDD5 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -338,21 +336,6 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 06770D39D4186D6446B1BDD5 /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "[CP] Embed Pods Frameworks"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Sample/Pods-Sample-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; E080B80F89C34A25B3488E26 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -368,22 +351,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; - showEnvVarsInLog = 0; - }; - F012A6F39E0149F18F564F50 /* [CP] Copy Pods Resources */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "[CP] Copy Pods Resources"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Sample/Pods-Sample-resources.sh\"\n"; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; /* End PBXShellScriptBuildPhase section */ diff --git a/examples/ASDKgram/Sample.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/examples/ASDKgram/Sample.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000000..18d981003d --- /dev/null +++ b/examples/ASDKgram/Sample.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/examples/ASDKgram/Sample/ASCollectionSectionController.h b/examples/ASDKgram/Sample/ASCollectionSectionController.h index f69791bc76..1a3a8443c9 100644 --- a/examples/ASDKgram/Sample/ASCollectionSectionController.h +++ b/examples/ASDKgram/Sample/ASCollectionSectionController.h @@ -1,9 +1,9 @@ // // ASCollectionSectionController.h -// Sample +// Texture // -// Created by Adlai Holler on 12/29/16. -// Copyright © 2016 Facebook. All rights reserved. +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/ASDKgram/Sample/ASCollectionSectionController.m b/examples/ASDKgram/Sample/ASCollectionSectionController.m index 2e5b657773..c1ddb42d41 100644 --- a/examples/ASDKgram/Sample/ASCollectionSectionController.m +++ b/examples/ASDKgram/Sample/ASCollectionSectionController.m @@ -1,9 +1,9 @@ // // ASCollectionSectionController.m -// Sample +// Texture // -// Created by Adlai Holler on 12/29/16. -// Copyright © 2016 Facebook. All rights reserved. +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ASCollectionSectionController.h" diff --git a/examples/ASDKgram/Sample/AppDelegate.h b/examples/ASDKgram/Sample/AppDelegate.h index f5a8485f9b..169cc651b5 100644 --- a/examples/ASDKgram/Sample/AppDelegate.h +++ b/examples/ASDKgram/Sample/AppDelegate.h @@ -1,20 +1,10 @@ // // AppDelegate.h -// Sample +// Texture // -// Created by Hannah Troisi on 2/16/16. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // @interface AppDelegate : UIResponder diff --git a/examples/ASDKgram/Sample/AppDelegate.m b/examples/ASDKgram/Sample/AppDelegate.m index e1dd507baa..019c6a71b2 100644 --- a/examples/ASDKgram/Sample/AppDelegate.m +++ b/examples/ASDKgram/Sample/AppDelegate.m @@ -2,17 +2,9 @@ // AppDelegate.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) through the present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "AppDelegate.h" diff --git a/examples/ASDKgram/Sample/FeedHeaderNode.h b/examples/ASDKgram/Sample/FeedHeaderNode.h index b440a05f52..13e6b16d6f 100644 --- a/examples/ASDKgram/Sample/FeedHeaderNode.h +++ b/examples/ASDKgram/Sample/FeedHeaderNode.h @@ -1,9 +1,9 @@ // // FeedHeaderNode.h -// Sample +// Texture // -// Created by Adlai Holler on 1/23/17. -// Copyright © 2017 Facebook. All rights reserved. +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/ASDKgram/Sample/FeedHeaderNode.m b/examples/ASDKgram/Sample/FeedHeaderNode.m index e0c8798aa2..f620fa5087 100644 --- a/examples/ASDKgram/Sample/FeedHeaderNode.m +++ b/examples/ASDKgram/Sample/FeedHeaderNode.m @@ -1,9 +1,9 @@ // // FeedHeaderNode.m -// Sample +// Texture // -// Created by Adlai Holler on 1/23/17. -// Copyright © 2017 Facebook. All rights reserved. +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "FeedHeaderNode.h" diff --git a/examples/ASDKgram/Sample/ImageURLModel.h b/examples/ASDKgram/Sample/ImageURLModel.h index 88381fde8f..16828a2dac 100644 --- a/examples/ASDKgram/Sample/ImageURLModel.h +++ b/examples/ASDKgram/Sample/ImageURLModel.h @@ -1,20 +1,10 @@ // // ImageURLModel.h -// Sample +// Texture // -// Created by Hannah Troisi on 3/11/16. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // @interface ImageURLModel : NSObject diff --git a/examples/ASDKgram/Sample/ImageURLModel.m b/examples/ASDKgram/Sample/ImageURLModel.m index 78c4b43714..671027db5e 100644 --- a/examples/ASDKgram/Sample/ImageURLModel.m +++ b/examples/ASDKgram/Sample/ImageURLModel.m @@ -1,20 +1,10 @@ // // ImageURLModel.m -// Sample +// Texture // -// Created by Hannah Troisi on 3/11/16. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ImageURLModel.h" diff --git a/examples/ASDKgram/Sample/PhotoCellNode.h b/examples/ASDKgram/Sample/PhotoCellNode.h index b3135a1529..7724970252 100644 --- a/examples/ASDKgram/Sample/PhotoCellNode.h +++ b/examples/ASDKgram/Sample/PhotoCellNode.h @@ -2,17 +2,9 @@ // PhotoCellNode.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) through the present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "PhotoModel.h" diff --git a/examples/ASDKgram/Sample/PhotoCellNode.m b/examples/ASDKgram/Sample/PhotoCellNode.m index a7bb214d21..b020db9e64 100644 --- a/examples/ASDKgram/Sample/PhotoCellNode.m +++ b/examples/ASDKgram/Sample/PhotoCellNode.m @@ -2,17 +2,9 @@ // PhotoCellNode.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) through the present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "PhotoCellNode.h" diff --git a/examples/ASDKgram/Sample/PhotoCollectionViewCell.h b/examples/ASDKgram/Sample/PhotoCollectionViewCell.h index 717f575609..d277b5a571 100644 --- a/examples/ASDKgram/Sample/PhotoCollectionViewCell.h +++ b/examples/ASDKgram/Sample/PhotoCollectionViewCell.h @@ -1,20 +1,10 @@ // // PhotoCollectionViewCell.h -// Sample +// Texture // -// Created by Hannah Troisi on 3/2/16. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "PhotoModel.h" diff --git a/examples/ASDKgram/Sample/PhotoCollectionViewCell.m b/examples/ASDKgram/Sample/PhotoCollectionViewCell.m index 3f9dfe8d27..d04fe1ca5d 100644 --- a/examples/ASDKgram/Sample/PhotoCollectionViewCell.m +++ b/examples/ASDKgram/Sample/PhotoCollectionViewCell.m @@ -1,20 +1,10 @@ // // PhotoCollectionViewCell.m -// Sample +// Texture // -// Created by Hannah Troisi on 3/2/16. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "PhotoCollectionViewCell.h" diff --git a/examples/ASDKgram/Sample/PhotoFeedBaseController.h b/examples/ASDKgram/Sample/PhotoFeedBaseController.h index 649494c915..b40a5946c8 100644 --- a/examples/ASDKgram/Sample/PhotoFeedBaseController.h +++ b/examples/ASDKgram/Sample/PhotoFeedBaseController.h @@ -2,17 +2,9 @@ // PhotoFeedBaseController.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) through the present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/ASDKgram/Sample/PhotoFeedBaseController.m b/examples/ASDKgram/Sample/PhotoFeedBaseController.m index d4fd574fbb..473f2fc2e3 100644 --- a/examples/ASDKgram/Sample/PhotoFeedBaseController.m +++ b/examples/ASDKgram/Sample/PhotoFeedBaseController.m @@ -2,17 +2,9 @@ // PhotoFeedBaseController.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) through the present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "PhotoFeedBaseController.h" diff --git a/examples/ASDKgram/Sample/PhotoFeedControllerProtocol.h b/examples/ASDKgram/Sample/PhotoFeedControllerProtocol.h index e7c5be3689..df5832939b 100644 --- a/examples/ASDKgram/Sample/PhotoFeedControllerProtocol.h +++ b/examples/ASDKgram/Sample/PhotoFeedControllerProtocol.h @@ -1,9 +1,9 @@ // // PhotoFeedControllerProtocol.h -// Sample +// Texture // -// Created by Michael Schneider on 2/12/17. -// Copyright © 2017 Facebook. All rights reserved. +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/ASDKgram/Sample/PhotoFeedListKitViewController.h b/examples/ASDKgram/Sample/PhotoFeedListKitViewController.h index 0720363a4c..a1e3e6a338 100644 --- a/examples/ASDKgram/Sample/PhotoFeedListKitViewController.h +++ b/examples/ASDKgram/Sample/PhotoFeedListKitViewController.h @@ -1,9 +1,9 @@ // // PhotoFeedListKitViewController.h -// Sample +// Texture // -// Created by Adlai Holler on 12/29/16. -// Copyright © 2016 Facebook. All rights reserved. +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/ASDKgram/Sample/PhotoFeedListKitViewController.m b/examples/ASDKgram/Sample/PhotoFeedListKitViewController.m index f01f8c8eea..950458e197 100644 --- a/examples/ASDKgram/Sample/PhotoFeedListKitViewController.m +++ b/examples/ASDKgram/Sample/PhotoFeedListKitViewController.m @@ -1,9 +1,9 @@ // // PhotoFeedListKitViewController.m -// Sample +// Texture // -// Created by Adlai Holler on 12/29/16. -// Copyright © 2016 Facebook. All rights reserved. +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "PhotoFeedListKitViewController.h" diff --git a/examples/ASDKgram/Sample/PhotoFeedModel.h b/examples/ASDKgram/Sample/PhotoFeedModel.h index 97591bf79e..a71b830b37 100644 --- a/examples/ASDKgram/Sample/PhotoFeedModel.h +++ b/examples/ASDKgram/Sample/PhotoFeedModel.h @@ -2,17 +2,9 @@ // PhotoFeedModel.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) through the present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "PhotoModel.h" diff --git a/examples/ASDKgram/Sample/PhotoFeedModel.m b/examples/ASDKgram/Sample/PhotoFeedModel.m index 8f7eef961e..6548f9d373 100644 --- a/examples/ASDKgram/Sample/PhotoFeedModel.m +++ b/examples/ASDKgram/Sample/PhotoFeedModel.m @@ -2,17 +2,9 @@ // PhotoFeedModel.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "PhotoFeedModel.h" diff --git a/examples/ASDKgram/Sample/PhotoFeedNodeController.h b/examples/ASDKgram/Sample/PhotoFeedNodeController.h index c97576b7bc..e4b8553c08 100644 --- a/examples/ASDKgram/Sample/PhotoFeedNodeController.h +++ b/examples/ASDKgram/Sample/PhotoFeedNodeController.h @@ -1,20 +1,10 @@ // // PhotoFeedNodeController.h -// Sample +// Texture // -// Created by Hannah Troisi on 2/17/16. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "PhotoFeedBaseController.h" diff --git a/examples/ASDKgram/Sample/PhotoFeedNodeController.m b/examples/ASDKgram/Sample/PhotoFeedNodeController.m index 9eac3e5f72..8abc80bb53 100644 --- a/examples/ASDKgram/Sample/PhotoFeedNodeController.m +++ b/examples/ASDKgram/Sample/PhotoFeedNodeController.m @@ -1,20 +1,10 @@ // // PhotoFeedNodeController.m -// Sample +// Texture // -// Created by Hannah Troisi on 2/17/16. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "PhotoFeedNodeController.h" diff --git a/examples/ASDKgram/Sample/PhotoFeedSectionController.h b/examples/ASDKgram/Sample/PhotoFeedSectionController.h index 0da1836a68..f7d820d6e5 100644 --- a/examples/ASDKgram/Sample/PhotoFeedSectionController.h +++ b/examples/ASDKgram/Sample/PhotoFeedSectionController.h @@ -1,9 +1,9 @@ // // PhotoFeedSectionController.h -// Sample +// Texture // -// Created by Adlai Holler on 12/29/16. -// Copyright © 2016 Facebook. All rights reserved. +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/ASDKgram/Sample/PhotoFeedSectionController.m b/examples/ASDKgram/Sample/PhotoFeedSectionController.m index 190a817853..b621b02525 100644 --- a/examples/ASDKgram/Sample/PhotoFeedSectionController.m +++ b/examples/ASDKgram/Sample/PhotoFeedSectionController.m @@ -1,9 +1,9 @@ // // PhotoFeedSectionController.m -// Sample +// Texture // -// Created by Adlai Holler on 12/29/16. -// Copyright © 2016 Facebook. All rights reserved. +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "PhotoFeedSectionController.h" diff --git a/examples/ASDKgram/Sample/PhotoFeedViewController.h b/examples/ASDKgram/Sample/PhotoFeedViewController.h index 3733fde82b..14295d0bbc 100644 --- a/examples/ASDKgram/Sample/PhotoFeedViewController.h +++ b/examples/ASDKgram/Sample/PhotoFeedViewController.h @@ -1,20 +1,10 @@ // // PhotoFeedViewController.h -// Sample +// Texture // -// Created by Hannah Troisi on 2/17/16. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "PhotoFeedBaseController.h" diff --git a/examples/ASDKgram/Sample/PhotoFeedViewController.m b/examples/ASDKgram/Sample/PhotoFeedViewController.m index 5f78eb1bfb..c3f9a4aefe 100644 --- a/examples/ASDKgram/Sample/PhotoFeedViewController.m +++ b/examples/ASDKgram/Sample/PhotoFeedViewController.m @@ -2,17 +2,9 @@ // PhotoFeedViewController.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) through the present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "PhotoFeedViewController.h" diff --git a/examples/ASDKgram/Sample/PhotoModel.h b/examples/ASDKgram/Sample/PhotoModel.h index bc5950437f..95c1a8130c 100644 --- a/examples/ASDKgram/Sample/PhotoModel.h +++ b/examples/ASDKgram/Sample/PhotoModel.h @@ -2,17 +2,9 @@ // PhotoModel.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) through the present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "UserModel.h" diff --git a/examples/ASDKgram/Sample/PhotoModel.m b/examples/ASDKgram/Sample/PhotoModel.m index b1c39f5083..0662e71ae5 100644 --- a/examples/ASDKgram/Sample/PhotoModel.m +++ b/examples/ASDKgram/Sample/PhotoModel.m @@ -2,17 +2,9 @@ // PhotoModel.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) through the present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "PhotoModel.h" diff --git a/examples/ASDKgram/Sample/PhotoTableViewCell.h b/examples/ASDKgram/Sample/PhotoTableViewCell.h index 5e0620f2e2..47e8e913f7 100644 --- a/examples/ASDKgram/Sample/PhotoTableViewCell.h +++ b/examples/ASDKgram/Sample/PhotoTableViewCell.h @@ -2,17 +2,9 @@ // PhotoTableViewCell.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) through the present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "PhotoModel.h" diff --git a/examples/ASDKgram/Sample/PhotoTableViewCell.m b/examples/ASDKgram/Sample/PhotoTableViewCell.m index 3fea610f01..9cc5fa785b 100644 --- a/examples/ASDKgram/Sample/PhotoTableViewCell.m +++ b/examples/ASDKgram/Sample/PhotoTableViewCell.m @@ -2,17 +2,9 @@ // PhotoTableViewCell.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) through the present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "PhotoTableViewCell.h" diff --git a/examples/ASDKgram/Sample/RefreshingSectionControllerType.h b/examples/ASDKgram/Sample/RefreshingSectionControllerType.h index 892a3a32ce..169a996012 100644 --- a/examples/ASDKgram/Sample/RefreshingSectionControllerType.h +++ b/examples/ASDKgram/Sample/RefreshingSectionControllerType.h @@ -1,9 +1,9 @@ // // RefreshingSectionControllerType.h -// Sample +// Texture // -// Created by Adlai Holler on 12/29/16. -// Copyright © 2016 Facebook. All rights reserved. +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/ASDKgram/Sample/TailLoadingNode.h b/examples/ASDKgram/Sample/TailLoadingNode.h index 177a938e10..ae514231f6 100644 --- a/examples/ASDKgram/Sample/TailLoadingNode.h +++ b/examples/ASDKgram/Sample/TailLoadingNode.h @@ -1,9 +1,9 @@ // // TailLoadingNode.h -// Sample +// Texture // -// Created by Adlai Holler on 1/3/17. -// Copyright © 2017 Facebook. All rights reserved. +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/ASDKgram/Sample/TailLoadingNode.m b/examples/ASDKgram/Sample/TailLoadingNode.m index 9f096db706..9211ac4c13 100644 --- a/examples/ASDKgram/Sample/TailLoadingNode.m +++ b/examples/ASDKgram/Sample/TailLoadingNode.m @@ -1,9 +1,9 @@ // // TailLoadingNode.m -// Sample +// Texture // -// Created by Adlai Holler on 1/3/17. -// Copyright © 2017 Facebook. All rights reserved. +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "TailLoadingNode.h" diff --git a/examples/ASDKgram/Sample/TextureConfigDelegate.m b/examples/ASDKgram/Sample/TextureConfigDelegate.m index 0905a646ef..b6a2ae9717 100644 --- a/examples/ASDKgram/Sample/TextureConfigDelegate.m +++ b/examples/ASDKgram/Sample/TextureConfigDelegate.m @@ -2,12 +2,8 @@ // TextureConfigDelegate.m // Texture // -// Copyright (c) 2018-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/ASDKgram/Sample/UserModel.h b/examples/ASDKgram/Sample/UserModel.h index 5b57c13e14..299ddb1869 100644 --- a/examples/ASDKgram/Sample/UserModel.h +++ b/examples/ASDKgram/Sample/UserModel.h @@ -2,17 +2,9 @@ // UserModel.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) through the present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // @interface UserModel : NSObject diff --git a/examples/ASDKgram/Sample/UserModel.m b/examples/ASDKgram/Sample/UserModel.m index e428ad3c22..53e3626026 100644 --- a/examples/ASDKgram/Sample/UserModel.m +++ b/examples/ASDKgram/Sample/UserModel.m @@ -2,17 +2,9 @@ // UserModel.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) through the present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "UserModel.h" diff --git a/examples/ASDKgram/Sample/Utilities.h b/examples/ASDKgram/Sample/Utilities.h index 7e9e16cd08..63f2ab0553 100644 --- a/examples/ASDKgram/Sample/Utilities.h +++ b/examples/ASDKgram/Sample/Utilities.h @@ -1,20 +1,10 @@ // // Utilities.h -// Sample +// Texture // -// Created by Hannah Troisi on 3/9/16. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // @interface UIColor (Additions) @@ -47,4 +37,4 @@ color:(UIColor *)color firstWordColor:(UIColor *)firstWordColor; -@end \ No newline at end of file +@end diff --git a/examples/ASDKgram/Sample/Utilities.m b/examples/ASDKgram/Sample/Utilities.m index 556a3a2d2c..732c5f8171 100644 --- a/examples/ASDKgram/Sample/Utilities.m +++ b/examples/ASDKgram/Sample/Utilities.m @@ -1,20 +1,10 @@ // // Utilities.m -// Sample +// Texture // -// Created by Hannah Troisi on 3/9/16. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "Utilities.h" diff --git a/examples/ASDKgram/Sample/WindowWithStatusBarUnderlay.h b/examples/ASDKgram/Sample/WindowWithStatusBarUnderlay.h index b12509a43b..d9fb31778d 100644 --- a/examples/ASDKgram/Sample/WindowWithStatusBarUnderlay.h +++ b/examples/ASDKgram/Sample/WindowWithStatusBarUnderlay.h @@ -1,20 +1,10 @@ // // WindowWithStatusBarUnderlay.h -// Sample +// Texture // -// Created by Hannah Troisi on 4/10/16. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // diff --git a/examples/ASDKgram/Sample/WindowWithStatusBarUnderlay.m b/examples/ASDKgram/Sample/WindowWithStatusBarUnderlay.m index c98fcf4d0e..91670c2985 100644 --- a/examples/ASDKgram/Sample/WindowWithStatusBarUnderlay.m +++ b/examples/ASDKgram/Sample/WindowWithStatusBarUnderlay.m @@ -1,20 +1,10 @@ // // WindowWithStatusBarUnderlay.m -// Sample +// Texture // -// Created by Hannah Troisi on 4/10/16. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "WindowWithStatusBarUnderlay.h" diff --git a/examples/ASDKgram/Sample/main.m b/examples/ASDKgram/Sample/main.m index 89f1d26c20..fb6be69952 100644 --- a/examples/ASDKgram/Sample/main.m +++ b/examples/ASDKgram/Sample/main.m @@ -1,20 +1,10 @@ // // main.m -// Sample +// Texture // -// Created by Hannah Troisi on 2/16/16. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "AppDelegate.h" diff --git a/examples/ASMapNode/Sample/AppDelegate.h b/examples/ASMapNode/Sample/AppDelegate.h index 4591d34854..8d58a13cbe 100644 --- a/examples/ASMapNode/Sample/AppDelegate.h +++ b/examples/ASMapNode/Sample/AppDelegate.h @@ -1,18 +1,10 @@ // // AppDelegate.h -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/ASMapNode/Sample/AppDelegate.m b/examples/ASMapNode/Sample/AppDelegate.m index 7cf75f8bb7..cae730c64e 100644 --- a/examples/ASMapNode/Sample/AppDelegate.m +++ b/examples/ASMapNode/Sample/AppDelegate.m @@ -1,18 +1,10 @@ // // AppDelegate.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "AppDelegate.h" diff --git a/examples/ASMapNode/Sample/CustomMapAnnotation.h b/examples/ASMapNode/Sample/CustomMapAnnotation.h index d94f0153f4..22e62ab7e4 100644 --- a/examples/ASMapNode/Sample/CustomMapAnnotation.h +++ b/examples/ASMapNode/Sample/CustomMapAnnotation.h @@ -1,18 +1,10 @@ // // CustomMapAnnotation.h -// ASDKMapTest +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/ASMapNode/Sample/CustomMapAnnotation.m b/examples/ASMapNode/Sample/CustomMapAnnotation.m index a5da10ac94..c6843dcc3c 100644 --- a/examples/ASMapNode/Sample/CustomMapAnnotation.m +++ b/examples/ASMapNode/Sample/CustomMapAnnotation.m @@ -1,18 +1,10 @@ // // CustomMapAnnotation.m -// ASDKMapTest +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "CustomMapAnnotation.h" diff --git a/examples/ASMapNode/Sample/MapHandlerNode.h b/examples/ASMapNode/Sample/MapHandlerNode.h index 29c77c7131..46a4d74686 100644 --- a/examples/ASMapNode/Sample/MapHandlerNode.h +++ b/examples/ASMapNode/Sample/MapHandlerNode.h @@ -2,17 +2,9 @@ // MapHandlerNode.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/ASMapNode/Sample/MapHandlerNode.m b/examples/ASMapNode/Sample/MapHandlerNode.m index 0f6f4a0e27..9226253a10 100644 --- a/examples/ASMapNode/Sample/MapHandlerNode.m +++ b/examples/ASMapNode/Sample/MapHandlerNode.m @@ -2,17 +2,9 @@ // MapHandlerNode.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "MapHandlerNode.h" diff --git a/examples/ASMapNode/Sample/ViewController.h b/examples/ASMapNode/Sample/ViewController.h index c2a4b5f166..7054e2d89c 100644 --- a/examples/ASMapNode/Sample/ViewController.h +++ b/examples/ASMapNode/Sample/ViewController.h @@ -1,18 +1,10 @@ // // ViewController.h -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/ASMapNode/Sample/ViewController.m b/examples/ASMapNode/Sample/ViewController.m index 4dc690ae34..390532d662 100644 --- a/examples/ASMapNode/Sample/ViewController.m +++ b/examples/ASMapNode/Sample/ViewController.m @@ -1,18 +1,10 @@ // // ViewController.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ViewController.h" diff --git a/examples/ASMapNode/Sample/main.m b/examples/ASMapNode/Sample/main.m index 791ef4b743..0e5da05001 100644 --- a/examples/ASMapNode/Sample/main.m +++ b/examples/ASMapNode/Sample/main.m @@ -1,18 +1,10 @@ // // main.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/ASViewController/Sample/AppDelegate.h b/examples/ASViewController/Sample/AppDelegate.h index 4591d34854..8d58a13cbe 100644 --- a/examples/ASViewController/Sample/AppDelegate.h +++ b/examples/ASViewController/Sample/AppDelegate.h @@ -1,18 +1,10 @@ // // AppDelegate.h -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/ASViewController/Sample/AppDelegate.m b/examples/ASViewController/Sample/AppDelegate.m index 8e3f33a9dc..ed2724b182 100644 --- a/examples/ASViewController/Sample/AppDelegate.m +++ b/examples/ASViewController/Sample/AppDelegate.m @@ -1,18 +1,10 @@ // // AppDelegate.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "AppDelegate.h" diff --git a/examples/ASViewController/Sample/DetailCellNode.h b/examples/ASViewController/Sample/DetailCellNode.h index e80b6dc6cb..d524ff1c02 100644 --- a/examples/ASViewController/Sample/DetailCellNode.h +++ b/examples/ASViewController/Sample/DetailCellNode.h @@ -1,18 +1,10 @@ // // DetailCellNode.h -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/ASViewController/Sample/DetailCellNode.m b/examples/ASViewController/Sample/DetailCellNode.m index d069f75c18..edc9932076 100644 --- a/examples/ASViewController/Sample/DetailCellNode.m +++ b/examples/ASViewController/Sample/DetailCellNode.m @@ -1,18 +1,10 @@ // // DetailCellNode.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "DetailCellNode.h" diff --git a/examples/ASViewController/Sample/DetailRootNode.h b/examples/ASViewController/Sample/DetailRootNode.h index a60ce8007b..648900b30e 100644 --- a/examples/ASViewController/Sample/DetailRootNode.h +++ b/examples/ASViewController/Sample/DetailRootNode.h @@ -1,18 +1,10 @@ // // DetailRootNode.h -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/ASViewController/Sample/DetailRootNode.m b/examples/ASViewController/Sample/DetailRootNode.m index 333af36e6c..5d478059d9 100644 --- a/examples/ASViewController/Sample/DetailRootNode.m +++ b/examples/ASViewController/Sample/DetailRootNode.m @@ -1,18 +1,10 @@ // // DetailRootNode.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "DetailRootNode.h" diff --git a/examples/ASViewController/Sample/DetailViewController.h b/examples/ASViewController/Sample/DetailViewController.h index f11bfaf42c..0c5eb85891 100644 --- a/examples/ASViewController/Sample/DetailViewController.h +++ b/examples/ASViewController/Sample/DetailViewController.h @@ -1,18 +1,10 @@ // // DetailViewController.h -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/ASViewController/Sample/DetailViewController.m b/examples/ASViewController/Sample/DetailViewController.m index 494efd4ffd..2d6471cd5d 100644 --- a/examples/ASViewController/Sample/DetailViewController.m +++ b/examples/ASViewController/Sample/DetailViewController.m @@ -1,18 +1,10 @@ // // DetailViewController.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "DetailViewController.h" diff --git a/examples/ASViewController/Sample/ViewController.h b/examples/ASViewController/Sample/ViewController.h index 9ece2de58d..f1700621f0 100644 --- a/examples/ASViewController/Sample/ViewController.h +++ b/examples/ASViewController/Sample/ViewController.h @@ -1,18 +1,10 @@ // // ViewController.h -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/ASViewController/Sample/ViewController.m b/examples/ASViewController/Sample/ViewController.m index 9e70c99c54..f66c7add93 100644 --- a/examples/ASViewController/Sample/ViewController.m +++ b/examples/ASViewController/Sample/ViewController.m @@ -1,18 +1,10 @@ // // ViewController.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ViewController.h" diff --git a/examples/ASViewController/Sample/main.m b/examples/ASViewController/Sample/main.m index 791ef4b743..0e5da05001 100644 --- a/examples/ASViewController/Sample/main.m +++ b/examples/ASViewController/Sample/main.m @@ -1,18 +1,10 @@ // // main.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/AnimatedGIF/ASAnimatedImage/AppDelegate.h b/examples/AnimatedGIF/ASAnimatedImage/AppDelegate.h index b7889999d5..8d58a13cbe 100644 --- a/examples/AnimatedGIF/ASAnimatedImage/AppDelegate.h +++ b/examples/AnimatedGIF/ASAnimatedImage/AppDelegate.h @@ -1,20 +1,10 @@ // // AppDelegate.h -// Sample +// Texture // -// Created by Garrett Moon on 3/22/16. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/AnimatedGIF/ASAnimatedImage/AppDelegate.m b/examples/AnimatedGIF/ASAnimatedImage/AppDelegate.m index ae73c318d9..a21b00ffd1 100644 --- a/examples/AnimatedGIF/ASAnimatedImage/AppDelegate.m +++ b/examples/AnimatedGIF/ASAnimatedImage/AppDelegate.m @@ -1,20 +1,10 @@ // // AppDelegate.m -// Sample +// Texture // -// Created by Garrett Moon on 3/22/16. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "AppDelegate.h" diff --git a/examples/AnimatedGIF/ASAnimatedImage/ViewController.h b/examples/AnimatedGIF/ASAnimatedImage/ViewController.h index 73a4c39a3d..4627e29285 100644 --- a/examples/AnimatedGIF/ASAnimatedImage/ViewController.h +++ b/examples/AnimatedGIF/ASAnimatedImage/ViewController.h @@ -1,20 +1,10 @@ // // ViewController.h -// Sample +// Texture // -// Created by Garrett Moon on 3/22/16. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/AnimatedGIF/ASAnimatedImage/ViewController.m b/examples/AnimatedGIF/ASAnimatedImage/ViewController.m index fe9b30bb33..6fd98321db 100644 --- a/examples/AnimatedGIF/ASAnimatedImage/ViewController.m +++ b/examples/AnimatedGIF/ASAnimatedImage/ViewController.m @@ -2,17 +2,9 @@ // ViewController.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ViewController.h" diff --git a/examples/AnimatedGIF/ASAnimatedImage/main.m b/examples/AnimatedGIF/ASAnimatedImage/main.m index a07ed9d945..65850400e4 100644 --- a/examples/AnimatedGIF/ASAnimatedImage/main.m +++ b/examples/AnimatedGIF/ASAnimatedImage/main.m @@ -1,20 +1,10 @@ // // main.m -// Sample +// Texture // -// Created by Garrett Moon on 3/22/16. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/AsyncDisplayKitOverview/Sample/AppDelegate.h b/examples/AsyncDisplayKitOverview/Sample/AppDelegate.h index c77e4095e2..8d58a13cbe 100644 --- a/examples/AsyncDisplayKitOverview/Sample/AppDelegate.h +++ b/examples/AsyncDisplayKitOverview/Sample/AppDelegate.h @@ -1,20 +1,10 @@ // // AppDelegate.h -// Sample +// Texture // -// Created by Michael Schneider on 4/24/16. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/AsyncDisplayKitOverview/Sample/AppDelegate.m b/examples/AsyncDisplayKitOverview/Sample/AppDelegate.m index ae97a27ae5..8221f4c755 100644 --- a/examples/AsyncDisplayKitOverview/Sample/AppDelegate.m +++ b/examples/AsyncDisplayKitOverview/Sample/AppDelegate.m @@ -1,20 +1,10 @@ // // AppDelegate.m -// Sample +// Texture // -// Created by Michael Schneider on 4/24/16. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "AppDelegate.h" diff --git a/examples/AsyncDisplayKitOverview/Sample/Node Containers/OverviewASCollectionNode.h b/examples/AsyncDisplayKitOverview/Sample/Node Containers/OverviewASCollectionNode.h index 6be9dfaa7a..8fc32e4e43 100644 --- a/examples/AsyncDisplayKitOverview/Sample/Node Containers/OverviewASCollectionNode.h +++ b/examples/AsyncDisplayKitOverview/Sample/Node Containers/OverviewASCollectionNode.h @@ -1,20 +1,9 @@ // // OverviewASCollectionNode.h -// Sample +// Texture // -// Created by Michael Schneider on 4/17/16. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/AsyncDisplayKitOverview/Sample/Node Containers/OverviewASCollectionNode.m b/examples/AsyncDisplayKitOverview/Sample/Node Containers/OverviewASCollectionNode.m index 78c8615ede..5d29eea95e 100644 --- a/examples/AsyncDisplayKitOverview/Sample/Node Containers/OverviewASCollectionNode.m +++ b/examples/AsyncDisplayKitOverview/Sample/Node Containers/OverviewASCollectionNode.m @@ -1,20 +1,9 @@ // // OverviewASCollectionNode.m -// Sample +// Texture // -// Created by Michael Schneider on 4/17/16. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "OverviewASCollectionNode.h" diff --git a/examples/AsyncDisplayKitOverview/Sample/Node Containers/OverviewASPagerNode.h b/examples/AsyncDisplayKitOverview/Sample/Node Containers/OverviewASPagerNode.h index 824d1fb5c0..dd6d09d014 100644 --- a/examples/AsyncDisplayKitOverview/Sample/Node Containers/OverviewASPagerNode.h +++ b/examples/AsyncDisplayKitOverview/Sample/Node Containers/OverviewASPagerNode.h @@ -1,20 +1,9 @@ // // OverviewASPagerNode.h -// Sample +// Texture // -// Created by Michael Schneider on 4/17/16. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/AsyncDisplayKitOverview/Sample/Node Containers/OverviewASPagerNode.m b/examples/AsyncDisplayKitOverview/Sample/Node Containers/OverviewASPagerNode.m index ac91a7a3d0..7e37448497 100644 --- a/examples/AsyncDisplayKitOverview/Sample/Node Containers/OverviewASPagerNode.m +++ b/examples/AsyncDisplayKitOverview/Sample/Node Containers/OverviewASPagerNode.m @@ -1,20 +1,9 @@ // // OverviewASPagerNode.m -// Sample +// Texture // -// Created by Michael Schneider on 4/17/16. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "OverviewASPagerNode.h" diff --git a/examples/AsyncDisplayKitOverview/Sample/Node Containers/OverviewASTableNode.h b/examples/AsyncDisplayKitOverview/Sample/Node Containers/OverviewASTableNode.h index c2ba8e5323..f80af0d2c9 100644 --- a/examples/AsyncDisplayKitOverview/Sample/Node Containers/OverviewASTableNode.h +++ b/examples/AsyncDisplayKitOverview/Sample/Node Containers/OverviewASTableNode.h @@ -1,20 +1,9 @@ // // OverviewASTableNode.h -// Sample +// Texture // -// Created by Michael Schneider on 4/17/16. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/AsyncDisplayKitOverview/Sample/Node Containers/OverviewASTableNode.m b/examples/AsyncDisplayKitOverview/Sample/Node Containers/OverviewASTableNode.m index 1a94fdbf84..de050c3694 100644 --- a/examples/AsyncDisplayKitOverview/Sample/Node Containers/OverviewASTableNode.m +++ b/examples/AsyncDisplayKitOverview/Sample/Node Containers/OverviewASTableNode.m @@ -1,20 +1,9 @@ // // OverviewASTableNode.m -// Sample +// Texture // -// Created by Michael Schneider on 4/17/16. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "OverviewASTableNode.h" diff --git a/examples/AsyncDisplayKitOverview/Sample/OverviewComponentsViewController.h b/examples/AsyncDisplayKitOverview/Sample/OverviewComponentsViewController.h index 9e838b4fba..cae34ad209 100644 --- a/examples/AsyncDisplayKitOverview/Sample/OverviewComponentsViewController.h +++ b/examples/AsyncDisplayKitOverview/Sample/OverviewComponentsViewController.h @@ -1,20 +1,10 @@ // // OverviewComponentsViewController.h -// Sample +// Texture // -// Created by Michael Schneider on 4/15/16. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/AsyncDisplayKitOverview/Sample/OverviewComponentsViewController.m b/examples/AsyncDisplayKitOverview/Sample/OverviewComponentsViewController.m index c49f64cca2..740d975d2a 100644 --- a/examples/AsyncDisplayKitOverview/Sample/OverviewComponentsViewController.m +++ b/examples/AsyncDisplayKitOverview/Sample/OverviewComponentsViewController.m @@ -1,20 +1,10 @@ // // OverviewComponentsViewController.m -// Sample +// Texture // -// Created by Michael Schneider on 4/15/16. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "OverviewComponentsViewController.h" diff --git a/examples/AsyncDisplayKitOverview/Sample/OverviewDetailViewController.h b/examples/AsyncDisplayKitOverview/Sample/OverviewDetailViewController.h index b3fae243c5..8a006b4428 100644 --- a/examples/AsyncDisplayKitOverview/Sample/OverviewDetailViewController.h +++ b/examples/AsyncDisplayKitOverview/Sample/OverviewDetailViewController.h @@ -1,20 +1,10 @@ // // OverviewDetailViewController.h -// Sample +// Texture // -// Created by Michael Schneider on 4/15/16. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/AsyncDisplayKitOverview/Sample/OverviewDetailViewController.m b/examples/AsyncDisplayKitOverview/Sample/OverviewDetailViewController.m index af2a39cb6b..b81b307921 100644 --- a/examples/AsyncDisplayKitOverview/Sample/OverviewDetailViewController.m +++ b/examples/AsyncDisplayKitOverview/Sample/OverviewDetailViewController.m @@ -1,20 +1,10 @@ // // OverviewDetailViewController.m -// Sample +// Texture // -// Created by Michael Schneider on 4/15/16. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "OverviewDetailViewController.h" diff --git a/examples/AsyncDisplayKitOverview/Sample/main.m b/examples/AsyncDisplayKitOverview/Sample/main.m index 63beb381e8..0e5da05001 100644 --- a/examples/AsyncDisplayKitOverview/Sample/main.m +++ b/examples/AsyncDisplayKitOverview/Sample/main.m @@ -1,20 +1,10 @@ // // main.m -// Sample +// Texture // -// Created by Michael Schneider on 4/24/16. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/CatDealsCollectionView/Sample/AppDelegate.h b/examples/CatDealsCollectionView/Sample/AppDelegate.h index b977c7498f..db20870a31 100644 --- a/examples/CatDealsCollectionView/Sample/AppDelegate.h +++ b/examples/CatDealsCollectionView/Sample/AppDelegate.h @@ -1,18 +1,10 @@ // // AppDelegate.h -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/CatDealsCollectionView/Sample/AppDelegate.m b/examples/CatDealsCollectionView/Sample/AppDelegate.m index b30facbbb5..447ff93b88 100644 --- a/examples/CatDealsCollectionView/Sample/AppDelegate.m +++ b/examples/CatDealsCollectionView/Sample/AppDelegate.m @@ -2,17 +2,9 @@ // AppDelegate.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) through the present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "AppDelegate.h" @@ -55,14 +47,3 @@ } @end - -@implementation ASConfiguration (UserProvided) - -+ (ASConfiguration *)textureConfiguration -{ - ASConfiguration *cfg = [[ASConfiguration alloc] init]; - cfg.experimentalFeatures = ASExperimentalDeallocQueue; - return cfg; -} - -@end diff --git a/examples/CatDealsCollectionView/Sample/BlurbNode.h b/examples/CatDealsCollectionView/Sample/BlurbNode.h index e40f99d8a6..5451fb39f0 100644 --- a/examples/CatDealsCollectionView/Sample/BlurbNode.h +++ b/examples/CatDealsCollectionView/Sample/BlurbNode.h @@ -2,17 +2,9 @@ // BlurbNode.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) through the present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/CatDealsCollectionView/Sample/BlurbNode.m b/examples/CatDealsCollectionView/Sample/BlurbNode.m index 0b358273c0..9c72b6d573 100644 --- a/examples/CatDealsCollectionView/Sample/BlurbNode.m +++ b/examples/CatDealsCollectionView/Sample/BlurbNode.m @@ -2,17 +2,9 @@ // BlurbNode.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) through the present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "BlurbNode.h" diff --git a/examples/CatDealsCollectionView/Sample/ItemNode.h b/examples/CatDealsCollectionView/Sample/ItemNode.h index bb0f06857d..19bfec29cc 100644 --- a/examples/CatDealsCollectionView/Sample/ItemNode.h +++ b/examples/CatDealsCollectionView/Sample/ItemNode.h @@ -2,17 +2,9 @@ // ItemNode.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/CatDealsCollectionView/Sample/ItemNode.m b/examples/CatDealsCollectionView/Sample/ItemNode.m index 4fd76e8a01..f118c282a2 100644 --- a/examples/CatDealsCollectionView/Sample/ItemNode.m +++ b/examples/CatDealsCollectionView/Sample/ItemNode.m @@ -2,17 +2,9 @@ // ItemNode.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ItemNode.h" diff --git a/examples/CatDealsCollectionView/Sample/ItemStyles.h b/examples/CatDealsCollectionView/Sample/ItemStyles.h index 09d3b81c88..db4d0d08d5 100644 --- a/examples/CatDealsCollectionView/Sample/ItemStyles.h +++ b/examples/CatDealsCollectionView/Sample/ItemStyles.h @@ -2,17 +2,9 @@ // ItemStyles.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) through the present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/CatDealsCollectionView/Sample/ItemStyles.m b/examples/CatDealsCollectionView/Sample/ItemStyles.m index 690980d49c..1659341161 100644 --- a/examples/CatDealsCollectionView/Sample/ItemStyles.m +++ b/examples/CatDealsCollectionView/Sample/ItemStyles.m @@ -2,17 +2,9 @@ // ItemStyles.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) through the present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ItemStyles.h" diff --git a/examples/CatDealsCollectionView/Sample/ItemViewModel.h b/examples/CatDealsCollectionView/Sample/ItemViewModel.h index 621b4060a9..489a10515b 100644 --- a/examples/CatDealsCollectionView/Sample/ItemViewModel.h +++ b/examples/CatDealsCollectionView/Sample/ItemViewModel.h @@ -2,17 +2,9 @@ // ItemViewModel.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/CatDealsCollectionView/Sample/ItemViewModel.m b/examples/CatDealsCollectionView/Sample/ItemViewModel.m index 6206e399c2..8f60900c60 100644 --- a/examples/CatDealsCollectionView/Sample/ItemViewModel.m +++ b/examples/CatDealsCollectionView/Sample/ItemViewModel.m @@ -2,17 +2,9 @@ // ItemViewModel.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ItemViewModel.h" diff --git a/examples/CatDealsCollectionView/Sample/LoadingNode.h b/examples/CatDealsCollectionView/Sample/LoadingNode.h index 6c07157265..996a6798cf 100644 --- a/examples/CatDealsCollectionView/Sample/LoadingNode.h +++ b/examples/CatDealsCollectionView/Sample/LoadingNode.h @@ -2,17 +2,9 @@ // LoadingNode.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) through the present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/CatDealsCollectionView/Sample/LoadingNode.m b/examples/CatDealsCollectionView/Sample/LoadingNode.m index 03a6825c65..18681c011c 100644 --- a/examples/CatDealsCollectionView/Sample/LoadingNode.m +++ b/examples/CatDealsCollectionView/Sample/LoadingNode.m @@ -2,17 +2,9 @@ // LoadingNode.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) through the present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "LoadingNode.h" diff --git a/examples/CatDealsCollectionView/Sample/PlaceholderNetworkImageNode.h b/examples/CatDealsCollectionView/Sample/PlaceholderNetworkImageNode.h index 31470610bd..a18e17c9ea 100644 --- a/examples/CatDealsCollectionView/Sample/PlaceholderNetworkImageNode.h +++ b/examples/CatDealsCollectionView/Sample/PlaceholderNetworkImageNode.h @@ -2,17 +2,9 @@ // PlaceholderNetworkImageNode.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) through the present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/CatDealsCollectionView/Sample/PlaceholderNetworkImageNode.m b/examples/CatDealsCollectionView/Sample/PlaceholderNetworkImageNode.m index e7f0de47f9..81129392a9 100644 --- a/examples/CatDealsCollectionView/Sample/PlaceholderNetworkImageNode.m +++ b/examples/CatDealsCollectionView/Sample/PlaceholderNetworkImageNode.m @@ -2,17 +2,9 @@ // PlaceholderNetworkImageNode.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) through the present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "PlaceholderNetworkImageNode.h" diff --git a/examples/CatDealsCollectionView/Sample/PresentingViewController.h b/examples/CatDealsCollectionView/Sample/PresentingViewController.h index f0c2a76e37..44c07c6a76 100644 --- a/examples/CatDealsCollectionView/Sample/PresentingViewController.h +++ b/examples/CatDealsCollectionView/Sample/PresentingViewController.h @@ -1,20 +1,10 @@ // // PresentingViewController.h -// Sample +// Texture // -// Created by Tom King on 12/23/15. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/CatDealsCollectionView/Sample/PresentingViewController.m b/examples/CatDealsCollectionView/Sample/PresentingViewController.m index 53f297f9e3..216cf4dd28 100644 --- a/examples/CatDealsCollectionView/Sample/PresentingViewController.m +++ b/examples/CatDealsCollectionView/Sample/PresentingViewController.m @@ -1,20 +1,10 @@ // // PresentingViewController.m -// Sample +// Texture // -// Created by Tom King on 12/23/15. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "PresentingViewController.h" diff --git a/examples/CatDealsCollectionView/Sample/ViewController.h b/examples/CatDealsCollectionView/Sample/ViewController.h index db689fe324..560b6a2d03 100644 --- a/examples/CatDealsCollectionView/Sample/ViewController.h +++ b/examples/CatDealsCollectionView/Sample/ViewController.h @@ -1,18 +1,10 @@ // // ViewController.h -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/CatDealsCollectionView/Sample/ViewController.m b/examples/CatDealsCollectionView/Sample/ViewController.m index 78b58d67a6..c1f9111ad0 100644 --- a/examples/CatDealsCollectionView/Sample/ViewController.m +++ b/examples/CatDealsCollectionView/Sample/ViewController.m @@ -2,17 +2,9 @@ // ViewController.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ViewController.h" diff --git a/examples/CatDealsCollectionView/Sample/main.m b/examples/CatDealsCollectionView/Sample/main.m index d5794dca4c..65850400e4 100644 --- a/examples/CatDealsCollectionView/Sample/main.m +++ b/examples/CatDealsCollectionView/Sample/main.m @@ -1,18 +1,10 @@ // // main.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/CustomCollectionView-Swift/Sample/AppDelegate.swift b/examples/CustomCollectionView-Swift/Sample/AppDelegate.swift index 7606d4f94e..5556f8c77e 100644 --- a/examples/CustomCollectionView-Swift/Sample/AppDelegate.swift +++ b/examples/CustomCollectionView-Swift/Sample/AppDelegate.swift @@ -1,23 +1,10 @@ // // AppDelegate.swift -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // import UIKit diff --git a/examples/CustomCollectionView-Swift/Sample/ImageCellNode.swift b/examples/CustomCollectionView-Swift/Sample/ImageCellNode.swift index ecd0e358b1..70c1692679 100644 --- a/examples/CustomCollectionView-Swift/Sample/ImageCellNode.swift +++ b/examples/CustomCollectionView-Swift/Sample/ImageCellNode.swift @@ -1,23 +1,10 @@ // // ImageCellNode.swift -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // import UIKit diff --git a/examples/CustomCollectionView-Swift/Sample/MosaicCollectionViewLayout.swift b/examples/CustomCollectionView-Swift/Sample/MosaicCollectionViewLayout.swift old mode 100755 new mode 100644 index 96c9eae851..976481c8d2 --- a/examples/CustomCollectionView-Swift/Sample/MosaicCollectionViewLayout.swift +++ b/examples/CustomCollectionView-Swift/Sample/MosaicCollectionViewLayout.swift @@ -1,23 +1,10 @@ // -// MosaicCollectionViewLayout -// Sample +// MosaicCollectionViewLayout.swift +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // import Foundation diff --git a/examples/CustomCollectionView-Swift/Sample/ViewController.swift b/examples/CustomCollectionView-Swift/Sample/ViewController.swift index a4ee85df93..24345cdcef 100644 --- a/examples/CustomCollectionView-Swift/Sample/ViewController.swift +++ b/examples/CustomCollectionView-Swift/Sample/ViewController.swift @@ -1,18 +1,10 @@ // // ViewController.swift -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // import UIKit diff --git a/examples/CustomCollectionView/Sample/AppDelegate.h b/examples/CustomCollectionView/Sample/AppDelegate.h index 27e560aafe..19db03c153 100644 --- a/examples/CustomCollectionView/Sample/AppDelegate.h +++ b/examples/CustomCollectionView/Sample/AppDelegate.h @@ -1,18 +1,10 @@ // // AppDelegate.h -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/CustomCollectionView/Sample/AppDelegate.m b/examples/CustomCollectionView/Sample/AppDelegate.m index dec3c29fe7..867dafbc92 100644 --- a/examples/CustomCollectionView/Sample/AppDelegate.m +++ b/examples/CustomCollectionView/Sample/AppDelegate.m @@ -1,18 +1,10 @@ // // AppDelegate.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) through the present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "AppDelegate.h" diff --git a/examples/CustomCollectionView/Sample/ImageCellNode.h b/examples/CustomCollectionView/Sample/ImageCellNode.h index 970503c00d..787ee041ca 100644 --- a/examples/CustomCollectionView/Sample/ImageCellNode.h +++ b/examples/CustomCollectionView/Sample/ImageCellNode.h @@ -1,20 +1,10 @@ // // ImageCellNode.h -// Sample +// Texture // -// Created by McCallum, Levi on 11/22/15. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/CustomCollectionView/Sample/ImageCellNode.m b/examples/CustomCollectionView/Sample/ImageCellNode.m index 4292b0f189..9e3e4a72ff 100644 --- a/examples/CustomCollectionView/Sample/ImageCellNode.m +++ b/examples/CustomCollectionView/Sample/ImageCellNode.m @@ -2,17 +2,9 @@ // ImageCellNode.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ImageCellNode.h" diff --git a/examples/CustomCollectionView/Sample/ImageCollectionViewCell.h b/examples/CustomCollectionView/Sample/ImageCollectionViewCell.h index 8ca69a4239..8359fb72a0 100644 --- a/examples/CustomCollectionView/Sample/ImageCollectionViewCell.h +++ b/examples/CustomCollectionView/Sample/ImageCollectionViewCell.h @@ -1,9 +1,9 @@ // // ImageCollectionViewCell.h -// Sample +// Texture // -// Created by Hannah Troisi on 1/28/17. -// Copyright © 2017 Facebook. All rights reserved. +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/CustomCollectionView/Sample/ImageCollectionViewCell.m b/examples/CustomCollectionView/Sample/ImageCollectionViewCell.m index 9ef4a66281..c04c865039 100644 --- a/examples/CustomCollectionView/Sample/ImageCollectionViewCell.m +++ b/examples/CustomCollectionView/Sample/ImageCollectionViewCell.m @@ -1,9 +1,9 @@ // // ImageCollectionViewCell.m -// Sample +// Texture // -// Created by Hannah Troisi on 1/28/17. -// Copyright © 2017 Facebook. All rights reserved. +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ImageCollectionViewCell.h" diff --git a/examples/CustomCollectionView/Sample/MosaicCollectionLayoutDelegate.h b/examples/CustomCollectionView/Sample/MosaicCollectionLayoutDelegate.h index 78a3f7a17e..b6651953d1 100644 --- a/examples/CustomCollectionView/Sample/MosaicCollectionLayoutDelegate.h +++ b/examples/CustomCollectionView/Sample/MosaicCollectionLayoutDelegate.h @@ -2,12 +2,8 @@ // MosaicCollectionLayoutDelegate.h // Texture // -// Copyright (c) 2017-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/CustomCollectionView/Sample/MosaicCollectionLayoutDelegate.m b/examples/CustomCollectionView/Sample/MosaicCollectionLayoutDelegate.m index 196925c912..1715e1c374 100644 --- a/examples/CustomCollectionView/Sample/MosaicCollectionLayoutDelegate.m +++ b/examples/CustomCollectionView/Sample/MosaicCollectionLayoutDelegate.m @@ -2,12 +2,8 @@ // MosaicCollectionLayoutDelegate.m // Texture // -// Copyright (c) 2017-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "MosaicCollectionLayoutDelegate.h" diff --git a/examples/CustomCollectionView/Sample/MosaicCollectionLayoutInfo.h b/examples/CustomCollectionView/Sample/MosaicCollectionLayoutInfo.h index 1e7db52043..b887e1d2be 100644 --- a/examples/CustomCollectionView/Sample/MosaicCollectionLayoutInfo.h +++ b/examples/CustomCollectionView/Sample/MosaicCollectionLayoutInfo.h @@ -2,12 +2,8 @@ // MosaicCollectionLayoutInfo.h // Texture // -// Copyright (c) 2017-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/CustomCollectionView/Sample/MosaicCollectionLayoutInfo.m b/examples/CustomCollectionView/Sample/MosaicCollectionLayoutInfo.m index f7a4224ab3..9eb80c2186 100644 --- a/examples/CustomCollectionView/Sample/MosaicCollectionLayoutInfo.m +++ b/examples/CustomCollectionView/Sample/MosaicCollectionLayoutInfo.m @@ -2,12 +2,8 @@ // MosaicCollectionLayoutInfo.m // Texture // -// Copyright (c) 2017-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "MosaicCollectionLayoutInfo.h" diff --git a/examples/CustomCollectionView/Sample/ViewController.h b/examples/CustomCollectionView/Sample/ViewController.h index fb75aa3056..da850f7446 100644 --- a/examples/CustomCollectionView/Sample/ViewController.h +++ b/examples/CustomCollectionView/Sample/ViewController.h @@ -1,18 +1,10 @@ // // ViewController.h -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/CustomCollectionView/Sample/ViewController.m b/examples/CustomCollectionView/Sample/ViewController.m index 65445a557c..7715fc8c07 100644 --- a/examples/CustomCollectionView/Sample/ViewController.m +++ b/examples/CustomCollectionView/Sample/ViewController.m @@ -2,17 +2,9 @@ // ViewController.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ViewController.h" diff --git a/examples/CustomCollectionView/Sample/main.m b/examples/CustomCollectionView/Sample/main.m index d5794dca4c..65850400e4 100644 --- a/examples/CustomCollectionView/Sample/main.m +++ b/examples/CustomCollectionView/Sample/main.m @@ -1,18 +1,10 @@ // // main.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/HorizontalWithinVerticalScrolling/Sample/AppDelegate.h b/examples/HorizontalWithinVerticalScrolling/Sample/AppDelegate.h index 5274628a9e..c30a27f4dc 100644 --- a/examples/HorizontalWithinVerticalScrolling/Sample/AppDelegate.h +++ b/examples/HorizontalWithinVerticalScrolling/Sample/AppDelegate.h @@ -1,18 +1,10 @@ // // AppDelegate.h -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/HorizontalWithinVerticalScrolling/Sample/AppDelegate.m b/examples/HorizontalWithinVerticalScrolling/Sample/AppDelegate.m index 58fe564898..f8437855b0 100644 --- a/examples/HorizontalWithinVerticalScrolling/Sample/AppDelegate.m +++ b/examples/HorizontalWithinVerticalScrolling/Sample/AppDelegate.m @@ -1,18 +1,10 @@ // // AppDelegate.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "AppDelegate.h" diff --git a/examples/HorizontalWithinVerticalScrolling/Sample/HorizontalScrollCellNode.h b/examples/HorizontalWithinVerticalScrolling/Sample/HorizontalScrollCellNode.h index 07133747fb..49b6e48d09 100644 --- a/examples/HorizontalWithinVerticalScrolling/Sample/HorizontalScrollCellNode.h +++ b/examples/HorizontalWithinVerticalScrolling/Sample/HorizontalScrollCellNode.h @@ -1,18 +1,10 @@ // // HorizontalScrollCellNode.h -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/HorizontalWithinVerticalScrolling/Sample/HorizontalScrollCellNode.mm b/examples/HorizontalWithinVerticalScrolling/Sample/HorizontalScrollCellNode.mm index 9f2f355e9a..0794643893 100644 --- a/examples/HorizontalWithinVerticalScrolling/Sample/HorizontalScrollCellNode.mm +++ b/examples/HorizontalWithinVerticalScrolling/Sample/HorizontalScrollCellNode.mm @@ -1,18 +1,10 @@ // // HorizontalScrollCellNode.mm -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "HorizontalScrollCellNode.h" diff --git a/examples/HorizontalWithinVerticalScrolling/Sample/RandomCoreGraphicsNode.h b/examples/HorizontalWithinVerticalScrolling/Sample/RandomCoreGraphicsNode.h index 19e86e5712..85b53290cc 100644 --- a/examples/HorizontalWithinVerticalScrolling/Sample/RandomCoreGraphicsNode.h +++ b/examples/HorizontalWithinVerticalScrolling/Sample/RandomCoreGraphicsNode.h @@ -1,20 +1,10 @@ // // RandomCoreGraphicsNode.h -// Sample +// Texture // -// Created by Scott Goodson on 9/5/15. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/HorizontalWithinVerticalScrolling/Sample/RandomCoreGraphicsNode.m b/examples/HorizontalWithinVerticalScrolling/Sample/RandomCoreGraphicsNode.m index fce6ea56e9..83d9ed6795 100644 --- a/examples/HorizontalWithinVerticalScrolling/Sample/RandomCoreGraphicsNode.m +++ b/examples/HorizontalWithinVerticalScrolling/Sample/RandomCoreGraphicsNode.m @@ -1,20 +1,10 @@ // // RandomCoreGraphicsNode.m -// Sample +// Texture // -// Created by Scott Goodson on 9/5/15. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "RandomCoreGraphicsNode.h" diff --git a/examples/HorizontalWithinVerticalScrolling/Sample/ViewController.h b/examples/HorizontalWithinVerticalScrolling/Sample/ViewController.h index db689fe324..560b6a2d03 100644 --- a/examples/HorizontalWithinVerticalScrolling/Sample/ViewController.h +++ b/examples/HorizontalWithinVerticalScrolling/Sample/ViewController.h @@ -1,18 +1,10 @@ // // ViewController.h -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/HorizontalWithinVerticalScrolling/Sample/ViewController.m b/examples/HorizontalWithinVerticalScrolling/Sample/ViewController.m index 876775f35c..f1b1858825 100644 --- a/examples/HorizontalWithinVerticalScrolling/Sample/ViewController.m +++ b/examples/HorizontalWithinVerticalScrolling/Sample/ViewController.m @@ -1,18 +1,10 @@ // // ViewController.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/HorizontalWithinVerticalScrolling/Sample/main.m b/examples/HorizontalWithinVerticalScrolling/Sample/main.m index 756080fb2b..511cd1a7ac 100644 --- a/examples/HorizontalWithinVerticalScrolling/Sample/main.m +++ b/examples/HorizontalWithinVerticalScrolling/Sample/main.m @@ -1,18 +1,10 @@ // // main.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/Kittens/Sample/AppDelegate.h b/examples/Kittens/Sample/AppDelegate.h index 5274628a9e..c30a27f4dc 100644 --- a/examples/Kittens/Sample/AppDelegate.h +++ b/examples/Kittens/Sample/AppDelegate.h @@ -1,18 +1,10 @@ // // AppDelegate.h -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/Kittens/Sample/AppDelegate.m b/examples/Kittens/Sample/AppDelegate.m index e683d16d4f..d9465e0de7 100644 --- a/examples/Kittens/Sample/AppDelegate.m +++ b/examples/Kittens/Sample/AppDelegate.m @@ -2,17 +2,9 @@ // AppDelegate.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) through the present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "AppDelegate.h" diff --git a/examples/Kittens/Sample/BlurbNode.h b/examples/Kittens/Sample/BlurbNode.h index e6574bcd05..5451fb39f0 100644 --- a/examples/Kittens/Sample/BlurbNode.h +++ b/examples/Kittens/Sample/BlurbNode.h @@ -1,18 +1,10 @@ // // BlurbNode.h -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/Kittens/Sample/BlurbNode.m b/examples/Kittens/Sample/BlurbNode.m index 7b02ae93de..6014711d33 100644 --- a/examples/Kittens/Sample/BlurbNode.m +++ b/examples/Kittens/Sample/BlurbNode.m @@ -1,18 +1,10 @@ // // BlurbNode.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "BlurbNode.h" diff --git a/examples/Kittens/Sample/KittenNode.h b/examples/Kittens/Sample/KittenNode.h index 9193b9df29..5b0b04203e 100644 --- a/examples/Kittens/Sample/KittenNode.h +++ b/examples/Kittens/Sample/KittenNode.h @@ -1,18 +1,10 @@ // // KittenNode.h -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/Kittens/Sample/KittenNode.mm b/examples/Kittens/Sample/KittenNode.mm index c27d54bd2c..f8ae2ef2e6 100644 --- a/examples/Kittens/Sample/KittenNode.mm +++ b/examples/Kittens/Sample/KittenNode.mm @@ -1,18 +1,10 @@ // // KittenNode.mm -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "KittenNode.h" diff --git a/examples/Kittens/Sample/ViewController.h b/examples/Kittens/Sample/ViewController.h index db689fe324..560b6a2d03 100644 --- a/examples/Kittens/Sample/ViewController.h +++ b/examples/Kittens/Sample/ViewController.h @@ -1,18 +1,10 @@ // // ViewController.h -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/Kittens/Sample/ViewController.m b/examples/Kittens/Sample/ViewController.m index 38d01d6f55..552f482886 100644 --- a/examples/Kittens/Sample/ViewController.m +++ b/examples/Kittens/Sample/ViewController.m @@ -2,17 +2,9 @@ // ViewController.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) through the present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ViewController.h" diff --git a/examples/Kittens/Sample/main.m b/examples/Kittens/Sample/main.m index 756080fb2b..511cd1a7ac 100644 --- a/examples/Kittens/Sample/main.m +++ b/examples/Kittens/Sample/main.m @@ -1,18 +1,10 @@ // // main.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/LayoutSpecExamples-Swift/Sample/AppDelegate.swift b/examples/LayoutSpecExamples-Swift/Sample/AppDelegate.swift index 6cce6558a8..9a465c6de8 100644 --- a/examples/LayoutSpecExamples-Swift/Sample/AppDelegate.swift +++ b/examples/LayoutSpecExamples-Swift/Sample/AppDelegate.swift @@ -1,18 +1,10 @@ // // AppDelegate.swift -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // import UIKit diff --git a/examples/LayoutSpecExamples-Swift/Sample/LayoutExampleNode+Layouts.swift b/examples/LayoutSpecExamples-Swift/Sample/LayoutExampleNode+Layouts.swift index c2d53a8f22..cf6bfbf1a6 100644 --- a/examples/LayoutSpecExamples-Swift/Sample/LayoutExampleNode+Layouts.swift +++ b/examples/LayoutSpecExamples-Swift/Sample/LayoutExampleNode+Layouts.swift @@ -1,18 +1,10 @@ // // LayoutExampleNode+Layouts.swift -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // import AsyncDisplayKit diff --git a/examples/LayoutSpecExamples-Swift/Sample/LayoutExampleNode.swift b/examples/LayoutSpecExamples-Swift/Sample/LayoutExampleNode.swift index 8be3356839..c113e07d37 100644 --- a/examples/LayoutSpecExamples-Swift/Sample/LayoutExampleNode.swift +++ b/examples/LayoutSpecExamples-Swift/Sample/LayoutExampleNode.swift @@ -1,18 +1,10 @@ // // LayoutExampleNode.swift -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // import AsyncDisplayKit diff --git a/examples/LayoutSpecExamples-Swift/Sample/LayoutExampleViewController.swift b/examples/LayoutSpecExamples-Swift/Sample/LayoutExampleViewController.swift index 1deccf05eb..25a391694f 100644 --- a/examples/LayoutSpecExamples-Swift/Sample/LayoutExampleViewController.swift +++ b/examples/LayoutSpecExamples-Swift/Sample/LayoutExampleViewController.swift @@ -1,18 +1,10 @@ // // LayoutExampleViewController.swift -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // import AsyncDisplayKit diff --git a/examples/LayoutSpecExamples-Swift/Sample/OverviewCellNode.swift b/examples/LayoutSpecExamples-Swift/Sample/OverviewCellNode.swift index 2db4b5c4a9..e6e511b62d 100644 --- a/examples/LayoutSpecExamples-Swift/Sample/OverviewCellNode.swift +++ b/examples/LayoutSpecExamples-Swift/Sample/OverviewCellNode.swift @@ -1,18 +1,10 @@ // // OverviewCellNode.swift -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // import AsyncDisplayKit diff --git a/examples/LayoutSpecExamples-Swift/Sample/OverviewViewController.swift b/examples/LayoutSpecExamples-Swift/Sample/OverviewViewController.swift index e4b6f5d5a4..c43856f11a 100644 --- a/examples/LayoutSpecExamples-Swift/Sample/OverviewViewController.swift +++ b/examples/LayoutSpecExamples-Swift/Sample/OverviewViewController.swift @@ -1,18 +1,10 @@ // // OverviewViewController.swift -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // import AsyncDisplayKit diff --git a/examples/LayoutSpecExamples-Swift/Sample/Utilities.swift b/examples/LayoutSpecExamples-Swift/Sample/Utilities.swift index 1f1bad89ce..f235be8166 100644 --- a/examples/LayoutSpecExamples-Swift/Sample/Utilities.swift +++ b/examples/LayoutSpecExamples-Swift/Sample/Utilities.swift @@ -1,18 +1,10 @@ // // Utilities.swift -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // import UIKit diff --git a/examples/LayoutSpecExamples/Sample/AppDelegate.h b/examples/LayoutSpecExamples/Sample/AppDelegate.h index 32777218dd..d5c7194563 100644 --- a/examples/LayoutSpecExamples/Sample/AppDelegate.h +++ b/examples/LayoutSpecExamples/Sample/AppDelegate.h @@ -1,11 +1,10 @@ // // AppDelegate.h -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/LayoutSpecExamples/Sample/AppDelegate.m b/examples/LayoutSpecExamples/Sample/AppDelegate.m index 88772c00d2..73fc27af6e 100644 --- a/examples/LayoutSpecExamples/Sample/AppDelegate.m +++ b/examples/LayoutSpecExamples/Sample/AppDelegate.m @@ -1,11 +1,10 @@ // // AppDelegate.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "AppDelegate.h" diff --git a/examples/LayoutSpecExamples/Sample/LayoutExampleNodes.h b/examples/LayoutSpecExamples/Sample/LayoutExampleNodes.h index 65241146ba..484ba5d418 100644 --- a/examples/LayoutSpecExamples/Sample/LayoutExampleNodes.h +++ b/examples/LayoutSpecExamples/Sample/LayoutExampleNodes.h @@ -2,17 +2,9 @@ // LayoutExampleNodes.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/LayoutSpecExamples/Sample/LayoutExampleNodes.m b/examples/LayoutSpecExamples/Sample/LayoutExampleNodes.m index 9b84cb16e4..5d9d63663f 100644 --- a/examples/LayoutSpecExamples/Sample/LayoutExampleNodes.m +++ b/examples/LayoutSpecExamples/Sample/LayoutExampleNodes.m @@ -2,17 +2,9 @@ // LayoutExampleNodes.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "LayoutExampleNodes.h" diff --git a/examples/LayoutSpecExamples/Sample/LayoutExampleViewController.h b/examples/LayoutSpecExamples/Sample/LayoutExampleViewController.h index 6426a8d8a2..d087bcc77f 100644 --- a/examples/LayoutSpecExamples/Sample/LayoutExampleViewController.h +++ b/examples/LayoutSpecExamples/Sample/LayoutExampleViewController.h @@ -1,11 +1,10 @@ // // LayoutExampleViewController.h -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/LayoutSpecExamples/Sample/LayoutExampleViewController.m b/examples/LayoutSpecExamples/Sample/LayoutExampleViewController.m index cc3cddc3cb..71607a6f87 100644 --- a/examples/LayoutSpecExamples/Sample/LayoutExampleViewController.m +++ b/examples/LayoutSpecExamples/Sample/LayoutExampleViewController.m @@ -1,11 +1,10 @@ // // LayoutExampleViewController.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "LayoutExampleViewController.h" diff --git a/examples/LayoutSpecExamples/Sample/OverviewCellNode.h b/examples/LayoutSpecExamples/Sample/OverviewCellNode.h index 28926d294a..7a98c031cd 100644 --- a/examples/LayoutSpecExamples/Sample/OverviewCellNode.h +++ b/examples/LayoutSpecExamples/Sample/OverviewCellNode.h @@ -1,11 +1,10 @@ // // OverviewCellNode.h -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/LayoutSpecExamples/Sample/OverviewCellNode.m b/examples/LayoutSpecExamples/Sample/OverviewCellNode.m index bab20e61d3..6cd4eb845f 100644 --- a/examples/LayoutSpecExamples/Sample/OverviewCellNode.m +++ b/examples/LayoutSpecExamples/Sample/OverviewCellNode.m @@ -1,11 +1,10 @@ // // OverviewCellNode.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "OverviewCellNode.h" diff --git a/examples/LayoutSpecExamples/Sample/OverviewViewController.h b/examples/LayoutSpecExamples/Sample/OverviewViewController.h index c05e4fd7a2..83381429a3 100644 --- a/examples/LayoutSpecExamples/Sample/OverviewViewController.h +++ b/examples/LayoutSpecExamples/Sample/OverviewViewController.h @@ -1,11 +1,10 @@ // // OverviewViewController.h -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/LayoutSpecExamples/Sample/OverviewViewController.m b/examples/LayoutSpecExamples/Sample/OverviewViewController.m index c3cd7f9b6b..9d9700f5e2 100644 --- a/examples/LayoutSpecExamples/Sample/OverviewViewController.m +++ b/examples/LayoutSpecExamples/Sample/OverviewViewController.m @@ -2,17 +2,9 @@ // OverviewViewController.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "OverviewViewController.h" diff --git a/examples/LayoutSpecExamples/Sample/Utilities.h b/examples/LayoutSpecExamples/Sample/Utilities.h index b4bf2f824a..5719a4ab85 100644 --- a/examples/LayoutSpecExamples/Sample/Utilities.h +++ b/examples/LayoutSpecExamples/Sample/Utilities.h @@ -2,17 +2,9 @@ // Utilities.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/LayoutSpecExamples/Sample/Utilities.m b/examples/LayoutSpecExamples/Sample/Utilities.m index 92e5c4bda7..d999ddd32d 100644 --- a/examples/LayoutSpecExamples/Sample/Utilities.m +++ b/examples/LayoutSpecExamples/Sample/Utilities.m @@ -2,17 +2,9 @@ // Utilities.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "Utilities.h" diff --git a/examples/LayoutSpecExamples/Sample/main.m b/examples/LayoutSpecExamples/Sample/main.m index 791ef4b743..0e5da05001 100644 --- a/examples/LayoutSpecExamples/Sample/main.m +++ b/examples/LayoutSpecExamples/Sample/main.m @@ -1,18 +1,10 @@ // // main.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/PagerNode/Sample/AppDelegate.h b/examples/PagerNode/Sample/AppDelegate.h index 27e560aafe..19db03c153 100644 --- a/examples/PagerNode/Sample/AppDelegate.h +++ b/examples/PagerNode/Sample/AppDelegate.h @@ -1,18 +1,10 @@ // // AppDelegate.h -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/PagerNode/Sample/AppDelegate.m b/examples/PagerNode/Sample/AppDelegate.m index 58fe564898..f8437855b0 100644 --- a/examples/PagerNode/Sample/AppDelegate.m +++ b/examples/PagerNode/Sample/AppDelegate.m @@ -1,18 +1,10 @@ // // AppDelegate.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "AppDelegate.h" diff --git a/examples/PagerNode/Sample/PageNode.h b/examples/PagerNode/Sample/PageNode.h index e87a74628b..f4346289c5 100644 --- a/examples/PagerNode/Sample/PageNode.h +++ b/examples/PagerNode/Sample/PageNode.h @@ -1,20 +1,10 @@ // // PageNode.h -// Sample +// Texture // -// Created by McCallum, Levi on 12/7/15. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/PagerNode/Sample/PageNode.m b/examples/PagerNode/Sample/PageNode.m index 0efd831219..bedd46f0c0 100644 --- a/examples/PagerNode/Sample/PageNode.m +++ b/examples/PagerNode/Sample/PageNode.m @@ -2,17 +2,9 @@ // PageNode.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "PageNode.h" diff --git a/examples/PagerNode/Sample/ViewController.h b/examples/PagerNode/Sample/ViewController.h index 151b29582a..3af731c848 100644 --- a/examples/PagerNode/Sample/ViewController.h +++ b/examples/PagerNode/Sample/ViewController.h @@ -1,18 +1,10 @@ // // ViewController.h -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/PagerNode/Sample/ViewController.m b/examples/PagerNode/Sample/ViewController.m index 001c5c069a..b55fa343f9 100644 --- a/examples/PagerNode/Sample/ViewController.m +++ b/examples/PagerNode/Sample/ViewController.m @@ -1,18 +1,10 @@ // // ViewController.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ViewController.h" diff --git a/examples/PagerNode/Sample/main.m b/examples/PagerNode/Sample/main.m index 756080fb2b..511cd1a7ac 100644 --- a/examples/PagerNode/Sample/main.m +++ b/examples/PagerNode/Sample/main.m @@ -1,18 +1,10 @@ // // main.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/SocialAppLayout-Inverted/Sample/AppDelegate.h b/examples/SocialAppLayout-Inverted/Sample/AppDelegate.h index 445e9559ee..19db03c153 100644 --- a/examples/SocialAppLayout-Inverted/Sample/AppDelegate.h +++ b/examples/SocialAppLayout-Inverted/Sample/AppDelegate.h @@ -2,17 +2,9 @@ // AppDelegate.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/SocialAppLayout-Inverted/Sample/AppDelegate.m b/examples/SocialAppLayout-Inverted/Sample/AppDelegate.m index 54b277b146..73663a6919 100644 --- a/examples/SocialAppLayout-Inverted/Sample/AppDelegate.m +++ b/examples/SocialAppLayout-Inverted/Sample/AppDelegate.m @@ -2,17 +2,9 @@ // AppDelegate.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "AppDelegate.h" diff --git a/examples/SocialAppLayout-Inverted/Sample/CommentsNode.h b/examples/SocialAppLayout-Inverted/Sample/CommentsNode.h index cd1271f9b4..422460fe9e 100644 --- a/examples/SocialAppLayout-Inverted/Sample/CommentsNode.h +++ b/examples/SocialAppLayout-Inverted/Sample/CommentsNode.h @@ -2,17 +2,9 @@ // CommentsNode.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/SocialAppLayout-Inverted/Sample/CommentsNode.m b/examples/SocialAppLayout-Inverted/Sample/CommentsNode.m index d90ed58c1d..96ba688881 100644 --- a/examples/SocialAppLayout-Inverted/Sample/CommentsNode.m +++ b/examples/SocialAppLayout-Inverted/Sample/CommentsNode.m @@ -2,17 +2,9 @@ // CommentsNode.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "CommentsNode.h" diff --git a/examples/SocialAppLayout-Inverted/Sample/LikesNode.h b/examples/SocialAppLayout-Inverted/Sample/LikesNode.h index 21908713c1..1dbbc191e1 100644 --- a/examples/SocialAppLayout-Inverted/Sample/LikesNode.h +++ b/examples/SocialAppLayout-Inverted/Sample/LikesNode.h @@ -2,17 +2,9 @@ // LikesNode.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/SocialAppLayout-Inverted/Sample/LikesNode.m b/examples/SocialAppLayout-Inverted/Sample/LikesNode.m index 551c575c72..cd5ade1db4 100644 --- a/examples/SocialAppLayout-Inverted/Sample/LikesNode.m +++ b/examples/SocialAppLayout-Inverted/Sample/LikesNode.m @@ -2,17 +2,9 @@ // LikesNode.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "LikesNode.h" diff --git a/examples/SocialAppLayout-Inverted/Sample/Post.h b/examples/SocialAppLayout-Inverted/Sample/Post.h index c2383c82f2..c8259237b8 100644 --- a/examples/SocialAppLayout-Inverted/Sample/Post.h +++ b/examples/SocialAppLayout-Inverted/Sample/Post.h @@ -2,17 +2,9 @@ // Post.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/SocialAppLayout-Inverted/Sample/Post.m b/examples/SocialAppLayout-Inverted/Sample/Post.m index ca029e7aa0..fc61c5bf82 100644 --- a/examples/SocialAppLayout-Inverted/Sample/Post.m +++ b/examples/SocialAppLayout-Inverted/Sample/Post.m @@ -2,17 +2,9 @@ // Post.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "Post.h" diff --git a/examples/SocialAppLayout-Inverted/Sample/PostNode.h b/examples/SocialAppLayout-Inverted/Sample/PostNode.h index c3e27e52b7..b558158e31 100644 --- a/examples/SocialAppLayout-Inverted/Sample/PostNode.h +++ b/examples/SocialAppLayout-Inverted/Sample/PostNode.h @@ -2,17 +2,9 @@ // PostNode.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/SocialAppLayout-Inverted/Sample/PostNode.m b/examples/SocialAppLayout-Inverted/Sample/PostNode.m index 1c4bad381e..defafc0061 100644 --- a/examples/SocialAppLayout-Inverted/Sample/PostNode.m +++ b/examples/SocialAppLayout-Inverted/Sample/PostNode.m @@ -2,17 +2,9 @@ // PostNode.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "PostNode.h" diff --git a/examples/SocialAppLayout-Inverted/Sample/TextStyles.h b/examples/SocialAppLayout-Inverted/Sample/TextStyles.h index 39cfe9528c..2a975bdea3 100644 --- a/examples/SocialAppLayout-Inverted/Sample/TextStyles.h +++ b/examples/SocialAppLayout-Inverted/Sample/TextStyles.h @@ -2,17 +2,9 @@ // TextStyles.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/SocialAppLayout-Inverted/Sample/TextStyles.m b/examples/SocialAppLayout-Inverted/Sample/TextStyles.m index 68f11954ae..ad7798c445 100644 --- a/examples/SocialAppLayout-Inverted/Sample/TextStyles.m +++ b/examples/SocialAppLayout-Inverted/Sample/TextStyles.m @@ -2,17 +2,9 @@ // TextStyles.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "TextStyles.h" diff --git a/examples/SocialAppLayout-Inverted/Sample/ViewController.h b/examples/SocialAppLayout-Inverted/Sample/ViewController.h index 437714485d..6416242247 100644 --- a/examples/SocialAppLayout-Inverted/Sample/ViewController.h +++ b/examples/SocialAppLayout-Inverted/Sample/ViewController.h @@ -2,17 +2,9 @@ // ViewController.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/SocialAppLayout-Inverted/Sample/ViewController.m b/examples/SocialAppLayout-Inverted/Sample/ViewController.m index f19962d613..efc9d06e4a 100644 --- a/examples/SocialAppLayout-Inverted/Sample/ViewController.m +++ b/examples/SocialAppLayout-Inverted/Sample/ViewController.m @@ -2,17 +2,9 @@ // ViewController.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ViewController.h" diff --git a/examples/SocialAppLayout-Inverted/Sample/main.m b/examples/SocialAppLayout-Inverted/Sample/main.m index 7dd0fecc6d..0e5da05001 100644 --- a/examples/SocialAppLayout-Inverted/Sample/main.m +++ b/examples/SocialAppLayout-Inverted/Sample/main.m @@ -2,17 +2,9 @@ // main.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/SocialAppLayout/Sample/AppDelegate.h b/examples/SocialAppLayout/Sample/AppDelegate.h index 27e560aafe..19db03c153 100644 --- a/examples/SocialAppLayout/Sample/AppDelegate.h +++ b/examples/SocialAppLayout/Sample/AppDelegate.h @@ -1,18 +1,10 @@ // // AppDelegate.h -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/SocialAppLayout/Sample/AppDelegate.m b/examples/SocialAppLayout/Sample/AppDelegate.m index da7d93f4d8..73663a6919 100644 --- a/examples/SocialAppLayout/Sample/AppDelegate.m +++ b/examples/SocialAppLayout/Sample/AppDelegate.m @@ -1,18 +1,10 @@ // // AppDelegate.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "AppDelegate.h" diff --git a/examples/SocialAppLayout/Sample/CommentsNode.h b/examples/SocialAppLayout/Sample/CommentsNode.h index 24e39cb5b4..422460fe9e 100644 --- a/examples/SocialAppLayout/Sample/CommentsNode.h +++ b/examples/SocialAppLayout/Sample/CommentsNode.h @@ -1,18 +1,10 @@ // // CommentsNode.h -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/SocialAppLayout/Sample/CommentsNode.m b/examples/SocialAppLayout/Sample/CommentsNode.m index 48d1d457ad..96ba688881 100644 --- a/examples/SocialAppLayout/Sample/CommentsNode.m +++ b/examples/SocialAppLayout/Sample/CommentsNode.m @@ -1,18 +1,10 @@ // // CommentsNode.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "CommentsNode.h" diff --git a/examples/SocialAppLayout/Sample/LikesNode.h b/examples/SocialAppLayout/Sample/LikesNode.h index b98cbebef6..1dbbc191e1 100644 --- a/examples/SocialAppLayout/Sample/LikesNode.h +++ b/examples/SocialAppLayout/Sample/LikesNode.h @@ -1,18 +1,10 @@ // // LikesNode.h -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/SocialAppLayout/Sample/LikesNode.m b/examples/SocialAppLayout/Sample/LikesNode.m index 593d5ae5de..cd5ade1db4 100644 --- a/examples/SocialAppLayout/Sample/LikesNode.m +++ b/examples/SocialAppLayout/Sample/LikesNode.m @@ -1,18 +1,10 @@ // // LikesNode.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "LikesNode.h" diff --git a/examples/SocialAppLayout/Sample/Post.h b/examples/SocialAppLayout/Sample/Post.h index 44bed0dd73..c8259237b8 100644 --- a/examples/SocialAppLayout/Sample/Post.h +++ b/examples/SocialAppLayout/Sample/Post.h @@ -1,18 +1,10 @@ // // Post.h -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/SocialAppLayout/Sample/Post.m b/examples/SocialAppLayout/Sample/Post.m index 10bf3a7623..fc61c5bf82 100644 --- a/examples/SocialAppLayout/Sample/Post.m +++ b/examples/SocialAppLayout/Sample/Post.m @@ -1,18 +1,10 @@ // // Post.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "Post.h" diff --git a/examples/SocialAppLayout/Sample/PostNode.h b/examples/SocialAppLayout/Sample/PostNode.h index 6d8c62696d..b558158e31 100644 --- a/examples/SocialAppLayout/Sample/PostNode.h +++ b/examples/SocialAppLayout/Sample/PostNode.h @@ -1,18 +1,10 @@ // // PostNode.h -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/SocialAppLayout/Sample/PostNode.m b/examples/SocialAppLayout/Sample/PostNode.m index 1c4bad381e..defafc0061 100644 --- a/examples/SocialAppLayout/Sample/PostNode.m +++ b/examples/SocialAppLayout/Sample/PostNode.m @@ -2,17 +2,9 @@ // PostNode.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "PostNode.h" diff --git a/examples/SocialAppLayout/Sample/TextStyles.h b/examples/SocialAppLayout/Sample/TextStyles.h index b8ef6780c1..2a975bdea3 100644 --- a/examples/SocialAppLayout/Sample/TextStyles.h +++ b/examples/SocialAppLayout/Sample/TextStyles.h @@ -1,18 +1,10 @@ // // TextStyles.h -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/SocialAppLayout/Sample/TextStyles.m b/examples/SocialAppLayout/Sample/TextStyles.m index 8f642522b7..ad7798c445 100644 --- a/examples/SocialAppLayout/Sample/TextStyles.m +++ b/examples/SocialAppLayout/Sample/TextStyles.m @@ -1,18 +1,10 @@ // // TextStyles.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "TextStyles.h" diff --git a/examples/SocialAppLayout/Sample/ViewController.h b/examples/SocialAppLayout/Sample/ViewController.h index bfb359c6b5..6416242247 100644 --- a/examples/SocialAppLayout/Sample/ViewController.h +++ b/examples/SocialAppLayout/Sample/ViewController.h @@ -1,18 +1,10 @@ // // ViewController.h -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/SocialAppLayout/Sample/ViewController.m b/examples/SocialAppLayout/Sample/ViewController.m index 28bdf90283..1eebcb516c 100644 --- a/examples/SocialAppLayout/Sample/ViewController.m +++ b/examples/SocialAppLayout/Sample/ViewController.m @@ -1,18 +1,10 @@ // // ViewController.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ViewController.h" diff --git a/examples/SocialAppLayout/Sample/main.m b/examples/SocialAppLayout/Sample/main.m index 791ef4b743..0e5da05001 100644 --- a/examples/SocialAppLayout/Sample/main.m +++ b/examples/SocialAppLayout/Sample/main.m @@ -1,18 +1,10 @@ // // main.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/Swift/Sample/AppDelegate.swift b/examples/Swift/Sample/AppDelegate.swift index c40f1be4ed..df48167298 100644 --- a/examples/Swift/Sample/AppDelegate.swift +++ b/examples/Swift/Sample/AppDelegate.swift @@ -1,18 +1,10 @@ // // AppDelegate.swift -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // import UIKit diff --git a/examples/Swift/Sample/TailLoadingCellNode.swift b/examples/Swift/Sample/TailLoadingCellNode.swift index 5327dd4456..5b586e7086 100644 --- a/examples/Swift/Sample/TailLoadingCellNode.swift +++ b/examples/Swift/Sample/TailLoadingCellNode.swift @@ -1,20 +1,10 @@ // // TailLoadingCellNode.swift -// Sample +// Texture // -// Created by Adlai Holler on 2/1/16. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // import AsyncDisplayKit diff --git a/examples/Swift/Sample/ViewController.swift b/examples/Swift/Sample/ViewController.swift index 4d1269e6ae..e68c178ad5 100644 --- a/examples/Swift/Sample/ViewController.swift +++ b/examples/Swift/Sample/ViewController.swift @@ -1,18 +1,10 @@ // // ViewController.swift -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // import UIKit diff --git a/examples/VerticalWithinHorizontalScrolling/Sample/AppDelegate.h b/examples/VerticalWithinHorizontalScrolling/Sample/AppDelegate.h index 5274628a9e..c30a27f4dc 100644 --- a/examples/VerticalWithinHorizontalScrolling/Sample/AppDelegate.h +++ b/examples/VerticalWithinHorizontalScrolling/Sample/AppDelegate.h @@ -1,18 +1,10 @@ // // AppDelegate.h -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/VerticalWithinHorizontalScrolling/Sample/AppDelegate.m b/examples/VerticalWithinHorizontalScrolling/Sample/AppDelegate.m index 7856fdec08..faa44dc60b 100644 --- a/examples/VerticalWithinHorizontalScrolling/Sample/AppDelegate.m +++ b/examples/VerticalWithinHorizontalScrolling/Sample/AppDelegate.m @@ -1,18 +1,10 @@ // // AppDelegate.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "AppDelegate.h" diff --git a/examples/VerticalWithinHorizontalScrolling/Sample/GradientTableNode.h b/examples/VerticalWithinHorizontalScrolling/Sample/GradientTableNode.h index 2c36e79dab..e679beb7d7 100644 --- a/examples/VerticalWithinHorizontalScrolling/Sample/GradientTableNode.h +++ b/examples/VerticalWithinHorizontalScrolling/Sample/GradientTableNode.h @@ -1,18 +1,10 @@ // // GradientTableNode.h -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/VerticalWithinHorizontalScrolling/Sample/GradientTableNode.mm b/examples/VerticalWithinHorizontalScrolling/Sample/GradientTableNode.mm index 8e6c884f11..af36ca637c 100644 --- a/examples/VerticalWithinHorizontalScrolling/Sample/GradientTableNode.mm +++ b/examples/VerticalWithinHorizontalScrolling/Sample/GradientTableNode.mm @@ -1,18 +1,10 @@ // // GradientTableNode.mm -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "GradientTableNode.h" diff --git a/examples/VerticalWithinHorizontalScrolling/Sample/RandomCoreGraphicsNode.h b/examples/VerticalWithinHorizontalScrolling/Sample/RandomCoreGraphicsNode.h index e2b21128f2..c07752ab1a 100644 --- a/examples/VerticalWithinHorizontalScrolling/Sample/RandomCoreGraphicsNode.h +++ b/examples/VerticalWithinHorizontalScrolling/Sample/RandomCoreGraphicsNode.h @@ -1,20 +1,10 @@ // // RandomCoreGraphicsNode.h -// Sample +// Texture // -// Created by Scott Goodson on 9/5/15. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/VerticalWithinHorizontalScrolling/Sample/RandomCoreGraphicsNode.m b/examples/VerticalWithinHorizontalScrolling/Sample/RandomCoreGraphicsNode.m index 3b9e09d009..bf114349e5 100644 --- a/examples/VerticalWithinHorizontalScrolling/Sample/RandomCoreGraphicsNode.m +++ b/examples/VerticalWithinHorizontalScrolling/Sample/RandomCoreGraphicsNode.m @@ -1,20 +1,10 @@ // // RandomCoreGraphicsNode.m -// Sample +// Texture // -// Created by Scott Goodson on 9/5/15. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "RandomCoreGraphicsNode.h" diff --git a/examples/VerticalWithinHorizontalScrolling/Sample/ViewController.h b/examples/VerticalWithinHorizontalScrolling/Sample/ViewController.h index fc52c022f2..c8a0626291 100644 --- a/examples/VerticalWithinHorizontalScrolling/Sample/ViewController.h +++ b/examples/VerticalWithinHorizontalScrolling/Sample/ViewController.h @@ -1,18 +1,10 @@ // // ViewController.h -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/VerticalWithinHorizontalScrolling/Sample/ViewController.m b/examples/VerticalWithinHorizontalScrolling/Sample/ViewController.m index 4791a42f08..7e852414c4 100644 --- a/examples/VerticalWithinHorizontalScrolling/Sample/ViewController.m +++ b/examples/VerticalWithinHorizontalScrolling/Sample/ViewController.m @@ -1,18 +1,10 @@ // // ViewController.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/VerticalWithinHorizontalScrolling/Sample/main.m b/examples/VerticalWithinHorizontalScrolling/Sample/main.m index 756080fb2b..511cd1a7ac 100644 --- a/examples/VerticalWithinHorizontalScrolling/Sample/main.m +++ b/examples/VerticalWithinHorizontalScrolling/Sample/main.m @@ -1,18 +1,10 @@ // // main.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/Videos/Sample/ASVideoNode.h b/examples/Videos/Sample/ASVideoNode.h index 3fcce60480..bec76ccc57 100644 --- a/examples/Videos/Sample/ASVideoNode.h +++ b/examples/Videos/Sample/ASVideoNode.h @@ -1,18 +1,10 @@ // // ASVideoNode.h -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/Videos/Sample/ASVideoNode.m b/examples/Videos/Sample/ASVideoNode.m index 7b9118721d..f7db712b5b 100644 --- a/examples/Videos/Sample/ASVideoNode.m +++ b/examples/Videos/Sample/ASVideoNode.m @@ -1,18 +1,10 @@ // // ASVideoNode.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // diff --git a/examples/Videos/Sample/AppDelegate.h b/examples/Videos/Sample/AppDelegate.h index 27e560aafe..19db03c153 100644 --- a/examples/Videos/Sample/AppDelegate.h +++ b/examples/Videos/Sample/AppDelegate.h @@ -1,18 +1,10 @@ // // AppDelegate.h -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/Videos/Sample/AppDelegate.m b/examples/Videos/Sample/AppDelegate.m index c62355c06c..d0fd66f775 100644 --- a/examples/Videos/Sample/AppDelegate.m +++ b/examples/Videos/Sample/AppDelegate.m @@ -1,18 +1,10 @@ // // AppDelegate.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "AppDelegate.h" diff --git a/examples/Videos/Sample/ViewController.h b/examples/Videos/Sample/ViewController.h index 2b35e7f47d..40cc00f2fc 100644 --- a/examples/Videos/Sample/ViewController.h +++ b/examples/Videos/Sample/ViewController.h @@ -1,18 +1,10 @@ // // ViewController.h -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples/Videos/Sample/ViewController.m b/examples/Videos/Sample/ViewController.m index b0de8101b3..988b3579b8 100644 --- a/examples/Videos/Sample/ViewController.m +++ b/examples/Videos/Sample/ViewController.m @@ -1,18 +1,10 @@ // // ViewController.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ViewController.h" diff --git a/examples/Videos/Sample/main.m b/examples/Videos/Sample/main.m index 756080fb2b..511cd1a7ac 100644 --- a/examples/Videos/Sample/main.m +++ b/examples/Videos/Sample/main.m @@ -1,18 +1,10 @@ // // main.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples_extra/ASDKgram-Swift/ASDKgram-Swift.xcodeproj/project.pbxproj b/examples_extra/ASDKgram-Swift/ASDKgram-Swift.xcodeproj/project.pbxproj index 23ef18b40e..e073f01f5d 100644 --- a/examples_extra/ASDKgram-Swift/ASDKgram-Swift.xcodeproj/project.pbxproj +++ b/examples_extra/ASDKgram-Swift/ASDKgram-Swift.xcodeproj/project.pbxproj @@ -8,7 +8,6 @@ /* Begin PBXBuildFile section */ 3A2362FB1E2D33A0007E08F1 /* Date.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A2362FA1E2D33A0007E08F1 /* Date.swift */; }; - 3A7A28D91E2F7410003E2B8D /* UIImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A7A28D81E2F7410003E2B8D /* UIImage.swift */; }; 3AB33F5E1E1F94530039F711 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3AB33F5D1E1F94530039F711 /* AppDelegate.swift */; }; 3AB33F651E1F94530039F711 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3AB33F641E1F94530039F711 /* Assets.xcassets */; }; 3AB33F681E1F94530039F711 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 3AB33F661E1F94530039F711 /* LaunchScreen.storyboard */; }; @@ -21,17 +20,20 @@ 3AB33F881E20ED460039F711 /* PhotoModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3AB33F871E20ED460039F711 /* PhotoModel.swift */; }; 3AB33F8C1E2106F30039F711 /* URL.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3AB33F8B1E2106F30039F711 /* URL.swift */; }; 3AB33F961E2269D40039F711 /* PopularPageModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3AB33F951E2269D40039F711 /* PopularPageModel.swift */; }; - 3AB33F981E22A0080039F711 /* PX500Convenience.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3AB33F971E22A0080039F711 /* PX500Convenience.swift */; }; + 3AB33F981E22A0080039F711 /* ParseResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3AB33F971E22A0080039F711 /* ParseResponse.swift */; }; 3AB33F9E1E22D9DB0039F711 /* PhotoTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3AB33F9D1E22D9DB0039F711 /* PhotoTableViewCell.swift */; }; 3AB33FA21E230A160039F711 /* NetworkImageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3AB33FA11E230A160039F711 /* NetworkImageView.swift */; }; 3AB33FA41E2337850039F711 /* PhotoTableNodeCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3AB33FA31E2337850039F711 /* PhotoTableNodeCell.swift */; }; + 692CD06E20E1A40D00D9B963 /* NumberFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 692CD06D20E1A40D00D9B963 /* NumberFormatter.swift */; }; 7E438240D2C4026931D60594 /* Pods_ASDKgram_Swift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D7D664E4FF432C4AE232A56 /* Pods_ASDKgram_Swift.framework */; }; + 9D4DFC5E20E1DF660067C960 /* OrderedDictionary+Codable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9D4DFC5B20E1DF660067C960 /* OrderedDictionary+Codable.swift */; }; + 9D4DFC5F20E1DF660067C960 /* OrderedDictionary.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9D4DFC5C20E1DF660067C960 /* OrderedDictionary.swift */; }; + 9D4DFC6020E1DF660067C960 /* OrderedDictionary+Description.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9D4DFC5D20E1DF660067C960 /* OrderedDictionary+Description.swift */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ 019E984FADA258377FC6B2D8 /* Pods-ASDKgram-Swift.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ASDKgram-Swift.debug.xcconfig"; path = "Pods/Target Support Files/Pods-ASDKgram-Swift/Pods-ASDKgram-Swift.debug.xcconfig"; sourceTree = ""; }; 3A2362FA1E2D33A0007E08F1 /* Date.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Date.swift; sourceTree = ""; }; - 3A7A28D81E2F7410003E2B8D /* UIImage.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UIImage.swift; sourceTree = ""; }; 3AB33F5A1E1F94520039F711 /* ASDKgram-Swift.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "ASDKgram-Swift.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 3AB33F5D1E1F94530039F711 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 3AB33F641E1F94530039F711 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; @@ -46,11 +48,15 @@ 3AB33F871E20ED460039F711 /* PhotoModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PhotoModel.swift; sourceTree = ""; }; 3AB33F8B1E2106F30039F711 /* URL.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = URL.swift; sourceTree = ""; }; 3AB33F951E2269D40039F711 /* PopularPageModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PopularPageModel.swift; sourceTree = ""; }; - 3AB33F971E22A0080039F711 /* PX500Convenience.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PX500Convenience.swift; sourceTree = ""; }; + 3AB33F971E22A0080039F711 /* ParseResponse.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ParseResponse.swift; sourceTree = ""; }; 3AB33F9D1E22D9DB0039F711 /* PhotoTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PhotoTableViewCell.swift; sourceTree = ""; }; 3AB33FA11E230A160039F711 /* NetworkImageView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NetworkImageView.swift; sourceTree = ""; }; 3AB33FA31E2337850039F711 /* PhotoTableNodeCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PhotoTableNodeCell.swift; sourceTree = ""; }; 4D7D664E4FF432C4AE232A56 /* Pods_ASDKgram_Swift.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_ASDKgram_Swift.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 692CD06D20E1A40D00D9B963 /* NumberFormatter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NumberFormatter.swift; sourceTree = ""; }; + 9D4DFC5B20E1DF660067C960 /* OrderedDictionary+Codable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "OrderedDictionary+Codable.swift"; sourceTree = ""; }; + 9D4DFC5C20E1DF660067C960 /* OrderedDictionary.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OrderedDictionary.swift; sourceTree = ""; }; + 9D4DFC5D20E1DF660067C960 /* OrderedDictionary+Description.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "OrderedDictionary+Description.swift"; sourceTree = ""; }; A3A86E74A8C3F06D7688AACB /* Pods-ASDKgram-Swift.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ASDKgram-Swift.release.xcconfig"; path = "Pods/Target Support Files/Pods-ASDKgram-Swift/Pods-ASDKgram-Swift.release.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ @@ -87,6 +93,7 @@ 3AB33F5C1E1F94530039F711 /* ASDKgram-Swift */ = { isa = PBXGroup; children = ( + 9D4DFC5A20E1DF660067C960 /* OrderedDictionary */, 3AB33F991E22CF160039F711 /* Views */, 3AB33F841E20E98C0039F711 /* Model */, 3AB33F7D1E1FDA890039F711 /* Client */, @@ -129,10 +136,10 @@ 3AB33F791E1F9E4E0039F711 /* Extensions */ = { isa = PBXGroup; children = ( + 3A2362FA1E2D33A0007E08F1 /* Date.swift */, + 692CD06D20E1A40D00D9B963 /* NumberFormatter.swift */, 3AB33F7A1E1F9E630039F711 /* UIColor.swift */, 3AB33F8B1E2106F30039F711 /* URL.swift */, - 3A2362FA1E2D33A0007E08F1 /* Date.swift */, - 3A7A28D81E2F7410003E2B8D /* UIImage.swift */, ); name = Extensions; sourceTree = ""; @@ -141,7 +148,7 @@ isa = PBXGroup; children = ( 3AB33F801E1FDE100039F711 /* Webservice.swift */, - 3AB33F971E22A0080039F711 /* PX500Convenience.swift */, + 3AB33F971E22A0080039F711 /* ParseResponse.swift */, ); name = Client; sourceTree = ""; @@ -191,6 +198,16 @@ name = Pods; sourceTree = ""; }; + 9D4DFC5A20E1DF660067C960 /* OrderedDictionary */ = { + isa = PBXGroup; + children = ( + 9D4DFC5B20E1DF660067C960 /* OrderedDictionary+Codable.swift */, + 9D4DFC5C20E1DF660067C960 /* OrderedDictionary.swift */, + 9D4DFC5D20E1DF660067C960 /* OrderedDictionary+Description.swift */, + ); + path = OrderedDictionary; + sourceTree = ""; + }; A7DD645D70CF34C7CA3B1A8B /* Frameworks */ = { isa = PBXGroup; children = ( @@ -211,7 +228,6 @@ 3AB33F571E1F94520039F711 /* Frameworks */, 3AB33F581E1F94520039F711 /* Resources */, 154783123A953C3AFB9805CF /* [CP] Embed Pods Frameworks */, - 07D25AC7E9C9518F14F0C929 /* [CP] Copy Pods Resources */, 3A7BEDD71E254278005769D4 /* ShellScript */, ); buildRules = ( @@ -272,21 +288,6 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 07D25AC7E9C9518F14F0C929 /* [CP] Copy Pods Resources */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "[CP] Copy Pods Resources"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-ASDKgram-Swift/Pods-ASDKgram-Swift-resources.sh\"\n"; - showEnvVarsInLog = 0; - }; 154783123A953C3AFB9805CF /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -352,14 +353,17 @@ 3AB33F781E1F9C400039F711 /* PhotoFeedTableNodeController.swift in Sources */, 3A2362FB1E2D33A0007E08F1 /* Date.swift in Sources */, 3AB33F7B1E1F9E630039F711 /* UIColor.swift in Sources */, - 3AB33F981E22A0080039F711 /* PX500Convenience.swift in Sources */, + 3AB33F981E22A0080039F711 /* ParseResponse.swift in Sources */, + 692CD06E20E1A40D00D9B963 /* NumberFormatter.swift in Sources */, 3AB33FA41E2337850039F711 /* PhotoTableNodeCell.swift in Sources */, 3AB33FA21E230A160039F711 /* NetworkImageView.swift in Sources */, + 9D4DFC6020E1DF660067C960 /* OrderedDictionary+Description.swift in Sources */, 3AB33F8C1E2106F30039F711 /* URL.swift in Sources */, 3AB33F831E20E81E0039F711 /* Constants.swift in Sources */, + 9D4DFC5F20E1DF660067C960 /* OrderedDictionary.swift in Sources */, 3AB33F961E2269D40039F711 /* PopularPageModel.swift in Sources */, - 3A7A28D91E2F7410003E2B8D /* UIImage.swift in Sources */, 3AB33F5E1E1F94530039F711 /* AppDelegate.swift in Sources */, + 9D4DFC5E20E1DF660067C960 /* OrderedDictionary+Codable.swift in Sources */, 3AB33F811E1FDE100039F711 /* Webservice.swift in Sources */, 3AB33F9E1E22D9DB0039F711 /* PhotoTableViewCell.swift in Sources */, 3AB33F861E20E9B10039F711 /* PhotoFeedModel.swift in Sources */, diff --git a/examples_extra/ASDKgram-Swift/ASDKgram-Swift.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/examples_extra/ASDKgram-Swift/ASDKgram-Swift.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000000..18d981003d --- /dev/null +++ b/examples_extra/ASDKgram-Swift/ASDKgram-Swift.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/examples_extra/ASDKgram-Swift/ASDKgram-Swift/AppDelegate.swift b/examples_extra/ASDKgram-Swift/ASDKgram-Swift/AppDelegate.swift index 886d28ca70..990773f687 100644 --- a/examples_extra/ASDKgram-Swift/ASDKgram-Swift/AppDelegate.swift +++ b/examples_extra/ASDKgram-Swift/ASDKgram-Swift/AppDelegate.swift @@ -1,20 +1,10 @@ // // AppDelegate.swift -// ASDKgram-Swift +// Texture // -// Created by Calum Harris on 06/01/2017. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // import UIKit @@ -42,11 +32,11 @@ class AppDelegate: UIResponder, UIApplicationDelegate { let tabBarController = UITabBarController() tabBarController.viewControllers = [UIKitNavController, ASDKNavController] tabBarController.selectedIndex = 1 - tabBarController.tabBar.tintColor = UIColor.mainBarTintColor() + tabBarController.tabBar.tintColor = UIColor.mainBarTintColor // Nav Bar appearance - UINavigationBar.appearance().barTintColor = UIColor.mainBarTintColor() + UINavigationBar.appearance().barTintColor = UIColor.mainBarTintColor // UIWindow diff --git a/examples_extra/ASDKgram-Swift/ASDKgram-Swift/Constants.swift b/examples_extra/ASDKgram-Swift/ASDKgram-Swift/Constants.swift index f85bb817fe..f4da709f26 100644 --- a/examples_extra/ASDKgram-Swift/ASDKgram-Swift/Constants.swift +++ b/examples_extra/ASDKgram-Swift/ASDKgram-Swift/Constants.swift @@ -1,36 +1,25 @@ // -// Constants -// ASDKgram-Swift +// Constants.swift +// Texture // -// Created by Calum Harris on 07/01/2017. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// swiftlint:disable nesting import UIKit struct Constants { - - struct PX500 { - struct URLS { - static let Host = "https://api.500px.com/v1/" - static let PopularEndpoint = "photos?feature=popular&exclude=Nude,People,Fashion&sort=rating&image_size=3&include_store=store_download&include_states=voted" - static let SearchEndpoint = "photos/search?geo=" //latitude,longitude,radius - static let UserEndpoint = "photos?user_id=" - static let ConsumerKey = "&consumer_key=Fi13GVb8g53sGvHICzlram7QkKOlSDmAmp9s9aqC" - } - } + struct Unsplash { + struct URLS { + static let Host = "https://api.unsplash.com/" + static let PopularEndpoint = "photos?order_by=popular" + static let SearchEndpoint = "photos/search?geo=" //latitude,longitude,radius + static let UserEndpoint = "photos?user_id=" + static let ConsumerKey = "&client_id=3b99a69cee09770a4a0bbb870b437dbda53efb22f6f6de63714b71c4df7c9642" + static let ImagesPerPage = 30 + } + } struct CellLayout { static let FontSize: CGFloat = 14 diff --git a/examples_extra/ASDKgram-Swift/ASDKgram-Swift/Date.swift b/examples_extra/ASDKgram-Swift/ASDKgram-Swift/Date.swift index 0d7cde2d3d..d367584b10 100644 --- a/examples_extra/ASDKgram-Swift/ASDKgram-Swift/Date.swift +++ b/examples_extra/ASDKgram-Swift/ASDKgram-Swift/Date.swift @@ -1,26 +1,15 @@ // // Date.swift -// ASDKgram-Swift +// Texture // -// Created by Calum Harris on 16/01/2017. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // import Foundation extension Date { - static let iso8601Formatter: DateFormatter = { let formatter = DateFormatter() formatter.calendar = Calendar(identifier: .iso8601) @@ -29,4 +18,22 @@ extension Date { formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ssZZZZZ" return formatter }() + + static func timeStringSince(fromConverted date: Date) -> String { + let diffDates = NSCalendar.current.dateComponents([.day, .hour, .second], from: date, to: Date()) + + if let week = diffDates.day, week > 7 { + return "\(week / 7)w" + } else if let day = diffDates.day, day > 0 { + return "\(day)d" + } else if let hour = diffDates.hour, hour > 0 { + return "\(hour)h" + } else if let second = diffDates.second, second > 0 { + return "\(second)s" + } else if let zero = diffDates.second, zero == 0 { + return "1s" + } else { + return "ERROR" + } + } } diff --git a/examples_extra/ASDKgram-Swift/ASDKgram-Swift/NetworkImageView.swift b/examples_extra/ASDKgram-Swift/ASDKgram-Swift/NetworkImageView.swift index aeb860d8aa..937f87fadf 100644 --- a/examples_extra/ASDKgram-Swift/ASDKgram-Swift/NetworkImageView.swift +++ b/examples_extra/ASDKgram-Swift/ASDKgram-Swift/NetworkImageView.swift @@ -1,20 +1,10 @@ // // NetworkImageView.swift -// ASDKgram-Swift +// Texture // -// Created by Calum Harris on 09/01/2017. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // import UIKit diff --git a/examples_extra/ASDKgram-Swift/ASDKgram-Swift/NumberFormatter.swift b/examples_extra/ASDKgram-Swift/ASDKgram-Swift/NumberFormatter.swift new file mode 100644 index 0000000000..246f398b94 --- /dev/null +++ b/examples_extra/ASDKgram-Swift/ASDKgram-Swift/NumberFormatter.swift @@ -0,0 +1,18 @@ +// +// NumberFormatter.swift +// Texture +// +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 +// + +import Foundation + +extension NumberFormatter { + static let decimalNumberFormatter: NumberFormatter = { + let formatter = NumberFormatter() + formatter.numberStyle = .decimal + return formatter + }() +} diff --git a/examples_extra/ASDKgram-Swift/ASDKgram-Swift/OrderedDictionary/OrderedDictionary+Codable.swift b/examples_extra/ASDKgram-Swift/ASDKgram-Swift/OrderedDictionary/OrderedDictionary+Codable.swift new file mode 100644 index 0000000000..45e5de48f7 --- /dev/null +++ b/examples_extra/ASDKgram-Swift/ASDKgram-Swift/OrderedDictionary/OrderedDictionary+Codable.swift @@ -0,0 +1,142 @@ +// +// OrderedDictionary+Codable.swift +// Texture +// +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 +// + +#if swift(>=4.1) + +extension OrderedDictionary: Encodable where Key: Encodable, Value: Encodable { + + /// __inheritdoc__ + public func encode(to encoder: Encoder) throws { + // Encode the ordered dictionary as an array of alternating key-value pairs. + var container = encoder.unkeyedContainer() + + for (key, value) in self { + try container.encode(key) + try container.encode(value) + } + } + +} + +extension OrderedDictionary: Decodable where Key: Decodable, Value: Decodable { + + /// __inheritdoc__ + public init(from decoder: Decoder) throws { + // Decode the ordered dictionary from an array of alternating key-value pairs. + self.init() + + var container = try decoder.unkeyedContainer() + + while !container.isAtEnd { + let key = try container.decode(Key.self) + guard !container.isAtEnd else { throw DecodingError.unkeyedContainerReachedEndBeforeValue(decoder.codingPath) } + let value = try container.decode(Value.self) + + self[key] = value + } + } + +} + +#else + +extension OrderedDictionary: Encodable { + + /// __inheritdoc__ + public func encode(to encoder: Encoder) throws { + // Since Swift 4.0 lacks the protocol conditional conformance support, we have to make the + // whole OrderedDictionary type conform to Encodable and assert that the key and value + // types conform to Encodable. Furthermore, we leverage a trick of super encoders to be + // able to encode objects without knowing their exact types. This trick was used in the + // standard library for encoding/decoding Dictionary before Swift 4.1. + + _assertTypeIsEncodable(Key.self, in: type(of: self)) + _assertTypeIsEncodable(Value.self, in: type(of: self)) + + var container = encoder.unkeyedContainer() + + for (key, value) in self { + let keyEncoder = container.superEncoder() + try (key as! Encodable).encode(to: keyEncoder) + + let valueEncoder = container.superEncoder() + try (value as! Encodable).encode(to: valueEncoder) + } + } + + private func _assertTypeIsEncodable(_ type: T.Type, in wrappingType: Any.Type) { + guard T.self is Encodable.Type else { + if T.self == Encodable.self || T.self == Codable.self { + preconditionFailure("\(wrappingType) does not conform to Encodable because Encodable does not conform to itself. You must use a concrete type to encode or decode.") + } else { + preconditionFailure("\(wrappingType) does not conform to Encodable because \(T.self) does not conform to Encodable.") + } + } + } + +} + +extension OrderedDictionary: Decodable { + + /// __inheritdoc__ + public init(from decoder: Decoder) throws { + // Since Swift 4.0 lacks the protocol conditional conformance support, we have to make the + // whole OrderedDictionary type conform to Decodable and assert that the key and value + // types conform to Decodable. Furthermore, we leverage a trick of super decoders to be + // able to decode objects without knowing their exact types. This trick was used in the + // standard library for encoding/decoding Dictionary before Swift 4.1. + + self.init() + + _assertTypeIsDecodable(Key.self, in: type(of: self)) + _assertTypeIsDecodable(Value.self, in: type(of: self)) + + var container = try decoder.unkeyedContainer() + + let keyMetaType = (Key.self as! Decodable.Type) + let valueMetaType = (Value.self as! Decodable.Type) + + while !container.isAtEnd { + let keyDecoder = try container.superDecoder() + let key = try keyMetaType.init(from: keyDecoder) as! Key + + guard !container.isAtEnd else { throw DecodingError.unkeyedContainerReachedEndBeforeValue(decoder.codingPath) } + + let valueDecoder = try container.superDecoder() + let value = try valueMetaType.init(from: valueDecoder) as! Value + + self[key] = value + } + } + + private func _assertTypeIsDecodable(_ type: T.Type, in wrappingType: Any.Type) { + guard T.self is Decodable.Type else { + if T.self == Decodable.self || T.self == Codable.self { + preconditionFailure("\(wrappingType) does not conform to Decodable because Decodable does not conform to itself. You must use a concrete type to encode or decode.") + } else { + preconditionFailure("\(wrappingType) does not conform to Decodable because \(T.self) does not conform to Decodable.") + } + } + } + +} + +#endif + +fileprivate extension DecodingError { + + fileprivate static func unkeyedContainerReachedEndBeforeValue(_ codingPath: [CodingKey]) -> DecodingError { + return DecodingError.dataCorrupted( + DecodingError.Context( + codingPath: codingPath, + debugDescription: "Unkeyed container reached end before value in key-value pair." + ) + ) + } + +} diff --git a/examples_extra/ASDKgram-Swift/ASDKgram-Swift/OrderedDictionary/OrderedDictionary+Description.swift b/examples_extra/ASDKgram-Swift/ASDKgram-Swift/OrderedDictionary/OrderedDictionary+Description.swift new file mode 100644 index 0000000000..604dbac119 --- /dev/null +++ b/examples_extra/ASDKgram-Swift/ASDKgram-Swift/OrderedDictionary/OrderedDictionary+Description.swift @@ -0,0 +1,58 @@ +// +// OrderedDictionary+Description.swift +// Texture +// +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 +// + +extension OrderedDictionary: CustomStringConvertible { + + /// A textual representation of the ordered dictionary. + public var description: String { + return makeDescription(debug: false) + } + +} + +extension OrderedDictionary: CustomDebugStringConvertible { + + /// A textual representation of the ordered dictionary, suitable for debugging. + public var debugDescription: String { + return makeDescription(debug: true) + } + +} + +extension OrderedDictionary { + + fileprivate func makeDescription(debug: Bool) -> String { + // The implementation of the description is inspired by zwaldowski's implementation of the + // ordered dictionary. See http://bit.ly/2iqGhrb + + if isEmpty { return "[:]" } + + let printFunction: (Any, inout String) -> () = { + if debug { + return { debugPrint($0, separator: "", terminator: "", to: &$1) } + } else { + return { print($0, separator: "", terminator: "", to: &$1) } + } + }() + + let descriptionForItem: (Any) -> String = { item in + var description = "" + printFunction(item, &description) + return description + } + + let bodyComponents = map { element in + return descriptionForItem(element.key) + ": " + descriptionForItem(element.value) + } + + let body = bodyComponents.joined(separator: ", ") + + return "[\(body)]" + } + +} diff --git a/examples_extra/ASDKgram-Swift/ASDKgram-Swift/OrderedDictionary/OrderedDictionary.swift b/examples_extra/ASDKgram-Swift/ASDKgram-Swift/OrderedDictionary/OrderedDictionary.swift new file mode 100644 index 0000000000..38bb9853f2 --- /dev/null +++ b/examples_extra/ASDKgram-Swift/ASDKgram-Swift/OrderedDictionary/OrderedDictionary.swift @@ -0,0 +1,618 @@ +// +// OrderedDictionary.swift +// Texture +// +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 +// + +/// A generic collection for storing key-value pairs in an ordered manner. +/// +/// Same as in a dictionary all keys in the collection are unique and have an associated value. +/// Same as in an array, all key-value pairs (elements) are kept sorted and accessible by +/// a zero-based integer index. +public struct OrderedDictionary: BidirectionalCollection { + + // ======================================================= // + // MARK: - Type Aliases + // ======================================================= // + + /// The type of the key-value pair stored in the ordered dictionary. + public typealias Element = (key: Key, value: Value) + + /// The type of the index. + public typealias Index = Int + + /// The type of the indices collection. + public typealias Indices = CountableRange + + /// The type of the contiguous subrange of the ordered dictionary's elements. + /// + /// - SeeAlso: OrderedDictionarySlice + public typealias SubSequence = OrderedDictionarySlice + + // ======================================================= // + // MARK: - Initialization + // ======================================================= // + + /// Creates an empty ordered dictionary. + public init() {} + + /// Creates an ordered dictionary from a sequence of values keyed by a key which gets extracted + /// from the value in the provided closure. + /// + /// - Parameter values: The sequence of values. + /// - Parameter getKey: The closure which provides a key for the given value from the values + /// sequence. + public init(values: Values, keyedBy getKey: (Value) -> Key) where Values.Element == Value { + self.init(values.map { (getKey($0), $0) }) + } + + /// Creates an ordered dictionary from a sequence of values keyed by a key loaded from the value + /// at the given key path. + /// + /// - Parameter values: The sequence of values. + /// - Parameter keyPath: The key path for the value to locate its key at. + public init(values: [Value], keyedBy keyPath: KeyPath) { + self.init(values.map { ($0[keyPath: keyPath], $0) }) + } + + /// Creates an ordered dictionary from a regular unsorted dictionary by sorting it using the + /// the given sort function. + /// + /// - Parameter unsorted: The unsorted dictionary. + /// - Parameter areInIncreasingOrder: The sort function which compares the key-value pairs. + public init(unsorted: Dictionary, areInIncreasingOrder: (Element, Element) -> Bool) { + let elements = unsorted + .map { (key: $0.key, value: $0.value) } + .sorted(by: areInIncreasingOrder) + + self.init(elements) + } + + /// Creates an ordered dictionary from a sequence of key-value pairs. + /// + /// - Parameter elements: The key-value pairs that will make up the new ordered dictionary. + /// Each key in `elements` must be unique. + public init(_ elements: S) where S.Element == Element { + for (key, value) in elements { + precondition(!containsKey(key), "Elements sequence contains duplicate keys") + self[key] = value + } + } + + // ======================================================= // + // MARK: - Ordered Keys & Values + // ======================================================= // + + /// A collection containing just the keys of the ordered dictionary in the correct order. + public var orderedKeys: OrderedDictionaryKeys { + return self.lazy.map { $0.key } + } + + /// A collection containing just the values of the ordered dictionary in the correct order. + public var orderedValues: OrderedDictionaryValues { + return self.lazy.map { $0.value } + } + + // ======================================================= // + // MARK: - Dictionary + // ======================================================= // + + /// Converts itself to a common unsorted dictionary. + public var unorderedDictionary: Dictionary { + return _keysToValues + } + + // ======================================================= // + // MARK: - Key-based Access + // ======================================================= // + + /// Accesses the value associated with the given key for reading and writing. + /// + /// This key-based subscript returns the value for the given key if the key is found in the + /// ordered dictionary, or `nil` if the key is not found. + /// + /// When you assign a value for a key and that key already exists, the ordered dictionary + /// overwrites the existing value and preservers the index of the key-value pair. If the ordered + /// dictionary does not contain the key, a new key-value pair is appended to the end of the + /// ordered dictionary. + /// + /// If you assign `nil` as the value for the given key, the ordered dictionary removes that key + /// and its associated value if it exists. + /// + /// - Parameter key: The key to find in the ordered dictionary. + /// - Returns: The value associated with `key` if `key` is in the ordered dictionary; otherwise, + /// `nil`. + public subscript(key: Key) -> Value? { + get { + return value(forKey: key) + } + set(newValue) { + if let newValue = newValue { + updateValue(newValue, forKey: key) + } else { + removeValue(forKey: key) + } + } + } + + /// Returns a Boolean value indicating whether the ordered dictionary contains the given key. + /// + /// - Parameter key: The key to be looked up. + /// - Returns: `true` if the ordered dictionary contains the given key; otherwise, `false`. + public func containsKey(_ key: Key) -> Bool { + return _keysToValues[key] != nil + } + + /// Returns the value associated with the given key if the key is found in the ordered + /// dictionary, or `nil` if the key is not found. + /// + /// - Parameter key: The key to find in the ordered dictionary. + /// - Returns: The value associated with `key` if `key` is in the ordered dictionary; otherwise, + /// `nil`. + public func value(forKey key: Key) -> Value? { + return _keysToValues[key] + } + + /// Updates the value stored in the ordered dictionary for the given key, or appends a new + /// key-value pair if the key does not exist. + /// + /// - Parameter value: The new value to add to the ordered dictionary. + /// - Parameter key: The key to associate with `value`. If `key` already exists in the ordered + /// dictionary, `value` replaces the existing associated value. If `key` is not already a key + /// of the ordered dictionary, the `(key, value)` pair is appended at the end of the ordered + /// dictionary. + @discardableResult + public mutating func updateValue(_ value: Value, forKey key: Key) -> Value? { + if containsKey(key) { + let currentValue = _unsafeValue(forKey: key) + + _keysToValues[key] = value + + return currentValue + } else { + _orderedKeys.append(key) + _keysToValues[key] = value + + return nil + } + } + + /// Removes the given key and its associated value from the ordered dictionary. + /// + /// If the key is found in the ordered dictionary, this method returns the key's associated + /// value. On removal, the indices of the ordered dictionary are invalidated. If the key is + /// not found in the ordered dictionary, this method returns `nil`. + /// + /// - Parameter key: The key to remove along with its associated value. + /// - Returns: The value that was removed, or `nil` if the key was not present in the + /// ordered dictionary. + /// + /// - SeeAlso: remove(at:) + @discardableResult + public mutating func removeValue(forKey key: Key) -> Value? { + guard let index = index(forKey: key) else { return nil } + + let currentValue = self[index].value + + _orderedKeys.remove(at: index) + _keysToValues[key] = nil + + return currentValue + } + + /// Removes all key-value pairs from the ordered dictionary and invalidates all indices. + /// + /// - Parameter keepCapacity: Whether the ordered dictionary should keep its underlying storage. + /// If you pass `true`, the operation preserves the storage capacity that the collection has, + /// otherwise the underlying storage is released. The default is `false`. + public mutating func removeAll(keepingCapacity keepCapacity: Bool = false) { + _orderedKeys.removeAll(keepingCapacity: keepCapacity) + _keysToValues.removeAll(keepingCapacity: keepCapacity) + } + + private func _unsafeValue(forKey key: Key) -> Value { + let value = _keysToValues[key] + precondition(value != nil, "Inconsistency error occurred in OrderedDictionary") + return value! + } + + // ======================================================= // + // MARK: - Index-based Access + // ======================================================= // + + /// Accesses the key-value pair at the specified position. + /// + /// The specified position has to be a valid index of the ordered dictionary. The index-base + /// subscript returns the key-value pair corresponding to the index. + /// + /// - Parameter position: The position of the key-value pair to access. `position` must be + /// a valid index of the ordered dictionary and not equal to `endIndex`. + /// - Returns: A tuple containing the key-value pair corresponding to `position`. + /// + /// - SeeAlso: update(:at:) + public subscript(position: Index) -> Element { + precondition(indices.contains(position), "OrderedDictionary index is out of range") + + let key = _orderedKeys[position] + let value = _unsafeValue(forKey: key) + + return (key, value) + } + + /// Returns the index for the given key. + /// + /// - Parameter key: The key to find in the ordered dictionary. + /// - Returns: The index for `key` and its associated value if `key` is in the ordered + /// dictionary; otherwise, `nil`. + public func index(forKey key: Key) -> Index? { + return _orderedKeys.index(of: key) + } + + /// Returns the key-value pair at the specified index, or `nil` if there is no key-value pair + /// at that index. + /// + /// - Parameter index: The index of the key-value pair to be looked up. `index` does not have to + /// be a valid index. + /// - Returns: A tuple containing the key-value pair corresponding to `index` if the index is + /// valid; otherwise, `nil`. + public func elementAt(_ index: Index) -> Element? { + return indices.contains(index) ? self[index] : nil + } + + /// Checks whether the given key-value pair can be inserted into to ordered dictionary by + /// validating the presence of the key. + /// + /// - Parameter newElement: The key-value pair to be inserted into the ordered dictionary. + /// - Returns: `true` if the key-value pair can be safely inserted; otherwise, `false`. + /// + /// - SeeAlso: canInsert(key:) + /// - SeeAlso: canInsert(at:) + @available(*, deprecated, message: "Use canInsert(key:) with the element's key instead") + public func canInsert(_ newElement: Element) -> Bool { + return canInsert(key: newElement.key) + } + + /// Checks whether a key-value pair with the given key can be inserted into the ordered + /// dictionary by validating its presence. + /// + /// - Parameter key: The key to be inserted into the ordered dictionary. + /// - Returns: `true` if the key can safely be inserted; ortherwise, `false`. + /// + /// - SeeAlso: canInsert(at:) + public func canInsert(key: Key) -> Bool { + return !containsKey(key) + } + + /// Checks whether a new key-value pair can be inserted into the ordered dictionary at the + /// given index. + /// + /// - Parameter index: The index the new key-value pair should be inserted at. + /// - Returns: `true` if a new key-value pair can be inserted at the specified index; otherwise, + /// `false`. + /// + /// - SeeAlso: canInsert(key:) + public func canInsert(at index: Index) -> Bool { + return index >= startIndex && index <= endIndex + } + + /// Inserts a new key-value pair at the specified position. + /// + /// If the key of the inserted pair already exists in the ordered dictionary, a runtime error + /// is triggered. Use `canInsert(_:)` for performing a check first, so that this method can + /// be executed safely. + /// + /// - Parameter newElement: The new key-value pair to insert into the ordered dictionary. The + /// key contained in the pair must not be already present in the ordered dictionary. + /// - Parameter index: The position at which to insert the new key-value pair. `index` must be + /// a valid index of the ordered dictionary or equal to `endIndex` property. + /// + /// - SeeAlso: canInsert(key:) + /// - SeeAlso: canInsert(at:) + /// - SeeAlso: update(:at:) + public mutating func insert(_ newElement: Element, at index: Index) { + precondition(canInsert(key: newElement.key), "Cannot insert duplicate key in OrderedDictionary") + precondition(canInsert(at: index), "Cannot insert at invalid index in OrderedDictionary") + + let (key, value) = newElement + + _orderedKeys.insert(key, at: index) + _keysToValues[key] = value + } + + /// Checks whether the key-value pair at the given index can be updated with the given key-value + /// pair. This is not the case if the key of the updated element is already present in the + /// ordered dictionary and located at another index than the updated one. + /// + /// Although this is a checking method, a valid index has to be provided. + /// + /// - Parameter newElement: The key-value pair to be set at the specified position. + /// - Parameter index: The position at which to set the key-value pair. `index` must be a valid + /// index of the ordered dictionary. + public func canUpdate(_ newElement: Element, at index: Index) -> Bool { + var keyPresentAtIndex = false + return _canUpdate(newElement, at: index, keyPresentAtIndex: &keyPresentAtIndex) + } + + /// Updates the key-value pair located at the specified position. + /// + /// If the key of the updated pair already exists in the ordered dictionary *and* is located at + /// a different position than the specified one, a runtime error is triggered. Use + /// `canUpdate(_:at:)` for performing a check first, so that this method can be executed safely. + /// + /// - Parameter newElement: The key-value pair to be set at the specified position. + /// - Parameter index: The position at which to set the key-value pair. `index` must be a valid + /// index of the ordered dictionary. + /// + /// - SeeAlso: canUpdate(_:at:) + /// - SeeAlso: insert(:at:) + @discardableResult + public mutating func update(_ newElement: Element, at index: Index) -> Element? { + // Store the flag indicating whether the key of the inserted element + // is present at the updated index + var keyPresentAtIndex = false + + precondition( + _canUpdate(newElement, at: index, keyPresentAtIndex: &keyPresentAtIndex), + "OrderedDictionary update duplicates key" + ) + + // Decompose the element + let (key, value) = newElement + + // Load the current element at the index + let replacedElement = self[index] + + // If its key differs, remove its associated value + if (!keyPresentAtIndex) { + _keysToValues.removeValue(forKey: replacedElement.key) + } + + // Store the new position of the key and the new value associated with the key + _orderedKeys[index] = key + _keysToValues[key] = value + + return replacedElement + } + + /// Removes and returns the key-value pair at the specified position if there is any key-value + /// pair, or `nil` if there is none. + /// + /// - Parameter index: The position of the key-value pair to remove. + /// - Returns: The element at the specified index, or `nil` if the position is not taken. + /// + /// - SeeAlso: removeValue(forKey:) + @discardableResult + public mutating func remove(at index: Index) -> Element? { + guard let element = elementAt(index) else { return nil } + + _orderedKeys.remove(at: index) + _keysToValues.removeValue(forKey: element.key) + + return element + } + + private func _canUpdate(_ newElement: Element, at index: Index, keyPresentAtIndex: inout Bool) -> Bool { + precondition(indices.contains(index), "OrderedDictionary index is out of range") + + let currentIndexOfKey = self.index(forKey: newElement.key) + + let keyNotPresent = currentIndexOfKey == nil + keyPresentAtIndex = currentIndexOfKey == index + + return keyNotPresent || keyPresentAtIndex + } + + // ======================================================= // + // MARK: - Moving Elements + // ======================================================= // + + /// Moves an existing key-value pair specified by the given key to the new index by removing it + /// from its original index first and inserting it at the new index. If the movement is + /// actually performed, the previous index of the key-value pair is returned. Otherwise, `nil` + /// is returned. + /// + /// - Parameter key: The key specifying the key-value pair to move. + /// - Parameter newIndex: The new index the key-value pair should be moved to. + /// - Returns: The previous index of the key-value pair if it was sucessfully moved. + @discardableResult + public mutating func moveElement(forKey key: Key, to newIndex: Index) -> Index? { + // Load the previous index and return nil if the index is not found. + guard let previousIndex = index(forKey: key) else { return nil } + + // If the previous and new indices match, threat it as if the movement was already + // performed. + guard previousIndex != newIndex else { return previousIndex } + + // Remove the value for the key at its original index. + let value = removeValue(forKey: key)! + + // Validate the new index. + precondition(canInsert(at: newIndex), "Cannot move to invalid index in OrderedDictionary") + + // Insert the element at the new index. + insert((key: key, value: value), at: newIndex) + + return previousIndex + } + + // ======================================================= // + // MARK: - Sorting Elements + // ======================================================= // + + /// Sorts the ordered dictionary in place, using the given predicate as the comparison between + /// elements. + /// + /// The predicate must be a *strict weak ordering* over the elements. + /// + /// - Parameter areInIncreasingOrder: A predicate that returns `true` if its first argument + /// should be ordered before its second argument; otherwise, `false`. + /// + /// - SeeAlso: MutableCollection.sort(by:), sorted(by:) + public mutating func sort(by areInIncreasingOrder: (Element, Element) -> Bool) { + _orderedKeys = _sortedElements(by: areInIncreasingOrder).map { $0.key } + } + + /// Returns a new ordered dictionary, sorted using the given predicate as the comparison between + /// elements. + /// + /// The predicate must be a *strict weak ordering* over the elements. + /// + /// - Parameter areInIncreasingOrder: A predicate that returns `true` if its first argument + /// should be ordered before its second argument; otherwise, `false`. + /// - Returns: A new ordered dictionary sorted according to the predicate. + /// + /// - SeeAlso: MutableCollection.sorted(by:), sort(by:) + /// - MutatingVariant: sort + public func sorted(by areInIncreasingOrder: (Element, Element) -> Bool) -> OrderedDictionary { + return OrderedDictionary(_sortedElements(by: areInIncreasingOrder)) + } + + private func _sortedElements(by areInIncreasingOrder: (Element, Element) -> Bool) -> [Element] { + return sorted(by: areInIncreasingOrder) + } + + // ======================================================= // + // MARK: - Slices + // ======================================================= // + + /// Accesses a contiguous subrange of the ordered dictionary. + /// + /// - Parameter bounds: A range of the ordered dictionary's indices. The bounds of the range + /// must be valid indices of the ordered dictionary. + /// - Returns: The slice view at the ordered dictionary in the specified subrange. + public subscript(bounds: Range) -> SubSequence { + return OrderedDictionarySlice(base: self, bounds: bounds) + } + + // ======================================================= // + // MARK: - Indices + // ======================================================= // + + /// The indices that are valid for subscripting the ordered dictionary. + public var indices: Indices { + return _orderedKeys.indices + } + + /// The position of the first key-value pair in a non-empty ordered dictionary. + public var startIndex: Index { + return _orderedKeys.startIndex + } + + /// The position which is one greater than the position of the last valid key-value pair in the + /// ordered dictionary. + public var endIndex: Index { + return _orderedKeys.endIndex + } + + /// Returns the position immediately after the given index. + public func index(after i: Index) -> Index { + return _orderedKeys.index(after: i) + } + + /// Returns the position immediately before the given index. + public func index(before i: Index) -> Index { + return _orderedKeys.index(before: i) + } + + // ======================================================= // + // MARK: - Internal Storage + // ======================================================= // + + /// The backing storage for the ordered keys. + fileprivate var _orderedKeys = [Key]() + + /// The backing storage for the mapping of keys to values. + fileprivate var _keysToValues = [Key: Value]() + +} + +// ======================================================= // +// MARK: - Subtypes +// ======================================================= // + +#if swift(>=4.1) + +/// A view into an ordered dictionary whose indices are a subrange of the indices of the ordered +/// dictionary. +public typealias OrderedDictionarySlice = Slice> + +/// A collection containing the keys of the ordered dictionary. +/// +/// Under the hood this is a lazily evaluated bidirectional collection deriving the keys from +/// the base ordered dictionary on-the-fly. +public typealias OrderedDictionaryKeys = LazyMapCollection, Key> + +/// A collection containing the values of the ordered dictionary. +/// +/// Under the hood this is a lazily evaluated bidirectional collection deriving the values from +/// the base ordered dictionary on-the-fly. +public typealias OrderedDictionaryValues = LazyMapCollection, Value> + +#else + +/// A view into an ordered dictionary whose indices are a subrange of the indices of the ordered +/// dictionary. +public typealias OrderedDictionarySlice = Slice> + +/// A collection containing the keys of the ordered dictionary. +/// +/// Under the hood this is a lazily evaluated bidirectional collection deriving the keys from +/// the base ordered dictionary on-the-fly. +public typealias OrderedDictionaryKeys = LazyMapCollection, Key> + +/// A collection containing the values of the ordered dictionary. +/// +/// Under the hood this is a lazily evaluated bidirectional collection deriving the values from +/// the base ordered dictionary on-the-fly. +public typealias OrderedDictionaryValues = LazyMapCollection, Value> + +#endif + +// ======================================================= // +// MARK: - Literals +// ======================================================= // + +extension OrderedDictionary: ExpressibleByArrayLiteral { + + /// Creates an ordered dictionary initialized from an array literal containing a list of + /// key-value pairs. + public init(arrayLiteral elements: Element...) { + self.init(elements) + } + +} + +extension OrderedDictionary: ExpressibleByDictionaryLiteral { + + /// Creates an ordered dictionary initialized from a dictionary literal. + public init(dictionaryLiteral elements: (Key, Value)...) { + self.init(elements.map { element in + let (key, value) = element + return (key: key, value: value) + }) + } + +} + +// ======================================================= // +// MARK: - Equatable Conformance +// ======================================================= // + +#if swift(>=4.1) + +extension OrderedDictionary: Equatable where Value: Equatable {} + +#endif + +extension OrderedDictionary where Value: Equatable { + + /// Returns a Boolean value that indicates whether the two given ordered dictionaries with + /// equatable values are equal. + public static func == (lhs: OrderedDictionary, rhs: OrderedDictionary) -> Bool { + return lhs._orderedKeys == rhs._orderedKeys + && lhs._keysToValues == rhs._keysToValues + } + +} diff --git a/examples_extra/ASDKgram-Swift/ASDKgram-Swift/PX500Convenience.swift b/examples_extra/ASDKgram-Swift/ASDKgram-Swift/PX500Convenience.swift index 808a553d14..a8754d695b 100644 --- a/examples_extra/ASDKgram-Swift/ASDKgram-Swift/PX500Convenience.swift +++ b/examples_extra/ASDKgram-Swift/ASDKgram-Swift/PX500Convenience.swift @@ -1,20 +1,10 @@ // // PX500Convenience.swift -// ASDKgram-Swift +// Texture // -// Created by Calum Harris on 08/01/2017. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // import Foundation diff --git a/examples_extra/ASDKgram-Swift/ASDKgram-Swift/ParseResponse.swift b/examples_extra/ASDKgram-Swift/ASDKgram-Swift/ParseResponse.swift new file mode 100644 index 0000000000..0870651e89 --- /dev/null +++ b/examples_extra/ASDKgram-Swift/ASDKgram-Swift/ParseResponse.swift @@ -0,0 +1,23 @@ +// +// ParseResponse.swift +// Texture +// +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 +// + +import Foundation + +func parsePopularPage(withURL: URL, page: Int) -> Resource { + let parse = Resource(url: withURL, page: page) { metaData, jsonData in + do { + let photos = try JSONDecoder().decode([PhotoModel].self, from: jsonData) + return .success(PopularPageModel(metaData: metaData, photos: photos)) + } catch { + return .failure(.errorParsingJSON) + } + } + + return parse +} diff --git a/examples_extra/ASDKgram-Swift/ASDKgram-Swift/PhotoFeedModel.swift b/examples_extra/ASDKgram-Swift/ASDKgram-Swift/PhotoFeedModel.swift index f344df34a7..edfe37ff37 100644 --- a/examples_extra/ASDKgram-Swift/ASDKgram-Swift/PhotoFeedModel.swift +++ b/examples_extra/ASDKgram-Swift/ASDKgram-Swift/PhotoFeedModel.swift @@ -1,117 +1,107 @@ // // PhotoFeedModel.swift -// ASDKgram-Swift +// Texture // -// Created by Calum Harris on 07/01/2017. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // import UIKit final class PhotoFeedModel { + + // MARK: Properties public private(set) var photoFeedModelType: PhotoFeedModelType - public private(set) var photos: [PhotoModel] = [] - public private(set) var imageSize: CGSize - private var url: URL - private var ids: [Int] = [] + + private var orderedPhotos: OrderedDictionary = [:] private var currentPage: Int = 0 private var totalPages: Int = 0 - public private(set) var totalItems: Int = 0 + private var totalItems: Int = 0 private var fetchPageInProgress: Bool = false - private var refreshFeedInProgress: Bool = false - init(initWithPhotoFeedModelType: PhotoFeedModelType, requiredImageSize: CGSize) { - self.photoFeedModelType = initWithPhotoFeedModelType - self.imageSize = requiredImageSize - self.url = URL.URLForFeedModelType(feedModelType: initWithPhotoFeedModelType) - } + // MARK: Lifecycle - var numberOfItemsInFeed: Int { - return photos.count + init(photoFeedModelType: PhotoFeedModelType) { + self.photoFeedModelType = photoFeedModelType } + + // MARK: API + + lazy var url: URL = { + return URL.URLForFeedModelType(feedModelType: self.photoFeedModelType) + }() + + var numberOfItems: Int { + return orderedPhotos.count + } + + func itemAtIndexPath(_ indexPath: IndexPath) -> PhotoModel { + return orderedPhotos[indexPath.row].value + } // return in completion handler the number of additions and the status of internet connection func updateNewBatchOfPopularPhotos(additionsAndConnectionStatusCompletion: @escaping (Int, InternetStatus) -> ()) { + + // For this example let's use the main thread as locking queue + DispatchQueue.main.async { + guard !self.fetchPageInProgress else { + return + } - guard !fetchPageInProgress else { return } + self.fetchPageInProgress = true + self.fetchNextPageOfPopularPhotos(replaceData: false) { [unowned self] additions, error in + self.fetchPageInProgress = false - fetchPageInProgress = true - fetchNextPageOfPopularPhotos(replaceData: false) { [unowned self] additions, errors in - self.fetchPageInProgress = false - - if let error = errors { - switch error { - case .noInternetConnection: - additionsAndConnectionStatusCompletion(0, .noConnection) - default: additionsAndConnectionStatusCompletion(0, .connected) - } - } else { - additionsAndConnectionStatusCompletion(additions, .connected) - } - } + if let error = error { + switch error { + case .noInternetConnection: + additionsAndConnectionStatusCompletion(0, .noConnection) + default: + additionsAndConnectionStatusCompletion(0, .connected) + } + } else { + additionsAndConnectionStatusCompletion(additions, .connected) + } + } + } } - private func fetchNextPageOfPopularPhotos(replaceData: Bool, numberOfAdditionsCompletion: @escaping (Int, NetworkingErrors?) -> ()) { - + private func fetchNextPageOfPopularPhotos(replaceData: Bool, numberOfAdditionsCompletion: @escaping (Int, NetworkingError?) -> ()) { if currentPage == totalPages, currentPage != 0 { - DispatchQueue.main.async { - numberOfAdditionsCompletion(0, .customError("No pages left to parse")) - } + numberOfAdditionsCompletion(0, .customError("No pages left to parse")) return } - var newPhotos: [PhotoModel] = [] - var newIDs: [Int] = [] - let pageToFetch = currentPage + 1 - - let url = self.url.addImageParameterForClosestImageSizeAndpage(size: imageSize, page: pageToFetch) - - WebService().load(resource: parsePopularPage(withURL: url)) { [unowned self] result in - + WebService().load(resource: parsePopularPage(withURL: url, page: pageToFetch)) { [unowned self] result in + // Callback will happen on main for now switch result { - case .success(let popularPage): - self.totalItems = popularPage.totalNumberOfItems - self.totalPages = popularPage.totalPages - self.currentPage = popularPage.page + case .success(let itemsPage): + // Update current state + self.totalItems = itemsPage.totalNumberOfItems + self.totalPages = itemsPage.totalPages + self.currentPage = itemsPage.page - for photo in popularPage.photos { - if !replaceData || !self.ids.contains(photo.photoID) { - newPhotos.append(photo) - newIDs.append(photo.photoID) - } - } - - DispatchQueue.main.async { - if replaceData { - self.photos = newPhotos - self.ids = newIDs - } else { - self.photos += newPhotos - self.ids += newIDs - } - - numberOfAdditionsCompletion(newPhotos.count, nil) - } + // Update photos + if replaceData { + self.orderedPhotos = [] + } + var insertedItems = 0 + for photo in itemsPage.photos { + if !self.orderedPhotos.containsKey(photo.photoID) { + // Append a new key-value pair by setting a value for an non-existent key + self.orderedPhotos[photo.photoID] = photo + insertedItems += 1 + } + } + numberOfAdditionsCompletion(insertedItems, nil) case .failure(let fail): - print(fail) - DispatchQueue.main.async { + print(fail) numberOfAdditionsCompletion(0, fail) - } } } } diff --git a/examples_extra/ASDKgram-Swift/ASDKgram-Swift/PhotoFeedTableNodeController.swift b/examples_extra/ASDKgram-Swift/ASDKgram-Swift/PhotoFeedTableNodeController.swift index 08c1bc3273..6c2fe39f14 100644 --- a/examples_extra/ASDKgram-Swift/ASDKgram-Swift/PhotoFeedTableNodeController.swift +++ b/examples_extra/ASDKgram-Swift/ASDKgram-Swift/PhotoFeedTableNodeController.swift @@ -1,104 +1,95 @@ // // PhotoFeedTableNodeController.swift -// ASDKgram-Swift +// Texture // -// Created by Calum Harris on 06/01/2017. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // import AsyncDisplayKit class PhotoFeedTableNodeController: ASViewController { + + // MARK: Lifecycle - var activityIndicator: UIActivityIndicatorView! - var photoFeed: PhotoFeedModel + private lazy var activityIndicatorView: UIActivityIndicatorView = { + return UIActivityIndicatorView(activityIndicatorStyle: .gray) + }() + + var photoFeedModel = PhotoFeedModel(photoFeedModelType: .photoFeedModelTypePopular) init() { - photoFeed = PhotoFeedModel(initWithPhotoFeedModelType: .photoFeedModelTypePopular, requiredImageSize: screenSizeForWidth) - super.init(node: ASTableNode()) - self.navigationItem.title = "ASDK" + super.init(node: ASTableNode()) + navigationItem.title = "ASDK" } required init?(coder aDecoder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + // MAKR: UIViewController override func viewDidLoad() { super.viewDidLoad() - setupActivityIndicator() + node.allowsSelection = false - node.view.separatorStyle = .none node.dataSource = self node.delegate = self node.leadingScreensForBatching = 2.5 - navigationController?.hidesBarsOnSwipe = true + node.view.separatorStyle = .none + + navigationController?.hidesBarsOnSwipe = true + + node.view.addSubview(activityIndicatorView) } - - // helper functions - func setupActivityIndicator() { - let activityIndicator = UIActivityIndicatorView(activityIndicatorStyle: .gray) - self.activityIndicator = activityIndicator - let bounds = self.node.frame - var refreshRect = activityIndicator.frame - refreshRect.origin = CGPoint(x: (bounds.size.width - activityIndicator.frame.size.width) / 2.0, y: (bounds.size.height - activityIndicator.frame.size.height) / 2.0) - activityIndicator.frame = refreshRect - self.node.view.addSubview(activityIndicator) - } - - var screenSizeForWidth: CGSize = { - let screenRect = UIScreen.main.bounds - let screenScale = UIScreen.main.scale - return CGSize(width: screenRect.size.width * screenScale, height: screenRect.size.width * screenScale) - }() + + override func viewDidLayoutSubviews() { + super.viewDidLayoutSubviews() + + // Center the activity indicator view + let bounds = node.bounds + activityIndicatorView.frame.origin = CGPoint( + x: (bounds.width - activityIndicatorView.frame.width) / 2.0, + y: (bounds.height - activityIndicatorView.frame.height) / 2.0 + ) + } func fetchNewBatchWithContext(_ context: ASBatchContext?) { DispatchQueue.main.async { - self.activityIndicator.startAnimating() + self.activityIndicatorView.startAnimating() } - photoFeed.updateNewBatchOfPopularPhotos() { additions, connectionStatus in + photoFeedModel.updateNewBatchOfPopularPhotos() { additions, connectionStatus in switch connectionStatus { case .connected: - self.activityIndicator.stopAnimating() + self.activityIndicatorView.stopAnimating() self.addRowsIntoTableNode(newPhotoCount: additions) context?.completeBatchFetching(true) case .noConnection: - self.activityIndicator.stopAnimating() - if context != nil { - context!.completeBatchFetching(true) - } - break + self.activityIndicatorView.stopAnimating() + context?.completeBatchFetching(true) } } } func addRowsIntoTableNode(newPhotoCount newPhotos: Int) { - let indexRange = (photoFeed.photos.count - newPhotos.. Int { - return photoFeed.numberOfItemsInFeed + return photoFeedModel.numberOfItems } func tableNode(_ tableNode: ASTableNode, nodeBlockForRowAt indexPath: IndexPath) -> ASCellNodeBlock { - let photo = photoFeed.photos[indexPath.row] + let photo = photoFeedModel.itemAtIndexPath(indexPath) let nodeBlock: ASCellNodeBlock = { _ in return PhotoTableNodeCell(photoModel: photo) } diff --git a/examples_extra/ASDKgram-Swift/ASDKgram-Swift/PhotoFeedTableViewController.swift b/examples_extra/ASDKgram-Swift/ASDKgram-Swift/PhotoFeedTableViewController.swift index 0e7cbef975..1f19fe8dc9 100644 --- a/examples_extra/ASDKgram-Swift/ASDKgram-Swift/PhotoFeedTableViewController.swift +++ b/examples_extra/ASDKgram-Swift/ASDKgram-Swift/PhotoFeedTableViewController.swift @@ -1,20 +1,10 @@ // // PhotoFeedTableViewController.swift -// ASDKgram-Swift +// Texture // -// Created by Calum Harris on 06/01/2017. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // import UIKit @@ -22,13 +12,12 @@ import UIKit class PhotoFeedTableViewController: UITableViewController { var activityIndicator: UIActivityIndicatorView! - var photoFeed: PhotoFeedModel + var photoFeed = PhotoFeedModel(photoFeedModelType: .photoFeedModelTypePopular) init() { - photoFeed = PhotoFeedModel(initWithPhotoFeedModelType: .photoFeedModelTypePopular, requiredImageSize: screenSizeForWidth) - super.init(nibName: nil, bundle: nil) - self.navigationItem.title = "UIKit" - + super.init(nibName: nil, bundle: nil) + + navigationItem.title = "UIKit" } required init?(coder aDecoder: NSCoder) { @@ -37,12 +26,13 @@ class PhotoFeedTableViewController: UITableViewController { override func viewDidLoad() { super.viewDidLoad() + + navigationController?.hidesBarsOnSwipe = true setupActivityIndicator() configureTableView() fetchNewBatch() - navigationController?.hidesBarsOnSwipe = true } - + func fetchNewBatch() { activityIndicator.startAnimating() photoFeed.updateNewBatchOfPopularPhotos() { additions, connectionStatus in @@ -57,22 +47,17 @@ class PhotoFeedTableViewController: UITableViewController { } } - var screenSizeForWidth: CGSize = { - let screenRect = UIScreen.main.bounds - let screenScale = UIScreen.main.scale - return CGSize(width: screenRect.size.width * screenScale, height: screenRect.size.width * screenScale) - }() - - // helper functions + // Helper functions func setupActivityIndicator() { let activityIndicator = UIActivityIndicatorView(activityIndicatorStyle: .gray) + activityIndicator.translatesAutoresizingMaskIntoConstraints = false self.activityIndicator = activityIndicator - self.tableView.addSubview(activityIndicator) - activityIndicator.translatesAutoresizingMaskIntoConstraints = false + self.tableView.addSubview(activityIndicator) + NSLayoutConstraint.activate([ activityIndicator.centerXAnchor.constraint(equalTo: self.tableView.centerXAnchor), activityIndicator.centerYAnchor.constraint(equalTo: self.tableView.centerYAnchor) - ]) + ]) } func configureTableView() { @@ -87,7 +72,7 @@ extension PhotoFeedTableViewController { func addRowsIntoTableView(newPhotoCount newPhotos: Int) { - let indexRange = (photoFeed.photos.count - newPhotos.. Int { - return photoFeed.photos.count + return photoFeed.numberOfItems } override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { guard let cell = tableView.dequeueReusableCell(withIdentifier: "photoCell", for: indexPath) as? PhotoTableViewCell else { fatalError("Wrong cell type") } - cell.photoModel = photoFeed.photos[indexPath.row] + cell.photoModel = photoFeed.itemAtIndexPath(indexPath) return cell } override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { - return PhotoTableViewCell.height(for: photoFeed.photos[indexPath.row], withWidth: self.view.frame.size.width) + return PhotoTableViewCell.height( + for: photoFeed.itemAtIndexPath(indexPath), + withWidth: self.view.frame.size.width + ) } override func scrollViewDidScroll(_ scrollView: UIScrollView) { - let currentOffSetY = scrollView.contentOffset.y let contentHeight = scrollView.contentSize.height - let screenHeight = UIScreen.main.bounds.size.height + let screenHeight = UIScreen.main.bounds.height let screenfullsBeforeBottom = (contentHeight - currentOffSetY) / screenHeight if screenfullsBeforeBottom < 2.5 { self.fetchNewBatch() diff --git a/examples_extra/ASDKgram-Swift/ASDKgram-Swift/PhotoModel.swift b/examples_extra/ASDKgram-Swift/ASDKgram-Swift/PhotoModel.swift index 13508631b1..5f5c5bbe71 100644 --- a/examples_extra/ASDKgram-Swift/ASDKgram-Swift/PhotoModel.swift +++ b/examples_extra/ASDKgram-Swift/ASDKgram-Swift/PhotoModel.swift @@ -1,92 +1,116 @@ // // PhotoModel.swift -// ASDKgram-Swift +// Texture // -// Created by Calum Harris on 07/01/2017. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // import UIKit -typealias JSONDictionary = [String : Any] +// MARK: ProfileImage -struct PhotoModel { - - let url: String - let photoID: Int - let dateString: String - let descriptionText: String +struct ProfileImage: Codable { + let large: String + let medium: String + let small: String +} + +// MARK: UserModel + +struct UserModel: Codable { + let userName: String + let profileImages: ProfileImage + + enum CodingKeys: String, CodingKey { + case userName = "username" + case profileImages = "profile_image" + } +} + +extension UserModel { + var profileImage: String { + return profileImages.medium + } +} + +// MARK: PhotoURL + +struct PhotoURL: Codable { + let full: String + let raw: String + let regular: String + let small: String + let thumb: String +} + +// MARK: PhotoModel + +struct PhotoModel: Codable { + let urls: PhotoURL + let photoID: String + let uploadedDateString: String + let descriptionText: String? let likesCount: Int - let ownerUserName: String - let ownerPicURL: String - - init?(dictionary: JSONDictionary) { - - guard let images = dictionary["images"] as? [[String: Any]], - let url = images[0]["url"] as? String, - let date = dictionary["created_at"] as? String, - let photoID = dictionary["id"] as? Int, - let descriptionText = dictionary["name"] as? String, - let likesCount = dictionary["positive_votes_count"] as? Int else - { print("error parsing JSON within PhotoModel Init"); return nil } - - guard let user = dictionary["user"] as? JSONDictionary, - let username = user["username"] as? String, - let ownerPicURL = user["userpic_url"] as? String else - { print("error parsing JSON within PhotoModel Init"); return nil } - - self.url = url - self.photoID = photoID - self.descriptionText = descriptionText - self.likesCount = likesCount - self.dateString = date - self.ownerUserName = username - self.ownerPicURL = ownerPicURL - } + let width: Int + let height: Int + let user: UserModel + + enum CodingKeys: String, CodingKey { + case photoID = "id" + case urls = "urls" + case uploadedDateString = "created_at" + case descriptionText = "description" + case likesCount = "likes" + case width = "width" + case height = "height" + case user = "user" + } +} + +extension PhotoModel { + var url: String { + return urls.regular + } } extension PhotoModel { // MARK: - Attributed Strings - func attrStringForUserName(withSize size: CGFloat) -> NSAttributedString { - let attr = [ + func attributedStringForUserName(withSize size: CGFloat) -> NSAttributedString { + let attributes = [ NSForegroundColorAttributeName : UIColor.darkGray, NSFontAttributeName: UIFont.boldSystemFont(ofSize: size) ] - return NSAttributedString(string: self.ownerUserName, attributes: attr) + return NSAttributedString(string: user.userName, attributes: attributes) } - func attrStringForDescription(withSize size: CGFloat) -> NSAttributedString { - let attr = [ + func attributedStringForDescription(withSize size: CGFloat) -> NSAttributedString { + let attributes = [ NSForegroundColorAttributeName : UIColor.darkGray, NSFontAttributeName: UIFont.systemFont(ofSize: size) ] - return NSAttributedString(string: self.descriptionText, attributes: attr) + return NSAttributedString(string: descriptionText ?? "", attributes: attributes) } - func attrStringLikes(withSize size: CGFloat) -> NSAttributedString { + func attributedStringLikes(withSize size: CGFloat) -> NSAttributedString { + guard let formattedLikesNumber = NumberFormatter.decimalNumberFormatter.string(from: NSNumber(value: likesCount)) else { + return NSAttributedString() + } - let formatter = NumberFormatter() - formatter.numberStyle = .decimal - let formattedLikesNumber: String? = formatter.string(from: NSNumber(value: self.likesCount)) - let likesString: String = "\(formattedLikesNumber!) Likes" - let textAttr = [NSForegroundColorAttributeName : UIColor.mainBarTintColor(), NSFontAttributeName: UIFont.systemFont(ofSize: size)] - let likesAttrString = NSAttributedString(string: likesString, attributes: textAttr) + let likesAttributes = [ + NSForegroundColorAttributeName : UIColor.mainBarTintColor, + NSFontAttributeName: UIFont.systemFont(ofSize: size) + ] + let likesAttrString = NSAttributedString(string: "\(formattedLikesNumber) Likes", attributes: likesAttributes) - let heartAttr = [NSForegroundColorAttributeName : UIColor.red, NSFontAttributeName: UIFont.systemFont(ofSize: size)] - let heartAttrString = NSAttributedString(string: "♥︎ ", attributes: heartAttr) + let heartAttributes = [ + NSForegroundColorAttributeName : UIColor.red, + NSFontAttributeName: UIFont.systemFont(ofSize: size) + ] + let heartAttrString = NSAttributedString(string: "♥︎ ", attributes: heartAttributes) let combine = NSMutableAttributedString() combine.append(heartAttrString) @@ -94,32 +118,16 @@ extension PhotoModel { return combine } - func attrStringForTimeSinceString(withSize size: CGFloat) -> NSAttributedString { - - let attr = [ - NSForegroundColorAttributeName : UIColor.mainBarTintColor(), + func attributedStringForTimeSinceString(withSize size: CGFloat) -> NSAttributedString { + guard let date = Date.iso8601Formatter.date(from: self.uploadedDateString) else { + return NSAttributedString(); + } + + let attributes = [ + NSForegroundColorAttributeName : UIColor.mainBarTintColor, NSFontAttributeName: UIFont.systemFont(ofSize: size) ] - let date = Date.iso8601Formatter.date(from: self.dateString)! - return NSAttributedString(string: timeStringSince(fromConverted: date), attributes: attr) - } - - private func timeStringSince(fromConverted date: Date) -> String { - let diffDates = NSCalendar.current.dateComponents([.day, .hour, .second], from: date, to: Date()) - - if let week = diffDates.day, week > 7 { - return "\(week / 7)w" - } else if let day = diffDates.day, day > 0 { - return "\(day)d" - } else if let hour = diffDates.hour, hour > 0 { - return "\(hour)h" - } else if let second = diffDates.second, second > 0 { - return "\(second)s" - } else if let zero = diffDates.second, zero == 0 { - return "1s" - } else { - return "ERROR" - } + return NSAttributedString(string: Date.timeStringSince(fromConverted: date), attributes: attributes) } } diff --git a/examples_extra/ASDKgram-Swift/ASDKgram-Swift/PhotoTableNodeCell.swift b/examples_extra/ASDKgram-Swift/ASDKgram-Swift/PhotoTableNodeCell.swift index 56e02588b5..58f2a7086c 100644 --- a/examples_extra/ASDKgram-Swift/ASDKgram-Swift/PhotoTableNodeCell.swift +++ b/examples_extra/ASDKgram-Swift/ASDKgram-Swift/PhotoTableNodeCell.swift @@ -1,54 +1,53 @@ // // PhotoTableNodeCell.swift -// ASDKgram-Swift +// Texture // -// Created by Calum Harris on 09/01/2017. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.// import Foundation import AsyncDisplayKit class PhotoTableNodeCell: ASCellNode { - + + // MARK: Properties + let usernameLabel = ASTextNode() let timeIntervalLabel = ASTextNode() let photoLikesLabel = ASTextNode() let photoDescriptionLabel = ASTextNode() let avatarImageNode: ASNetworkImageNode = { - let imageNode = ASNetworkImageNode() - imageNode.contentMode = .scaleAspectFill - imageNode.imageModificationBlock = ASImageNodeRoundBorderModificationBlock(0, nil) - return imageNode + let node = ASNetworkImageNode() + node.contentMode = .scaleAspectFill + // Set the imageModificationBlock for a rounded avatar + node.imageModificationBlock = ASImageNodeRoundBorderModificationBlock(0, nil) + return node }() let photoImageNode: ASNetworkImageNode = { - let imageNode = ASNetworkImageNode() - imageNode.contentMode = .scaleAspectFill - return imageNode + let node = ASNetworkImageNode() + node.contentMode = .scaleAspectFill + return node }() + + // MARK: Lifecycle init(photoModel: PhotoModel) { super.init() - self.photoImageNode.url = URL(string: photoModel.url) - self.avatarImageNode.url = URL(string: photoModel.ownerPicURL) - self.usernameLabel.attributedText = photoModel.attrStringForUserName(withSize: Constants.CellLayout.FontSize) - self.timeIntervalLabel.attributedText = photoModel.attrStringForTimeSinceString(withSize: Constants.CellLayout.FontSize) - self.photoLikesLabel.attributedText = photoModel.attrStringLikes(withSize: Constants.CellLayout.FontSize) - self.photoDescriptionLabel.attributedText = photoModel.attrStringForDescription(withSize: Constants.CellLayout.FontSize) - self.automaticallyManagesSubnodes = true + + automaticallyManagesSubnodes = true + photoImageNode.url = URL(string: photoModel.url) + avatarImageNode.url = URL(string: photoModel.user.profileImage) + usernameLabel.attributedText = photoModel.attributedStringForUserName(withSize: Constants.CellLayout.FontSize) + timeIntervalLabel.attributedText = photoModel.attributedStringForTimeSinceString(withSize: Constants.CellLayout.FontSize) + photoLikesLabel.attributedText = photoModel.attributedStringLikes(withSize: Constants.CellLayout.FontSize) + photoDescriptionLabel.attributedText = photoModel.attributedStringForDescription(withSize: Constants.CellLayout.FontSize) } + + // MARK: ASDisplayNode override func layoutSpecThatFits(_ constrainedSize: ASSizeRange) -> ASLayoutSpec { @@ -58,9 +57,13 @@ class PhotoTableNodeCell: ASCellNode { let headerStack = ASStackLayoutSpec.horizontal() headerStack.alignItems = .center - avatarImageNode.style.preferredSize = CGSize(width: Constants.CellLayout.UserImageHeight, height: Constants.CellLayout.UserImageHeight) + avatarImageNode.style.preferredSize = CGSize( + width: Constants.CellLayout.UserImageHeight, + height: Constants.CellLayout.UserImageHeight + ) headerChildren.append(ASInsetLayoutSpec(insets: Constants.CellLayout.InsetForAvatar, child: avatarImageNode)) - usernameLabel.style.flexShrink = 1.0 + + usernameLabel.style.flexShrink = 1.0 headerChildren.append(usernameLabel) let spacer = ASLayoutSpec() @@ -76,9 +79,11 @@ class PhotoTableNodeCell: ASCellNode { headerStack.children = headerChildren let verticalStack = ASStackLayoutSpec.vertical() - - verticalStack.children = [ASInsetLayoutSpec(insets: Constants.CellLayout.InsetForHeader, child: headerStack), ASRatioLayoutSpec(ratio: 1.0, child: photoImageNode), ASInsetLayoutSpec(insets: Constants.CellLayout.InsetForFooter, child: footerStack)] - + verticalStack.children = [ + ASInsetLayoutSpec(insets: Constants.CellLayout.InsetForHeader, child: headerStack), + ASRatioLayoutSpec(ratio: 1.0, child: photoImageNode), + ASInsetLayoutSpec(insets: Constants.CellLayout.InsetForFooter, child: footerStack) + ] return verticalStack } } diff --git a/examples_extra/ASDKgram-Swift/ASDKgram-Swift/PhotoTableViewCell.swift b/examples_extra/ASDKgram-Swift/ASDKgram-Swift/PhotoTableViewCell.swift index b57beab9a0..0698ff2cee 100644 --- a/examples_extra/ASDKgram-Swift/ASDKgram-Swift/PhotoTableViewCell.swift +++ b/examples_extra/ASDKgram-Swift/ASDKgram-Swift/PhotoTableViewCell.swift @@ -1,20 +1,10 @@ // // PhotoTableViewCell.swift -// ASDKgram-Swift +// Texture // -// Created by Calum Harris on 08/01/2017. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // import UIKit @@ -25,15 +15,15 @@ class PhotoTableViewCell: UITableViewCell { didSet { if let model = photoModel { photoImageView.loadImageUsingUrlString(urlString: model.url) - avatarImageView.loadImageUsingUrlString(urlString: model.ownerPicURL) - photoLikesLabel.attributedText = model.attrStringLikes(withSize: Constants.CellLayout.FontSize) - usernameLabel.attributedText = model.attrStringForUserName(withSize: Constants.CellLayout.FontSize) - timeIntervalLabel.attributedText = model.attrStringForTimeSinceString(withSize: Constants.CellLayout.FontSize) - photoDescriptionLabel.attributedText = model.attrStringForDescription(withSize: Constants.CellLayout.FontSize) + avatarImageView.loadImageUsingUrlString(urlString: model.user.profileImage) + photoLikesLabel.attributedText = model.attributedStringLikes(withSize: Constants.CellLayout.FontSize) + usernameLabel.attributedText = model.attributedStringForUserName(withSize: Constants.CellLayout.FontSize) + timeIntervalLabel.attributedText = model.attributedStringForTimeSinceString(withSize: Constants.CellLayout.FontSize) + photoDescriptionLabel.attributedText = model.attributedStringForDescription(withSize: Constants.CellLayout.FontSize) photoDescriptionLabel.sizeToFit() var rect = photoDescriptionLabel.frame let availableWidth = self.bounds.size.width - Constants.CellLayout.HorizontalBuffer * 2 - rect.size = model.attrStringForDescription(withSize: Constants.CellLayout.FontSize).boundingRect(with: CGSize(width: availableWidth, height: CGFloat.greatestFiniteMagnitude), options: .usesLineFragmentOrigin, context: nil).size + rect.size = model.attributedStringForDescription(withSize: Constants.CellLayout.FontSize).boundingRect(with: CGSize(width: availableWidth, height: CGFloat.greatestFiniteMagnitude), options: .usesLineFragmentOrigin, context: nil).size photoDescriptionLabel.frame = rect } } @@ -133,7 +123,7 @@ class PhotoTableViewCell: UITableViewCell { let photoHeight = width let font = UIFont.systemFont(ofSize: Constants.CellLayout.FontSize) let likesHeight = round(font.lineHeight) - let descriptionAttrString = photo.attrStringForDescription(withSize: Constants.CellLayout.FontSize) + let descriptionAttrString = photo.attributedStringForDescription(withSize: Constants.CellLayout.FontSize) let availableWidth = width - Constants.CellLayout.HorizontalBuffer * 2 let descriptionHeight = descriptionAttrString.boundingRect(with: CGSize(width: availableWidth, height: CGFloat.greatestFiniteMagnitude), options: .usesLineFragmentOrigin, context: nil).size.height diff --git a/examples_extra/ASDKgram-Swift/ASDKgram-Swift/PopularPageModel.swift b/examples_extra/ASDKgram-Swift/ASDKgram-Swift/PopularPageModel.swift index 8aca2445f1..048b219211 100644 --- a/examples_extra/ASDKgram-Swift/ASDKgram-Swift/PopularPageModel.swift +++ b/examples_extra/ASDKgram-Swift/ASDKgram-Swift/PopularPageModel.swift @@ -1,37 +1,24 @@ // // PopularPageModel.swift -// ASDKgram-Swift +// Texture // -// Created by Calum Harris on 08/01/2017. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // import Foundation -class PopularPageModel: NSObject { - - let page: Int - let totalPages: Int - let totalNumberOfItems: Int - let photos: [PhotoModel] - - init?(dictionary: JSONDictionary, photosArray: [PhotoModel]) { - guard let page = dictionary["current_page"] as? Int, let totalPages = dictionary["total_pages"] as? Int, let totalItems = dictionary["total_items"] as? Int else { print("error parsing JSON within PhotoModel Init"); return nil } - - self.page = page - self.totalPages = totalPages - self.totalNumberOfItems = totalItems - self.photos = photosArray - } +struct PopularPageModel { + let page: Int + let totalPages: Int + let totalNumberOfItems: Int + let photos: [PhotoModel] + + init(metaData: ResponseMetadata, photos:[PhotoModel]) { + self.page = metaData.currentPage + self.totalPages = metaData.pagesTotal + self.totalNumberOfItems = metaData.itemsTotal + self.photos = photos + } } diff --git a/examples_extra/ASDKgram-Swift/ASDKgram-Swift/UIColor.swift b/examples_extra/ASDKgram-Swift/ASDKgram-Swift/UIColor.swift index 5ab9d7e010..5498f07ce9 100644 --- a/examples_extra/ASDKgram-Swift/ASDKgram-Swift/UIColor.swift +++ b/examples_extra/ASDKgram-Swift/ASDKgram-Swift/UIColor.swift @@ -1,26 +1,16 @@ // // UIColor.swift -// ASDKgram-Swift +// Texture // -// Created by Calum Harris on 06/01/2017. -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // import UIKit extension UIColor { - - class func mainBarTintColor() -> UIColor { + static var mainBarTintColor: UIColor { return UIColor(red: 69/255, green: 142/255, blue: 255/255, alpha: 1) } } diff --git a/examples_extra/ASDKgram-Swift/ASDKgram-Swift/UIImage.swift b/examples_extra/ASDKgram-Swift/ASDKgram-Swift/UIImage.swift deleted file mode 100644 index 4eb233f37b..0000000000 --- a/examples_extra/ASDKgram-Swift/ASDKgram-Swift/UIImage.swift +++ /dev/null @@ -1,60 +0,0 @@ -// -// UIImage.swift -// ASDKgram-Swift -// -// Created by Calum Harris on 18/01/2017. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -import UIKit - -// This extension was copied directly from LayoutSpecExamples-Swift. It is an example of how to create Precomoposed Alpha Corners. I have used the helper ASImageNodeRoundBorderModificationBlock:boarderWidth:boarderColor function in practice which does the same. - -extension UIImage { - - func makeCircularImage(size: CGSize, borderWidth width: CGFloat) -> UIImage { - // make a CGRect with the image's size - let circleRect = CGRect(origin: .zero, size: size) - - // begin the image context since we're not in a drawRect: - UIGraphicsBeginImageContextWithOptions(circleRect.size, false, 0) - - // create a UIBezierPath circle - let circle = UIBezierPath(roundedRect: circleRect, cornerRadius: circleRect.size.width * 0.5) - - // clip to the circle - circle.addClip() - - UIColor.white.set() - circle.fill() - - // draw the image in the circleRect *AFTER* the context is clipped - self.draw(in: circleRect) - - // create a border (for white background pictures) - if width > 0 { - circle.lineWidth = width - UIColor.white.set() - circle.stroke() - } - - // get an image from the image context - let roundedImage = UIGraphicsGetImageFromCurrentImageContext() - - // end the image context since we're not in a drawRect: - UIGraphicsEndImageContext() - - return roundedImage ?? self - } -} diff --git a/examples_extra/ASDKgram-Swift/ASDKgram-Swift/URL.swift b/examples_extra/ASDKgram-Swift/ASDKgram-Swift/URL.swift index 5960498155..be9b4a49e9 100644 --- a/examples_extra/ASDKgram-Swift/ASDKgram-Swift/URL.swift +++ b/examples_extra/ASDKgram-Swift/ASDKgram-Swift/URL.swift @@ -1,67 +1,29 @@ // // URL.swift -// ASDKgram-Swift +// Texture // -// Created by Calum Harris on 07/01/2017. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // import UIKit extension URL { - static func URLForFeedModelType(feedModelType: PhotoFeedModelType) -> URL { switch feedModelType { case .photoFeedModelTypePopular: - return URL(string: assemble500PXURLString(endpoint: Constants.PX500.URLS.PopularEndpoint))! + return URL(string: assembleUnsplashURLString(endpoint: Constants.Unsplash.URLS.PopularEndpoint))! case .photoFeedModelTypeLocation: - return URL(string: assemble500PXURLString(endpoint: Constants.PX500.URLS.SearchEndpoint))! + return URL(string: assembleUnsplashURLString(endpoint: Constants.Unsplash.URLS.SearchEndpoint))! case .photoFeedModelTypeUserPhotos: - return URL(string: assemble500PXURLString(endpoint: Constants.PX500.URLS.UserEndpoint))! + return URL(string: assembleUnsplashURLString(endpoint: Constants.Unsplash.URLS.UserEndpoint))! } } - - private static func assemble500PXURLString(endpoint: String) -> String { - return Constants.PX500.URLS.Host + endpoint + Constants.PX500.URLS.ConsumerKey - } - - mutating func addImageParameterForClosestImageSizeAndpage(size: CGSize, page: Int) -> URL { - - let imageParameterID: Int - - if size.height <= 70 { - imageParameterID = 1 - } else if size.height <= 100 { - imageParameterID = 100 - } else if size.height <= 140 { - imageParameterID = 2 - } else if size.height <= 200 { - imageParameterID = 200 - } else if size.height <= 280 { - imageParameterID = 3 - } else if size.height <= 400 { - imageParameterID = 400 - } else { - imageParameterID = 600 - } - - var urlString = self.absoluteString - urlString.append("&image_size=\(imageParameterID)&page=\(page)") - - return URL(string: urlString)! - } - + + private static func assembleUnsplashURLString(endpoint: String) -> String { + return Constants.Unsplash.URLS.Host + endpoint + Constants.Unsplash.URLS.ConsumerKey + } } diff --git a/examples_extra/ASDKgram-Swift/ASDKgram-Swift/Webservice.swift b/examples_extra/ASDKgram-Swift/ASDKgram-Swift/Webservice.swift index 830d78eb0e..a103d21653 100644 --- a/examples_extra/ASDKgram-Swift/ASDKgram-Swift/Webservice.swift +++ b/examples_extra/ASDKgram-Swift/ASDKgram-Swift/Webservice.swift @@ -1,34 +1,25 @@ // // Webservice.swift -// ASDKgram-Swift +// Texture // -// Created by Calum Harris on 06/01/2017. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// swiftlint:disable force_cast import UIKit final class WebService { + /// Load a new resource. Callback is called on main func load(resource: Resource, completion: @escaping (Result) -> ()) { URLSession.shared.dataTask(with: resource.url) { data, response, error in // Check for errors in responses. let result = self.checkForNetworkErrors(data, response, error) DispatchQueue.main.async { + // Parsing should happen off main switch result { case .success(let data): - completion(resource.parse(data)) + completion(resource.parse(data, response)) case .failure(let error): completion(.failure(error)) } @@ -38,54 +29,77 @@ final class WebService { } extension WebService { - + /// // Check for errors in responses. fileprivate func checkForNetworkErrors(_ data: Data?, _ response: URLResponse?, _ error: Error?) -> Result { - // Check for errors in responses. if let error = error { - let nsError = error as NSError - if nsError.domain == NSURLErrorDomain && (nsError.code == NSURLErrorNotConnectedToInternet || nsError.code == NSURLErrorTimedOut) { - return .failure(.noInternetConnection) - } else { - return .failure(.returnedError(error)) - } + switch error { + case URLError.notConnectedToInternet, URLError.timedOut: + return .failure(.noInternetConnection) + default: + return .failure(.returnedError(error)) + } } if let response = response as? HTTPURLResponse, response.statusCode <= 200 && response.statusCode >= 299 { return .failure((.invalidStatusCode("Request returned status code other than 2xx \(response)"))) } - guard let data = data else { return .failure(.dataReturnedNil) } + guard let data = data else { + return .failure(.dataReturnedNil) + } return .success(data) } } +struct ResponseMetadata { + let currentPage: Int + let itemsTotal: Int + let itemsPerPage: Int +} + +extension ResponseMetadata { + var pagesTotal: Int { + return itemsTotal / itemsPerPage + } +} + struct Resource { let url: URL - let parse: (Data) -> Result + let parse: (Data, URLResponse?) -> Result } extension Resource { - - init(url: URL, parseJSON: @escaping (Any) -> Result) { - self.url = url - self.parse = { data in - do { - let jsonData = try JSONSerialization.jsonObject(with: data, options: []) - return parseJSON(jsonData) - } catch { - fatalError("Error parsing data") - } + init(url: URL, page: Int, parseResponse: @escaping (ResponseMetadata, Data) -> Result) { + // Append extra data to url for paging + guard let url = URL(string: url.absoluteString.appending("&page=\(page)")) else { + fatalError("Malformed URL given"); + } + self.url = url + self.parse = { data, response in + // Parse out metadata from header + guard let httpUrlResponse = response as? HTTPURLResponse, + let xTotalString = httpUrlResponse.allHeaderFields["x-total"] as? String, + let xTotal = Int(xTotalString), + let xPerPageString = httpUrlResponse.allHeaderFields["x-per-page"] as? String, + let xPerPage = Int(xPerPageString) + else { + return .failure(.errorParsingResponse) + } + + let metadata = ResponseMetadata(currentPage: page, itemsTotal: xTotal, itemsPerPage: xPerPage) + return parseResponse(metadata, data) } } } enum Result { case success(T) - case failure(NetworkingErrors) + case failure(NetworkingError) } -enum NetworkingErrors: Error { +enum NetworkingError: Error { + case errorParsingResponse case errorParsingJSON case noInternetConnection case dataReturnedNil diff --git a/examples_extra/ASDKgram-Swift/Podfile b/examples_extra/ASDKgram-Swift/Podfile index 6ab85b36c6..5510b59d9e 100644 --- a/examples_extra/ASDKgram-Swift/Podfile +++ b/examples_extra/ASDKgram-Swift/Podfile @@ -1,8 +1,9 @@ - +source 'https://github.com/CocoaPods/Specs.git' +platform :ios, '9.0' target 'ASDKgram-Swift' do - use_frameworks! + inhibit_all_warnings! - pod 'Texture', '>= 2.0' + pod 'Texture/PINRemoteImage', :path => '../..' end diff --git a/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.h b/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.h index 0c5d69364f..d80265a099 100644 --- a/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.h +++ b/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.h @@ -1,8 +1,9 @@ // // Sample.h -// Sample +// Texture // -// Copyright © 2016 Facebook. All rights reserved. +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.playground/Pages/HorizontalStackWithSpacer.xcplaygroundpage/Contents.swift b/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.playground/Pages/HorizontalStackWithSpacer.xcplaygroundpage/Contents.swift index 10715382bb..43cf09026e 100644 --- a/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.playground/Pages/HorizontalStackWithSpacer.xcplaygroundpage/Contents.swift +++ b/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.playground/Pages/HorizontalStackWithSpacer.xcplaygroundpage/Contents.swift @@ -1,4 +1,10 @@ -//: [Photo With Outset Icon Overlay](PhotoWithOutsetIconOverlay) +// +// Contents.swift +// Texture +// +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 +// import AsyncDisplayKit diff --git a/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.playground/Pages/Index.xcplaygroundpage/Contents.swift b/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.playground/Pages/Index.xcplaygroundpage/Contents.swift index b44cbd0226..655f86b0f5 100644 --- a/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.playground/Pages/Index.xcplaygroundpage/Contents.swift +++ b/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.playground/Pages/Index.xcplaygroundpage/Contents.swift @@ -1,24 +1,7 @@ -/*: - ## ⚠️ You must start by building the Sample framework ⚠️ - Once that succeeds, you should not have to build until you update AsyncDisplayKit! - What you see here isn't comprehensive, but you should be able to tweak the variables to familiarize yourself with the layout APIs. - - - - - - ## Table of Contents - * [Stack Layout](StackLayout) - * [Photo With Inset Text Overlay](PhotoWithInsetTextOverlay) - * [Photo With Outset Icon Overlay](PhotoWithOutsetIconOverlay) - * [Horizontal Stack With Spacer](HorizontalStackWithSpacer) - - - - - -Tips: - 1. Make sure to show the Assistant Editor in order to preview your code changes. You can do this with either of the following: - - (cmd + opt/alt + ⮐) - - View → Assistant Editor → Show Assistant Editor, to see the preview - 1. Make sure that **Timeline** as the element selected in the Assistant Editor - 1. You might have to click on stop/start (the one at the bottom of the screen, under the editor) a few times in case the timeline isn't updating. - - - - -Solutions to Common Issues: - 1. If you're getting errors regarding **import Sample_Sources**, simply restart Xcode and try again. - 1. If you're getting issues with threading, restart the test until it works. -*/ +// +// Contents.swift +// Texture +// +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 +// diff --git a/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.playground/Pages/PhotoWithInsetTextOverlay.xcplaygroundpage/Contents.swift b/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.playground/Pages/PhotoWithInsetTextOverlay.xcplaygroundpage/Contents.swift index cc73be4b1a..88360fd4fb 100644 --- a/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.playground/Pages/PhotoWithInsetTextOverlay.xcplaygroundpage/Contents.swift +++ b/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.playground/Pages/PhotoWithInsetTextOverlay.xcplaygroundpage/Contents.swift @@ -1,4 +1,10 @@ -//: [Stack Layout](StackLayout) +// +// Contents.swift +// Texture +// +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 +// import AsyncDisplayKit @@ -23,4 +29,4 @@ extension PhotoWithInsetTextOverlay { PhotoWithInsetTextOverlay().show() -//: [Photo With Outset Icon Overlay](PhotoWithOutsetIconOverlay) \ No newline at end of file +//: [Photo With Outset Icon Overlay](PhotoWithOutsetIconOverlay) diff --git a/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.playground/Pages/PhotoWithOutsetIconOverlay.xcplaygroundpage/Contents.swift b/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.playground/Pages/PhotoWithOutsetIconOverlay.xcplaygroundpage/Contents.swift index ab2195f393..ba866f3b6d 100644 --- a/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.playground/Pages/PhotoWithOutsetIconOverlay.xcplaygroundpage/Contents.swift +++ b/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.playground/Pages/PhotoWithOutsetIconOverlay.xcplaygroundpage/Contents.swift @@ -1,4 +1,10 @@ -//: [Photo With Inset Text Overlay](PhotoWithInsetTextOverlay) +// +// Contents.swift +// Texture +// +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 +// import AsyncDisplayKit diff --git a/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.playground/Pages/StackLayout.xcplaygroundpage/Contents.swift b/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.playground/Pages/StackLayout.xcplaygroundpage/Contents.swift index d9eb59db8e..ec63def40a 100644 --- a/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.playground/Pages/StackLayout.xcplaygroundpage/Contents.swift +++ b/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.playground/Pages/StackLayout.xcplaygroundpage/Contents.swift @@ -1,7 +1,10 @@ -//: [Index](Index) -/*: - In this example, you can experiment with stack layouts. - */ +// +// Contents.swift +// Texture +// +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 +// import AsyncDisplayKit extension StackLayout { @@ -28,4 +31,4 @@ extension StackLayout { StackLayout().show() -//: [Photo With Inset Text Overlay](PhotoWithInsetTextOverlay) \ No newline at end of file +//: [Photo With Inset Text Overlay](PhotoWithInsetTextOverlay) diff --git a/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.playground/Sources/ASPlayground.swift b/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.playground/Sources/ASPlayground.swift index 0aab532ed3..1edf7db0bb 100644 --- a/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.playground/Sources/ASPlayground.swift +++ b/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.playground/Sources/ASPlayground.swift @@ -1,3 +1,10 @@ +// +// ASPlayground.swift +// Texture +// +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 +// import PlaygroundSupport import AsyncDisplayKit diff --git a/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.playground/Sources/HorizontalStackWithSpacer.swift b/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.playground/Sources/HorizontalStackWithSpacer.swift index 03338158fb..84b38c8e4d 100644 --- a/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.playground/Sources/HorizontalStackWithSpacer.swift +++ b/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.playground/Sources/HorizontalStackWithSpacer.swift @@ -1,3 +1,10 @@ +// +// HorizontalStackWithSpacer.swift +// Texture +// +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 +// import AsyncDisplayKit fileprivate let fontSize: CGFloat = 20 diff --git a/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.playground/Sources/PhotoWithInsetTextOverlay.swift b/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.playground/Sources/PhotoWithInsetTextOverlay.swift index 701d82f834..2a9736446c 100644 --- a/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.playground/Sources/PhotoWithInsetTextOverlay.swift +++ b/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.playground/Sources/PhotoWithInsetTextOverlay.swift @@ -1,3 +1,10 @@ +// +// PhotoWithInsetTextOverlay.swift +// Texture +// +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 +// import AsyncDisplayKit public class PhotoWithInsetTextOverlay: ASDisplayNode, ASPlayground { diff --git a/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.playground/Sources/PhotoWithOutsetIconOverlay.swift b/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.playground/Sources/PhotoWithOutsetIconOverlay.swift index 469feab7e3..9a8c9f3ab3 100644 --- a/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.playground/Sources/PhotoWithOutsetIconOverlay.swift +++ b/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.playground/Sources/PhotoWithOutsetIconOverlay.swift @@ -1,3 +1,10 @@ +// +// PhotoWithOutsetIconOverlay.swift +// Texture +// +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 +// import AsyncDisplayKit fileprivate let userImageHeight = 60 diff --git a/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.playground/Sources/StackLayout.swift b/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.playground/Sources/StackLayout.swift index 8eb4b1dbc5..871252e0fc 100644 --- a/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.playground/Sources/StackLayout.swift +++ b/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.playground/Sources/StackLayout.swift @@ -1,3 +1,10 @@ +// +// StackLayout.swift +// Texture +// +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 +// import AsyncDisplayKit public class StackLayout: ASDisplayNode, ASPlayground { diff --git a/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.playground/Sources/Utilities.swift b/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.playground/Sources/Utilities.swift index db9a9c2857..ab2cccc798 100644 --- a/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.playground/Sources/Utilities.swift +++ b/examples_extra/ASLayoutSpecPlayground-Swift/Sample/Sample.playground/Sources/Utilities.swift @@ -1,3 +1,10 @@ +// +// Utilities.swift +// Texture +// +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 +// import UIKit import Foundation diff --git a/examples_extra/ASTableViewStressTest/Sample/AppDelegate.h b/examples_extra/ASTableViewStressTest/Sample/AppDelegate.h index 27e560aafe..19db03c153 100644 --- a/examples_extra/ASTableViewStressTest/Sample/AppDelegate.h +++ b/examples_extra/ASTableViewStressTest/Sample/AppDelegate.h @@ -1,18 +1,10 @@ // // AppDelegate.h -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples_extra/ASTableViewStressTest/Sample/AppDelegate.m b/examples_extra/ASTableViewStressTest/Sample/AppDelegate.m index 3ba6ef18f3..1a89581c33 100644 --- a/examples_extra/ASTableViewStressTest/Sample/AppDelegate.m +++ b/examples_extra/ASTableViewStressTest/Sample/AppDelegate.m @@ -1,18 +1,10 @@ // // AppDelegate.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "AppDelegate.h" @@ -52,4 +44,4 @@ [self pushNewViewControllerAnimated:YES]; } -@end \ No newline at end of file +@end diff --git a/examples_extra/ASTableViewStressTest/Sample/ViewController.h b/examples_extra/ASTableViewStressTest/Sample/ViewController.h index fc52c022f2..c8a0626291 100644 --- a/examples_extra/ASTableViewStressTest/Sample/ViewController.h +++ b/examples_extra/ASTableViewStressTest/Sample/ViewController.h @@ -1,18 +1,10 @@ // // ViewController.h -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples_extra/ASTableViewStressTest/Sample/ViewController.m b/examples_extra/ASTableViewStressTest/Sample/ViewController.m index 4dfeca76ab..d75f9ac3ef 100644 --- a/examples_extra/ASTableViewStressTest/Sample/ViewController.m +++ b/examples_extra/ASTableViewStressTest/Sample/ViewController.m @@ -1,18 +1,10 @@ // // ViewController.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ViewController.h" diff --git a/examples_extra/ASTableViewStressTest/Sample/main.m b/examples_extra/ASTableViewStressTest/Sample/main.m index 756080fb2b..511cd1a7ac 100644 --- a/examples_extra/ASTableViewStressTest/Sample/main.m +++ b/examples_extra/ASTableViewStressTest/Sample/main.m @@ -1,18 +1,10 @@ // // main.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples_extra/ASTraitCollection/Sample/AppDelegate.h b/examples_extra/ASTraitCollection/Sample/AppDelegate.h index 5274628a9e..c30a27f4dc 100644 --- a/examples_extra/ASTraitCollection/Sample/AppDelegate.h +++ b/examples_extra/ASTraitCollection/Sample/AppDelegate.h @@ -1,18 +1,10 @@ // // AppDelegate.h -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples_extra/ASTraitCollection/Sample/AppDelegate.m b/examples_extra/ASTraitCollection/Sample/AppDelegate.m index eb5d123a4b..0a4654ae14 100644 --- a/examples_extra/ASTraitCollection/Sample/AppDelegate.m +++ b/examples_extra/ASTraitCollection/Sample/AppDelegate.m @@ -1,18 +1,10 @@ // // AppDelegate.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "AppDelegate.h" diff --git a/examples_extra/ASTraitCollection/Sample/CollectionViewController.h b/examples_extra/ASTraitCollection/Sample/CollectionViewController.h index 68c7b30d07..0528310b79 100644 --- a/examples_extra/ASTraitCollection/Sample/CollectionViewController.h +++ b/examples_extra/ASTraitCollection/Sample/CollectionViewController.h @@ -1,18 +1,10 @@ // // CollectionViewController.h -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples_extra/ASTraitCollection/Sample/CollectionViewController.m b/examples_extra/ASTraitCollection/Sample/CollectionViewController.m index 1c94ce4812..7e57f74434 100644 --- a/examples_extra/ASTraitCollection/Sample/CollectionViewController.m +++ b/examples_extra/ASTraitCollection/Sample/CollectionViewController.m @@ -1,18 +1,10 @@ // // CollectionViewController.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "CollectionViewController.h" diff --git a/examples_extra/ASTraitCollection/Sample/KittenNode.h b/examples_extra/ASTraitCollection/Sample/KittenNode.h index 1fd783f03d..17655e0765 100644 --- a/examples_extra/ASTraitCollection/Sample/KittenNode.h +++ b/examples_extra/ASTraitCollection/Sample/KittenNode.h @@ -1,18 +1,10 @@ // // KittenNode.h -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples_extra/ASTraitCollection/Sample/KittenNode.m b/examples_extra/ASTraitCollection/Sample/KittenNode.m index 6643f03b82..1526563e04 100644 --- a/examples_extra/ASTraitCollection/Sample/KittenNode.m +++ b/examples_extra/ASTraitCollection/Sample/KittenNode.m @@ -1,18 +1,10 @@ // // KittenNode.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "KittenNode.h" diff --git a/examples_extra/ASTraitCollection/Sample/OverrideViewController.h b/examples_extra/ASTraitCollection/Sample/OverrideViewController.h index 895d21ce2a..f5de270ae5 100644 --- a/examples_extra/ASTraitCollection/Sample/OverrideViewController.h +++ b/examples_extra/ASTraitCollection/Sample/OverrideViewController.h @@ -1,18 +1,10 @@ // // OverrideViewController.h -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples_extra/ASTraitCollection/Sample/OverrideViewController.m b/examples_extra/ASTraitCollection/Sample/OverrideViewController.m index 008497f9d8..3e9fcc305e 100644 --- a/examples_extra/ASTraitCollection/Sample/OverrideViewController.m +++ b/examples_extra/ASTraitCollection/Sample/OverrideViewController.m @@ -1,18 +1,10 @@ // // OverrideViewController.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "OverrideViewController.h" diff --git a/examples_extra/ASTraitCollection/Sample/TableViewController.h b/examples_extra/ASTraitCollection/Sample/TableViewController.h index 56683ad278..bfb5fad618 100644 --- a/examples_extra/ASTraitCollection/Sample/TableViewController.h +++ b/examples_extra/ASTraitCollection/Sample/TableViewController.h @@ -1,18 +1,10 @@ // // TableViewController.h -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples_extra/ASTraitCollection/Sample/TableViewController.m b/examples_extra/ASTraitCollection/Sample/TableViewController.m index b24cdec5ca..3a91be7588 100644 --- a/examples_extra/ASTraitCollection/Sample/TableViewController.m +++ b/examples_extra/ASTraitCollection/Sample/TableViewController.m @@ -1,18 +1,10 @@ // // TableViewController.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "TableViewController.h" diff --git a/examples_extra/ASTraitCollection/Sample/ViewController.h b/examples_extra/ASTraitCollection/Sample/ViewController.h index c5a802dd6f..4499f93bab 100644 --- a/examples_extra/ASTraitCollection/Sample/ViewController.h +++ b/examples_extra/ASTraitCollection/Sample/ViewController.h @@ -1,18 +1,10 @@ // // ViewController.h -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples_extra/ASTraitCollection/Sample/ViewController.m b/examples_extra/ASTraitCollection/Sample/ViewController.m index 0b7b6dd370..ddb1d708f2 100644 --- a/examples_extra/ASTraitCollection/Sample/ViewController.m +++ b/examples_extra/ASTraitCollection/Sample/ViewController.m @@ -1,18 +1,10 @@ // // ViewController.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ViewController.h" diff --git a/examples_extra/ASTraitCollection/Sample/main.m b/examples_extra/ASTraitCollection/Sample/main.m index 756080fb2b..511cd1a7ac 100644 --- a/examples_extra/ASTraitCollection/Sample/main.m +++ b/examples_extra/ASTraitCollection/Sample/main.m @@ -1,18 +1,10 @@ // // main.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples_extra/BackgroundPropertySetting/Sample/AppDelegate.swift b/examples_extra/BackgroundPropertySetting/Sample/AppDelegate.swift index bc0e91bfc6..5868314aaf 100644 --- a/examples_extra/BackgroundPropertySetting/Sample/AppDelegate.swift +++ b/examples_extra/BackgroundPropertySetting/Sample/AppDelegate.swift @@ -1,20 +1,10 @@ // // AppDelegate.swift -// Sample +// Texture // -// Created by Adlai Holler on 2/17/16. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // import UIKit diff --git a/examples_extra/BackgroundPropertySetting/Sample/DemoCellNode.swift b/examples_extra/BackgroundPropertySetting/Sample/DemoCellNode.swift index 8ce79266b5..6c3e7e529b 100644 --- a/examples_extra/BackgroundPropertySetting/Sample/DemoCellNode.swift +++ b/examples_extra/BackgroundPropertySetting/Sample/DemoCellNode.swift @@ -1,20 +1,10 @@ // // DemoCellNode.swift -// Sample +// Texture // -// Created by Adlai Holler on 2/17/16. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // import UIKit diff --git a/examples_extra/BackgroundPropertySetting/Sample/Utilities.swift b/examples_extra/BackgroundPropertySetting/Sample/Utilities.swift index 4a313ac139..f33065245c 100644 --- a/examples_extra/BackgroundPropertySetting/Sample/Utilities.swift +++ b/examples_extra/BackgroundPropertySetting/Sample/Utilities.swift @@ -1,20 +1,10 @@ // // Utilities.swift -// Sample +// Texture // -// Created by Adlai Holler on 2/17/16. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // import UIKit diff --git a/examples_extra/BackgroundPropertySetting/Sample/ViewController.swift b/examples_extra/BackgroundPropertySetting/Sample/ViewController.swift index facf11c8a5..47faf4384e 100644 --- a/examples_extra/BackgroundPropertySetting/Sample/ViewController.swift +++ b/examples_extra/BackgroundPropertySetting/Sample/ViewController.swift @@ -1,20 +1,10 @@ // // ViewController.swift -// Sample +// Texture // -// Created by Adlai Holler on 2/17/16. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // import UIKit diff --git a/examples_extra/CarthageBuildTest/CarthageExample/AppDelegate.h b/examples_extra/CarthageBuildTest/CarthageExample/AppDelegate.h index 2679ca0f5d..8d58a13cbe 100644 --- a/examples_extra/CarthageBuildTest/CarthageExample/AppDelegate.h +++ b/examples_extra/CarthageBuildTest/CarthageExample/AppDelegate.h @@ -1,20 +1,10 @@ // // AppDelegate.h -// Sample +// Texture // -// Created by Engin Kurutepe on 23/02/16. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples_extra/CarthageBuildTest/CarthageExample/AppDelegate.m b/examples_extra/CarthageBuildTest/CarthageExample/AppDelegate.m index 3cbd83a5e1..f4d3339633 100644 --- a/examples_extra/CarthageBuildTest/CarthageExample/AppDelegate.m +++ b/examples_extra/CarthageBuildTest/CarthageExample/AppDelegate.m @@ -1,20 +1,10 @@ // // AppDelegate.m -// Sample +// Texture // -// Created by Engin Kurutepe on 23/02/16. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // @import AsyncDisplayKit; diff --git a/examples_extra/CarthageBuildTest/CarthageExample/ViewController.h b/examples_extra/CarthageBuildTest/CarthageExample/ViewController.h index 69b7c77fa8..4627e29285 100644 --- a/examples_extra/CarthageBuildTest/CarthageExample/ViewController.h +++ b/examples_extra/CarthageBuildTest/CarthageExample/ViewController.h @@ -1,20 +1,10 @@ // // ViewController.h -// Sample +// Texture // -// Created by Engin Kurutepe on 23/02/16. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples_extra/CarthageBuildTest/CarthageExample/ViewController.m b/examples_extra/CarthageBuildTest/CarthageExample/ViewController.m index 6c48850bbb..993d6ac152 100644 --- a/examples_extra/CarthageBuildTest/CarthageExample/ViewController.m +++ b/examples_extra/CarthageBuildTest/CarthageExample/ViewController.m @@ -1,20 +1,10 @@ // // ViewController.m -// Sample +// Texture // -// Created by Engin Kurutepe on 23/02/16. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ViewController.h" diff --git a/examples_extra/CarthageBuildTest/CarthageExample/main.m b/examples_extra/CarthageBuildTest/CarthageExample/main.m index 269c9a6c74..0e5da05001 100644 --- a/examples_extra/CarthageBuildTest/CarthageExample/main.m +++ b/examples_extra/CarthageBuildTest/CarthageExample/main.m @@ -1,20 +1,10 @@ // // main.m -// Sample +// Texture // -// Created by Engin Kurutepe on 23/02/16. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples_extra/CollectionViewWithViewControllerCells/Sample/AppDelegate.h b/examples_extra/CollectionViewWithViewControllerCells/Sample/AppDelegate.h index 27e560aafe..19db03c153 100644 --- a/examples_extra/CollectionViewWithViewControllerCells/Sample/AppDelegate.h +++ b/examples_extra/CollectionViewWithViewControllerCells/Sample/AppDelegate.h @@ -1,18 +1,10 @@ // // AppDelegate.h -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples_extra/CollectionViewWithViewControllerCells/Sample/AppDelegate.m b/examples_extra/CollectionViewWithViewControllerCells/Sample/AppDelegate.m index 853bf6e8bc..78de0a3151 100644 --- a/examples_extra/CollectionViewWithViewControllerCells/Sample/AppDelegate.m +++ b/examples_extra/CollectionViewWithViewControllerCells/Sample/AppDelegate.m @@ -1,18 +1,10 @@ // // AppDelegate.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "AppDelegate.h" diff --git a/examples_extra/CollectionViewWithViewControllerCells/Sample/ImageViewController.h b/examples_extra/CollectionViewWithViewControllerCells/Sample/ImageViewController.h index e24af762a1..07000b0e3f 100644 --- a/examples_extra/CollectionViewWithViewControllerCells/Sample/ImageViewController.h +++ b/examples_extra/CollectionViewWithViewControllerCells/Sample/ImageViewController.h @@ -1,18 +1,10 @@ // // ImageViewController.h -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples_extra/CollectionViewWithViewControllerCells/Sample/ImageViewController.m b/examples_extra/CollectionViewWithViewControllerCells/Sample/ImageViewController.m index 2d330689ce..60e5027dae 100644 --- a/examples_extra/CollectionViewWithViewControllerCells/Sample/ImageViewController.m +++ b/examples_extra/CollectionViewWithViewControllerCells/Sample/ImageViewController.m @@ -1,18 +1,10 @@ // // ImageViewController.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // diff --git a/examples_extra/CollectionViewWithViewControllerCells/Sample/MosaicCollectionViewLayout.h b/examples_extra/CollectionViewWithViewControllerCells/Sample/MosaicCollectionViewLayout.h index 0acb1dde08..c7a9867fb5 100644 --- a/examples_extra/CollectionViewWithViewControllerCells/Sample/MosaicCollectionViewLayout.h +++ b/examples_extra/CollectionViewWithViewControllerCells/Sample/MosaicCollectionViewLayout.h @@ -1,20 +1,10 @@ // // MosaicCollectionViewLayout.h -// Sample +// Texture // -// Created by McCallum, Levi on 11/22/15. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import @@ -38,4 +28,4 @@ @interface MosaicCollectionViewLayoutInspector : NSObject -@end \ No newline at end of file +@end diff --git a/examples_extra/CollectionViewWithViewControllerCells/Sample/MosaicCollectionViewLayout.m b/examples_extra/CollectionViewWithViewControllerCells/Sample/MosaicCollectionViewLayout.m index 9e70ad0fd1..bc48035100 100644 --- a/examples_extra/CollectionViewWithViewControllerCells/Sample/MosaicCollectionViewLayout.m +++ b/examples_extra/CollectionViewWithViewControllerCells/Sample/MosaicCollectionViewLayout.m @@ -1,20 +1,10 @@ // // MosaicCollectionViewLayout.m -// Sample +// Texture // -// Created by McCallum, Levi on 11/22/15. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "MosaicCollectionViewLayout.h" @@ -238,4 +228,4 @@ } } -@end \ No newline at end of file +@end diff --git a/examples_extra/CollectionViewWithViewControllerCells/Sample/SupplementaryNode.h b/examples_extra/CollectionViewWithViewControllerCells/Sample/SupplementaryNode.h index 906fc50bdc..b29ec002b2 100644 --- a/examples_extra/CollectionViewWithViewControllerCells/Sample/SupplementaryNode.h +++ b/examples_extra/CollectionViewWithViewControllerCells/Sample/SupplementaryNode.h @@ -1,18 +1,10 @@ // // SupplementaryNode.h -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples_extra/CollectionViewWithViewControllerCells/Sample/SupplementaryNode.m b/examples_extra/CollectionViewWithViewControllerCells/Sample/SupplementaryNode.m index ab3be7cd4d..47dfa786b5 100644 --- a/examples_extra/CollectionViewWithViewControllerCells/Sample/SupplementaryNode.m +++ b/examples_extra/CollectionViewWithViewControllerCells/Sample/SupplementaryNode.m @@ -1,18 +1,10 @@ // // SupplementaryNode.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "SupplementaryNode.h" diff --git a/examples_extra/CollectionViewWithViewControllerCells/Sample/ViewController.h b/examples_extra/CollectionViewWithViewControllerCells/Sample/ViewController.h index fc52c022f2..c8a0626291 100644 --- a/examples_extra/CollectionViewWithViewControllerCells/Sample/ViewController.h +++ b/examples_extra/CollectionViewWithViewControllerCells/Sample/ViewController.h @@ -1,18 +1,10 @@ // // ViewController.h -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples_extra/CollectionViewWithViewControllerCells/Sample/ViewController.m b/examples_extra/CollectionViewWithViewControllerCells/Sample/ViewController.m index c1ae6628dc..60979faf3e 100644 --- a/examples_extra/CollectionViewWithViewControllerCells/Sample/ViewController.m +++ b/examples_extra/CollectionViewWithViewControllerCells/Sample/ViewController.m @@ -1,18 +1,10 @@ // // ViewController.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ViewController.h" diff --git a/examples_extra/CollectionViewWithViewControllerCells/Sample/main.m b/examples_extra/CollectionViewWithViewControllerCells/Sample/main.m index d5794dca4c..65850400e4 100644 --- a/examples_extra/CollectionViewWithViewControllerCells/Sample/main.m +++ b/examples_extra/CollectionViewWithViewControllerCells/Sample/main.m @@ -1,18 +1,10 @@ // // main.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples_extra/EditableText/Sample/AppDelegate.h b/examples_extra/EditableText/Sample/AppDelegate.h index 27e560aafe..19db03c153 100644 --- a/examples_extra/EditableText/Sample/AppDelegate.h +++ b/examples_extra/EditableText/Sample/AppDelegate.h @@ -1,18 +1,10 @@ // // AppDelegate.h -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples_extra/EditableText/Sample/AppDelegate.m b/examples_extra/EditableText/Sample/AppDelegate.m index c62355c06c..d0fd66f775 100644 --- a/examples_extra/EditableText/Sample/AppDelegate.m +++ b/examples_extra/EditableText/Sample/AppDelegate.m @@ -1,18 +1,10 @@ // // AppDelegate.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "AppDelegate.h" diff --git a/examples_extra/EditableText/Sample/ViewController.h b/examples_extra/EditableText/Sample/ViewController.h index fc52c022f2..c8a0626291 100644 --- a/examples_extra/EditableText/Sample/ViewController.h +++ b/examples_extra/EditableText/Sample/ViewController.h @@ -1,18 +1,10 @@ // // ViewController.h -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples_extra/EditableText/Sample/ViewController.m b/examples_extra/EditableText/Sample/ViewController.m index 6bbcad75cd..0a9703b897 100644 --- a/examples_extra/EditableText/Sample/ViewController.m +++ b/examples_extra/EditableText/Sample/ViewController.m @@ -1,18 +1,10 @@ // // ViewController.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ViewController.h" diff --git a/examples_extra/EditableText/Sample/main.m b/examples_extra/EditableText/Sample/main.m index 756080fb2b..511cd1a7ac 100644 --- a/examples_extra/EditableText/Sample/main.m +++ b/examples_extra/EditableText/Sample/main.m @@ -1,18 +1,10 @@ // // main.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples_extra/Multiplex/Sample/AppDelegate.h b/examples_extra/Multiplex/Sample/AppDelegate.h index 27e560aafe..19db03c153 100644 --- a/examples_extra/Multiplex/Sample/AppDelegate.h +++ b/examples_extra/Multiplex/Sample/AppDelegate.h @@ -1,18 +1,10 @@ // // AppDelegate.h -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples_extra/Multiplex/Sample/AppDelegate.m b/examples_extra/Multiplex/Sample/AppDelegate.m index c62355c06c..d0fd66f775 100644 --- a/examples_extra/Multiplex/Sample/AppDelegate.m +++ b/examples_extra/Multiplex/Sample/AppDelegate.m @@ -1,18 +1,10 @@ // // AppDelegate.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "AppDelegate.h" diff --git a/examples_extra/Multiplex/Sample/ScreenNode.h b/examples_extra/Multiplex/Sample/ScreenNode.h index ecfb4c2220..4ade23a06b 100644 --- a/examples_extra/Multiplex/Sample/ScreenNode.h +++ b/examples_extra/Multiplex/Sample/ScreenNode.h @@ -1,20 +1,10 @@ // // ScreenNode.h -// Sample +// Texture // -// Created by Huy Nguyen on 16/09/15. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples_extra/Multiplex/Sample/ScreenNode.m b/examples_extra/Multiplex/Sample/ScreenNode.m index ab0f94f394..345c5bed5d 100644 --- a/examples_extra/Multiplex/Sample/ScreenNode.m +++ b/examples_extra/Multiplex/Sample/ScreenNode.m @@ -1,20 +1,10 @@ // // ScreenNode.m -// Sample +// Texture // -// Created by Huy Nguyen on 16/09/15. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ScreenNode.h" @@ -146,7 +136,7 @@ } if (completion) { - completion([UIImage imageWithData:data], connectionError, nil); + completion([UIImage imageWithData:data], connectionError, nil, nil); } }); }; diff --git a/examples_extra/Multiplex/Sample/ViewController.h b/examples_extra/Multiplex/Sample/ViewController.h index c4af5a3e0d..27738fcbe1 100644 --- a/examples_extra/Multiplex/Sample/ViewController.h +++ b/examples_extra/Multiplex/Sample/ViewController.h @@ -1,18 +1,10 @@ // // ViewController.h -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples_extra/Multiplex/Sample/ViewController.m b/examples_extra/Multiplex/Sample/ViewController.m index 5cb4532a15..cd687f5bc7 100644 --- a/examples_extra/Multiplex/Sample/ViewController.m +++ b/examples_extra/Multiplex/Sample/ViewController.m @@ -1,18 +1,10 @@ // // ViewController.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ViewController.h" diff --git a/examples_extra/Multiplex/Sample/main.m b/examples_extra/Multiplex/Sample/main.m index 756080fb2b..511cd1a7ac 100644 --- a/examples_extra/Multiplex/Sample/main.m +++ b/examples_extra/Multiplex/Sample/main.m @@ -1,18 +1,10 @@ // // main.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples_extra/Placeholders/Sample/AppDelegate.h b/examples_extra/Placeholders/Sample/AppDelegate.h index 27e560aafe..19db03c153 100644 --- a/examples_extra/Placeholders/Sample/AppDelegate.h +++ b/examples_extra/Placeholders/Sample/AppDelegate.h @@ -1,18 +1,10 @@ // // AppDelegate.h -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples_extra/Placeholders/Sample/AppDelegate.m b/examples_extra/Placeholders/Sample/AppDelegate.m index c62355c06c..d0fd66f775 100644 --- a/examples_extra/Placeholders/Sample/AppDelegate.m +++ b/examples_extra/Placeholders/Sample/AppDelegate.m @@ -1,18 +1,10 @@ // // AppDelegate.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "AppDelegate.h" diff --git a/examples_extra/Placeholders/Sample/PostNode.h b/examples_extra/Placeholders/Sample/PostNode.h index 844d8e4606..646f72232d 100644 --- a/examples_extra/Placeholders/Sample/PostNode.h +++ b/examples_extra/Placeholders/Sample/PostNode.h @@ -1,18 +1,10 @@ // // PostNode.h -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples_extra/Placeholders/Sample/PostNode.m b/examples_extra/Placeholders/Sample/PostNode.m index 7d4a5c2c8b..27809b471d 100644 --- a/examples_extra/Placeholders/Sample/PostNode.m +++ b/examples_extra/Placeholders/Sample/PostNode.m @@ -1,18 +1,10 @@ // // PostNode.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "PostNode.h" diff --git a/examples_extra/Placeholders/Sample/SlowpokeImageNode.h b/examples_extra/Placeholders/Sample/SlowpokeImageNode.h index ba9706e1b5..9c6ef5c42d 100644 --- a/examples_extra/Placeholders/Sample/SlowpokeImageNode.h +++ b/examples_extra/Placeholders/Sample/SlowpokeImageNode.h @@ -1,18 +1,10 @@ // // SlowpokeImageNode.h -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples_extra/Placeholders/Sample/SlowpokeImageNode.m b/examples_extra/Placeholders/Sample/SlowpokeImageNode.m index ad607c71c2..8bf0f25bdf 100644 --- a/examples_extra/Placeholders/Sample/SlowpokeImageNode.m +++ b/examples_extra/Placeholders/Sample/SlowpokeImageNode.m @@ -1,18 +1,10 @@ // // SlowpokeImageNode.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "SlowpokeImageNode.h" diff --git a/examples_extra/Placeholders/Sample/SlowpokeShareNode.h b/examples_extra/Placeholders/Sample/SlowpokeShareNode.h index deb3a640af..3742854276 100644 --- a/examples_extra/Placeholders/Sample/SlowpokeShareNode.h +++ b/examples_extra/Placeholders/Sample/SlowpokeShareNode.h @@ -1,18 +1,10 @@ // // SlowpokeShareNode.h -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples_extra/Placeholders/Sample/SlowpokeShareNode.m b/examples_extra/Placeholders/Sample/SlowpokeShareNode.m index 4dcfe0547b..3d1e568756 100644 --- a/examples_extra/Placeholders/Sample/SlowpokeShareNode.m +++ b/examples_extra/Placeholders/Sample/SlowpokeShareNode.m @@ -1,18 +1,10 @@ // // SlowpokeShareNode.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "SlowpokeShareNode.h" diff --git a/examples_extra/Placeholders/Sample/SlowpokeTextNode.h b/examples_extra/Placeholders/Sample/SlowpokeTextNode.h index d99968e1f0..069833e53f 100644 --- a/examples_extra/Placeholders/Sample/SlowpokeTextNode.h +++ b/examples_extra/Placeholders/Sample/SlowpokeTextNode.h @@ -1,18 +1,10 @@ // // SlowpokeTextNode.h -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples_extra/Placeholders/Sample/SlowpokeTextNode.m b/examples_extra/Placeholders/Sample/SlowpokeTextNode.m index 7b3e133471..81cedf3ccd 100644 --- a/examples_extra/Placeholders/Sample/SlowpokeTextNode.m +++ b/examples_extra/Placeholders/Sample/SlowpokeTextNode.m @@ -1,18 +1,10 @@ // // SlowpokeTextNode.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "SlowpokeTextNode.h" diff --git a/examples_extra/Placeholders/Sample/ViewController.h b/examples_extra/Placeholders/Sample/ViewController.h index fc52c022f2..c8a0626291 100644 --- a/examples_extra/Placeholders/Sample/ViewController.h +++ b/examples_extra/Placeholders/Sample/ViewController.h @@ -1,18 +1,10 @@ // // ViewController.h -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples_extra/Placeholders/Sample/ViewController.m b/examples_extra/Placeholders/Sample/ViewController.m index c631740d3a..f1177963bb 100644 --- a/examples_extra/Placeholders/Sample/ViewController.m +++ b/examples_extra/Placeholders/Sample/ViewController.m @@ -1,18 +1,10 @@ // // ViewController.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ViewController.h" diff --git a/examples_extra/Placeholders/Sample/main.m b/examples_extra/Placeholders/Sample/main.m index 756080fb2b..511cd1a7ac 100644 --- a/examples_extra/Placeholders/Sample/main.m +++ b/examples_extra/Placeholders/Sample/main.m @@ -1,18 +1,10 @@ // // main.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples_extra/RepoSearcher/RepoSearcher/AppDelegate.swift b/examples_extra/RepoSearcher/RepoSearcher/AppDelegate.swift index d9e8b19907..75583b7cd9 100644 --- a/examples_extra/RepoSearcher/RepoSearcher/AppDelegate.swift +++ b/examples_extra/RepoSearcher/RepoSearcher/AppDelegate.swift @@ -1,9 +1,9 @@ // // AppDelegate.swift -// RepoSearcher +// Texture // -// Created by Marvin Nazari on 2017-02-18. -// Copyright © 2017 Marvin Nazari. All rights reserved. +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // import UIKit diff --git a/examples_extra/RepoSearcher/RepoSearcher/IGListCollectionContext+ASDK.swift b/examples_extra/RepoSearcher/RepoSearcher/IGListCollectionContext+ASDK.swift index df923205c8..31a951f349 100644 --- a/examples_extra/RepoSearcher/RepoSearcher/IGListCollectionContext+ASDK.swift +++ b/examples_extra/RepoSearcher/RepoSearcher/IGListCollectionContext+ASDK.swift @@ -1,9 +1,9 @@ // // IGListCollectionContext+ASDK.swift -// RepoSearcher +// Texture // -// Created by Marvin Nazari on 2017-02-18. -// Copyright © 2017 Marvin Nazari. All rights reserved. +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // import Foundation diff --git a/examples_extra/RepoSearcher/RepoSearcher/LabelSectionController.swift b/examples_extra/RepoSearcher/RepoSearcher/LabelSectionController.swift index fe65d2dfa1..d76dfdd78c 100644 --- a/examples_extra/RepoSearcher/RepoSearcher/LabelSectionController.swift +++ b/examples_extra/RepoSearcher/RepoSearcher/LabelSectionController.swift @@ -1,9 +1,9 @@ // // LabelSectionController.swift -// RepoSearcher +// Texture // -// Created by Marvin Nazari on 2017-02-18. -// Copyright © 2017 Marvin Nazari. All rights reserved. +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // import Foundation diff --git a/examples_extra/RepoSearcher/RepoSearcher/NSObject+IGListDiffable.swift b/examples_extra/RepoSearcher/RepoSearcher/NSObject+IGListDiffable.swift index f6b95a193e..eb95b06c78 100644 --- a/examples_extra/RepoSearcher/RepoSearcher/NSObject+IGListDiffable.swift +++ b/examples_extra/RepoSearcher/RepoSearcher/NSObject+IGListDiffable.swift @@ -1,9 +1,9 @@ // // NSObject+IGListDiffable.swift -// RepoSearcher +// Texture // -// Created by Marvin Nazari on 2017-02-18. -// Copyright © 2017 Marvin Nazari. All rights reserved. +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // import IGListKit diff --git a/examples_extra/RepoSearcher/RepoSearcher/SearchNode.swift b/examples_extra/RepoSearcher/RepoSearcher/SearchNode.swift index 57bb1eebea..c25322c9cc 100644 --- a/examples_extra/RepoSearcher/RepoSearcher/SearchNode.swift +++ b/examples_extra/RepoSearcher/RepoSearcher/SearchNode.swift @@ -1,9 +1,9 @@ // // SearchNode.swift -// RepoSearcher +// Texture // -// Created by Marvin Nazari on 2017-02-18. -// Copyright © 2017 Marvin Nazari. All rights reserved. +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // import Foundation diff --git a/examples_extra/RepoSearcher/RepoSearcher/SearchSectionController.swift b/examples_extra/RepoSearcher/RepoSearcher/SearchSectionController.swift index 1619b55984..def4b10edd 100644 --- a/examples_extra/RepoSearcher/RepoSearcher/SearchSectionController.swift +++ b/examples_extra/RepoSearcher/RepoSearcher/SearchSectionController.swift @@ -1,9 +1,9 @@ // // SearchSectionController.swift -// RepoSearcher +// Texture // -// Created by Marvin Nazari on 2017-02-18. -// Copyright © 2017 Marvin Nazari. All rights reserved. +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // import AsyncDisplayKit diff --git a/examples_extra/RepoSearcher/RepoSearcher/SearchViewController.swift b/examples_extra/RepoSearcher/RepoSearcher/SearchViewController.swift index dd00d9aa74..59556d4b37 100644 --- a/examples_extra/RepoSearcher/RepoSearcher/SearchViewController.swift +++ b/examples_extra/RepoSearcher/RepoSearcher/SearchViewController.swift @@ -1,9 +1,9 @@ // // SearchViewController.swift -// RepoSearcher +// Texture // -// Created by Marvin Nazari on 2017-02-18. -// Copyright © 2017 Marvin Nazari. All rights reserved. +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // import UIKit diff --git a/examples_extra/Shop/Shop/AppDelegate.swift b/examples_extra/Shop/Shop/AppDelegate.swift index 0c3c759fe5..ebae7efc3a 100644 --- a/examples_extra/Shop/Shop/AppDelegate.swift +++ b/examples_extra/Shop/Shop/AppDelegate.swift @@ -1,9 +1,9 @@ // // AppDelegate.swift -// Shop +// Texture // -// Created by Dimitri on 10/11/2016. -// Copyright © 2016 Dimitri. All rights reserved. +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // import UIKit diff --git a/examples_extra/Shop/Shop/Extensions/UIColor.swift b/examples_extra/Shop/Shop/Extensions/UIColor.swift index b00e6715dc..4d6444f131 100644 --- a/examples_extra/Shop/Shop/Extensions/UIColor.swift +++ b/examples_extra/Shop/Shop/Extensions/UIColor.swift @@ -1,9 +1,9 @@ // // UIColor.swift -// Shop +// Texture // -// Created by Dimitri on 10/11/2016. -// Copyright © 2016 Dimitri. All rights reserved. +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // import Foundation diff --git a/examples_extra/Shop/Shop/Models/Category.swift b/examples_extra/Shop/Shop/Models/Category.swift index e1ed7aa9f6..d5e4949230 100644 --- a/examples_extra/Shop/Shop/Models/Category.swift +++ b/examples_extra/Shop/Shop/Models/Category.swift @@ -1,9 +1,9 @@ // // Category.swift -// Shop +// Texture // -// Created by Dimitri on 10/11/2016. -// Copyright © 2016 Dimitri. All rights reserved. +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // import Foundation diff --git a/examples_extra/Shop/Shop/Models/DummyGenerator.swift b/examples_extra/Shop/Shop/Models/DummyGenerator.swift index 3cfe4ba7a4..d68e43751f 100644 --- a/examples_extra/Shop/Shop/Models/DummyGenerator.swift +++ b/examples_extra/Shop/Shop/Models/DummyGenerator.swift @@ -1,9 +1,9 @@ // // DummyGenerator.swift -// Shop +// Texture // -// Created by Dimitri on 14/11/2016. -// Copyright © 2016 Dimitri. All rights reserved. +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // import Foundation diff --git a/examples_extra/Shop/Shop/Models/Product.swift b/examples_extra/Shop/Shop/Models/Product.swift index c88cd21c74..67051c76ba 100644 --- a/examples_extra/Shop/Shop/Models/Product.swift +++ b/examples_extra/Shop/Shop/Models/Product.swift @@ -1,9 +1,9 @@ // // Product.swift -// Shop +// Texture // -// Created by Dimitri on 10/11/2016. -// Copyright © 2016 Dimitri. All rights reserved. +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // import Foundation diff --git a/examples_extra/Shop/Shop/Scenes/Product/ProductCellNode.swift b/examples_extra/Shop/Shop/Scenes/Product/ProductCellNode.swift index 3e61f06573..83a33ebd63 100644 --- a/examples_extra/Shop/Shop/Scenes/Product/ProductCellNode.swift +++ b/examples_extra/Shop/Shop/Scenes/Product/ProductCellNode.swift @@ -1,9 +1,9 @@ // // ProductCellNode.swift -// Shop +// Texture // -// Created by Dimitri on 15/11/2016. -// Copyright © 2016 Dimitri. All rights reserved. +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // import UIKit diff --git a/examples_extra/Shop/Shop/Scenes/Product/ProductNode.swift b/examples_extra/Shop/Shop/Scenes/Product/ProductNode.swift index 0efaf45d3b..8dda39d137 100644 --- a/examples_extra/Shop/Shop/Scenes/Product/ProductNode.swift +++ b/examples_extra/Shop/Shop/Scenes/Product/ProductNode.swift @@ -1,9 +1,9 @@ // // ProductNode.swift -// Shop +// Texture // -// Created by Dimitri on 15/11/2016. -// Copyright © 2016 Dimitri. All rights reserved. +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // import UIKit diff --git a/examples_extra/Shop/Shop/Scenes/Product/ProductViewController.swift b/examples_extra/Shop/Shop/Scenes/Product/ProductViewController.swift index 6251550848..9d36298e1d 100644 --- a/examples_extra/Shop/Shop/Scenes/Product/ProductViewController.swift +++ b/examples_extra/Shop/Shop/Scenes/Product/ProductViewController.swift @@ -1,9 +1,9 @@ // // ProductViewController.swift -// Shop +// Texture // -// Created by Dimitri on 10/11/2016. -// Copyright © 2016 Dimitri. All rights reserved. +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // import UIKit diff --git a/examples_extra/Shop/Shop/Scenes/Product/StarRatingNode.swift b/examples_extra/Shop/Shop/Scenes/Product/StarRatingNode.swift index 83a37564ff..21c373c858 100644 --- a/examples_extra/Shop/Shop/Scenes/Product/StarRatingNode.swift +++ b/examples_extra/Shop/Shop/Scenes/Product/StarRatingNode.swift @@ -1,9 +1,9 @@ // // StarRatingNode.swift -// Shop +// Texture // -// Created by Dimitri on 15/11/2016. -// Copyright © 2016 Dimitri. All rights reserved. +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // import UIKit diff --git a/examples_extra/Shop/Shop/Scenes/Products/ProductCollectionNode.swift b/examples_extra/Shop/Shop/Scenes/Products/ProductCollectionNode.swift index 7b0897811b..5c95586fed 100644 --- a/examples_extra/Shop/Shop/Scenes/Products/ProductCollectionNode.swift +++ b/examples_extra/Shop/Shop/Scenes/Products/ProductCollectionNode.swift @@ -1,9 +1,9 @@ // // ProductCollectionNode.swift -// Shop +// Texture // -// Created by Dimitri on 15/11/2016. -// Copyright © 2016 Dimitri. All rights reserved. +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // import UIKit diff --git a/examples_extra/Shop/Shop/Scenes/Products/ProductTableNode.swift b/examples_extra/Shop/Shop/Scenes/Products/ProductTableNode.swift index 7cb0a2b9f8..816d405dcf 100644 --- a/examples_extra/Shop/Shop/Scenes/Products/ProductTableNode.swift +++ b/examples_extra/Shop/Shop/Scenes/Products/ProductTableNode.swift @@ -1,9 +1,9 @@ // // ProductTableNode.swift -// Shop +// Texture // -// Created by Dimitri on 15/11/2016. -// Copyright © 2016 Dimitri. All rights reserved. +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // import UIKit diff --git a/examples_extra/Shop/Shop/Scenes/Products/ProductsCollectionViewController.swift b/examples_extra/Shop/Shop/Scenes/Products/ProductsCollectionViewController.swift index 39c63ead13..caa5278f07 100644 --- a/examples_extra/Shop/Shop/Scenes/Products/ProductsCollectionViewController.swift +++ b/examples_extra/Shop/Shop/Scenes/Products/ProductsCollectionViewController.swift @@ -1,9 +1,9 @@ // // ProductsCollectionViewController.swift -// Shop +// Texture // -// Created by Dimitri on 15/11/2016. -// Copyright © 2016 Dimitri. All rights reserved. +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // import UIKit diff --git a/examples_extra/Shop/Shop/Scenes/Products/ProductsLayout.swift b/examples_extra/Shop/Shop/Scenes/Products/ProductsLayout.swift index 8a6054c8c6..67f4a77837 100644 --- a/examples_extra/Shop/Shop/Scenes/Products/ProductsLayout.swift +++ b/examples_extra/Shop/Shop/Scenes/Products/ProductsLayout.swift @@ -1,9 +1,9 @@ // // ProductsLayout.swift -// Shop +// Texture // -// Created by Dimitri on 16/11/2016. -// Copyright © 2016 Dimitri. All rights reserved. +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // import UIKit diff --git a/examples_extra/Shop/Shop/Scenes/Products/ProductsTableViewController.swift b/examples_extra/Shop/Shop/Scenes/Products/ProductsTableViewController.swift index ab33726d96..bfb851a3f6 100644 --- a/examples_extra/Shop/Shop/Scenes/Products/ProductsTableViewController.swift +++ b/examples_extra/Shop/Shop/Scenes/Products/ProductsTableViewController.swift @@ -1,9 +1,9 @@ // // ProductsTableViewController.swift -// Shop +// Texture // -// Created by Dimitri on 15/11/2016. -// Copyright © 2016 Dimitri. All rights reserved. +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // import UIKit diff --git a/examples_extra/Shop/Shop/Scenes/Shop/ShopCellNode.swift b/examples_extra/Shop/Shop/Scenes/Shop/ShopCellNode.swift index df94f35bdc..5e71328296 100644 --- a/examples_extra/Shop/Shop/Scenes/Shop/ShopCellNode.swift +++ b/examples_extra/Shop/Shop/Scenes/Shop/ShopCellNode.swift @@ -1,9 +1,9 @@ // // ShopCellNode.swift -// Shop +// Texture // -// Created by Dimitri on 14/11/2016. -// Copyright © 2016 Dimitri. All rights reserved. +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // import UIKit diff --git a/examples_extra/Shop/Shop/Scenes/Shop/ShopViewController.swift b/examples_extra/Shop/Shop/Scenes/Shop/ShopViewController.swift index c32ce3f0a4..8feefa3f25 100644 --- a/examples_extra/Shop/Shop/Scenes/Shop/ShopViewController.swift +++ b/examples_extra/Shop/Shop/Scenes/Shop/ShopViewController.swift @@ -1,9 +1,9 @@ // // ShopViewController.swift -// Shop +// Texture // -// Created by Dimitri on 10/11/2016. -// Copyright © 2016 Dimitri. All rights reserved. +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // import UIKit diff --git a/examples_extra/Shop/Shop/Shop-Bridging-Header.h b/examples_extra/Shop/Shop/Shop-Bridging-Header.h index ba84a99573..943168eead 100644 --- a/examples_extra/Shop/Shop/Shop-Bridging-Header.h +++ b/examples_extra/Shop/Shop/Shop-Bridging-Header.h @@ -1,5 +1,9 @@ // -// Use this file to import your target's public headers that you would like to expose to Swift. +// Shop-Bridging-Header.h +// Texture +// +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples_extra/Shop/ShopTests/ShopTests.swift b/examples_extra/Shop/ShopTests/ShopTests.swift index 4838065106..b42098bc4c 100644 --- a/examples_extra/Shop/ShopTests/ShopTests.swift +++ b/examples_extra/Shop/ShopTests/ShopTests.swift @@ -1,9 +1,9 @@ // // ShopTests.swift -// ShopTests +// Texture // -// Created by Dimitri on 10/11/2016. -// Copyright © 2016 Dimitri. All rights reserved. +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // import XCTest diff --git a/examples_extra/SynchronousConcurrency/Sample/AppDelegate.h b/examples_extra/SynchronousConcurrency/Sample/AppDelegate.h index 5274628a9e..c30a27f4dc 100644 --- a/examples_extra/SynchronousConcurrency/Sample/AppDelegate.h +++ b/examples_extra/SynchronousConcurrency/Sample/AppDelegate.h @@ -1,18 +1,10 @@ // // AppDelegate.h -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples_extra/SynchronousConcurrency/Sample/AppDelegate.m b/examples_extra/SynchronousConcurrency/Sample/AppDelegate.m index c7da0d3cb1..662357cb71 100644 --- a/examples_extra/SynchronousConcurrency/Sample/AppDelegate.m +++ b/examples_extra/SynchronousConcurrency/Sample/AppDelegate.m @@ -1,18 +1,10 @@ // // AppDelegate.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "AppDelegate.h" diff --git a/examples_extra/SynchronousConcurrency/Sample/AsyncTableViewController.h b/examples_extra/SynchronousConcurrency/Sample/AsyncTableViewController.h index 9a2e1a09b4..2b8fe4ed9f 100644 --- a/examples_extra/SynchronousConcurrency/Sample/AsyncTableViewController.h +++ b/examples_extra/SynchronousConcurrency/Sample/AsyncTableViewController.h @@ -1,18 +1,10 @@ // // AsyncTableViewController.h -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples_extra/SynchronousConcurrency/Sample/AsyncTableViewController.m b/examples_extra/SynchronousConcurrency/Sample/AsyncTableViewController.m index d87c22ea54..2cacef05ea 100644 --- a/examples_extra/SynchronousConcurrency/Sample/AsyncTableViewController.m +++ b/examples_extra/SynchronousConcurrency/Sample/AsyncTableViewController.m @@ -1,18 +1,10 @@ // // AsyncTableViewController.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples_extra/SynchronousConcurrency/Sample/AsyncViewController.h b/examples_extra/SynchronousConcurrency/Sample/AsyncViewController.h index f307e65d6b..2c20ade6e9 100644 --- a/examples_extra/SynchronousConcurrency/Sample/AsyncViewController.h +++ b/examples_extra/SynchronousConcurrency/Sample/AsyncViewController.h @@ -1,20 +1,10 @@ // // AsyncViewController.h -// Sample +// Texture // -// Created by Scott Goodson on 9/26/15. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples_extra/SynchronousConcurrency/Sample/AsyncViewController.m b/examples_extra/SynchronousConcurrency/Sample/AsyncViewController.m index 5354915b51..de9b71cc89 100644 --- a/examples_extra/SynchronousConcurrency/Sample/AsyncViewController.m +++ b/examples_extra/SynchronousConcurrency/Sample/AsyncViewController.m @@ -1,20 +1,10 @@ // // AsyncViewController.m -// Sample +// Texture // -// Created by Scott Goodson on 9/26/15. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "AsyncViewController.h" diff --git a/examples_extra/SynchronousConcurrency/Sample/RandomCoreGraphicsNode.h b/examples_extra/SynchronousConcurrency/Sample/RandomCoreGraphicsNode.h index 1690acf54a..cdd60a3465 100644 --- a/examples_extra/SynchronousConcurrency/Sample/RandomCoreGraphicsNode.h +++ b/examples_extra/SynchronousConcurrency/Sample/RandomCoreGraphicsNode.h @@ -1,20 +1,10 @@ // // RandomCoreGraphicsNode.h -// Sample +// Texture // -// Created by Scott Goodson on 9/5/15. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples_extra/SynchronousConcurrency/Sample/RandomCoreGraphicsNode.m b/examples_extra/SynchronousConcurrency/Sample/RandomCoreGraphicsNode.m index 66b490df06..d80c51caf2 100644 --- a/examples_extra/SynchronousConcurrency/Sample/RandomCoreGraphicsNode.m +++ b/examples_extra/SynchronousConcurrency/Sample/RandomCoreGraphicsNode.m @@ -1,20 +1,10 @@ // // RandomCoreGraphicsNode.m -// Sample +// Texture // -// Created by Scott Goodson on 9/5/15. -// -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "RandomCoreGraphicsNode.h" diff --git a/examples_extra/SynchronousConcurrency/Sample/main.m b/examples_extra/SynchronousConcurrency/Sample/main.m index 756080fb2b..511cd1a7ac 100644 --- a/examples_extra/SynchronousConcurrency/Sample/main.m +++ b/examples_extra/SynchronousConcurrency/Sample/main.m @@ -1,18 +1,10 @@ // // main.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples_extra/SynchronousKittens/Sample/AppDelegate.h b/examples_extra/SynchronousKittens/Sample/AppDelegate.h index 5274628a9e..c30a27f4dc 100644 --- a/examples_extra/SynchronousKittens/Sample/AppDelegate.h +++ b/examples_extra/SynchronousKittens/Sample/AppDelegate.h @@ -1,18 +1,10 @@ // // AppDelegate.h -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples_extra/SynchronousKittens/Sample/AppDelegate.m b/examples_extra/SynchronousKittens/Sample/AppDelegate.m index 58fe564898..f8437855b0 100644 --- a/examples_extra/SynchronousKittens/Sample/AppDelegate.m +++ b/examples_extra/SynchronousKittens/Sample/AppDelegate.m @@ -1,18 +1,10 @@ // // AppDelegate.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "AppDelegate.h" diff --git a/examples_extra/SynchronousKittens/Sample/BlurbNode.h b/examples_extra/SynchronousKittens/Sample/BlurbNode.h index e6574bcd05..5451fb39f0 100644 --- a/examples_extra/SynchronousKittens/Sample/BlurbNode.h +++ b/examples_extra/SynchronousKittens/Sample/BlurbNode.h @@ -1,18 +1,10 @@ // // BlurbNode.h -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples_extra/SynchronousKittens/Sample/BlurbNode.m b/examples_extra/SynchronousKittens/Sample/BlurbNode.m index 7b02ae93de..6014711d33 100644 --- a/examples_extra/SynchronousKittens/Sample/BlurbNode.m +++ b/examples_extra/SynchronousKittens/Sample/BlurbNode.m @@ -1,18 +1,10 @@ // // BlurbNode.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "BlurbNode.h" diff --git a/examples_extra/SynchronousKittens/Sample/KittenNode.h b/examples_extra/SynchronousKittens/Sample/KittenNode.h index 9193b9df29..5b0b04203e 100644 --- a/examples_extra/SynchronousKittens/Sample/KittenNode.h +++ b/examples_extra/SynchronousKittens/Sample/KittenNode.h @@ -1,18 +1,10 @@ // // KittenNode.h -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples_extra/SynchronousKittens/Sample/KittenNode.mm b/examples_extra/SynchronousKittens/Sample/KittenNode.mm index 87e2c40f49..5fcebf393e 100644 --- a/examples_extra/SynchronousKittens/Sample/KittenNode.mm +++ b/examples_extra/SynchronousKittens/Sample/KittenNode.mm @@ -1,18 +1,10 @@ // // KittenNode.mm -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "KittenNode.h" diff --git a/examples_extra/SynchronousKittens/Sample/ViewController.h b/examples_extra/SynchronousKittens/Sample/ViewController.h index fc52c022f2..c8a0626291 100644 --- a/examples_extra/SynchronousKittens/Sample/ViewController.h +++ b/examples_extra/SynchronousKittens/Sample/ViewController.h @@ -1,18 +1,10 @@ // // ViewController.h -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples_extra/SynchronousKittens/Sample/ViewController.m b/examples_extra/SynchronousKittens/Sample/ViewController.m index f10b60edbe..1757807a1d 100644 --- a/examples_extra/SynchronousKittens/Sample/ViewController.m +++ b/examples_extra/SynchronousKittens/Sample/ViewController.m @@ -1,18 +1,10 @@ // // ViewController.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ViewController.h" diff --git a/examples_extra/SynchronousKittens/Sample/main.m b/examples_extra/SynchronousKittens/Sample/main.m index 756080fb2b..511cd1a7ac 100644 --- a/examples_extra/SynchronousKittens/Sample/main.m +++ b/examples_extra/SynchronousKittens/Sample/main.m @@ -1,18 +1,10 @@ // // main.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples_extra/TextStressTest/Sample/AppDelegate.h b/examples_extra/TextStressTest/Sample/AppDelegate.h index 2aa29369b4..e4a477eb23 100644 --- a/examples_extra/TextStressTest/Sample/AppDelegate.h +++ b/examples_extra/TextStressTest/Sample/AppDelegate.h @@ -1,13 +1,10 @@ -/* This file provided by Facebook is for non-commercial testing and evaluation - * purposes only. Facebook reserves all rights not expressly granted. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ +// +// AppDelegate.h +// Texture +// +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 +// #import diff --git a/examples_extra/TextStressTest/Sample/AppDelegate.m b/examples_extra/TextStressTest/Sample/AppDelegate.m index 5be641c029..c54a53505e 100644 --- a/examples_extra/TextStressTest/Sample/AppDelegate.m +++ b/examples_extra/TextStressTest/Sample/AppDelegate.m @@ -2,12 +2,8 @@ // AppDelegate.m // Texture // -// Copyright (c) 2017-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "AppDelegate.h" diff --git a/examples_extra/TextStressTest/Sample/CollectionViewController.h b/examples_extra/TextStressTest/Sample/CollectionViewController.h index 159b2fa1c9..d9329bdb07 100644 --- a/examples_extra/TextStressTest/Sample/CollectionViewController.h +++ b/examples_extra/TextStressTest/Sample/CollectionViewController.h @@ -2,12 +2,8 @@ // CollectionViewController.h // Texture // -// Copyright (c) 2017-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples_extra/TextStressTest/Sample/CollectionViewController.m b/examples_extra/TextStressTest/Sample/CollectionViewController.m index d93005236b..0464c376fa 100644 --- a/examples_extra/TextStressTest/Sample/CollectionViewController.m +++ b/examples_extra/TextStressTest/Sample/CollectionViewController.m @@ -2,12 +2,8 @@ // CollectionViewController.m // Texture // -// Copyright (c) 2017-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "CollectionViewController.h" diff --git a/examples_extra/TextStressTest/Sample/TabBarController.h b/examples_extra/TextStressTest/Sample/TabBarController.h index 5a25bb04ac..a8d7f80512 100644 --- a/examples_extra/TextStressTest/Sample/TabBarController.h +++ b/examples_extra/TextStressTest/Sample/TabBarController.h @@ -2,12 +2,8 @@ // TabBarController.h // Texture // -// Copyright (c) 2017-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples_extra/TextStressTest/Sample/TabBarController.m b/examples_extra/TextStressTest/Sample/TabBarController.m index a7905cb235..d056f1f679 100644 --- a/examples_extra/TextStressTest/Sample/TabBarController.m +++ b/examples_extra/TextStressTest/Sample/TabBarController.m @@ -2,12 +2,8 @@ // TabBarController.m // Texture // -// Copyright (c) 2017-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "TabBarController.h" diff --git a/examples_extra/TextStressTest/Sample/TextCellNode.h b/examples_extra/TextStressTest/Sample/TextCellNode.h index c4b35cfaf4..2ae855e5fb 100644 --- a/examples_extra/TextStressTest/Sample/TextCellNode.h +++ b/examples_extra/TextStressTest/Sample/TextCellNode.h @@ -2,12 +2,8 @@ // TextCellNode.h // Texture // -// Copyright (c) 2017-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples_extra/TextStressTest/Sample/TextCellNode.m b/examples_extra/TextStressTest/Sample/TextCellNode.m index 13bb7694cb..4b777b5677 100644 --- a/examples_extra/TextStressTest/Sample/TextCellNode.m +++ b/examples_extra/TextStressTest/Sample/TextCellNode.m @@ -2,12 +2,8 @@ // TextCellNode.m // Texture // -// Copyright (c) 2017-present, Pinterest, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "TextCellNode.h" diff --git a/examples_extra/TextStressTest/Sample/ViewController.h b/examples_extra/TextStressTest/Sample/ViewController.h index d0e9200d88..8c2d4162b9 100644 --- a/examples_extra/TextStressTest/Sample/ViewController.h +++ b/examples_extra/TextStressTest/Sample/ViewController.h @@ -1,13 +1,10 @@ -/* This file provided by Facebook is for non-commercial testing and evaluation - * purposes only. Facebook reserves all rights not expressly granted. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ +// +// ViewController.h +// Texture +// +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 +// #import diff --git a/examples_extra/TextStressTest/Sample/ViewController.m b/examples_extra/TextStressTest/Sample/ViewController.m index 3c21c64b8a..f14bba18b3 100644 --- a/examples_extra/TextStressTest/Sample/ViewController.m +++ b/examples_extra/TextStressTest/Sample/ViewController.m @@ -1,13 +1,10 @@ -/* This file provided by Facebook is for non-commercial testing and evaluation - * purposes only. Facebook reserves all rights not expressly granted. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ +// +// ViewController.m +// Texture +// +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 +// #import "ViewController.h" #import diff --git a/examples_extra/TextStressTest/Sample/main.m b/examples_extra/TextStressTest/Sample/main.m index ae9488711c..1745cc192d 100644 --- a/examples_extra/TextStressTest/Sample/main.m +++ b/examples_extra/TextStressTest/Sample/main.m @@ -1,13 +1,10 @@ -/* This file provided by Facebook is for non-commercial testing and evaluation - * purposes only. Facebook reserves all rights not expressly granted. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ +// +// main.m +// Texture +// +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 +// #import diff --git a/examples_extra/VideoTableView/Sample/AppDelegate.h b/examples_extra/VideoTableView/Sample/AppDelegate.h index 5274628a9e..c30a27f4dc 100644 --- a/examples_extra/VideoTableView/Sample/AppDelegate.h +++ b/examples_extra/VideoTableView/Sample/AppDelegate.h @@ -1,18 +1,10 @@ // // AppDelegate.h -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples_extra/VideoTableView/Sample/AppDelegate.m b/examples_extra/VideoTableView/Sample/AppDelegate.m index 58fe564898..f8437855b0 100644 --- a/examples_extra/VideoTableView/Sample/AppDelegate.m +++ b/examples_extra/VideoTableView/Sample/AppDelegate.m @@ -1,18 +1,10 @@ // // AppDelegate.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "AppDelegate.h" diff --git a/examples_extra/VideoTableView/Sample/BlurbNode.h b/examples_extra/VideoTableView/Sample/BlurbNode.h index e6574bcd05..5451fb39f0 100644 --- a/examples_extra/VideoTableView/Sample/BlurbNode.h +++ b/examples_extra/VideoTableView/Sample/BlurbNode.h @@ -1,18 +1,10 @@ // // BlurbNode.h -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples_extra/VideoTableView/Sample/BlurbNode.m b/examples_extra/VideoTableView/Sample/BlurbNode.m index 36dea1ecae..ba39439157 100644 --- a/examples_extra/VideoTableView/Sample/BlurbNode.m +++ b/examples_extra/VideoTableView/Sample/BlurbNode.m @@ -1,18 +1,10 @@ // // BlurbNode.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "BlurbNode.h" diff --git a/examples_extra/VideoTableView/Sample/NicCageNode.h b/examples_extra/VideoTableView/Sample/NicCageNode.h index 6dbff3ffa5..b2937f6a44 100644 --- a/examples_extra/VideoTableView/Sample/NicCageNode.h +++ b/examples_extra/VideoTableView/Sample/NicCageNode.h @@ -1,18 +1,10 @@ // // NicCageNode.h -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples_extra/VideoTableView/Sample/NicCageNode.mm b/examples_extra/VideoTableView/Sample/NicCageNode.mm index 95a62d957f..5e960ee013 100644 --- a/examples_extra/VideoTableView/Sample/NicCageNode.mm +++ b/examples_extra/VideoTableView/Sample/NicCageNode.mm @@ -2,17 +2,9 @@ // NicCageNode.mm // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "NicCageNode.h" diff --git a/examples_extra/VideoTableView/Sample/ViewController.h b/examples_extra/VideoTableView/Sample/ViewController.h index fc52c022f2..c8a0626291 100644 --- a/examples_extra/VideoTableView/Sample/ViewController.h +++ b/examples_extra/VideoTableView/Sample/ViewController.h @@ -1,18 +1,10 @@ // // ViewController.h -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/examples_extra/VideoTableView/Sample/ViewController.m b/examples_extra/VideoTableView/Sample/ViewController.m index a57e3b2094..5e1553c571 100644 --- a/examples_extra/VideoTableView/Sample/ViewController.m +++ b/examples_extra/VideoTableView/Sample/ViewController.m @@ -1,18 +1,10 @@ // // ViewController.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ViewController.h" diff --git a/examples_extra/VideoTableView/Sample/main.m b/examples_extra/VideoTableView/Sample/main.m index 756080fb2b..511cd1a7ac 100644 --- a/examples_extra/VideoTableView/Sample/main.m +++ b/examples_extra/VideoTableView/Sample/main.m @@ -1,18 +1,10 @@ // // main.m -// Sample +// Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the root directory of this source tree. An additional grant -// of patent rights can be found in the PATENTS file in the same directory. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/smoke-tests/Framework/Sample/AppDelegate.swift b/smoke-tests/Framework/Sample/AppDelegate.swift index 843523a436..a2c10adbba 100644 --- a/smoke-tests/Framework/Sample/AppDelegate.swift +++ b/smoke-tests/Framework/Sample/AppDelegate.swift @@ -2,17 +2,9 @@ // AppDelegate.swift // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // import UIKit diff --git a/smoke-tests/Framework/Sample/ViewController.swift b/smoke-tests/Framework/Sample/ViewController.swift index 544850d42d..9d96ac7477 100644 --- a/smoke-tests/Framework/Sample/ViewController.swift +++ b/smoke-tests/Framework/Sample/ViewController.swift @@ -2,17 +2,9 @@ // ViewController.swift // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // import UIKit diff --git a/smoke-tests/Life Without CocoaPods/Life With Frameworks/main.m b/smoke-tests/Life Without CocoaPods/Life With Frameworks/main.m index 3f9d50d481..feb53cc3f7 100644 --- a/smoke-tests/Life Without CocoaPods/Life With Frameworks/main.m +++ b/smoke-tests/Life Without CocoaPods/Life With Frameworks/main.m @@ -1,9 +1,9 @@ // // main.m -// Life With Frameworks +// Texture // -// Created by Kiel Gillard on 7/07/2016. -// Copyright © 2016 Facebook. All rights reserved. +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/smoke-tests/Life Without CocoaPods/Life Without CocoaPods/AppDelegate.h b/smoke-tests/Life Without CocoaPods/Life Without CocoaPods/AppDelegate.h index bda0aacab9..75aff7fc14 100644 --- a/smoke-tests/Life Without CocoaPods/Life Without CocoaPods/AppDelegate.h +++ b/smoke-tests/Life Without CocoaPods/Life Without CocoaPods/AppDelegate.h @@ -2,17 +2,8 @@ // AppDelegate.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/smoke-tests/Life Without CocoaPods/Life Without CocoaPods/AppDelegate.m b/smoke-tests/Life Without CocoaPods/Life Without CocoaPods/AppDelegate.m index 14306e7930..d6890ff2e3 100644 --- a/smoke-tests/Life Without CocoaPods/Life Without CocoaPods/AppDelegate.m +++ b/smoke-tests/Life Without CocoaPods/Life Without CocoaPods/AppDelegate.m @@ -2,17 +2,8 @@ // AppDelegate.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "AppDelegate.h" diff --git a/smoke-tests/Life Without CocoaPods/Life Without CocoaPods/ViewController.h b/smoke-tests/Life Without CocoaPods/Life Without CocoaPods/ViewController.h index 1d87bcb6e1..261e9ff480 100644 --- a/smoke-tests/Life Without CocoaPods/Life Without CocoaPods/ViewController.h +++ b/smoke-tests/Life Without CocoaPods/Life Without CocoaPods/ViewController.h @@ -2,17 +2,8 @@ // ViewController.h // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import diff --git a/smoke-tests/Life Without CocoaPods/Life Without CocoaPods/ViewController.m b/smoke-tests/Life Without CocoaPods/Life Without CocoaPods/ViewController.m index 181eda42c2..106ee524f4 100644 --- a/smoke-tests/Life Without CocoaPods/Life Without CocoaPods/ViewController.m +++ b/smoke-tests/Life Without CocoaPods/Life Without CocoaPods/ViewController.m @@ -2,17 +2,8 @@ // ViewController.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import "ViewController.h" diff --git a/smoke-tests/Life Without CocoaPods/Life Without CocoaPods/main.m b/smoke-tests/Life Without CocoaPods/Life Without CocoaPods/main.m index 27c659b765..ec43dab250 100644 --- a/smoke-tests/Life Without CocoaPods/Life Without CocoaPods/main.m +++ b/smoke-tests/Life Without CocoaPods/Life Without CocoaPods/main.m @@ -2,17 +2,8 @@ // main.m // Texture // -// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -// This source code is licensed under the BSD-style license found in the -// LICENSE file in the /ASDK-Licenses directory of this source tree. An additional -// grant of patent rights can be found in the PATENTS file in the same directory. -// -// Modifications to this file made after 4/13/2017 are: Copyright (c) 2017-present, -// Pinterest, Inc. Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright (c) Pinterest, Inc. All rights reserved. +// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import