修改了可以添加多个代理的
This commit is contained in:
@@ -151,6 +151,13 @@
|
||||
E874B88427215B0E003954B9 /* XPIMRoomMicQueueDelegate.h in Sources */ = {isa = PBXBuildFile; fileRef = E874B8822721590D003954B9 /* XPIMRoomMicQueueDelegate.h */; };
|
||||
E874B88827215D39003954B9 /* MicroModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E874B88727215D39003954B9 /* MicroModel.m */; };
|
||||
E874B88B27215EAF003954B9 /* MicroQueueItemModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E874B88A27215EAF003954B9 /* MicroQueueItemModel.m */; };
|
||||
E874B88F27216FFE003954B9 /* XPIMChatRoomMemberImpl.m in Sources */ = {isa = PBXBuildFile; fileRef = E874B88E27216FFE003954B9 /* XPIMChatRoomMemberImpl.m */; };
|
||||
E874B8912721712B003954B9 /* XPIMChatRoomMemberInterface.h in Sources */ = {isa = PBXBuildFile; fileRef = E874B890272170A6003954B9 /* XPIMChatRoomMemberInterface.h */; };
|
||||
E874B89527217DA6003954B9 /* XPIMChatRoomMessageImpl.m in Sources */ = {isa = PBXBuildFile; fileRef = E874B89427217DA6003954B9 /* XPIMChatRoomMessageImpl.m */; };
|
||||
E874B89727218349003954B9 /* ZegoAudioRoom.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 184862CA27213FC7005FC5DC /* ZegoAudioRoom.framework */; };
|
||||
E874B89827218349003954B9 /* ZegoAudioRoom.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 184862CA27213FC7005FC5DC /* ZegoAudioRoom.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||
E874B89A27218AAF003954B9 /* XPIMChatRoomMessageDelegate.h in Sources */ = {isa = PBXBuildFile; fileRef = E874B89927218A9A003954B9 /* XPIMChatRoomMessageDelegate.h */; };
|
||||
E874B89B27218ABC003954B9 /* XPIMChatRoomMessageInterface.h in Sources */ = {isa = PBXBuildFile; fileRef = E874B89627217DC3003954B9 /* XPIMChatRoomMessageInterface.h */; };
|
||||
E88B5CA526FB088600DA9178 /* XPMineTeenagerViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E88B5CA426FB088600DA9178 /* XPMineTeenagerViewController.m */; };
|
||||
E88B5CA826FB089C00DA9178 /* XPMineTeenagePwdViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E88B5CA726FB089C00DA9178 /* XPMineTeenagePwdViewController.m */; };
|
||||
E88B5CAD26FB16A800DA9178 /* XPMineTeenagerDesView.m in Sources */ = {isa = PBXBuildFile; fileRef = E88B5CAC26FB16A800DA9178 /* XPMineTeenagerDesView.m */; };
|
||||
@@ -518,6 +525,13 @@
|
||||
E874B88727215D39003954B9 /* MicroModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MicroModel.m; sourceTree = "<group>"; };
|
||||
E874B88927215EAF003954B9 /* MicroQueueItemModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MicroQueueItemModel.h; sourceTree = "<group>"; };
|
||||
E874B88A27215EAF003954B9 /* MicroQueueItemModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MicroQueueItemModel.m; sourceTree = "<group>"; };
|
||||
E874B88D27216FFE003954B9 /* XPIMChatRoomMemberImpl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPIMChatRoomMemberImpl.h; sourceTree = "<group>"; };
|
||||
E874B88E27216FFE003954B9 /* XPIMChatRoomMemberImpl.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPIMChatRoomMemberImpl.m; sourceTree = "<group>"; };
|
||||
E874B890272170A6003954B9 /* XPIMChatRoomMemberInterface.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPIMChatRoomMemberInterface.h; sourceTree = "<group>"; };
|
||||
E874B89327217DA6003954B9 /* XPIMChatRoomMessageImpl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPIMChatRoomMessageImpl.h; sourceTree = "<group>"; };
|
||||
E874B89427217DA6003954B9 /* XPIMChatRoomMessageImpl.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPIMChatRoomMessageImpl.m; sourceTree = "<group>"; };
|
||||
E874B89627217DC3003954B9 /* XPIMChatRoomMessageInterface.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPIMChatRoomMessageInterface.h; sourceTree = "<group>"; };
|
||||
E874B89927218A9A003954B9 /* XPIMChatRoomMessageDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPIMChatRoomMessageDelegate.h; sourceTree = "<group>"; };
|
||||
E88B5CA326FB088600DA9178 /* XPMineTeenagerViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMineTeenagerViewController.h; sourceTree = "<group>"; };
|
||||
E88B5CA426FB088600DA9178 /* XPMineTeenagerViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPMineTeenagerViewController.m; sourceTree = "<group>"; };
|
||||
E88B5CA626FB089C00DA9178 /* XPMineTeenagePwdViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMineTeenagePwdViewController.h; sourceTree = "<group>"; };
|
||||
@@ -1439,6 +1453,8 @@
|
||||
E874B869272105C0003954B9 /* IM */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E874B89227217D64003954B9 /* RoomMessage */,
|
||||
E874B88C27216FB6003954B9 /* ChatRoomMember */,
|
||||
E874B87D272158B9003954B9 /* MicroQueue */,
|
||||
E874B8752721436F003954B9 /* Room */,
|
||||
E874B86A272105DD003954B9 /* XPIMManager.h */,
|
||||
@@ -1481,6 +1497,27 @@
|
||||
path = Model;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
E874B88C27216FB6003954B9 /* ChatRoomMember */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E874B88D27216FFE003954B9 /* XPIMChatRoomMemberImpl.h */,
|
||||
E874B88E27216FFE003954B9 /* XPIMChatRoomMemberImpl.m */,
|
||||
E874B890272170A6003954B9 /* XPIMChatRoomMemberInterface.h */,
|
||||
);
|
||||
path = ChatRoomMember;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
E874B89227217D64003954B9 /* RoomMessage */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E874B89327217DA6003954B9 /* XPIMChatRoomMessageImpl.h */,
|
||||
E874B89427217DA6003954B9 /* XPIMChatRoomMessageImpl.m */,
|
||||
E874B89627217DC3003954B9 /* XPIMChatRoomMessageInterface.h */,
|
||||
E874B89927218A9A003954B9 /* XPIMChatRoomMessageDelegate.h */,
|
||||
);
|
||||
path = RoomMessage;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
E88B5CA926FB15B900DA9178 /* Teenager */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@@ -2052,6 +2089,9 @@
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
E874B89B27218ABC003954B9 /* XPIMChatRoomMessageInterface.h in Sources */,
|
||||
E874B89A27218AAF003954B9 /* XPIMChatRoomMessageDelegate.h in Sources */,
|
||||
E874B8912721712B003954B9 /* XPIMChatRoomMemberInterface.h in Sources */,
|
||||
E874B88427215B0E003954B9 /* XPIMRoomMicQueueDelegate.h in Sources */,
|
||||
E874B88327215B06003954B9 /* XPIMRoomMicQueueInterface.h in Sources */,
|
||||
E874B87C27214888003954B9 /* XPIMRoomDelegate.h in Sources */,
|
||||
@@ -2108,6 +2148,7 @@
|
||||
E8E70D7A26F2F16600F03460 /* XPMinePresent.m in Sources */,
|
||||
E8EEB8F226FC2050007C6EBA /* SDPhotoBrowser.m in Sources */,
|
||||
E89DA67827009F16008483C1 /* NSObject+JSONString.m in Sources */,
|
||||
E874B89527217DA6003954B9 /* XPIMChatRoomMessageImpl.m in Sources */,
|
||||
E81C27AB26EF2D920031E639 /* ThirdUserInfo.m in Sources */,
|
||||
E874B86C272105DD003954B9 /* XPIMManager.m in Sources */,
|
||||
E81C279D26EEEC620031E639 /* XPConstant.m in Sources */,
|
||||
@@ -2184,6 +2225,7 @@
|
||||
E88F5EB0271ECEF000FF9B33 /* XPRoomViewController+RoomInfoContainerView.m in Sources */,
|
||||
E86596542701A55500846EBD /* StatisticsServiceHelper.m in Sources */,
|
||||
E8E70D8C26F2F5A500F03460 /* XPMineMatchCollectionViewCell.m in Sources */,
|
||||
E874B88F27216FFE003954B9 /* XPIMChatRoomMemberImpl.m in Sources */,
|
||||
186A534A26FC6ED900D67B2C /* TTActionSheetConfig.m in Sources */,
|
||||
E81C279326EB394D0031E639 /* LoginForgetPasswordViewController.m in Sources */,
|
||||
E81C278D26EAFAF60031E639 /* DESEncrypt.m in Sources */,
|
||||
|
16
xplan-ios/Main/IM/ChatRoomMember/XPIMChatRoomMemberImpl.h
Normal file
16
xplan-ios/Main/IM/ChatRoomMember/XPIMChatRoomMemberImpl.h
Normal file
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// XPIMChatRoomMemberImpl.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2021/10/21.
|
||||
// 房间成员变化的类 在线列表 拉黑/移除成员 查询成员 设置/取消管理 踢出成员
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "XPIMChatRoomMemberInterface.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface XPIMChatRoomMemberImpl : NSObject<XPIMChatRoomMemberInterface>
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
40
xplan-ios/Main/IM/ChatRoomMember/XPIMChatRoomMemberImpl.m
Normal file
40
xplan-ios/Main/IM/ChatRoomMember/XPIMChatRoomMemberImpl.m
Normal file
@@ -0,0 +1,40 @@
|
||||
//
|
||||
// XPIMChatRoomMemberImpl.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2021/10/21.
|
||||
//
|
||||
|
||||
#import "XPIMChatRoomMemberImpl.h"
|
||||
///Third
|
||||
#import <ReactiveObjC/ReactiveObjC.h>
|
||||
#import <NIMSDK/NIMSDK.h>
|
||||
///Tool
|
||||
#import "XPIMManager.h"
|
||||
///Model
|
||||
#import "RoomInfoModel.h"
|
||||
|
||||
@implementation XPIMChatRoomMemberImpl
|
||||
|
||||
#pragma mark - XPIMChatRoomMemberInterface
|
||||
///通过Uid获取 成员
|
||||
- (RACSignal *)rac_queryChatRoomMember:(NSString *)uid {
|
||||
return [RACSignal createSignal:^RACDisposable * _Nullable(id<RACSubscriber> _Nonnull subscriber) {
|
||||
RoomInfoModel * roomInfo =[XPIMManager shareManager].chatRoomManager.getCurrentRoomInfo;
|
||||
NIMChatroomMembersByIdsRequest *request = [[NIMChatroomMembersByIdsRequest alloc]init];
|
||||
request.roomId = [NSString stringWithFormat:@"%ld", roomInfo.roomId];
|
||||
request.userIds = @[uid];
|
||||
[[NIMSDK sharedSDK].chatroomManager fetchChatroomMembersByIds:request completion:^(NSError * _Nullable error, NSArray<NIMChatroomMember *> * _Nullable members) {
|
||||
if (error == nil) {
|
||||
[subscriber sendNext:members.firstObject];
|
||||
[subscriber sendCompleted];
|
||||
}else {
|
||||
[subscriber sendNext:nil];
|
||||
}
|
||||
}];
|
||||
|
||||
return nil;
|
||||
}];
|
||||
}
|
||||
|
||||
@end
|
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// XPIMChatRoomMemberInterface.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2021/10/21.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <ReactiveObjC/ReactiveObjC.h>
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@protocol XPIMChatRoomMemberInterface <NSObject>
|
||||
|
||||
///通过Uid获取 成员
|
||||
- (RACSignal *)rac_queryChatRoomMember:(NSString *)uid;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@@ -10,6 +10,7 @@
|
||||
#import <NIMSDK/NIMSDK.h>
|
||||
///Tool
|
||||
#import "XPIMManager.h"
|
||||
#import "AccountInfoStorage.h"
|
||||
///Model
|
||||
#import "MicroModel.h"
|
||||
#import "MicroQueueItemModel.h"
|
||||
@@ -21,10 +22,12 @@
|
||||
#define MIC_COUNT(Type) [self roomTypecpORnormal:Type]
|
||||
|
||||
@interface XPIMRoomMicQueueImpl ()
|
||||
///代理
|
||||
@property (nonatomic,strong) id<XPIMRoomMicQueueDelegate> delegate;
|
||||
///麦序的状态 <麦序 麦序上的内容>
|
||||
@property (nonatomic,strong) NSMutableDictionary<NSString *, MicroQueueItemModel *> *micQueue;
|
||||
///正在上麦或者下麦
|
||||
@property (nonatomic,assign) BOOL isLoadingMic;
|
||||
///代理数组
|
||||
@property (nonatomic,strong) NSMutableArray *delegateArray;
|
||||
@end
|
||||
|
||||
@implementation XPIMRoomMicQueueImpl
|
||||
@@ -38,6 +41,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
///提前绑定一下麦序
|
||||
- (void)configDefaultMicQueue {
|
||||
RoomInfoModel * roomfInfo = [XPIMManager shareManager].chatRoomManager.getCurrentRoomInfo;
|
||||
for (int i = 0 ; i < MIC_COUNT(roomfInfo.type); i++) {
|
||||
@@ -51,6 +55,8 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#pragma mark - XPIMRoomMicQueueInterface
|
||||
///进入房间成功之后根据扩展字段整理麦序
|
||||
- (void)enterRoomRepairMicQueue:(NSDictionary *)micDictionary {
|
||||
@@ -72,8 +78,11 @@
|
||||
MicroQueueItemModel *sequence = [self.micQueue objectForKey:position];
|
||||
sequence.userInfo = userInfo;
|
||||
}
|
||||
if ([self.delegate respondsToSelector:@selector(onGetRoomMicroQueueSuccess:)]) {
|
||||
[self.delegate onGetRoomMicroQueueSuccess:self.micQueue];
|
||||
|
||||
for (id<XPIMRoomMicQueueDelegate> delegate in self.delegateArray) {
|
||||
if ([delegate respondsToSelector:@selector(onGetRoomMicroQueueSuccess:)]) {
|
||||
[delegate onGetRoomMicroQueueSuccess:self.micQueue];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
NSLog(@"获取队列失败");
|
||||
@@ -86,7 +95,27 @@
|
||||
}
|
||||
|
||||
- (void)upMic:(NSString *)position {
|
||||
if (self.isLoadingMic) {
|
||||
#warning to do - 展示正在上麦toast
|
||||
}
|
||||
|
||||
self.isLoadingMic = YES;
|
||||
///这个坑位 有没有人
|
||||
UserInfoModel *userInfo = [[self.micQueue objectForKey:position] userInfo];
|
||||
if (userInfo) {
|
||||
#warning to do - 展示用户卡片
|
||||
} else {
|
||||
NSString * uid = [[AccountInfoStorage instance] getUid];
|
||||
[[[XPIMManager shareManager].chatRoomMemberManager rac_queryChatRoomMember:uid] subscribeNext:^(id _Nullable x) {
|
||||
NIMChatroomMember * member = x;
|
||||
if (member.type == NIMChatroomMemberTypeCreator || member.type == NIMTeamMemberTypeManager) {
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
}];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
- (void)downMic:(NSString *)position {
|
||||
@@ -95,11 +124,16 @@
|
||||
|
||||
///添加代理
|
||||
- (void)addDelegate:(id<XPIMRoomMicQueueDelegate>)delegate {
|
||||
self.delegate = delegate;
|
||||
if (delegate) {
|
||||
[self.delegateArray addObject:delegate];
|
||||
}
|
||||
}
|
||||
///移除代理
|
||||
- (void)removeDelegate:(id<XPIMRoomMicQueueDelegate>)delegate {
|
||||
self.delegate = nil;
|
||||
if (delegate && [self.delegateArray containsObject:delegate]) {
|
||||
[self.delegateArray removeObject:delegate];
|
||||
delegate = nil;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
@@ -109,5 +143,11 @@
|
||||
}
|
||||
return _micQueue;
|
||||
}
|
||||
- (NSMutableArray *)delegateArray {
|
||||
if (!_delegateArray) {
|
||||
_delegateArray = [NSMutableArray array];
|
||||
}
|
||||
return _delegateArray;
|
||||
}
|
||||
|
||||
@end
|
||||
|
@@ -18,11 +18,10 @@
|
||||
|
||||
|
||||
@interface XPImRoomImpl ()
|
||||
///
|
||||
@property (nonatomic,strong) id<XPIMRoomDelegate> delegate;
|
||||
|
||||
///房间信息
|
||||
@property (nonatomic,strong) RoomInfoModel *roomInfo;
|
||||
///代理数组
|
||||
@property (nonatomic,strong) NSMutableArray *delegateArray;
|
||||
@end
|
||||
|
||||
|
||||
@@ -65,13 +64,25 @@
|
||||
}
|
||||
|
||||
- (void)addDelegate:(id<XPIMRoomDelegate>)delegate {
|
||||
self.delegate = delegate;
|
||||
if (delegate) {
|
||||
[self.delegateArray addObject:delegate];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)removeDelegate:(id<XPIMRoomDelegate>)delegate {
|
||||
self.delegate = nil;
|
||||
if (delegate && [self.delegateArray containsObject:delegate]) {
|
||||
[self.delegateArray removeObject:delegate];
|
||||
delegate = nil;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
- (NSMutableArray *)delegateArray {
|
||||
if (!_delegateArray) {
|
||||
_delegateArray = [NSMutableArray array];
|
||||
}
|
||||
return _delegateArray;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@end
|
||||
|
21
xplan-ios/Main/IM/RoomMessage/XPIMChatRoomMessageDelegate.h
Normal file
21
xplan-ios/Main/IM/RoomMessage/XPIMChatRoomMessageDelegate.h
Normal file
@@ -0,0 +1,21 @@
|
||||
//
|
||||
// XPIMChatRoomMessageDelegate.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2021/10/21.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
@class NIMMessage;
|
||||
@protocol XPIMChatRoomMessageDelegate <NSObject>
|
||||
|
||||
///收到房间信息更细的消息
|
||||
- (void)onReceiveRoomInfoUpdate:(NIMMessage *)message;
|
||||
///收到队列消息变更的通知
|
||||
- (void)onReceiveMicroQueueUpdate:(NIMMessage *)message;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
16
xplan-ios/Main/IM/RoomMessage/XPIMChatRoomMessageImpl.h
Normal file
16
xplan-ios/Main/IM/RoomMessage/XPIMChatRoomMessageImpl.h
Normal file
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// XPIMChatRoomMessageImpl.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2021/10/21.
|
||||
// 处理房间消息 收到房间消息的各种处理
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface XPIMChatRoomMessageImpl : NSObject
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
115
xplan-ios/Main/IM/RoomMessage/XPIMChatRoomMessageImpl.m
Normal file
115
xplan-ios/Main/IM/RoomMessage/XPIMChatRoomMessageImpl.m
Normal file
@@ -0,0 +1,115 @@
|
||||
//
|
||||
// XPIMChatRoomMessageImpl.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2021/10/21.
|
||||
//
|
||||
|
||||
#import "XPIMChatRoomMessageImpl.h"
|
||||
///Third
|
||||
#import <NIMSDK/NIMSDK.h>
|
||||
///Tool
|
||||
#import "XPIMManager.h"
|
||||
///Model
|
||||
#import "RoomInfoModel.h"
|
||||
///P
|
||||
#import "XPIMChatRoomMessageDelegate.h"
|
||||
|
||||
@interface XPIMChatRoomMessageImpl ()<NIMChatManagerDelegate>
|
||||
///代理数组
|
||||
@property (nonatomic,strong) NSMutableArray *delegateArray;
|
||||
@end
|
||||
|
||||
@implementation XPIMChatRoomMessageImpl
|
||||
|
||||
- (instancetype)init {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
[[NIMSDK sharedSDK].chatManager addDelegate:self];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
[[NIMSDK sharedSDK].chatManager removeDelegate:self];
|
||||
}
|
||||
|
||||
#pragma mark - Private Method
|
||||
- (void)onReceiveMessageNotification:(NIMMessage *)message {
|
||||
NIMNotificationObject *notiMsg = (NIMNotificationObject *)message.messageObject;
|
||||
NIMChatroomNotificationContent *content = (NIMChatroomNotificationContent *)notiMsg.content;
|
||||
switch (content.eventType) {
|
||||
case NIMChatroomEventTypeEnter:
|
||||
///进房房间 目前不做
|
||||
break;
|
||||
case NIMChatroomEventTypeExit:
|
||||
{
|
||||
/// 退出房间可能需要及时刷新在线人数
|
||||
}
|
||||
break;
|
||||
case NIMChatroomEventTypeAddBlack:
|
||||
{
|
||||
///用户被拉黑 需要更新在线人数以及 更新队列
|
||||
}
|
||||
break;
|
||||
case NIMChatroomEventTypeRemoveBlack:
|
||||
{
|
||||
///移除黑名单
|
||||
}
|
||||
break;
|
||||
case NIMChatroomEventTypeMemberUpdateInfo://修改自己ext字段
|
||||
|
||||
break;
|
||||
case NIMChatroomEventTypeRemoveManager:
|
||||
#warning to do 移除管理员
|
||||
break;
|
||||
case NIMChatroomEventTypeAddManager:
|
||||
#warning to do 添加管理员
|
||||
break;
|
||||
case NIMChatroomEventTypeKicked:///用户被踢出房间
|
||||
|
||||
break;
|
||||
case NIMChatroomEventTypeInfoUpdated://麦序状态,房间信息,房间背景
|
||||
|
||||
break;
|
||||
case NIMChatroomEventTypeQueueChange://队列上下麦
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - NIMChatManagerDelegate
|
||||
/// 收到消息回调
|
||||
- (void)onRecvMessages:(NSArray<NIMMessage *> *)messages {
|
||||
for (NIMMessage * message in messages) {
|
||||
///房间内的消息
|
||||
if (message.session.sessionType == NIMSessionTypeChatroom && [message.session.sessionId isEqualToString:[NSString stringWithFormat:@"%ld", [XPIMManager shareManager].chatRoomManager.getCurrentRoomInfo.roomId]]) {
|
||||
if (message.messageType == NIMMessageTypeText || message.messageType == NIMMessageTypeTip) {
|
||||
#warning to do 加入到公屏
|
||||
} else if (message.messageType == NIMMessageTypeNotification) {
|
||||
NIMNotificationObject *notiMsg = (NIMNotificationObject *)message.messageObject;
|
||||
|
||||
}else if (message.messageType == NIMMessageTypeCustom) {// 如果是自定义消息
|
||||
#warning to do 处理自定义消息
|
||||
|
||||
}
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
- (NSMutableArray *)delegateArray {
|
||||
if (!_delegateArray) {
|
||||
_delegateArray = [NSMutableArray array];
|
||||
}
|
||||
return _delegateArray;
|
||||
}
|
||||
|
||||
@end
|
16
xplan-ios/Main/IM/RoomMessage/XPIMChatRoomMessageInterface.h
Normal file
16
xplan-ios/Main/IM/RoomMessage/XPIMChatRoomMessageInterface.h
Normal file
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// XPIMChatRoomMessageInterface.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2021/10/21.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@protocol XPIMChatRoomMessageInterface <NSObject>
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@@ -8,6 +8,7 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "XPIMRoomInterface.h"
|
||||
#import "XPIMRoomMicQueueInterface.h"
|
||||
#import "XPIMChatRoomMemberInterface.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface XPIMManager : NSObject
|
||||
@@ -16,6 +17,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@property (nonatomic,strong, readonly) id<XPIMRoomInterface> chatRoomManager;
|
||||
///麦序的管理类
|
||||
@property (nonatomic,strong, readonly) id<XPIMRoomMicQueueInterface> microQueueManager;
|
||||
///房间成员管理类
|
||||
@property (nonatomic,strong, readonly) id<XPIMChatRoomMemberInterface> chatRoomMemberManager;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -8,11 +8,14 @@
|
||||
#import "XPIMManager.h"
|
||||
#import "XPImRoomImpl.h"
|
||||
#import "XPIMRoomMicQueueImpl.h"
|
||||
#import "XPIMChatRoomMemberImpl.h"
|
||||
@interface XPIMManager ()
|
||||
///聊天室的管理类
|
||||
@property (nonatomic,strong) id<XPIMRoomInterface> chatRoomManager;
|
||||
///麦序的管理类
|
||||
@property (nonatomic,strong) id<XPIMRoomMicQueueInterface> microQueueManager;
|
||||
///房间成员管理类
|
||||
@property (nonatomic,strong) id<XPIMChatRoomMemberInterface> chatRoomMemberManager;
|
||||
@end
|
||||
|
||||
@implementation XPIMManager
|
||||
@@ -41,4 +44,11 @@
|
||||
return _microQueueManager;
|
||||
}
|
||||
|
||||
- (id<XPIMChatRoomMemberInterface>)chatRoomMemberManager {
|
||||
if (!_chatRoomMemberManager) {
|
||||
_chatRoomMemberManager = [[XPIMChatRoomMemberImpl alloc] init];
|
||||
}
|
||||
return _chatRoomMemberManager;
|
||||
}
|
||||
|
||||
@end
|
||||
|
Reference in New Issue
Block a user