Authored by 盖剑秋

定位并解决弹幕不显示的问题。

... ... @@ -107,6 +107,7 @@
self.emojiCountLabel.text = @"0";
self.timeLabel.text = @"00:00:00";
self.onlineCountLabel.text = @"0";
exit(2);
});
}
... ...
... ... @@ -270,7 +270,9 @@
}
case SOCKET_TAG_RESIVE_MSG:
{
[self.barrageViewController insertItem:resDic];
dispatch_async(dispatch_get_main_queue(), ^{
[self.barrageViewController insertItem:resDic];
});
}
break;
case SOCKET_TAG_NotifyPRAISE:
... ...
... ... @@ -113,7 +113,7 @@
[self setCornerForAvatarImageView];
NSString *avatarUrlString = [msgModel.avatar yh_splitUrlWithWidth:[NSString stringWithFormat:@"%.0lf",CGRectGetWidth(self.avatarImageView.bounds)] height:[NSString stringWithFormat:@"%.0lf",CGRectGetWidth(self.avatarImageView.bounds)]];
NSString *avatarUrlString = [msgModel.avatar yh_splitUrlWithWidth:[NSString stringWithFormat:@"%.0lf",CGRectGetWidth(self.avatarImageView.bounds)*6] height:[NSString stringWithFormat:@"%.0lf",CGRectGetWidth(self.avatarImageView.bounds)*6]];
[self.avatarImageView sd_setImageWithURL:[NSURL URLWithString:avatarUrlString] placeholderImage:nil completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
if (image) {
... ...
... ... @@ -97,14 +97,13 @@
{
__weak typeof (self) weakSelf = self;
__strong typeof (weakSelf) strongSelf = weakSelf;
if (itemDic && ![itemDic isEqual:[NSNull null]] && !IsStrEmpty([itemDic objectForKey:@"name"])) {
if (0) {
// [self greenChannel:itemDic];
} else {
if ([[itemDic objectForKey:@"cmd"] longValue] == 4 && !self.manualScrolling) {
if ([[itemDic objectForKey:@"cmd"] longValue] == 4/*user join*/ && !self.manualScrolling) {
// 如果是用户加入的消息,则不加入到缓冲区
[self newUserJoin:itemDic];
} else {
... ... @@ -112,8 +111,13 @@
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
YH_BarrageMsgModel *message = [[YH_BarrageMsgModel alloc]initWithDictionary:itemDic error:nil];
if (_messageBuffer) {
[_messageBuffer enqueue:message];
} else {
_messageBuffer = [NSMutableArray new];
[_messageBuffer enqueue:message];
}
[strongSelf->_messageBuffer enqueue:message];
dispatch_async(dispatch_get_main_queue(), ^{
if (weakSelf.manualScrolling) {
... ...