动态消息列表

This commit is contained in:
fengshuo
2022-05-20 20:50:35 +08:00
parent 465e73b6f1
commit fe8747ce5e
21 changed files with 638 additions and 18 deletions

View File

@@ -573,6 +573,9 @@
E8788948273A55D000BF1D57 /* XPGiftBarView.m in Sources */ = {isa = PBXBuildFile; fileRef = E8788947273A55D000BF1D57 /* XPGiftBarView.m */; };
E878894C273A607C00BF1D57 /* XPGiftUserCollectionViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E878894B273A607C00BF1D57 /* XPGiftUserCollectionViewCell.m */; };
E8788950273A699900BF1D57 /* ThemeColor+SendGift.m in Sources */ = {isa = PBXBuildFile; fileRef = E878894F273A699900BF1D57 /* ThemeColor+SendGift.m */; };
E878B8582835F0D300E22DCF /* MonentsInteractiveModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E878B8572835F0D300E22DCF /* MonentsInteractiveModel.m */; };
E878B85B2835F3BF00E22DCF /* XPMonentsInteractiveTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E878B85A2835F3BF00E22DCF /* XPMonentsInteractiveTableViewCell.m */; };
E878B85E283640A500E22DCF /* MonentsUnReadModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E878B85D283640A500E22DCF /* MonentsUnReadModel.m */; };
E87A24F1272935920086A794 /* XPMessageRemoteExtModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E87A24F0272935920086A794 /* XPMessageRemoteExtModel.m */; };
E87A26F627587C48002DDC7A /* XPHomePartyContainerViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E87A26F527587C48002DDC7A /* XPHomePartyContainerViewController.m */; };
E87A26F927587C62002DDC7A /* XPHomeContainerPresenter.m in Sources */ = {isa = PBXBuildFile; fileRef = E87A26F827587C62002DDC7A /* XPHomeContainerPresenter.m */; };
@@ -2107,6 +2110,12 @@
E878894D273A672200BF1D57 /* XPGiftProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPGiftProtocol.h; sourceTree = "<group>"; };
E878894E273A699900BF1D57 /* ThemeColor+SendGift.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "ThemeColor+SendGift.h"; sourceTree = "<group>"; };
E878894F273A699900BF1D57 /* ThemeColor+SendGift.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "ThemeColor+SendGift.m"; sourceTree = "<group>"; };
E878B8562835F0D300E22DCF /* MonentsInteractiveModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MonentsInteractiveModel.h; sourceTree = "<group>"; };
E878B8572835F0D300E22DCF /* MonentsInteractiveModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MonentsInteractiveModel.m; sourceTree = "<group>"; };
E878B8592835F3BF00E22DCF /* XPMonentsInteractiveTableViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMonentsInteractiveTableViewCell.h; sourceTree = "<group>"; };
E878B85A2835F3BF00E22DCF /* XPMonentsInteractiveTableViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPMonentsInteractiveTableViewCell.m; sourceTree = "<group>"; };
E878B85C283640A500E22DCF /* MonentsUnReadModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MonentsUnReadModel.h; sourceTree = "<group>"; };
E878B85D283640A500E22DCF /* MonentsUnReadModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MonentsUnReadModel.m; sourceTree = "<group>"; };
E87A24EF272935920086A794 /* XPMessageRemoteExtModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMessageRemoteExtModel.h; sourceTree = "<group>"; };
E87A24F0272935920086A794 /* XPMessageRemoteExtModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPMessageRemoteExtModel.m; sourceTree = "<group>"; };
E87A26F427587C48002DDC7A /* XPHomePartyContainerViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPHomePartyContainerViewController.h; sourceTree = "<group>"; };
@@ -4934,6 +4943,10 @@
E81A653B2834E9AE00F55894 /* MonentsListInfoModel.m */,
E81A6544283519CA00F55894 /* MonentsTopicModel.h */,
E81A6545283519CA00F55894 /* MonentsTopicModel.m */,
E878B8562835F0D300E22DCF /* MonentsInteractiveModel.h */,
E878B8572835F0D300E22DCF /* MonentsInteractiveModel.m */,
E878B85C283640A500E22DCF /* MonentsUnReadModel.h */,
E878B85D283640A500E22DCF /* MonentsUnReadModel.m */,
);
path = Model;
sourceTree = "<group>";
@@ -7048,6 +7061,8 @@
E8098CAD282E07C00090B9F0 /* XPMonentsEmptyTableViewCell.m */,
E81A654A28351D9900F55894 /* XPMonentsTopicCollectionViewCell.h */,
E81A654B28351D9900F55894 /* XPMonentsTopicCollectionViewCell.m */,
E878B8592835F3BF00E22DCF /* XPMonentsInteractiveTableViewCell.h */,
E878B85A2835F3BF00E22DCF /* XPMonentsInteractiveTableViewCell.m */,
);
path = Cell;
sourceTree = "<group>";
@@ -8204,6 +8219,7 @@
E81D58822720082A003063FE /* MicroWaveView.m in Sources */,
E8A73F8728586A6F00FD9CBC /* XPGiftWeekStarCollectionViewCell.m in Sources */,
E8B825C226EA00DF009E8E9F /* LoginVerifCodePresent.m in Sources */,
E878B85B2835F3BF00E22DCF /* XPMonentsInteractiveTableViewCell.m in Sources */,
9B9EEF4E27C8755C006B0EB3 /* XPSkillCardResourcePropModel.m in Sources */,
E88B5CB026FB1C6500DA9178 /* XPMineTeenagerPresenter.m in Sources */,
E800163B28041F7B00D6D17A /* XPGuildSingleRoomIncomeTableViewCell.m in Sources */,
@@ -8480,6 +8496,7 @@
E8C1CD7027D894B800376F83 /* RoomFaceTitleItemModel.m in Sources */,
189DD73D26E21C3F00AB55B1 /* YYUtility+Device.m in Sources */,
187EEEDC26E89B32002833B2 /* BaseModel.m in Sources */,
E878B85E283640A500E22DCF /* MonentsUnReadModel.m in Sources */,
E81366FC26F0D2980076364C /* UIButton+EnlargeTouchArea.m in Sources */,
E824546426F5FF1C00BE8163 /* XPMineResetPayPasswordPresenter.m in Sources */,
E877A7EE278428FB00EFACED /* MicroDatingProgressView.m in Sources */,
@@ -8527,6 +8544,7 @@
189DD74526E21CCC00AB55B1 /* YYReachability.m in Sources */,
E82109AD26F1C8A000FC3319 /* CountDownHelper.m in Sources */,
E8A6C28C27CF436300AC7442 /* XPHomeLikeViewController.m in Sources */,
E878B8582835F0D300E22DCF /* MonentsInteractiveModel.m in Sources */,
9BCF586227995426008401A4 /* XPSkillCardSelectPropCell.m in Sources */,
9BD2ECCE288F829600F5CD9A /* XPMineFootPrintViewController.m in Sources */,
E86A16BF2856D4D5004228B8 /* XPSessionFindNewGreetListView.m in Sources */,

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "monents_interactive_delete_message@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "monents_interactive_delete_message@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 503 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 898 B

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "monents_nav_interavtive_message@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "monents_nav_interavtive_message@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 517 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 787 B

