头条优化
This commit is contained in:
@@ -370,7 +370,7 @@
|
||||
if (iPhoneXSeries) {
|
||||
bottom = (47+kSafeAreaBottomHeight+30 + 70) * scale;
|
||||
} else {
|
||||
bottom = (47+10+70 ) * scale;
|
||||
bottom = (47+10+70 + 30) * scale;
|
||||
}
|
||||
CGFloat width = rect.size.width * scale;
|
||||
CGFloat height = rect.size.height * scale;
|
||||
|
@@ -11,7 +11,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface MsRoomMessagChatHallHeadView : UIView
|
||||
@property(nonatomic,copy) NSString *content;
|
||||
|
||||
@property(nonatomic,assign) BOOL isGame;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -7,7 +7,8 @@
|
||||
|
||||
#import "MsRoomMessagChatHallHeadView.h"
|
||||
@interface MsRoomMessagChatHallHeadView()
|
||||
@property(nonatomic,strong) UILabel *titleView;
|
||||
@property(nonatomic,strong) UILabel *titleView;
|
||||
@property(nonatomic,strong) MarqueeLabel *marqueeView;
|
||||
@property(nonatomic,strong) UIImageView *bgImageView;
|
||||
@end
|
||||
@implementation MsRoomMessagChatHallHeadView
|
||||
@@ -25,6 +26,9 @@
|
||||
self.layer.masksToBounds = YES;
|
||||
[self addSubview:self.bgImageView];
|
||||
[self addSubview:self.titleView];
|
||||
[self addSubview:self.marqueeView];
|
||||
self.titleView.hidden = YES;
|
||||
self.marqueeView.hidden = YES;
|
||||
|
||||
}
|
||||
-(void)installConstraints{
|
||||
@@ -34,11 +38,20 @@
|
||||
[self.titleView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.leading.trailing.top.bottom.equalTo(self).inset(10);
|
||||
}];
|
||||
[self.marqueeView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.equalTo(self.titleView);
|
||||
}];
|
||||
}
|
||||
-(void)setContent:(NSString *)content{
|
||||
_content = content;
|
||||
_titleView.text = _content;
|
||||
|
||||
_marqueeView.text = _content;
|
||||
}
|
||||
- (void)setIsGame:(BOOL)isGame{
|
||||
_isGame = isGame;
|
||||
_titleView.numberOfLines = _isGame == YES ? 1 : 0;
|
||||
_titleView.hidden = _isGame;
|
||||
_marqueeView.hidden = !_isGame;
|
||||
}
|
||||
- (UIImage*)resizableImage:(UIImage *)image {
|
||||
//图片拉伸区域
|
||||
@@ -57,6 +70,19 @@
|
||||
}
|
||||
return _titleView;
|
||||
}
|
||||
- (MarqueeLabel *)marqueeView{
|
||||
if(!_marqueeView){
|
||||
_marqueeView = [[MarqueeLabel alloc] init];
|
||||
_marqueeView.textAlignment = NSTextAlignmentCenter;
|
||||
|
||||
_marqueeView.scrollDuration = 8.0;
|
||||
_marqueeView.fadeLength = 6.0f;
|
||||
_marqueeView.font = [UIFont systemFontOfSize:13 weight:UIFontWeightMedium];
|
||||
_marqueeView.textColor = UIColorFromRGB(0xFFF6E1);
|
||||
_marqueeView.userInteractionEnabled = YES;
|
||||
}
|
||||
return _marqueeView;
|
||||
}
|
||||
- (UIImageView *)bgImageView{
|
||||
if(!_bgImageView){
|
||||
_bgImageView = [UIImageView new];
|
||||
|
@@ -9,9 +9,11 @@
|
||||
#import "RoomHostDelegate.h"
|
||||
#import "RoomGuestDelegate.h"
|
||||
#import <JXCategoryView/JXCategoryListContainerView.h>
|
||||
#import "MSSessionPublicChatHallTopModel.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface MsRoomMessagChatHallView : UIView<RoomGuestDelegate,JXCategoryListContentViewDelegate>
|
||||
@property(nonatomic,strong) MSSessionPublicChatHallTopModel *topModel;
|
||||
- (instancetype)initWithDelegate:(id<RoomHostDelegate>)delegate;
|
||||
- (void)handleNIMImageMessage:(NIMMessage *)message;
|
||||
@end
|
||||
|
@@ -106,32 +106,28 @@
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(addCustomMessage:) name:@"message" object:nil];
|
||||
[self addSubview:self.headerView];
|
||||
[self addSubview:self.messageTableView];
|
||||
|
||||
[Api getPublicChatHallTopText:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
||||
if(code == 200){
|
||||
MSSessionPublicChatHallTopModel *model = [MSSessionPublicChatHallTopModel modelWithDictionary:data.data];
|
||||
if(model != nil){
|
||||
self.headerView.content = 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);
|
||||
|
||||
}];
|
||||
}
|
||||
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)setTopModel:(MSSessionPublicChatHallTopModel *)topModel{
|
||||
_topModel = topModel;
|
||||
if(_topModel != nil){
|
||||
self.headerView.content = _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);
|
||||
|
||||
}];
|
||||
|
||||
}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);
|
||||
|
||||
}];
|
||||
}
|
||||
|
||||
}
|
||||
- (void)initSubViewConstraints {
|
||||
[self.headerView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.leading.mas_equalTo(self).offset(15);
|
||||
@@ -139,10 +135,12 @@
|
||||
make.height.mas_greaterThanOrEqualTo(0);
|
||||
|
||||
}];
|
||||
|
||||
[self.messageTableView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.leading.mas_equalTo(self).offset(15);
|
||||
make.bottom.trailing.mas_equalTo(self);
|
||||
make.top.equalTo(self.headerView.mas_bottom).mas_offset(10);
|
||||
make.trailing.mas_equalTo(self);
|
||||
make.bottom.mas_equalTo(10);
|
||||
make.top.equalTo(self.headerView.mas_bottom).mas_offset(0);
|
||||
}];
|
||||
|
||||
|
||||
@@ -448,6 +446,8 @@
|
||||
|
||||
[self.messageTableView reloadData];
|
||||
}
|
||||
RoomInfoModel *infoModel = self.hostDelegate.getRoomInfo;
|
||||
self.headerView.isGame = infoModel.type == RoomType_MiniGame;
|
||||
}
|
||||
|
||||
|
||||
@@ -534,37 +534,7 @@
|
||||
}
|
||||
#pragma mark - PIRoomMessageUnlockPhotoAlbumViewDelegate
|
||||
- (void)unlockRoomAlbumImageWithAlbumModel:(PIRoomPhotoAlbumItemModel *)albumModel{
|
||||
[XNDJTDDLoadingTool showLoading];
|
||||
[Api unlockRoomAlbumPhoto:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
||||
|
||||
[XNDJTDDLoadingTool hideHUD];
|
||||
if(code == 200){
|
||||
NSMutableDictionary *getData = [NSMutableDictionary dictionary];
|
||||
[getData addEntriesFromDictionary:data.data];
|
||||
AttachmentModel *attachment = [[AttachmentModel alloc] init];
|
||||
attachment.first = CustomMessageType_Gift;
|
||||
attachment.second = Custom_Message_Sub_Gift_Send;
|
||||
NSDictionary *targetUsers = ((NSArray *)[getData objectForKey:@"targetUsers"]).firstObject;
|
||||
[getData setObject:[targetUsers valueForKeyPath:@"uid"] forKey:@"targetUid"];
|
||||
[getData setObject:[targetUsers valueForKeyPath:@"nick"] forKey:@"targetNick"];
|
||||
[getData setObject:[targetUsers valueForKeyPath:@"avatar"] forKey:@"targetAvatar"];
|
||||
[getData setObject:@(YES) forKey:@"isRoomAlbum"];
|
||||
attachment.data = getData;
|
||||
[self sendCustomMessage:attachment];
|
||||
if(albumModel.ID != nil){
|
||||
if(![[XPSkillCardPlayerManager shareInstance].photoIdList containsObject:albumModel.ID]){
|
||||
if([XPSkillCardPlayerManager shareInstance].photoIdList == nil){
|
||||
[XPSkillCardPlayerManager shareInstance].photoIdList = [NSMutableArray arrayWithArray:@[albumModel.ID]];
|
||||
}else{
|
||||
[[XPSkillCardPlayerManager shareInstance].photoIdList addObject:albumModel.ID];
|
||||
}
|
||||
}
|
||||
[[NSNotificationCenter defaultCenter]postNotificationName:@"kGetgetUnlockRoomAlbumPhotoListNot" object:nil];
|
||||
}
|
||||
return;
|
||||
}
|
||||
[XNDJTDDLoadingTool showErrorWithMessage:msg];
|
||||
} id:albumModel.ID roomUid:@(self.hostDelegate.getRoomInfo.uid).stringValue];
|
||||
|
||||
}
|
||||
- (void)sendCustomMessage:(AttachmentModel *)attachment {
|
||||
|
||||
@@ -623,6 +593,8 @@
|
||||
- (MsRoomMessagChatHallHeadView *)headerView {
|
||||
if (!_headerView) {
|
||||
_headerView = [[MsRoomMessagChatHallHeadView alloc] initWithFrame:CGRectZero];
|
||||
RoomInfoModel *infoModel = self.hostDelegate.getRoomInfo;
|
||||
_headerView.isGame = infoModel.type == RoomType_MiniGame;
|
||||
}
|
||||
return _headerView;
|
||||
}
|
||||
|
@@ -13,6 +13,8 @@
|
||||
#import "ClientConfig.h"
|
||||
#import "UserInfoModel.h"
|
||||
#import <NIMSDK/NIMSDK.h>
|
||||
#import "Api+Message.h"
|
||||
#import "MSSessionPublicChatHallTopModel.h"
|
||||
@interface MsRoomMessageMainView()<JXCategoryViewDelegate, JXCategoryListContainerViewDelegate>
|
||||
///分页标题
|
||||
@property (nonatomic, strong) NSArray<NSString *> *titles;
|
||||
@@ -41,6 +43,14 @@
|
||||
-(void)installUI{
|
||||
[self addSubview:self.titleView];
|
||||
[self addSubview:self.pi_containerView];
|
||||
[Api getPublicChatHallTopText:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
||||
if(code == 200){
|
||||
MSSessionPublicChatHallTopModel *model = [MSSessionPublicChatHallTopModel modelWithDictionary:data.data];
|
||||
self.chatHallView.topModel = model;
|
||||
self.roomView.topModel = model;
|
||||
|
||||
}
|
||||
}];
|
||||
}
|
||||
-(void)installConstraints{
|
||||
[self.titleView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
|
@@ -9,9 +9,11 @@
|
||||
#import "RoomHostDelegate.h"
|
||||
#import "RoomGuestDelegate.h"
|
||||
#import <JXCategoryView/JXCategoryListContainerView.h>
|
||||
#import "MSSessionPublicChatHallTopModel.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface XPRoomMessageContainerView : UIView<RoomGuestDelegate,JXCategoryListContentViewDelegate>
|
||||
@property(nonatomic,strong) MSSessionPublicChatHallTopModel *topModel;
|
||||
- (void)showUserCard:(NSInteger)uid;
|
||||
- (instancetype)initWithDelegate:(id<RoomHostDelegate>)delegate;
|
||||
|
||||
|
@@ -35,6 +35,7 @@
|
||||
#import "XPMessageInfoModel.h"
|
||||
#import "GiftReceiveInfoModel.h"
|
||||
#import "XPGiftStorage.h"
|
||||
#import "MsRoomMessagChatHallHeadView.h"
|
||||
///View
|
||||
#import "XPRoomMessageTableViewCell.h"
|
||||
#import "XPRoomMessageHeaderView.h"
|
||||
@@ -50,7 +51,8 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
|
||||
@interface XPRoomMessageContainerView ()<UITableViewDelegate, UITableViewDataSource, XPRoomMessageTableViewCellDelegate, UIGestureRecognizerDelegate,PIRoomMessagePhotoAlbumCellDelegate,SDPhotoBrowserDelegate,PIRoomMessageUnlockPhotoAlbumViewDelegate>
|
||||
///房间的代理
|
||||
@property (nonatomic,weak) id<RoomHostDelegate> hostDelegate;
|
||||
|
||||
///头条
|
||||
@property (nonatomic,strong) MsRoomMessagChatHallHeadView *headlineView;
|
||||
///列表
|
||||
@property (nonatomic,strong) UITableView *messageTableView;
|
||||
///头部
|
||||
@@ -247,6 +249,7 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
|
||||
#pragma mark - Private Method
|
||||
- (void)initSubViews {
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(addCustomMessage:) name:@"message" object:nil];
|
||||
[self addSubview:self.headlineView];
|
||||
[self addSubview:self.messageTableView];
|
||||
[self addSubview:self.messageTipsBtn];
|
||||
[self addSubview:self.atTipBtn];
|
||||
@@ -254,10 +257,16 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
[self.headlineView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.leading.mas_equalTo(self).offset(15);
|
||||
make.top.trailing.mas_equalTo(self);
|
||||
make.height.mas_greaterThanOrEqualTo(0);
|
||||
|
||||
}];
|
||||
[self.messageTableView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.leading.mas_equalTo(self).offset(15);
|
||||
make.bottom.trailing.mas_equalTo(self);
|
||||
make.top.mas_equalTo(self);
|
||||
make.top.equalTo(self.headlineView.mas_bottom).mas_offset(0);
|
||||
}];
|
||||
|
||||
[self.messageTipsBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
@@ -273,7 +282,27 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
|
||||
make.leading.mas_equalTo(self);
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)setTopModel:(MSSessionPublicChatHallTopModel *)topModel{
|
||||
_topModel = topModel;
|
||||
if(_topModel != nil){
|
||||
self.headlineView.content = _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);
|
||||
|
||||
}];
|
||||
|
||||
}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);
|
||||
|
||||
}];
|
||||
}
|
||||
|
||||
}
|
||||
///是否是当前房间
|
||||
- (BOOL)isCurrentRoom:(NSString *)sessionId {
|
||||
if ([sessionId isEqualToString:[NSString stringWithFormat:@"%ld", self.hostDelegate.getRoomInfo.roomId]]) {
|
||||
@@ -412,6 +441,27 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
|
||||
if (giftInfo.giftType == GiftType_super){
|
||||
return NO;
|
||||
}
|
||||
}else 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.headlineView.content = topModel.content;
|
||||
[self.headlineView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
make.leading.mas_equalTo(self).offset(15);
|
||||
make.top.trailing.mas_equalTo(self);
|
||||
make.height.mas_equalTo(0);
|
||||
|
||||
}];
|
||||
|
||||
}else{
|
||||
self.headlineView.content = topModel.content;
|
||||
[self.headlineView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
make.leading.mas_equalTo(self).offset(15);
|
||||
make.top.trailing.mas_equalTo(self);
|
||||
make.height.mas_greaterThanOrEqualTo(0);
|
||||
|
||||
}];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -913,6 +963,8 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
|
||||
self.headerView.bubbleColor = self.hostDelegate.getRoomInfo.type == RoomType_MiniGame ? [UIColor colorWithWhite:1 alpha:0.2] : [UIColor colorWithWhite:1 alpha:0.3];
|
||||
[self.messageTableView reloadData];
|
||||
}
|
||||
RoomInfoModel *infoModel = self.hostDelegate.getRoomInfo;
|
||||
self.headlineView.isGame = infoModel.type == RoomType_MiniGame;
|
||||
}
|
||||
|
||||
#pragma mark - ScrollViewDelegate
|
||||
@@ -1185,5 +1237,13 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
|
||||
}
|
||||
return _messageParser;
|
||||
}
|
||||
- (MsRoomMessagChatHallHeadView *)headlineView {
|
||||
if (!_headlineView) {
|
||||
_headlineView = [[MsRoomMessagChatHallHeadView alloc] initWithFrame:CGRectZero];
|
||||
RoomInfoModel *infoModel = self.hostDelegate.getRoomInfo;
|
||||
_headlineView.isGame = infoModel.type == RoomType_MiniGame;
|
||||
}
|
||||
return _headlineView;
|
||||
}
|
||||
|
||||
@end
|
||||
|
@@ -644,9 +644,9 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
|
||||
}];
|
||||
CGFloat height = 70;
|
||||
if (iPhoneXSeries) {
|
||||
height = 70;
|
||||
height = 100;
|
||||
} else {
|
||||
height = 50;
|
||||
height = 80;
|
||||
}
|
||||
[self.messageContainerView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(height);
|
||||
|
Reference in New Issue
Block a user