feat: 基本完成房间内消息列表的调整

This commit is contained in:
eggmanQQQ
2024-10-11 16:41:55 +08:00
parent b79adfa576
commit 80549b57aa
16 changed files with 311 additions and 146 deletions

View File

@@ -65,10 +65,6 @@
- (void)setLevel:(NSInteger)level {
_level = level;
// NSString *iconPicName = [NSString stringWithFormat:@"room_boom_rocket_box_%ld", (long)level];
// self.icon.image = kImage(iconPicName);
self.levelLabel.text = [NSString stringWithFormat:@"LV.%ld", (long)level];
}
@@ -226,37 +222,38 @@
make.height.mas_equalTo(kGetScaleWidth(188));
}];
UIButton *bottomButton = [self bottomButton];
[self.view addSubview:bottomButton];
[bottomButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self.view);
make.bottom.mas_equalTo(self.view).offset(-11 - kSafeAreaBottomHeight);
make.width.mas_equalTo(kGetScaleWidth(340));
make.height.mas_equalTo(kGetScaleWidth(44));
}];
_vapView = [[VAPView alloc] init];
_vapView.contentMode = UIViewContentModeScaleAspectFit;
_vapView.contentMode = UIViewContentModeScaleAspectFill;
[self.view addSubview:_vapView];
[_vapView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self.view);
make.top.mas_equalTo(self.view).offset(kGetScaleWidth(170));
make.top.mas_equalTo(self.view).offset(kGetScaleWidth(170) - kSafeAreaBottomHeight);
make.width.mas_equalTo(kGetScaleWidth(211));
make.height.mas_equalTo(kGetScaleWidth(489));
}];
[self.view addSubview:self.giftsView];
[self.giftsView mas_makeConstraints:^(MASConstraintMaker *make) {
make.bottom.mas_equalTo(bottomButton.mas_top).offset(-10);
make.centerX.mas_equalTo(self.view);
make.leading.mas_equalTo(10);
make.trailing.mas_equalTo(-10);
make.height.equalTo(self.giftsView.mas_width).multipliedBy(230.0/355.0);
make.bottom.leading.trailing.mas_equalTo(self.view);
make.height.mas_equalTo(kGetScaleWidth(230+65) + kSafeAreaBottomHeight);
}];
UIButton *bottomButton = [self bottomButton];
[self.giftsView addSubview:bottomButton];
[bottomButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self.giftsView);
make.bottom.mas_equalTo(self.view).offset(kGetScaleWidth(-11));
make.width.mas_equalTo(kGetScaleWidth(340));
make.height.mas_equalTo(kGetScaleWidth(44));
}];
UIImageView *jackpotBackgroundImageView = [self jackpotBackgroundImageView];
[self.giftsView addSubview:jackpotBackgroundImageView];
[jackpotBackgroundImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(self.giftsView);
make.bottom.mas_equalTo(self.giftsView).offset(kGetScaleWidth(-65));
make.centerX.mas_equalTo(self.giftsView);
make.width.mas_equalTo(kGetScaleWidth(355));
make.height.mas_equalTo(kGetScaleWidth(230));
}];
UIButton *helpButton = [self helpButton];
@@ -366,7 +363,8 @@
[progressBG addSubview:self.progressBar];
[self.progressBar mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(progressBG);
// make.centerX.mas_equalTo(progressBG);
make.leading.mas_equalTo(progressBG).offset(kGetScaleWidth(21.5));
make.bottom.mas_equalTo(progressBG).offset(kGetScaleWidth(-35));
make.width.mas_equalTo(kGetScaleWidth(18));
make.height.mas_equalTo(kGetScaleWidth(180)).multipliedBy(1);
@@ -376,7 +374,8 @@
[self.view addSubview:progressNumberBG];
[progressNumberBG mas_makeConstraints:^(MASConstraintMaker *make) {
make.bottom.mas_equalTo(progressBG).offset(kGetScaleWidth(-13));
make.centerX.mas_equalTo(progressBG);
// make.centerX.mas_equalTo(progressBG);
make.leading.mas_equalTo(progressBG).offset(11);
make.width.height.mas_equalTo(kGetScaleWidth(43));
}];
@@ -742,7 +741,7 @@
- (UIImageView *)jackpotBackgroundImageView {
UIImageView *bg = [[UIImageView alloc] initWithImage:kImage(@"room_boom_progress_jackpot_bg")];
bg.contentMode = UIViewContentModeScaleToFill;
bg.contentMode = UIViewContentModeScaleAspectFill;
return bg;
}

View File

@@ -114,7 +114,7 @@
- (instancetype)initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame]) {
self.backgroundColor = [UIColor yellowColor];
self.backgroundColor = [UIColor clearColor];
UIImageView *backgroundImageView = [[UIImageView alloc] initWithImage:kImage(@"boom_banner_bg")];
backgroundImageView.contentMode = UIViewContentModeScaleAspectFit;
@@ -170,7 +170,6 @@
make.right.mas_equalTo(goButton.mas_left);
make.height.mas_offset(17);
}];
}
return self;
}
@@ -197,8 +196,6 @@
- (NetImageView *)rocket {
if (!_rocket) {
_rocket = [[NetImageView alloc] init];
_rocket.backgroundColor = [UIColor purpleColor];
}
return _rocket;
}
@@ -208,10 +205,7 @@
_titleLabel = [UILabel labelInitWithText:@""
font:kFontMedium(12)
textColor:[UIColor whiteColor]];
//
_titleLabel.shadowColor = [UIColor redColor];
// (width, height)
_titleLabel.shadowColor = [UIColor grayColor];
_titleLabel.shadowOffset = CGSizeMake(2, 2);
}
return _titleLabel;