View File

@@ -50,6 +50,8 @@ typedef NS_ENUM(NSUInteger, CustomMessageType) {
CustomMessageType_Room_GiftValue = 42,
///公会超管
CustomMessageType_Hall_Super_Admin = 50,
///动态
CustomMessageType_Monents = 52,
///收藏房间
CustomMessageType_Collection_Room = 59,
///福袋消息
@@ -292,6 +294,18 @@ typedef NS_ENUM(NSInteger, CustomMessageSubHallSuperAdmin) {
Custom_Message_Sub_Hall_Super_Admin_Kick_Manager_Out_Room = 508,
};
/// first == CustomMessageType_Monents
typedef NS_ENUM(NSUInteger, Custom_Noti_Sub_Dynamic) {
///未读更新
Custom_Message_Sub_Monents_Unread_Update = 521,
/// 违禁删除
Custom_Message_Sub_Monents_Ban_Delete = 522,
/// 动态审核通过
Custom_Message_Sub_Monents_Approved = 523,
/// app内分享动态
Custom_Message_Sub_Monents_Share = 524,
};
///first = CustomMessageType_Collection_Room
typedef NS_ENUM(NSUInteger, CustomMessageSubCollectRoom) {
/// 福袋礼物房间飘屏通知

View File

@@ -38,6 +38,11 @@ NS_ASSUME_NONNULL_BEGIN
/// @param uid 类型 uid
+ (void)monentsInteractiveList:(HttpRequestHelperCompletion)completion dynamicId:(NSString *)dynamicId pageSize:(NSString *)pageSize uid:(NSString *)uid;
/// 清空互动消息
/// @param complection 完成
/// @param uid 用户的uid
+ (void)monentsInteractiveClear:(HttpRequestHelperCompletion)complection uid:(NSString *)uid;
/// 获取话题列表
/// @param completion 完成
/// @param uid uid

View File

@@ -49,6 +49,13 @@
[HttpRequestHelper request:@"interactive/list" method:HttpRequestHelperMethodPOST params:dic completion:completion];
}
///
/// @param complection
/// @param uid uid
+ (void)monentsInteractiveClear:(HttpRequestHelperCompletion)complection uid:(NSString *)uid {
[self makeRequest:@"interactive/clear" method:HttpRequestHelperMethodPOST completion:complection, __FUNCTION__, uid, nil];
}
///
/// @param completion
/// @param uid uid

View File

@@ -0,0 +1,65 @@
//
// MonentsInteractiveModel.h
// xplan-ios
//
// Created by 冯硕 on 2022/5/19.
//
#import <Foundation/Foundation.h>
#import "MonentsInfoModel.h"
#import "XPEnum.h"
NS_ASSUME_NONNULL_BEGIN
typedef NS_ENUM(NSInteger, MonentsInteractiveActionType) {
///评论
MonentsInteractiveActionType_Comment = 1,
///回复
MonentsInteractiveActionType_Reply,
///点赞
MonentsInteractiveActionType_Like,
///分享
MonentsInteractiveActionType_Share
};
@interface MonentsInteractiveModel : NSObject
///msgType为2时为评论id
@property (nonatomic,assign) NSInteger targetId;
///类型 0纯文本2图片
@property (nonatomic,assign) MonentsContentType type;
///动态内容
@property (nonatomic,copy) NSString *content;
///性别
@property (nonatomic,assign) GenderType gender;
///年龄
@property (nonatomic,assign) NSInteger age;
///动态id
@property (nonatomic,copy) NSString *dynamicId;
///消息id
@property (nonatomic,copy) NSString *msgId;
///用户的uid
@property (nonatomic,assign) NSInteger uid;
///动作类型1-评论,2-回复,3-点赞,4-分享
@property (nonatomic,assign) MonentsInteractiveActionType actionType;
///消息,如"赞了你的动态"
@property (nonatomic,copy) NSString *message;
///类型1-动态2-评论(回复也算评论)
@property (nonatomic,assign) NSInteger msgType;
///昵称
@property (nonatomic,copy) NSString *nick;
///头像
@property (nonatomic,copy) NSString *avatar;
///目标对象uid
@property (nonatomic,copy) NSString *targetUid;
///发布时间
@property (nonatomic,copy) NSString *publishTime;
///动态发布者uid
@property (nonatomic,copy) NSString *dynamicUid;
///话题id
@property (nonatomic,copy) NSString *worldId;
///话题的名称
@property (nonatomic,copy) NSString *worldName;
///动态的图片
@property (nonatomic,strong) MonentsPicInfoModel *dynamicRes;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,12 @@
//
// MonentsInteractiveModel.m
// xplan-ios
//
// Created by on 2022/5/19.
//
#import "MonentsInteractiveModel.h"
@implementation MonentsInteractiveModel
@end

View File

@@ -0,0 +1,25 @@
//
// MonentsUnReadModel.h
// xplan-ios
//
// Created by 冯硕 on 2022/5/19.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface MonentsUnReadModel : NSObject
/// 总计未读消息数
@property (nonatomic, assign) NSInteger total;
/// 评论未读消息数
@property (nonatomic, assign) NSInteger comment;
/// 分享未读消息数
@property (nonatomic, assign) NSInteger share;
/// 回复未读消息数
@property (nonatomic, assign) NSInteger reply;
/// 点赞未读消息数
@property (nonatomic, assign) NSInteger like;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,12 @@
//
// MonentsUnReadModel.m
// xplan-ios
//
// Created by on 2022/5/19.
//
#import "MonentsUnReadModel.h"
@implementation MonentsUnReadModel
@end

View File

@@ -16,6 +16,9 @@ NS_ASSUME_NONNULL_BEGIN
/// @param pageSize 一页的个数
/// @param state 状态
- (void)getMonentsInteractiveList:(NSString *)dynamicId pageSize:(int)pageSize state:(int)state;
///清空互动消息
- (void)clearInteractiveMessage;
@end
NS_ASSUME_NONNULL_END

View File

@@ -9,6 +9,7 @@
#import "Api+Monents.h"
#import "XPMonentsInteractiveProtocol.h"
#import "AccountInfoStorage.h"
#import "MonentsInteractiveModel.h"
@implementation XPMonentsInteractivePresenter
@@ -21,11 +22,19 @@
NSString * pageSizeStr = [NSString stringWithFormat:@"%d", pageSize];
NSString * uid = [AccountInfoStorage instance].getUid;
[Api monentsInteractiveList:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
NSArray * array;
NSArray * array = [MonentsInteractiveModel modelsWithArray:data.data];
[[self getView] getMonentsInteractiveListSueccess:array state:state];
} fail:^(NSInteger code, NSString * _Nullable msg) {
[[self getView] getMonentsInteractiveListFail:msg state:state];
}] dynamicId:dynamicId pageSize:pageSizeStr uid:uid];
}
///
- (void)clearInteractiveMessage {
NSString * uid = [AccountInfoStorage instance].getUid;
[Api monentsInteractiveClear:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
[[self getView] clearInteractiveMessageSuccess];
} showLoading:YES] uid:uid];
}
@end

