修改首页pop对钩问题
This commit is contained in:
@@ -284,9 +284,44 @@
|
||||
pop.isClickBgDismiss = YES; // 点击背景关闭
|
||||
pop.cornerRadius = 0; // 自定义 view 自处理圆角
|
||||
|
||||
KBWeakSelf
|
||||
__weak typeof(pop) weakPop = pop;
|
||||
content.saveHandler = ^{ [weakPop dismiss]; };
|
||||
content.closeHandler = ^{ [weakPop dismiss]; };
|
||||
content.saveHandler = ^{
|
||||
[weakPop dismiss];
|
||||
|
||||
if (![KBUserSessionManager shared].isLoggedIn) {
|
||||
[[KBUserSessionManager shared] goLoginVC];
|
||||
return;
|
||||
}
|
||||
|
||||
__strong typeof(weakSelf) self = weakSelf;
|
||||
if (!self) { return; }
|
||||
if (indexPath.row >= self.listCharacters.count) { return; }
|
||||
|
||||
KBCharacter *mc = self.listCharacters[indexPath.row];
|
||||
if (mc.added) { return; }
|
||||
|
||||
NSString *cidStr = mc.ID ?: @"";
|
||||
if (cidStr.length == 0) { return; }
|
||||
NSNumber *cid = @([cidStr integerValue]);
|
||||
NSString *emoji = mc.emoji ? mc.emoji : @"";
|
||||
|
||||
[self.homeVM addUserCharacterWithId:cid emoji : emoji
|
||||
completion:^(BOOL success, NSError * _Nullable error) {
|
||||
if (success) {
|
||||
mc.added = YES;
|
||||
NSMutableArray *m = [self.listCharacters mutableCopy];
|
||||
[m replaceObjectAtIndex:indexPath.row withObject:mc];
|
||||
self.listCharacters = [m copy];
|
||||
[self.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
|
||||
|
||||
[self kb_refreshTopThreeView];
|
||||
}
|
||||
}];
|
||||
};
|
||||
content.closeHandler = ^{
|
||||
[weakPop dismiss];
|
||||
};
|
||||
|
||||
[pop pop];
|
||||
|
||||
|
||||
@@ -210,9 +210,42 @@
|
||||
pop.isClickBgDismiss = YES; // 点击背景关闭
|
||||
pop.cornerRadius = 0; // 自定义 view 自处理圆角
|
||||
|
||||
KBWeakSelf
|
||||
__weak typeof(pop) weakPop = pop;
|
||||
content.saveHandler = ^{ [weakPop dismiss]; };
|
||||
content.closeHandler = ^{ [weakPop dismiss]; };
|
||||
content.saveHandler = ^{
|
||||
[weakPop dismiss];
|
||||
|
||||
if (![KBUserSessionManager shared].isLoggedIn) {
|
||||
[[KBUserSessionManager shared] goLoginVC];
|
||||
return;
|
||||
}
|
||||
|
||||
__strong typeof(weakSelf) self = weakSelf;
|
||||
if (!self) { return; }
|
||||
if (indexPath.item >= self.characters.count) { return; }
|
||||
|
||||
KBCharacter *mc = self.characters[indexPath.item];
|
||||
if (mc.added) { return; }
|
||||
|
||||
NSString *cidStr = mc.ID ?: @"";
|
||||
if (cidStr.length == 0) { return; }
|
||||
NSNumber *cid = @([cidStr integerValue]);
|
||||
NSString *emoji = mc.emoji ? mc.emoji : @"";
|
||||
|
||||
[self.homeVM addUserCharacterWithId:cid emoji : emoji
|
||||
completion:^(BOOL success, NSError * _Nullable error) {
|
||||
if (success) {
|
||||
mc.added = YES;
|
||||
NSMutableArray *m = [self.characters mutableCopy];
|
||||
[m replaceObjectAtIndex:indexPath.item withObject:mc];
|
||||
self.characters = [m copy];
|
||||
[self.collectionView reloadItemsAtIndexPaths:@[indexPath]];
|
||||
}
|
||||
}];
|
||||
};
|
||||
content.closeHandler = ^{
|
||||
[weakPop dismiss];
|
||||
};
|
||||
|
||||
[pop pop];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user