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 {

View File

@@ -108,6 +108,11 @@
}];
if (audioMessage) {
[self.messageLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
make.width.height.mas_equalTo(0);
make.left.equalTo(self.bubbleView.mas_left);
make.top.equalTo(self.bubbleView.mas_top);
}];
[self.audioIconView mas_remakeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.bubbleView.mas_left).offset(10);
make.centerY.equalTo(self.bubbleView);
@@ -121,6 +126,16 @@
make.bottom.lessThanOrEqualTo(self.bubbleView.mas_bottom).offset(-8);
}];
} else {
[self.audioIconView mas_remakeConstraints:^(MASConstraintMaker *make) {
make.width.height.mas_equalTo(0);
make.left.equalTo(self.bubbleView.mas_left);
make.top.equalTo(self.bubbleView.mas_top);
}];
[self.audioLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
make.width.height.mas_equalTo(0);
make.left.equalTo(self.audioIconView.mas_right);
make.top.equalTo(self.bubbleView.mas_top);
}];
[self.messageLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self.bubbleView).insets(UIEdgeInsetsMake(8, 10, 8, 10));
}];