View File

@@ -13,6 +13,8 @@ NS_ASSUME_NONNULL_BEGIN
- (void)getMonentsInteractiveListSueccess:(NSArray *)array state:(int)state;
- (void)getMonentsInteractiveListFail:(NSString *)msg state:(int)state;
///清空互动消息
- (void)clearInteractiveMessageSuccess;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,16 @@
//
// XPMonentsInteractiveTableViewCell.h
// xplan-ios
//
// Created by 冯硕 on 2022/5/19.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@class MonentsInteractiveModel;
@interface XPMonentsInteractiveTableViewCell : UITableViewCell
@property (nonatomic,strong) MonentsInteractiveModel *interactiveInfo;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,308 @@
//
// XPMonentsInteractiveTableViewCell.m
// xplan-ios
//
// Created by on 2022/5/19.
//
#import "XPMonentsInteractiveTableViewCell.h"
///Third
#import <Masonry/Masonry.h>
///Tool
#import "ThemeColor.h"
#import "NetImageView.h"
#import "XPMacro.h"
#import "UIImage+Utils.h"
///Model
#import "MonentsInteractiveModel.h"
@interface XPMonentsInteractiveTableViewCell ()
///
@property (nonatomic,strong) UIStackView *stackView;
///
@property (nonatomic,strong) UIButton *topicButton;
///
@property (nonatomic,strong) UIView * infoView;
///
@property (nonatomic,strong) NetImageView *avatarImageView;
///
@property (nonatomic,strong) UILabel *nickLabel;
///
@property (nonatomic,strong) UIImageView *sexImageView;
///
@property (nonatomic,strong) UILabel *commentLabel;
///
@property (nonatomic,strong) UILabel *contentLabel;
///
@property (nonatomic,strong) UILabel *timeLabel;
///
@property (nonatomic,strong) NetImageView *dynamicImageView;
///
@property (nonatomic,strong) UILabel *dynamicLabel;
///线
@property (nonatomic,strong) UIView * lineView;
///
@property (nonatomic,strong) NSDateFormatter *dataFormatter;
@end
@implementation XPMonentsInteractiveTableViewCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
[self initSubViews];
[self initSubViewConstraints];
}
return self;
}
#pragma mark - Private Method
- (void)initSubViews {
self.backgroundColor = [ThemeColor appCellBackgroundColor];
self.selectionStyle = UITableViewCellSelectionStyleNone;
[self.contentView addSubview:self.stackView];
[self.stackView addArrangedSubview:self.topicButton];
[self.stackView addArrangedSubview:self.infoView];
[self.infoView addSubview:self.avatarImageView];
[self.infoView addSubview:self.nickLabel];
[self.infoView addSubview:self.sexImageView];
[self.infoView addSubview:self.commentLabel];
[self.infoView addSubview:self.contentLabel];
[self.infoView addSubview:self.timeLabel];
[self.infoView addSubview:self.dynamicImageView];
[self.infoView addSubview:self.dynamicLabel];
[self.infoView addSubview:self.lineView];
}
- (void)initSubViewConstraints {
[self.stackView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.mas_equalTo(self.contentView).inset(15);
make.top.mas_equalTo(self.contentView).offset(10);
make.bottom.mas_equalTo(self.contentView);
}];
[self.topicButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(30);
make.width.mas_equalTo(50);
}];
[self.infoView mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(KScreenWidth- 15 * 2);
}];
[self.avatarImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(44, 44));
make.left.top.mas_equalTo(self.infoView);
}];
[self.nickLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.avatarImageView.mas_right).offset(10);
make.top.mas_equalTo(self.avatarImageView);
}];
[self.sexImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(15, 15));
make.centerY.mas_equalTo(self.nickLabel);
make.left.mas_equalTo(self.nickLabel.mas_right).offset(2);
}];
[self.commentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.mas_equalTo(self.nickLabel);
make.left.mas_equalTo(self.sexImageView.mas_right).offset(2);
}];
[self.contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.nickLabel.mas_bottom).offset(10);
make.left.mas_equalTo(self.nickLabel);
make.right.mas_lessThanOrEqualTo(self.dynamicImageView.mas_left).offset(-5);
}];
[self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.nickLabel);
make.top.mas_equalTo(self.contentLabel.mas_bottom).offset(10);
}];
[self.dynamicImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(60, 60));
make.right.mas_equalTo(self.infoView);
make.centerY.mas_equalTo(self.infoView);
}];
[self.dynamicLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.right.mas_equalTo(self.dynamicImageView);
}];
[self.lineView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.nickLabel);
make.right.mas_equalTo(self.infoView);
make.height.mas_equalTo(1);
make.bottom.mas_equalTo(self.infoView);
}];
}
#pragma mark - Getters And Setters
- (void)setInteractiveInfo:(MonentsInteractiveModel *)interactiveInfo {
_interactiveInfo = interactiveInfo;
if (_interactiveInfo) {
self.topicButton.hidden = _interactiveInfo.worldName.length <=0;
[self.topicButton setTitle:_interactiveInfo.worldName forState:UIControlStateNormal];
self.avatarImageView.imageUrl = _interactiveInfo.avatar;
NSString * nick = interactiveInfo.nick;
if (nick.length > 6) {
nick = [NSString stringWithFormat:@"%@…", [nick substringToIndex:6]];
}
self.nickLabel.text = nick.length > 0 ? nick : @"";
self.sexImageView.image = _interactiveInfo.gender == GenderType_Female ? [UIImage imageNamed:@"common_female"] : [UIImage imageNamed:@"common_male"];
BOOL isComment = _interactiveInfo.actionType == MonentsInteractiveActionType_Comment;
self.commentLabel.text = isComment ? @"评论了你" : @"";
BOOL isText = _interactiveInfo.type == MonentsContentType_Text;
self.dynamicImageView.hidden = isText;
self.dynamicLabel.hidden = !isText;
if (isText) {
self.dynamicLabel.text = _interactiveInfo.content;
} else {
self.dynamicImageView.imageUrl = _interactiveInfo.dynamicRes.resUrl;
}
self.contentLabel.text = _interactiveInfo.message;
NSDate *date = [NSDate dateWithTimeIntervalSince1970:_interactiveInfo.publishTime.floatValue/1000];
NSString *dateString = [self.dataFormatter stringFromDate:date];
self.timeLabel.text = dateString;
CGFloat width = [_interactiveInfo.worldName boundingRectWithSize:CGSizeMake(150,CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingTruncatesLastVisibleLine attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:12]} context:nil].size.width + 10;
[self.topicButton mas_updateConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(width);
}];
}
}
- (UIStackView *)stackView {
if (!_stackView) {
_stackView = [[UIStackView alloc] init];
_stackView.axis = UILayoutConstraintAxisVertical;
_stackView.distribution = UIStackViewDistributionFill;
_stackView.alignment = UIStackViewAlignmentLeading;
_stackView.spacing = 10;
}
return _stackView;
}
- (UIButton *)topicButton {
if (!_topicButton) {
_topicButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_topicButton setTitle:@"邀请" forState:UIControlStateNormal];
[_topicButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
_topicButton.titleLabel.font = [UIFont systemFontOfSize:12];
[_topicButton setBackgroundImage:[UIImage gradientColorImageFromColors:@[[ThemeColor confirmButtonGradientStartColor], [ThemeColor confirmButtonGradientEndColor]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)] forState:UIControlStateNormal];
_topicButton.layer.masksToBounds = YES;
_topicButton.layer.cornerRadius = 15;
}
return _topicButton;
}
- (UIView *)infoView {
if (!_infoView) {
_infoView = [[UIView alloc] init];
_infoView.backgroundColor = [UIColor clearColor];
}
return _infoView;
}
- (NetImageView *)avatarImageView {
if (!_avatarImageView) {
NetImageConfig * config = [[NetImageConfig alloc]init];
config.imageType = ImageTypeUserIcon;
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
_avatarImageView = [[NetImageView alloc] initWithConfig:config];
_avatarImageView.layer.masksToBounds = YES;
_avatarImageView.layer.cornerRadius = 22;
}
return _avatarImageView;
}
- (UILabel *)nickLabel {
if (!_nickLabel) {
_nickLabel = [[UILabel alloc] init];
_nickLabel.font = [UIFont systemFontOfSize:15];
_nickLabel.textColor = [ThemeColor textThirdColor];
}
return _nickLabel;
}
- (UIImageView *)sexImageView {
if (!_sexImageView) {
_sexImageView = [[UIImageView alloc] init];
_sexImageView.userInteractionEnabled = YES;
}
return _sexImageView;
}
- (UILabel *)commentLabel {
if (!_commentLabel) {
_commentLabel = [[UILabel alloc] init];
_commentLabel.font = [UIFont systemFontOfSize:15];
_commentLabel.textColor = [ThemeColor textThirdColor];
}
return _commentLabel;
}
- (UILabel *)contentLabel {
if (!_contentLabel) {
_contentLabel = [[UILabel alloc] init];
_contentLabel.font = [UIFont systemFontOfSize:15];
_contentLabel.textColor = [ThemeColor mainTextColor];
}
return _contentLabel;
}
- (UILabel *)timeLabel {
if (!_timeLabel) {
_timeLabel = [[UILabel alloc] init];
_timeLabel.font = [UIFont systemFontOfSize:12];
_timeLabel.textColor = [ThemeColor textThirdColor];
}
return _timeLabel;
}
- (NetImageView *)dynamicImageView {
if (!_dynamicImageView) {
NetImageConfig * config = [[NetImageConfig alloc]init];
config.imageType = ImageTypeUserIcon;
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
_dynamicImageView = [[NetImageView alloc] initWithConfig:config];
_dynamicImageView.layer.masksToBounds = YES;
_dynamicImageView.layer.cornerRadius = 8;
_dynamicImageView.contentMode = UIViewContentModeScaleAspectFill;
}
return _dynamicImageView;
}
- (UILabel *)dynamicLabel {
if (!_dynamicLabel) {
_dynamicLabel = [[UILabel alloc] init];
_dynamicLabel.font = [UIFont systemFontOfSize:12];
_dynamicLabel.textColor = [ThemeColor textThirdColor];
}
return _dynamicLabel;
}
- (UIView *)lineView {
if (!_lineView) {
_lineView = [[UIView alloc] init];
_lineView.backgroundColor = [ThemeColor dividerColor];
}
return _lineView;
}
- (NSDateFormatter *)dataFormatter {
if (!_dataFormatter) {
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm"];
_dataFormatter = dateFormatter;
}
return _dataFormatter;
}
@end

