Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ship ASExperimentalTraitCollectionDidChangeWithPreviousCollection #1842

Merged
merged 1 commit into from
May 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions Source/ASDisplayNode+Layout.mm
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,7 @@ - (void)setPrimitiveTraitCollection:(ASPrimitiveTraitCollection)traitCollection
_primitiveTraitCollection = traitCollection;

l.unlock();
if (ASActivateExperimentalFeature(ASExperimentalTraitCollectionDidChangeWithPreviousCollection)) {
[self asyncTraitCollectionDidChangeWithPreviousTraitCollection:previousTraitCollection];
} else {
[self asyncTraitCollectionDidChange];
}

}
}

Expand Down
11 changes: 0 additions & 11 deletions Source/ASDisplayNode+Subclasses.h
Original file line number Diff line number Diff line change
Expand Up @@ -201,23 +201,12 @@ AS_CATEGORY_IMPLEMENTABLE
- (void)interfaceStateDidChange:(ASInterfaceState)newState
fromState:(ASInterfaceState)oldState ASDISPLAYNODE_REQUIRES_SUPER;

/**
* @abstract Called when the node's ASTraitCollection changes
*
* @discussion Subclasses can override this method to react to a trait collection change.
*/
AS_CATEGORY_IMPLEMENTABLE
- (void)asyncTraitCollectionDidChange ASDISPLAYNODE_REQUIRES_SUPER ASDISPLAYNODE_DEPRECATED_MSG("Use asyncTraitCollectionDidChangeWithPreviousTraitCollection: instead.");


/**
* @abstract Called when the node's ASTraitCollection changes
*
* @discussion Subclasses can override this method to react to a trait collection change.
*
* @param previousTraitCollection The ASPrimitiveTraitCollection object before the interface environment changed.
*
* @note Enable `ASExperimentalTraitCollectionDidChangeWithPreviousCollection` experiment to have this method called instead of `asyncTraitCollectionDidChange`.
*/
AS_CATEGORY_IMPLEMENTABLE
- (void)asyncTraitCollectionDidChangeWithPreviousTraitCollection:(ASPrimitiveTraitCollection)previousTraitCollection ASDISPLAYNODE_REQUIRES_SUPER;
Expand Down
1 change: 0 additions & 1 deletion Source/ASDisplayNode.mm
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,6 @@ + (void)initialize
class_addMethod(self, @selector(didEnterVisibleState), noArgsImp, "v@:");
class_addMethod(self, @selector(didExitVisibleState), noArgsImp, "v@:");
class_addMethod(self, @selector(hierarchyDisplayDidFinish), noArgsImp, "v@:");
class_addMethod(self, @selector(asyncTraitCollectionDidChange), noArgsImp, "v@:");
class_addMethod(self, @selector(calculatedLayoutDidChange), noArgsImp, "v@:");

auto type0 = "v@:" + std::string(@encode(ASSizeRange));
Expand Down
3 changes: 1 addition & 2 deletions Source/ASExperimentalFeatures.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ 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
ASExperimentalTraitCollectionDidChangeWithPreviousCollection = 1 << 10, // exp_trait_collection_did_change_with_previous_collection
ASExperimentalDoNotCacheAccessibilityElements = 1 << 11 , // exp_do_not_cache_accessibility_elements
ASExperimentalDoNotCacheAccessibilityElements = 1 << 10, // exp_do_not_cache_accessibility_elements
ASExperimentalFeatureAll = 0xFFFFFFFF
};

Expand Down
1 change: 0 additions & 1 deletion Source/ASExperimentalFeatures.mm
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
@"exp_dispatch_apply",
@"exp_drawing_global",
@"exp_optimize_data_controller_pipeline",
@"exp_trait_collection_did_change_with_previous_collection",
@"exp_do_not_cache_accessibility_elements"]));
if (flags == ASExperimentalFeatureAll) {
return allNames;
Expand Down
2 changes: 0 additions & 2 deletions Tests/ASConfigurationTests.mm
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
ASExperimentalDispatchApply,
ASExperimentalDrawingGlobal,
ASExperimentalOptimizeDataControllerPipeline,
ASExperimentalTraitCollectionDidChangeWithPreviousCollection,
ASExperimentalDoNotCacheAccessibilityElements,
};

Expand All @@ -52,7 +51,6 @@ + (NSArray *)names {
@"exp_dispatch_apply",
@"exp_drawing_global",
@"exp_optimize_data_controller_pipeline",
@"exp_trait_collection_did_change_with_previous_collection",
@"exp_do_not_cache_accessibility_elements",
];
}
Expand Down
15 changes: 0 additions & 15 deletions Tests/ASDisplayNodeSnapshotTests.mm
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,6 @@ @interface ASDisplayNodeSnapshotTests : ASSnapshotTestCase

@implementation ASDisplayNodeSnapshotTests

- (void)setUp {
[super setUp];
ASConfiguration *config = [ASConfiguration new];
config.experimentalFeatures = ASExperimentalTraitCollectionDidChangeWithPreviousCollection;
[ASConfigurationManager test_resetWithConfiguration:config];
}

- (void)testBasicHierarchySnapshotTesting
{
ASDisplayNode *node = [[ASDisplayNode alloc] init];
Expand Down Expand Up @@ -68,14 +61,6 @@ - (void)testPrecompositedCornerRounding

- (void)testClippingCornerRounding
{
#if AS_AT_LEAST_IOS13
if (@available(iOS 13.0, *)) {
ASConfiguration *config = [ASConfiguration new];
config.experimentalFeatures = ASExperimentalTraitCollectionDidChangeWithPreviousCollection;
[ASConfigurationManager test_resetWithConfiguration:config];
}
#endif

for (CACornerMask c = 1; c <= kASCACornerAllCorners; c |= (c << 1)) {
auto node = [[ASImageNode alloc] init];
auto bounds = CGRectMake(0, 0, 100, 100);
Expand Down
10 changes: 0 additions & 10 deletions Tests/ASImageNodeSnapshotTests.mm
Original file line number Diff line number Diff line change
Expand Up @@ -242,11 +242,6 @@ - (void)testUIGraphicsRendererDrawingExperiment
- (void)testDynamicAssetImage
{
if (@available(iOS 13.0, *)) {
// enable experimantal callback for traits change
ASConfiguration *config = [ASConfiguration new];
config.experimentalFeatures = ASExperimentalTraitCollectionDidChangeWithPreviousCollection;
[ASConfigurationManager test_resetWithConfiguration:config];

UIImage *image = [UIImage imageNamed:@"light-dark" inBundle:[NSBundle bundleForClass:[self class]] compatibleWithTraitCollection:nil];
ASImageNode *node = [[ASImageNode alloc] init];
node.image = image;
Expand All @@ -265,11 +260,6 @@ - (void)testDynamicAssetImage
- (void)testDynamicTintColor
{
if (@available(iOS 13.0, *)) {
// enable experimental callback for traits change
ASConfiguration *config = [ASConfiguration new];
config.experimentalFeatures = ASExperimentalTraitCollectionDidChangeWithPreviousCollection;
[ASConfigurationManager test_resetWithConfiguration:config];

UIImage *image = makeImageWithColor(UIColor.redColor, CGSize{.width = 100, .height = 100});
image = [image imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
UIColor* tintColor = UIColor.systemBackgroundColor;
Expand Down