mirror of
https://github.com/Instagram/IGListKit
synced 2026-05-23 09:18:29 +00:00
add debugDescriptionLines for new updater
Summary: The current `IGListAdapterUpdater` implements `-debugDescriptionLines` which is used by `IGListDebugger` to dump information about all the apaters, so lets also implement it for `IGListExperimentalAdapterUpdater`. Reviewed By: lorixx Differential Revision: D25884781 fbshipit-source-id: 86b227258f033f0079058af04915171d6a149241
This commit is contained in:
parent
329a4d300d
commit
3b47aa27dc
2 changed files with 67 additions and 0 deletions
|
|
@ -0,0 +1,14 @@
|
|||
/*
|
||||
* 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 <IGListKit/IGListExperimentalAdapterUpdater.h>
|
||||
|
||||
@interface IGListExperimentalAdapterUpdater (DebugDescription)
|
||||
|
||||
- (NSArray<NSString *> *)debugDescriptionLines;
|
||||
|
||||
@end
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
* 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 "IGListExperimentalAdapterUpdater+DebugDescription.h"
|
||||
|
||||
#import "IGListBatchUpdateData+DebugDescription.h"
|
||||
#import "IGListDebuggingUtilities.h"
|
||||
#import "IGListExperimentalAdapterUpdaterInternal.h"
|
||||
#import "IGListUpdateTransactable.h"
|
||||
|
||||
@implementation IGListExperimentalAdapterUpdater (DebugDescription)
|
||||
|
||||
- (NSArray<NSString *> *)debugDescriptionLines {
|
||||
NSMutableArray *debug = [NSMutableArray new];
|
||||
#if defined(IGLK_DEBUG_DESCRIPTION_ENABLED) && IGLK_DEBUG_DESCRIPTION_ENABLED
|
||||
[debug addObject:@"Options:"];
|
||||
NSArray<NSString *> *options = @[
|
||||
[NSString stringWithFormat:@"sectionMovesAsDeletesInserts: %@", IGListDebugBOOL(self.sectionMovesAsDeletesInserts)],
|
||||
[NSString stringWithFormat:@"singleItemSectionUpdates: %@", IGListDebugBOOL(self.singleItemSectionUpdates)],
|
||||
[NSString stringWithFormat:@"preferItemReloadsForSectionReloads: %@", IGListDebugBOOL(self.preferItemReloadsForSectionReloads)],
|
||||
[NSString stringWithFormat:@"allowsBackgroundReloading: %@", IGListDebugBOOL(self.allowsBackgroundReloading)],
|
||||
[NSString stringWithFormat:@"allowsReloadingOnTooManyUpdates: %@", IGListDebugBOOL(self.allowsReloadingOnTooManyUpdates)]
|
||||
];
|
||||
[debug addObjectsFromArray:IGListDebugIndentedLines(options)];
|
||||
|
||||
const IGListBatchUpdateState state = self.transaction ? [self.transaction state] : IGListBatchUpdateStateIdle;
|
||||
|
||||
NSString *stateString;
|
||||
switch (state) {
|
||||
case IGListBatchUpdateStateIdle:
|
||||
stateString = @"Idle";
|
||||
break;
|
||||
case IGListBatchUpdateStateQueuedBatchUpdate:
|
||||
stateString = @"Queued batch update";
|
||||
break;
|
||||
case IGListBatchUpdateStateExecutedBatchUpdateBlock:
|
||||
stateString = @"Executed batch update block";
|
||||
break;
|
||||
case IGListBatchUpdateStateExecutingBatchUpdateBlock:
|
||||
stateString = @"Executing batch update block";
|
||||
break;
|
||||
}
|
||||
[debug addObject:[NSString stringWithFormat:@"State: %@", stateString]];
|
||||
|
||||
#endif // #if IGLK_DEBUG_DESCRIPTION_ENABLED
|
||||
return debug;
|
||||
}
|
||||
|
||||
@end
|
||||
Loading…
Reference in a new issue