IGListKit/Tests/Objects/IGTestInvalidateLayoutObject.m

43 lines
931 B
Mathematica
Raw Normal View History

/*
Fix #1275 layouts inconsistency in `updateAnimated:completion` of IGListBindingSectionController (#1285) Summary: ## Changes in this pull request Issue fixed: https://github.com/Instagram/IGListKit/issues/1275 This PR is straintforward solution as mentioned in https://github.com/Instagram/IGListKit/issues/1275. When I finished it, I realized that it is not a problem in `IGListCollectionViewLayout Partial Optimization` and `IGListBindingSectionController` deserved it. Maybe `IGListCollectionViewLayout` is rarely used because of great builtin UICollectionViewFlowLayout or cells in section rarely need changing their sizes in practices. Despite it is not `IGListCollectionViewLayout`'s fault, I think it can be more optimized against `invalidateLayoutWithContext`. I would like to make an another PR to optimize it. Due to this PR just giving a proposed solution, it lacks of adding tests and changing log. When this solution is accepted, I would like to complete these todos. ### Checklist - [x] All tests pass. Demo project builds and runs. - [x] I added tests, an experiment, or detailed why my change isn't tested. - [x] I added an entry to the `CHANGELOG.md` for any breaking changes, enhancements, or bug fixes. - [x] I have reviewed the [contributing guide](https://github.com/Instagram/IGListKit/blob/master/.github/CONTRIBUTING.md) Pull Request resolved: https://github.com/Instagram/IGListKit/pull/1285 Reviewed By: candance Differential Revision: D15592807 Pulled By: lorixx fbshipit-source-id: ae06abce896341509de4f3dfb73b3a7bc0a68c51
2019-06-12 05:25:14 +00:00
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#import "IGTestInvalidateLayoutObject.h"
@implementation IGTestInvalidateLayoutObject
- (instancetype)initWithKey:(id)key objects:(NSArray *)objects {
if (self = [super init]) {
_key = key;
_objects = objects;
}
return self;
}
- (NSString *)description {
return [NSString stringWithFormat:@"<%@: %p; key: %@; objects: %@>",
NSStringFromClass(self.class), self, self.key, self.objects];
}
#pragma mark - IGListDiffable
- (id<NSObject>)diffIdentifier {
return self.key;
}
- (BOOL)isEqualToDiffableObject:(id)object {
if (object == self) {
return YES;
}
if ([object isKindOfClass:[IGTestInvalidateLayoutObject class]]) {
return YES;
}
Fix #1275 layouts inconsistency in `updateAnimated:completion` of IGListBindingSectionController (#1285) Summary: ## Changes in this pull request Issue fixed: https://github.com/Instagram/IGListKit/issues/1275 This PR is straintforward solution as mentioned in https://github.com/Instagram/IGListKit/issues/1275. When I finished it, I realized that it is not a problem in `IGListCollectionViewLayout Partial Optimization` and `IGListBindingSectionController` deserved it. Maybe `IGListCollectionViewLayout` is rarely used because of great builtin UICollectionViewFlowLayout or cells in section rarely need changing their sizes in practices. Despite it is not `IGListCollectionViewLayout`'s fault, I think it can be more optimized against `invalidateLayoutWithContext`. I would like to make an another PR to optimize it. Due to this PR just giving a proposed solution, it lacks of adding tests and changing log. When this solution is accepted, I would like to complete these todos. ### Checklist - [x] All tests pass. Demo project builds and runs. - [x] I added tests, an experiment, or detailed why my change isn't tested. - [x] I added an entry to the `CHANGELOG.md` for any breaking changes, enhancements, or bug fixes. - [x] I have reviewed the [contributing guide](https://github.com/Instagram/IGListKit/blob/master/.github/CONTRIBUTING.md) Pull Request resolved: https://github.com/Instagram/IGListKit/pull/1285 Reviewed By: candance Differential Revision: D15592807 Pulled By: lorixx fbshipit-source-id: ae06abce896341509de4f3dfb73b3a7bc0a68c51
2019-06-12 05:25:14 +00:00
return NO;
}
@end