修改部分方法名
This commit is contained in:
@@ -190,7 +190,6 @@
|
|||||||
8C9C84902B0D439800A601BC /* YMRoomMessageFilter.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C9C848F2B0D439800A601BC /* YMRoomMessageFilter.m */; };
|
8C9C84902B0D439800A601BC /* YMRoomMessageFilter.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C9C848F2B0D439800A601BC /* YMRoomMessageFilter.m */; };
|
||||||
8C9C84942B0D65C300A601BC /* YMRoomAnimationHitView.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C9C84932B0D65C300A601BC /* YMRoomAnimationHitView.m */; };
|
8C9C84942B0D65C300A601BC /* YMRoomAnimationHitView.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C9C84932B0D65C300A601BC /* YMRoomAnimationHitView.m */; };
|
||||||
8C9C84972B0D65E200A601BC /* YMRoomAnimationView.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C9C84962B0D65E200A601BC /* YMRoomAnimationView.m */; };
|
8C9C84972B0D65E200A601BC /* YMRoomAnimationView.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C9C84962B0D65E200A601BC /* YMRoomAnimationView.m */; };
|
||||||
8C9C849A2B0D675600A601BC /* YMRoomGiftAnimationParser.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C9C84992B0D675600A601BC /* YMRoomGiftAnimationParser.m */; };
|
|
||||||
8C9C849E2B0D6A5C00A601BC /* YMGiftStorage.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C9C849D2B0D6A5C00A601BC /* YMGiftStorage.m */; };
|
8C9C849E2B0D6A5C00A601BC /* YMGiftStorage.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C9C849D2B0D6A5C00A601BC /* YMGiftStorage.m */; };
|
||||||
8C9C84AD2B0D9AB900A601BC /* CHRoomMessageHeaderView.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C9C84AC2B0D9AB900A601BC /* CHRoomMessageHeaderView.m */; };
|
8C9C84AD2B0D9AB900A601BC /* CHRoomMessageHeaderView.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C9C84AC2B0D9AB900A601BC /* CHRoomMessageHeaderView.m */; };
|
||||||
8C9C84B12B0DEAE100A601BC /* YMIButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C9C84B02B0DEAE100A601BC /* YMIButton.m */; };
|
8C9C84B12B0DEAE100A601BC /* YMIButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C9C84B02B0DEAE100A601BC /* YMIButton.m */; };
|
||||||
@@ -592,8 +591,6 @@
|
|||||||
8C9C84932B0D65C300A601BC /* YMRoomAnimationHitView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = YMRoomAnimationHitView.m; sourceTree = "<group>"; };
|
8C9C84932B0D65C300A601BC /* YMRoomAnimationHitView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = YMRoomAnimationHitView.m; sourceTree = "<group>"; };
|
||||||
8C9C84952B0D65E200A601BC /* YMRoomAnimationView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = YMRoomAnimationView.h; sourceTree = "<group>"; };
|
8C9C84952B0D65E200A601BC /* YMRoomAnimationView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = YMRoomAnimationView.h; sourceTree = "<group>"; };
|
||||||
8C9C84962B0D65E200A601BC /* YMRoomAnimationView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = YMRoomAnimationView.m; sourceTree = "<group>"; };
|
8C9C84962B0D65E200A601BC /* YMRoomAnimationView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = YMRoomAnimationView.m; sourceTree = "<group>"; };
|
||||||
8C9C84982B0D675600A601BC /* YMRoomGiftAnimationParser.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = YMRoomGiftAnimationParser.h; sourceTree = "<group>"; };
|
|
||||||
8C9C84992B0D675600A601BC /* YMRoomGiftAnimationParser.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = YMRoomGiftAnimationParser.m; sourceTree = "<group>"; };
|
|
||||||
8C9C849C2B0D6A5C00A601BC /* YMGiftStorage.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = YMGiftStorage.h; sourceTree = "<group>"; };
|
8C9C849C2B0D6A5C00A601BC /* YMGiftStorage.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = YMGiftStorage.h; sourceTree = "<group>"; };
|
||||||
8C9C849D2B0D6A5C00A601BC /* YMGiftStorage.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = YMGiftStorage.m; sourceTree = "<group>"; };
|
8C9C849D2B0D6A5C00A601BC /* YMGiftStorage.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = YMGiftStorage.m; sourceTree = "<group>"; };
|
||||||
8C9C849F2B0D6BCF00A601BC /* CHRoomAnimationProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CHRoomAnimationProtocol.h; sourceTree = "<group>"; };
|
8C9C849F2B0D6BCF00A601BC /* CHRoomAnimationProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CHRoomAnimationProtocol.h; sourceTree = "<group>"; };
|
||||||
@@ -2152,8 +2149,6 @@
|
|||||||
8C9C84932B0D65C300A601BC /* YMRoomAnimationHitView.m */,
|
8C9C84932B0D65C300A601BC /* YMRoomAnimationHitView.m */,
|
||||||
8C9C84952B0D65E200A601BC /* YMRoomAnimationView.h */,
|
8C9C84952B0D65E200A601BC /* YMRoomAnimationView.h */,
|
||||||
8C9C84962B0D65E200A601BC /* YMRoomAnimationView.m */,
|
8C9C84962B0D65E200A601BC /* YMRoomAnimationView.m */,
|
||||||
8C9C84982B0D675600A601BC /* YMRoomGiftAnimationParser.h */,
|
|
||||||
8C9C84992B0D675600A601BC /* YMRoomGiftAnimationParser.m */,
|
|
||||||
8CAB96F32B1AB15200ED8639 /* CHRoomAnimationGroup.h */,
|
8CAB96F32B1AB15200ED8639 /* CHRoomAnimationGroup.h */,
|
||||||
8CAB96F42B1AB15200ED8639 /* CHRoomAnimationGroup.m */,
|
8CAB96F42B1AB15200ED8639 /* CHRoomAnimationGroup.m */,
|
||||||
);
|
);
|
||||||
@@ -2457,7 +2452,6 @@
|
|||||||
8C9C845A2B0C697A00A601BC /* ClientDataModel.m in Sources */,
|
8C9C845A2B0C697A00A601BC /* ClientDataModel.m in Sources */,
|
||||||
8C9C84972B0D65E200A601BC /* YMRoomAnimationView.m in Sources */,
|
8C9C84972B0D65E200A601BC /* YMRoomAnimationView.m in Sources */,
|
||||||
8C9C82D52B0C695600A601BC /* YMHUDTool.m in Sources */,
|
8C9C82D52B0C695600A601BC /* YMHUDTool.m in Sources */,
|
||||||
8C9C849A2B0D675600A601BC /* YMRoomGiftAnimationParser.m in Sources */,
|
|
||||||
8C9C82202B0C694900A601BC /* AppDelegate+ThirdConfig.m in Sources */,
|
8C9C82202B0C694900A601BC /* AppDelegate+ThirdConfig.m in Sources */,
|
||||||
8C9C84202B0C697A00A601BC /* MicroView.m in Sources */,
|
8C9C84202B0C697A00A601BC /* MicroView.m in Sources */,
|
||||||
8C9C84522B0C697A00A601BC /* ThirdUserInfo.m in Sources */,
|
8C9C84522B0C697A00A601BC /* ThirdUserInfo.m in Sources */,
|
||||||
|
@@ -83,7 +83,7 @@
|
|||||||
self.emojiArrays = @[@"mew_room_emoji_deyi",@"mew_room_emoji_happy",@"mew_room_emoji_sex",@"mew_room_emoji_suprise"];
|
self.emojiArrays = @[@"mew_room_emoji_deyi",@"mew_room_emoji_happy",@"mew_room_emoji_sex",@"mew_room_emoji_suprise"];
|
||||||
self.playEmojiArrays = [NSMutableArray array];
|
self.playEmojiArrays = [NSMutableArray array];
|
||||||
self.isPlayEmojiAnimation = NO;
|
self.isPlayEmojiAnimation = NO;
|
||||||
[self.presenter initEnterRoom:self.roomUid user:[AccountInfoStorage instance].getUid];
|
[self.presenter initEnterCurrentRoom:self.roomUid user:[AccountInfoStorage instance].getUid];
|
||||||
|
|
||||||
//监听云信消息
|
//监听云信消息
|
||||||
[[NIMSDK sharedSDK].chatroomManager addDelegate:self];
|
[[NIMSDK sharedSDK].chatroomManager addDelegate:self];
|
||||||
@@ -132,7 +132,7 @@
|
|||||||
{
|
{
|
||||||
NSMutableDictionary *lastRoomInfoDic = [NSMutableDictionary dictionaryWithDictionary:[self.roomInfo model2dictionary]];
|
NSMutableDictionary *lastRoomInfoDic = [NSMutableDictionary dictionaryWithDictionary:[self.roomInfo model2dictionary]];
|
||||||
[lastRoomInfoDic addEntriesFromDictionary: ((NSString *)data[@"roomInfo"]).toJSONObject];
|
[lastRoomInfoDic addEntriesFromDictionary: ((NSString *)data[@"roomInfo"]).toJSONObject];
|
||||||
[self.roomStageView onRoomUpdate];
|
[self.roomStageView onRoomInfoUpdate];
|
||||||
// [self.roomMessageView onRoomUpdate];
|
// [self.roomMessageView onRoomUpdate];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -238,9 +238,9 @@
|
|||||||
/// 退出房间
|
/// 退出房间
|
||||||
- (void)exitCurrentRoom {
|
- (void)exitCurrentRoom {
|
||||||
//其他模式下
|
//其他模式下
|
||||||
[self.roomAnimationView resumeTimer];
|
[self.roomAnimationView resumeAnimationTimer];
|
||||||
// 默认模式下
|
// 默认模式下
|
||||||
[self.presenter exitNIMRoom:[NSString stringWithFormat:@"%ld", self.roomInfo.roomId]];
|
[self.presenter exitNIMCurrentRoom:[NSString stringWithFormat:@"%ld", self.roomInfo.roomId]];
|
||||||
[[RtcManager instance] exitRoom];
|
[[RtcManager instance] exitRoom];
|
||||||
[self.presenter reportUserOutRoom:[NSString stringWithFormat:@"%ld",self.roomInfo.uid]];
|
[self.presenter reportUserOutRoom:[NSString stringWithFormat:@"%ld",self.roomInfo.uid]];
|
||||||
[self dismissViewControllerAnimated:YES completion:nil];
|
[self dismissViewControllerAnimated:YES completion:nil];
|
||||||
@@ -266,42 +266,42 @@
|
|||||||
}
|
}
|
||||||
#pragma mark - YMRoomProtocol
|
#pragma mark - YMRoomProtocol
|
||||||
/// 进入房间成功
|
/// 进入房间成功
|
||||||
- (void)initEnterRoomSuccess:(RoomInfoModel *)roomInfo user:(UserInfoModel *)userInfo {
|
- (void)initEnterCurrentRoomSuccess:(RoomInfoModel *)roomInfo user:(UserInfoModel *)userInfo {
|
||||||
[YMHUDTool hideHUDInView:self.navigationController.view];
|
[YMHUDTool hideHUDInView:self.navigationController.view];
|
||||||
self.userInfo = userInfo;
|
self.userInfo = userInfo;
|
||||||
self.roomInfo = roomInfo;
|
self.roomInfo = roomInfo;
|
||||||
if (roomInfo.valid) {
|
if (roomInfo.valid) {
|
||||||
[self.roomHeaderView onRoomEntered];
|
[self.roomHeaderView onRoomEntered];
|
||||||
[self.presenter enterNIMRoom:[NSString stringWithFormat:@"%ld",self.roomInfo.roomId] user:self.userInfo];
|
[self.presenter enterNIMCurrentRoom:[NSString stringWithFormat:@"%ld",self.roomInfo.roomId] user:self.userInfo];
|
||||||
} else {
|
} else {
|
||||||
if ([self.roomUid isEqualToString:[NSString stringWithFormat:@"%ld", userInfo.uid]]) {
|
if ([self.roomUid isEqualToString:[NSString stringWithFormat:@"%ld", userInfo.uid]]) {
|
||||||
//用户进入自己的房间
|
//用户进入自己的房间
|
||||||
if (roomInfo.roomId > 0) {
|
if (roomInfo.roomId > 0) {
|
||||||
[self.presenter openRoom:roomInfo.title type:roomInfo.type roomPwd:@"" roomDesc:roomInfo.roomDesc backPic:@"" mgId:@""];
|
[self.presenter openUserRoom:roomInfo.title type:roomInfo.type roomPwd:@"" roomDesc:roomInfo.roomDesc backPic:@"" mgId:@""];
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
NSString *title = [NSString stringWithFormat:@"%@的房间",userInfo.nick];
|
NSString *title = [NSString stringWithFormat:@"%@的房间",userInfo.nick];
|
||||||
RoomType type = RoomType_Game;
|
RoomType type = RoomType_Game;
|
||||||
|
|
||||||
[self.presenter openRoom:title type:type roomPwd:@"" roomDesc:@"" backPic:@"" mgId:@""];
|
[self.presenter openUserRoom:title type:type roomPwd:@"" roomDesc:@"" backPic:@"" mgId:@""];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
[self showSuccessToast:@"房主已下线"];
|
[self showSuccessToast:@"房主已下线"];
|
||||||
[self enterRoomFail:-1];
|
[self enterCurrentRoomFail:-1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 开房成功
|
// 开房成功
|
||||||
- (void)openRoomSuccess:(RoomInfoModel *)roomInfo {
|
- (void)openCurrentRoomSuccess:(RoomInfoModel *)roomInfo {
|
||||||
self.roomInfo = roomInfo;
|
self.roomInfo = roomInfo;
|
||||||
[self.roomHeaderView onRoomEntered];
|
[self.roomHeaderView onRoomEntered];
|
||||||
[self.presenter enterNIMRoom:[NSString stringWithFormat:@"%ld", self.roomInfo.roomId] user:self.userInfo];
|
[self.presenter enterNIMCurrentRoom:[NSString stringWithFormat:@"%ld", self.roomInfo.roomId] user:self.userInfo];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// IM进房成功
|
// IM进房成功
|
||||||
- (void)enterRoomSuccess:(NIMChatroom *)chatRoom {
|
- (void)enterCurrentRoomSuccess:(NIMChatroom *)chatRoom {
|
||||||
[YMHUDTool hideHUDInView:self.navigationController.view];
|
[YMHUDTool hideHUDInView:self.navigationController.view];
|
||||||
[self.roomStageView onRoomEntered];
|
[self.roomStageView onRoomEntered];
|
||||||
if (self.roomInfo != nil) {
|
if (self.roomInfo != nil) {
|
||||||
@@ -313,7 +313,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 进房失败
|
// 进房失败
|
||||||
- (void)enterRoomFail:(NSInteger)code {
|
- (void)enterCurrentRoomFail:(NSInteger)code {
|
||||||
[YMHUDTool hideHUDInView:self.navigationController.view];
|
[YMHUDTool hideHUDInView:self.navigationController.view];
|
||||||
[self hideHUD];
|
[self hideHUD];
|
||||||
if (code == 13003) {
|
if (code == 13003) {
|
||||||
|
@@ -17,17 +17,17 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
/// - Parameters:
|
/// - Parameters:
|
||||||
/// - roomUid: 房间Uid
|
/// - roomUid: 房间Uid
|
||||||
/// - uid: 用户Uid
|
/// - uid: 用户Uid
|
||||||
- (void)initEnterRoom:(NSString *)roomUid user:(NSString *)uid;
|
- (void)initEnterCurrentRoom:(NSString *)roomUid user:(NSString *)uid;
|
||||||
|
|
||||||
/// 云信进房
|
/// 云信进房
|
||||||
/// - Parameters:
|
/// - Parameters:
|
||||||
/// - roomUid: 房间Uid
|
/// - roomUid: 房间Uid
|
||||||
/// - userInfo: 用户Uid
|
/// - userInfo: 用户Uid
|
||||||
- (void)enterNIMRoom:(NSString *)roomUid user:(UserInfoModel *)userInfo;
|
- (void)enterNIMCurrentRoom:(NSString *)roomUid user:(UserInfoModel *)userInfo;
|
||||||
|
|
||||||
/// 云信退房
|
/// 云信退房
|
||||||
/// - Parameter roomUid: 房间Uid
|
/// - Parameter roomUid: 房间Uid
|
||||||
- (void)exitNIMRoom:(NSString *)roomUid;
|
- (void)exitNIMCurrentRoom:(NSString *)roomUid;
|
||||||
|
|
||||||
/// 开启用户自己的房间
|
/// 开启用户自己的房间
|
||||||
/// @param title 房间标题
|
/// @param title 房间标题
|
||||||
@@ -36,7 +36,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
/// @param roomDesc 房间介绍
|
/// @param roomDesc 房间介绍
|
||||||
/// @param backPic 房间背景
|
/// @param backPic 房间背景
|
||||||
/// @param mgId 小游戏的id
|
/// @param mgId 小游戏的id
|
||||||
- (void)openRoom:(NSString *)title
|
- (void)openUserRoom:(NSString *)title
|
||||||
type:(RoomType)type
|
type:(RoomType)type
|
||||||
roomPwd:(NSString *)roomPwd
|
roomPwd:(NSString *)roomPwd
|
||||||
roomDesc:(NSString *)roomDesc
|
roomDesc:(NSString *)roomDesc
|
||||||
|
@@ -24,16 +24,16 @@
|
|||||||
@implementation YMRoomPresenter
|
@implementation YMRoomPresenter
|
||||||
|
|
||||||
#pragma mark - Public Method
|
#pragma mark - Public Method
|
||||||
- (void)initEnterRoom:(NSString *)roomUid user:(NSString *)uid {
|
- (void)initEnterCurrentRoom:(NSString *)roomUid user:(NSString *)uid {
|
||||||
RACSubject *room = [RACSubject subject];
|
RACSubject *room = [RACSubject subject];
|
||||||
RACSubject *user = [RACSubject subject];
|
RACSubject *user = [RACSubject subject];
|
||||||
|
|
||||||
/// RAC监听用户和房间值的改变
|
/// RAC监听用户和房间值的改变
|
||||||
[[RACSignal combineLatest:@[room, user] reduce:^id(RoomInfoModel *room, UserInfoModel *user){
|
[[RACSignal combineLatest:@[room, user] reduce:^id(RoomInfoModel *room, UserInfoModel *user){
|
||||||
[[self getView] initEnterRoomSuccess:room user:user];
|
[[self getView] initEnterCurrentRoomSuccess:room user:user];
|
||||||
return nil;
|
return nil;
|
||||||
}] subscribeError:^(NSError * _Nullable error) {
|
}] subscribeError:^(NSError * _Nullable error) {
|
||||||
[[self getView] enterRoomFail:error.code];
|
[[self getView] enterCurrentRoomFail:error.code];
|
||||||
}];
|
}];
|
||||||
|
|
||||||
|
|
||||||
@@ -57,7 +57,7 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
/// 云信进房
|
/// 云信进房
|
||||||
- (void)enterNIMRoom:(NSString *)roomUid user:(UserInfoModel *)userInfo {
|
- (void)enterNIMCurrentRoom:(NSString *)roomUid user:(UserInfoModel *)userInfo {
|
||||||
NIMChatroomEnterRequest *request = [[NIMChatroomEnterRequest alloc] init];
|
NIMChatroomEnterRequest *request = [[NIMChatroomEnterRequest alloc] init];
|
||||||
request.roomId = roomUid;
|
request.roomId = roomUid;
|
||||||
YMMessageRemoteExtModel *extModel = [[YMMessageRemoteExtModel alloc] init];
|
YMMessageRemoteExtModel *extModel = [[YMMessageRemoteExtModel alloc] init];
|
||||||
@@ -69,15 +69,15 @@
|
|||||||
/// 云信进房
|
/// 云信进房
|
||||||
[[NIMSDK sharedSDK].chatroomManager enterChatroom:request completion:^(NSError * _Nullable error, NIMChatroom * _Nullable chatroom, NIMChatroomMember * _Nullable me) {
|
[[NIMSDK sharedSDK].chatroomManager enterChatroom:request completion:^(NSError * _Nullable error, NIMChatroom * _Nullable chatroom, NIMChatroomMember * _Nullable me) {
|
||||||
if (error) {
|
if (error) {
|
||||||
[[self getView] enterRoomFail:error.code];
|
[[self getView] enterCurrentRoomFail:error.code];
|
||||||
} else {
|
} else {
|
||||||
[[self getView] enterRoomSuccess:chatroom];
|
[[self getView] enterCurrentRoomSuccess:chatroom];
|
||||||
}
|
}
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 云信退房
|
/// 云信退房
|
||||||
- (void)exitNIMRoom:(NSString *)roomUid {
|
- (void)exitNIMCurrentRoom:(NSString *)roomUid {
|
||||||
[[NIMSDK sharedSDK].chatroomManager exitChatroom:roomUid completion:nil];
|
[[NIMSDK sharedSDK].chatroomManager exitChatroom:roomUid completion:nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,7 +89,7 @@
|
|||||||
/// @param roomDesc 房间介绍
|
/// @param roomDesc 房间介绍
|
||||||
/// @param backPic 房间背景
|
/// @param backPic 房间背景
|
||||||
/// @param mgId 小游戏的id
|
/// @param mgId 小游戏的id
|
||||||
- (void)openRoom:(NSString *)title
|
- (void)openUserRoom:(NSString *)title
|
||||||
type:(RoomType)type
|
type:(RoomType)type
|
||||||
roomPwd:(NSString *)roomPwd
|
roomPwd:(NSString *)roomPwd
|
||||||
roomDesc:(NSString *)roomDesc
|
roomDesc:(NSString *)roomDesc
|
||||||
@@ -119,9 +119,9 @@
|
|||||||
|
|
||||||
[Api openRoom:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
[Api openRoom:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||||
RoomInfoModel *roomInfo = [RoomInfoModel modelWithJSON:data.data];
|
RoomInfoModel *roomInfo = [RoomInfoModel modelWithJSON:data.data];
|
||||||
[[self getView] openRoomSuccess:roomInfo];
|
[[self getView] openCurrentRoomSuccess:roomInfo];
|
||||||
} fail:^(NSInteger code, NSString * _Nullable msg) {
|
} fail:^(NSInteger code, NSString * _Nullable msg) {
|
||||||
[[self getView] enterRoomFail:code];
|
[[self getView] enterCurrentRoomFail:code];
|
||||||
}] title:title type:type roomPwd:roomPwd roomDesc:roomDesc backPic:backPic uid:uid ticket:ticket mgId:mgId];
|
}] title:title type:type roomPwd:roomPwd roomDesc:roomDesc backPic:backPic uid:uid ticket:ticket mgId:mgId];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -12,13 +12,13 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
|
|
||||||
@protocol YMRoomProtocol <NSObject>
|
@protocol YMRoomProtocol <NSObject>
|
||||||
/// 进入房间成功
|
/// 进入房间成功
|
||||||
- (void)initEnterRoomSuccess:(RoomInfoModel *)roomInfo user:(UserInfoModel *)userInfo;
|
- (void)initEnterCurrentRoomSuccess:(RoomInfoModel *)roomInfo user:(UserInfoModel *)userInfo;
|
||||||
///开启房间成功
|
///开启房间成功
|
||||||
- (void)openRoomSuccess:(RoomInfoModel *)roomInfo;
|
- (void)openCurrentRoomSuccess:(RoomInfoModel *)roomInfo;
|
||||||
///进入房间成功
|
///进入房间成功
|
||||||
- (void)enterRoomSuccess:(NIMChatroom *)chatRoom;
|
- (void)enterCurrentRoomSuccess:(NIMChatroom *)chatRoom;
|
||||||
///进入房间失败(当前获取用户信息、获取房间信息、开启房间、进入云信房间失败,均会导致进房失败)
|
///进入房间失败(当前获取用户信息、获取房间信息、开启房间、进入云信房间失败,均会导致进房失败)
|
||||||
- (void)enterRoomFail:(NSInteger)code;
|
- (void)enterCurrentRoomFail:(NSInteger)code;
|
||||||
///获取当前房间的信息,个播房
|
///获取当前房间的信息,个播房
|
||||||
//- (void)getCurrentRoomInfoSuccess:(RoomInfoModel *_Nullable)roomInfo;
|
//- (void)getCurrentRoomInfoSuccess:(RoomInfoModel *_Nullable)roomInfo;
|
||||||
|
|
||||||
|
@@ -13,7 +13,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
|
|
||||||
@interface YMRoomAnimationView : YMRoomAnimationHitView<CHRoomGuestDelegate>
|
@interface YMRoomAnimationView : YMRoomAnimationHitView<CHRoomGuestDelegate>
|
||||||
|
|
||||||
-(void)resumeTimer;
|
-(void)resumeAnimationTimer;
|
||||||
- (instancetype)initWithDelegate:(id<CHRoomHostDelegate>)delegate;
|
- (instancetype)initWithDelegate:(id<CHRoomHostDelegate>)delegate;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
#import "YMRoomAnimationView.h"
|
#import "YMRoomAnimationView.h"
|
||||||
#import "YMRoomAnimationHitView.h"
|
#import "YMRoomAnimationHitView.h"
|
||||||
#import "YMRoomGiftAnimationParser.h"
|
|
||||||
///Third
|
///Third
|
||||||
#import <Masonry/Masonry.h>
|
#import <Masonry/Masonry.h>
|
||||||
#import <SVGA.h>
|
#import <SVGA.h>
|
||||||
@@ -53,7 +53,7 @@
|
|||||||
[[NIMSDK sharedSDK].broadcastManager removeDelegate:self];
|
[[NIMSDK sharedSDK].broadcastManager removeDelegate:self];
|
||||||
|
|
||||||
}
|
}
|
||||||
-(void)resumeTimer{
|
-(void)resumeAnimationTimer{
|
||||||
if(self.giftEffectTimer != nil){
|
if(self.giftEffectTimer != nil){
|
||||||
dispatch_cancel(self.giftEffectTimer);
|
dispatch_cancel(self.giftEffectTimer);
|
||||||
self.giftEffectTimer = nil;
|
self.giftEffectTimer = nil;
|
||||||
|
@@ -1,18 +0,0 @@
|
|||||||
//
|
|
||||||
// YMRoomGiftAnimationParser.h
|
|
||||||
// yinmeng-ios
|
|
||||||
//
|
|
||||||
// Created by 触海 on 2023/11/21.
|
|
||||||
//
|
|
||||||
|
|
||||||
#import <Foundation/Foundation.h>
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
|
||||||
|
|
||||||
@interface YMRoomGiftAnimationParser : NSObject
|
|
||||||
- (void)parseWithURL:(nonnull NSString *)URL
|
|
||||||
completionBlock:(void ( ^ _Nonnull )(NSString * _Nullable videoUrl))completionBlock
|
|
||||||
failureBlock:(void ( ^ _Nullable)(NSError * _Nullable error))failureBlock;
|
|
||||||
@end
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
|
@@ -1,97 +0,0 @@
|
|||||||
//
|
|
||||||
// YMRoomGiftAnimationParser.m
|
|
||||||
// yinmeng-ios
|
|
||||||
//
|
|
||||||
// Created by 触海 on 2023/11/21.
|
|
||||||
//
|
|
||||||
|
|
||||||
#import "YMRoomGiftAnimationParser.h"
|
|
||||||
#import <AFNetworking/AFNetworking.h>
|
|
||||||
#import <SSZipArchive/SSZipArchive.h>
|
|
||||||
#import <CommonCrypto/CommonDigest.h>
|
|
||||||
#import "GCDHelper.h"
|
|
||||||
|
|
||||||
@implementation YMRoomGiftAnimationParser
|
|
||||||
|
|
||||||
static NSOperationQueue *parseQueue;
|
|
||||||
|
|
||||||
+ (void)load {
|
|
||||||
parseQueue = [NSOperationQueue new];
|
|
||||||
parseQueue.maxConcurrentOperationCount = 8;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)parseWithURL:(nonnull NSString *)URL
|
|
||||||
completionBlock:(void ( ^ _Nonnull )(NSString * _Nullable videoUrl))completionBlock
|
|
||||||
failureBlock:(void ( ^ _Nullable)(NSError * _Nullable error))failureBlock {
|
|
||||||
[self parseWithURLRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:URL] cachePolicy:NSURLRequestReturnCacheDataElseLoad timeoutInterval:20.0]
|
|
||||||
completionBlock:completionBlock
|
|
||||||
failureBlock:failureBlock];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)parseWithURLRequest:(NSURLRequest *)URLRequest completionBlock:(void (^)(NSString * _Nullable))completionBlock failureBlock:(void (^)(NSError * _Nullable))failureBlock {
|
|
||||||
if (URLRequest.URL == nil) {
|
|
||||||
if (failureBlock) {
|
|
||||||
[[NSOperationQueue mainQueue] addOperationWithBlock:^{
|
|
||||||
failureBlock([NSError errorWithDomain:@"vapParser" code:411 userInfo:@{NSLocalizedDescriptionKey: @"URL cannot be nil."}]);
|
|
||||||
}];
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if ([[NSFileManager defaultManager] fileExistsAtPath:[self cacheDirectory:[self cacheKey:URLRequest.URL]]]) {
|
|
||||||
if (completionBlock) {
|
|
||||||
[[NSOperationQueue mainQueue] addOperationWithBlock:^{
|
|
||||||
completionBlock([self cacheDirectory:[self cacheKey:URLRequest.URL]]);
|
|
||||||
}];
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
[[[AFHTTPSessionManager manager] downloadTaskWithRequest:URLRequest progress:^(NSProgress * _Nonnull downloadProgress) {
|
|
||||||
} destination:^NSURL * _Nonnull(NSURL * _Nonnull targetPath, NSURLResponse * _Nonnull response) {
|
|
||||||
return [NSURL fileURLWithPath:[self cacheDirectory:[self cacheKey:URLRequest.URL]]];
|
|
||||||
} completionHandler:^(NSURLResponse * _Nonnull response, NSURL * _Nullable filePath, NSError * _Nullable error) {
|
|
||||||
if (!error) {
|
|
||||||
[[NSOperationQueue mainQueue] addOperationWithBlock:^{
|
|
||||||
NSString *str;
|
|
||||||
if ([filePath.absoluteString hasPrefix:@"file:///"]) {
|
|
||||||
str = [filePath.absoluteString stringByReplacingOccurrencesOfString:@"file://" withString:@""];
|
|
||||||
} else {
|
|
||||||
str = filePath.absoluteString;
|
|
||||||
}
|
|
||||||
completionBlock(str);
|
|
||||||
}];
|
|
||||||
} else {
|
|
||||||
[[NSOperationQueue mainQueue] addOperationWithBlock:^{
|
|
||||||
completionBlock(nil);
|
|
||||||
}];
|
|
||||||
}
|
|
||||||
}] resume];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)clearCache:(nonnull NSString *)cacheKey {
|
|
||||||
NSString *cacheDir = [self cacheDirectory:cacheKey];
|
|
||||||
[[NSFileManager defaultManager] removeItemAtPath:cacheDir error:NULL];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (nonnull NSString *)cacheKey:(NSURL *)URL {
|
|
||||||
return [self MD5String:URL.absoluteString];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (nullable NSString *)cacheDirectory:(NSString *)cacheKey {
|
|
||||||
NSString *cacheDir = [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) firstObject];
|
|
||||||
return [cacheDir stringByAppendingFormat:@"/%@.mp4", cacheKey];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (NSString *)MD5String:(NSString *)str {
|
|
||||||
const char *cstr = [str UTF8String];
|
|
||||||
unsigned char result[16];
|
|
||||||
CC_MD5(cstr, (CC_LONG)strlen(cstr), result);
|
|
||||||
return [NSString stringWithFormat:
|
|
||||||
@"%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X",
|
|
||||||
result[0], result[1], result[2], result[3],
|
|
||||||
result[4], result[5], result[6], result[7],
|
|
||||||
result[8], result[9], result[10], result[11],
|
|
||||||
result[12], result[13], result[14], result[15]
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
@@ -25,8 +25,8 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
|
|
||||||
@optional
|
@optional
|
||||||
|
|
||||||
- (void)onRoomUpdate;
|
- (void)onRoomInfoUpdate;
|
||||||
- (void)onUserUpdate;
|
- (void)onUserInfoUpdate;
|
||||||
- (void)onRoomEntered;
|
- (void)onRoomEntered;
|
||||||
|
|
||||||
/// NIM 事件监听
|
/// NIM 事件监听
|
||||||
|
@@ -145,7 +145,7 @@
|
|||||||
return self.micQueue;
|
return self.micQueue;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)onRoomUpdate {
|
- (void)onRoomInfoUpdate {
|
||||||
// self.isMiniEnter = NO;
|
// self.isMiniEnter = NO;
|
||||||
RoomInfoModel * roomInfo = self.hostDelegate.getRoomInformation;
|
RoomInfoModel * roomInfo = self.hostDelegate.getRoomInformation;
|
||||||
// for (int i = 0; i < self.countOfMircoView; i++) {
|
// for (int i = 0; i < self.countOfMircoView; i++) {
|
||||||
@@ -362,12 +362,6 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (roomInfo.leaveMode && roomInfo.uid == [AccountInfoStorage instance].getUid.integerValue) {
|
|
||||||
[YMHUDTool showErrorWithMessage:@"请先关闭离开模式"];
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// 2. 空麦位,上麦逻辑
|
// 2. 空麦位,上麦逻辑
|
||||||
NIMChatroomMembersByIdsRequest *request = [[NIMChatroomMembersByIdsRequest alloc]init];
|
NIMChatroomMembersByIdsRequest *request = [[NIMChatroomMembersByIdsRequest alloc]init];
|
||||||
request.roomId = roomId;
|
request.roomId = roomId;
|
||||||
@@ -394,9 +388,6 @@
|
|||||||
if (isFromDownMic) {
|
if (isFromDownMic) {
|
||||||
self.isUpingMic = NO;
|
self.isUpingMic = NO;
|
||||||
}
|
}
|
||||||
if (error) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}];
|
}];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user