View File

@@ -25,18 +25,18 @@
dispatch_async(dispatch_get_main_queue(), ^{
@kStrongify(self);
self.icon.imageUrl = boomModel.pic;
// CGFloat progress = boomModel.speed * 1.0 / 100.0;
// if (progress == 0) {
// self.progress.hidden = YES;
// } else {
// self.progress.hidden = NO;
// [UIView animateWithDuration:0.3 animations:^{
// [self.progress mas_updateConstraints:^(MASConstraintMaker *make) {
// make.width.mas_equalTo(kGetScaleWidth(32) * progress);
// }];
// [self layoutIfNeeded];
// }];
// }
CGFloat progress = boomModel.speed * 1.0 / 100.0;
if (progress == 0) {
self.progress.hidden = YES;
} else {
self.progress.hidden = NO;
[UIView animateWithDuration:0.3 animations:^{
[self.progress mas_updateConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(kGetScaleWidth(32) * progress);
}];
[self layoutIfNeeded];
}];
}
});
}
@@ -60,7 +60,7 @@
[self.progress mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.mas_equalTo(self.progressBG);
make.leading.mas_equalTo(self.icon).offset(4.5);
make.width.mas_equalTo(kGetScaleWidth(32));
make.width.mas_equalTo(0);
make.height.mas_equalTo(5);
}];
}

View File

@@ -17,14 +17,6 @@ NS_ASSUME_NONNULL_BEGIN
with:(NSArray *)vapSources
complete:(void(^)(void))complete;
//+ (void)display:(UIView *)superView
// with:(AttachmentModel *)attachment
// complete:(void(^)(void))complete;
//
//+ (void)displayWhenEnter:(UIView *)superView
// with:(BoomInfoModel *)model
// complete:(void(^)(void))complete;
- (void)saveCurrenRoomUID:(NSInteger)room;
@end

View File

@@ -48,42 +48,16 @@
}
- (void)saveCurrenRoomUID:(NSInteger)room {
}
//+ (void)display:(UIView *)superView
// with:(AttachmentModel *)attachment
// complete:(void(^)(void))complete {
//
// if (!attachment) {
// return;
// }
//
// Boom632Model *m = [Boom632Model modelWithJSON:attachment.data];
//
// RoomBoomExplosionView *explosionView = [[RoomBoomExplosionView alloc] initWithFrame:CGRectMake(0, 0, superView.bounds.size.width, superView.bounds.size.height)];
// explosionView.userInteractionEnabled = NO;
// explosionView.completeDisplay = complete;
// [superView addSubview:explosionView];
// explosionView.model = m;
//}
//
//+ (void)displayWhenEnter:(UIView *)superView
// with:(BoomInfoModel *)model
// complete:(void(^)(void))complete {
// if (!model) {
// return;
// }
//
// RoomBoomExplosionView *explosionView = [[RoomBoomExplosionView alloc] initWithFrame:CGRectMake(0, 0, superView.bounds.size.width, superView.bounds.size.height)];
// explosionView.userInteractionEnabled = NO;
// explosionView.completeDisplay = complete;
// [superView addSubview:explosionView];
// explosionView.boomInfo = model;
//}
- (void)dealloc
{
if (self.seq != 2) {
// manager
[[RoomBoomManager sharedManager] explosionEnd];
}
[self.vapView stopHWDMP4];
[self.vapView removeFromSuperview];
self.vapView = nil;
@@ -172,10 +146,6 @@
@kStrongify(self);
[[RoomBoomManager sharedManager] explosionEnd];
[self removeFromSuperview];
// if (self.completeDisplay) {
// self.completeDisplay();
//
// }
});
}
}

