feat:async blend sub node of list
This commit is contained in:
parent
c23d5c5391
commit
0889a57a68
@ -182,29 +182,37 @@ - (NSDictionary *)itemModelAt:(NSUInteger)position {
|
|||||||
NSUInteger pos = position + idx;
|
NSUInteger pos = position + idx;
|
||||||
self.itemViewIds[@(pos)] = thisViewId;
|
self.itemViewIds[@(pos)] = thisViewId;
|
||||||
}];
|
}];
|
||||||
return array[0];
|
if (array.count > 0) {
|
||||||
|
return array[0];
|
||||||
|
} else {
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)blendSubNode:(NSDictionary *)subModel {
|
- (void)blendSubNode:(NSDictionary *)subModel {
|
||||||
NSString *viewId = subModel[@"id"];
|
///Here async blend sub node because the item count need to be applied first.
|
||||||
DoricViewNode *viewNode = [self subNodeWithViewId:viewId];
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
if (viewNode) {
|
NSString *viewId = subModel[@"id"];
|
||||||
[viewNode blend:subModel[@"props"]];
|
DoricViewNode *viewNode = [self subNodeWithViewId:viewId];
|
||||||
} else {
|
if (viewNode) {
|
||||||
NSMutableDictionary *model = [[self subModelOf:viewId] mutableCopy];
|
[viewNode blend:subModel[@"props"]];
|
||||||
[self recursiveMixin:subModel to:model];
|
} else {
|
||||||
[self setSubModel:model in:viewId];
|
NSMutableDictionary *model = [[self subModelOf:viewId] mutableCopy];
|
||||||
}
|
[self recursiveMixin:subModel to:model];
|
||||||
[self.itemViewIds enumerateKeysAndObjectsUsingBlock:^(NSNumber *_Nonnull key, NSString *_Nonnull obj, BOOL *_Nonnull stop) {
|
[self setSubModel:model in:viewId];
|
||||||
if ([viewId isEqualToString:obj]) {
|
|
||||||
*stop = YES;
|
|
||||||
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:[key integerValue] inSection:0];
|
|
||||||
[UIView performWithoutAnimation:^{
|
|
||||||
[self.view reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
|
|
||||||
}];
|
|
||||||
}
|
}
|
||||||
}];
|
[self.itemViewIds enumerateKeysAndObjectsUsingBlock:^(NSNumber *_Nonnull key, NSString *_Nonnull obj, BOOL *_Nonnull stop) {
|
||||||
|
if ([viewId isEqualToString:obj]) {
|
||||||
|
*stop = YES;
|
||||||
|
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:[key integerValue] inSection:0];
|
||||||
|
[UIView performWithoutAnimation:^{
|
||||||
|
[self.view reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
}];
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)callItem:(NSUInteger)position height:(CGFloat)height {
|
- (void)callItem:(NSUInteger)position height:(CGFloat)height {
|
||||||
|
Reference in New Issue
Block a user