Skip to content

Commit

Permalink
[Accessibility] Ship ASExperimentalDoNotCacheAccessibilityElements (T…
Browse files Browse the repository at this point in the history
…extureGroup#1888)

We did not notice any effect on performance of the Pinterest app by not caching `accessibilityElements` in `_ASDisplayView`. By not caching the elements, we can be sure that the elements will be correct even when nodes change visibility state. There will be a performance impact when voice over is enabled, but providing the correct elements for the current state of a view is more important than performance in this case.

TextureGroup#1853
Remove background deallocation helper code (TextureGroup#1890)

* Remove background deallocation helper code

Last use removed in Texture with TextureGroup#1840, now PINS no longer uses it either. Less OOMs is so nice.

* remove methods from docs
Call will / did display node for ASTextNode. Fixes TextureGroup#1680 (TextureGroup#1893)

Do not expose tgmath.h to all clients of Texture (TextureGroup#1900)

* Do not expose tgmath.h to all clients of Texture

- tgmath.h #undef the `log` macro for mathematical reasons. Code that may also use a log name (such as CocoaLumberjack) will get confused by this when they try to use `NS_SWIFT_NAME` with `log` as part of the name.
- `ABS` from NSObjCRuntime.h is what is typically used for abs on `CGFloat`.
- Note: removing tgmath.h from the Texture umbrella header may expose clients that implicitly depended upon it being imported. Sources may have to be updated after this to `#import <tgmath.h>` explicitly.
Disable text kit lock (TextureGroup#1910)

* Add experiment to disable global textkit lock

* Forgot the bang
Add an experiment that makes ASDataController to do everything on main thread (TextureGroup#1911)

* Add an experiment that makes ASDataController to do everything on main thread

Under this experiment, ASDataController will allocate and layout all nodes on the main thread. This helps to avoid deadlocks that would otherwise occur if some of the node allocations or layouts caused ASDataController's background queue to block on main thread. As a bonus, this experiment also helps to measure how much performance wins we get from doing the work off main.

* Remove ASSERT_ON_EDITING_QUEUE
More on ASDataController's main-thread-only mode (TextureGroup#1915)

Follow up on TextureGroup#1911: it's not enough to execute step 3 on the main thread because -_allocateNodesFromElements: uses ASDispatchApply to offload the work to other threads. So this diff adds a flag to tell that method to do everything serially on the calling thread.
Fix failing ASConfigurationTests (TextureGroup#1923)

* Fix failing ASConfigurationTests

* Update configuration.json as well
Fix hit point when ASCollectionNode inverted set to true (TextureGroup#1781)

* Account for possible inverted transform during hit test

When ASCollectionNode has the `inverted` flag set, a transform gets
set on the cell node. We need to make sure that we account for that
when dealing in the view coordinates.

* Store self.node and self.node.view in local variables for better readability.

* Add a test for hit testing in an inverted ASCollectionNode
Ship ASExperimentalDispatchApply (TextureGroup#1924)

Closes TextureGroup#1850.
[ASTextNode2] Make some ASTextNode2 layout files public (TextureGroup#1939)

* Trying to make ASTextLinePositionModifier public

* d’oh

* be a little more restrictive on the files we pull into the pod

* Never mind, I guess we need all of these

* update the project file as well

* try this again

* I think this will work this time.
Set ASTableView isAccessibilityElement, accessibilityElementsHidden properties from its Element's node (TextureGroup#1941)

Update CocoaPods to use the CDN instead of the old trunk repo. (TextureGroup#1957)

Remove redundant assignment. (TextureGroup#1960)

Fix mutation of variable that is never read. (TextureGroup#1961)

use https for slack link (TextureGroup#1950)

fix missing hidden class (TextureGroup#1952)

Fix WKWebView Accessibility (TextureGroup#1955)

* Return nil instead of empty array when no accessibility elements are found. Fixes TextureGroup#1954.

* Use nullability annotations to fix static analyzer warnings.

* Add UI test target.

* Add UI test to make sure web view stays accessible.

* Revert "Add UI test to make sure web view stays accessible."

This reverts commit 00253f4.

* Revert "Add UI test target."

This reverts commit 288b5e0.

* Add unit test to make sure accessibility elements are correct when a WKWebView is wrapped in an ASDisplayNode.
Update asdkGram swift sample to swift version 5.3 (TextureGroup#1962)

Fix order-dependent ASTextNodeTests (TextureGroup#1963)

Exposes a new option in ASImageDownloaderProtocol to retry image downloads (TextureGroup#1948)

* Exposes a new option in ASImageDownloaderProtocol to retry image downloads

At the moment the ASBasicImageDownloader does not automatically retry image downloads if the remote
host is unreachable. On the contrary the ASPINRemoteImageDownloader automatically retries. Retrying is
something that ultimately clients need to be able to control, for example to fail fast to an alternative image
rather than keep retrying for more than one minute while not displaying any image. This change exposes
a new option in the ASImageDownloaderProtocol to retry image downloads. It also uses this new option
in both ASNetworkImageNode and also ASMultiplexImageNode, setting it to YES to preserve the current
behaviour.

* Fixes a failing test in ASMultiplexImageNodeTests

* Fixes ScreenNode.m

ScreenNode.m is implementing ASImageDownloaderProtocol and needs to
be fixed to reflect changes in the latter.
Add experiment to ensure ASCollectionView's range controller updates on changeset updates (TextureGroup#1976)

This experiment makes sure a ASCollectionView's `rangeController` updates when
a changeset WITH updates is applied. Currently it is possible for nodes
inserted into the preload range to not get preloaded when performing a batch
update.

For example, suppose a collection node has:
- Tuning parameters with a preload range of 1 screenful for the given range
  mode.
- Nodes A and B where A is visible and B is off screen.
Currently if node B is deleted and a new node C is inserted in its place, node
C will not get preloaded until the collection node is scrolled. This is because
the preloading mechanism relies on a `setNeedsUpdate` call on the range
controller as part of the `-collectionView:willDisplayCell:forItemAtIndexPath:`
delegate method when the batch update is submitted. However, in the example
outlined above, this sometimes doesn't happen automtically, causing the range
update to be delayed until the next the view scrolls.
Remove Facebook and shift everything around, add Remix by Buffer (TextureGroup#1978)

Expand ASExperimentalRangeUpdateOnChangesetUpdate to ASTableView (TextureGroup#1979)

A previous commit
(TextureGroup@8f7444e)
aimed to fix a preloading bug for ASCollectionView. This commit expands this
fix to ASTableView as the bug occurs there too.

Previous commit message for context:

This experiment makes sure a ASCollectionView's `rangeController` updates when
a changeset WITH updates is applied. Currently it is possible for nodes
inserted into the preload range to not get preloaded when performing a batch
update.

For example, suppose a collection node has:
- Tuning parameters with a preload range of 1 screenful for the given range
  mode.
- Nodes A and B where A is visible and B is off screen.
Currently if node B is deleted and a new node C is inserted in its place, node
C will not get preloaded until the collection node is scrolled. This is because
the preloading mechanism relies on a `setNeedsUpdate` call on the range
controller as part of the `-collectionView:willDisplayCell:forItemAtIndexPath:`
delegate method when the batch update is submitted. However, in the example
outlined above, this sometimes doesn't happen automtically, causing the range
update to be delayed until the next the view scrolls.
Remove trailing semicolons between method parameters and body (TextureGroup#1973)

Having a semi-colon between a method parameters list and a method
body is not not correct and is usually caused by a copy and paste
error while creating the method definition from its declaration.

Fixes the following compilation warnings when building with
-Wsemicolon-before-method-body (which is part of -Wextra):

  ASPINRemoteImageDownloader.mm:230:85: error: semicolon before method body is ignored [-Werror,-Wsemicolon-before-method-body]
  - (id <ASImageContainerProtocol>)synchronouslyFetchedCachedImageWithURL:(NSURL *)URL;
                                                                                      ^
  ASPINRemoteImageDownloader.mm:275:76: error: semicolon before method body is ignored [-Werror,-Wsemicolon-before-method-body]
                           completion:(ASImageDownloaderCompletion)completion;
                                                                             ^
  2 errors generated.

Fixes applied to both code, examples and samples in documentation.
[Layout] Add RTL support to LayoutSpecs (TextureGroup#1983)

* [Layout] Add RTL support to LayoutSpecs

This is largely a slight update for TextureGroup#1805. If RTL is enabled, `calculateLayoutLayoutSpec:` will flip the origin of all sublayouts.

The new part of the diff is that ASBatchFetching now supports proper fetching on RTL horizontal scrollViews.

* Fix build and add RTL batch fetching tests
[RTL/Batching] Make ASDisplayShouldFetchBatchForScrollView aware of flipped CV layouts (TextureGroup#1985)

* [RTL/Batching] Make ASDisplayShouldFetchBatchForScrollView aware of flipped CV layouts

UICollectionViewLayout has a property called `flipsHorizontallyInOppositeLayoutDirection`. If this is set to `YES` then a RTL collectionView’s contentOffset behaves like it does in LTR. In other words, the first item is at contentOffset 0. In this case, the existing logic for `ASDisplayShouldFetchBatchForScrollView` works in RTL.

If you don’t override `flipsHorizontallyInOppositeLayoutDirection` to be `YES`, then it means that in RTL languages the first item in your collectionView will actually be at x offset `collectionView.contentSize.width - collectionView.frame.size.width`. As you scroll to the right, the content offset will decrease until you reach the end of the data at a content offset of 0,0. In this case, `ASDisplayShouldFetchBatchForScrollView` needs to know that you are in RTL and the layout is not flipped. It can then use the contentOffset as the `remainingDistance` to determine when to fetch.

* fix indentation

* assert that we are on main when accessing CV layout
[RTL] Guard access of flipsHorizontallyInOppositeLayoutDirection for iOS >= 11 (TextureGroup#2003)

`flipsHorizontallyInOppositeLayoutDirection` is available in iOS11 and greater. Texture still supports iOS9 so we need to make sure not to call this it in those cases.
Rename ASNavigationController to ASDKNavigationController to fix name collision (TextureGroup#2020)

As of iOS15 the AuthenticationServices framework has a class named `ASNavigationController`. We need to rename our `ASNavigationController` to protect against undefined behavior.

Note: This change was based on this PR TextureGroup#2014. We were slow in merging it and the author has not replied, so I'm making a new one to get this landed.
[3.1.0] Create new version of ASDK (TextureGroup#2021)

With the breaking change of renaming ASNavigationController to ASDKNavigationController, we have released a new version of Texture. Please see `ThreeMigrationGuide.md` for how to handle the breaking changes in 3.1.0.
[3.1.0] Update CHANGELOG

[3.1.0] Update .github_changelog_generator

Update RELEASE.md
Remove AssetsLibrary dependency for tvOS (TextureGroup#2034)

- The framework isn't available on tvOS. This causes CocoaPods linting to fail which prevented me from pushing the new release out.
- One way to fix this is to have a different `default_subspecs` for tvOS that doesn't have AssetsLibrary subspec, but per-platform `default_subspecs` doesn't seem to be supported by CocoaPods. So I updated the subspec itself to only depend on the framework for iOS. This means the subspec is empty/useless for tvOS (and other platforms FWIW).
- Tested with `pod spec lint Texture.podspec`.
- Fixes TextureGroup#1992 and part of TextureGroup#1549. Also unblocks 3.1.0 release.
- For the long term, we can remove the subspec entirely when iOS 9 is deprecated (TextureGroup#1828).
  • Loading branch information
sreshetnyak committed Dec 24, 2021
1 parent afd8037 commit 2796c8e
Show file tree
Hide file tree
Showing 118 changed files with 1,159 additions and 507 deletions.
4 changes: 2 additions & 2 deletions .github_changelog_generator
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
issues=false
since-tag=3.0.0-rc.2
future-release=3.0.0
since-tag=3.1.0
future-release=3.2.0
218 changes: 111 additions & 107 deletions AsyncDisplayKit.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

39 changes: 39 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,44 @@
# Changelog

## [3.1.0](https://github.com/TextureGroup/Texture/tree/3.1.0) (2021-09-09)

[Full Changelog](https://github.com/TextureGroup/Texture/compare/3.0.0...3.1.0)

**Fixed bugs:**

- Fix hit point when ASCollectionNode inverted set to true [\#1781](https://github.com/TextureGroup/Texture/pull/1781) ([bdolman](https://github.com/bdolman))

**Merged pull requests:**

- \[Minor Breaking API\] Rename ASNavigationController to ASDKNavigationController to fix name collision [\#2020](https://github.com/TextureGroup/Texture/pull/2020) ([rcancro](https://github.com/rcancro))
- \[RTL\] Guard access of flipsHorizontallyInOppositeLayoutDirection for iOS \>= 11 [\#2003](https://github.com/TextureGroup/Texture/pull/2003) ([rcancro](https://github.com/rcancro))
- \[RTL/Batching\] Make ASDisplayShouldFetchBatchForScrollView aware of flipped CV layouts [\#1985](https://github.com/TextureGroup/Texture/pull/1985) ([rcancro](https://github.com/rcancro))
- \[Layout\] Add RTL support to LayoutSpecs [\#1983](https://github.com/TextureGroup/Texture/pull/1983) ([rcancro](https://github.com/rcancro))
- Expand ASExperimentalRangeUpdateOnChangesetUpdate to ASTableView [\#1979](https://github.com/TextureGroup/Texture/pull/1979) ([rqueue](https://github.com/rqueue))
- Docs: Remove Facebook and shift everything around, add Remix by Buffer [\#1978](https://github.com/TextureGroup/Texture/pull/1978) ([ay8s](https://github.com/ay8s))
- Add experiment to ensure ASCollectionView's range controller updates … [\#1976](https://github.com/TextureGroup/Texture/pull/1976) ([rqueue](https://github.com/rqueue))
- Remove trailing semicolons between method parameters and body [\#1973](https://github.com/TextureGroup/Texture/pull/1973) ([sdefresne](https://github.com/sdefresne))
- Fix order-dependent ASTextNodeTests [\#1963](https://github.com/TextureGroup/Texture/pull/1963) ([tjaneczko](https://github.com/tjaneczko))
- Update asdkGram swift sample to swift version 5.3 [\#1962](https://github.com/TextureGroup/Texture/pull/1962) ([MussaCharles](https://github.com/MussaCharles))
- Fix mutation of variable that is never read [\#1961](https://github.com/TextureGroup/Texture/pull/1961) ([ZevEisenberg](https://github.com/ZevEisenberg))
- Remove redundant assignment [\#1960](https://github.com/TextureGroup/Texture/pull/1960) ([ZevEisenberg](https://github.com/ZevEisenberg))
- Podfile improvements [\#1957](https://github.com/TextureGroup/Texture/pull/1957) ([ZevEisenberg](https://github.com/ZevEisenberg))
- Fix WKWebView Accessibility [\#1955](https://github.com/TextureGroup/Texture/pull/1955) ([ZevEisenberg](https://github.com/ZevEisenberg))
- fix missing hidden class [\#1952](https://github.com/TextureGroup/Texture/pull/1952) ([joprice](https://github.com/joprice))
- use https for slack link [\#1950](https://github.com/TextureGroup/Texture/pull/1950) ([joprice](https://github.com/joprice))
- Exposes a new option in ASImageDownloaderProtocol to retry image downloads [\#1948](https://github.com/TextureGroup/Texture/pull/1948) ([chggr](https://github.com/chggr))
- All ASCellNode nodes to be non accessible if needed [\#1941](https://github.com/TextureGroup/Texture/pull/1941) ([decim92](https://github.com/decim92))
- \[ASTextNode2\] Make some ASTextNode2 layout files public [\#1939](https://github.com/TextureGroup/Texture/pull/1939) ([rcancro](https://github.com/rcancro))
- Ship ASExperimentalDispatchApply [\#1924](https://github.com/TextureGroup/Texture/pull/1924) ([nguyenhuy](https://github.com/nguyenhuy))
- Fix failing ASConfigurationTests [\#1923](https://github.com/TextureGroup/Texture/pull/1923) ([nguyenhuy](https://github.com/nguyenhuy))
- More on ASDataController's main-thread-only mode [\#1915](https://github.com/TextureGroup/Texture/pull/1915) ([nguyenhuy](https://github.com/nguyenhuy))
- Add an experiment that makes ASDataController to do everything on main thread [\#1911](https://github.com/TextureGroup/Texture/pull/1911) ([nguyenhuy](https://github.com/nguyenhuy))
- Disable text kit lock [\#1910](https://github.com/TextureGroup/Texture/pull/1910) ([garrettmoon](https://github.com/garrettmoon))
- Do not expose tgmath.h to all clients of Texture [\#1900](https://github.com/TextureGroup/Texture/pull/1900) ([bolsinga](https://github.com/bolsinga))
- Call will / did display node for ASTextNode. Fixes \#1680 [\#1893](https://github.com/TextureGroup/Texture/pull/1893) ([garrettmoon](https://github.com/garrettmoon))
- Remove background deallocation helper code [\#1890](https://github.com/TextureGroup/Texture/pull/1890) ([bolsinga](https://github.com/bolsinga))
- \[Accessibility\] Ship ASExperimentalDoNotCacheAccessibilityElements [\#1888](https://github.com/TextureGroup/Texture/pull/1888) ([rcancro](https://github.com/rcancro))

## [3.0.0](https://github.com/TextureGroup/Texture/tree/3.0.0) (2020-07-15)

[Full Changelog](https://github.com/TextureGroup/Texture/compare/3.0.0-rc.2...3.0.0)
Expand Down
2 changes: 0 additions & 2 deletions Podfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
source 'https://github.com/CocoaPods/Specs.git'

platform :ios, '9.0'

target :'AsyncDisplayKitTests' do
Expand Down
4 changes: 2 additions & 2 deletions Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ DEPENDENCIES:
- OCMock (~> 3.6)

SPEC REPOS:
https://github.com/CocoaPods/Specs.git:
trunk:
- iOSSnapshotTestCase
- OCMock

SPEC CHECKSUMS:
iOSSnapshotTestCase: 9ab44cb5aa62b84d31847f40680112e15ec579a6
OCMock: 29f6e52085b4e7d9b075cbf03ed7c3112f82f934

PODFILE CHECKSUM: ff1a1777e31f49e6e4b7b148d0f10e504db7fa26
PODFILE CHECKSUM: 1b4ea0e8ab7d94a46b1964a2354686c2e599c8c2

COCOAPODS: 1.10.2
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ As the framework has grown, many features have been added that can save develope

## Getting Help

We use Slack for real-time debugging, community updates, and general talk about Texture. [Signup](http://asdk-slack-auto-invite.herokuapp.com) yourself or email textureframework@gmail.com to get an invite.
We use Slack for real-time debugging, community updates, and general talk about Texture. [Signup](https://asdk-slack-auto-invite.herokuapp.com) yourself or email textureframework@gmail.com to get an invite.

## Release process

Expand Down
2 changes: 1 addition & 1 deletion RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This document describes the process for a public Texture release.
### Process
- Run `github_changelog_generator` in Texture project directory: `github_changelog_generator --token <generated personal token> --user TextureGroup --project Texture`. To avoid hitting rate limit, the generator will replace the entire file with just the changes from this version – revert that giant deletion to get the entire new changelog.
- Update `spec.version` within `Texture.podspec` and the `since-tag` and `future-release` fields in `.github_changelog_generator`.
- Create a new PR with the updated `Texture.podspec` and the newly generated changelog.
- Create a new PR with the updated `Texture.podspec` and `.github_changelog_generator`, and the newly generated changelog.
- After merging in the PR, [create a new GitHub release](https://github.com/TextureGroup/Texture/releases/new). Use the generated changelog for the new release.
- Push to Cocoapods with `pod trunk push`

Expand Down
7 changes: 4 additions & 3 deletions Schemas/configuration.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
"items": {
"type": "string",
"enum": [
"exp_graphics_contexts",
"exp_text_node",
"exp_interface_state_coalesce",
"exp_infer_layer_defaults",
Expand All @@ -22,8 +21,10 @@
"exp_skip_clear_data",
"exp_did_enter_preload_skip_asm_layout",
"exp_dispatch_apply",
"exp_oom_bg_dealloc_disable",
"exp_do_not_cache_accessibility_elements",
"exp_drawing_global",
"exp_optimize_data_controller_pipeline",
"exp_disable_global_textkit_lock",
"exp_main_thread_only_data_controller",
]
}
}
Expand Down
4 changes: 2 additions & 2 deletions Source/ASCellNode.mm
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ - (void)setHighlighted:(BOOL)highlighted
}
}

- (void)__setSelectedFromUIKit:(BOOL)selected;
- (void)__setSelectedFromUIKit:(BOOL)selected
{
// Note: Race condition could mean redundant sets. Risk is low.
if (ASLockedSelf(_selected != selected)) {
Expand All @@ -169,7 +169,7 @@ - (void)__setSelectedFromUIKit:(BOOL)selected;
}
}

- (void)__setHighlightedFromUIKit:(BOOL)highlighted;
- (void)__setHighlightedFromUIKit:(BOOL)highlighted
{
// Note: Race condition could mean redundant sets. Risk is low.
if (ASLockedSelf(_highlighted != highlighted)) {
Expand Down
2 changes: 1 addition & 1 deletion Source/ASCollectionNode.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1168,7 +1168,7 @@ - (void)moveItemAtIndexPath:(NSIndexPath *)indexPath toIndexPath:(NSIndexPath *)

#pragma mark - ASRangeControllerUpdateRangeProtocol

- (void)updateCurrentRangeWithMode:(ASLayoutRangeMode)rangeMode;
- (void)updateCurrentRangeWithMode:(ASLayoutRangeMode)rangeMode
{
if ([self pendingState]) {
_pendingState.rangeMode = rangeMode;
Expand Down
11 changes: 10 additions & 1 deletion Source/ASCollectionView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1857,7 +1857,13 @@ - (void)_checkForBatchFetching

- (void)_beginBatchFetchingIfNeededWithContentOffset:(CGPoint)contentOffset velocity:(CGPoint)velocity
{
if (ASDisplayShouldFetchBatchForScrollView(self, self.scrollDirection, self.scrollableDirections, contentOffset, velocity)) {
// Since we are accessing self.collectionViewLayout, we should make sure we are on main
ASDisplayNodeAssertMainThread();
BOOL flipsHorizontallyInOppositeLayoutDirection = NO;
if (AS_AVAILABLE_IOS(11.0)) {
flipsHorizontallyInOppositeLayoutDirection = self.collectionViewLayout.flipsHorizontallyInOppositeLayoutDirection;
}
if (ASDisplayShouldFetchBatchForScrollView(self, self.scrollDirection, self.scrollableDirections, contentOffset, velocity, flipsHorizontallyInOppositeLayoutDirection)) {
[self _beginBatchFetching];
}
}
Expand Down Expand Up @@ -2311,6 +2317,9 @@ - (void)rangeController:(ASRangeController *)rangeController updateWithChangeSet

// Flush any range changes that happened as part of submitting the update.
as_activity_scope(changeSet.rootActivity);
if (numberOfUpdates > 0 && ASActivateExperimentalFeature(ASExperimentalRangeUpdateOnChangesetUpdate)) {
[self->_rangeController setNeedsUpdate];
}
[self->_rangeController updateIfNeeded];
}
});
Expand Down
21 changes: 21 additions & 0 deletions Source/ASDisplayNode+LayoutSpec.mm
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,27 @@ - (ASLayout *)calculateLayoutLayoutSpec:(ASSizeRange)constrainedSize
}
layout = [layout filteredNodeLayoutTree];

// Flip layout if layout should be rendered right-to-left
BOOL shouldRenderRTLLayout = [UIView userInterfaceLayoutDirectionForSemanticContentAttribute:_semanticContentAttribute] == UIUserInterfaceLayoutDirectionRightToLeft;
if (shouldRenderRTLLayout) {
for (ASLayout *sublayout in layout.sublayouts) {
switch (_semanticContentAttribute) {
case UISemanticContentAttributeUnspecified:
case UISemanticContentAttributeForceRightToLeft: {
// Flip
CGPoint flippedPosition = CGPointMake(layout.size.width - CGRectGetWidth(sublayout.frame) - sublayout.position.x, sublayout.position.y);
sublayout.position = flippedPosition;
}
case UISemanticContentAttributePlayback:
case UISemanticContentAttributeForceLeftToRight:
case UISemanticContentAttributeSpatial:
// Don't flip
break;
}
}
}


return layout;
}

Expand Down
15 changes: 15 additions & 0 deletions Source/ASDisplayNode.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1625,6 +1625,21 @@ - (void)updateCornerRoundingWithType:(ASCornerRoundingType)newRoundingType
});
}

- (void)updateSemanticContentAttributeWithAttribute:(UISemanticContentAttribute)attribute
{
__instanceLock__.lock();
UISemanticContentAttribute oldAttribute = _semanticContentAttribute;
_semanticContentAttribute = attribute;
__instanceLock__.unlock();

ASPerformBlockOnMainThread(^{
// If the value has changed we should attempt to relayout.
if (attribute != oldAttribute) {
[self setNeedsLayout];
}
});
}

- (void)recursivelySetDisplaySuspended:(BOOL)flag
{
_recursivelySetDisplaySuspended(self, nil, flag);
Expand Down
2 changes: 1 addition & 1 deletion Source/ASDisplayNodeExtras.mm
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ ASInterfaceState ASInterfaceStateForDisplayNode(ASDisplayNode *displayNode, UIWi
// if not already, about to be set to invisible as it is not possible for an element to be visible
// while outside of a window.
ASInterfaceState interfaceState = displayNode.pendingInterfaceState;
return (window == nil ? (interfaceState &= (~ASInterfaceStateVisible)) : interfaceState);
return (window == nil ? (interfaceState & (~ASInterfaceStateVisible)) : interfaceState);
} else {
// For not range managed nodes we might be on our own to try to guess if we're visible.
return (window == nil ? ASInterfaceStateNone : (ASInterfaceStateVisible | ASInterfaceStateDisplay));
Expand Down
4 changes: 3 additions & 1 deletion Source/ASExperimentalFeatures.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ typedef NS_OPTIONS(NSUInteger, ASExperimentalFeatures) {
ASExperimentalDispatchApply = 1 << 7, // exp_dispatch_apply
ASExperimentalDrawingGlobal = 1 << 8, // exp_drawing_global
ASExperimentalOptimizeDataControllerPipeline = 1 << 9, // exp_optimize_data_controller_pipeline
ASExperimentalDoNotCacheAccessibilityElements = 1 << 10, // exp_do_not_cache_accessibility_elements
ASExperimentalDisableGlobalTextkitLock = 1 << 10, // exp_disable_global_textkit_lock
ASExperimentalMainThreadOnlyDataController = 1 << 11, // exp_main_thread_only_data_controller
ASExperimentalRangeUpdateOnChangesetUpdate = 1 << 12, // exp_range_update_on_changeset_update
ASExperimentalFeatureAll = 0xFFFFFFFF
};

Expand Down
4 changes: 3 additions & 1 deletion Source/ASExperimentalFeatures.mm
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@
@"exp_dispatch_apply",
@"exp_drawing_global",
@"exp_optimize_data_controller_pipeline",
@"exp_do_not_cache_accessibility_elements"]));
@"exp_disable_global_textkit_lock",
@"exp_main_thread_only_data_controller",
@"exp_range_update_on_changeset_update"]));
if (flags == ASExperimentalFeatureAll) {
return allNames;
}
Expand Down
6 changes: 6 additions & 0 deletions Source/ASMultiplexImageNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,12 @@ typedef NS_ENUM(NSUInteger, ASMultiplexImageNodeErrorCode) {
*/
@property (nonatomic) BOOL shouldRenderProgressImages;

/**
* Specifies whether the underlying image downloader should attempt to retry downloading the image if the remote
* host is unreachable. It will have no effect if the downloader does not support retrying. The default is YES.
*/
@property BOOL shouldRetryImageDownload;

/**
* @abstract The image manager that this image node should use when requesting images from the Photos framework. If this is `nil` (the default), then `PHImageManager.defaultManager` is used.
Expand Down
5 changes: 4 additions & 1 deletion Source/ASMultiplexImageNode.mm
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,14 @@ - (instancetype)initWithCache:(id<ASImageCacheProtocol>)cache downloader:(id<ASI

_downloaderFlags.downloaderImplementsSetProgress = [downloader respondsToSelector:@selector(setProgressImageBlock:callbackQueue:withDownloadIdentifier:)];
_downloaderFlags.downloaderImplementsSetPriority = [downloader respondsToSelector:@selector(setPriority:withDownloadIdentifier:)];
_downloaderFlags.downloaderImplementsDownloadWithPriority = [downloader respondsToSelector:@selector(downloadImageWithURL:priority:callbackQueue:downloadProgress:completion:)];
_downloaderFlags.downloaderImplementsDownloadWithPriority = [downloader respondsToSelector:@selector(downloadImageWithURL:shouldRetry:priority:callbackQueue:downloadProgress:completion:)];

_cacheSupportsClearing = [cache respondsToSelector:@selector(clearFetchedImageFromCacheWithURL:)];

_shouldRenderProgressImages = YES;

self.shouldBypassEnsureDisplay = YES;
self.shouldRetryImageDownload = YES;

return self;
}
Expand Down Expand Up @@ -805,6 +806,7 @@ - (void)_downloadImageWithIdentifier:(id)imageIdentifier URL:(NSURL *)imageURL c
*/
ASImageDownloaderPriority priority = ASImageDownloaderPriorityWithInterfaceState(strongSelf.interfaceState);
downloadIdentifier = [strongSelf->_downloader downloadImageWithURL:imageURL
shouldRetry:[self shouldRetryImageDownload]
priority:priority
callbackQueue:callbackQueue
downloadProgress:downloadProgressBlock
Expand All @@ -820,6 +822,7 @@ - (void)_downloadImageWithIdentifier:(id)imageIdentifier URL:(NSURL *)imageURL c
and their requests are put into the same pool.
*/
downloadIdentifier = [strongSelf->_downloader downloadImageWithURL:imageURL
shouldRetry:[self shouldRetryImageDownload]
callbackQueue:callbackQueue
downloadProgress:downloadProgressBlock
completion:completion];
Expand Down
6 changes: 6 additions & 0 deletions Source/ASNetworkImageNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,12 @@ NS_ASSUME_NONNULL_BEGIN
*/
@property BOOL shouldRenderProgressImages;

/**
* Specifies whether the underlying image downloader should attempt to retry downloading the image if the remote
* host is unreachable. It will have no effect if the downloader does not support retrying. The default is YES.
*/
@property BOOL shouldRetryImageDownload;

/**
* The image quality of the current image.
*
Expand Down
Loading

0 comments on commit 2796c8e

Please sign in to comment.