新增 QEmotionBoardView 表情不显示问题分析报告和排查报告,详细记录问题描述、代码逻辑、根因分析及解决方案。同时,修复 AppDelegate 中的图片加载逻辑,添加调试日志以便于后续排查,确保表情正常显示。
This commit is contained in:
@@ -808,6 +808,8 @@ typedef NS_ENUM(NSUInteger, CustomMessageTypeRoomLevelUpdate) {
|
||||
|
||||
@property(nonatomic, assign) NSInteger seq; // 本地序号,用于将一条消息分解为多条有次序的消息
|
||||
|
||||
@property (nonatomic, assign) BOOL isFromPublic;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -23,6 +23,8 @@
|
||||
@property (nonatomic, copy) NSString *currentUserId;
|
||||
@property (nonatomic, strong) UserInfoModel *userInfo;
|
||||
|
||||
|
||||
|
||||
@end
|
||||
|
||||
@implementation PublicRoomManager
|
||||
@@ -217,6 +219,7 @@
|
||||
NSMutableDictionary *ext = [NSMutableDictionary dictionaryWithObject:extModel.model2dictionary
|
||||
forKey:[NSString stringWithFormat:@"%ld", self.userInfo.uid]];
|
||||
request.roomExt = [ext toJSONString];
|
||||
request.retryCount = 3;
|
||||
|
||||
// 进入房间
|
||||
@kWeakify(self);
|
||||
@@ -373,6 +376,10 @@
|
||||
- (void)onRecvMessages:(NSArray<NIMMessage *> *)messages {
|
||||
// 只处理公共房间的消息
|
||||
for (NIMMessage *message in messages) {
|
||||
if ([message.session.sessionId isEqualToString:self.currentPublicRoomId]) {
|
||||
[self handleMessageWithAttachmentAndFirstSecond:message];
|
||||
}
|
||||
/*
|
||||
if (message.session.sessionType == NIMSessionTypeChatroom) {
|
||||
NSString *sessionId = message.session.sessionId;
|
||||
if ([sessionId isEqualToString:self.currentPublicRoomId]) {
|
||||
@@ -382,6 +389,7 @@
|
||||
NIMCustomObject *obj = (NIMCustomObject *) message.messageObject;
|
||||
attachment = (AttachmentModel *) obj.attachment;
|
||||
if (attachment.first > 0 && attachment.second >0) {
|
||||
attachment.isFromPublic = YES;
|
||||
[self handleMessageWithAttachmentAndFirstSecond:message];
|
||||
}
|
||||
// if (attachment) {
|
||||
@@ -402,11 +410,18 @@
|
||||
// messageExt.roomExt);
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
- (void)handleMessageWithAttachmentAndFirstSecond:(NIMMessage *)message {
|
||||
|
||||
// 只有用户在房间时,才会转发
|
||||
if (![XPSkillCardPlayerManager shareInstance].isInRoom) {
|
||||
NSLog(@"PublicRoomManager: 用户未在房间中,跳过消息转发");
|
||||
return;
|
||||
}
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:@"MessageFromPublicRoomWithAttachmentNotification"
|
||||
object:message];
|
||||
}
|
||||
|
||||
- (void)handleFirst_106:(AttachmentModel *)attachment
|
||||
|
@@ -9,7 +9,7 @@
|
||||
#import "XPMessageRemoteExtModel.h"
|
||||
|
||||
// 公共房间消息转发通知名称
|
||||
UIKIT_EXTERN NSString * const kMessageFromPublicRoomWithAttachmentNotification;
|
||||
UIKIT_EXTERN NSString * _Nullable const kMessageFromPublicRoomWithAttachmentNotification;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
|
@@ -1932,9 +1932,21 @@ XPCandyTreeInsufficientBalanceViewDelegate>
|
||||
}
|
||||
|
||||
if (![message.session.sessionId isEqualToString:@(self.roomInfo.roomId).stringValue]) {
|
||||
NSLog(@"[Recv] ⛔️ 过滤:房间不匹配 | msg.sid=%@ | curRoomId=%@",
|
||||
message.session.sessionId, @(self.roomInfo.roomId).stringValue);
|
||||
continue;
|
||||
// if (message.messageType == NIMMessageTypeCustom) {
|
||||
// NIMCustomObject *obj = (NIMCustomObject *)message.messageObject;
|
||||
// if ([obj.attachment isKindOfClass:[AttachmentModel class]]) {
|
||||
// AttachmentModel *att = (AttachmentModel *)obj.attachment;
|
||||
// if (!att.isFromPublic) {
|
||||
// NSLog(@"[Recv] ⛔️ 过滤:房间不匹配 | msg.sid=%@ | curRoomId=%@",
|
||||
// message.session.sessionId, @(self.roomInfo.roomId).stringValue);
|
||||
// continue;
|
||||
// }
|
||||
// }
|
||||
// }else {
|
||||
NSLog(@"[Recv] ⛔️ 过滤:房间不匹配 | msg.sid=%@ | curRoomId=%@",
|
||||
message.session.sessionId, @(self.roomInfo.roomId).stringValue);
|
||||
continue;
|
||||
// }
|
||||
}
|
||||
|
||||
NSLog(@"[Recv] --- Message Raw Attach Content: %@, %@, %ld", @(message.senderClientType), message.rawAttachContent, (long)message.messageType);
|
||||
@@ -1948,19 +1960,19 @@ XPCandyTreeInsufficientBalanceViewDelegate>
|
||||
[self handleNIMNotificationTypeMessage:message];
|
||||
} else if (message.messageType == NIMMessageTypeCustom) {
|
||||
// 自定义消息排查日志:first/second/size3
|
||||
//#if DEBUG
|
||||
// if ([message.messageObject isKindOfClass:[NIMCustomObject class]]) {
|
||||
// NIMCustomObject *obj = (NIMCustomObject *)message.messageObject;
|
||||
// if ([obj.attachment isKindOfClass:[AttachmentModel class]]) {
|
||||
// AttachmentModel *att = (AttachmentModel *)obj.attachment;
|
||||
// NSData *payloadJSON = nil;
|
||||
// @try { payloadJSON = [NSJSONSerialization dataWithJSONObject:att.data ?: @{} options:0 error:nil]; } @catch (__unused NSException *e) {}
|
||||
// NSLog(@"[Recv] 🎯 自定义消息 | first=%ld second=%ld | payload=%lub | sid=%@ | ts=%.3f",
|
||||
// (long)att.first, (long)att.second, (unsigned long)payloadJSON.length,
|
||||
// message.session.sessionId, [[NSDate date] timeIntervalSince1970]);
|
||||
// }
|
||||
// }
|
||||
//#endif
|
||||
#if DEBUG
|
||||
if ([message.messageObject isKindOfClass:[NIMCustomObject class]]) {
|
||||
NIMCustomObject *obj = (NIMCustomObject *)message.messageObject;
|
||||
if ([obj.attachment isKindOfClass:[AttachmentModel class]]) {
|
||||
AttachmentModel *att = (AttachmentModel *)obj.attachment;
|
||||
NSData *payloadJSON = nil;
|
||||
@try { payloadJSON = [NSJSONSerialization dataWithJSONObject:att.data ?: @{} options:0 error:nil]; } @catch (__unused NSException *e) {}
|
||||
NSLog(@"[Recv] 🎯 自定义消息 | first=%ld second=%ld | payload=%lub | sid=%@ | ts=%.3f",
|
||||
(long)att.first, (long)att.second, (unsigned long)payloadJSON.length,
|
||||
message.session.sessionId, [[NSDate date] timeIntervalSince1970]);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
[self handleNimCustomTypeMessage:message];
|
||||
} else if(message.messageType == NIMMessageTypeText) {
|
||||
[self.messageContainerView handleNIMTextMessage:message];
|
||||
@@ -3239,9 +3251,32 @@ XPCandyTreeInsufficientBalanceViewDelegate>
|
||||
}
|
||||
|
||||
// 使用现有的消息处理流程
|
||||
[self.messageContainerView handleNIMCustomMessage:message];
|
||||
// [self.messageContainerView handleNIMCustomMessage:message];
|
||||
// [self.animationView handleNIMCustomMessage:message];
|
||||
// [self handleNimCustomTypeMessage:message];
|
||||
// [self onRecvMessages:@[message]];
|
||||
|
||||
|
||||
NSLog(@"XPRoomViewController: 处理公共房间转发的106类型消息");
|
||||
switch (message.messageType) {
|
||||
case NIMMessageTypeNotification:
|
||||
[self handleNIMNotificationTypeMessage:message];
|
||||
break;
|
||||
case NIMMessageTypeCustom:
|
||||
[self handleNimCustomTypeMessage:message];
|
||||
break;
|
||||
case NIMMessageTypeText:
|
||||
[self.messageContainerView handleNIMTextMessage:message];
|
||||
[self.littleGameView handleNIMTextMessage:message];
|
||||
break;
|
||||
case NIMMessageTypeTip:
|
||||
[self.messageContainerView handleNIMTextMessage:message];
|
||||
break;
|
||||
case NIMMessageTypeImage:
|
||||
[self.messageContainerView handleNIMImageMessage:message];
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
Reference in New Issue
Block a user