View File

@@ -19,6 +19,8 @@ typedef void(^BoomEventBlock)(id sth);
- (NSArray *)loadBoomDetails;
- (void)leaveRoom;
- (void)updateBoomDetailArray:(NSArray <BoomDetailModel *> *)array;
- (void)updateBoomDetail:(BoomDetailModel *)boomDetail;
- (void)cleanBoomDetail;
@@ -40,6 +42,8 @@ typedef void(^BoomEventBlock)(id sth);
- (void)receiveNIMResponse:(AttachmentModel *)attachment;
@end
NS_ASSUME_NONNULL_END

View File

@@ -64,6 +64,10 @@
return self.boomDetailArray;
}
- (void)leaveRoom {
self.boomEventsQueue = @[].mutableCopy;
}
- (void)updateBoomDetailArray:(NSArray <BoomDetailModel *> *)array {
self.boomDetailArray = array.mutableCopy;
}
@@ -129,7 +133,7 @@
url_2 = m.endVapUrl;
} else if ([obj isKindOfClass:[RoomBoomSignVo class]]) {
url_1 = [(RoomBoomSignVo *)obj countDownVapUrl];
url_1 = [(RoomBoomSignVo *)obj endVapUrl];
url_2 = [(RoomBoomSignVo *)obj endVapUrl];
}
if (url_1.length > 0 && url_2.length > 0) {
@@ -176,7 +180,6 @@
- (void)removeEventListenerForTarget:(id)target {
@synchronized (self.progressUpdateListeners) {
NSString *key = NSStringFromClass([target class]);
for (NSDictionary *dic in self.progressUpdateListeners) {
if ([[dic allKeys] containsObject:key]) {
[self.progressUpdateListeners removeObject:dic];
@@ -187,7 +190,6 @@
@synchronized (self.ExplosionListeners) {
NSString *key = NSStringFromClass([target class]);
for (NSDictionary *dic in self.ExplosionListeners) {
if ([[dic allKeys] containsObject:key]) {
[self.ExplosionListeners removeObject:dic];
@@ -198,7 +200,6 @@
@synchronized (self.bannerListeners) {
NSString *key = NSStringFromClass([target class]);
for (NSDictionary *dic in self.bannerListeners) {
if ([[dic allKeys] containsObject:key]) {
[self.bannerListeners removeObject:dic];
@@ -209,7 +210,6 @@
@synchronized (self.boomGiftsListeners) {
NSString *key = NSStringFromClass([target class]);
for (NSDictionary *dic in self.boomGiftsListeners) {
if ([[dic allKeys] containsObject:key]) {
[self.boomGiftsListeners removeObject:dic];
@@ -220,7 +220,6 @@
@synchronized (self.enterRoomExplosionListeners) {
NSString *key = NSStringFromClass([target class]);
for (NSDictionary *dic in self.enterRoomExplosionListeners) {
if ([[dic allKeys] containsObject:key]) {
[self.enterRoomExplosionListeners removeObject:dic];
@@ -236,7 +235,6 @@
}
- (void)receiveNIMResponse:(AttachmentModel *)attachment {
// TODO:
switch (attachment.second) {
case Custom_Message_Room_Boom_EXP: {
NSLog(@" 火箭 -------- 631 : %@", attachment.data);
@@ -247,8 +245,6 @@
case Custom_Message_Room_Boom_LevelUp: {
NSLog(@" 火箭 -------- 632 : %@", attachment.data);
[self.boomEventsQueue addObject:attachment];
// [self handleExplosionUpdate:attachment];
// [self handleBannerUpdate:attachment];
[self.bannerEventsQueue addObject:attachment];
[self checkAndStartBoomEvent];
@@ -258,7 +254,6 @@
case Custom_Message_Room_Boom_Award:
NSLog(@" 火箭 -------- 633 : %@", attachment.data);
[self.giftEventsQueue addObject:attachment];
// [self handleBoomGiftUpdate:attachment];
break;
default:
break;

View File

@@ -14,12 +14,18 @@
#import "RoomInfoModel.h"
@interface MsRoomMessageMainView()<XPRoomMessageContainerViewDelegate>
@property(nonatomic,strong) XPRoomMessageContainerView *roomView;
@property(nonatomic,strong) XPRoomMessageContainerView *messageListView;
///
@property (nonatomic,weak) id<RoomHostDelegate> hostDelegate;
///
@property (nonatomic,assign) BOOL isLarge;
@property (nonatomic, strong) UIButton *buttonRoom;
@property (nonatomic, strong) UIButton *buttonChat;
@property (nonatomic, strong) UIButton *buttonGift;
@property (nonatomic, strong) UIImageView *selectedMark;
@end
@implementation MsRoomMessageMainView
@@ -28,24 +34,71 @@
self = [super init];
if (self) {
self.hostDelegate = delegate;
// TODO:
[self installUI];
[self installConstraints];
}
return self;
}
-(void)installUI{
[self addSubview:self.roomView];
[self addSubview:self.buttonRoom];
[self addSubview:self.buttonChat];
[self addSubview:self.buttonGift];
[self addSubview:self.selectedMark];
[self addSubview:self.messageListView];
}
-(void)installConstraints{
[self.roomView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(self);
[self.buttonRoom mas_makeConstraints:^(MASConstraintMaker *make) {
make.leading.top.mas_equalTo(self);
make.width.mas_equalTo(100);
make.height.mas_equalTo(40);
}];
[self.buttonChat mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self);
make.leading.mas_equalTo(self.buttonRoom.mas_trailing).offset(8);
make.width.mas_equalTo(100);
make.height.mas_equalTo(40);
}];
[self.buttonGift mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self);
make.leading.mas_equalTo(self.buttonChat.mas_trailing).offset(8);
make.width.mas_equalTo(100);
make.height.mas_equalTo(40);
}];
[self.selectedMark mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self).offset(40);
make.centerX.mas_equalTo(self.buttonRoom);
make.size.mas_equalTo(CGSizeMake(10, 3));
}];
[self.messageListView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.buttonRoom.mas_bottom).offset(16);
make.leading.bottom.trailing.mas_equalTo(self);
}];
}
- (void)showUserCard:(NSInteger)uid{
[self.roomView showUserCard:uid];
[self.messageListView showUserCard:uid];
}
- (void)didTapButton:(UIButton *)sender {
[self.messageListView changeType:sender.tag - 100];
[UIView animateWithDuration:0.2 animations:^{
[self.selectedMark mas_remakeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self).offset(40);
if (sender.tag == 101) {
make.centerX.mas_equalTo(self.buttonRoom);
} else if (sender.tag == 102) {
make.centerX.mas_equalTo(self.buttonChat);
} else {
make.centerX.mas_equalTo(self.buttonGift);
}
make.size.mas_equalTo(CGSizeMake(10, 3));
}];
[self layoutIfNeeded];
}];
}
#pragma mark - RoomGuestDelegate
@@ -53,7 +106,7 @@
UserInfoModel *infoModel = self.hostDelegate.getUserInfo;
NSString *publicChatRoomId = [NSString stringWithFormat:@"%@",[ClientConfig shareConfig].configInfo.publicChatRoomIdMap[infoModel.partitionId]];
if(![message.session.sessionId isEqualToString:publicChatRoomId]){
[self.roomView handleNIMCustomMessage:message];
[self.messageListView handleNIMCustomMessage:message];
return;
}
}
@@ -62,7 +115,7 @@
UserInfoModel *infoModel = self.hostDelegate.getUserInfo;
NSString *publicChatRoomId = [NSString stringWithFormat:@"%@",[ClientConfig shareConfig].configInfo.publicChatRoomIdMap[infoModel.partitionId]];
if(![message.session.sessionId isEqualToString:publicChatRoomId]){
[self.roomView handleNIMNotificationMessage:message];
[self.messageListView handleNIMNotificationMessage:message];
return;
}
}
@@ -71,7 +124,7 @@
UserInfoModel *infoModel = self.hostDelegate.getUserInfo;
NSString *publicChatRoomId = [NSString stringWithFormat:@"%@",[ClientConfig shareConfig].configInfo.publicChatRoomIdMap[infoModel.partitionId]];
if(![message.session.sessionId isEqualToString:publicChatRoomId]){
[self.roomView handleNIMTextMessage:message];
[self.messageListView handleNIMTextMessage:message];
return;
}
}
@@ -81,15 +134,15 @@
- (void)onRoomMiniEntered {
[self.roomView onRoomMiniEntered];
[self.messageListView onRoomMiniEntered];
}
- (void)onRoomEntered {
[self.roomView onRoomEntered];
[self.messageListView onRoomEntered];
}
- (void)onRoomUpdate {
[self.roomView onRoomUpdate];
[self.messageListView onRoomUpdate];
}
#pragma mark - XPRoomMessageContainerViewDelegate
- (void)xPRoomMessageContainerViewlDidTapEmpty:(XPRoomMessageContainerView *)view{
@@ -107,12 +160,50 @@
return 0;
}
- (XPRoomMessageContainerView *)roomView{
if(!_roomView){
_roomView = [[XPRoomMessageContainerView alloc] initWithDelegate:self.hostDelegate];
_roomView.delegate = self;
- (XPRoomMessageContainerView *)messageListView{
if(!_messageListView){
_messageListView = [[XPRoomMessageContainerView alloc] initWithDelegate:self.hostDelegate];
_messageListView.delegate = self;
}
return _roomView;
return _messageListView;
}
- (UIButton *)buttonRoom {
if (!_buttonRoom) {
_buttonRoom = [UIButton buttonWithType:UIButtonTypeCustom];
_buttonRoom.tag = 101;
[_buttonRoom setTitle:YMLocalizedString(@"RoomMessageTitle_0") forState:UIControlStateNormal];
[_buttonRoom addTarget:self action:@selector(didTapButton:) forControlEvents:UIControlEventTouchUpInside];
}
return _buttonRoom;
}
- (UIButton *)buttonChat {
if (!_buttonChat) {
_buttonChat = [UIButton buttonWithType:UIButtonTypeCustom];
_buttonChat.tag = 102;
[_buttonChat setTitle:YMLocalizedString(@"RoomMessageTitle_1") forState:UIControlStateNormal];
[_buttonChat addTarget:self action:@selector(didTapButton:) forControlEvents:UIControlEventTouchUpInside];
}
return _buttonChat;
}
- (UIButton *)buttonGift {
if (!_buttonGift) {
_buttonGift = [UIButton buttonWithType:UIButtonTypeCustom];
_buttonGift.tag = 103;
[_buttonGift setTitle:YMLocalizedString(@"RoomMessageTitle_2") forState:UIControlStateNormal];
[_buttonGift addTarget:self action:@selector(didTapButton:) forControlEvents:UIControlEventTouchUpInside];
}
return _buttonGift;
}
- (UIImageView *)selectedMark {
if (!_selectedMark) {
_selectedMark = [[UIImageView alloc] init];
_selectedMark.backgroundColor = [UIColor systemGreenColor];
}
return _selectedMark;
}
@end

View File

@@ -316,6 +316,7 @@
NSAttributedString * attribute = [self createTextAttribute:message.text color:UIColorFromRGB(0xFE5D7F) font:kRoomMessageDefalutFont];
messageInfo.content = attribute;
}
messageInfo.first = message.messageType;
return messageInfo;
}
@@ -385,6 +386,7 @@
[attribute appendAttributedString:[self createTextAttribute:YMLocalizedString(@"XPRoomMessageParser6") color:[DJDKMIMOMColor messageTextColor] font:kRoomMessageDefalutFont]];
messageInfo.content = attribute;
messageInfo.first = 10;
return messageInfo;
}
break;
@@ -393,6 +395,7 @@
if (self.hostDelegate.getRoomInfo.datingState == RoomDatingStateChangeType_Open) {
[attribute appendAttributedString:[self createTextAttribute:YMLocalizedString(@"XPRoomMessageParser8") color:[DJDKMIMOMColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
messageInfo.content = attribute;
messageInfo.first = 10;
return messageInfo;
}
}

View File

@@ -25,6 +25,8 @@ NS_ASSUME_NONNULL_BEGIN
- (void)showUserCard:(NSInteger)uid;
- (instancetype)initWithDelegate:(id<RoomHostDelegate>)delegate;
- (void)changeType:(NSInteger)type;
@end
NS_ASSUME_NONNULL_END

View File

@@ -39,7 +39,6 @@
///View
#import "XPRoomMessageTableViewCell.h"
#import "XPRoomMessageHeaderView.h"
#import "View/XPRoomMessageHeaderView.h"
#import "PIRoomMessagePhotoAlbumCell.h"
#import "PIRoomMessageUnlockPhotoAlbumView.h"
#import "PIRoomPhotoAlbumItemModel.h"
@@ -65,6 +64,8 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
@property (nonatomic,assign) BOOL isMiniEnter;
///
@property (nonatomic,strong) NSMutableArray<XPMessageInfoModel *> *datasource;
@property (nonatomic,strong) NSMutableArray<XPMessageInfoModel *> *datasource_chat;
@property (nonatomic,strong) NSMutableArray<XPMessageInfoModel *> *datasource_gift;
///
@property (nonatomic,strong) NSMutableArray<NIMMessage *> *incomingMessages;
///at
@@ -76,6 +77,8 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
@property(nonatomic,strong) PIRoomPhotoAlbumItemModel *lookUpModel;
@property(nonatomic,assign) BOOL isLoadHistoryMessage;
@property (nonatomic, assign) NSInteger displayType;
@end
@@ -88,6 +91,7 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
- (instancetype)initWithDelegate:(id<RoomHostDelegate>)delegate {
self = [super init];
if (self) {
self.displayType = 1;
self.isLoadHistoryMessage = YES;
self.hostDelegate = delegate;
[self initSubViews];
@@ -95,6 +99,36 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
}
return self;
}
- (void)changeType:(NSInteger)type {
self.displayType = type;
[self updateAllDataSource];
[self.messageTableView reloadData];
if (self.displayType == 1) {
self.messageTableView.tableHeaderView = self.headerView;
} else {
self.messageTableView.tableHeaderView = nil;
}
}
- (void)updateAllDataSource {
self.datasource_chat = @[].mutableCopy;
self.datasource_gift = @[].mutableCopy;
for (XPMessageInfoModel *model in self.datasource) {
switch (model.first) {
case NIMMessageTypeText:
[self.datasource_chat addObject:model];
break;
case CustomMessageType_Gift:
case CustomMessageType_AllMicroSend:
[self.datasource_gift addObject:model];
break;
}
}
}
- (UIView *)listView {
return self;
}
@@ -153,6 +187,7 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
NSIndexSet *set = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, kRoomMessageMaxLength/2)];
NSArray *needRemoveMsgArray = [self.datasource objectsAtIndexes:set];
[self.datasource removeObjectsInArray:needRemoveMsgArray];
[self updateAllDataSource];
NSMutableIndexSet *indexSet = [NSMutableIndexSet indexSet];
for (int i = 0; i<self.locationArray.count; i++) {///at
NSNumber *number = self.locationArray[i];
@@ -183,6 +218,7 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
}
}
}
[self updateAllDataSource];
[self.incomingMessages removeAllObjects];
[self.messageTableView reloadData];
@@ -333,8 +369,12 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
//
for (NIMMessage *item in self.incomingMessages) {
[self.datasource addObject:[self.messageParser parseMessageAttribute:item]];
XPMessageInfoModel *model = [self.messageParser parseMessageAttribute:item];
[self.datasource addObject:model];
}
[self updateAllDataSource];
[self.incomingMessages removeAllObjects];
[self.messageTableView reloadData];
@@ -344,8 +384,24 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
///
- (void)scrollToBottom:(BOOL)animated {
if(self.datasource.count > 0){
NSIndexPath *ip = [NSIndexPath indexPathForRow:self.datasource.count-1 inSection:0]; //
NSArray *source = @[];
switch (self.displayType) {
case 1:
source = self.datasource;
break;
case 2:
source = self.datasource_chat;
break;
case 3:
source = self.datasource_gift;
break;
default:
source = self.datasource;
break;
}
if(source.count > 0){
NSIndexPath *ip = [NSIndexPath indexPathForRow:source.count-1 inSection:0]; //
[self.messageTableView scrollToRowAtIndexPath:ip atScrollPosition:UITableViewScrollPositionBottom animated:animated]; //
self.atCount = 0;
self.atTipBtn.hidden = YES;
@@ -583,6 +639,8 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
NSDateComponents *compons = [PLTimeUtil compareTwoDate:date secondDate:[NSDate date]];
if (ABS(compons.year) > 0 || ABS(compons.month) > 0 || ABS(compons.day) > 0) {
NIMMessage * message = [[NIMMessage alloc] init];
NIMTipObject *tipObject = [[NIMTipObject alloc] init];
message.messageObject = tipObject;
NSString * content = [NSString stringWithFormat:YMLocalizedString(@"XPRoomMessageContainerView3"), roomInfo.introduction];
message.text = content;
message.localExt = @{@"isRoomTopic": @(NO)};
@@ -608,6 +666,8 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
}
NIMMessage * message = [[NIMMessage alloc] init];
NIMTipObject *tipObject = [[NIMTipObject alloc] init];
message.messageObject = tipObject;
message.text = YMLocalizedString(@"XPRoomMessageContainerView5");
message.localExt = @{@"isRoomTopic": @(YES)};
[message setValue:@(NIMMessageTypeTip) forKey:@"messageType"];
@@ -626,6 +686,7 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
AttachmentModel *attachment = (AttachmentModel *)obj.attachment;
if (attachment.first == CustomMessageType_Update_RoomInfo && attachment.second == Custom_Message_Sub_Update_RoomInfo_MessageState) {
[self.datasource removeAllObjects];
[self updateAllDataSource];
[self.incomingMessages removeAllObjects];
[self.locationArray removeAllObjects];
self.atCount = 0;
@@ -637,6 +698,7 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
return;
} else if (attachment.first == CustomMessageType_Update_RoomInfo && attachment.second == Custom_Message_Sub_Update_RoomInfo_CleanScreen) {
[self.datasource removeAllObjects];
[self updateAllDataSource];
[self.incomingMessages removeAllObjects];
[self.locationArray removeAllObjects];
self.atCount = 0;
@@ -783,6 +845,8 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
}
[self createUserEnterRoomAddRoomTopicMessage];
[self updateAllDataSource];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self.messageTableView reloadData];
[self scrollToBottom:YES];
@@ -810,6 +874,9 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
[self roomInfoNoGiftAnimationMessage:message];
}
[self createUserEnterRoomAddRoomTopicMessage];
[self updateAllDataSource];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self.messageTableView reloadData];
[self scrollToBottom:YES];
@@ -889,6 +956,9 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
for (NIMMessage *item in temArray) {
[self.datasource addObject:[self.messageParser parseMessageAttribute:item]];
}
[self updateAllDataSource];
[self.messageTableView reloadData];
//
[self scrollToBottom:YES];
@@ -959,31 +1029,52 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
#pragma mark - UITableViewDelegate And UITableViewDataSource
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return self.datasource.count;
switch (self.displayType) {
case 1:
return self.datasource.count;
break;
case 2:
return self.datasource_chat.count;
break;
case 3:
return self.datasource_gift.count;
break;
default:
return self.datasource.count;
break;
}
}
//- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
// XPMessageInfoModel* messageInfo = [self.datasource safeObjectAtIndex1:indexPath.row];
//
// if(messageInfo.first == CustomMessageType_Room_Album){
// return 186;
// }
//
// return messageInfo.rowHeight;
//}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
XPMessageInfoModel* attr = [self.datasource xpSafeObjectAtIndex:indexPath.row];
if(attr.first == CustomMessageType_Room_Album){
NSArray *source = @[];
switch (self.displayType) {
case 1:
source = self.datasource;
break;
case 2:
source = self.datasource_chat;
break;
case 3:
source = self.datasource_gift;
break;
default:
source = self.datasource;
break;
}
XPMessageInfoModel *model = [source xpSafeObjectAtIndex:indexPath.row];
if(model.first == CustomMessageType_Room_Album){
PIRoomMessagePhotoAlbumCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([PIRoomMessagePhotoAlbumCell class])];
cell.delegate = self;
cell.messageInfo = attr;
cell.messageInfo = model;
cell.roomType = self.hostDelegate.getRoomInfo.type;
return cell;
} else {
XPRoomMessageTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPRoomMessageTableViewCell class])];
cell.delegate = self;
cell.messageInfo = attr;
cell.messageInfo = model;
cell.roomType = self.hostDelegate.getRoomInfo.type;
return cell;
}
@@ -1156,6 +1247,20 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
return _datasource;
}
- (NSMutableArray<XPMessageInfoModel *> *)datasource_chat {
if (!_datasource_chat) {
_datasource_chat = [NSMutableArray array];
}
return _datasource_chat;
}
- (NSMutableArray<XPMessageInfoModel *> *)datasource_gift {
if (!_datasource_gift) {
_datasource_gift = [NSMutableArray array];
}
return _datasource_gift;
}
- (NSMutableArray<NIMMessage *> *)incomingMessages {
if (!_incomingMessages) {
_incomingMessages = [NSMutableArray array];

View File

@@ -286,6 +286,8 @@ XPCandyTreeInsufficientBalanceViewDelegate>
timer = nil;
}
[[RoomBoomManager sharedManager] leaveRoom];
[[CountDownHelper shareHelper] stopCountDown];
[CountDownHelper shareHelper].delegate = nil;
[[NIMSDK sharedSDK].chatroomManager removeDelegate:self];
@@ -1928,14 +1930,6 @@ XPCandyTreeInsufficientBalanceViewDelegate>
[[NSNotificationCenter defaultCenter]postNotificationName:kFreeGiftCountdownNotification object:nil userInfo:@{@"updateGiftInfo":attachment.data ?: @""}];
}
}
// else if (attachment.first == CustomMessageType_RoomBoom) {
// if (attachment.second == 631) {
// [[RoomBoomManager sharedManager] receiveNIMResponse:attachment];
// } else if (attachment.second == 633) {
// [[RoomBoomManager sharedManager] receiveNIMResponse:attachment];
// }
// }
[self.messageContainerView handleNIMCustomMessage:message];
}
} else if(message.messageType == NIMMessageTypeText) {
@@ -2345,7 +2339,7 @@ XPCandyTreeInsufficientBalanceViewDelegate>
}
- (void)getRoomBoomExplosionSuccess:(BoomInfoModel *)model {
// [[RoomBoomManager sharedManager] updateBoomDetailArray:models];
[[RoomBoomManager sharedManager] receiveEnterRoomBoom:model];
}
#pragma mark - 退

