mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 22:25:57 +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
|
// Visible items
|
||||||
for (NSIndexPath *indexPath in self.indexPathsForVisibleItems) {
|
for (NSIndexPath *indexPath in self.indexPathsForVisibleItems) {
|
||||||
ASCollectionElement *element = [map elementForItemAtIndexPath:indexPath];
|
ASCollectionElement *element = [map elementForItemAtIndexPath:indexPath];
|
||||||
|
if (element != nil) {
|
||||||
[result addObject:element];
|
[result addObject:element];
|
||||||
|
} else {
|
||||||
|
ASDisplayNodeFailAssert(@"Couldn't find 'visible' item at index path %@ in map %@", indexPath, map);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Visible supplementary elements
|
// Visible supplementary elements
|
||||||
for (NSString *kind in map.supplementaryElementKinds) {
|
for (NSString *kind in map.supplementaryElementKinds) {
|
||||||
for (NSIndexPath *indexPath in [self asdk_indexPathsForVisibleSupplementaryElementsOfKind:kind]) {
|
for (NSIndexPath *indexPath in [self asdk_indexPathsForVisibleSupplementaryElementsOfKind:kind]) {
|
||||||
ASCollectionElement *element = [map supplementaryElementOfKind:kind atIndexPath:indexPath];
|
ASCollectionElement *element = [map supplementaryElementOfKind:kind atIndexPath:indexPath];
|
||||||
|
if (element != nil) {
|
||||||
[result addObject:element];
|
[result addObject:element];
|
||||||
|
} else {
|
||||||
|
ASDisplayNodeFailAssert(@"Couldn't find 'visible' supplementary element of kind %@ at index path %@ in map %@", kind, indexPath, map);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
@@ -13,8 +13,9 @@
|
|||||||
#import <AsyncDisplayKit/ASMutableElementMap.h>
|
#import <AsyncDisplayKit/ASMutableElementMap.h>
|
||||||
#import <AsyncDisplayKit/ASSection.h>
|
#import <AsyncDisplayKit/ASSection.h>
|
||||||
#import <AsyncDisplayKit/NSIndexSet+ASHelpers.h>
|
#import <AsyncDisplayKit/NSIndexSet+ASHelpers.h>
|
||||||
|
#import <AsyncDisplayKit/ASObjectDescriptionHelpers.h>
|
||||||
|
|
||||||
@interface ASElementMap ()
|
@interface ASElementMap () <ASDescriptionProvider>
|
||||||
|
|
||||||
@property (nonatomic, strong, readonly) NSArray<ASSection *> *sections;
|
@property (nonatomic, strong, readonly) NSArray<ASSection *> *sections;
|
||||||
|
|
||||||
@@ -168,6 +169,21 @@
|
|||||||
return [_elementToIndexPathMap countByEnumeratingWithState:state objects:buffer count:len];
|
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
|
#pragma mark - Internal
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user