Commit Graph
5023 Commits
Author SHA1 Message Date
Kevin Smith 21bb50da68 Add files we reviewed : ASTextNode2 & company 2021-01-15 10:42:39 -08:00
Rahul Malik 6464153489 Cleanup from recent changes (#1647)
- Fix availability warnings for usage of userInterfaceLevel
- Deprecate `asyncTraitCollectionDidChange` in favor of the new method
- Remove old compiler warning flag added for Xcode 9 building
- Access `textColorFollowsTintColor` with a locked scope
sync-base-08-29-19
2019-08-28 12:24:03 -07:00
Rahul Malik dfe0f57311 Propagate ASTraitCollection for snapshot testing (#1646)
Our helper methods set the current trait collection on the node we want
to snapshot but did not propagate the trait collection as expected.
2019-08-28 10:43:00 -07:00
Rahul Malik caa0d8de54 Fix issue where UIGraphicsRendererFormat is mutated (#1645)
* Fix issue where UIGraphicsRendererFormat is mutated

As part of https://github.com/TextureGroup/Texture/pull/1629, we use the
preferred or default UIGraphicsRendererFormat. This was pointing to a
static variable which content scale was mutated across several graphic
render passes and lead to pixelated views.

* Update reference images with iOS 10.3
2019-08-27 13:51:38 -07:00
Rahul Malik bda0a5b22b Track backgroundColor in ASDisplayNode (#1640)
To preserve dynamic color capabilities for layer-backed
nodes, we need to track backgroundColor as a UIColor. In layer backed nodes we lose the dynamic color logic since we
extract a CGColor from the UIColor applied to ASDisplayNode. With this
change we can respond to changes in UITraitCollection.userInterfaceStyle
for backgroundColor.
2019-08-26 17:58:53 -07:00
vovasty 1961a5a948 Add support for loading image variants through Asset catalogs (#1630)
Currently ASImageNode would initially load the correct asset from the asset catalog but would not respond to changes in trait collections that would require loading a different asset from the asset catalog. This change allows use to use `-[UIImage imageAsset]` to reference the asset catalog entry for the current image and load the appropriate version based on the current trait collection
2019-08-23 14:42:05 -07:00
Hanton Yang 762c8e8bff Keep using unowned macro (#1626) 2019-08-22 17:02:50 -07:00
Rahul Malik e0d5cedd23 Dark Mode dynamic rendering preparation, adding experiment to propagate older trait collections (#1637)
- Adding experiment to propagate older trait collections when trait
collections change
- Re-render nodes when user interface style changes (dark mode)
- Snapshot testing examples for dark mode
- Fixes for applying trait collection overrides in XCTest
- Create new define for gating Xcode 11 / iOS 13 features until CI is running it
2019-08-22 15:53:17 -07:00
Jessie Alvarez ccee5666dd Allow full color tinting on grayscale template images. (#1629)
* Allow full color tinting on grayscale template images.

* Signing a commit with the correct email address.

* Add snapshot test for a grayscale image with ASExperimentalDrawingGlobal enabled.
2019-08-22 12:53:49 -07:00
Huy Nguyen 28be9bb21e Update Danger workflow (#1636)
Turned out that @babel/plugin-transform-flow-strip-types is needed for TypeScript/Bale transpilation with we don't need because we use JS. So instead of installing the module, we can. just disable transpilation by DANGER_DISABLE_TRANSPILATION environment variable to true.

Test plan: Tested manually here: https://github.com/TextureGroup/Texture/commit/a4cfe347914c23aafe08603bf82372d4cb94136c/checks
2019-08-22 11:29:48 -07:00
Huy Nguyen 44aecb368f Remove BUCK support (#1632)
None of the core maintainers uses BUCK and so the build files are not maintained. Let's remove them to clean up the repo.
2019-08-22 11:13:51 -07:00
Huy Nguyen 015e4e463b Remove Travis and Slather configs, as well as run_tests_update_status.sh (#1633)
We no longer use Travis CI. We haven't found Slather useful. Garrett said run_tests_update_status.sh can be removed as well.
2019-08-22 10:39:51 -07:00
Huy Nguyen fff7763279 Run Danger with GitHub Actions (#1635) 2019-08-22 10:20:33 -07:00
Huy Nguyen 57afd63fdd [GitHub CI] Remove build approval step (#1631)
In #1627 I introduced an approval step that is meant to block PRs from forked repos unless they're labeled as "CI approved" by a maintainer. Turned out it doesn't work. When a label is added, a pull_request event with "labeled" as its action is fired but GitHub CI didn't restart the workflow. My guess is it checked the PR's commit and branch and determined that nothing has changed. Here is what the doc says: "A workflow runs on a specific version of code in your repository, determined by the commit SHA and Git ref" (https://help.github.com/en/articles/events-that-trigger-workflows#webhook-events).

This diff removes the label check so all PRs are automatically built. Here are the current usage limits in case we run into them: https://help.github.com/en/articles/workflow-syntax-for-github-actions#usage-limits
2019-08-21 14:53:42 -07:00
Hanton Yang 1467319ec3 Minor code improvements (#1622)
* Simplify code logic

* Keep using user-defined type
2019-08-20 22:14:15 -07:00
Huy Nguyen beadc28934 [GitHub CI] Add step to block PRs from forked repositories unless they have the right label (#1627)
Block pull requests from forked repositories that aren't from, and aren't labeled by, a maintainer. Adding "CI approved" label will unblock them.
2019-08-20 15:24:48 -07:00
Huy Nguyen 33c4b05907 Set up GitHub Actions CI (#1623)
GitHub Actions now supports CI and it's free for open source projects!

Our current CI runs on a single machine and needs 1h 20m for each build. GitHub CI often finishes everything in less than 10m!

The setup is straight-forward. The only missing feature is the ability to exclude certain files so that if a commit only contains those files, the CI won't test it at all (see exclude-from-build.json). Given that GitHub CI is fast and is not a serial queue, I wouldn't mind testing such commit as well.

* Fix and optimize steps that build example projects

- examples-pt3 builds the same examples as examples-pt1 instead of building the remaining projects. So I fixed it.
- Add another mode (examples-pt4) to distribute the load with existing steps.
- Build extra examples (examples-extra-pt{1, 2, 3}) which weren't built before.
- Each examples-pt and examples-extra-pt builds 5 projects except examples-pt4 and examples-extra-pt3 which build 6.

* Use HTTPS URL for Weaver in Podfile of examples/ASDKgram

* Don't build extra examples for now
2019-08-18 16:40:30 -07:00
Huy Nguyen ab0a14c8ab Minor changes to tint color support (#1620) 2019-08-15 12:59:10 -07:00
Rahul Malik b9903a4155 Add support for tinting layer-backed ASDisplayNode (#1617)
* Add support for tinting layer-backed ASImageNode's

* Move tint color support ASDisplayNode

* Address comments, unlock before calling "tintColorDidChange" on
subclasses

* Address comments
2019-08-15 10:03:15 -07:00
Huy Nguyen b721a911c8 Remove _ASDisplayLayer's delegateDidChangeBounds flag (#1618)
We rely on the delegate setter to be called to set the flag. However, recent change on iOS 13 causes the setter to not be called at all and thus we had to put up a workaround (https://github.com/TextureGroup/Texture/pull/1609). While the workaround works, the perf benefit of that the flag provides doesn't warranty the extra complexity IMO. So I think we should just remove everything.
2019-08-15 10:01:36 -07:00
Hanton Yang ad1ed9f6b6 Remove unused headers (#1615)
* Improve compilation time by reducing unnecessary compilation dependencies
* More clean code
2019-08-15 05:42:26 -07:00
Rahul Malik 4caf9511f4 Avoid querying for NSAttributedString attributes on empty string (#1614) 2019-08-13 14:39:27 -07:00
Michael Schneider 0c78681cdc Cleanup for cgFloatForYogaFloat (#1571)
- Return CGFloat
- Proper check for YGUndefined
- Add YGUndefined default return value
2019-08-12 14:05:23 -07:00
Rahul Malik 540f1344ab Add support for tintColor on ASImageNode and ASButtonNode (#1603)
- Add the ability to specify a tintColor for images / buttons that behave similarly to how they would under UIKit.
- Add flag to control if tint color is applied to ASTextNode to match how
UIKit controls if it is .applied to UILabel.
- Update tests for not-tinting automatic render mode for UIImage.
- Add property on ASTextNode2.
- Add tint color support to ASTextNode2.
2019-08-12 09:14:54 -07:00
Rahul Malik ae00a9053d Force -[_ASDisplayLayer setDelegate:] to evaluate delegateFlags in iOS13. (#1609)
It appears that UIKit might be setting the delegate ivar directly which bypasses establishing the `_delegateFlags` ivar on `ASDisplayLayer`. This is critical for things like ASPagerNode, ASCollectionNode that depend on layer delegateFlags to forward bounds changes.
Radar filed: FB6956185
2019-08-08 10:15:22 -07:00
Hanton 3a3e574ef0 Update periodicTimeObserverTimescale's comment default value, according to the real value set in the implementation (#1604) 2019-08-04 10:08:38 -07:00
Ray Sang Hyuk Cho ecd0ef7374 [ASImageNode] Stop setting frameInterval for animated image optimization (#1607)
We previously tried to optimize showing animated images (e.g. GIF) by calling
display link for updating the frame just when when we need the next frame, but
this resulted in some frames dropping when `frameInterval` wasn't respected like
you can find from this GIF:
https://i.pinimg.com/originals/58/9c/e8/589ce828d2ef0797da0e85b1c6d2f2b3.gif

Since the the display link fire method continues if we detect we're
at the same image index as before, let's just remove this optimization.
2019-08-04 10:07:17 -07:00
dirtmelon a88e3cfc5f Add new property alwaysHandleTapTruncationAction to ASTextNode2 and ASTextNode. (#1520)
If the alwaysHandleTapTruncationAction is YES, the ASTextNode and ASTextNode2 can handle touches on additional attributed message even passthrough is YES.
2019-07-30 10:50:01 -07:00
Huy Nguyen 0568a537d9 [Dev docs] Fix previous and next page links (#1601)
Our pages are organized in 2 dirs: /docs/ and /development/.

Within a dir, prevPage and nextPage are relative (to the dir) so its path should be appended to their href links (see docs/_layouts/docs.html). The dir is available in the page's permalink var.

Some prevPage and nextPage point to a page in a different dir in which case they must not be relative. Instead they must include the other dir's path and thus their links won't be modified.

Also removed some pages that are no longer needed and fixed some prevPage and nextPage values.

I tested this diff locally and all links worked fine.
2019-07-29 12:09:19 -07:00
Hanton 6608f46a8e Update .gitignore file to include Carthage's artifacts (#1581)
* Update .gitignore file [Carthage]

* Add Cartfile.resolved file

Quoting from Carthage's README.md on Github:
"Along the way, Carthage will have created some build artifacts. The most important of these is the Cartfile.resolved file, which lists the versions that were actually built for each framework. Make sure to commit your Cartfile.resolved, because anyone else using the project will need that file to build the same framework versions."
2019-07-29 11:10:18 -07:00
Hanton 0537a94df5 Fix ASBasicImageDownloaderTests (#1576) 2019-07-28 13:09:47 -07:00
Hanton e93e666f45 [Examples] Fix all project coding warnings in examples folder (#1582) 2019-07-28 13:09:02 -07:00
Hanton 4a2d77dc9e [Examples] Migrate to the recommended -nodeBlock data source method, so node containers will be able to prepare and display all of its cells concurrently (#1596) 2019-07-28 13:08:28 -07:00
Hanton b933f661b9 Use AS_ARRAY_SIZE for array counting (#1600) 2019-07-28 13:07:54 -07:00
Huy Nguyen 67f2ea5c42 Add dev docs navigation (#1599) 2019-07-26 08:09:40 -07:00
Hanton 7aba2873b1 [Dev docs] fix broken image links (#1597) 2019-07-25 15:39:38 -07:00
Wu Zhong 9cedd4e3e6 Add download progress support to ASNetworkImageNode (#1489) 2019-07-24 22:44:16 -07:00
Rahul Malik 4ebd38c316 Update ASPendingState type for backgroundColor to UIColor
Given that UIColor is now a dynamic provider we can no longer rely on the fact that there is a 1:1 mapping between UIColor <-> CGColorRef.

I've updated the UIViewBridge and ASPendingState accordingly to use UIColor and translate to CGColorRef only when interacting with layers. This should preserve any dynamic capabilities we might need in the future when trying to re-render layer backed nodes.
2019-07-20 18:53:37 -07:00
Rahul Malik d4d6897a97 Set background color directly to view if not layer backed (#1588)
* Set background color directly to view or layer depending on if the node
is layerBacked.

Summary:
UIColor can now be a dynamic color provider to support capabilities like Dark Mode in applications. UIKit is able to re-render views when a user enters dark mode but this dynamic capabilities is not handled at the layer level.

Currently this takes the recommendation in facebookarchive/AsyncDisplayKit#1537 (comment) to set background color on the view directly or layer depending on if the node is layer backed. This change allows UIKit to track these colors and update the UI when the UITraitCollection.userInterfaceStyle changes.

* Updates to UIViewBridge to fix tests

* Remove opaque

* Test fixes

* Revert change to test checker method

* Fix strange issue where setting UIView backgroundColor sets the layer to
opaque to false

* Address Huy comments

* Address last comment
2019-07-19 19:17:01 -07:00
ernestmama 9c537ead5d Add a new networking image delegate method when a network image node failed to load from cache (#1590) 2019-07-19 11:45:37 -07:00
Huy Nguyen b0382994b7 Fix missing app icon in Showcase page 2019-07-18 09:37:06 -07:00
Huy Nguyen 4ddb785cab Minor changes to showcase.md 2019-07-18 09:32:47 -07:00
Chetan Garg c24d4c1870 Add Longwalks app to Showcase page (#1556) 2019-07-18 09:29:28 -07:00
Michael Zuccarino 935abc4b51 Add link to Getting Started to Overview page (#1587) 2019-07-15 18:14:39 -07:00
Huy Nguyen 45f1611ccb [Dev doc] Improve title of how-to-debug.md (#1586) 2019-07-15 13:53:54 -07:00
Huy Nguyen b15bcfd6d7 [Dev docs] Update navigation bar (#1585) 2019-07-15 13:53:32 -07:00
Huy Nguyen 8640d568f4 [Dev doc] Minor updates to collection-asynchronous-updates.md 2019-07-15 12:14:21 -07:00
Hanton 88946c4b93 Update docs navigation orders (#1584) 2019-07-15 12:02:43 -07:00
Greg Bolsinga 7da85c5008 Run Import Optimizer on Texture (#1580)
* Run Import Optimizer on Texture
2019-07-11 19:19:13 -07:00
Hanton b7d64a0917 Fix the build warning in ASRangeController.mm (#1575) 2019-07-11 12:14:14 -07:00