修复了动态很多个bug
This commit is contained in:
@@ -348,6 +348,7 @@
|
||||
E8098CB4282E97550090B9F0 /* XPMineBlackListPresenter.m in Sources */ = {isa = PBXBuildFile; fileRef = E8098CB3282E97550090B9F0 /* XPMineBlackListPresenter.m */; };
|
||||
E80A086227F2AC190027B30C /* RoomPKDetailInfoModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E80A086127F2AC190027B30C /* RoomPKDetailInfoModel.m */; };
|
||||
E80A086527F318620027B30C /* XPRoomPKPlayingView.m in Sources */ = {isa = PBXBuildFile; fileRef = E80A086427F318620027B30C /* XPRoomPKPlayingView.m */; };
|
||||
E80A63DC28B86B9700690914 /* MessageContentMonentsAutoView.m in Sources */ = {isa = PBXBuildFile; fileRef = E80A63DB28B86B9700690914 /* MessageContentMonentsAutoView.m */; };
|
||||
E80B0712280D0A6700A79F63 /* FansInfoModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E80B0711280D0A6700A79F63 /* FansInfoModel.m */; };
|
||||
E80B0734280D740600A79F63 /* MessageContentGuildView.m in Sources */ = {isa = PBXBuildFile; fileRef = E80B0733280D740600A79F63 /* MessageContentGuildView.m */; };
|
||||
E80B0737280D790400A79F63 /* GuildMessageModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E80B0736280D790400A79F63 /* GuildMessageModel.m */; };
|
||||
@@ -1854,6 +1855,8 @@
|
||||
E80A086127F2AC190027B30C /* RoomPKDetailInfoModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RoomPKDetailInfoModel.m; sourceTree = "<group>"; };
|
||||
E80A086327F318620027B30C /* XPRoomPKPlayingView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomPKPlayingView.h; sourceTree = "<group>"; };
|
||||
E80A086427F318620027B30C /* XPRoomPKPlayingView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPRoomPKPlayingView.m; sourceTree = "<group>"; };
|
||||
E80A63DA28B86B9700690914 /* MessageContentMonentsAutoView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MessageContentMonentsAutoView.h; sourceTree = "<group>"; };
|
||||
E80A63DB28B86B9700690914 /* MessageContentMonentsAutoView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MessageContentMonentsAutoView.m; sourceTree = "<group>"; };
|
||||
E80B0710280D0A6700A79F63 /* FansInfoModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FansInfoModel.h; sourceTree = "<group>"; };
|
||||
E80B0711280D0A6700A79F63 /* FansInfoModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FansInfoModel.m; sourceTree = "<group>"; };
|
||||
E80B0732280D740600A79F63 /* MessageContentGuildView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MessageContentGuildView.h; sourceTree = "<group>"; };
|
||||
@@ -3975,6 +3978,8 @@
|
||||
E86E79CC28A4E045006DAF48 /* MessageContentRiskAlertView.m */,
|
||||
E85E3FA528B7A6F000268DC8 /* MessageContentMonentsView.h */,
|
||||
E85E3FA628B7A6F000268DC8 /* MessageContentMonentsView.m */,
|
||||
E80A63DA28B86B9700690914 /* MessageContentMonentsAutoView.h */,
|
||||
E80A63DB28B86B9700690914 /* MessageContentMonentsAutoView.m */,
|
||||
);
|
||||
path = Content;
|
||||
sourceTree = "<group>";
|
||||
@@ -9122,6 +9127,7 @@
|
||||
E8E20BDB281645300033B688 /* SessionInfoViewController.m in Sources */,
|
||||
E8AB631C28ADE30E0023B0D2 /* XPMonentsTopicLatestPresenter.m in Sources */,
|
||||
E8E859CA28264C2300EE4857 /* WebSocket.m in Sources */,
|
||||
E80A63DC28B86B9700690914 /* MessageContentMonentsAutoView.m in Sources */,
|
||||
E8098CB4282E97550090B9F0 /* XPMineBlackListPresenter.m in Sources */,
|
||||
E8E859CC28264C2300EE4857 /* MultipartFormDataParser.m in Sources */,
|
||||
E800807C27FD84980055A8AB /* GuildInfoModel.m in Sources */,
|
||||
|
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// MessageContentMonentsAutoView.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2022/8/26.
|
||||
//
|
||||
|
||||
#import "MessageContentCustomView.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface MessageContentMonentsAutoView : MessageContentCustomView
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,109 @@
|
||||
//
|
||||
// MessageContentMonentsAutoView.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2022/8/26.
|
||||
//
|
||||
|
||||
#import "MessageContentMonentsAutoView.h"
|
||||
///Third
|
||||
#import <Masonry/Masonry.h>
|
||||
///Tool
|
||||
#import "NSObject+MJExtension.h"
|
||||
#import "ThemeColor.h"
|
||||
///Model
|
||||
#import "GuildMessageModel.h"
|
||||
@interface MessageContentMonentsAutoView ()
|
||||
|
||||
@property (nonatomic, strong) UILabel *titleLabel; // 标题
|
||||
@property (nonatomic, strong) UILabel *timeLabel; // 时间
|
||||
@property (nonatomic, strong) UILabel *messageLabel; // 内容
|
||||
@end
|
||||
|
||||
@implementation MessageContentMonentsAutoView
|
||||
|
||||
+ (CGFloat)measureHeight:(NIMMessage *)message {
|
||||
return (CONTENT_PADDING_V_TOTAL + 144);
|
||||
}
|
||||
|
||||
- (void)initSubViews {
|
||||
[super initSubViews];
|
||||
[self addSubview:self.backView];
|
||||
|
||||
[self.backView addSubview:self.titleLabel];
|
||||
[self.backView addSubview:self.timeLabel];
|
||||
[self.backView addSubview:self.messageLabel];
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
[super initSubViewConstraints];
|
||||
[self.backView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.size.mas_equalTo(CGSizeMake(200, 144));
|
||||
}];
|
||||
|
||||
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(14.5);
|
||||
make.top.mas_equalTo(10);
|
||||
}];
|
||||
|
||||
[self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.right.mas_equalTo(-14.5);
|
||||
make.centerY.mas_equalTo(self.titleLabel);
|
||||
}];
|
||||
|
||||
[self.messageLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.mas_equalTo(self).inset(14.5);
|
||||
make.top.mas_equalTo(self.titleLabel.mas_bottom).offset(12.5);
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)render:(NIMMessage *)message {
|
||||
NIMCustomObject *obj = (NIMCustomObject *)message.messageObject;
|
||||
AttachmentModel * attach = obj.attachment;
|
||||
NSDictionary * dic = attach.data;
|
||||
GuildMessageModel *model = [GuildMessageModel modelWithDictionary:dic];
|
||||
GuildMessageLayoutModel * layout = model.layout;
|
||||
if (layout) {
|
||||
self.titleLabel.text = layout.title.content;
|
||||
self.timeLabel.text = layout.time.content;
|
||||
NSMutableAttributedString *msgString = [[NSMutableAttributedString alloc] init];
|
||||
|
||||
[layout.contents enumerateObjectsUsingBlock:^(GuildMessageLayoutInfoModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
NSMutableAttributedString *string = [[NSMutableAttributedString alloc] initWithString:obj.content];
|
||||
[string addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:obj.fontSize] range:NSMakeRange(0, string.length)];
|
||||
[string addAttribute:NSForegroundColorAttributeName value:UIColorFromRGB(0x333333) range:NSMakeRange(0, string.length)];
|
||||
[msgString appendAttributedString:string];
|
||||
}];
|
||||
self.messageLabel.attributedText = msgString;
|
||||
}
|
||||
}
|
||||
|
||||
- (UILabel *)titleLabel {
|
||||
if (!_titleLabel) {
|
||||
_titleLabel = [[UILabel alloc] init];
|
||||
_titleLabel.textColor = UIColorFromRGB(0x333333);
|
||||
_titleLabel.font = [UIFont boldSystemFontOfSize:15];
|
||||
}
|
||||
return _titleLabel;
|
||||
}
|
||||
|
||||
- (UILabel *)timeLabel {
|
||||
if (!_timeLabel) {
|
||||
_timeLabel = [[UILabel alloc] init];
|
||||
_timeLabel.textColor = UIColorFromRGB(0x999999);
|
||||
_timeLabel.font = [UIFont systemFontOfSize:12];
|
||||
_timeLabel.textAlignment = NSTextAlignmentRight;
|
||||
}
|
||||
return _timeLabel;
|
||||
}
|
||||
|
||||
- (UILabel *)messageLabel {
|
||||
if (!_messageLabel) {
|
||||
_messageLabel = [[UILabel alloc] init];
|
||||
_messageLabel.textColor = UIColorFromRGB(0x333333);
|
||||
_messageLabel.font = [UIFont systemFontOfSize:14];
|
||||
_messageLabel.numberOfLines = 0;
|
||||
}
|
||||
return _messageLabel;
|
||||
}
|
||||
@end
|
@@ -33,7 +33,7 @@
|
||||
@implementation MessageContentMonentsView
|
||||
|
||||
+ (CGFloat)measureHeight:(NIMMessage *)message {
|
||||
return (CONTENT_PADDING_V_TOTAL + 80);
|
||||
return (CONTENT_PADDING_V_TOTAL + 60);
|
||||
}
|
||||
|
||||
- (void)initSubViews {
|
||||
@@ -50,7 +50,7 @@
|
||||
- (void)initSubViewConstraints {
|
||||
[super initSubViewConstraints];
|
||||
[self.backView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.size.mas_equalTo(CGSizeMake(250, 80));
|
||||
make.size.mas_equalTo(CGSizeMake(250, 60));
|
||||
}];
|
||||
|
||||
[self.monentsView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
|
@@ -23,6 +23,7 @@
|
||||
#import "MessageContentFindNewGreetView.h"
|
||||
#import "MessageContentRiskAlertView.h"
|
||||
#import "MessageContentMonentsView.h"
|
||||
#import "MessageContentMonentsAutoView.h"
|
||||
|
||||
#import "AttachmentModel.h"
|
||||
#import "NetImageView.h"
|
||||
@@ -259,7 +260,9 @@
|
||||
return @"MessageContentRiskAlertView";
|
||||
}else if(attachment.first == CustomMessageType_Monents && attachment.second == Custom_Message_Sub_Monents_Share) {
|
||||
return @"MessageContentMonentsView";
|
||||
} else {
|
||||
}else if(attachment.first == CustomMessageType_Monents && attachment.second == Custom_Message_Sub_Monents_Approved) {
|
||||
return @"MessageContentMonentsAutoView";
|
||||
} else {
|
||||
return @"MessageContentOpenLiveView";
|
||||
}
|
||||
} else {
|
||||
@@ -302,6 +305,8 @@
|
||||
return [MessageContentRiskAlertView measureHeight:message];
|
||||
} else if(attachment.first == CustomMessageType_Monents && attachment.second == Custom_Message_Sub_Monents_Share) {
|
||||
return [MessageContentMonentsView measureHeight:message];
|
||||
} else if(attachment.first == CustomMessageType_Monents && attachment.second == Custom_Message_Sub_Monents_Approved) {
|
||||
return [MessageContentMonentsAutoView measureHeight:message];
|
||||
} else {
|
||||
return [MessageContentUnSupportView measureHeight:message];
|
||||
}
|
||||
@@ -367,6 +372,11 @@
|
||||
return self.messageContent;
|
||||
}
|
||||
return [[MessageContentMonentsView alloc] init];
|
||||
}else if(attachment.first == CustomMessageType_Monents && attachment.second == Custom_Message_Sub_Monents_Approved) {
|
||||
if ([self.messageContent isKindOfClass:[MessageContentMonentsAutoView class]]) {
|
||||
return self.messageContent;
|
||||
}
|
||||
return [[MessageContentMonentsAutoView alloc] init];
|
||||
}else {
|
||||
if ([self.messageContent isKindOfClass:[MessageContentUnSupportView class]]) {
|
||||
return self.messageContent;
|
||||
|
@@ -162,6 +162,11 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/// @param dynamicId 动态的id
|
||||
/// @param worldId 话题的id
|
||||
+ (void)monentsDelete:(HttpRequestHelperCompletion)completion uid:(NSString *)uid dynamicId:(NSString *)dynamicId worldId:(NSString *)worldId;
|
||||
|
||||
/// 获取动态没有阅读数
|
||||
/// @param completion 完成
|
||||
/// @param uid uid
|
||||
+ (void)monentsUnReadCount:(HttpRequestHelperCompletion)completion uid:(NSString *)uid;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -166,16 +166,16 @@
|
||||
NSMutableDictionary * dic = [NSMutableDictionary dictionary];
|
||||
[dic setObject:uid forKey:@"uid"];
|
||||
[dic setObject:type forKey:@"type"];
|
||||
[dic setObject:content forKey:@"content"];
|
||||
|
||||
[dic setObject:content.length > 0 ? content : @"" forKey:@"content"];
|
||||
if (worldId.length > 0) {
|
||||
[dic setObject:worldId forKey:@"worldId"];
|
||||
}
|
||||
|
||||
if (resList.count > 0) {
|
||||
[dic setObject:resList forKey:@"resList"];
|
||||
}
|
||||
|
||||
[HttpRequestHelper postSkillCard:@"dynamic/publish" params:dic.toJSONString completion:completion];
|
||||
[HttpRequestHelper postSkillCard:@"dynamic/square/publish" params:dic.toJSONString completion:completion];
|
||||
}
|
||||
|
||||
|
||||
@@ -244,4 +244,11 @@
|
||||
[self makeRequest:@"dynamic/delete" method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__, uid, dynamicId, worldId, nil];
|
||||
}
|
||||
|
||||
/// 获取动态没有阅读数
|
||||
/// @param completion 完成
|
||||
/// @param uid uid
|
||||
+ (void)monentsUnReadCount:(HttpRequestHelperCompletion)completion uid:(NSString *)uid {
|
||||
[self makeRequest:@"interactive/unreadCount" method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__, uid, nil];
|
||||
}
|
||||
|
||||
@end
|
||||
|
@@ -7,11 +7,12 @@
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "XPEnum.h"
|
||||
#import "UserVipInfoVo.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
typedef NS_ENUM(NSInteger, MonentsContentType) {
|
||||
///纯文字的
|
||||
MonentsContentType_Text = 0,
|
||||
///文字 + 图片
|
||||
///图片
|
||||
MonentsContentType_Picture = 2
|
||||
};
|
||||
@class MonentsPicInfoModel;
|
||||
@@ -48,6 +49,8 @@ typedef NS_ENUM(NSInteger, MonentsContentType) {
|
||||
@property (nonatomic,strong) NSString *charmLevelPic;
|
||||
///是否置顶
|
||||
@property (nonatomic,assign) BOOL squareTop;
|
||||
///贵族信息
|
||||
@property (nonatomic, strong) UserVipInfoVo *userVipInfoVO;
|
||||
///发布的内容
|
||||
@property (nonatomic,copy) NSArray<MonentsPicInfoModel *> *dynamicResList;
|
||||
///头饰url地址
|
||||
@@ -80,6 +83,8 @@ typedef NS_ENUM(NSInteger, MonentsContentType) {
|
||||
@property (nonatomic,strong) NSMutableAttributedString *contentAttribute;
|
||||
///收起的
|
||||
@property (nonatomic,strong, nullable) NSMutableAttributedString *foldAttribute;
|
||||
// 文本行数
|
||||
@property (nonatomic, assign) NSInteger numberOfText;
|
||||
@end
|
||||
|
||||
@interface MonentsPicInfoModel : NSObject
|
||||
|
@@ -10,7 +10,7 @@
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
#define kMONENTS_CONTENT_LEFT_PADDING 67
|
||||
#define kMONENTS_CONTENT_RIGHT_PADDING 36
|
||||
#define kMONENTS_CONTENT_MAX_WIDTH (KScreenWidth -kMONENTS_CONTENT_LEFT_PADDING - kMONENTS_CONTENT_RIGHT_PADDING)
|
||||
#define kMONENTS_CONTENT_MAX_WIDTH (KScreenWidth - kMONENTS_CONTENT_LEFT_PADDING - kMONENTS_CONTENT_RIGHT_PADDING)
|
||||
#define kMONENTS_PIC_ONE_WIDTH 200 ///只有一个动态图片的高度
|
||||
#define kMONENTS_PIC_SPACE 4 ///图片之间的间隙的宽度或者高度
|
||||
#define kMONENTS_USER_INFO_HEIGHT 60 ///用户信息的高度
|
||||
|
@@ -37,6 +37,9 @@
|
||||
}
|
||||
|
||||
+ (CGFloat)monentsPicHeight:(MonentsInfoModel *)monents {
|
||||
if (monents.type == MonentsContentType_Picture) {
|
||||
|
||||
}
|
||||
///计算图片的高度
|
||||
NSInteger picCount = monents.dynamicResList.count;
|
||||
CGFloat picHeight = 0;
|
||||
@@ -64,51 +67,50 @@
|
||||
}
|
||||
|
||||
+ (CGFloat)monentsContentHeight:(MonentsInfoModel *)monents {
|
||||
if (monents.content.length <= 0) {
|
||||
monents.contentHeight = 0;
|
||||
return 0;
|
||||
}
|
||||
///计算文本的高度
|
||||
if (!monents.contentAttribute) {
|
||||
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
|
||||
///置顶
|
||||
if (monents.squareTop) {
|
||||
UIImageView *imageView = [[UIImageView alloc]init];
|
||||
imageView.frame = CGRectMake(0, 0, 36, 14);
|
||||
imageView.image = [UIImage imageNamed:@"monents_info_top"];
|
||||
NSMutableAttributedString * topAttrString = [NSMutableAttributedString yy_attachmentStringWithContent:imageView contentMode:UIViewContentModeScaleAspectFit attachmentSize:CGSizeMake(imageView.frame.size.width, imageView.frame.size.height) alignToFont:[UIFont systemFontOfSize:15.0] alignment:YYTextVerticalAlignmentCenter];
|
||||
[attribute appendAttributedString:topAttrString];
|
||||
}
|
||||
|
||||
///文本
|
||||
NSString * text = monents.content;
|
||||
if (text == nil || text.length <= 0) {
|
||||
text = @"";
|
||||
}
|
||||
NSMutableAttributedString *contentAttribute = [[NSMutableAttributedString alloc] initWithString:text attributes:nil];
|
||||
contentAttribute.yy_font = [UIFont systemFontOfSize:14];
|
||||
NSMutableParagraphStyle *paraStyle = [[NSMutableParagraphStyle alloc] init];
|
||||
paraStyle.lineSpacing = 4.0f;//行间距
|
||||
// 强制排版(从左到右)
|
||||
paraStyle.alignment = NSTextAlignmentLeft;
|
||||
paraStyle.baseWritingDirection = NSWritingDirectionLeftToRight;
|
||||
contentAttribute.yy_paragraphStyle = paraStyle;
|
||||
[attribute appendAttributedString:contentAttribute];
|
||||
monents.contentAttribute = attribute;
|
||||
NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] init];
|
||||
if (monents.squareTop ) {//动态/广场
|
||||
NSTextAttachment * attachment = [[NSTextAttachment alloc] init];
|
||||
attachment.bounds = CGRectMake(0, 0, 10, 12);
|
||||
attachment.image = [UIImage imageNamed:@"monents_info_top"];
|
||||
NSAttributedString * starAttribute = [NSMutableAttributedString attributedStringWithAttachment:(NSTextAttachment *)attachment];
|
||||
[attributedString insertAttributedString:starAttribute atIndex:0];
|
||||
//将图片插入到合适的位置
|
||||
[attributedString appendAttributedString:[self creatStrAttrByStr:@"置顶 " attributed:@{NSFontAttributeName : [UIFont systemFontOfSize:15], NSForegroundColorAttributeName: UIColorFromRGB(0xE84C46)}]];
|
||||
}
|
||||
[attributedString appendAttributedString:[self creatStrAttrByStr:monents.content attributed:@{NSFontAttributeName : [UIFont systemFontOfSize:15]}]];
|
||||
attributedString.yy_lineSpacing = 5;
|
||||
monents.contentAttribute = attributedString;
|
||||
}
|
||||
|
||||
YYTextContainer *container = [YYTextContainer new];
|
||||
container.size = CGSizeMake(kMONENTS_CONTENT_MAX_WIDTH, CGFLOAT_MAX);
|
||||
container.maximumNumberOfRows = 0;
|
||||
YYTextLayout *layout = [YYTextLayout layoutWithContainer:container text:monents.contentAttribute];
|
||||
monents.numberOfText = layout.rowCount;
|
||||
CGFloat foldHeight = 0;
|
||||
if (layout.rowCount > 6) {
|
||||
foldHeight = kMONENTS_FOLD_HEIGHT;
|
||||
if (monents.isFold) {
|
||||
container.maximumNumberOfRows = 6;
|
||||
} else {
|
||||
container.maximumNumberOfRows = 0;
|
||||
}
|
||||
NSInteger numberOfLines = monents.isFold ? 6 : 0;
|
||||
container.maximumNumberOfRows = numberOfLines;
|
||||
}
|
||||
YYTextLayout *realLayout = [YYTextLayout layoutWithContainer:container text:monents.contentAttribute];
|
||||
monents.contentHeight = realLayout.textBoundingSize.height;
|
||||
return realLayout.textBoundingSize.height + foldHeight;
|
||||
CGFloat contentHeight = realLayout.textBoundingSize.height + 15;
|
||||
monents.contentHeight =contentHeight;
|
||||
return contentHeight + foldHeight;
|
||||
}
|
||||
|
||||
+ (NSMutableAttributedString *)creatStrAttrByStr:(NSString *)str attributed:(NSDictionary *)attribute{
|
||||
if (str.length == 0 || !str) {
|
||||
str = @" ";
|
||||
}
|
||||
NSMutableAttributedString *attr = [[NSMutableAttributedString alloc] initWithString:str attributes:attribute];
|
||||
return attr;
|
||||
}
|
||||
|
||||
///计算评论的高度
|
||||
|
@@ -15,6 +15,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
- (void)xPMonentsCommentTableViewCell:(XPMonentsCommentTableViewCell *)view didClickMoreReply:(MonentsCommentModel *)commentInfo;
|
||||
///点击了某个评论
|
||||
- (void)xPMonentsCommentTableViewCell:(XPMonentsCommentTableViewCell *)view didClickCommon:(MonentsReplyModel *)commentInfo;
|
||||
///点击了头想
|
||||
- (void)xPMonentsCommentTableViewCell:(XPMonentsCommentTableViewCell *)view didClickAvatar:(NSString *)commentInfo;
|
||||
@end
|
||||
|
||||
@interface XPMonentsCommentTableViewCell : UITableViewCell
|
||||
|
@@ -22,7 +22,7 @@
|
||||
#import "XPMonentsReplyTableViewCell.h"
|
||||
#import "XPMonentsReplyMoreTableViewCell.h"
|
||||
|
||||
@interface XPMonentsCommentTableViewCell ()<UITableViewDelegate, UITableViewDataSource, XPMonentsReplyMoreTableViewCellDelegate>
|
||||
@interface XPMonentsCommentTableViewCell ()<UITableViewDelegate, UITableViewDataSource, XPMonentsReplyMoreTableViewCellDelegate, XPMonentsReplyTableViewCellDelegate>
|
||||
///容器
|
||||
@property (nonatomic,strong) UIStackView *stackView;
|
||||
///评论者
|
||||
@@ -146,6 +146,7 @@
|
||||
if (indexPath.section == 0) {
|
||||
XPMonentsReplyTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMonentsReplyTableViewCell class])];
|
||||
cell.replyInfo = [self.datasource objectAtIndex:indexPath.row];
|
||||
cell.delegate = self;
|
||||
return cell;
|
||||
}
|
||||
XPMonentsReplyMoreTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMonentsReplyMoreTableViewCell class])];
|
||||
@@ -164,6 +165,13 @@
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - XPMonentsReplyTableViewCellDelegate
|
||||
- (void)xPMonentsReplyTableViewCell:(XPMonentsReplyTableViewCell *)view didClickAvatar:(MonentsReplyModel *)replyInfo {
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(xPMonentsCommentTableViewCell:didClickAvatar:)]) {
|
||||
[self.delegate xPMonentsCommentTableViewCell:self didClickAvatar:replyInfo.uid];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - XPMonentsReplyMoreTableViewCellDelegate
|
||||
- (void)xPMonentsReplyMoreTableViewCellDidClickMoreReply:(XPMonentsReplyMoreTableViewCell *)view {
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(xPMonentsCommentTableViewCell:didClickMoreReply:)]) {
|
||||
@@ -171,6 +179,13 @@
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Event Response
|
||||
- (void)tapAvatarRecognizer {
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(xPMonentsCommentTableViewCell:didClickAvatar:)]) {
|
||||
[self.delegate xPMonentsCommentTableViewCell:self didClickAvatar:self.commentInfo.uid];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
- (void)setCommentInfo:(MonentsCommentModel *)commentInfo {
|
||||
_commentInfo = commentInfo;
|
||||
@@ -229,6 +244,9 @@
|
||||
_commentAvatarView = [[NetImageView alloc] initWithConfig:config];
|
||||
_commentAvatarView.layer.masksToBounds = YES;
|
||||
_commentAvatarView.layer.cornerRadius = 45/2.0;
|
||||
_commentAvatarView.userInteractionEnabled = YES;
|
||||
UITapGestureRecognizer * tap= [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapAvatarRecognizer)];
|
||||
[_commentAvatarView addGestureRecognizer:tap];
|
||||
}
|
||||
return _commentAvatarView;
|
||||
}
|
||||
|
@@ -8,9 +8,17 @@
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
@class MonentsReplyModel;
|
||||
@class MonentsReplyModel, XPMonentsReplyTableViewCell;
|
||||
@protocol XPMonentsReplyTableViewCellDelegate <NSObject>
|
||||
|
||||
///点击了头像
|
||||
- (void)xPMonentsReplyTableViewCell:(XPMonentsReplyTableViewCell *)view didClickAvatar:(MonentsReplyModel *)replyInfo;
|
||||
|
||||
@end
|
||||
@interface XPMonentsReplyTableViewCell : UITableViewCell
|
||||
@property (nonatomic,strong) MonentsReplyModel *replyInfo;
|
||||
///代理
|
||||
@property (nonatomic,weak) id<XPMonentsReplyTableViewCellDelegate> delegate;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -96,6 +96,13 @@
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - Event Response
|
||||
- (void)tapAvatarImage {
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(xPMonentsReplyTableViewCell:didClickAvatar:)]) {
|
||||
[self.delegate xPMonentsReplyTableViewCell:self didClickAvatar:self.replyInfo];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
- (void)setReplyInfo:(MonentsReplyModel *)replyInfo {
|
||||
_replyInfo = replyInfo;
|
||||
@@ -121,6 +128,9 @@
|
||||
_avatarImageView.layer.masksToBounds = YES;
|
||||
_avatarImageView.layer.cornerRadius = 30/2.0;
|
||||
_avatarImageView.layer.borderColor = [ThemeColor appMainColor].CGColor;
|
||||
_avatarImageView.userInteractionEnabled = YES;
|
||||
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapAvatarImage)];
|
||||
[_avatarImageView addGestureRecognizer:tap];
|
||||
}
|
||||
return _avatarImageView;
|
||||
}
|
||||
|
@@ -18,14 +18,14 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@optional
|
||||
///点击了评论
|
||||
- (void)xPMonentsTableViewCell:(XPMonentsTableViewCell *)view didClicCommon:(MonentsInfoModel *)monentsInfo;
|
||||
///点击了展开
|
||||
- (void)xPMonentsTableViewCell:(XPMonentsTableViewCell *)view didClicFold:(MonentsInfoModel *)monentsInfo;
|
||||
@end
|
||||
|
||||
@interface XPMonentsTableViewCell : UITableViewCell
|
||||
@property (nonatomic,strong) MonentsInfoModel *monentsInfo;
|
||||
///代理
|
||||
@property (nonatomic,weak) id<XPMonentsTableViewCellDelegate> delegate;
|
||||
///列表
|
||||
@property (nonatomic,weak) UITableView * tableView;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -78,6 +78,10 @@
|
||||
make.left.right.top.mas_equalTo(self.backView);
|
||||
make.height.mas_equalTo(kMONENTS_USER_INFO_HEIGHT);
|
||||
}];
|
||||
|
||||
[self.textView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(20);
|
||||
}];
|
||||
|
||||
[self.stackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.backView).offset(kMONENTS_CONTENT_LEFT_PADDING);
|
||||
@@ -129,7 +133,9 @@
|
||||
|
||||
#pragma mark - XPMonentsContentViewDelegate
|
||||
- (void)xPMonentsContentView:(XPMonentsContentView *)view didClickFold:(MonentsInfoModel *)monentsInfo {
|
||||
[self.tableView reloadData];
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(xPMonentsTableViewCell:didClicFold:)]) {
|
||||
[self.delegate xPMonentsTableViewCell:self didClicFold:monentsInfo];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - SDPhotoBrowserDelegate
|
||||
@@ -172,17 +178,17 @@
|
||||
self.photoView.dynamicResList = _monentsInfo.dynamicResList;
|
||||
self.topicView.monentsInfo = _monentsInfo;
|
||||
self.toolBarView.monentsInfo = _monentsInfo;
|
||||
if (_monentsInfo.type == MonentsContentType_Text) {
|
||||
self.photoView.hidden = YES;
|
||||
[self.photoView mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(0);
|
||||
}];
|
||||
} else {
|
||||
if (_monentsInfo.type == MonentsContentType_Picture) {
|
||||
self.photoView.hidden = NO;
|
||||
CGFloat picHeight = _monentsInfo.picHeight <=0 ? [XPMonentsLayoutConfig monentsPicHeight:_monentsInfo] : _monentsInfo.picHeight;
|
||||
[self.photoView mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(picHeight);
|
||||
}];
|
||||
} else {
|
||||
self.photoView.hidden = NO;
|
||||
[self.photoView mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(0);
|
||||
}];
|
||||
}
|
||||
|
||||
CGFloat contentHeight = _monentsInfo.contentHeight <=0 ? [XPMonentsLayoutConfig monentsContentHeight:_monentsInfo] : _monentsInfo.contentHeight;
|
||||
|
@@ -12,13 +12,14 @@
|
||||
///Tool
|
||||
#import "ThemeColor.h"
|
||||
#import "XPMonentsLayoutConfig.h"
|
||||
#import "UIButton+EnlargeTouchArea.h"
|
||||
///Model
|
||||
#import "MonentsInfoModel.h"
|
||||
@interface XPMonentsContentView ()
|
||||
///容器
|
||||
@property (nonatomic,strong) UIStackView *stackView;
|
||||
///显示内容
|
||||
@property (nonatomic,strong) YYLabel *contentLabel;
|
||||
@property (nonatomic,strong) UILabel *contentLabel;
|
||||
///折叠的按钮
|
||||
@property (nonatomic,strong) UIButton *foldButton;
|
||||
@end
|
||||
@@ -53,48 +54,35 @@
|
||||
}
|
||||
|
||||
- (NSAttributedString *)createMonentsContentAttribute {
|
||||
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
|
||||
if (self.monentsInfo.squareTop) {
|
||||
[attribute appendAttributedString:[self createImageAttribute:[UIImage imageNamed:@"monents_info_top"]]];
|
||||
}
|
||||
|
||||
NSString * text = _monentsInfo.content;
|
||||
if (text == nil || text.length <= 0) {
|
||||
text = @"";
|
||||
}
|
||||
NSMutableAttributedString *contentAttribute = [[NSMutableAttributedString alloc] initWithString:text attributes:nil];
|
||||
contentAttribute.yy_font = [UIFont systemFontOfSize:14];
|
||||
contentAttribute.yy_color = [ThemeColor mainTextColor];
|
||||
contentAttribute.yy_paragraphStyle = [self paragraphStyle];
|
||||
[attribute appendAttributedString:contentAttribute];
|
||||
return attribute;
|
||||
NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] init];
|
||||
if (self.monentsInfo.squareTop ) {//动态/广场
|
||||
NSTextAttachment * attachment = [[NSTextAttachment alloc] init];
|
||||
attachment.bounds = CGRectMake(0, 0, 10, 12);
|
||||
attachment.image = [UIImage imageNamed:@"monents_info_top"];
|
||||
NSAttributedString * starAttribute = [NSMutableAttributedString attributedStringWithAttachment:(NSTextAttachment *)attachment];
|
||||
[attributedString insertAttributedString:starAttribute atIndex:0];
|
||||
//将图片插入到合适的位置
|
||||
[attributedString appendAttributedString:[self creatStrAttrByStr:@"置顶 " attributed:@{NSFontAttributeName : [UIFont systemFontOfSize:15], NSForegroundColorAttributeName: UIColorFromRGB(0xE84C46)}]];
|
||||
}
|
||||
[attributedString appendAttributedString:[self creatStrAttrByStr:self.monentsInfo.content attributed:@{NSFontAttributeName : [UIFont systemFontOfSize:15]}]];
|
||||
attributedString.yy_lineSpacing = 5;
|
||||
return attributedString;
|
||||
}
|
||||
|
||||
/// 生成本地一个图片的富文本
|
||||
/// @param image 本地的图片
|
||||
- (NSMutableAttributedString *)createImageAttribute:(UIImage *)image {
|
||||
UIImageView *imaveView = [[UIImageView alloc]init];
|
||||
imaveView.image = image;
|
||||
CGFloat scale = (CGFloat)imaveView.image.size.width / (CGFloat)imaveView.image.size.height;
|
||||
imaveView.bounds = CGRectMake(0, 0, 20 * scale, 20);
|
||||
NSMutableAttributedString * attrString = [NSMutableAttributedString yy_attachmentStringWithContent:imaveView contentMode:UIViewContentModeScaleAspectFit attachmentSize:CGSizeMake(imaveView.frame.size.width, imaveView.frame.size.height) alignToFont:[UIFont systemFontOfSize:15.0] alignment:YYTextVerticalAlignmentCenter];
|
||||
return attrString;
|
||||
- (NSMutableAttributedString *)creatStrAttrByStr:(NSString *)str attributed:(NSDictionary *)attribute{
|
||||
if (str.length == 0 || !str) {
|
||||
str = @" ";
|
||||
}
|
||||
NSMutableAttributedString *attr = [[NSMutableAttributedString alloc] initWithString:str attributes:attribute];
|
||||
return attr;
|
||||
}
|
||||
|
||||
/// 设置文本的样式 间隙 缩进 ...
|
||||
- (NSMutableParagraphStyle *)paragraphStyle {
|
||||
NSMutableParagraphStyle *paraStyle = [[NSMutableParagraphStyle alloc] init];
|
||||
paraStyle.lineSpacing = 4.0f;//行间距
|
||||
// 强制排版(从左到右
|
||||
paraStyle.alignment = NSTextAlignmentLeft;
|
||||
paraStyle.baseWritingDirection = NSWritingDirectionLeftToRight;
|
||||
return paraStyle;
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - Event Response
|
||||
- (void)didClickFoldButton:(UIButton *)sender {
|
||||
self.monentsInfo.isFold = sender.selected;
|
||||
sender.selected = !sender.selected;
|
||||
self.monentsInfo.isFold = !sender.selected;
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(xPMonentsContentView:didClickFold:)]) {
|
||||
[self.delegate xPMonentsContentView:self didClickFold:self.monentsInfo];
|
||||
}
|
||||
@@ -105,20 +93,35 @@
|
||||
_monentsInfo = monentsInfo;
|
||||
if (_monentsInfo) {
|
||||
self.contentLabel.attributedText = [self createMonentsContentAttribute];
|
||||
YYTextContainer *container = [YYTextContainer new];
|
||||
container.size = CGSizeMake(kMONENTS_CONTENT_MAX_WIDTH, CGFLOAT_MAX);
|
||||
container.maximumNumberOfRows = 0;
|
||||
YYTextLayout *layout = [YYTextLayout layoutWithContainer:container text:self.contentLabel.attributedText];
|
||||
if (layout.rowCount > 6) {
|
||||
self.foldButton.hidden = NO;
|
||||
[self.foldButton mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(kMONENTS_FOLD_HEIGHT);
|
||||
}];
|
||||
self.foldButton.selected = !_monentsInfo.isFold;
|
||||
if (monentsInfo.numberOfText <= 0) {
|
||||
YYTextContainer *container = [YYTextContainer new];
|
||||
container.size = CGSizeMake(kMONENTS_CONTENT_MAX_WIDTH, CGFLOAT_MAX);
|
||||
container.maximumNumberOfRows = 0;
|
||||
YYTextLayout * layout = [YYTextLayout layoutWithContainer:container text:self.contentLabel.attributedText];
|
||||
if (layout.rowCount > 6) {
|
||||
self.foldButton.hidden = NO;
|
||||
[self.foldButton mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(kMONENTS_FOLD_HEIGHT);
|
||||
}];
|
||||
} else {
|
||||
self.foldButton.hidden = YES;
|
||||
[self.foldButton mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(0);
|
||||
}];
|
||||
}
|
||||
} else {
|
||||
self.foldButton.hidden = YES;
|
||||
[self.foldButton mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(0);
|
||||
}];
|
||||
if (monentsInfo.numberOfText > 6) {
|
||||
self.foldButton.hidden = NO;
|
||||
[self.foldButton mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(kMONENTS_FOLD_HEIGHT);
|
||||
}];
|
||||
} else {
|
||||
self.foldButton.hidden = YES;
|
||||
[self.foldButton mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(0);
|
||||
}];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -129,7 +132,6 @@
|
||||
_stackView.axis = UILayoutConstraintAxisVertical;
|
||||
_stackView.distribution = UIStackViewDistributionFill;
|
||||
_stackView.alignment = UIStackViewAlignmentLeading;
|
||||
_stackView.spacing = 0;
|
||||
}
|
||||
return _stackView;
|
||||
}
|
||||
@@ -149,11 +151,14 @@
|
||||
}
|
||||
|
||||
|
||||
- (YYLabel *)contentLabel {
|
||||
- (UILabel *)contentLabel {
|
||||
if (!_contentLabel) {
|
||||
_contentLabel = [[YYLabel alloc] init];
|
||||
_contentLabel.preferredMaxLayoutWidth = kMONENTS_CONTENT_MAX_WIDTH;
|
||||
_contentLabel = [[UILabel alloc] init];
|
||||
_contentLabel.numberOfLines = 0;
|
||||
_contentLabel.font = [UIFont systemFontOfSize:15];
|
||||
_contentLabel.textColor = UIColorRGBAlpha(0x333333, 1);
|
||||
_contentLabel.preferredMaxLayoutWidth = kMONENTS_CONTENT_MAX_WIDTH;
|
||||
_contentLabel.lineBreakMode = NSLineBreakByCharWrapping;
|
||||
}
|
||||
return _contentLabel;
|
||||
}
|
||||
|
@@ -17,8 +17,12 @@
|
||||
#import "MonentsInfoModel.h"
|
||||
|
||||
@interface XPMonentsUserInfoView ()
|
||||
///
|
||||
@property (nonatomic,strong) UIStackView *nickStackView;
|
||||
///头像
|
||||
@property (nonatomic,strong) NetImageView *avatarImageView;
|
||||
///贵族
|
||||
@property (nonatomic, strong) NetImageView *nobleImageView;
|
||||
///昵称
|
||||
@property (nonatomic,strong) UILabel *nickLabel;
|
||||
///性别
|
||||
@@ -76,7 +80,8 @@
|
||||
[self.tagStackView addArrangedSubview:self.firstTagImageView];
|
||||
[self.tagStackView addArrangedSubview:self.secondTagImageView];
|
||||
[self.tagStackView addArrangedSubview:self.thirdTagImageView];
|
||||
|
||||
|
||||
[self.levelStackView addArrangedSubview:self.nobleImageView];
|
||||
[self.levelStackView addArrangedSubview:self.newsUserImageView];
|
||||
[self.levelStackView addArrangedSubview:self.officalImageView];
|
||||
[self.levelStackView addArrangedSubview:self.experImageView];
|
||||
@@ -118,6 +123,10 @@
|
||||
make.top.mas_equalTo(self.avatarImageView.mas_centerY).offset(2);
|
||||
make.height.mas_equalTo(20);
|
||||
}];
|
||||
|
||||
[self.nobleImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_equalTo(20);
|
||||
}];
|
||||
|
||||
[self.newsUserImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_equalTo(20);
|
||||
@@ -201,6 +210,7 @@
|
||||
self.sexImageView.image = _monentsInfo.gender == GenderType_Female ? [UIImage imageNamed:@"common_female"] : [UIImage imageNamed:@"common_male"];
|
||||
self.officalImageView.hidden = _monentsInfo.defUser != 2;
|
||||
self.newsUserImageView.hidden = !_monentsInfo.newUser;
|
||||
self.nobleImageView.hidden = !_monentsInfo.userVipInfoVO;
|
||||
if (_monentsInfo.experLevelPic) {
|
||||
self.experImageView.imageUrl = _monentsInfo.experLevelPic;
|
||||
}
|
||||
@@ -209,6 +219,11 @@
|
||||
if (_monentsInfo.charmLevelPic) {
|
||||
self.charmImageView.imageUrl = _monentsInfo.charmLevelPic;
|
||||
}
|
||||
|
||||
if (_monentsInfo.userVipInfoVO) {
|
||||
self.nobleImageView.imageUrl = _monentsInfo.userVipInfoVO.vipIcon;
|
||||
}
|
||||
|
||||
self.charmImageView.hidden = _monentsInfo.charmLevelPic.length <= 0;
|
||||
|
||||
if (_monentsInfo.nameplateWord.length>0 && _monentsInfo.nameplatePic.length>0) {
|
||||
@@ -331,6 +346,19 @@
|
||||
return _charmImageView;
|
||||
}
|
||||
|
||||
- (NetImageView *)nobleImageView {
|
||||
if (!_nobleImageView) {
|
||||
NetImageConfig * config = [[NetImageConfig alloc] init];
|
||||
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
|
||||
config.imageType = ImageTypeUserCardLevel;
|
||||
_nobleImageView = [[NetImageView alloc] initWithConfig:config];
|
||||
_nobleImageView.userInteractionEnabled = YES;
|
||||
_nobleImageView.hidden = YES;
|
||||
_nobleImageView.contentMode = UIViewContentModeScaleAspectFit;
|
||||
}
|
||||
return _nobleImageView;
|
||||
}
|
||||
|
||||
- (UIView *)namePlateView {
|
||||
if (!_namePlateView) {
|
||||
_namePlateView = [[UIView alloc] init];
|
||||
|
@@ -163,6 +163,20 @@
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)xPMonentsTableViewCell:(XPMonentsTableViewCell *)view didClicFold:(MonentsInfoModel *)monentsInfo {
|
||||
__block MonentsInfoModel * monentsInfos;
|
||||
[self.datasource enumerateObjectsUsingBlock:^(MonentsInfoModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
if (obj.dynamicId.integerValue == monentsInfo.dynamicId.integerValue) {
|
||||
monentsInfos = obj;
|
||||
*stop = YES;
|
||||
}
|
||||
}];
|
||||
if (monentsInfos) {
|
||||
NSInteger row = [self.datasource indexOfObject:monentsInfo];
|
||||
[self.tableView reloadRowsAtIndexPaths:@[[NSIndexPath indexPathForRow:row inSection:0]] withRowAnimation:UITableViewRowAnimationNone];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark -JXCategoryListContainerViewDelegate
|
||||
- (UIView *)listView {
|
||||
return self.view;
|
||||
|
@@ -26,6 +26,7 @@
|
||||
#import "QInputBarView.h"
|
||||
#import "QKeyboardManager.h"
|
||||
#import "QEmotionBoardView.h"
|
||||
#import "XPMineUserInfoViewController.h"
|
||||
///P
|
||||
#import "XPMonentDetailPresenter.h"
|
||||
#import "XPMonentsDetailProtocol.h"
|
||||
@@ -239,7 +240,11 @@
|
||||
[self.inputBarView textViewBecomeFirstResponder];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)xPMonentsCommentTableViewCell:(XPMonentsCommentTableViewCell *)view didClickAvatar:(NSString *)commentInfo {
|
||||
XPMineUserInfoViewController * userInfoVC = [[XPMineUserInfoViewController alloc] init];
|
||||
userInfoVC.uid = commentInfo.integerValue;
|
||||
[self.navigationController pushViewController:userInfoVC animated:YES];
|
||||
}
|
||||
#pragma mark - XPMonentsTableViewCellDelegate
|
||||
- (void)xPMonentsTableViewCell:(XPMonentsTableViewCell *)view didClickLike:(MonentsInfoModel *)monentsInfo {
|
||||
[self.presenter likeMonent:monentsInfo.dynamicId status:!monentsInfo.isLike likedUid:monentsInfo.uid worldId:[NSString stringWithFormat:@"%ld", monentsInfo.worldId]];
|
||||
@@ -261,6 +266,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)xPMonentsTableViewCell:(XPMonentsTableViewCell *)view didClicFold:(MonentsInfoModel *)monentsInfo {
|
||||
self.monentsInfo = monentsInfo;
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
|
||||
#pragma mark - InputBoardDataSource
|
||||
//@return 点加号按钮弹出的拓展面板View,且无需设置frame
|
||||
- (UIView *)keyboardManagerExtendBoardView:(QKeyboardManager *)keyboardManager {
|
||||
|
@@ -126,8 +126,10 @@
|
||||
[tableView deselectRowAtIndexPath:indexPath animated:YES];
|
||||
if (self.datasource.count > 0) {
|
||||
XPMonentsDetailViewController * detailVC = [[XPMonentsDetailViewController alloc] init];
|
||||
MonentsInfoModel * monentsInfo = [self.datasource objectAtIndex:indexPath.row];
|
||||
detailVC.monentsInfo = monentsInfo;
|
||||
MonentsInteractiveModel * model = [self.datasource objectAtIndex:indexPath.row];
|
||||
MonentsInfoModel * monents = [[MonentsInfoModel alloc] init];
|
||||
monents.dynamicId = model.dynamicId;
|
||||
detailVC.monentsInfo = monents;
|
||||
[self.navigationController pushViewController:detailVC animated:YES];
|
||||
}
|
||||
}
|
||||
|
@@ -122,7 +122,6 @@
|
||||
MonentsInfoModel * monentsInfo = [self.datasource objectAtIndex:indexPath.row];
|
||||
cell.monentsInfo = monentsInfo;
|
||||
cell.delegate = self;
|
||||
cell.tableView = tableView;
|
||||
return cell;
|
||||
}
|
||||
XPMonentsEmptyTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMonentsEmptyTableViewCell class])];
|
||||
@@ -167,6 +166,20 @@
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)xPMonentsTableViewCell:(XPMonentsTableViewCell *)view didClicFold:(MonentsInfoModel *)monentsInfo {
|
||||
__block MonentsInfoModel * monentsInfos;
|
||||
[self.datasource enumerateObjectsUsingBlock:^(MonentsInfoModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
if (obj.dynamicId.integerValue == monentsInfo.dynamicId.integerValue) {
|
||||
monentsInfos = obj;
|
||||
*stop = YES;
|
||||
}
|
||||
}];
|
||||
if (monentsInfos) {
|
||||
NSInteger row = [self.datasource indexOfObject:monentsInfo];
|
||||
[self.tableView reloadRowsAtIndexPaths:@[[NSIndexPath indexPathForRow:row inSection:0]] withRowAnimation:UITableViewRowAnimationNone];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark -JXCategoryListContainerViewDelegate
|
||||
- (UIView *)listView {
|
||||
return self.view;
|
||||
|
@@ -111,6 +111,20 @@
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)xPMonentsTableViewCell:(XPMonentsTableViewCell *)view didClicFold:(MonentsInfoModel *)monentsInfo {
|
||||
__block MonentsInfoModel * monentsInfos;
|
||||
[self.datasource enumerateObjectsUsingBlock:^(MonentsInfoModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
if (obj.dynamicId.integerValue == monentsInfo.dynamicId.integerValue) {
|
||||
monentsInfos = obj;
|
||||
*stop = YES;
|
||||
}
|
||||
}];
|
||||
if (monentsInfos) {
|
||||
NSInteger row = [self.datasource indexOfObject:monentsInfo];
|
||||
[self.tableView reloadRowsAtIndexPaths:@[[NSIndexPath indexPathForRow:row inSection:0]] withRowAnimation:UITableViewRowAnimationNone];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - XPMonentsDetailViewControllerDelegate
|
||||
- (void)xPMonentsDetailViewController:(XPMonentsDetailViewController *)view deleteMonents:(NSString *)dynamicId {
|
||||
__block MonentsInfoModel * deleteInfo;
|
||||
|
@@ -380,7 +380,7 @@
|
||||
|
||||
- (void)publicButtonAction:(UIButton *)sender {
|
||||
[self.view endEditing:YES];
|
||||
if (self.textView.text.length > 0) {
|
||||
if (self.textView.text.length > 0 || self.uploadImageList.count > 0) {
|
||||
if (self.uploadImageList.count > 0) {
|
||||
[self showLoading];
|
||||
[self uploadAlbumPicList:self.uploadImageList finish:^(NSArray *list) {
|
||||
|
@@ -124,7 +124,6 @@
|
||||
MonentsInfoModel * monentsInfo = [self.datasource objectAtIndex:indexPath.row];
|
||||
cell.monentsInfo = monentsInfo;
|
||||
cell.delegate = self;
|
||||
cell.tableView = tableView;
|
||||
return cell;
|
||||
}
|
||||
XPMonentsEmptyTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMonentsEmptyTableViewCell class])];
|
||||
@@ -169,6 +168,20 @@
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)xPMonentsTableViewCell:(XPMonentsTableViewCell *)view didClicFold:(MonentsInfoModel *)monentsInfo {
|
||||
__block MonentsInfoModel * monentsInfos;
|
||||
[self.datasource enumerateObjectsUsingBlock:^(MonentsInfoModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
if (obj.dynamicId.integerValue == monentsInfo.dynamicId.integerValue) {
|
||||
monentsInfos = obj;
|
||||
*stop = YES;
|
||||
}
|
||||
}];
|
||||
if (monentsInfos) {
|
||||
NSInteger row = [self.datasource indexOfObject:monentsInfo];
|
||||
[self.tableView reloadRowsAtIndexPaths:@[[NSIndexPath indexPathForRow:row inSection:0]] withRowAnimation:UITableViewRowAnimationNone];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - XPMonentsRecommendHeaderViewDelegate
|
||||
- (void)xPMonentsRecommendHeaderView:(XPMonentsRecommendHeaderView *)view didSelectItem:(MonentsTopicModel *)info {
|
||||
XPMonentTopicContainerViewController * topicVC = [[XPMonentTopicContainerViewController alloc] init];
|
||||
|
@@ -143,6 +143,20 @@
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)xPMonentsTableViewCell:(XPMonentsTableViewCell *)view didClicFold:(MonentsInfoModel *)monentsInfo {
|
||||
__block MonentsInfoModel * monentsInfos;
|
||||
[self.datasource enumerateObjectsUsingBlock:^(MonentsInfoModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
if (obj.dynamicId.integerValue == monentsInfo.dynamicId.integerValue) {
|
||||
monentsInfos = obj;
|
||||
*stop = YES;
|
||||
}
|
||||
}];
|
||||
if (monentsInfos) {
|
||||
NSInteger row = [self.datasource indexOfObject:monentsInfo];
|
||||
[self.tableView reloadRowsAtIndexPaths:@[[NSIndexPath indexPathForRow:row inSection:0]] withRowAnimation:UITableViewRowAnimationNone];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - JXPagingViewListViewDelegate
|
||||
- (UIScrollView *)listScrollView {
|
||||
return self.tableView;
|
||||
|
@@ -159,6 +159,20 @@
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)xPMonentsTableViewCell:(XPMonentsTableViewCell *)view didClicFold:(MonentsInfoModel *)monentsInfo {
|
||||
__block MonentsInfoModel * monentsInfos;
|
||||
[self.datasource enumerateObjectsUsingBlock:^(MonentsInfoModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
if (obj.dynamicId.integerValue == monentsInfo.dynamicId.integerValue) {
|
||||
monentsInfos = obj;
|
||||
*stop = YES;
|
||||
}
|
||||
}];
|
||||
if (monentsInfos) {
|
||||
NSInteger row = [self.datasource indexOfObject:monentsInfo];
|
||||
[self.tableView reloadRowsAtIndexPaths:@[[NSIndexPath indexPathForRow:row inSection:0]] withRowAnimation:UITableViewRowAnimationNone];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - JXPagingViewListViewDelegate
|
||||
- (UIScrollView *)listScrollView {
|
||||
return self.tableView;
|
||||
|
@@ -38,6 +38,12 @@
|
||||
@property (nonatomic, strong) JXCategoryListContainerView *listContainerView;
|
||||
///发布的按钮
|
||||
@property (nonatomic,strong) UIButton *publishButton;
|
||||
///关注
|
||||
@property (nonatomic,strong) XPMonentsAttentionViewController * attentionVC ;
|
||||
///最新的
|
||||
@property (nonatomic,strong) XPMonentsLatestViewController *latestVC;
|
||||
///推荐
|
||||
@property (nonatomic,strong) XPMonentsRecommendViewController * recommendVC;
|
||||
@end
|
||||
|
||||
@implementation XPMonentsViewController
|
||||
@@ -111,17 +117,20 @@
|
||||
|
||||
// 根据下标 index 返回对应遵守并实现 `JXCategoryListContentViewDelegate` 协议的列表实例
|
||||
- (id<JXCategoryListContentViewDelegate>)listContainerView:(JXCategoryListContainerView *)listContainerView initListForIndex:(NSInteger)index {
|
||||
if (index == 0) {
|
||||
XPMonentsAttentionViewController * attentionVC = [[XPMonentsAttentionViewController alloc] init];
|
||||
return attentionVC;
|
||||
}else if (index == 1) {
|
||||
XPMonentsRecommendViewController * recommendVC = [[XPMonentsRecommendViewController alloc] init];
|
||||
return recommendVC;
|
||||
} else if(index == 2) {
|
||||
XPMonentsLatestViewController * latestVC = [[XPMonentsLatestViewController alloc] init];
|
||||
return latestVC;
|
||||
UIViewController<JXCategoryListContentViewDelegate> * list = (UIViewController<JXCategoryListContentViewDelegate> *)[self.listContainerView.validListDict objectForKey:[NSNumber numberWithInteger:index]];
|
||||
if (list) {
|
||||
return list;
|
||||
} else {
|
||||
if (index == 0) {
|
||||
return self.attentionVC;
|
||||
}else if (index == 1) {
|
||||
return self.recommendVC;
|
||||
} else if(index == 2) {
|
||||
return self.latestVC;
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
return nil;
|
||||
|
||||
}
|
||||
|
||||
#pragma mark -NIMSystemNotificationManagerDelegate
|
||||
@@ -136,11 +145,24 @@
|
||||
} else {
|
||||
self.dotView.hidden = YES;
|
||||
}
|
||||
[self setTabBarItemBadge:unreadModel.total];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setTabBarItemBadge:(NSInteger)value {
|
||||
if (value > 0) {
|
||||
if (value > 99) {
|
||||
[self.tabBarItem setBadgeValue:@"99+"];
|
||||
} else {
|
||||
[self.tabBarItem setBadgeValue:[NSString stringWithFormat:@"%ld", value]];
|
||||
}
|
||||
} else {
|
||||
[self.tabBarItem setBadgeValue:nil];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Event Response
|
||||
- (void)messageButtonAction:(UIButton *)sender {
|
||||
XPMonentsInteractiveViewController * messageVC = [[XPMonentsInteractiveViewController alloc] init];
|
||||
@@ -231,4 +253,27 @@
|
||||
return _publishButton;
|
||||
}
|
||||
|
||||
- (XPMonentsAttentionViewController *)attentionVC {
|
||||
if (!_attentionVC) {
|
||||
XPMonentsAttentionViewController * attentionVC = [[XPMonentsAttentionViewController alloc] init];
|
||||
_attentionVC = attentionVC;
|
||||
}
|
||||
return _attentionVC;
|
||||
}
|
||||
|
||||
- (XPMonentsLatestViewController *)latestVC {
|
||||
if (!_latestVC) {
|
||||
_latestVC = [[XPMonentsLatestViewController alloc] init];
|
||||
}
|
||||
return _latestVC;
|
||||
}
|
||||
|
||||
- (XPMonentsRecommendViewController *)recommendVC {
|
||||
if (!_recommendVC) {
|
||||
_recommendVC = [[XPMonentsRecommendViewController alloc] init];
|
||||
}
|
||||
return _recommendVC;
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
@@ -27,6 +27,7 @@
|
||||
#import "Api+Home.h"
|
||||
#import "XPConstant.h"
|
||||
#import "StatisticsServiceHelper.h"
|
||||
#import "Api+Monents.h"
|
||||
///Model
|
||||
#import "AccountModel.h"
|
||||
#import "RoomInfoModel.h"
|
||||
@@ -38,6 +39,7 @@
|
||||
#import "FindNewGreetMessageModel.h"
|
||||
#import "XPTabAnchorCardModel.h"
|
||||
#import "FirstRechargeModel.h"
|
||||
#import "MonentsUnReadModel.h"
|
||||
///VC
|
||||
#import "TabbarViewController.h"
|
||||
#import "BaseViewController.h"
|
||||
@@ -206,6 +208,7 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
|
||||
self.inviteCode = nil;
|
||||
}
|
||||
[self showTeenagerAlertView:userInfo];
|
||||
[self monentsUnReadCount];
|
||||
}
|
||||
|
||||
- (void)checkInviteUserInfoSuccess:(InviteUserInfoModel *)inviteInfo {
|
||||
@@ -438,6 +441,22 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
|
||||
[XCHUDTool hideHUD];
|
||||
}
|
||||
|
||||
#pragma mark - 动态
|
||||
- (void)monentsUnReadCount {
|
||||
[Api monentsUnReadCount:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
||||
if (code == 200) {
|
||||
MonentsUnReadModel * model = [MonentsUnReadModel modelWithDictionary:data.data];
|
||||
NSString *badge = model.total > 0 ? @(model.total).stringValue : nil;
|
||||
if (model.total > 99) {
|
||||
badge = @"99+";
|
||||
}
|
||||
NSUInteger index = 1;
|
||||
UITabBarItem *item = self.tabBar.items.count > index ? self.tabBar.items[index] : nil;
|
||||
[item setBadgeValue:badge];
|
||||
}
|
||||
} uid:[AccountInfoStorage instance].getUid];
|
||||
}
|
||||
|
||||
#pragma mark - 房间最小化
|
||||
- (void)configRoomMiniNView:(NSDictionary *)dic {
|
||||
UserInfoModel * userInfo = [UserInfoModel modelWithDictionary:dic[@"userInfo"]];
|
||||
|
Reference in New Issue
Block a user