Commit 5be2c6d4d3e40445f3d2ed9ae12a1a1f01f1ad96
1 parent
3a27b875
接受礼物的展示逻辑,不接受历史消息
Showing
3 changed files
with
17 additions
and
1 deletions
LiveVideoCloud/Classes/Sections/InteractionSections/Gift/GiftViews/GiftListView.h
| @@ -23,4 +23,6 @@ | @@ -23,4 +23,6 @@ | ||
| 23 | @property (nonatomic,weak) id <GiftSelectDelegate> delegate; | 23 | @property (nonatomic,weak) id <GiftSelectDelegate> delegate; |
| 24 | 24 | ||
| 25 | - (void)addGiftAnimationWithModel:(GiftModel *_Nonnull)model; | 25 | - (void)addGiftAnimationWithModel:(GiftModel *_Nonnull)model; |
| 26 | + | ||
| 27 | +- (NSInteger)recGiftIndexFromGiftName:(NSString *)giftName; | ||
| 26 | @end | 28 | @end |
LiveVideoCloud/Classes/Sections/InteractionSections/Gift/GiftViews/GiftListView.m
| @@ -205,6 +205,18 @@ | @@ -205,6 +205,18 @@ | ||
| 205 | return giftName; | 205 | return giftName; |
| 206 | } | 206 | } |
| 207 | 207 | ||
| 208 | +- (NSInteger)recGiftIndexFromGiftName:(NSString *)giftName | ||
| 209 | +{ | ||
| 210 | + NSInteger index = 0; | ||
| 211 | + for (NSString *str in _giftNames) { | ||
| 212 | + if ([str isEqualToString:giftName]) { | ||
| 213 | + index = [_giftNames indexOfObject:str]; | ||
| 214 | + NSLog(@"rec index %zd,name %@",index,str); | ||
| 215 | + } | ||
| 216 | + } | ||
| 217 | + return index; | ||
| 218 | +} | ||
| 219 | + | ||
| 208 | #pragma mark - getter | 220 | #pragma mark - getter |
| 209 | 221 | ||
| 210 | - (NSArray *)giftArray | 222 | - (NSArray *)giftArray |
LiveVideoCloud/Classes/Sections/InteractionSections/LiveBaseView.m
| @@ -101,7 +101,7 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型 | @@ -101,7 +101,7 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型 | ||
| 101 | { | 101 | { |
| 102 | _roomId = roomId; | 102 | _roomId = roomId; |
| 103 | [CNLiveChatManager sharedCNLiveChatManager].delegate = self; | 103 | [CNLiveChatManager sharedCNLiveChatManager].delegate = self; |
| 104 | - [[CNLiveChatManager sharedCNLiveChatManager] joinChatRoom:roomId messageCount:10 success:^(NSString *targetId) { | 104 | + [[CNLiveChatManager sharedCNLiveChatManager] joinChatRoom:roomId messageCount:0 success:^(NSString *targetId) { |
| 105 | NSLog(@"连接聊天室成功success %@",targetId); | 105 | NSLog(@"连接聊天室成功success %@",targetId); |
| 106 | } error:^(CNLiveChatErrorCode errors, NSString *targetId) { | 106 | } error:^(CNLiveChatErrorCode errors, NSString *targetId) { |
| 107 | NSLog(@"error"); | 107 | NSLog(@"error"); |
| @@ -533,7 +533,9 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型 | @@ -533,7 +533,9 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型 | ||
| 533 | giftModel.sender = message.userInfo.name; | 533 | giftModel.sender = message.userInfo.name; |
| 534 | giftModel.giftName = [msgDic objectForKey:msgGiftName]; | 534 | giftModel.giftName = [msgDic objectForKey:msgGiftName]; |
| 535 | giftModel.icon = message.userInfo.portraitUri; | 535 | giftModel.icon = message.userInfo.portraitUri; |
| 536 | + giftModel.giftStyle = GiftStyleCombo; | ||
| 536 | 537 | ||
| 538 | + giftModel.index = [self.giftListView recGiftIndexFromGiftName:[msgDic objectForKey:msgGiftName]]; | ||
| 537 | [self.giftListView addGiftAnimationWithModel:giftModel]; | 539 | [self.giftListView addGiftAnimationWithModel:giftModel]; |
| 538 | 540 | ||
| 539 | //将消息显示到列表中 | 541 | //将消息显示到列表中 |