View File

@@ -3938,3 +3938,7 @@ ineHeadView12" = "الحمل";
"RoomBoom_4" = ",前去圍觀";
"RoomBoom_5" = "房間暱稱:";
"RoomBoom_6" = "Reset time: 0:00 (GMT+3) daily";
"RoomMessageTitle_0" = "房間";
"RoomMessageTitle_1" = "聊天";
"RoomMessageTitle_2" = "禮物";

View File

@@ -3734,3 +3734,7 @@
"RoomBoom_4" = ",前去圍觀";
"RoomBoom_5" = "房間暱稱:";
"RoomBoom_6" = "Reset time: 0:00 (GMT+3) daily";
"RoomMessageTitle_0" = "房間";
"RoomMessageTitle_1" = "聊天";
"RoomMessageTitle_2" = "禮物";

View File

@@ -3398,3 +3398,7 @@
"RoomBoom_4" = ",前去圍觀";
"RoomBoom_5" = "房間暱稱:";
"RoomBoom_6" = "Reset time: 0:00 (GMT+3) daily";
"RoomMessageTitle_0" = "房間";
"RoomMessageTitle_1" = "聊天";
"RoomMessageTitle_2" = "禮物";

View File

@@ -3390,3 +3390,7 @@
"RoomBoom_4" = ",前去圍觀";
"RoomBoom_5" = "房間暱稱:";
"RoomBoom_6" = "Reset time: 0:00 (GMT+3) daily";
"RoomMessageTitle_0" = "房間";
"RoomMessageTitle_1" = "聊天";
"RoomMessageTitle_2" = "禮物";