This commit is contained in:
2026-01-15 20:30:03 +08:00
parent b5da9f35a5
commit 169a1929d7
2 changed files with 41 additions and 6 deletions

View File

@@ -895,7 +895,7 @@ static void KBSkinInstallNotificationCallback(CFNotificationCenterRef center,
UIImage *cached = [self.chatAvatarCache objectForKey:urlString];
if (cached) {
message.avatarImage = cached;
[self.chatPanelView kb_reloadWithMessages:self.chatMessages];
[self kb_reloadChatRowForMessage:message];
return;
}
if (![[KBFullAccessManager shared] hasFullAccess]) {
@@ -919,11 +919,31 @@ static void KBSkinInstallNotificationCallback(CFNotificationCenterRef center,
if (!self) {
return;
}
[self.chatAvatarCache setObject:image forKey:urlString];
message.avatarImage = image;
[self.chatPanelView kb_reloadWithMessages:self.chatMessages];
});
}];
[self.chatAvatarCache setObject:image forKey:urlString];
message.avatarImage = image;
[self kb_reloadChatRowForMessage:message];
});
}];
}
- (void)kb_reloadChatRowForMessage:(KBChatMessage *)message {
NSUInteger idx = [self.chatMessages indexOfObject:message];
if (idx == NSNotFound) {
[self.chatPanelView kb_reloadWithMessages:self.chatMessages];
return;
}
UITableView *tableView = self.chatPanelView.tableView;
if (!tableView) {
[self.chatPanelView kb_reloadWithMessages:self.chatMessages];
return;
}
if (idx >= (NSUInteger)[tableView numberOfRowsInSection:0]) {
[self.chatPanelView kb_reloadWithMessages:self.chatMessages];
return;
}
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:idx inSection:0];
[tableView reloadRowsAtIndexPaths:@[ indexPath ]
withRowAnimation:UITableViewRowAnimationNone];
}
- (void)kb_requestChatAudioForText:(NSString *)text {