修改了加入房间 获取麦序
This commit is contained in:
@@ -147,6 +147,14 @@
|
||||
E874B8702721067A003954B9 /* XPIMLoginImpl.m in Sources */ = {isa = PBXBuildFile; fileRef = E874B86F2721067A003954B9 /* XPIMLoginImpl.m */; };
|
||||
E874B873272108DB003954B9 /* XPIMLoginDelegate.h in Sources */ = {isa = PBXBuildFile; fileRef = E874B872272106B3003954B9 /* XPIMLoginDelegate.h */; };
|
||||
E874B874272108ED003954B9 /* XPIMLoginInterface.h in Sources */ = {isa = PBXBuildFile; fileRef = E874B87127210699003954B9 /* XPIMLoginInterface.h */; };
|
||||
E874B8782721438E003954B9 /* XPImRoomImpl.m in Sources */ = {isa = PBXBuildFile; fileRef = E874B8772721438E003954B9 /* XPImRoomImpl.m */; };
|
||||
E874B87B27214882003954B9 /* XPIMRoomInterface.h in Sources */ = {isa = PBXBuildFile; fileRef = E874B879272143AD003954B9 /* XPIMRoomInterface.h */; };
|
||||
E874B87C27214888003954B9 /* XPIMRoomDelegate.h in Sources */ = {isa = PBXBuildFile; fileRef = E874B87A272143C7003954B9 /* XPIMRoomDelegate.h */; };
|
||||
E874B880272158E7003954B9 /* XPIMRoomMicQueueImpl.m in Sources */ = {isa = PBXBuildFile; fileRef = E874B87F272158E7003954B9 /* XPIMRoomMicQueueImpl.m */; };
|
||||
E874B88327215B06003954B9 /* XPIMRoomMicQueueInterface.h in Sources */ = {isa = PBXBuildFile; fileRef = E874B881272158FA003954B9 /* XPIMRoomMicQueueInterface.h */; };
|
||||
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 */; };
|
||||
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 */; };
|
||||
@@ -508,6 +516,18 @@
|
||||
E874B86F2721067A003954B9 /* XPIMLoginImpl.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPIMLoginImpl.m; sourceTree = "<group>"; };
|
||||
E874B87127210699003954B9 /* XPIMLoginInterface.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPIMLoginInterface.h; sourceTree = "<group>"; };
|
||||
E874B872272106B3003954B9 /* XPIMLoginDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPIMLoginDelegate.h; sourceTree = "<group>"; };
|
||||
E874B8762721438E003954B9 /* XPImRoomImpl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPImRoomImpl.h; sourceTree = "<group>"; };
|
||||
E874B8772721438E003954B9 /* XPImRoomImpl.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPImRoomImpl.m; sourceTree = "<group>"; };
|
||||
E874B879272143AD003954B9 /* XPIMRoomInterface.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPIMRoomInterface.h; sourceTree = "<group>"; };
|
||||
E874B87A272143C7003954B9 /* XPIMRoomDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPIMRoomDelegate.h; sourceTree = "<group>"; };
|
||||
E874B87E272158E7003954B9 /* XPIMRoomMicQueueImpl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPIMRoomMicQueueImpl.h; sourceTree = "<group>"; };
|
||||
E874B87F272158E7003954B9 /* XPIMRoomMicQueueImpl.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPIMRoomMicQueueImpl.m; sourceTree = "<group>"; };
|
||||
E874B881272158FA003954B9 /* XPIMRoomMicQueueInterface.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPIMRoomMicQueueInterface.h; sourceTree = "<group>"; };
|
||||
E874B8822721590D003954B9 /* XPIMRoomMicQueueDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPIMRoomMicQueueDelegate.h; sourceTree = "<group>"; };
|
||||
E874B88627215D39003954B9 /* MicroModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MicroModel.h; sourceTree = "<group>"; };
|
||||
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>"; };
|
||||
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>"; };
|
||||
@@ -1429,6 +1449,8 @@
|
||||
E874B869272105C0003954B9 /* IM */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E874B87D272158B9003954B9 /* MicroQueue */,
|
||||
E874B8752721436F003954B9 /* Room */,
|
||||
E874B86D2721064E003954B9 /* Login */,
|
||||
E874B86A272105DD003954B9 /* XPIMManager.h */,
|
||||
E874B86B272105DD003954B9 /* XPIMManager.m */,
|
||||
@@ -1447,6 +1469,40 @@
|
||||
path = Login;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
E874B8752721436F003954B9 /* Room */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E874B8762721438E003954B9 /* XPImRoomImpl.h */,
|
||||
E874B8772721438E003954B9 /* XPImRoomImpl.m */,
|
||||
E874B879272143AD003954B9 /* XPIMRoomInterface.h */,
|
||||
E874B87A272143C7003954B9 /* XPIMRoomDelegate.h */,
|
||||
);
|
||||
path = Room;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
E874B87D272158B9003954B9 /* MicroQueue */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E874B88527215CFF003954B9 /* Model */,
|
||||
E874B87E272158E7003954B9 /* XPIMRoomMicQueueImpl.h */,
|
||||
E874B87F272158E7003954B9 /* XPIMRoomMicQueueImpl.m */,
|
||||
E874B881272158FA003954B9 /* XPIMRoomMicQueueInterface.h */,
|
||||
E874B8822721590D003954B9 /* XPIMRoomMicQueueDelegate.h */,
|
||||
);
|
||||
path = MicroQueue;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
E874B88527215CFF003954B9 /* Model */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E874B88627215D39003954B9 /* MicroModel.h */,
|
||||
E874B88727215D39003954B9 /* MicroModel.m */,
|
||||
E874B88927215EAF003954B9 /* MicroQueueItemModel.h */,
|
||||
E874B88A27215EAF003954B9 /* MicroQueueItemModel.m */,
|
||||
);
|
||||
path = Model;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
E88B5CA926FB15B900DA9178 /* Teenager */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@@ -2020,6 +2076,10 @@
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
E874B88427215B0E003954B9 /* XPIMRoomMicQueueDelegate.h in Sources */,
|
||||
E874B88327215B06003954B9 /* XPIMRoomMicQueueInterface.h in Sources */,
|
||||
E874B87C27214888003954B9 /* XPIMRoomDelegate.h in Sources */,
|
||||
E874B87B27214882003954B9 /* XPIMRoomInterface.h in Sources */,
|
||||
E874B874272108ED003954B9 /* XPIMLoginInterface.h in Sources */,
|
||||
E874B873272108DB003954B9 /* XPIMLoginDelegate.h in Sources */,
|
||||
E8B846D826FDE17300A777FE /* XPMineRechargeProtocol.h in Sources */,
|
||||
@@ -2054,6 +2114,7 @@
|
||||
E8B825C726EA0D9A009E8E9F /* LoginVerifCodeProtocol.h in Sources */,
|
||||
E824544E26F5BC1A00BE8163 /* XPMineModifPayPwdView.m in Sources */,
|
||||
E8B825CA26EA1231009E8E9F /* LoginVerifCodeViewController.m in Sources */,
|
||||
E874B880272158E7003954B9 /* XPIMRoomMicQueueImpl.m in Sources */,
|
||||
189DD76226E60DDC00AB55B1 /* Api+Login.m in Sources */,
|
||||
18E7B22626E8CDCF0064BC9B /* XplanFlutterBoostDelegate.m in Sources */,
|
||||
E8EEB8F326FC2050007C6EBA /* SDWaitingView.m in Sources */,
|
||||
@@ -2129,6 +2190,7 @@
|
||||
E824545626F5E51900BE8163 /* XPMineVerifIdentityViewController.m in Sources */,
|
||||
186A534726FC6ED900D67B2C /* TTAlertConfig.m in Sources */,
|
||||
18E7B31E26F0984C0064BC9B /* UserLevelVo.m in Sources */,
|
||||
E874B88B27215EAF003954B9 /* MicroQueueItemModel.m in Sources */,
|
||||
E8EEB90626FC5772007C6EBA /* XPMineUserInfoEditViewController.m in Sources */,
|
||||
E8B846D626FDE01B00A777FE /* XPMineRechargePresenter.m in Sources */,
|
||||
E8EEB91426FC7786007C6EBA /* XPMineUserInfoNickViewController.m in Sources */,
|
||||
@@ -2162,6 +2224,7 @@
|
||||
E824545126F5CE6E00BE8163 /* XPMineModifPayPwdPresenter.m in Sources */,
|
||||
E8EEB90F26FC6AB8007C6EBA /* XPMineUserInfoEditPresenter.m in Sources */,
|
||||
E8AC723A26F49AAE007D6E91 /* XPMineNotifyStatus.m in Sources */,
|
||||
E874B8782721438E003954B9 /* XPImRoomImpl.m in Sources */,
|
||||
18E7B33226F317A20064BC9B /* XPWebViewController.m in Sources */,
|
||||
E8AEAEF927141CA30017FCE0 /* XPRoomInfoContainerView.m in Sources */,
|
||||
E8AC721C26F4720B007D6E91 /* XPMineSettingPresent.m in Sources */,
|
||||
@@ -2210,6 +2273,7 @@
|
||||
E8B846DC26FDE24300A777FE /* RechargeListModel.m in Sources */,
|
||||
189DD75926E6003C00AB55B1 /* Api.m in Sources */,
|
||||
E88B5CB826FB325200DA9178 /* XPMineTeenagerPwdPresenter.m in Sources */,
|
||||
E874B88827215D39003954B9 /* MicroModel.m in Sources */,
|
||||
E868071B271969A50024F48F /* XCRoomPostionNickView.m in Sources */,
|
||||
E89D60C1271D64B9001F8895 /* RoomInfoModel.m in Sources */,
|
||||
E89DA66727006443008483C1 /* RechargeStorage.m in Sources */,
|
||||
|
@@ -11,6 +11,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface NSObject (JSONString)
|
||||
- (NSString *)objectToJSONString;
|
||||
|
||||
- (id)JSONObject;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -13,4 +13,9 @@
|
||||
return [self mj_JSONString];
|
||||
}
|
||||
|
||||
///转成字典或者数组
|
||||
- (id)JSONObject {
|
||||
return [self mj_JSONObject];
|
||||
}
|
||||
|
||||
@end
|
||||
|
31
xplan-ios/Main/IM/MicroQueue/Model/MicroModel.h
Normal file
31
xplan-ios/Main/IM/MicroQueue/Model/MicroModel.h
Normal file
@@ -0,0 +1,31 @@
|
||||
//
|
||||
// MicroModel.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2021/10/21.
|
||||
//
|
||||
|
||||
#import "BaseObject.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
typedef NS_ENUM(NSInteger, MicroPosStateType) {
|
||||
MicroPosStateType_Free = 0,///空闲
|
||||
MicroPosStateType_Lock = 1,///上锁
|
||||
};
|
||||
|
||||
typedef NS_ENUM(NSInteger, MicroMicStateType) {
|
||||
MicroMicStateType_Open = 0,///开麦
|
||||
MicroMicStateType_Close = 1,///锁麦
|
||||
};
|
||||
|
||||
|
||||
@interface MicroModel : BaseObject
|
||||
///坑位的序号
|
||||
@property (nonatomic, assign) int position;
|
||||
///坑位状态 锁坑/开坑
|
||||
@property (nonatomic, assign) MicroPosStateType posState;
|
||||
///麦序的状态 闭麦/开麦
|
||||
@property (nonatomic, assign) MicroMicStateType micState;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
12
xplan-ios/Main/IM/MicroQueue/Model/MicroModel.m
Normal file
12
xplan-ios/Main/IM/MicroQueue/Model/MicroModel.m
Normal file
@@ -0,0 +1,12 @@
|
||||
//
|
||||
// MicroModel.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2021/10/21.
|
||||
//
|
||||
|
||||
#import "MicroModel.h"
|
||||
|
||||
@implementation MicroModel
|
||||
|
||||
@end
|
19
xplan-ios/Main/IM/MicroQueue/Model/MicroQueueItemModel.h
Normal file
19
xplan-ios/Main/IM/MicroQueue/Model/MicroQueueItemModel.h
Normal file
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// MicroQueueItemModel.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2021/10/21.
|
||||
//
|
||||
|
||||
#import "BaseObject.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
@class UserInfoModel, MicroModel;
|
||||
@interface MicroQueueItemModel : BaseObject
|
||||
///麦序的状态
|
||||
@property (nonatomic, strong) MicroModel *microState;
|
||||
///麦序上是否有人
|
||||
@property (nonatomic, strong, nullable) UserInfoModel *userInfo;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
12
xplan-ios/Main/IM/MicroQueue/Model/MicroQueueItemModel.m
Normal file
12
xplan-ios/Main/IM/MicroQueue/Model/MicroQueueItemModel.m
Normal file
@@ -0,0 +1,12 @@
|
||||
//
|
||||
// MicroQueueItemModel.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2021/10/21.
|
||||
//
|
||||
|
||||
#import "MicroQueueItemModel.h"
|
||||
|
||||
@implementation MicroQueueItemModel
|
||||
|
||||
@end
|
19
xplan-ios/Main/IM/MicroQueue/XPIMRoomMicQueueDelegate.h
Normal file
19
xplan-ios/Main/IM/MicroQueue/XPIMRoomMicQueueDelegate.h
Normal file
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// XPIMRoomMicQueueDelegate.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2021/10/21.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
@class MicroQueueItemModel;
|
||||
@protocol XPIMRoomMicQueueDelegate <NSObject>
|
||||
|
||||
///获取房间队列成功
|
||||
- (void)onGetRoomMicroQueueSuccess:(NSDictionary<NSString *, MicroQueueItemModel *>*)microQueue;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
16
xplan-ios/Main/IM/MicroQueue/XPIMRoomMicQueueImpl.h
Normal file
16
xplan-ios/Main/IM/MicroQueue/XPIMRoomMicQueueImpl.h
Normal file
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// XPIMRoomMicQueueImpl.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2021/10/21.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "XPIMRoomMicQueueInterface.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface XPIMRoomMicQueueImpl : NSObject <XPIMRoomMicQueueInterface>
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
113
xplan-ios/Main/IM/MicroQueue/XPIMRoomMicQueueImpl.m
Normal file
113
xplan-ios/Main/IM/MicroQueue/XPIMRoomMicQueueImpl.m
Normal file
@@ -0,0 +1,113 @@
|
||||
//
|
||||
// XPIMRoomMicQueueImpl.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2021/10/21.
|
||||
//
|
||||
|
||||
#import "XPIMRoomMicQueueImpl.h"
|
||||
///Third
|
||||
#import <NIMSDK/NIMSDK.h>
|
||||
///Tool
|
||||
#import "XPIMManager.h"
|
||||
///Model
|
||||
#import "MicroModel.h"
|
||||
#import "MicroQueueItemModel.h"
|
||||
#import "RoomInfoModel.h"
|
||||
#import "UserInfoModel.h"
|
||||
///P
|
||||
#import "XPIMRoomMicQueueDelegate.h"
|
||||
|
||||
#define MIC_COUNT(Type) [self roomTypecpORnormal:Type]
|
||||
|
||||
@interface XPIMRoomMicQueueImpl ()
|
||||
///代理
|
||||
@property (nonatomic,strong) id<XPIMRoomMicQueueDelegate> delegate;
|
||||
///麦序的状态 <麦序 麦序上的内容>
|
||||
@property (nonatomic,strong) NSMutableDictionary<NSString *, MicroQueueItemModel *> *micQueue;
|
||||
@end
|
||||
|
||||
@implementation XPIMRoomMicQueueImpl
|
||||
|
||||
// 给宏定义赋值
|
||||
-(NSInteger )roomTypecpORnormal:(RoomType )type{
|
||||
if (type == RoomType_Game){
|
||||
return 9;
|
||||
}else{
|
||||
return 9;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)configDefaultMicQueue {
|
||||
RoomInfoModel * roomfInfo = [XPIMManager shareManager].chatRoomManager.getCurrentRoomInfo;
|
||||
for (int i = 0 ; i < MIC_COUNT(roomfInfo.type); i++) {
|
||||
MicroModel *state = [[MicroModel alloc]init];
|
||||
state.posState = MicroPosStateType_Free;
|
||||
state.micState = MicroMicStateType_Open;
|
||||
MicroQueueItemModel *micSequence = [[MicroQueueItemModel alloc]init];
|
||||
micSequence.microState = state;
|
||||
micSequence.userInfo = nil;
|
||||
[self.micQueue setObject:micSequence forKey:[NSString stringWithFormat:@"%d",i-1]];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - XPIMRoomMicQueueInterface
|
||||
///进入房间成功之后根据扩展字段整理麦序
|
||||
- (void)enterRoomRepairMicQueue:(NSDictionary *)micDictionary {
|
||||
[self configDefaultMicQueue];
|
||||
for (NSString *position in micDictionary.allKeys) {
|
||||
MicroModel *state = [MicroModel modelWithJSON:micDictionary[position]];
|
||||
MicroQueueItemModel *sequence = [self.micQueue objectForKey:position];
|
||||
sequence.microState = state;
|
||||
}
|
||||
|
||||
}
|
||||
///获取房间队列
|
||||
- (void)fetchRoomQueue:(NSString *)roomid {
|
||||
[[NIMSDK sharedSDK].chatroomManager fetchChatroomQueue:roomid completion:^(NSError * _Nullable error, NSArray<NSDictionary<NSString *,NSString *> *> * _Nullable info) {
|
||||
if (error == nil && info!= nil) {
|
||||
for (NSDictionary *item in info) {
|
||||
UserInfoModel *userInfo = [UserInfoModel modelWithJSON:item.allValues.firstObject];
|
||||
NSString *position = item.allKeys.firstObject;
|
||||
MicroQueueItemModel *sequence = [self.micQueue objectForKey:position];
|
||||
sequence.userInfo = userInfo;
|
||||
}
|
||||
if ([self.delegate respondsToSelector:@selector(onGetRoomMicroQueueSuccess:)]) {
|
||||
[self.delegate onGetRoomMicroQueueSuccess:self.micQueue];
|
||||
}
|
||||
} else {
|
||||
NSLog(@"获取队列失败");
|
||||
}
|
||||
}];
|
||||
}
|
||||
///麦序的队列
|
||||
- (NSDictionary *)microQueue {
|
||||
return [self.microQueue copy];
|
||||
}
|
||||
|
||||
- (void)upMic:(NSString *)position {
|
||||
|
||||
}
|
||||
|
||||
- (void)downMic:(NSString *)position {
|
||||
|
||||
}
|
||||
|
||||
///添加代理
|
||||
- (void)addDelegate:(id<XPIMRoomMicQueueDelegate>)delegate {
|
||||
self.delegate = delegate;
|
||||
}
|
||||
///移除代理
|
||||
- (void)removeDelegate:(id<XPIMRoomMicQueueDelegate>)delegate {
|
||||
self.delegate = nil;
|
||||
}
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
- (NSMutableDictionary<NSString *,MicroQueueItemModel *> *)micQueue {
|
||||
if (!_micQueue) {
|
||||
_micQueue= [NSMutableDictionary dictionary];
|
||||
}
|
||||
return _micQueue;
|
||||
}
|
||||
|
||||
@end
|
33
xplan-ios/Main/IM/MicroQueue/XPIMRoomMicQueueInterface.h
Normal file
33
xplan-ios/Main/IM/MicroQueue/XPIMRoomMicQueueInterface.h
Normal file
@@ -0,0 +1,33 @@
|
||||
//
|
||||
// XPIMRoomMicQueueInterface.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2021/10/21.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "XPIMRoomMicQueueDelegate.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@protocol XPIMRoomMicQueueInterface <NSObject>
|
||||
|
||||
///进入房间成功之后根据扩展字段整理麦序
|
||||
- (void)enterRoomRepairMicQueue:(NSDictionary *)micDictory;
|
||||
///获取房间队列
|
||||
- (void)fetchRoomQueue:(NSString *)roomid;
|
||||
///麦序的队列
|
||||
- (NSDictionary *)microQueue;
|
||||
|
||||
///上麦
|
||||
- (void)upMic:(NSString *)position;
|
||||
///下麦
|
||||
- (void)downMic:(NSString *)position;
|
||||
|
||||
///添加代理
|
||||
- (void)addDelegate:(id<XPIMRoomMicQueueDelegate>)delegate;
|
||||
///移除代理
|
||||
- (void)removeDelegate:(id<XPIMRoomMicQueueDelegate>)delegate;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
16
xplan-ios/Main/IM/Room/XPIMRoomDelegate.h
Normal file
16
xplan-ios/Main/IM/Room/XPIMRoomDelegate.h
Normal file
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// XPIMRoomDelegate.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2021/10/21.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@protocol XPIMRoomDelegate <NSObject>
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
28
xplan-ios/Main/IM/Room/XPIMRoomInterface.h
Normal file
28
xplan-ios/Main/IM/Room/XPIMRoomInterface.h
Normal file
@@ -0,0 +1,28 @@
|
||||
//
|
||||
// XPIMRoomInterface.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2021/10/21.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "XPIMRoomDelegate.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
@class UserInfoModel, RoomInfoModel;
|
||||
@protocol XPIMRoomInterface <NSObject>
|
||||
/// 进入房间
|
||||
/// @param roomId 进入房间的uid
|
||||
/// @param userInfo 进入房间的用户的信息
|
||||
- (void)enterRoomWithRoomId:(NSString *)roomId userInfo:(UserInfoModel * __nullable)userInfo;
|
||||
///获取当前房间的用户信息
|
||||
- (RoomInfoModel *)getCurrentRoomInfo;
|
||||
///设置房间信息
|
||||
- (void)setCurrentRoomInfo:(RoomInfoModel *)roomInfo;
|
||||
///添加代理
|
||||
- (void)addDelegate:(id<XPIMRoomDelegate>)delegate;
|
||||
///移除代理
|
||||
- (void)removeDelegate:(id<XPIMRoomDelegate>)delegate;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
16
xplan-ios/Main/IM/Room/XPImRoomImpl.h
Normal file
16
xplan-ios/Main/IM/Room/XPImRoomImpl.h
Normal file
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// XPImRoomImpl.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2021/10/21.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "XPIMRoomInterface.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface XPImRoomImpl : NSObject<XPIMRoomInterface>
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
77
xplan-ios/Main/IM/Room/XPImRoomImpl.m
Normal file
77
xplan-ios/Main/IM/Room/XPImRoomImpl.m
Normal file
@@ -0,0 +1,77 @@
|
||||
//
|
||||
// XPImRoomImpl.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2021/10/21.
|
||||
//
|
||||
|
||||
#import "XPImRoomImpl.h"
|
||||
///Third
|
||||
#import <NIMSDK/NIMSDK.h>
|
||||
///Tool
|
||||
#import "NSObject+JSONString.h"
|
||||
#import "XPIMManager.h"
|
||||
///Model
|
||||
#import "UserInfoModel.h"
|
||||
///P
|
||||
#import "XPIMRoomDelegate.h"
|
||||
|
||||
|
||||
@interface XPImRoomImpl ()
|
||||
///
|
||||
@property (nonatomic,strong) id<XPIMRoomDelegate> delegate;
|
||||
|
||||
///房间信息
|
||||
@property (nonatomic,strong) RoomInfoModel *roomInfo;
|
||||
@end
|
||||
|
||||
|
||||
@implementation XPImRoomImpl
|
||||
|
||||
|
||||
|
||||
#pragma mark - XPIMRoomInterface
|
||||
- (void)enterRoomWithRoomId:(NSString *)roomId userInfo:(UserInfoModel *)userInfo {
|
||||
|
||||
NIMChatroomEnterRequest *request = [[NIMChatroomEnterRequest alloc] init];
|
||||
request.roomId = roomId;
|
||||
//设置ext
|
||||
NSMutableDictionary *extSource = [NSMutableDictionary dictionary];
|
||||
//defUser
|
||||
if (userInfo) {
|
||||
[extSource setObject:@(userInfo.defUser) forKey:@"defUser"];
|
||||
[extSource setObject:@(userInfo.erbanNo) forKey:@"erbanNo"];
|
||||
}
|
||||
NSMutableDictionary *ext = [NSMutableDictionary dictionaryWithObject:extSource forKey:[NSString stringWithFormat:@"%ld", userInfo.uid]];
|
||||
request.roomExt = [ext objectToJSONString];
|
||||
|
||||
[[NIMSDK sharedSDK].chatroomManager enterChatroom:request completion:^(NSError * _Nullable error, NIMChatroom * _Nullable chatroom, NIMChatroomMember * _Nullable me) {
|
||||
NSDictionary *info = (NSDictionary *)[chatroom.ext JSONObject];
|
||||
NSDictionary *micDictionary = [info[@"micQueue"] JSONObject];
|
||||
///初始化房间队列
|
||||
[[XPIMManager shareManager].microQueueManager enterRoomRepairMicQueue:micDictionary];
|
||||
[[XPIMManager shareManager].microQueueManager fetchRoomQueue:roomId];
|
||||
|
||||
}];
|
||||
}
|
||||
|
||||
- (RoomInfoModel *)getCurrentRoomInfo {
|
||||
return _roomInfo;
|
||||
}
|
||||
|
||||
|
||||
- (void)setCurrentRoomInfo:(RoomInfoModel *)roomInfo {
|
||||
self.roomInfo = roomInfo;
|
||||
}
|
||||
|
||||
- (void)addDelegate:(id<XPIMRoomDelegate>)delegate {
|
||||
self.delegate = delegate;
|
||||
}
|
||||
|
||||
- (void)removeDelegate:(id<XPIMRoomDelegate>)delegate {
|
||||
self.delegate = nil;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@end
|
@@ -7,13 +7,18 @@
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "XPIMLoginInterface.h"
|
||||
#import "XPIMRoomInterface.h"
|
||||
#import "XPIMRoomMicQueueInterface.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface XPIMManager : NSObject
|
||||
+ (instancetype)shareManager;
|
||||
///im登录的协议
|
||||
@property (nonatomic,strong, readonly) id<XPIMLoginInterface> imLoginManager;
|
||||
|
||||
///聊天室的管理类
|
||||
@property (nonatomic,strong, readonly) id<XPIMRoomInterface> chatRoomManager;
|
||||
///麦序的管理类
|
||||
@property (nonatomic,strong, readonly) id<XPIMRoomMicQueueInterface> microQueueManager;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -7,9 +7,15 @@
|
||||
|
||||
#import "XPIMManager.h"
|
||||
#import "XPIMLoginImpl.h"
|
||||
#import "XPImRoomImpl.h"
|
||||
#import "XPIMRoomMicQueueImpl.h"
|
||||
@interface XPIMManager ()
|
||||
///
|
||||
@property (nonatomic,strong) id<XPIMLoginInterface> imLoginManager;
|
||||
///聊天室的管理类
|
||||
@property (nonatomic,strong) id<XPIMRoomInterface> chatRoomManager;
|
||||
///麦序的管理类
|
||||
@property (nonatomic,strong) id<XPIMRoomMicQueueInterface> microQueueManager;
|
||||
@end
|
||||
|
||||
@implementation XPIMManager
|
||||
@@ -31,4 +37,19 @@
|
||||
return _imLoginManager;
|
||||
}
|
||||
|
||||
- (id<XPIMRoomInterface>)chatRoomManager {
|
||||
if (!_chatRoomManager) {
|
||||
_chatRoomManager = [[XPImRoomImpl alloc] init];
|
||||
}
|
||||
return _chatRoomManager;
|
||||
}
|
||||
|
||||
|
||||
- (id<XPIMRoomMicQueueInterface>)microQueueManager {
|
||||
if (!_microQueueManager) {
|
||||
_microQueueManager = [[XPIMRoomMicQueueImpl alloc] init];
|
||||
}
|
||||
return _microQueueManager;
|
||||
}
|
||||
|
||||
@end
|
||||
|
@@ -132,7 +132,7 @@
|
||||
{
|
||||
#warning to do 测试
|
||||
XPRoomViewController * roomVC = [[XPRoomViewController alloc] init];
|
||||
roomVC.roomUid = [NSString stringWithFormat:@"%ld", self.userInfo.uid];
|
||||
roomVC.roomUid = [NSString stringWithFormat:@"%ld",1004567];
|
||||
BaseNavigationController * nav = [[BaseNavigationController alloc] initWithRootViewController:roomVC];
|
||||
nav.modalPresentationStyle = UIModalPresentationFullScreen;
|
||||
[self presentViewController:nav animated:YES completion:nil];
|
||||
|
@@ -35,7 +35,7 @@
|
||||
backPic:(NSString *)backPic
|
||||
uid:(NSString *)uid
|
||||
ticket:(NSString *)ticket {
|
||||
[Api makeRequest:@"room/open" method:HttpRequestHelperMethodPOST completion:complection, __FUNCTION__, title, type, roomPwd, roomDesc, backPic, uid, ticket,nil];
|
||||
[Api makeRequest:@"room/open" method:HttpRequestHelperMethodPOST completion:complection, __FUNCTION__, title, @(type), roomPwd, roomDesc, backPic, uid, ticket,nil];
|
||||
}
|
||||
|
||||
|
||||
|
@@ -8,6 +8,7 @@
|
||||
#import "XPRoomViewController+SDKConfig.h"
|
||||
///Model
|
||||
#import "RoomInfoModel.h"
|
||||
#import "XPIMManager.h"
|
||||
|
||||
@implementation XPRoomViewController (SDKConfig)
|
||||
|
||||
@@ -15,6 +16,12 @@
|
||||
[RtcManager initEngineWithType:RtcEngineType_Agora delegate:self];
|
||||
[[RtcManager instance] enterRoom:[NSString stringWithFormat:@"%ld", (long)self.roomInfo.uid]];
|
||||
[[RtcManager instance] broadcast:YES];
|
||||
[self enterChatRoom];
|
||||
}
|
||||
|
||||
|
||||
- (void)enterChatRoom {
|
||||
[[XPIMManager shareManager].chatRoomManager enterRoomWithRoomId:[NSString stringWithFormat:@"%ld", self.roomInfo.roomId] userInfo:self.usereInfo];
|
||||
}
|
||||
|
||||
#pragma mark - RtcDelegate
|
||||
|
@@ -8,7 +8,7 @@
|
||||
#import "MvpViewController.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
@class XPRoomBackContainerView,XPRoomInfoContainerView,XPRoomMessageContainerView,XPRoomMenuContainerView,XPRoomActivityContainerView, XPRoomPositionContainView, RoomInfoModel;
|
||||
@class XPRoomBackContainerView,XPRoomInfoContainerView,XPRoomMessageContainerView,XPRoomMenuContainerView,XPRoomActivityContainerView, XPRoomPositionContainView, RoomInfoModel, UserInfoModel;
|
||||
@interface XPRoomViewController : MvpViewController
|
||||
|
||||
///房间的Uid
|
||||
@@ -28,7 +28,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@property (nonatomic,strong, readonly) XPRoomActivityContainerView *activityContainerView;
|
||||
///房间信息
|
||||
@property (nonatomic,strong, readonly) RoomInfoModel *roomInfo;
|
||||
|
||||
///用户信息
|
||||
@property (nonatomic,strong, readonly) UserInfoModel *usereInfo;
|
||||
|
||||
///dismissVC
|
||||
- (void)disMissRoomVC;
|
||||
|
@@ -153,7 +153,7 @@
|
||||
- (void)getRoomInfoSuccess:(RoomInfoModel *)roomInfo {
|
||||
NSString * uid = [AccountInfoStorage instance].getUid;
|
||||
if ([self.roomUid isEqualToString:uid]) {///如果是自己进入房间的话
|
||||
if (roomInfo == nil || roomInfo.valid) {
|
||||
if (roomInfo == nil || !roomInfo.valid) {
|
||||
self.isOpenRoom = YES;
|
||||
if (self.usereInfo) {
|
||||
[self openRoomWithUserInfo];
|
||||
|
Reference in New Issue
Block a user