View File

@@ -11,28 +11,26 @@
#import <MJRefresh/MJRefresh.h>
///Tool
#import "ThemeColor.h"
#import "TTPopup.h"
#import "XPMacro.h"
#import "XPMonentsLayoutConfig.h"
///Model
#import "MonentsListInfoModel.h"
#import "MonentsInteractiveModel.h"
///P
#import "XPMonentsInteractivePresenter.h"
#import "XPMonentsInteractiveProtocol.h"
///View
#import "XPMonentsTableViewCell.h"
#import "XPMonentsInteractiveTableViewCell.h"
#import "XPMonentsEmptyTableViewCell.h"
@interface XPMonentsInteractiveViewController ()<UITableViewDelegate, UITableViewDataSource,XPMonentsInteractiveProtocol>
///
@property (nonatomic,strong) UITableView *tableView;
///
@property (nonatomic,strong) NSMutableArray<MonentsInfoModel *> *datasource;
@property (nonatomic,strong) NSMutableArray<MonentsInteractiveModel *> *datasource;
///
@property (nonatomic,assign) NSInteger page;
///
@property (nonatomic,assign) BOOL hasNoMoreData;
///
@property (nonatomic,strong) MonentsListInfoModel *listInfo;
@end
@implementation XPMonentsInteractiveViewController
@@ -50,7 +48,9 @@
#pragma mark - Private Method
- (void)initSubViews {
self.title = @"全部消息";
[self.view addSubview:self.tableView];
[self addNavigationItemWithImageNames:@[@"monents_interactive_delete_message"] isLeft:NO target:self action:@selector(rightButtonAction:) tags:nil];
}
- (void)initSubViewConstraints {
@@ -79,7 +79,7 @@
#pragma mark - fangfa
- (void)headerRefresh {
self.page = 1;
[self.presenter getMonentsInteractiveList:@"0" pageSize:20 state:0];
[self.presenter getMonentsInteractiveList:@"" pageSize:20 state:0];
}
- (void)footerRefresh {
@@ -89,7 +89,12 @@
return;
}
self.page++;
[self.presenter getMonentsInteractiveList:@"0" pageSize:20 state:1];
NSString * dynamicId = @"";
if (self.datasource.count > 0) {
MonentsInteractiveModel * model = [self.datasource lastObject];
dynamicId = model.dynamicId;
}
[self.presenter getMonentsInteractiveList:dynamicId pageSize:20 state:1];
}
#pragma mark - UITableViewDelegate And UITableViewDataSource
@@ -99,18 +104,17 @@
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
if (self.datasource.count > 0) {
MonentsInfoModel * monentInfo= [self.datasource objectAtIndex:indexPath.row];
[XPMonentsLayoutConfig layoutMonentsModel:monentInfo];
return monentInfo.rowHeight;
MonentsInteractiveModel * model = [self.datasource objectAtIndex:indexPath.row];
return model.worldName.length > 0? 130 : 90;
}
return KScreenHeight - kNavigationHeight - 49 - kSafeAreaBottomHeight;
return KScreenHeight - kNavigationHeight;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
if (self.datasource.count > 0) {
XPMonentsTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMonentsTableViewCell class])];
MonentsInfoModel * monentsInfo = [self.datasource objectAtIndex:indexPath.row];
cell.monentsInfo = monentsInfo;
XPMonentsInteractiveTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMonentsInteractiveTableViewCell class])];
MonentsInteractiveModel * model = [self.datasource objectAtIndex:indexPath.row];
cell.interactiveInfo = model;
return cell;
}
XPMonentsEmptyTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMonentsEmptyTableViewCell class])];
@@ -152,6 +156,19 @@
}
}
- (void)clearInteractiveMessageSuccess {
[self.datasource removeAllObjects];
[self.tableView reloadData];
}
#pragma mark - Event Response
- (void)rightButtonAction:(UIButton *)sender {
[TTPopup alertWithMessage:@"清空后所有互动通知将被删除,确定清空吗?" confirmHandler:^{
[[self presenter] clearInteractiveMessage];
} cancelHandler:^{
}];
}
#pragma mark - Getters And Setters
- (UITableView *)tableView {
if (!_tableView) {
@@ -164,14 +181,14 @@
if (@available(iOS 11.0, *)) {
_tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
}
[_tableView registerClass:[XPMonentsTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPMonentsTableViewCell class])];
[_tableView registerClass:[XPMonentsInteractiveTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPMonentsInteractiveTableViewCell class])];
[_tableView registerClass:[XPMonentsEmptyTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPMonentsEmptyTableViewCell class])];
}
return _tableView;
}
- (NSMutableArray<MonentsInfoModel *> *)datasource {
- (NSMutableArray<MonentsInteractiveModel *> *)datasource {
if (!_datasource) {
_datasource = [NSMutableArray array];
}

View File

@@ -8,21 +8,28 @@
#import "XPMonentsViewController.h"
///Third
#import <Masonry/Masonry.h>
#import <NIMSDK/NIMSDK.h>
#import <JXCategoryView/JXCategoryView.h>
#import <JXCategoryView/JXCategoryListContainerView.h>
///Tool
#import "ThemeColor.h"
#import "XPMacro.h"
///Tool
#import "AttachMentModel.h"
#import "MonentsUnReadModel.h"
///View
#import "XPMonentsRecommendViewController.h"
#import "XPMonentsAttentionViewController.h"
#import "XPMonentsLatestViewController.h"
#import "XPMonentsInteractiveViewController.h"
@interface XPMonentsViewController ()<JXCategoryViewDelegate,JXCategoryListContainerViewDelegate>
///
@property (nonatomic,strong) NSArray<NSString *> *titles;
///
@property (nonatomic,strong) UIView * navView;
///
@property (nonatomic,strong) UIView * dotView;
///
@property (nonatomic,strong) UIButton *messageButton;
///
@@ -32,12 +39,17 @@
@implementation XPMonentsViewController
- (void)dealloc {
[[NIMSDK sharedSDK].systemNotificationManager removeDelegate:self];
}
- (BOOL)isHiddenNavBar {
return YES;
}
- (void)viewDidLoad {
[super viewDidLoad];
[[NIMSDK sharedSDK].systemNotificationManager addDelegate:self];
[self initSubViews];
[self initSubViewConstraints];
}
@@ -49,6 +61,7 @@
[self.navView addSubview:self.titleView];
[self.navView addSubview:self.messageButton];
[self.navView addSubview:self.dotView];
}
- (void)initSubViewConstraints {
@@ -69,6 +82,12 @@
make.size.mas_equalTo(CGSizeMake(22, 22));
}];
[self.dotView mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(10, 10));
make.centerY.mas_equalTo(self.messageButton.mas_top);
make.centerX.mas_equalTo(self.messageButton.mas_right);
}];
[self.listContainerView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.bottom.mas_equalTo(self.view);
make.top.mas_equalTo(self.navView.mas_bottom);
@@ -99,6 +118,29 @@
}
#pragma mark -NIMSystemNotificationManagerDelegate
- (void)onReceiveCustomSystemNotification:(NIMCustomSystemNotification *)notification {
if (notification.receiverType == NIMSessionTypeP2P) {
if (notification.content != nil) {
AttachmentModel *attachment = [AttachmentModel modelWithJSON:notification.content];
if (attachment.first == CustomMessageType_Monents && attachment.second == Custom_Message_Sub_Monents_Unread_Update) {
MonentsUnReadModel * unreadModel = [MonentsUnReadModel modelWithDictionary:attachment.data];
if (unreadModel.total > 0) {
self.dotView.hidden = NO;
} else {
self.dotView.hidden = YES;
}
}
}
}
}
#pragma mark - Event Response
- (void)messageButtonAction:(UIButton *)sender {
XPMonentsInteractiveViewController * messageVC = [[XPMonentsInteractiveViewController alloc] init];
[self.navigationController pushViewController:messageVC animated:YES];
}
#pragma mark - Getters And Setters
- (JXCategoryListContainerView *)listContainerView {
if (!_listContainerView) {
@@ -147,4 +189,25 @@
return _titles;
}
- (UIButton *)messageButton {
if (!_messageButton) {
_messageButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_messageButton setImage:[UIImage imageNamed:@"monents_nav_interavtive_message"] forState:UIControlStateNormal];
[_messageButton setImage:[UIImage imageNamed:@"monents_nav_interavtive_message"] forState:UIControlStateSelected];
[_messageButton addTarget:self action:@selector(messageButtonAction:) forControlEvents:UIControlEventTouchUpInside];
}
return _messageButton;
}
- (UIView *)dotView {
if (!_dotView) {
_dotView = [[UIView alloc] init];
_dotView.backgroundColor = UIColorFromRGB(0xFF2D55);
_dotView.layer.masksToBounds = YES;
_dotView.layer.cornerRadius = 5;
_dotView.hidden = YES;
}
return _dotView;
}
@end