|
|
|
@@ -84,9 +84,46 @@
|
|
|
|
|
self.hostDelegate = delegate;
|
|
|
|
|
[self initSubViews];
|
|
|
|
|
[self initSubViewConstraints];
|
|
|
|
|
|
|
|
|
|
[self add__test__button];
|
|
|
|
|
}
|
|
|
|
|
return self;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void)add__test__button {
|
|
|
|
|
UIButton *b = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
|
|
|
b.titleLabel.text= @"测试按钮";
|
|
|
|
|
b.backgroundColor = [UIColor blackColor];
|
|
|
|
|
[b addTarget:self
|
|
|
|
|
action:@selector(__test__)
|
|
|
|
|
forControlEvents:UIControlEventTouchUpInside];
|
|
|
|
|
[self addSubview:b];
|
|
|
|
|
[b mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
|
make.size.mas_equalTo(CGSizeMake(100, 40));
|
|
|
|
|
make.center.mas_equalTo(CGPointMake(100, 50));
|
|
|
|
|
}];
|
|
|
|
|
}
|
|
|
|
|
- (void)__test__ {
|
|
|
|
|
NSInteger randomNum = arc4random()%1000;
|
|
|
|
|
[self updateTitleView:(randomNum > 500) ?
|
|
|
|
|
[NSString stringWithFormat:@"测试头头头头拓土偷偷头条 %ld", (long)randomNum] :
|
|
|
|
|
@""];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void)updateTitleView:(NSString *)content {
|
|
|
|
|
self.titleView.text = content;
|
|
|
|
|
|
|
|
|
|
[self.headerView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
|
make.leading.mas_equalTo(self).offset(15);
|
|
|
|
|
make.top.trailing.mas_equalTo(self);
|
|
|
|
|
if (content.length > 0) {
|
|
|
|
|
make.height.mas_greaterThanOrEqualTo(0);
|
|
|
|
|
}else {
|
|
|
|
|
make.height.mas_equalTo(0);
|
|
|
|
|
}
|
|
|
|
|
}];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#pragma mark - JXCategoryListContentViewDelegate
|
|
|
|
|
- (UIView *)listView {
|
|
|
|
|
return self;
|
|
|
|
@@ -96,16 +133,14 @@
|
|
|
|
|
}
|
|
|
|
|
#pragma mark - Response
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#pragma mark - Private Method
|
|
|
|
|
- (void)initSubViews {
|
|
|
|
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(addCustomMessage:) name:@"message" object:nil];
|
|
|
|
|
[self addSubview:self.headerView];
|
|
|
|
|
[self.headerView addSubview:self.titleView];
|
|
|
|
|
|
|
|
|
|
self.headerView.backgroundColor = [UIColor colorWithWhite:0 alpha:0.8];
|
|
|
|
|
|
|
|
|
|
[self addSubview:self.messageTableView];
|
|
|
|
|
|
|
|
|
|
[Api getPublicChatHallTopText:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
|
|
|
@@ -113,21 +148,9 @@
|
|
|
|
|
MSSessionPublicChatHallTopModel *model = [MSSessionPublicChatHallTopModel modelWithDictionary:data.data];
|
|
|
|
|
if(model != nil){
|
|
|
|
|
self.titleView.text = model.content;
|
|
|
|
|
[self.headerView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
|
make.leading.mas_equalTo(self).offset(15);
|
|
|
|
|
make.top.trailing.mas_equalTo(self);
|
|
|
|
|
make.height.mas_greaterThanOrEqualTo(0);
|
|
|
|
|
|
|
|
|
|
}];
|
|
|
|
|
}else{
|
|
|
|
|
[self.headerView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
|
make.leading.mas_equalTo(self).offset(15);
|
|
|
|
|
make.top.trailing.mas_equalTo(self);
|
|
|
|
|
make.height.mas_equalTo(0);
|
|
|
|
|
|
|
|
|
|
}];
|
|
|
|
|
} else {
|
|
|
|
|
self.titleView.text = @"";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}];
|
|
|
|
|
}
|
|
|
|
@@ -137,7 +160,6 @@
|
|
|
|
|
make.leading.mas_equalTo(self).offset(15);
|
|
|
|
|
make.top.trailing.mas_equalTo(self);
|
|
|
|
|
make.height.mas_greaterThanOrEqualTo(0);
|
|
|
|
|
|
|
|
|
|
}];
|
|
|
|
|
[self.titleView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
|
make.leading.trailing.top.bottom.equalTo(self.headerView).inset(10);
|
|
|
|
@@ -147,14 +169,8 @@
|
|
|
|
|
make.bottom.trailing.mas_equalTo(self);
|
|
|
|
|
make.top.equalTo(self.headerView.mas_bottom).mas_offset(10);
|
|
|
|
|
}];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#pragma mark - 添加数据并且做自动滚动
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -165,10 +181,7 @@
|
|
|
|
|
NSIndexPath *ip = [NSIndexPath indexPathForRow:self.datasource.count-1 inSection:0]; //取最后一行数据
|
|
|
|
|
[self.messageTableView scrollToRowAtIndexPath:ip atScrollPosition:UITableViewScrollPositionBottom animated:animated]; //滚动到最后一行
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
///自定义消息 是否可以加到 公屏 需要自己维护
|
|
|
|
@@ -179,24 +192,10 @@
|
|
|
|
|
if(attachment.first == CustomMessageType_Chat_Hall_Headlinesn && attachment.second == Custom_Message_Sub_Chat_Hall_Headlinesn){
|
|
|
|
|
MSSessionPublicChatHallTopModel *topModel = [MSSessionPublicChatHallTopModel modelWithDictionary:attachment.data];
|
|
|
|
|
if(topModel.recordStatus == 1){
|
|
|
|
|
self.titleView.text = topModel.content;
|
|
|
|
|
[self.headerView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
|
make.leading.mas_equalTo(self).offset(15);
|
|
|
|
|
make.top.trailing.mas_equalTo(self);
|
|
|
|
|
make.height.mas_equalTo(0);
|
|
|
|
|
|
|
|
|
|
}];
|
|
|
|
|
}else{
|
|
|
|
|
self.titleView.text = topModel.content;
|
|
|
|
|
[self.headerView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
|
make.leading.mas_equalTo(self).offset(15);
|
|
|
|
|
make.top.trailing.mas_equalTo(self);
|
|
|
|
|
make.height.mas_greaterThanOrEqualTo(0);
|
|
|
|
|
|
|
|
|
|
}];
|
|
|
|
|
}
|
|
|
|
|
if(topModel.recordStatus == 1){
|
|
|
|
|
self.titleView.text = @"";
|
|
|
|
|
return NO;
|
|
|
|
|
} else {
|
|
|
|
|
self.titleView.text = topModel.content;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return [[[self supportMessageDic] objectForKey:@(attachment.first)] containsObject:@(attachment.second)];
|
|
|
|
@@ -234,7 +233,7 @@
|
|
|
|
|
- (void)handleNIMCustomMessage:(NIMMessage *)message {
|
|
|
|
|
self.isMiniEnter = NO;
|
|
|
|
|
if ([self isCanDisplayMessage:message]) {
|
|
|
|
|
NIMCustomObject *obj = (NIMCustomObject *)message.messageObject;
|
|
|
|
|
// NIMCustomObject *obj = (NIMCustomObject *)message.messageObject;
|
|
|
|
|
[self addRoomMessage:message];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@@ -262,10 +261,9 @@
|
|
|
|
|
self.isMiniEnter = NO;
|
|
|
|
|
NIMNotificationObject *notiMsg = (NIMNotificationObject *)message.messageObject;
|
|
|
|
|
NIMChatroomNotificationContent *content = (NIMChatroomNotificationContent *)notiMsg.content;
|
|
|
|
|
RoomInfoModel * roomInfo = self.hostDelegate.getRoomInfo;
|
|
|
|
|
// RoomInfoModel * roomInfo = self.hostDelegate.getRoomInfo;
|
|
|
|
|
if (content.eventType == NIMChatroomEventTypeEnter) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
NIMChatroomNotificationMember *member = content.targets[0];
|
|
|
|
|
if (member.userId.integerValue == [AccountInfoStorage instance].getUid.integerValue) {
|
|
|
|
|
///自己进房成功后拉取历史消息
|
|
|
|
@@ -436,18 +434,18 @@
|
|
|
|
|
}
|
|
|
|
|
}];
|
|
|
|
|
|
|
|
|
|
self.headerView.backgroundColor = UIColorRGBAlpha(0xADF4FF, 0.2);
|
|
|
|
|
// self.headerView.backgroundColor = UIColorRGBAlpha(0xADF4FF, 0.2);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void)onRoomEntered {
|
|
|
|
|
self.headerView.backgroundColor = UIColorRGBAlpha(0xADF4FF, 0.2);
|
|
|
|
|
// self.headerView.backgroundColor = UIColorRGBAlpha(0xADF4FF, 0.2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void)onRoomUpdate {
|
|
|
|
|
///改变公屏的背景样式
|
|
|
|
|
if (self.hostDelegate.getRoomInfo.hadChangeRoomType) {
|
|
|
|
|
self.headerView.backgroundColor = UIColorRGBAlpha(0xADF4FF, 0.2);
|
|
|
|
|
// self.headerView.backgroundColor = UIColorRGBAlpha(0xADF4FF, 0.2);
|
|
|
|
|
[self.messageTableView reloadData];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|