新增公共房间消息转发通知常量,并在相关管理器和视图控制器中实现消息转发逻辑,优化公共房间消息处理流程,提升代码可读性和功能性。
This commit is contained in:
@@ -7,6 +7,10 @@
|
||||
|
||||
#import "MvpViewController.h"
|
||||
#import "XPMessageRemoteExtModel.h"
|
||||
|
||||
// 公共房间消息转发通知名称
|
||||
UIKIT_EXTERN NSString * const kMessageFromPublicRoomWithAttachmentNotification;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface XPRoomViewController : MvpViewController
|
||||
|
@@ -98,6 +98,7 @@
|
||||
UIKIT_EXTERN NSString * const kRoomGiftEffectUpdateNotificationKey;
|
||||
UIKIT_EXTERN NSString * const kRoomMiniNotificationKey;
|
||||
UIKIT_EXTERN NSString * kNewUserRechargeKey;
|
||||
UIKIT_EXTERN NSString * const kMessageFromPublicRoomWithAttachmentNotification;
|
||||
UIKIT_EXTERN NSString * const kFreeGiftCountdownNotification;
|
||||
NSString * const kHadShowAnchorRoomTipKey = @"kHadShowAnchorRoomTipKey";//是否展示过个播房上划用户引导
|
||||
NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出过非自己房间
|
||||
@@ -421,6 +422,12 @@ XPCandyTreeInsufficientBalanceViewDelegate>
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(myGiftEffectUpdate:) name:kRoomGiftEffectUpdateNotificationKey object:nil];
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(openRedPacketNotification:) name:@"kOpenRedPacketNotification" object:nil];
|
||||
|
||||
// 添加公共房间消息转发通知监听
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(handlePublicRoomMessageForward:)
|
||||
name:@"MessageFromPublicRoomWithAttachmentNotification"
|
||||
object:nil];
|
||||
|
||||
// 添加应用生命周期保护
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(applicationDidEnterBackground:)
|
||||
@@ -3121,4 +3128,26 @@ XPCandyTreeInsufficientBalanceViewDelegate>
|
||||
}
|
||||
return _redPacketView;
|
||||
}
|
||||
|
||||
#pragma mark - 公共房间消息转发处理
|
||||
|
||||
- (void)handlePublicRoomMessageForward:(NSNotification *)notification {
|
||||
NIMMessage *message = notification.object;
|
||||
if (![message isKindOfClass:[NIMMessage class]]) {
|
||||
NSLog(@"XPRoomViewController: 收到无效的公共房间转发消息");
|
||||
return;
|
||||
}
|
||||
|
||||
// 检查房间是否处于活跃状态
|
||||
if (!self.roomInfo || !self.messageContainerView) {
|
||||
NSLog(@"XPRoomViewController: 房间未就绪,忽略公共房间转发消息");
|
||||
return;
|
||||
}
|
||||
|
||||
// 使用现有的消息处理流程
|
||||
[self.messageContainerView handleNIMCustomMessage:message];
|
||||
|
||||
NSLog(@"XPRoomViewController: 处理公共房间转发的106类型消息");
|
||||
}
|
||||
|
||||
@end
|
||||
|
Reference in New Issue
Block a user