Commit 959b464c132fafb99419fc3a99c0f3eb5a6b2ba9
1 parent
66da9870
修改聊天解析消息展示连击礼物的Bug和不展示自己加入房间消息
Showing
4 changed files
with
70 additions
and
200 deletions
LiveVideoCloud/AppDelegate/AppDelegate.m
| @@ -52,7 +52,7 @@ | @@ -52,7 +52,7 @@ | ||
| 52 | // 20170327 20170328 | 52 | // 20170327 20170328 |
| 53 | 53 | ||
| 54 | 54 | ||
| 55 | - CNLiveChatUserInfo *userInfo = [[CNLiveChatUserInfo alloc] initWithUserId:@"20170629" name:@"20170328" portrait:@"http://b.hiphotos.baidu.com/zhidao/wh%3D450%2C600/sign=f0c5c08030d3d539c16807c70fb7c566/8ad4b31c8701a18bbef9f231982f07082838feba.jpg"]; | 55 | + CNLiveChatUserInfo *userInfo = [[CNLiveChatUserInfo alloc] initWithUserId:@"20170628" name:@"20170628" portrait:@"http://b.hiphotos.baidu.com/zhidao/wh%3D450%2C600/sign=f0c5c08030d3d539c16807c70fb7c566/8ad4b31c8701a18bbef9f231982f07082838feba.jpg"]; |
| 56 | 56 | ||
| 57 | 57 | ||
| 58 | [[CNLiveChatManager sharedCNLiveChatManager] loginServer:userInfo success:^(NSString *userId) { | 58 | [[CNLiveChatManager sharedCNLiveChatManager] loginServer:userInfo success:^(NSString *userId) { |
LiveVideoCloud/Classes/Sections/InteractionSections/Gift/GiftViews/GiftListView.h
| @@ -7,8 +7,9 @@ | @@ -7,8 +7,9 @@ | ||
| 7 | // | 7 | // |
| 8 | 8 | ||
| 9 | #import "BaseView.h" | 9 | #import "BaseView.h" |
| 10 | +#import "GiftModel.h" | ||
| 10 | @class LiveBaseView; | 11 | @class LiveBaseView; |
| 11 | -@class GiftModel; | 12 | + |
| 12 | 13 | ||
| 13 | @protocol GiftSelectDelegate <NSObject> | 14 | @protocol GiftSelectDelegate <NSObject> |
| 14 | 15 | ||
| @@ -24,5 +25,7 @@ | @@ -24,5 +25,7 @@ | ||
| 24 | 25 | ||
| 25 | - (void)addGiftAnimationWithModel:(GiftModel *_Nonnull)model; | 26 | - (void)addGiftAnimationWithModel:(GiftModel *_Nonnull)model; |
| 26 | 27 | ||
| 27 | -- (NSInteger)recGiftIndexFromGiftName:(NSString *)giftName; | 28 | +- (GiftStyle)giftStyleWithTag:(NSInteger)tag; |
| 29 | + | ||
| 30 | +- (NSInteger)recGiftIndexFromGiftName:(NSString *_Nonnull)giftName; | ||
| 28 | @end | 31 | @end |
LiveVideoCloud/Classes/Sections/InteractionSections/Gift/GiftViews/GiftListView.m
| @@ -7,7 +7,6 @@ | @@ -7,7 +7,6 @@ | ||
| 7 | // | 7 | // |
| 8 | 8 | ||
| 9 | #import "GiftListView.h" | 9 | #import "GiftListView.h" |
| 10 | -#import "GiftModel.h" | ||
| 11 | #import "LiveBaseView.h" | 10 | #import "LiveBaseView.h" |
| 12 | #import "AnimQueueManager.h" | 11 | #import "AnimQueueManager.h" |
| 13 | #import "GiftPayButton.h" | 12 | #import "GiftPayButton.h" |
| @@ -171,6 +170,7 @@ | @@ -171,6 +170,7 @@ | ||
| 171 | GiftModel *model = self.giftArray[tag]; | 170 | GiftModel *model = self.giftArray[tag]; |
| 172 | model.sender = [CNLiveChatManager sharedCNLiveChatManager].currentUserInfo.name; | 171 | model.sender = [CNLiveChatManager sharedCNLiveChatManager].currentUserInfo.name; |
| 173 | model.icon = [CNLiveChatManager sharedCNLiveChatManager].currentUserInfo.portraitUri; | 172 | model.icon = [CNLiveChatManager sharedCNLiveChatManager].currentUserInfo.portraitUri; |
| 173 | + model.giftStyle = [self giftStyleWithTag:tag]; | ||
| 174 | #warning 测试时 price 用假值 model.giftNumber赋值会导致不能本地连击以后再说 | 174 | #warning 测试时 price 用假值 model.giftNumber赋值会导致不能本地连击以后再说 |
| 175 | model.price = @"0"; | 175 | model.price = @"0"; |
| 176 | // model.giftNumber = 3; | 176 | // model.giftNumber = 3; |
| @@ -181,17 +181,36 @@ | @@ -181,17 +181,36 @@ | ||
| 181 | //应该加验证发送礼物消息成功后 再展示动画 | 181 | //应该加验证发送礼物消息成功后 再展示动画 |
| 182 | - (void)addGiftAnimationWithModel:(GiftModel *_Nonnull)model | 182 | - (void)addGiftAnimationWithModel:(GiftModel *_Nonnull)model |
| 183 | { | 183 | { |
| 184 | + GiftModel *tempMdl = self.giftArray[model.index]; | ||
| 185 | + model.giftImageName = tempMdl.giftImageName; | ||
| 186 | + | ||
| 184 | dispatch_async(dispatch_get_main_queue(), ^{ | 187 | dispatch_async(dispatch_get_main_queue(), ^{ |
| 185 | if (model.giftStyle == GiftStyleCombo) { | 188 | if (model.giftStyle == GiftStyleCombo) { |
| 186 | 189 | ||
| 187 | - [self.animQueueManager addAnimationWithModel:self.giftArray[model.index] animContentView:(UIView *)self.liveBaseView.presentView]; | 190 | + [self.animQueueManager addAnimationWithModel:model animContentView:(UIView *)self.liveBaseView.presentView]; |
| 188 | }else | 191 | }else |
| 189 | { | 192 | { |
| 190 | - [self.animQueueManager addAnimationWithModel:self.giftArray[model.index] animContentView:self.liveBaseView]; | 193 | + [self.animQueueManager addAnimationWithModel:model animContentView:self.liveBaseView]; |
| 191 | } | 194 | } |
| 192 | }); | 195 | }); |
| 193 | } | 196 | } |
| 194 | 197 | ||
| 198 | +- (GiftStyle)giftStyleWithTag:(NSInteger)tag | ||
| 199 | +{ | ||
| 200 | + GiftStyle style; | ||
| 201 | + | ||
| 202 | + if (tag == 0) { | ||
| 203 | + style = GiftStylePorsch; | ||
| 204 | + }else if (tag == 1){ | ||
| 205 | + style = GiftStyleFighter; | ||
| 206 | + }else if (tag == 2){ | ||
| 207 | + style = GiftStylePlane; | ||
| 208 | + }else{ | ||
| 209 | + style = GiftStyleCombo; | ||
| 210 | + } | ||
| 211 | + return style; | ||
| 212 | +} | ||
| 213 | + | ||
| 195 | - (NSString *)giftNameWithImageName:(NSString *)imageName | 214 | - (NSString *)giftNameWithImageName:(NSString *)imageName |
| 196 | { | 215 | { |
| 197 | NSString *giftName = @""; | 216 | NSString *giftName = @""; |
LiveVideoCloud/Classes/Sections/InteractionSections/LiveBaseView.m
| @@ -104,36 +104,17 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型 | @@ -104,36 +104,17 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型 | ||
| 104 | [CNLiveChatManager sharedCNLiveChatManager].delegate = self; | 104 | [CNLiveChatManager sharedCNLiveChatManager].delegate = self; |
| 105 | [[CNLiveChatManager sharedCNLiveChatManager] joinChatRoom:roomId messageCount:-1 success:^(NSString *targetId) { | 105 | [[CNLiveChatManager sharedCNLiveChatManager] joinChatRoom:roomId messageCount:-1 success:^(NSString *targetId) { |
| 106 | 106 | ||
| 107 | - NSDictionary *dic = @{chatType:joinType,chatMessage:@{}}; | ||
| 108 | - | ||
| 109 | - weakself | ||
| 110 | - NSString *message = [Tools dictionaryToJson:dic]; | ||
| 111 | - [[CNLiveChatManager sharedCNLiveChatManager] sendMessage:message type:CNLive_ConversationType_CHATROOM targetId:_roomId success:^(CNLiveChatMessage *message) { | ||
| 112 | - strongself | ||
| 113 | - | ||
| 114 | - | ||
| 115 | - //将消息显示到列表中 | ||
| 116 | - chatMsgModel *model = [[chatMsgModel alloc] init]; | ||
| 117 | - model.name = message.userInfo.name; | ||
| 118 | - model.content = [NSString stringWithFormat:@"%@进入了房间",message.userInfo.name]; | ||
| 119 | - model.ID = message.targetId; | ||
| 120 | - model.icon = message.userInfo.portraitUri; | ||
| 121 | - model.cellWidth = self.chatTableView.width - 20; | ||
| 122 | - model.uId = message.userInfo.userId; | ||
| 123 | - [self.chatMsgArray addObject:model]; | ||
| 124 | - [self.chatTableView reloadData]; | ||
| 125 | - NSInteger section = [self.chatTableView numberOfSections]; | ||
| 126 | - if (section < 1) return; | ||
| 127 | - NSInteger row = [self.chatTableView numberOfRowsInSection:section - 1]; | ||
| 128 | - if (row < 1) return; | ||
| 129 | - NSIndexPath *indexPath = [NSIndexPath indexPathForRow:row - 1 inSection:section - 1]; | ||
| 130 | - [self.chatTableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionBottom animated:YES]; | ||
| 131 | - [self.chatTableView reloadData]; | ||
| 132 | - | ||
| 133 | - } error:^(CNLiveChatErrorCode errors, NSString *messageId, NSString *targetId) { | ||
| 134 | - NSLog(@"%@",messageId); | ||
| 135 | - }]; | ||
| 136 | - | 107 | + if ([[UserInformationModel manager].uid isEqualToString:roomId]) { |
| 108 | + }else{ | ||
| 109 | + NSDictionary *dic = @{chatType:joinType,chatMessage:@{}}; | ||
| 110 | + NSString *message = [Tools dictionaryToJson:dic]; | ||
| 111 | + [[CNLiveChatManager sharedCNLiveChatManager] sendMessage:message type:CNLive_ConversationType_CHATROOM targetId:_roomId success:^(CNLiveChatMessage *message) { | ||
| 112 | + NSLog(@"sendMessage Success %@",message.messageContent); | ||
| 113 | + | ||
| 114 | + } error:^(CNLiveChatErrorCode errors, NSString *messageId, NSString *targetId) { | ||
| 115 | + NSLog(@"%@",messageId); | ||
| 116 | + }]; | ||
| 117 | + } | ||
| 137 | NSLog(@"连接聊天室成功success %@",targetId); | 118 | NSLog(@"连接聊天室成功success %@",targetId); |
| 138 | } error:^(CNLiveChatErrorCode errors, NSString *targetId) { | 119 | } error:^(CNLiveChatErrorCode errors, NSString *targetId) { |
| 139 | NSLog(@"error"); | 120 | NSLog(@"error"); |
| @@ -231,39 +212,18 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型 | @@ -231,39 +212,18 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型 | ||
| 231 | NSString *message = [Tools dictionaryToJson:dic]; | 212 | NSString *message = [Tools dictionaryToJson:dic]; |
| 232 | [[CNLiveChatManager sharedCNLiveChatManager] sendMessage:message type:CNLive_ConversationType_CHATROOM targetId:_roomId success:^(CNLiveChatMessage *message) { | 213 | [[CNLiveChatManager sharedCNLiveChatManager] sendMessage:message type:CNLive_ConversationType_CHATROOM targetId:_roomId success:^(CNLiveChatMessage *message) { |
| 233 | strongself | 214 | strongself |
| 215 | + | ||
| 234 | NSDictionary *JSONDic = [Tools dictionaryWithJsonString:message.messageContent]; | 216 | NSDictionary *JSONDic = [Tools dictionaryWithJsonString:message.messageContent]; |
| 235 | NSDictionary *msg = [JSONDic objectForKey:chatMessage]; | 217 | NSDictionary *msg = [JSONDic objectForKey:chatMessage]; |
| 236 | - | ||
| 237 | - //将消息显示到列表中 | ||
| 238 | - chatMsgModel *model = [[chatMsgModel alloc] init]; | ||
| 239 | - model.name = message.userInfo.name; | ||
| 240 | - model.content = [msg objectForKey:msgContent]; | ||
| 241 | - model.ID = message.targetId; | ||
| 242 | - model.icon = message.userInfo.portraitUri; | ||
| 243 | - model.cellWidth = self.chatTableView.width - 20; | ||
| 244 | - model.uId = message.userInfo.userId; | ||
| 245 | - [self.chatMsgArray addObject:model]; | ||
| 246 | - [self.chatTableView reloadData]; | ||
| 247 | - NSInteger section = [self.chatTableView numberOfSections]; | ||
| 248 | - if (section < 1) return; | ||
| 249 | - NSInteger row = [self.chatTableView numberOfRowsInSection:section - 1]; | ||
| 250 | - if (row < 1) return; | ||
| 251 | - NSIndexPath *indexPath = [NSIndexPath indexPathForRow:row - 1 inSection:section - 1]; | ||
| 252 | - [self.chatTableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionBottom animated:YES]; | ||
| 253 | - [self.chatTableView reloadData]; | ||
| 254 | - | 218 | + [self addChatMsgWithMessage:message content:[msg objectForKey:msgContent]]; |
| 255 | NSInteger isBarrage = [[[JSONDic objectForKey:chatMessage] objectForKey:msgBarrage] integerValue]; | 219 | NSInteger isBarrage = [[[JSONDic objectForKey:chatMessage] objectForKey:msgBarrage] integerValue]; |
| 256 | - | ||
| 257 | if (isBarrage) {//此条消息飘弹幕 | 220 | if (isBarrage) {//此条消息飘弹幕 |
| 258 | - | ||
| 259 | chatMsgModel *barrageModel = [[chatMsgModel alloc] init]; | 221 | chatMsgModel *barrageModel = [[chatMsgModel alloc] init]; |
| 260 | barrageModel.name = message.userInfo.name; | 222 | barrageModel.name = message.userInfo.name; |
| 261 | barrageModel.content = [msg objectForKey:msgContent]; | 223 | barrageModel.content = [msg objectForKey:msgContent]; |
| 262 | barrageModel.icon = message.userInfo.portraitUri; | 224 | barrageModel.icon = message.userInfo.portraitUri; |
| 263 | - | ||
| 264 | [self.chatManager addAnimationWithModel:barrageModel animContentView:self.animationBaseView]; | 225 | [self.chatManager addAnimationWithModel:barrageModel animContentView:self.animationBaseView]; |
| 265 | - } | ||
| 266 | - | 226 | + } |
| 267 | } error:^(CNLiveChatErrorCode errors, NSString *messageId, NSString *targetId) { | 227 | } error:^(CNLiveChatErrorCode errors, NSString *messageId, NSString *targetId) { |
| 268 | NSLog(@"%@",messageId); | 228 | NSLog(@"%@",messageId); |
| 269 | }]; | 229 | }]; |
| @@ -411,25 +371,26 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型 | @@ -411,25 +371,26 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型 | ||
| 411 | 371 | ||
| 412 | - (void)addChatMsgWithMessage:(CNLiveChatMessage *)message content:(NSString *)content | 372 | - (void)addChatMsgWithMessage:(CNLiveChatMessage *)message content:(NSString *)content |
| 413 | { | 373 | { |
| 414 | - //将消息显示到列表中 | ||
| 415 | - chatMsgModel *model = [[chatMsgModel alloc] init]; | ||
| 416 | - model.name = message.userInfo.name; | ||
| 417 | - model.content = content; | ||
| 418 | - model.ID = message.targetId; | ||
| 419 | - model.icon = message.userInfo.portraitUri; | ||
| 420 | - model.cellWidth = self.chatTableView.width - 20; | ||
| 421 | - model.uId = message.userInfo.userId; | ||
| 422 | - [self.chatMsgArray addObject:model]; | ||
| 423 | - [self.chatTableView reloadData]; | ||
| 424 | - | ||
| 425 | - NSInteger section = [self.chatTableView numberOfSections]; | ||
| 426 | - if (section < 1) return; | ||
| 427 | - NSInteger row = [self.chatTableView numberOfRowsInSection:section - 1]; | ||
| 428 | - if (row < 1) return; | ||
| 429 | - NSIndexPath *indexPath = [NSIndexPath indexPathForRow:row - 1 inSection:section - 1]; | ||
| 430 | - [self.chatTableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionBottom animated:YES]; | ||
| 431 | - [self.chatTableView reloadData]; | ||
| 432 | - | 374 | + dispatch_async(dispatch_get_main_queue(), ^{ |
| 375 | + //将消息显示到列表中 | ||
| 376 | + chatMsgModel *model = [[chatMsgModel alloc] init]; | ||
| 377 | + model.name = message.userInfo.name; | ||
| 378 | + model.content = content; | ||
| 379 | + model.ID = message.targetId; | ||
| 380 | + model.icon = message.userInfo.portraitUri; | ||
| 381 | + model.cellWidth = self.chatTableView.width - 20; | ||
| 382 | + model.uId = message.userInfo.userId; | ||
| 383 | + [self.chatMsgArray addObject:model]; | ||
| 384 | + [self.chatTableView reloadData]; | ||
| 385 | + | ||
| 386 | + NSInteger section = [self.chatTableView numberOfSections]; | ||
| 387 | + if (section < 1) return; | ||
| 388 | + NSInteger row = [self.chatTableView numberOfRowsInSection:section - 1]; | ||
| 389 | + if (row < 1) return; | ||
| 390 | + NSIndexPath *indexPath = [NSIndexPath indexPathForRow:row - 1 inSection:section - 1]; | ||
| 391 | + [self.chatTableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionBottom animated:YES]; | ||
| 392 | + [self.chatTableView reloadData]; | ||
| 393 | + }); | ||
| 433 | } | 394 | } |
| 434 | 395 | ||
| 435 | #pragma mark - buttonClick触摸屏幕关闭方法 | 396 | #pragma mark - buttonClick触摸屏幕关闭方法 |
| @@ -499,10 +460,8 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型 | @@ -499,10 +460,8 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型 | ||
| 499 | { | 460 | { |
| 500 | if (![model.sender isEqualToString:@""]) { | 461 | if (![model.sender isEqualToString:@""]) { |
| 501 | if ([[CNLiveChatManager sharedCNLiveChatManager] getConnectionStatus] == CNLive_ConnectionStatus_Connected) { | 462 | if ([[CNLiveChatManager sharedCNLiveChatManager] getConnectionStatus] == CNLive_ConnectionStatus_Connected) { |
| 502 | - | ||
| 503 | weakself | 463 | weakself |
| 504 | [[CNLiveChatManager sharedCNLiveChatManager] sendMessage:[self giftModelToJSON:model] type:CNLive_ConversationType_CHATROOM targetId:_roomId success:^(CNLiveChatMessage *message) { | 464 | [[CNLiveChatManager sharedCNLiveChatManager] sendMessage:[self giftModelToJSON:model] type:CNLive_ConversationType_CHATROOM targetId:_roomId success:^(CNLiveChatMessage *message) { |
| 505 | - | ||
| 506 | NSLog(@"send Msg success: %@",message.messageContent); | 465 | NSLog(@"send Msg success: %@",message.messageContent); |
| 507 | strongself | 466 | strongself |
| 508 | NSDictionary *JSONDic = [Tools dictionaryWithJsonString:message.messageContent]; | 467 | NSDictionary *JSONDic = [Tools dictionaryWithJsonString:message.messageContent]; |
| @@ -510,24 +469,7 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型 | @@ -510,24 +469,7 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型 | ||
| 510 | 469 | ||
| 511 | [self.giftListView addGiftAnimationWithModel:model]; | 470 | [self.giftListView addGiftAnimationWithModel:model]; |
| 512 | 471 | ||
| 513 | - CNLiveChatUserInfo *userInfo = message.userInfo; | ||
| 514 | - //将消息显示到列表中 | ||
| 515 | - chatMsgModel *model1 = [[chatMsgModel alloc] init]; | ||
| 516 | - model1.name = message.userInfo.name; | ||
| 517 | - model1.content = [NSString stringWithFormat:@" 送了一个 %@",msgDic[@"giftName"]]; | ||
| 518 | - model1.ID = message.targetId; | ||
| 519 | - model1.icon = userInfo.portraitUri; | ||
| 520 | - model1.cellWidth = self.chatTableView.width - 20; | ||
| 521 | - model1.uId = userInfo.userId; | ||
| 522 | - [self.chatMsgArray addObject:model1]; | ||
| 523 | - [self.chatTableView reloadData]; | ||
| 524 | - NSInteger section = [self.chatTableView numberOfSections]; | ||
| 525 | - if (section < 1) return; | ||
| 526 | - NSInteger row = [self.chatTableView numberOfRowsInSection:section - 1]; | ||
| 527 | - if (row < 1) return; | ||
| 528 | - NSIndexPath *indexPath = [NSIndexPath indexPathForRow:row - 1 inSection:section - 1]; | ||
| 529 | - [self.chatTableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionBottom animated:YES]; | ||
| 530 | - [self.chatTableView reloadData]; | 472 | + [self addChatMsgWithMessage:message content:[NSString stringWithFormat:@" 送了一个 %@",msgDic[@"giftName"]]]; |
| 531 | 473 | ||
| 532 | } error:^(CNLiveChatErrorCode errors, NSString *messageId, NSString *targetId) { | 474 | } error:^(CNLiveChatErrorCode errors, NSString *messageId, NSString *targetId) { |
| 533 | NSLog(@"error"); | 475 | NSLog(@"error"); |
| @@ -590,122 +532,28 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型 | @@ -590,122 +532,28 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型 | ||
| 590 | giftModel.sender = message.userInfo.name; | 532 | giftModel.sender = message.userInfo.name; |
| 591 | giftModel.giftName = [msgDic objectForKey:msgGiftName]; | 533 | giftModel.giftName = [msgDic objectForKey:msgGiftName]; |
| 592 | giftModel.icon = message.userInfo.portraitUri; | 534 | giftModel.icon = message.userInfo.portraitUri; |
| 593 | - giftModel.giftStyle = GiftStyleCombo; | 535 | + NSInteger index = [self.giftListView recGiftIndexFromGiftName:[msgDic objectForKey:msgGiftName]]; |
| 536 | + giftModel.index = index; | ||
| 537 | + giftModel.price = [msgDic objectForKey:msgGiftPrice]; | ||
| 538 | + giftModel.giftStyle = [self.giftListView giftStyleWithTag:index]; | ||
| 594 | 539 | ||
| 595 | - giftModel.index = [self.giftListView recGiftIndexFromGiftName:[msgDic objectForKey:msgGiftName]]; | ||
| 596 | [self.giftListView addGiftAnimationWithModel:giftModel]; | 540 | [self.giftListView addGiftAnimationWithModel:giftModel]; |
| 597 | - | ||
| 598 | [self addChatMsgWithMessage:message content:[NSString stringWithFormat:@" 送了一个 %@",msgDic[@"giftName"]]]; | 541 | [self addChatMsgWithMessage:message content:[NSString stringWithFormat:@" 送了一个 %@",msgDic[@"giftName"]]]; |
| 599 | -// //将消息显示到列表中 | ||
| 600 | -// chatMsgModel *model = [[chatMsgModel alloc] init]; | ||
| 601 | -// model.name = message.userInfo.name; | ||
| 602 | -// model.content = [NSString stringWithFormat:@" 送了一个 %@",msgDic[@"giftName"]]; | ||
| 603 | -// model.ID = message.targetId; | ||
| 604 | -// model.icon = message.userInfo.portraitUri; | ||
| 605 | -// model.cellWidth = self.chatTableView.width - 20; | ||
| 606 | -// model.uId = message.userInfo.userId; | ||
| 607 | -// [self.chatMsgArray addObject:model]; | ||
| 608 | -// [self.chatTableView reloadData]; | ||
| 609 | -// | ||
| 610 | -// NSInteger section = [self.chatTableView numberOfSections]; | ||
| 611 | -// if (section < 1) return; | ||
| 612 | -// NSInteger row = [self.chatTableView numberOfRowsInSection:section - 1]; | ||
| 613 | -// if (row < 1) return; | ||
| 614 | -// NSIndexPath *indexPath = [NSIndexPath indexPathForRow:row - 1 inSection:section - 1]; | ||
| 615 | -// [self.chatTableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionBottom animated:YES]; | ||
| 616 | -// [self.chatTableView reloadData]; | 542 | + |
| 617 | }else if ([type isEqualToString:joinType]){ | 543 | }else if ([type isEqualToString:joinType]){ |
| 618 | [self addChatMsgWithMessage:message content:[NSString stringWithFormat:@"%@进入了房间",message.userInfo.name]]; | 544 | [self addChatMsgWithMessage:message content:[NSString stringWithFormat:@"%@进入了房间",message.userInfo.name]]; |
| 619 | -// //将消息显示到列表中 | ||
| 620 | -// chatMsgModel *model = [[chatMsgModel alloc] init]; | ||
| 621 | -// model.name = message.userInfo.name; | ||
| 622 | -// model.content = [NSString stringWithFormat:@"%@进入了房间",message.userInfo.name]; | ||
| 623 | -// model.ID = message.targetId; | ||
| 624 | -// model.icon = message.userInfo.portraitUri; | ||
| 625 | -// model.cellWidth = self.chatTableView.width - 20; | ||
| 626 | -// model.uId = message.userInfo.userId; | ||
| 627 | -// [self.chatMsgArray addObject:model]; | ||
| 628 | -// [self.chatTableView reloadData]; | ||
| 629 | -// NSInteger section = [self.chatTableView numberOfSections]; | ||
| 630 | -// if (section < 1) return; | ||
| 631 | -// NSInteger row = [self.chatTableView numberOfRowsInSection:section - 1]; | ||
| 632 | -// if (row < 1) return; | ||
| 633 | -// NSIndexPath *indexPath = [NSIndexPath indexPathForRow:row - 1 inSection:section - 1]; | ||
| 634 | -// [self.chatTableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionBottom animated:YES]; | ||
| 635 | -// [self.chatTableView reloadData]; | 545 | + |
| 636 | }else if ([type isEqualToString:chatRoomType]){ | 546 | }else if ([type isEqualToString:chatRoomType]){ |
| 637 | - [self addChatMsgWithMessage:message content: [NSString stringWithFormat:@" 送了一个 %@",msgDic[@"giftName"]]]; | ||
| 638 | -// //将消息显示到列表中 | ||
| 639 | -// chatMsgModel *model = [[chatMsgModel alloc] init]; | ||
| 640 | -// model.name = message.userInfo.name; | ||
| 641 | -// model.content = [NSString stringWithFormat:@" 送了一个 %@",msgDic[@"giftName"]]; | ||
| 642 | -// model.ID = message.targetId; | ||
| 643 | -// model.icon = message.userInfo.portraitUri; | ||
| 644 | -// model.cellWidth = self.chatTableView.width - 20; | ||
| 645 | -// model.uId = message.userInfo.userId; | ||
| 646 | -// [self.chatMsgArray addObject:model]; | ||
| 647 | -// [self.chatTableView reloadData]; | ||
| 648 | -// | ||
| 649 | -// NSInteger section = [self.chatTableView numberOfSections]; | ||
| 650 | -// if (section < 1) return; | ||
| 651 | -// NSInteger row = [self.chatTableView numberOfRowsInSection:section - 1]; | ||
| 652 | -// if (row < 1) return; | ||
| 653 | -// NSIndexPath *indexPath = [NSIndexPath indexPathForRow:row - 1 inSection:section - 1]; | ||
| 654 | -// [self.chatTableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionBottom animated:YES]; | ||
| 655 | -// [self.chatTableView reloadData]; | ||
| 656 | - | 547 | + [self addChatMsgWithMessage:message content: [msgDic objectForKey:msgContent]]; |
| 657 | NSInteger isBarrage = [[[JSONDic objectForKey:chatMessage] objectForKey:msgBarrage] integerValue]; | 548 | NSInteger isBarrage = [[[JSONDic objectForKey:chatMessage] objectForKey:msgBarrage] integerValue]; |
| 658 | - | ||
| 659 | if (isBarrage) {//此条消息飘弹幕 | 549 | if (isBarrage) {//此条消息飘弹幕 |
| 660 | - | ||
| 661 | chatMsgModel *barrageModel = [[chatMsgModel alloc] init]; | 550 | chatMsgModel *barrageModel = [[chatMsgModel alloc] init]; |
| 662 | barrageModel.name = message.userInfo.name; | 551 | barrageModel.name = message.userInfo.name; |
| 663 | barrageModel.content = [msgDic objectForKey:msgContent]; | 552 | barrageModel.content = [msgDic objectForKey:msgContent]; |
| 664 | barrageModel.icon = message.userInfo.portraitUri; | 553 | barrageModel.icon = message.userInfo.portraitUri; |
| 665 | [self.chatManager addAnimationWithModel:barrageModel animContentView:self.animationBaseView]; | 554 | [self.chatManager addAnimationWithModel:barrageModel animContentView:self.animationBaseView]; |
| 666 | } | 555 | } |
| 667 | - | ||
| 668 | } | 556 | } |
| 669 | - | ||
| 670 | -// | ||
| 671 | -// GiftModel *giftModel = [[GiftModel alloc] init]; | ||
| 672 | -// giftModel.sender = message.userInfo.name; | ||
| 673 | -// giftModel.giftName = [msgDic objectForKey:msgGiftName]; | ||
| 674 | -// giftModel.icon = message.userInfo.portraitUri; | ||
| 675 | -// giftModel.giftStyle = GiftStyleCombo; | ||
| 676 | -// | ||
| 677 | -// giftModel.index = [self.giftListView recGiftIndexFromGiftName:[msgDic objectForKey:msgGiftName]]; | ||
| 678 | -// [self.giftListView addGiftAnimationWithModel:giftModel]; | ||
| 679 | -// | ||
| 680 | -// //将消息显示到列表中 | ||
| 681 | -// chatMsgModel *model = [[chatMsgModel alloc] init]; | ||
| 682 | -// model.name = message.userInfo.name; | ||
| 683 | -// model.content = [NSString stringWithFormat:@" 送了一个 %@",msgDic[@"giftName"]]; | ||
| 684 | -// model.ID = message.targetId; | ||
| 685 | -// model.icon = message.userInfo.portraitUri; | ||
| 686 | -// model.cellWidth = self.chatTableView.width - 20; | ||
| 687 | -// model.uId = message.userInfo.userId; | ||
| 688 | -// [self.chatMsgArray addObject:model]; | ||
| 689 | -// [self.chatTableView reloadData]; | ||
| 690 | -// | ||
| 691 | -// NSInteger section = [self.chatTableView numberOfSections]; | ||
| 692 | -// if (section < 1) return; | ||
| 693 | -// NSInteger row = [self.chatTableView numberOfRowsInSection:section - 1]; | ||
| 694 | -// if (row < 1) return; | ||
| 695 | -// NSIndexPath *indexPath = [NSIndexPath indexPathForRow:row - 1 inSection:section - 1]; | ||
| 696 | -// [self.chatTableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionBottom animated:YES]; | ||
| 697 | -// [self.chatTableView reloadData]; | ||
| 698 | -// | ||
| 699 | -// NSInteger isBarrage = [[[JSONDic objectForKey:chatMessage] objectForKey:msgBarrage] integerValue]; | ||
| 700 | -// | ||
| 701 | -// if (isBarrage) {//此条消息飘弹幕 | ||
| 702 | -// | ||
| 703 | -// chatMsgModel *barrageModel = [[chatMsgModel alloc] init]; | ||
| 704 | -// barrageModel.name = message.userInfo.name; | ||
| 705 | -// barrageModel.content = [msgDic objectForKey:msgContent]; | ||
| 706 | -// barrageModel.icon = message.userInfo.portraitUri; | ||
| 707 | -// [self.chatManager addAnimationWithModel:barrageModel animContentView:self.animationBaseView]; | ||
| 708 | -// } | ||
| 709 | } | 557 | } |
| 710 | break; | 558 | break; |
| 711 | case CNLive_ConversationType_PRIVATE: | 559 | case CNLive_ConversationType_PRIVATE: |