mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 14:20:20 +00:00
Add production workaround for missing elements (#3158)
This commit is contained in:
@@ -1740,14 +1740,22 @@ static NSString * const kReuseIdentifier = @"_ASCollectionReuseIdentifier";
|
||||
// Visible items
|
||||
for (NSIndexPath *indexPath in self.indexPathsForVisibleItems) {
|
||||
ASCollectionElement *element = [map elementForItemAtIndexPath:indexPath];
|
||||
[result addObject:element];
|
||||
if (element != nil) {
|
||||
[result addObject:element];
|
||||
} else {
|
||||
ASDisplayNodeFailAssert(@"Couldn't find 'visible' item at index path %@ in map %@", indexPath, map);
|
||||
}
|
||||
}
|
||||
|
||||
// Visible supplementary elements
|
||||
for (NSString *kind in map.supplementaryElementKinds) {
|
||||
for (NSIndexPath *indexPath in [self asdk_indexPathsForVisibleSupplementaryElementsOfKind:kind]) {
|
||||
ASCollectionElement *element = [map supplementaryElementOfKind:kind atIndexPath:indexPath];
|
||||
[result addObject:element];
|
||||
if (element != nil) {
|
||||
[result addObject:element];
|
||||
} else {
|
||||
ASDisplayNodeFailAssert(@"Couldn't find 'visible' supplementary element of kind %@ at index path %@ in map %@", kind, indexPath, map);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
||||
@@ -13,8 +13,9 @@
|
||||
#import <AsyncDisplayKit/ASMutableElementMap.h>
|
||||
#import <AsyncDisplayKit/ASSection.h>
|
||||
#import <AsyncDisplayKit/NSIndexSet+ASHelpers.h>
|
||||
#import <AsyncDisplayKit/ASObjectDescriptionHelpers.h>
|
||||
|
||||
@interface ASElementMap ()
|
||||
@interface ASElementMap () <ASDescriptionProvider>
|
||||
|
||||
@property (nonatomic, strong, readonly) NSArray<ASSection *> *sections;
|
||||
|
||||
@@ -168,6 +169,21 @@
|
||||
return [_elementToIndexPathMap countByEnumeratingWithState:state objects:buffer count:len];
|
||||
}
|
||||
|
||||
#pragma mark - ASDescriptionProvider
|
||||
|
||||
- (NSString *)description
|
||||
{
|
||||
return ASObjectDescriptionMake(self, [self propertiesForDescription]);
|
||||
}
|
||||
|
||||
- (NSMutableArray<NSDictionary *> *)propertiesForDescription
|
||||
{
|
||||
NSMutableArray *result = [NSMutableArray array];
|
||||
[result addObject:@{ @"items" : _sectionsOfItems }];
|
||||
[result addObject:@{ @"supplementaryElements" : _supplementaryElements }];
|
||||
return result;
|
||||
}
|
||||
|
||||
#pragma mark - Internal
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user