动态修改
@@ -37,7 +37,6 @@ UIKIT_EXTERN NSString * const kOpenRoomNotification;
|
||||
[UMConfigure initWithAppkey:@"6434c6dfd64e686139618269" channel:@"yumi_appstore"];
|
||||
}
|
||||
[[FBSDKApplicationDelegate sharedInstance] application:application didFinishLaunchingWithOptions:launchOptions];
|
||||
|
||||
[FIRApp configure];
|
||||
return YES;
|
||||
}
|
||||
|
22
YuMi/Assets.xcassets/Monents/mine_dynamic.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "mine_dynamic@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "mine_dynamic@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
BIN
YuMi/Assets.xcassets/Monents/mine_dynamic.imageset/mine_dynamic@2x.png
vendored
Normal file
After Width: | Height: | Size: 995 B |
BIN
YuMi/Assets.xcassets/Monents/mine_dynamic.imageset/mine_dynamic@3x.png
vendored
Normal file
After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 896 B |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 517 B After Width: | Height: | Size: 658 B |
Before Width: | Height: | Size: 787 B After Width: | Height: | Size: 958 B |
22
YuMi/Assets.xcassets/Monents/monents_on_line_bg.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "monents_on_line_bg@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "monents_on_line_bg@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
BIN
YuMi/Assets.xcassets/Monents/monents_on_line_bg.imageset/monents_on_line_bg@2x.png
vendored
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
YuMi/Assets.xcassets/Monents/monents_on_line_bg.imageset/monents_on_line_bg@3x.png
vendored
Normal file
After Width: | Height: | Size: 1.8 KiB |
22
YuMi/Assets.xcassets/Monents/monents_on_line_note.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "monents_on_line_note@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "monents_on_line_note@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
BIN
YuMi/Assets.xcassets/Monents/monents_on_line_note.imageset/monents_on_line_note@2x.png
vendored
Normal file
After Width: | Height: | Size: 384 B |
BIN
YuMi/Assets.xcassets/Monents/monents_on_line_note.imageset/monents_on_line_note@3x.png
vendored
Normal file
After Width: | Height: | Size: 548 B |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 3.6 KiB |
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 6.1 KiB |
@@ -32,34 +32,24 @@
|
||||
- (instancetype)init{
|
||||
self = [super init];
|
||||
if(self){
|
||||
[FBSDKProfile enableUpdatesOnAccessTokenChange:YES];
|
||||
|
||||
@weakify(self);
|
||||
[[NSNotificationCenter defaultCenter] addObserverForName:FBSDKProfileDidChangeNotification
|
||||
object:nil
|
||||
queue:[NSOperationQueue mainQueue]
|
||||
usingBlock:
|
||||
^(NSNotification *notification) {
|
||||
|
||||
@strongify(self);
|
||||
if ([FBSDKProfile currentProfile]) {
|
||||
|
||||
|
||||
//获取当前用户名
|
||||
[FBSDKProfile loadCurrentProfileWithCompletion:
|
||||
^(FBSDKProfile *profile, NSError *error) {
|
||||
if (profile) {
|
||||
ThirdUserInfo * userInfo = [[ThirdUserInfo alloc] init];
|
||||
NSString * openid = profile.userID;
|
||||
NSString * access_token = profile.userID;
|
||||
NSString * unionid = profile.userID;
|
||||
userInfo.openid = openid;
|
||||
userInfo.access_token = access_token;
|
||||
userInfo.unionid = unionid;
|
||||
userInfo.userName = profile.name;
|
||||
userInfo.avatarUrl = profile.imageURL.absoluteString;
|
||||
[AccountInfoStorage instance].thirdUserInfo = userInfo;
|
||||
[AccountInfoStorage instance].thirdUserInfo.userName = profile.name;
|
||||
[AccountInfoStorage instance].thirdUserInfo.avatarUrl = profile.imageURL.absoluteString;
|
||||
[self loginWithThirdPartWithType:ThirdLoginType_FB];
|
||||
}
|
||||
}];
|
||||
|
||||
}
|
||||
|
||||
}];
|
||||
@@ -171,6 +161,8 @@
|
||||
|
||||
}
|
||||
-(void)thirdLoginByFBWithPresentingViewController:(UIViewController *)presentingViewController {
|
||||
[FBSDKProfile enableUpdatesOnAccessTokenChange:YES];
|
||||
[FBSDKAccessToken setCurrentAccessToken:nil];
|
||||
FBSDKLoginManager *manager = [[FBSDKLoginManager alloc] init];
|
||||
[manager logOut];
|
||||
[manager logInWithPermissions:@[@"public_profile"]
|
||||
@@ -181,7 +173,11 @@
|
||||
} else if (result.isCancelled) {
|
||||
[[self getView] showErrorToast:YMLocalizedString(@"LoginPresenter0")];
|
||||
} else {
|
||||
NSLog(@"Logged in");
|
||||
ThirdUserInfo * userInfo = [[ThirdUserInfo alloc] init];
|
||||
userInfo.openid = result.token.userID;
|
||||
userInfo.access_token = result.token.tokenString;
|
||||
userInfo.unionid = result.token.userID;
|
||||
[AccountInfoStorage instance].thirdUserInfo = userInfo;
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
@@ -190,7 +190,6 @@
|
||||
/// 公会个播收入列表
|
||||
/// @param completion 完成
|
||||
/// @param uid 用户的uid
|
||||
/// @param hallId 公会的id
|
||||
/// @param startTime 开始时间
|
||||
/// @param endTime 结束时间
|
||||
+ (void)getHallSingleRoomIncomeRecord:(HttpRequestHelperCompletion)completion uid:(NSString *)uid clanId:(NSString *)clanId startTime:(NSString *)startTime endTime:(NSString *)endTime {
|
||||
|
@@ -167,6 +167,10 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/// @param completion 完成
|
||||
/// @param uid uid
|
||||
+ (void)monentsUnReadCount:(HttpRequestHelperCompletion)completion uid:(NSString *)uid;
|
||||
/// 屏蔽
|
||||
/// @param completion 完成
|
||||
/// @param type type为0 => 屏蔽动态, objId 为 动态id, type为1 => 屏蔽房间, objId 为 用户uid
|
||||
+ (void)requesstShielding:(HttpRequestHelperCompletion)completion type:(NSString *)type objId:(NSString *)objId;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -273,5 +273,10 @@
|
||||
NSString * fang = [NSString stringFromBase64String:@"aW50ZXJhY3RpdmUvdW5yZWFkQ291bnQ="];///interactive/unreadCount
|
||||
[self makeRequest:fang method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__, uid, nil];
|
||||
}
|
||||
|
||||
/// 屏蔽
|
||||
/// @param completion 完成
|
||||
/// @param type type为0 => 屏蔽动态, objId 为 动态id, type为1 => 屏蔽房间, objId 为 用户uid
|
||||
+ (void)requesstShielding:(HttpRequestHelperCompletion)completion type:(NSString *)type objId:(NSString *)objId{
|
||||
[self makeRequest:[NSString stringWithFormat:@"%@%@%@",@"user/",@"black/",@"add"] method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__, type,objId, nil];
|
||||
}
|
||||
@end
|
||||
|
@@ -1,19 +1,19 @@
|
||||
//
|
||||
// MonentsInfoModel.h
|
||||
// YUMI
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by YUMI on 2022/5/11.
|
||||
// Created by 冯硕 on 2022/5/11.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "YUMINNNN.h"
|
||||
|
||||
#import "UserVipInfoVo.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
typedef NS_ENUM(NSInteger, MonentsContentType) {
|
||||
///纯文字的
|
||||
MonentsContentType_Text = 0,
|
||||
///图片
|
||||
MonentsContentType_Picture = 2
|
||||
///纯文字的
|
||||
MonentsContentType_Text = 0,
|
||||
///图片
|
||||
MonentsContentType_Picture = 2
|
||||
};
|
||||
@class MonentsPicInfoModel;
|
||||
@interface MonentsInfoModel : NSObject
|
||||
@@ -47,8 +47,10 @@ typedef NS_ENUM(NSInteger, MonentsContentType) {
|
||||
@property (nonatomic,strong) NSString *experLevelPic;
|
||||
///魅力等级
|
||||
@property (nonatomic,strong) NSString *charmLevelPic;
|
||||
///是否置顶
|
||||
///广场是否置顶
|
||||
@property (nonatomic,assign) BOOL squareTop;
|
||||
///话题是否置顶
|
||||
@property (nonatomic,assign) BOOL topicTop;
|
||||
///贵族信息
|
||||
@property (nonatomic, strong) UserVipInfoVo *userVipInfoVO;
|
||||
///发布的内容
|
||||
|
@@ -1,8 +1,8 @@
|
||||
//
|
||||
// MonentsInfoModel.m
|
||||
// YUMI
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by YUMI on 2022/5/11.
|
||||
// Created by 冯硕 on 2022/5/11.
|
||||
//
|
||||
|
||||
#import "MonentsInfoModel.h"
|
||||
@@ -10,14 +10,14 @@
|
||||
|
||||
@implementation MonentsInfoModel
|
||||
- (instancetype)init {
|
||||
if (self = [super init]) {
|
||||
self.isFold = YES;
|
||||
}
|
||||
return self;
|
||||
if (self = [super init]) {
|
||||
self.isFold = YES;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
+ (NSDictionary *)objectClassInArray {
|
||||
return @{@"dynamicResList":MonentsPicInfoModel.class};
|
||||
return @{@"dynamicResList":MonentsPicInfoModel.class};
|
||||
}
|
||||
@end
|
||||
|
||||
|
@@ -43,6 +43,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/// @param dynamicId 动态的id
|
||||
/// @param content 评论的内容
|
||||
- (void)commontMonents:(NSString *)dynamicId content:(NSString *)content;
|
||||
- (void)requesstShieldingWtihType:(NSString *)type objId:(NSString *)objId;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -94,6 +94,11 @@
|
||||
[[self getView] replyMonentsSuccess];
|
||||
}] uid:uid dynamicId:dynamicId content:content commentId:commonId];
|
||||
}
|
||||
- (void)requesstShieldingWtihType:(NSString *)type objId:(NSString *)objId{
|
||||
[Api requesstShielding:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
[[self getView] requesstShieldingSuccess:objId];
|
||||
}] type:type objId:objId];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@@ -28,7 +28,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/// @param dynamicId 动态id
|
||||
/// @param worldId 话题id
|
||||
- (void)deleteMonents:(NSString *)dynamicId worldId:(NSString *)worldId;
|
||||
|
||||
///屏蔽动态
|
||||
- (void)requesstShieldingWtihType:(NSString *)type objId:(NSString *)objId;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -52,5 +52,9 @@
|
||||
} uid:uid dynamicId:dynamicId worldId:worldId];
|
||||
}
|
||||
|
||||
|
||||
- (void)requesstShieldingWtihType:(NSString *)type objId:(NSString *)objId{
|
||||
[Api requesstShielding:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
[[self getView] requesstShieldingSuccess:objId];
|
||||
}] type:type objId:objId];
|
||||
}
|
||||
@end
|
||||
|
@@ -28,6 +28,9 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/// @param dynamicId 动态id
|
||||
/// @param worldId 话题id
|
||||
- (void)deleteMonents:(NSString *)dynamicId worldId:(NSString *)worldId;
|
||||
|
||||
- (void)requesstShieldingWtihType:(NSString *)type objId:(NSString *)objId;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -51,5 +51,9 @@
|
||||
[[self getView] deleteMonentsSuccess:dynamicId];
|
||||
} uid:uid dynamicId:dynamicId worldId:worldId];
|
||||
}
|
||||
|
||||
- (void)requesstShieldingWtihType:(NSString *)type objId:(NSString *)objId{
|
||||
[Api requesstShielding:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
[[self getView] requesstShieldingSuccess:objId];
|
||||
}] type:type objId:objId];
|
||||
}
|
||||
@end
|
||||
|
@@ -32,6 +32,9 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/// @param dynamicId 动态id
|
||||
/// @param worldId 话题id
|
||||
- (void)deleteMonents:(NSString *)dynamicId worldId:(NSString *)worldId;
|
||||
///屏蔽
|
||||
- (void)requesstShieldingWtihType:(NSString *)type objId:(NSString *)objId;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -65,5 +65,9 @@
|
||||
[[self getView] deleteMonentsSuccess:dynamicId];
|
||||
} uid:uid dynamicId:dynamicId worldId:worldId];
|
||||
}
|
||||
|
||||
- (void)requesstShieldingWtihType:(NSString *)type objId:(NSString *)objId{
|
||||
[Api requesstShielding:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
[[self getView] requesstShieldingSuccess:objId];
|
||||
}] type:type objId:objId];
|
||||
}
|
||||
@end
|
||||
|
@@ -23,6 +23,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/// @param dynamicId 动态id
|
||||
/// @param worldId 话题id
|
||||
- (void)deleteMonents:(NSString *)dynamicId worldId:(NSString *)worldId;
|
||||
- (void)requesstShieldingWtihType:(NSString *)type objId:(NSString *)objId;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -44,5 +44,9 @@
|
||||
[[self getView] deleteMonentsSuccess:dynamicId];
|
||||
} uid:uid dynamicId:dynamicId worldId:worldId];
|
||||
}
|
||||
|
||||
- (void)requesstShieldingWtihType:(NSString *)type objId:(NSString *)objId{
|
||||
[Api requesstShielding:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
[[self getView] requesstShieldingSuccess:objId];
|
||||
}] type:type objId:objId];
|
||||
}
|
||||
@end
|
||||
|
@@ -23,6 +23,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/// @param dynamicId 动态id
|
||||
/// @param worldId 话题id
|
||||
- (void)deleteMonents:(NSString *)dynamicId worldId:(NSString *)worldId;
|
||||
- (void)requesstShieldingWtihType:(NSString *)type objId:(NSString *)objId;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -44,4 +44,9 @@
|
||||
[[self getView] deleteMonentsSuccess:dynamicId];
|
||||
} uid:uid dynamicId:dynamicId worldId:worldId];
|
||||
}
|
||||
- (void)requesstShieldingWtihType:(NSString *)type objId:(NSString *)objId{
|
||||
[Api requesstShielding:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
[[self getView] requesstShieldingSuccess:objId];
|
||||
}] type:type objId:objId];
|
||||
}
|
||||
@end
|
||||
|
@@ -20,6 +20,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
///删除话题成功
|
||||
- (void)deleteMonentsSuccess:(NSString *)monentsInfo;
|
||||
///屏蔽
|
||||
- (void)requesstShieldingSuccess:(NSString *)monentsInfo;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -28,6 +28,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
- (void)commonMonentsSuccess;
|
||||
///回复某人评论成功
|
||||
- (void)replyMonentsSuccess;
|
||||
///屏蔽
|
||||
- (void)requesstShieldingSuccess:(NSString *)monentsInfo;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -19,6 +19,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
- (void)likeMonentsSuccess:(NSString *)dynamicId status:(BOOL)status;
|
||||
///删除话题成功
|
||||
- (void)deleteMonentsSuccess:(NSString *)monentsInfo;
|
||||
///屏蔽
|
||||
- (void)requesstShieldingSuccess:(NSString *)monentsInfo;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -22,7 +22,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
///删除话题成功
|
||||
- (void)deleteMonentsSuccess:(NSString *)monentsInfo;
|
||||
|
||||
///屏蔽
|
||||
- (void)requesstShieldingSuccess:(NSString *)monentsInfo;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -19,6 +19,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
///删除话题成功
|
||||
- (void)deleteMonentsSuccess:(NSString *)monentsInfo;
|
||||
///屏蔽
|
||||
- (void)requesstShieldingSuccess:(NSString *)monentsInfo;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -20,6 +20,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
///删除话题成功
|
||||
- (void)deleteMonentsSuccess:(NSString *)monentsInfo;
|
||||
///屏蔽
|
||||
- (void)requesstShieldingSuccess:(NSString *)monentsInfo;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -30,6 +30,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@property (nonatomic,strong) MonentsInfoModel *mineMonentsInfo;
|
||||
@property (nonatomic,strong) MonentsInfoModel *monentsInfo;
|
||||
@property (nonatomic,assign) BOOL isFillet;
|
||||
@property (nonatomic,assign) BOOL isTopic;///是否是话题页
|
||||
///代理
|
||||
@property (nonatomic,weak) id<XPMonentsTableViewCellDelegate> delegate;
|
||||
|
||||
|
@@ -10,7 +10,6 @@
|
||||
#import <Masonry/Masonry.h>
|
||||
|
||||
///Tool
|
||||
|
||||
#import "NetImageView.h"
|
||||
#import "XPMonentsLayoutConfig.h"
|
||||
#import "SDPhotoBrowser.h"
|
||||
@@ -83,8 +82,8 @@
|
||||
|
||||
- (void)initDynamicSubViewConstraints {
|
||||
[self.backView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(15);
|
||||
make.right.mas_equalTo(-15);
|
||||
make.leading.mas_equalTo(15);
|
||||
make.trailing.mas_equalTo(-15);
|
||||
make.top.bottom.equalTo(self.contentView);
|
||||
}];
|
||||
|
||||
@@ -95,8 +94,8 @@
|
||||
}];
|
||||
|
||||
[self.stackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.backView).offset(12);
|
||||
make.right.mas_equalTo(self.backView).offset(-12);
|
||||
make.leading.mas_equalTo(self.backView).offset(12);
|
||||
make.trailing.mas_equalTo(self.backView).offset(-12);
|
||||
make.top.mas_equalTo(13);
|
||||
}];
|
||||
|
||||
@@ -107,14 +106,14 @@
|
||||
make.width.mas_equalTo(KScreenWidth-30);
|
||||
}];
|
||||
[self.toolBarView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.mas_equalTo(self.backView);
|
||||
make.leading.trailing.mas_equalTo(self.backView);
|
||||
make.top.mas_equalTo(self.stackView.mas_bottom).mas_offset(10);
|
||||
make.height.mas_equalTo(18);
|
||||
}];
|
||||
|
||||
[self.lineView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(kGetScaleWidth(1));
|
||||
make.left.right.equalTo(self.toolBarView).inset(12);
|
||||
make.leading.trailing.equalTo(self.toolBarView).inset(12);
|
||||
make.bottom.equalTo(self.contentView);
|
||||
}];
|
||||
}
|
||||
@@ -139,7 +138,7 @@
|
||||
}];
|
||||
|
||||
[self.userInfoView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.top.mas_equalTo(self.backView);
|
||||
make.leading.trailing.top.mas_equalTo(self.backView);
|
||||
make.height.mas_equalTo(kMONENTS_USER_INFO_HEIGHT);
|
||||
}];
|
||||
|
||||
@@ -148,8 +147,8 @@
|
||||
}];
|
||||
|
||||
[self.stackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.backView).offset(kMONENTS_CONTENT_LEFT_PADDING);
|
||||
make.right.mas_equalTo(self.backView).offset(-kMONENTS_CONTENT_RIGHT_PADDING);
|
||||
make.leading.mas_equalTo(self.backView).offset(kMONENTS_CONTENT_LEFT_PADDING);
|
||||
make.trailing.mas_equalTo(self.backView).offset(-kMONENTS_CONTENT_RIGHT_PADDING);
|
||||
make.top.mas_equalTo(self.userInfoView.mas_bottom).offset(kMONENTS_CONTENT_SPACAE_HEIGHT);
|
||||
}];
|
||||
|
||||
@@ -158,7 +157,7 @@
|
||||
}];
|
||||
|
||||
[self.toolBarView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.mas_equalTo(self.backView);
|
||||
make.leading.trailing.mas_equalTo(self.backView);
|
||||
make.top.mas_equalTo(self.stackView.mas_bottom);
|
||||
make.height.mas_equalTo(kMONENTS_TOOL_BAR_HEIGHT);
|
||||
}];
|
||||
@@ -305,6 +304,7 @@
|
||||
_monentsInfo = monentsInfo;
|
||||
if (_monentsInfo) {
|
||||
self.userInfoView.monentsInfo = _monentsInfo;
|
||||
self.textView.isTopic = _isTopic;
|
||||
self.textView.monentsInfo = _monentsInfo;
|
||||
self.photoView.dynamicResList = _monentsInfo.dynamicResList;
|
||||
self.topicView.monentsInfo = _monentsInfo;
|
||||
@@ -326,7 +326,7 @@
|
||||
|
||||
self.topicView.hidden = monentsInfo.worldId <= 0;
|
||||
|
||||
if(_monentsInfo.squareTop && _monentsInfo.content.length == 0){
|
||||
if(_monentsInfo.topicTop && _monentsInfo.content.length == 0){
|
||||
[self.textView mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(contentHeight + 20);
|
||||
}];
|
||||
|
@@ -1,24 +1,23 @@
|
||||
//
|
||||
// YMMonentsTopicCollectionViewCell.m
|
||||
// YUMI
|
||||
// XPMonentsTopicCollectionViewCell.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by YUMI on 2022/5/18.
|
||||
// Created by 冯硕 on 2022/5/18.
|
||||
//
|
||||
|
||||
#import "XPMonentsTopicCollectionViewCell.h"
|
||||
///Third
|
||||
#import <Masonry/Masonry.h>
|
||||
///Tool
|
||||
#import "DJDKMIMOMColor.h"
|
||||
|
||||
#import "UIImage+Utils.h"
|
||||
#import "NetImageView.h"
|
||||
///Model
|
||||
#import "MonentsTopicModel.h"
|
||||
|
||||
@interface XPMonentsTopicCollectionViewCell ()
|
||||
|
||||
///背景
|
||||
@property (nonatomic,strong) NetImageView *topicImageView;
|
||||
//@property (nonatomic,strong) UIImageView *topicImageView;
|
||||
///显示话题前面的#
|
||||
@property (nonatomic,strong) UIImageView *iconImageView;
|
||||
///显示话题
|
||||
@@ -29,73 +28,87 @@
|
||||
@implementation XPMonentsTopicCollectionViewCell
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame {
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
}
|
||||
return self;
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
#pragma mark - Private Method
|
||||
- (void)initSubViews {
|
||||
[self.contentView addSubview:self.topicImageView];
|
||||
[self.topicImageView addSubview:self.iconImageView];
|
||||
[self.topicImageView addSubview:self.topicLabel];
|
||||
self.backgroundColor = [UIColor clearColor];
|
||||
self.contentView.backgroundColor = [UIColor clearColor];
|
||||
[self.contentView addSubview:self.iconImageView];
|
||||
[self.contentView addSubview:self.topicLabel];
|
||||
// [self.contentView addSubview:self.topicImageView];
|
||||
// [self.topicImageView addSubview:self.iconImageView];
|
||||
// [self.topicImageView addSubview:self.topicLabel];
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
[self.topicImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.mas_equalTo(self.contentView);
|
||||
}];
|
||||
|
||||
[self.iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.bottom.mas_equalTo(self.topicImageView);
|
||||
make.height.mas_equalTo(30);
|
||||
}];
|
||||
|
||||
[self.topicLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.mas_equalTo(self.topicImageView).inset(2);
|
||||
make.bottom.mas_equalTo(self.topicImageView.mas_bottom).offset(-6);
|
||||
}];
|
||||
[self.iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerY.equalTo(self.contentView);
|
||||
make.left.mas_equalTo(14);
|
||||
make.width.height.mas_equalTo(10);
|
||||
}];
|
||||
|
||||
[self.topicLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerY.right.equalTo(self.contentView);
|
||||
make.left.equalTo(self.iconImageView.mas_right).mas_offset(5);
|
||||
make.right.mas_equalTo(-5.5);
|
||||
}];
|
||||
|
||||
// [self.topicImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
// make.edges.mas_equalTo(self.contentView);
|
||||
// }];
|
||||
//
|
||||
// [self.iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
// make.left.mas_equalTo(self.topicImageView).offset(7);
|
||||
// make.size.mas_equalTo(CGSizeMake(16, 16));
|
||||
// make.centerY.mas_equalTo(self.topicImageView);
|
||||
// }];
|
||||
//
|
||||
// [self.topicLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
// make.left.mas_equalTo(self.iconImageView.mas_right).offset(2);
|
||||
// make.centerY.mas_equalTo(self.topicImageView);
|
||||
// }];
|
||||
}
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
- (void)setTopicInfo:(MonentsTopicModel *)topicInfo {
|
||||
_topicInfo = topicInfo;
|
||||
if (_topicInfo) {
|
||||
self.topicLabel.text = [NSString stringWithFormat:@"#%@", _topicInfo.name];
|
||||
self.topicImageView.imageUrl = _topicInfo.icon;
|
||||
}
|
||||
}
|
||||
|
||||
- (NetImageView *)topicImageView {
|
||||
if (!_topicImageView) {
|
||||
NetImageConfig * config = [[NetImageConfig alloc]init];
|
||||
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
|
||||
_topicImageView = [[NetImageView alloc] initWithConfig:config];
|
||||
_topicImageView.layer.masksToBounds = YES;
|
||||
_topicImageView.layer.cornerRadius = 12;
|
||||
_topicImageView.contentMode = UIViewContentModeScaleAspectFill;
|
||||
}
|
||||
return _topicImageView;
|
||||
_topicInfo = topicInfo;
|
||||
if (_topicInfo) {
|
||||
self.topicLabel.text = _topicInfo.name;
|
||||
}
|
||||
}
|
||||
//
|
||||
//- (UIImageView *)topicImageView {
|
||||
// if (!_topicImageView) {
|
||||
// _topicImageView = [[UIImageView alloc] init];
|
||||
// _topicImageView.userInteractionEnabled = YES;
|
||||
// _topicImageView.image = [UIImage gradientColorImageFromColors:@[UIColorFromRGB(0xFFFCDD), UIColorFromRGB(0xDFF9FF), UIColorFromRGB(0xF4E5FF)] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)];
|
||||
// _topicImageView.layer.masksToBounds = YES;
|
||||
// _topicImageView.layer.cornerRadius = 13;
|
||||
// }
|
||||
// return _topicImageView;
|
||||
//}
|
||||
|
||||
- (UIImageView *)iconImageView {
|
||||
if (!_iconImageView) {
|
||||
_iconImageView = [[UIImageView alloc] init];
|
||||
_iconImageView.userInteractionEnabled = YES;
|
||||
_iconImageView.image = [UIImage imageNamed:@"home_room_list_shadow_bg"];
|
||||
}
|
||||
return _iconImageView;
|
||||
if (!_iconImageView) {
|
||||
_iconImageView = [[UIImageView alloc] init];
|
||||
_iconImageView.userInteractionEnabled = YES;
|
||||
_iconImageView.image = [UIImage imageNamed:@"monents_info_topic_icon"];
|
||||
}
|
||||
return _iconImageView;
|
||||
}
|
||||
|
||||
- (UILabel *)topicLabel {
|
||||
if (!_topicLabel) {
|
||||
_topicLabel = [[UILabel alloc] init];
|
||||
_topicLabel.font = [UIFont systemFontOfSize:12 weight:UIFontWeightBold];
|
||||
_topicLabel.textColor = [UIColor whiteColor];
|
||||
_topicLabel.textAlignment = NSTextAlignmentCenter;
|
||||
}
|
||||
return _topicLabel;
|
||||
if (!_topicLabel) {
|
||||
_topicLabel = [[UILabel alloc] init];
|
||||
_topicLabel.font = [UIFont systemFontOfSize:13 weight:UIFontWeightRegular];
|
||||
_topicLabel.textColor = UIColorFromRGB(0x1F1A4E);
|
||||
}
|
||||
return _topicLabel;
|
||||
}
|
||||
@end
|
||||
|
@@ -1,15 +1,15 @@
|
||||
//
|
||||
// YMMoentsTopicView.m
|
||||
// YUMI
|
||||
// XPMoentsTopicView.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by YUMI on 2022/5/12.
|
||||
// Created by 冯硕 on 2022/5/12.
|
||||
//
|
||||
|
||||
#import "XPMoentsTopicView.h"
|
||||
///Third
|
||||
#import <Masonry/Masonry.h>
|
||||
///Tool
|
||||
#import "DJDKMIMOMColor.h"
|
||||
|
||||
#import "UIImage+Utils.h"
|
||||
#import "NSString+Utils.h"
|
||||
///Model
|
||||
@@ -24,111 +24,97 @@
|
||||
@property (nonatomic,strong) UIImageView *iconImageView;
|
||||
///显示话题
|
||||
@property (nonatomic,strong) UILabel *topicLabel;
|
||||
///显示时间
|
||||
@property (nonatomic,strong) UILabel *timeLabel;
|
||||
|
||||
@end
|
||||
|
||||
@implementation XPMoentsTopicView
|
||||
- (instancetype)initWithFrame:(CGRect)frame {
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
}
|
||||
return self;
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
#pragma mark - Private Method
|
||||
- (void)initSubViews {
|
||||
[self addSubview:self.stackView];
|
||||
[self.stackView addArrangedSubview:self.topicImageView];
|
||||
[self.stackView addArrangedSubview:self.timeLabel];
|
||||
|
||||
[self.topicImageView addSubview:self.iconImageView];
|
||||
[self.topicImageView addSubview:self.topicLabel];
|
||||
[self addSubview:self.stackView];
|
||||
[self.stackView addArrangedSubview:self.topicImageView];
|
||||
[self.topicImageView addSubview:self.iconImageView];
|
||||
[self.topicImageView addSubview:self.topicLabel];
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
[self.stackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.mas_equalTo(self);
|
||||
}];
|
||||
|
||||
[self.topicImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.right.mas_equalTo(self.topicLabel.mas_right).offset(9);
|
||||
}];
|
||||
|
||||
[self.iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.topicImageView).offset(9);
|
||||
make.size.mas_equalTo(CGSizeMake(20, 20));
|
||||
make.centerY.mas_equalTo(self.topicImageView);
|
||||
}];
|
||||
|
||||
[self.topicLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.iconImageView.mas_right).offset(4);
|
||||
make.centerY.mas_equalTo(self.topicImageView);
|
||||
}];
|
||||
[self.stackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.top.bottom.mas_equalTo(self);
|
||||
}];
|
||||
|
||||
[self.topicImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.right.mas_equalTo(self.topicLabel.mas_right).offset(9);
|
||||
}];
|
||||
|
||||
[self.iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.topicImageView);
|
||||
make.size.mas_equalTo(CGSizeMake(10, 10));
|
||||
make.centerY.mas_equalTo(self.topicImageView);
|
||||
}];
|
||||
|
||||
[self.topicLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.iconImageView.mas_right).offset(4);
|
||||
make.centerY.mas_equalTo(self.topicImageView);
|
||||
}];
|
||||
}
|
||||
#pragma mark - Getters And Setters
|
||||
- (void)setMonentsInfo:(MonentsInfoModel *)monentsInfo {
|
||||
_monentsInfo = monentsInfo;
|
||||
if (_monentsInfo) {
|
||||
if (_monentsInfo.worldId > 0) {
|
||||
self.topicImageView.hidden = NO;
|
||||
self.topicLabel.text = _monentsInfo.worldName;
|
||||
} else {
|
||||
self.topicImageView.hidden = YES;
|
||||
}
|
||||
self.timeLabel.text = [NSString stringWithTimeStamp:_monentsInfo.publishTime];
|
||||
}
|
||||
_monentsInfo = monentsInfo;
|
||||
if (_monentsInfo) {
|
||||
if (_monentsInfo.worldId > 0) {
|
||||
self.topicLabel.text = _monentsInfo.worldName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (UIStackView *)stackView {
|
||||
if (!_stackView) {
|
||||
_stackView = [[UIStackView alloc] init];
|
||||
_stackView.axis = UILayoutConstraintAxisHorizontal;
|
||||
_stackView.distribution = UIStackViewDistributionFill;
|
||||
_stackView.alignment = UIStackViewAlignmentFill;
|
||||
_stackView.spacing = 8;
|
||||
}
|
||||
return _stackView;
|
||||
if (!_stackView) {
|
||||
_stackView = [[UIStackView alloc] init];
|
||||
_stackView.axis = UILayoutConstraintAxisHorizontal;
|
||||
_stackView.distribution = UIStackViewDistributionFill;
|
||||
_stackView.alignment = UIStackViewAlignmentFill;
|
||||
_stackView.spacing = 8;
|
||||
}
|
||||
return _stackView;
|
||||
}
|
||||
|
||||
- (UIImageView *)topicImageView {
|
||||
if (!_topicImageView) {
|
||||
_topicImageView = [[UIImageView alloc] init];
|
||||
_topicImageView.userInteractionEnabled = YES;
|
||||
_topicImageView.image = [UIImage gradientColorImageFromColors:@[UIColorFromRGB(0xFFFCDD), UIColorFromRGB(0xDFF9FF), UIColorFromRGB(0xF4E5FF)] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)];
|
||||
_topicImageView.layer.masksToBounds = YES;
|
||||
_topicImageView.layer.cornerRadius = 8;
|
||||
}
|
||||
return _topicImageView;
|
||||
if (!_topicImageView) {
|
||||
_topicImageView = [[UIImageView alloc] init];
|
||||
_topicImageView.userInteractionEnabled = YES;
|
||||
// _topicImageView.image = [UIImage gradientColorImageFromColors:@[UIColorFromRGB(0xFFFCDD), UIColorFromRGB(0xDFF9FF), UIColorFromRGB(0xF4E5FF)] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)];
|
||||
_topicImageView.layer.masksToBounds = YES;
|
||||
_topicImageView.layer.cornerRadius = 8;
|
||||
}
|
||||
return _topicImageView;
|
||||
}
|
||||
|
||||
- (UIImageView *)iconImageView {
|
||||
if (!_iconImageView) {
|
||||
_iconImageView = [[UIImageView alloc] init];
|
||||
_iconImageView.userInteractionEnabled = YES;
|
||||
_iconImageView.image = [UIImage imageNamed:@"monents_info_topic_icon"];
|
||||
}
|
||||
return _iconImageView;
|
||||
if (!_iconImageView) {
|
||||
_iconImageView = [[UIImageView alloc] init];
|
||||
_iconImageView.userInteractionEnabled = YES;
|
||||
_iconImageView.image = [UIImage imageNamed:@"monents_info_topic_icon"];
|
||||
}
|
||||
return _iconImageView;
|
||||
}
|
||||
|
||||
- (UILabel *)topicLabel {
|
||||
if (!_topicLabel) {
|
||||
_topicLabel = [[UILabel alloc] init];
|
||||
_topicLabel.font = [UIFont systemFontOfSize:10 weight:UIFontWeightBold];
|
||||
_topicLabel.textColor = [DJDKMIMOMColor mainTextColor];
|
||||
}
|
||||
return _topicLabel;
|
||||
if (!_topicLabel) {
|
||||
_topicLabel = [[UILabel alloc] init];
|
||||
_topicLabel.font = [UIFont systemFontOfSize:11 weight:UIFontWeightRegular];
|
||||
_topicLabel.textColor = [DJDKMIMOMColor mainTextColor];
|
||||
}
|
||||
return _topicLabel;
|
||||
}
|
||||
|
||||
- (UILabel *)timeLabel {
|
||||
if (!_timeLabel) {
|
||||
_timeLabel = [[UILabel alloc] init];
|
||||
_timeLabel.font = [UIFont systemFontOfSize:10];
|
||||
_timeLabel.textColor = [DJDKMIMOMColor textThirdColor];
|
||||
}
|
||||
return _timeLabel;
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
@@ -1,8 +1,8 @@
|
||||
//
|
||||
// YMMonentsContentView.h
|
||||
// YUMI
|
||||
// XPMonentsContentView.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by YUMI on 2022/5/13.
|
||||
// Created by 冯硕 on 2022/5/13.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
@@ -18,13 +18,11 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@end
|
||||
|
||||
@interface XPMonentsContentView : UIView
|
||||
///
|
||||
@property (nonatomic,assign) BOOL isTopic;
|
||||
@property (nonatomic,strong) MonentsInfoModel *monentsInfo;
|
||||
///代理
|
||||
@property (nonatomic,weak) id<XPMonentsContentViewDelegate> delegate;
|
||||
|
||||
/// 是否是审核UI
|
||||
@property (nonatomic,assign) BOOL isSimple;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -1,8 +1,8 @@
|
||||
//
|
||||
// YMMonentsContentView.m
|
||||
// YUMI
|
||||
// XPMonentsContentView.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by YUMI on 2022/5/13.
|
||||
// Created by 冯硕 on 2022/5/13.
|
||||
//
|
||||
|
||||
#import "XPMonentsContentView.h"
|
||||
@@ -10,7 +10,7 @@
|
||||
#import <Masonry/Masonry.h>
|
||||
#import <YYText/YYText.h>
|
||||
///Tool
|
||||
#import "DJDKMIMOMColor.h"
|
||||
|
||||
#import "XPMonentsLayoutConfig.h"
|
||||
#import "UIButton+EnlargeTouchArea.h"
|
||||
///Model
|
||||
@@ -22,152 +22,173 @@
|
||||
@property (nonatomic,strong) UILabel *contentLabel;
|
||||
///折叠的按钮
|
||||
@property (nonatomic,strong) UIButton *foldButton;
|
||||
///显示时间
|
||||
@property (nonatomic,strong) UILabel *timeLabel;
|
||||
@end
|
||||
|
||||
|
||||
@implementation XPMonentsContentView
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame {
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
}
|
||||
return self;
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
#pragma mark - Private Method
|
||||
- (void)initSubViews {
|
||||
[self addSubview:self.stackView];
|
||||
[self.stackView addArrangedSubview:self.contentLabel];
|
||||
[self.stackView addArrangedSubview:self.foldButton];
|
||||
|
||||
[self addSubview:self.stackView];
|
||||
[self.stackView addArrangedSubview:self.contentLabel];
|
||||
[self.stackView addArrangedSubview:self.foldButton];
|
||||
[self.stackView addArrangedSubview:self.timeLabel];
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
[self.stackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.mas_equalTo(self);
|
||||
}];
|
||||
|
||||
[self.foldButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(kMONENTS_FOLD_HEIGHT);
|
||||
}];
|
||||
|
||||
[self.stackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.mas_equalTo(self);
|
||||
}];
|
||||
[self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(14);
|
||||
}];
|
||||
[self.foldButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(kMONENTS_FOLD_HEIGHT);
|
||||
}];
|
||||
}
|
||||
|
||||
- (NSAttributedString *)createMonentsContentAttribute {
|
||||
NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] init];
|
||||
if (self.monentsInfo.squareTop ) {//动态/广场
|
||||
NSTextAttachment * attachment = [[NSTextAttachment alloc] init];
|
||||
attachment.bounds = CGRectMake(0, 0, 25 * 1.3, 10 * 1.3);
|
||||
attachment.image = [UIImage imageNamed:@"monents_info_top"];
|
||||
NSAttributedString * starAttribute = [NSMutableAttributedString attributedStringWithAttachment:(NSTextAttachment *)attachment];
|
||||
[attributedString insertAttributedString:starAttribute atIndex:0];
|
||||
}
|
||||
[attributedString appendAttributedString:[self creatStrAttrByStr:self.monentsInfo.content attributed:@{NSFontAttributeName : [UIFont systemFontOfSize:15]}]];
|
||||
attributedString.yy_lineSpacing = 5;
|
||||
attributedString.yy_lineBreakMode = NSLineBreakByWordWrapping;
|
||||
return attributedString;
|
||||
NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] init];
|
||||
BOOL isTop = NO;
|
||||
if(self.isTopic && self.monentsInfo.topicTop){
|
||||
isTop = YES;
|
||||
}else{
|
||||
if (self.monentsInfo.squareTop ) {
|
||||
isTop = YES;
|
||||
}
|
||||
}
|
||||
if (isTop) {//动态/广场
|
||||
NSTextAttachment * attachment = [[NSTextAttachment alloc] init];
|
||||
UIImage *iconImage = [UIImage imageNamed:@"monents_info_top"];;
|
||||
attachment.bounds = CGRectMake(0, roundf(self.contentLabel.font.capHeight - iconImage.size.height)/2.f, iconImage.size.width, iconImage.size.height);
|
||||
|
||||
attachment.image =iconImage;
|
||||
NSAttributedString * starAttribute = [NSMutableAttributedString attributedStringWithAttachment:(NSTextAttachment *)attachment];
|
||||
[attributedString insertAttributedString:starAttribute atIndex:0];
|
||||
//将图片插入到合适的位置
|
||||
// [attributedString appendAttributedString:[self creatStrAttrByStr:YMLocalizedString(@"XPMonentsContentView0") attributed:@{NSFontAttributeName : [UIFont systemFontOfSize:15], NSForegroundColorAttributeName: UIColorFromRGB(0xE84C46)}]];
|
||||
}
|
||||
[attributedString appendAttributedString:[self creatStrAttrByStr:self.monentsInfo.content attributed:@{NSFontAttributeName : [UIFont systemFontOfSize:15]}]];
|
||||
attributedString.yy_lineSpacing = 5;
|
||||
attributedString.yy_lineBreakMode = NSLineBreakByWordWrapping;
|
||||
return attributedString;
|
||||
}
|
||||
|
||||
- (NSMutableAttributedString *)creatStrAttrByStr:(NSString *)str attributed:(NSDictionary *)attribute{
|
||||
if (str.length == 0 || !str) {
|
||||
str = @" ";
|
||||
}
|
||||
NSMutableAttributedString *attr = [[NSMutableAttributedString alloc] initWithString:str attributes:attribute];
|
||||
return attr;
|
||||
if (str.length == 0 || !str) {
|
||||
str = @" ";
|
||||
}
|
||||
NSMutableAttributedString *attr = [[NSMutableAttributedString alloc] initWithString:str attributes:attribute];
|
||||
return attr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#pragma mark - Event Response
|
||||
- (void)didClickFoldButton:(UIButton *)sender {
|
||||
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];
|
||||
}
|
||||
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];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
|
||||
- (void)setIsSimple:(BOOL)isSimple {
|
||||
_isSimple = isSimple;
|
||||
self.contentLabel.preferredMaxLayoutWidth = isSimple ? kSIMPLE_MONENTS_CONTENT_MAX_WIDTH : kMONENTS_CONTENT_MAX_WIDTH;
|
||||
}
|
||||
|
||||
- (void)setMonentsInfo:(MonentsInfoModel *)monentsInfo {
|
||||
_monentsInfo = monentsInfo;
|
||||
if (_monentsInfo) {
|
||||
self.contentLabel.attributedText = [self createMonentsContentAttribute];
|
||||
self.foldButton.selected = !_monentsInfo.isFold;
|
||||
if (monentsInfo.numberOfText <= 0) {
|
||||
YYTextContainer *container = [YYTextContainer new];
|
||||
container.size = CGSizeMake(self.isSimple ? kSIMPLE_MONENTS_CONTENT_MAX_WIDTH : 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 {
|
||||
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);
|
||||
}];
|
||||
}
|
||||
}
|
||||
}
|
||||
_monentsInfo = monentsInfo;
|
||||
if (_monentsInfo) {
|
||||
self.timeLabel.text = [NSString stringWithTimeStamp:_monentsInfo.publishTime];
|
||||
self.contentLabel.attributedText = [self createMonentsContentAttribute];
|
||||
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 {
|
||||
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);
|
||||
}];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (UIStackView *)stackView {
|
||||
if (!_stackView) {
|
||||
_stackView = [[UIStackView alloc] init];
|
||||
_stackView.axis = UILayoutConstraintAxisVertical;
|
||||
_stackView.distribution = UIStackViewDistributionFill;
|
||||
_stackView.alignment = UIStackViewAlignmentLeading;
|
||||
_stackView.spacing = 0;
|
||||
}
|
||||
return _stackView;
|
||||
if (!_stackView) {
|
||||
_stackView = [[UIStackView alloc] init];
|
||||
_stackView.axis = UILayoutConstraintAxisVertical;
|
||||
_stackView.distribution = UIStackViewDistributionFill;
|
||||
_stackView.alignment = UIStackViewAlignmentLeading;
|
||||
_stackView.spacing = 5;
|
||||
}
|
||||
return _stackView;
|
||||
}
|
||||
|
||||
- (UIButton *)foldButton {
|
||||
if (_foldButton == nil) {
|
||||
_foldButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_foldButton setTitle:YMLocalizedString(@"XPMonentsContentView0") forState:UIControlStateNormal];
|
||||
[_foldButton setTitle:YMLocalizedString(@"XPMonentsContentView1") forState:UIControlStateSelected];
|
||||
[_foldButton setTitleColor:UIColorFromRGB(0x34A7FF) forState:UIControlStateNormal];
|
||||
[_foldButton setTitleColor:UIColorFromRGB(0x34A7FF) forState:UIControlStateSelected];
|
||||
_foldButton.titleLabel.font = [UIFont systemFontOfSize:15];
|
||||
_foldButton.hidden = YES;
|
||||
[_foldButton addTarget:self action:@selector(didClickFoldButton:) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _foldButton;
|
||||
if (_foldButton == nil) {
|
||||
_foldButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_foldButton setTitle:YMLocalizedString(@"XPMonentsContentView1") forState:UIControlStateNormal];
|
||||
[_foldButton setTitle:YMLocalizedString(@"XPMonentsContentView2") forState:UIControlStateSelected];
|
||||
[_foldButton setTitleColor:UIColorFromRGB(0x34A7FF) forState:UIControlStateNormal];
|
||||
[_foldButton setTitleColor:UIColorFromRGB(0x34A7FF) forState:UIControlStateSelected];
|
||||
_foldButton.titleLabel.font = [UIFont systemFontOfSize:15];
|
||||
_foldButton.hidden = YES;
|
||||
[_foldButton addTarget:self action:@selector(didClickFoldButton:) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _foldButton;
|
||||
}
|
||||
|
||||
|
||||
- (UILabel *)contentLabel {
|
||||
if (!_contentLabel) {
|
||||
_contentLabel = [[UILabel alloc] init];
|
||||
_contentLabel.numberOfLines = 0;
|
||||
_contentLabel.font = [UIFont systemFontOfSize:15];
|
||||
_contentLabel.textColor = UIColorRGBAlpha(0x333333, 1);
|
||||
if (!_contentLabel) {
|
||||
_contentLabel = [[UILabel alloc] init];
|
||||
_contentLabel.numberOfLines = 0;
|
||||
_contentLabel.font = [UIFont systemFontOfSize:14 weight:UIFontWeightRegular];
|
||||
_contentLabel.textColor = UIColorRGBAlpha(0x1F1A4E, 1);
|
||||
_contentLabel.preferredMaxLayoutWidth = kMONENTS_CONTENT_MAX_WIDTH;
|
||||
_contentLabel.lineBreakMode = NSLineBreakByWordWrapping;
|
||||
_contentLabel.lineBreakMode = NSLineBreakByWordWrapping;
|
||||
|
||||
}
|
||||
return _contentLabel;
|
||||
}
|
||||
return _contentLabel;
|
||||
}
|
||||
- (UILabel *)timeLabel {
|
||||
if (!_timeLabel) {
|
||||
_timeLabel = [[UILabel alloc] init];
|
||||
_timeLabel.font = [UIFont systemFontOfSize:12 weight:UIFontWeightRegular];
|
||||
_timeLabel.textColor = [DJDKMIMOMColor textThirdColor];
|
||||
}
|
||||
return _timeLabel;
|
||||
}
|
||||
|
||||
@end
|
||||
|
@@ -1,18 +1,16 @@
|
||||
//
|
||||
// YMMonentsPhotoView.m
|
||||
// YUMI
|
||||
// XPMonentsPhotoView.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by YUMI on 2022/5/12.
|
||||
// Created by 冯硕 on 2022/5/12.
|
||||
//
|
||||
|
||||
#import "XPMonentsPhotoView.h"
|
||||
///Third
|
||||
#import <Masonry/Masonry.h>
|
||||
///Tool
|
||||
#import "DJDKMIMOMColor.h"
|
||||
#import "NetImageView.h"
|
||||
#import "XPMonentsLayoutConfig.h"
|
||||
#import "NSArray+Safe.h"
|
||||
///Model
|
||||
#import "MonentsInfoModel.h"
|
||||
|
||||
@@ -42,38 +40,38 @@
|
||||
@implementation XPMonentsPhotoView
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame {
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
[self initSubViews];
|
||||
}
|
||||
return self;
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
[self initSubViews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
#pragma mark - Private Method
|
||||
- (void)initSubViews {
|
||||
[self addSubview:self.firstImageView];
|
||||
[self addSubview:self.secondImageView];
|
||||
[self addSubview:self.thirdImageView];
|
||||
[self addSubview:self.fourthImageView];
|
||||
[self addSubview:self.fifthImageView];
|
||||
[self addSubview:self.sixthImageView];
|
||||
[self addSubview:self.sevenImageView];
|
||||
[self addSubview:self.eighthImageView];
|
||||
[self addSubview:self.ninthImageView];
|
||||
self.subViewArray = @[self.firstImageView, self.secondImageView, self.thirdImageView, self.fourthImageView, self.fifthImageView, self.sixthImageView, self.sevenImageView, self.eighthImageView, self.ninthImageView];
|
||||
[self addSubview:self.firstImageView];
|
||||
[self addSubview:self.secondImageView];
|
||||
[self addSubview:self.thirdImageView];
|
||||
[self addSubview:self.fourthImageView];
|
||||
[self addSubview:self.fifthImageView];
|
||||
[self addSubview:self.sixthImageView];
|
||||
[self addSubview:self.sevenImageView];
|
||||
[self addSubview:self.eighthImageView];
|
||||
[self addSubview:self.ninthImageView];
|
||||
self.subViewArray = @[self.firstImageView, self.secondImageView, self.thirdImageView, self.fourthImageView, self.fifthImageView, self.sixthImageView, self.sevenImageView, self.eighthImageView, self.ninthImageView];
|
||||
}
|
||||
|
||||
- (void)hiddenAllImageView {
|
||||
[self.subviews enumerateObjectsUsingBlock:^(__kindof UIView * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
obj.hidden = YES;
|
||||
}];
|
||||
[self.subviews enumerateObjectsUsingBlock:^(__kindof UIView * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
obj.hidden = YES;
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - Event Response
|
||||
- (void)tapImageView:(UITapGestureRecognizer *)tap {
|
||||
NetImageView * imageView = (NetImageView *)tap.view;
|
||||
if (imageView.imageUrl.length > 0 && self.delegate && [self.delegate respondsToSelector:@selector(xPMonentsPhotoView:didClickImage:)]) {
|
||||
[self.delegate xPMonentsPhotoView:self didClickImage:imageView.tag - 1001];
|
||||
}
|
||||
NetImageView * imageView = (NetImageView *)tap.view;
|
||||
if (imageView.imageUrl.length > 0 && self.delegate && [self.delegate respondsToSelector:@selector(xPMonentsPhotoView:didClickImage:)]) {
|
||||
[self.delegate xPMonentsPhotoView:self didClickImage:imageView.tag - 1001];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -144,222 +142,225 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
- (void)setDynamicResList:(NSArray<MonentsPicInfoModel *> *)dynamicResList {
|
||||
_dynamicResList = dynamicResList;
|
||||
[self hiddenAllImageView];
|
||||
if (_dynamicResList.count == 0) {
|
||||
|
||||
} else if (_dynamicResList.count == 1) {
|
||||
self.firstImageView.hidden = NO;
|
||||
[self.firstImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
make.size.mas_equalTo(CGSizeMake(kMONENTS_PIC_ONE_WIDTH, kMONENTS_PIC_ONE_WIDTH));
|
||||
make.left.top.mas_equalTo(self);
|
||||
}];
|
||||
MonentsPicInfoModel * picInfo = [_dynamicResList safeObjectAtIndex1:0];
|
||||
self.firstImageView.imageUrl = picInfo.resUrl;
|
||||
} else if(_dynamicResList.count == 2) {
|
||||
self.firstImageView.hidden = NO;
|
||||
CGFloat itemWidth = (kMONENTS_CONTENT_MAX_WIDTH - kMONENTS_PIC_SPACE) / 2;
|
||||
[self.firstImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
make.size.mas_equalTo(CGSizeMake(itemWidth, itemWidth));
|
||||
make.left.top.mas_equalTo(self);
|
||||
}];
|
||||
|
||||
MonentsPicInfoModel * picInfo = [_dynamicResList safeObjectAtIndex1:0];
|
||||
self.firstImageView.imageUrl = picInfo.resUrl;
|
||||
|
||||
self.secondImageView.hidden = NO;
|
||||
[self.secondImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
make.size.mas_equalTo(CGSizeMake(itemWidth, itemWidth));
|
||||
make.top.mas_equalTo(self);
|
||||
make.left.mas_equalTo(self.firstImageView.mas_right).offset(kMONENTS_PIC_SPACE);
|
||||
}];
|
||||
|
||||
MonentsPicInfoModel * secondPicInfo = [_dynamicResList safeObjectAtIndex1:1];
|
||||
self.secondImageView.imageUrl = secondPicInfo.resUrl;
|
||||
|
||||
} else{
|
||||
for (int i = 0; i < _dynamicResList.count; i++) {
|
||||
MonentsPicInfoModel * picInfo = [_dynamicResList safeObjectAtIndex1:i];
|
||||
if (i < self.subViewArray.count) {
|
||||
NetImageView * imageView = [self.subViewArray safeObjectAtIndex1:i];
|
||||
imageView.hidden = NO;
|
||||
imageView.imageUrl = picInfo.resUrl;
|
||||
}
|
||||
}
|
||||
|
||||
CGFloat itemWidth = (kMONENTS_CONTENT_MAX_WIDTH - kMONENTS_PIC_SPACE * 2) / 3;
|
||||
for (int i = 0; i < self.subViewArray.count; i++) {
|
||||
NSInteger page = i % 3;
|
||||
NSInteger line = i / 3;
|
||||
NetImageView * imageView = [self.subViewArray safeObjectAtIndex1:i];
|
||||
[imageView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
make.size.mas_equalTo(CGSizeMake(itemWidth, itemWidth));
|
||||
make.left.mas_equalTo(page * (itemWidth + kMONENTS_PIC_SPACE));
|
||||
make.top.mas_equalTo(line * (itemWidth + kMONENTS_PIC_SPACE));
|
||||
}];
|
||||
}
|
||||
|
||||
}
|
||||
_dynamicResList = dynamicResList;
|
||||
[self hiddenAllImageView];
|
||||
if (_dynamicResList.count == 0) {
|
||||
|
||||
} else if (_dynamicResList.count == 1) {
|
||||
self.firstImageView.hidden = NO;
|
||||
[self.firstImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
make.size.mas_equalTo(CGSizeMake(kMONENTS_PIC_ONE_WIDTH, kMONENTS_PIC_ONE_WIDTH));
|
||||
make.left.top.mas_equalTo(self);
|
||||
}];
|
||||
MonentsPicInfoModel * picInfo = [_dynamicResList safeObjectAtIndex1:0];
|
||||
self.firstImageView.imageUrl = picInfo.resUrl;
|
||||
} else if(_dynamicResList.count == 2) {
|
||||
self.firstImageView.hidden = NO;
|
||||
CGFloat itemWidth = (kMONENTS_CONTENT_MAX_WIDTH - kMONENTS_PIC_SPACE) / 2;
|
||||
[self.firstImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
make.size.mas_equalTo(CGSizeMake(itemWidth, itemWidth));
|
||||
make.left.top.mas_equalTo(self);
|
||||
}];
|
||||
|
||||
MonentsPicInfoModel * picInfo = [_dynamicResList safeObjectAtIndex1:0];
|
||||
self.firstImageView.imageUrl = picInfo.resUrl;
|
||||
|
||||
self.secondImageView.hidden = NO;
|
||||
[self.secondImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
make.size.mas_equalTo(CGSizeMake(itemWidth, itemWidth));
|
||||
make.top.mas_equalTo(self);
|
||||
make.left.mas_equalTo(self.firstImageView.mas_right).offset(kMONENTS_PIC_SPACE);
|
||||
}];
|
||||
|
||||
MonentsPicInfoModel * secondPicInfo = [_dynamicResList safeObjectAtIndex1:1];
|
||||
self.secondImageView.imageUrl = secondPicInfo.resUrl;
|
||||
|
||||
} else{
|
||||
for (int i = 0; i < _dynamicResList.count; i++) {
|
||||
MonentsPicInfoModel * picInfo = [_dynamicResList safeObjectAtIndex1:i];
|
||||
if (i < self.subViewArray.count) {
|
||||
NetImageView * imageView = [self.subViewArray safeObjectAtIndex1:i];
|
||||
imageView.hidden = NO;
|
||||
imageView.imageUrl = picInfo.resUrl;
|
||||
}
|
||||
}
|
||||
|
||||
CGFloat itemWidth = (kMONENTS_CONTENT_MAX_WIDTH - kMONENTS_PIC_SPACE * 2) / 3;
|
||||
for (int i = 0; i < self.subViewArray.count; i++) {
|
||||
NSInteger page = i % 3;
|
||||
NSInteger line = i / 3;
|
||||
NetImageView * imageView = [self.subViewArray safeObjectAtIndex1:i];
|
||||
if(imageView == nil)return;
|
||||
[imageView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
make.size.mas_equalTo(CGSizeMake(itemWidth, itemWidth));
|
||||
make.left.mas_equalTo(page * (itemWidth + kMONENTS_PIC_SPACE));
|
||||
make.top.mas_equalTo(line * (itemWidth + kMONENTS_PIC_SPACE));
|
||||
}];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
- (NetImageView *)firstImageView {
|
||||
if (!_firstImageView) {
|
||||
NetImageConfig * config = [[NetImageConfig alloc]init];
|
||||
config.imageType = ImageTypeMonentsPhoto;
|
||||
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
|
||||
_firstImageView = [[NetImageView alloc] initWithConfig:config];
|
||||
_firstImageView.layer.masksToBounds = YES;
|
||||
_firstImageView.layer.cornerRadius = 12;
|
||||
_firstImageView.contentMode = UIViewContentModeScaleAspectFill;
|
||||
_firstImageView.tag = 1000 + 1;
|
||||
_firstImageView.userInteractionEnabled = YES;
|
||||
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapImageView:)];
|
||||
[_firstImageView addGestureRecognizer:tap];
|
||||
}
|
||||
return _firstImageView;
|
||||
if (!_firstImageView) {
|
||||
NetImageConfig * config = [[NetImageConfig alloc]init];
|
||||
config.imageType = ImageTypeMonentsPhoto;
|
||||
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
|
||||
_firstImageView = [[NetImageView alloc] initWithConfig:config];
|
||||
_firstImageView.layer.masksToBounds = YES;
|
||||
_firstImageView.layer.cornerRadius = 12;
|
||||
_firstImageView.contentMode = UIViewContentModeScaleAspectFill;
|
||||
_firstImageView.tag = 1000 + 1;
|
||||
_firstImageView.userInteractionEnabled = YES;
|
||||
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapImageView:)];
|
||||
[_firstImageView addGestureRecognizer:tap];
|
||||
}
|
||||
return _firstImageView;
|
||||
}
|
||||
|
||||
- (NetImageView *)secondImageView {
|
||||
if (!_secondImageView) {
|
||||
NetImageConfig * config = [[NetImageConfig alloc]init];
|
||||
config.imageType = ImageTypeMonentsPhoto;
|
||||
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
|
||||
_secondImageView = [[NetImageView alloc] initWithConfig:config];
|
||||
_secondImageView.layer.masksToBounds = YES;
|
||||
_secondImageView.layer.cornerRadius = 12;
|
||||
_secondImageView.contentMode = UIViewContentModeScaleAspectFill;
|
||||
_secondImageView.tag = 1000 + 2;
|
||||
_secondImageView.userInteractionEnabled = YES;
|
||||
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapImageView:)];
|
||||
[_secondImageView addGestureRecognizer:tap];
|
||||
}
|
||||
return _secondImageView;
|
||||
if (!_secondImageView) {
|
||||
NetImageConfig * config = [[NetImageConfig alloc]init];
|
||||
config.imageType = ImageTypeMonentsPhoto;
|
||||
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
|
||||
_secondImageView = [[NetImageView alloc] initWithConfig:config];
|
||||
_secondImageView.layer.masksToBounds = YES;
|
||||
_secondImageView.layer.cornerRadius = 12;
|
||||
_secondImageView.contentMode = UIViewContentModeScaleAspectFill;
|
||||
_secondImageView.tag = 1000 + 2;
|
||||
_secondImageView.userInteractionEnabled = YES;
|
||||
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapImageView:)];
|
||||
[_secondImageView addGestureRecognizer:tap];
|
||||
}
|
||||
return _secondImageView;
|
||||
}
|
||||
|
||||
- (NetImageView *)thirdImageView {
|
||||
if (!_thirdImageView) {
|
||||
NetImageConfig * config = [[NetImageConfig alloc]init];
|
||||
config.imageType = ImageTypeMonentsPhoto;
|
||||
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
|
||||
_thirdImageView = [[NetImageView alloc] initWithConfig:config];
|
||||
_thirdImageView.layer.masksToBounds = YES;
|
||||
_thirdImageView.layer.cornerRadius = 12;
|
||||
_thirdImageView.contentMode = UIViewContentModeScaleAspectFill;
|
||||
_thirdImageView.tag = 1000 + 3;
|
||||
_thirdImageView.userInteractionEnabled = YES;
|
||||
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapImageView:)];
|
||||
[_thirdImageView addGestureRecognizer:tap];
|
||||
}
|
||||
return _thirdImageView;
|
||||
if (!_thirdImageView) {
|
||||
NetImageConfig * config = [[NetImageConfig alloc]init];
|
||||
config.imageType = ImageTypeMonentsPhoto;
|
||||
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
|
||||
_thirdImageView = [[NetImageView alloc] initWithConfig:config];
|
||||
_thirdImageView.layer.masksToBounds = YES;
|
||||
_thirdImageView.layer.cornerRadius = 12;
|
||||
_thirdImageView.contentMode = UIViewContentModeScaleAspectFill;
|
||||
_thirdImageView.tag = 1000 + 3;
|
||||
_thirdImageView.userInteractionEnabled = YES;
|
||||
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapImageView:)];
|
||||
[_thirdImageView addGestureRecognizer:tap];
|
||||
}
|
||||
return _thirdImageView;
|
||||
}
|
||||
|
||||
|
||||
- (NetImageView *)fourthImageView {
|
||||
if (!_fourthImageView) {
|
||||
NetImageConfig * config = [[NetImageConfig alloc]init];
|
||||
config.imageType = ImageTypeMonentsPhoto;
|
||||
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
|
||||
_fourthImageView = [[NetImageView alloc] initWithConfig:config];
|
||||
_fourthImageView.layer.masksToBounds = YES;
|
||||
_fourthImageView.layer.cornerRadius = 12;
|
||||
_fourthImageView.contentMode = UIViewContentModeScaleAspectFill;
|
||||
_fourthImageView.tag = 1000 + 4;
|
||||
_fourthImageView.userInteractionEnabled = YES;
|
||||
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapImageView:)];
|
||||
[_fourthImageView addGestureRecognizer:tap];
|
||||
|
||||
}
|
||||
return _fourthImageView;
|
||||
if (!_fourthImageView) {
|
||||
NetImageConfig * config = [[NetImageConfig alloc]init];
|
||||
config.imageType = ImageTypeMonentsPhoto;
|
||||
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
|
||||
_fourthImageView = [[NetImageView alloc] initWithConfig:config];
|
||||
_fourthImageView.layer.masksToBounds = YES;
|
||||
_fourthImageView.layer.cornerRadius = 12;
|
||||
_fourthImageView.contentMode = UIViewContentModeScaleAspectFill;
|
||||
_fourthImageView.tag = 1000 + 4;
|
||||
_fourthImageView.userInteractionEnabled = YES;
|
||||
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapImageView:)];
|
||||
[_fourthImageView addGestureRecognizer:tap];
|
||||
|
||||
}
|
||||
return _fourthImageView;
|
||||
}
|
||||
|
||||
- (NetImageView *)fifthImageView {
|
||||
if (!_fifthImageView) {
|
||||
NetImageConfig * config = [[NetImageConfig alloc]init];
|
||||
config.imageType = ImageTypeMonentsPhoto;
|
||||
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
|
||||
_fifthImageView = [[NetImageView alloc] initWithConfig:config];
|
||||
_fifthImageView.layer.masksToBounds = YES;
|
||||
_fifthImageView.layer.cornerRadius = 12;
|
||||
_fifthImageView.contentMode = UIViewContentModeScaleAspectFill;
|
||||
_fifthImageView.tag = 1000 + 5;
|
||||
_fifthImageView.userInteractionEnabled = YES;
|
||||
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapImageView:)];
|
||||
[_fifthImageView addGestureRecognizer:tap];
|
||||
}
|
||||
return _fifthImageView;
|
||||
if (!_fifthImageView) {
|
||||
NetImageConfig * config = [[NetImageConfig alloc]init];
|
||||
config.imageType = ImageTypeMonentsPhoto;
|
||||
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
|
||||
_fifthImageView = [[NetImageView alloc] initWithConfig:config];
|
||||
_fifthImageView.layer.masksToBounds = YES;
|
||||
_fifthImageView.layer.cornerRadius = 12;
|
||||
_fifthImageView.contentMode = UIViewContentModeScaleAspectFill;
|
||||
_fifthImageView.tag = 1000 + 5;
|
||||
_fifthImageView.userInteractionEnabled = YES;
|
||||
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapImageView:)];
|
||||
[_fifthImageView addGestureRecognizer:tap];
|
||||
}
|
||||
return _fifthImageView;
|
||||
}
|
||||
|
||||
|
||||
- (NetImageView *)sixthImageView {
|
||||
if (!_sixthImageView) {
|
||||
NetImageConfig * config = [[NetImageConfig alloc]init];
|
||||
config.imageType = ImageTypeMonentsPhoto;
|
||||
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
|
||||
_sixthImageView = [[NetImageView alloc] initWithConfig:config];
|
||||
_sixthImageView.layer.masksToBounds = YES;
|
||||
_sixthImageView.layer.cornerRadius = 12;
|
||||
_sixthImageView.contentMode = UIViewContentModeScaleAspectFill;
|
||||
_sixthImageView.tag = 1000 + 6;
|
||||
_sixthImageView.userInteractionEnabled = YES;
|
||||
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapImageView:)];
|
||||
[_sixthImageView addGestureRecognizer:tap];
|
||||
}
|
||||
return _sixthImageView;
|
||||
if (!_sixthImageView) {
|
||||
NetImageConfig * config = [[NetImageConfig alloc]init];
|
||||
config.imageType = ImageTypeMonentsPhoto;
|
||||
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
|
||||
_sixthImageView = [[NetImageView alloc] initWithConfig:config];
|
||||
_sixthImageView.layer.masksToBounds = YES;
|
||||
_sixthImageView.layer.cornerRadius = 12;
|
||||
_sixthImageView.contentMode = UIViewContentModeScaleAspectFill;
|
||||
_sixthImageView.tag = 1000 + 6;
|
||||
_sixthImageView.userInteractionEnabled = YES;
|
||||
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapImageView:)];
|
||||
[_sixthImageView addGestureRecognizer:tap];
|
||||
}
|
||||
return _sixthImageView;
|
||||
}
|
||||
|
||||
|
||||
- (NetImageView *)sevenImageView {
|
||||
if (!_sevenImageView) {
|
||||
NetImageConfig * config = [[NetImageConfig alloc]init];
|
||||
config.imageType = ImageTypeMonentsPhoto;
|
||||
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
|
||||
_sevenImageView = [[NetImageView alloc] initWithConfig:config];
|
||||
_sevenImageView.layer.masksToBounds = YES;
|
||||
_sevenImageView.layer.cornerRadius = 12;
|
||||
_sevenImageView.contentMode = UIViewContentModeScaleAspectFill;
|
||||
_sevenImageView.tag = 1000 + 7;
|
||||
_sevenImageView.userInteractionEnabled = YES;
|
||||
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapImageView:)];
|
||||
[_sevenImageView addGestureRecognizer:tap];
|
||||
}
|
||||
return _sevenImageView;
|
||||
if (!_sevenImageView) {
|
||||
NetImageConfig * config = [[NetImageConfig alloc]init];
|
||||
config.imageType = ImageTypeMonentsPhoto;
|
||||
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
|
||||
_sevenImageView = [[NetImageView alloc] initWithConfig:config];
|
||||
_sevenImageView.layer.masksToBounds = YES;
|
||||
_sevenImageView.layer.cornerRadius = 12;
|
||||
_sevenImageView.contentMode = UIViewContentModeScaleAspectFill;
|
||||
_sevenImageView.tag = 1000 + 7;
|
||||
_sevenImageView.userInteractionEnabled = YES;
|
||||
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapImageView:)];
|
||||
[_sevenImageView addGestureRecognizer:tap];
|
||||
}
|
||||
return _sevenImageView;
|
||||
}
|
||||
|
||||
|
||||
- (NetImageView *)eighthImageView {
|
||||
if (!_eighthImageView) {
|
||||
NetImageConfig * config = [[NetImageConfig alloc]init];
|
||||
config.imageType = ImageTypeMonentsPhoto;
|
||||
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
|
||||
_eighthImageView = [[NetImageView alloc] initWithConfig:config];
|
||||
_eighthImageView.layer.masksToBounds = YES;
|
||||
_eighthImageView.layer.cornerRadius = 12;
|
||||
_eighthImageView.contentMode = UIViewContentModeScaleAspectFill;
|
||||
_eighthImageView.tag = 1000 + 8;
|
||||
_eighthImageView.userInteractionEnabled = YES;
|
||||
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapImageView:)];
|
||||
[_eighthImageView addGestureRecognizer:tap];
|
||||
}
|
||||
return _eighthImageView;
|
||||
if (!_eighthImageView) {
|
||||
NetImageConfig * config = [[NetImageConfig alloc]init];
|
||||
config.imageType = ImageTypeMonentsPhoto;
|
||||
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
|
||||
_eighthImageView = [[NetImageView alloc] initWithConfig:config];
|
||||
_eighthImageView.layer.masksToBounds = YES;
|
||||
_eighthImageView.layer.cornerRadius = 12;
|
||||
_eighthImageView.contentMode = UIViewContentModeScaleAspectFill;
|
||||
_eighthImageView.tag = 1000 + 8;
|
||||
_eighthImageView.userInteractionEnabled = YES;
|
||||
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapImageView:)];
|
||||
[_eighthImageView addGestureRecognizer:tap];
|
||||
}
|
||||
return _eighthImageView;
|
||||
}
|
||||
|
||||
|
||||
- (NetImageView *)ninthImageView {
|
||||
if (!_ninthImageView) {
|
||||
NetImageConfig * config = [[NetImageConfig alloc]init];
|
||||
config.imageType = ImageTypeMonentsPhoto;
|
||||
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
|
||||
_ninthImageView = [[NetImageView alloc] initWithConfig:config];
|
||||
_ninthImageView.layer.masksToBounds = YES;
|
||||
_ninthImageView.layer.cornerRadius = 12;
|
||||
_ninthImageView.contentMode = UIViewContentModeScaleAspectFill;
|
||||
_ninthImageView.tag = 1000 + 9;
|
||||
_ninthImageView.userInteractionEnabled = YES;
|
||||
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapImageView:)];
|
||||
[_ninthImageView addGestureRecognizer:tap];
|
||||
}
|
||||
return _ninthImageView;
|
||||
if (!_ninthImageView) {
|
||||
NetImageConfig * config = [[NetImageConfig alloc]init];
|
||||
config.imageType = ImageTypeMonentsPhoto;
|
||||
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
|
||||
_ninthImageView = [[NetImageView alloc] initWithConfig:config];
|
||||
_ninthImageView.layer.masksToBounds = YES;
|
||||
_ninthImageView.layer.cornerRadius = 12;
|
||||
_ninthImageView.contentMode = UIViewContentModeScaleAspectFill;
|
||||
_ninthImageView.tag = 1000 + 9;
|
||||
_ninthImageView.userInteractionEnabled = YES;
|
||||
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapImageView:)];
|
||||
[_ninthImageView addGestureRecognizer:tap];
|
||||
}
|
||||
return _ninthImageView;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -1,26 +1,32 @@
|
||||
//
|
||||
// YMMonentsRecommendHeaderView.m
|
||||
// YUMI
|
||||
// XPMonentsRecommendHeaderView.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by YUMI on 2022/5/18.
|
||||
// Created by 冯硕 on 2022/5/18.
|
||||
//
|
||||
|
||||
#import "XPMonentsRecommendHeaderView.h"
|
||||
///Third
|
||||
#import <Masonry/Masonry.h>
|
||||
///Tool
|
||||
#import "DJDKMIMOMColor.h"
|
||||
#import "NSArray+Safe.h"
|
||||
|
||||
///Model
|
||||
#import "MonentsTopicModel.h"
|
||||
///View
|
||||
#import "XPMonentsTopicCollectionViewCell.h"
|
||||
|
||||
@interface XPMonentsRecommendHeaderView ()<UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout>
|
||||
@interface XPMonentsRecommendHeaderView ()<UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout>
|
||||
///背景图
|
||||
@property (nonatomic,strong) UIImageView *bgView;
|
||||
|
||||
///titile背景
|
||||
@property (nonatomic,strong) UIImageView *titleBgView;
|
||||
|
||||
///显示标题
|
||||
@property (nonatomic,strong) UILabel *titleLabel;
|
||||
///显示箭头
|
||||
@property (nonatomic,strong) UIButton *arrowButton;
|
||||
//@property (nonatomic,strong) UIButton *arrowButton;
|
||||
///列表背景
|
||||
@property (nonatomic,strong) UIView *collectionBgView;
|
||||
///列表
|
||||
@property (nonatomic,strong) UICollectionView *collectionView;
|
||||
|
||||
@@ -29,115 +35,182 @@
|
||||
@implementation XPMonentsRecommendHeaderView
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame {
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
}
|
||||
return self;
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
#pragma mark - Private Method
|
||||
- (void)initSubViews {
|
||||
self.backgroundColor = [DJDKMIMOMColor appCellBackgroundColor];
|
||||
[self addSubview:self.titleLabel];
|
||||
[self addSubview:self.arrowButton];
|
||||
[self addSubview:self.collectionView];
|
||||
self.backgroundColor = [DJDKMIMOMColor appCellBackgroundColor];
|
||||
[self addSubview:self.bgView];
|
||||
[self.bgView addSubview:self.collectionBgView];
|
||||
[self.collectionBgView addSubview:self.collectionView];
|
||||
[self.bgView addSubview:self.titleBgView];
|
||||
[self.titleBgView addSubview:self.titleLabel];
|
||||
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self).offset(15);
|
||||
make.top.mas_equalTo(self).offset(15);
|
||||
}];
|
||||
|
||||
[self.arrowButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.size.mas_equalTo(CGSizeMake(11, 20));
|
||||
make.centerY.mas_equalTo(self.titleLabel);
|
||||
make.right.mas_equalTo(self).offset(-15);
|
||||
}];
|
||||
|
||||
[self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.mas_equalTo(self);
|
||||
make.top.mas_equalTo(self.titleLabel.mas_bottom).offset(10);
|
||||
make.height.mas_equalTo(77);
|
||||
}];
|
||||
|
||||
[self.bgView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(16);
|
||||
make.right.mas_offset(-15);
|
||||
make.left.mas_offset(15);
|
||||
make.bottom.mas_equalTo(-20);
|
||||
}];
|
||||
// [self.collectionBgView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
// make.top.mas_equalTo(10);
|
||||
// make.left.mas_equalTo(10);
|
||||
// make.right.mas_equalTo(-10);
|
||||
// make.bottom.mas_equalTo(-10);
|
||||
// }];
|
||||
[self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(15);
|
||||
make.left.right.equalTo(self.collectionBgView);
|
||||
make.height.mas_equalTo(69);
|
||||
}];
|
||||
[self.titleBgView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.left.equalTo(self.bgView);
|
||||
make.width.mas_equalTo(74);
|
||||
make.height.mas_equalTo(21);
|
||||
}];
|
||||
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.center.equalTo(self.titleBgView);
|
||||
}];
|
||||
|
||||
// [self.arrowButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
// make.size.mas_equalTo(CGSizeMake(11, 20));
|
||||
// make.centerY.mas_equalTo(self.titleLabel);
|
||||
// make.right.mas_equalTo(self).offset(-15);
|
||||
// }];
|
||||
|
||||
|
||||
}
|
||||
|
||||
#pragma mark - UICollectionViewDelegate And UICollectionViewDatasource
|
||||
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
|
||||
return self.topicList.count;
|
||||
return self.topicList.count;
|
||||
}
|
||||
|
||||
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
|
||||
return CGSizeMake(125, 77);
|
||||
}
|
||||
//- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
|
||||
// MonentsTopicModel * topicModel = [self.topicList safeObjectWithIndex:indexPath.row];
|
||||
// CGFloat itemWidth = [topicModel.name boundingRectWithSize:CGSizeMake(100, CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingTruncatesLastVisibleLine attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:10 weight:UIFontWeightBold]} context:nil].size.width;
|
||||
// return CGSizeMake(itemWidth +34, 26);
|
||||
//}
|
||||
|
||||
- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
|
||||
XPMonentsTopicCollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPMonentsTopicCollectionViewCell class]) forIndexPath:indexPath];
|
||||
cell.topicInfo = [self.topicList safeObjectAtIndex1:indexPath.row];
|
||||
return cell;
|
||||
XPMonentsTopicCollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPMonentsTopicCollectionViewCell class]) forIndexPath:indexPath];
|
||||
|
||||
cell.topicInfo = [self.topicList safeObjectAtIndex1:indexPath.row];
|
||||
|
||||
return cell;
|
||||
}
|
||||
|
||||
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
|
||||
[collectionView deselectItemAtIndexPath:indexPath animated:YES];
|
||||
if (self.topicList.count > 0) {
|
||||
MonentsTopicModel * topicInfo = [self.topicList safeObjectAtIndex1:indexPath.row];
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(xPMonentsRecommendHeaderView:didSelectItem:)]) {
|
||||
[self.delegate xPMonentsRecommendHeaderView:self didSelectItem:topicInfo];
|
||||
}
|
||||
}
|
||||
[collectionView deselectItemAtIndexPath:indexPath animated:YES];
|
||||
if (self.topicList.count > 0) {
|
||||
MonentsTopicModel * topicInfo = [self.topicList safeObjectAtIndex1:indexPath.row];
|
||||
if(topicInfo == nil)return;
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(xPMonentsRecommendHeaderView:didSelectItem:)]) {
|
||||
[self.delegate xPMonentsRecommendHeaderView:self didSelectItem:topicInfo];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Event Response
|
||||
- (void)arrowButtonAction:(UIButton *)sender {
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(xPMonentsRecommendHeaderView:didClickMoreTopic:)]) {
|
||||
[self.delegate xPMonentsRecommendHeaderView:self didClickMoreTopic:sender];
|
||||
}
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(xPMonentsRecommendHeaderView:didClickMoreTopic:)]) {
|
||||
[self.delegate xPMonentsRecommendHeaderView:self didClickMoreTopic:sender];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
- (void)setTopicList:(NSArray<MonentsTopicModel *> *)topicList {
|
||||
_topicList = topicList;
|
||||
[self.collectionView reloadData];
|
||||
_topicList = topicList;
|
||||
[self.collectionView reloadData];
|
||||
}
|
||||
|
||||
- (UILabel *)titleLabel {
|
||||
if (!_titleLabel) {
|
||||
_titleLabel = [[UILabel alloc] init];
|
||||
_titleLabel.font = [UIFont systemFontOfSize:14 weight:UIFontWeightMedium];
|
||||
_titleLabel.textColor = [DJDKMIMOMColor mainTextColor];
|
||||
_titleLabel.text = YMLocalizedString(@"XPMonentsRecommendHeaderView0");
|
||||
}
|
||||
return _titleLabel;
|
||||
if (!_titleLabel) {
|
||||
_titleLabel = [[UILabel alloc] init];
|
||||
_titleLabel.font = [UIFont systemFontOfSize:15 weight:UIFontWeightMedium];
|
||||
_titleLabel.textColor = UIColorFromRGB(0x0D344D);
|
||||
_titleLabel.text = YMLocalizedString(@"XPMonentsRecommendHeaderView0");
|
||||
}
|
||||
return _titleLabel;
|
||||
}
|
||||
|
||||
- (UIButton *)arrowButton {
|
||||
if (!_arrowButton) {
|
||||
_arrowButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_arrowButton setImage:[UIImage imageNamed:@"room_setting_arrow"] forState:UIControlStateNormal];
|
||||
[_arrowButton setImage:[UIImage imageNamed:@"room_setting_arrow"] forState:UIControlStateSelected];
|
||||
[_arrowButton addTarget:self action:@selector(arrowButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _arrowButton;
|
||||
}
|
||||
//- (UIButton *)arrowButton {
|
||||
// if (!_arrowButton) {
|
||||
// _arrowButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
// [_arrowButton setImage:[UIImage imageNamed:@"room_setting_arrow"] forState:UIControlStateNormal];
|
||||
// [_arrowButton setImage:[UIImage imageNamed:@"room_setting_arrow"] forState:UIControlStateSelected];
|
||||
// [_arrowButton addTarget:self action:@selector(arrowButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
// }
|
||||
// return _arrowButton;
|
||||
//}
|
||||
|
||||
- (UICollectionView *)collectionView{
|
||||
if (!_collectionView) {
|
||||
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
|
||||
layout.sectionInset = UIEdgeInsetsMake(0, 15, 0, 0);
|
||||
layout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
|
||||
layout.minimumLineSpacing = 8;
|
||||
_collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
|
||||
_collectionView.dataSource = self;
|
||||
_collectionView.delegate = self;
|
||||
_collectionView.backgroundColor = [UIColor clearColor];
|
||||
_collectionView.showsHorizontalScrollIndicator = NO;
|
||||
[_collectionView registerClass:[XPMonentsTopicCollectionViewCell class] forCellWithReuseIdentifier:NSStringFromClass([XPMonentsTopicCollectionViewCell class])];
|
||||
}
|
||||
return _collectionView;
|
||||
if (!_collectionView) {
|
||||
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
|
||||
layout.sectionInset = UIEdgeInsetsMake(0,0, 0, 0);
|
||||
layout.itemSize = CGSizeMake((KScreenWidth - 50)/2, 18);
|
||||
layout.minimumLineSpacing = 0;
|
||||
layout.minimumInteritemSpacing = 0;
|
||||
layout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
|
||||
_collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
|
||||
_collectionView.dataSource = self;
|
||||
_collectionView.delegate = self;
|
||||
_collectionView.backgroundColor = [UIColor clearColor];
|
||||
_collectionView.pagingEnabled = YES;
|
||||
_collectionView.showsHorizontalScrollIndicator = NO;
|
||||
[_collectionView registerClass:[XPMonentsTopicCollectionViewCell class] forCellWithReuseIdentifier:NSStringFromClass([XPMonentsTopicCollectionViewCell class])];
|
||||
}
|
||||
return _collectionView;
|
||||
}
|
||||
- (UIView *)collectionBgView{
|
||||
if (!_collectionBgView){
|
||||
|
||||
UIView *view = [[UIView alloc] init];
|
||||
view.frame = CGRectMake(10,10,KScreenWidth - 50,89);
|
||||
view.layer.borderWidth = 0.5;
|
||||
view.layer.borderColor = [UIColor colorWithRed:255/255.0 green:255/255.0 blue:255/255.0 alpha:1.0].CGColor;
|
||||
|
||||
view.layer.backgroundColor = [UIColor colorWithRed:255/255.0 green:255/255.0 blue:255/255.0 alpha:0.6300].CGColor;
|
||||
|
||||
// blur
|
||||
UIBlurEffect *blurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight];
|
||||
UIVisualEffectView *visualView = [[UIVisualEffectView alloc]initWithEffect:blurEffect];
|
||||
visualView.frame = CGRectMake(10,10,KScreenWidth - 50,89);
|
||||
view.layer.cornerRadius = 8;
|
||||
_collectionBgView = view;
|
||||
_collectionView.userInteractionEnabled = YES;
|
||||
}
|
||||
return _collectionBgView;
|
||||
}
|
||||
- (UIImageView *)bgView{
|
||||
if (!_bgView){
|
||||
_bgView = [UIImageView new];
|
||||
UIImage *image = [UIImage gradientColorImageFromColors:@[UIColorFromRGB(0x9FF4F2),UIColorFromRGB(0x96D6FF)] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(KScreenWidth - 30, 109)];
|
||||
_bgView.image = image;
|
||||
[_bgView setCornerWithLeftTopCorner:10 rightTopCorner:10 bottomLeftCorner:10 bottomRightCorner:10 size:CGSizeMake(KScreenWidth - 30, 109)];
|
||||
_bgView.userInteractionEnabled = YES;
|
||||
}
|
||||
return _bgView;
|
||||
}
|
||||
-(UIImageView *)titleBgView{
|
||||
if (!_titleBgView){
|
||||
_titleBgView = [UIImageView new];
|
||||
UIImage *image = [UIImage gradientColorImageFromColors:@[UIColorFromRGB(0x83E8E7),UIColorFromRGB(0x86D4F6)] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(74, 21)];
|
||||
_titleBgView.image = image;
|
||||
[_titleBgView setCornerWithLeftTopCorner:10 rightTopCorner:0 bottomLeftCorner:0 bottomRightCorner:10 size:CGSizeMake(74, 21)];
|
||||
_titleBgView.userInteractionEnabled = YES;
|
||||
}
|
||||
return _titleBgView;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@end
|
||||
|
@@ -1,8 +1,8 @@
|
||||
//
|
||||
// YMMonentsUserInfoView.h
|
||||
// YUMI
|
||||
// XPMonentsUserInfoView.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by YUMI on 2022/5/12.
|
||||
// Created by 冯硕 on 2022/5/12.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
@@ -17,6 +17,9 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
///点击了跟随进房
|
||||
- (void)xPMonentsUserInfoView:(XPMonentsUserInfoView *)view didClickEnterRoom:(MonentsInfoModel *)monents;
|
||||
|
||||
///删除
|
||||
- (void)xPMonentsTooBarView:(XPMonentsUserInfoView *)view didClickDelete:(MonentsInfoModel *)monentsInfo;
|
||||
|
||||
@end
|
||||
@interface XPMonentsUserInfoView : UIView
|
||||
///动态信息
|
||||
|
@@ -1,21 +1,24 @@
|
||||
//
|
||||
// YMMonentsUserInfoView.m
|
||||
// YUMI
|
||||
// XPMonentsUserInfoView.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by YUMI on 2022/5/12.
|
||||
// Created by 冯硕 on 2022/5/12.
|
||||
//
|
||||
|
||||
#import "XPMonentsUserInfoView.h"
|
||||
///Third
|
||||
#import <Masonry/Masonry.h>
|
||||
///Tool
|
||||
#import "DJDKMIMOMColor.h"
|
||||
|
||||
#import "NetImageView.h"
|
||||
#import "SpriteSheetImageManager.h"
|
||||
#import "YUMIMacroUitls.h"
|
||||
#import "TTPopup.h"
|
||||
#import "XPWebViewController.h"
|
||||
#import "XCCurrentVCStackManager.h"
|
||||
#import "AccountInfoStorage.h"
|
||||
#import "UIButton+EnlargeTouchArea.h"
|
||||
///Model
|
||||
#import "MonentsInfoModel.h"
|
||||
#import "NSArray+Safe.h"
|
||||
|
||||
@interface XPMonentsUserInfoView ()
|
||||
///
|
||||
@@ -58,410 +61,436 @@
|
||||
@property (nonatomic,strong) NetImageView *thirdTagImageView;
|
||||
///直播中
|
||||
@property (nonatomic,strong) UIButton *onlineButton;
|
||||
|
||||
@end
|
||||
@implementation XPMonentsUserInfoView
|
||||
- (instancetype)initWithFrame:(CGRect)frame {
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
}
|
||||
return self;
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
#pragma mark - Private Method
|
||||
- (void)initSubViews {
|
||||
[self addSubview:self.avatarImageView];
|
||||
[self addSubview:self.headWearImageView];
|
||||
[self addSubview:self.nickLabel];
|
||||
[self addSubview:self.sexImageView];
|
||||
[self addSubview:self.tagStackView];
|
||||
[self addSubview:self.levelStackView];
|
||||
[self addSubview:self.onlineButton];
|
||||
|
||||
[self.tagStackView addArrangedSubview:self.firstTagImageView];
|
||||
[self.tagStackView addArrangedSubview:self.secondTagImageView];
|
||||
[self.tagStackView addArrangedSubview:self.thirdTagImageView];
|
||||
[self addSubview:self.avatarImageView];
|
||||
[self addSubview:self.headWearImageView];
|
||||
[self addSubview:self.nickLabel];
|
||||
[self addSubview:self.sexImageView];
|
||||
[self addSubview:self.tagStackView];
|
||||
[self addSubview:self.levelStackView];
|
||||
[self addSubview:self.onlineButton];
|
||||
|
||||
[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];
|
||||
[self.levelStackView addArrangedSubview:self.charmImageView];
|
||||
[self.levelStackView addArrangedSubview:self.namePlateView];
|
||||
///铭牌
|
||||
[self.namePlateView addSubview:self.nameplateImageView];
|
||||
[self.namePlateView addSubview:self.nameplateLabel];
|
||||
|
||||
[self.levelStackView addArrangedSubview:self.nobleImageView];
|
||||
[self.levelStackView addArrangedSubview:self.newsUserImageView];
|
||||
[self.levelStackView addArrangedSubview:self.officalImageView];
|
||||
[self.levelStackView addArrangedSubview:self.experImageView];
|
||||
[self.levelStackView addArrangedSubview:self.charmImageView];
|
||||
[self.levelStackView addArrangedSubview:self.namePlateView];
|
||||
///铭牌
|
||||
[self.namePlateView addSubview:self.nameplateImageView];
|
||||
[self.namePlateView addSubview:self.nameplateLabel];
|
||||
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
[self.avatarImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.size.mas_equalTo(CGSizeMake(40, 40));
|
||||
make.left.mas_equalTo(self).offset(15);
|
||||
make.top.mas_equalTo(self).offset(15);
|
||||
}];
|
||||
|
||||
[self.headWearImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.center.mas_equalTo(self.avatarImageView);
|
||||
make.width.mas_equalTo(self.avatarImageView.mas_width).multipliedBy(1.2);
|
||||
make.height.mas_equalTo(self.headWearImageView.mas_width);
|
||||
}];
|
||||
|
||||
|
||||
[self.nickLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.avatarImageView.mas_right).offset(12);
|
||||
make.bottom.mas_equalTo(self.avatarImageView.mas_centerY).offset(-2);
|
||||
}];
|
||||
|
||||
[self.sexImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.size.mas_equalTo(CGSizeMake(14, 14));
|
||||
make.left.mas_equalTo(self.nickLabel.mas_right).offset(4);
|
||||
make.centerY.mas_equalTo(self.nickLabel);
|
||||
}];
|
||||
|
||||
[self.levelStackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.nickLabel);
|
||||
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);
|
||||
}];
|
||||
|
||||
[self.officalImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_equalTo(20);
|
||||
}];
|
||||
|
||||
[self.experImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_equalTo(20);
|
||||
}];
|
||||
|
||||
[self.charmImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_equalTo(20);
|
||||
}];
|
||||
|
||||
[self.namePlateView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_equalTo(self.nameplateImageView.mas_width);
|
||||
}];
|
||||
[self.avatarImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.size.mas_equalTo(CGSizeMake(50, 50));
|
||||
make.left.mas_equalTo(self).offset(15);
|
||||
make.centerY.mas_equalTo(self);
|
||||
}];
|
||||
|
||||
[self.headWearImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.center.mas_equalTo(self.avatarImageView);
|
||||
make.width.mas_equalTo(self.avatarImageView.mas_width).multipliedBy(1.2);
|
||||
make.height.mas_equalTo(self.headWearImageView.mas_width);
|
||||
}];
|
||||
|
||||
[self.nameplateImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(20);
|
||||
make.width.mas_equalTo(60);
|
||||
make.left.top.mas_equalTo(self.namePlateView);
|
||||
}];
|
||||
|
||||
[self.nameplateLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.bottom.mas_equalTo(self.nameplateImageView);
|
||||
make.right.mas_equalTo(self.namePlateView).offset(-2);
|
||||
}];
|
||||
|
||||
[self.tagStackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.right.mas_equalTo(self).offset(-15);
|
||||
make.centerY.mas_equalTo(self.nickLabel);
|
||||
make.height.mas_equalTo(14);
|
||||
}];
|
||||
|
||||
[self.nickLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.avatarImageView.mas_right).offset(12);
|
||||
make.bottom.mas_equalTo(self.avatarImageView.mas_centerY).offset(-2);
|
||||
}];
|
||||
|
||||
[self.sexImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.size.mas_equalTo(CGSizeMake(14, 14));
|
||||
make.left.mas_equalTo(self.nickLabel.mas_right).offset(4);
|
||||
make.centerY.mas_equalTo(self.nickLabel);
|
||||
}];
|
||||
|
||||
[self.levelStackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.nickLabel);
|
||||
make.top.mas_equalTo(self.avatarImageView.mas_centerY).offset(2);
|
||||
make.height.mas_equalTo(20);
|
||||
}];
|
||||
|
||||
[self.onlineButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.size.mas_equalTo(CGSizeMake(55, 18));
|
||||
make.right.mas_equalTo(self.tagStackView);
|
||||
make.top.mas_equalTo(self.tagStackView.mas_bottom).offset(4);
|
||||
}];
|
||||
|
||||
[self.firstTagImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_equalTo(28);
|
||||
}];
|
||||
|
||||
[self.secondTagImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_equalTo(self.firstTagImageView);
|
||||
}];
|
||||
|
||||
[self.thirdTagImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_equalTo(self.firstTagImageView);
|
||||
}];
|
||||
[self.nobleImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_equalTo(20);
|
||||
}];
|
||||
|
||||
[self.newsUserImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_equalTo(20);
|
||||
}];
|
||||
|
||||
[self.officalImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_equalTo(20);
|
||||
}];
|
||||
|
||||
[self.experImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_equalTo(20);
|
||||
}];
|
||||
|
||||
[self.charmImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_equalTo(20);
|
||||
}];
|
||||
|
||||
[self.namePlateView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_equalTo(self.nameplateImageView.mas_width);
|
||||
}];
|
||||
|
||||
[self.nameplateImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(20);
|
||||
make.width.mas_equalTo(60);
|
||||
make.left.top.mas_equalTo(self.namePlateView);
|
||||
}];
|
||||
|
||||
[self.nameplateLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.bottom.mas_equalTo(self.nameplateImageView);
|
||||
make.right.mas_equalTo(self.namePlateView).offset(-2);
|
||||
}];
|
||||
|
||||
[self.tagStackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.right.mas_equalTo(self).offset(-15);
|
||||
make.centerY.mas_equalTo(self.nickLabel);
|
||||
make.height.mas_equalTo(14);
|
||||
}];
|
||||
|
||||
[self.onlineButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.size.mas_equalTo(CGSizeMake(55, 18));
|
||||
make.right.mas_equalTo(-15);
|
||||
make.top.equalTo(self.tagStackView.mas_bottom).mas_offset(8);
|
||||
}];
|
||||
|
||||
[self.firstTagImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_equalTo(28);
|
||||
}];
|
||||
|
||||
[self.secondTagImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_equalTo(self.firstTagImageView);
|
||||
}];
|
||||
|
||||
[self.thirdTagImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_equalTo(self.firstTagImageView);
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - Event Response
|
||||
- (void)onlineButtonAction:(UIButton *)sender {
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(xPMonentsUserInfoView:didClickEnterRoom:)]) {
|
||||
[self.delegate xPMonentsUserInfoView:self didClickEnterRoom:self.monentsInfo];
|
||||
}
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(xPMonentsUserInfoView:didClickEnterRoom:)]) {
|
||||
[self.delegate xPMonentsUserInfoView:self didClickEnterRoom:self.monentsInfo];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)didTapAvatarGuest {
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(xPMonentsUserInfoView:didClickAvatar:)]) {
|
||||
[self.delegate xPMonentsUserInfoView:self didClickAvatar:self.monentsInfo];
|
||||
}
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(xPMonentsUserInfoView:didClickAvatar:)]) {
|
||||
[self.delegate xPMonentsUserInfoView:self didClickAvatar:self.monentsInfo];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)reportButtonAction:(UIButton *)sender {
|
||||
TTActionSheetConfig *action;
|
||||
if (self.monentsInfo.uid.integerValue == [AccountInfoStorage instance].getUid.integerValue) {
|
||||
action = [TTActionSheetConfig normalTitle:YMLocalizedString(@"XPMonentsUserInfoView0") clickAction:^{
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(xPMonentsTooBarView:didClickDelete:)]) {
|
||||
[self.delegate xPMonentsTooBarView:self didClickDelete:self.monentsInfo];
|
||||
}
|
||||
}];
|
||||
} else {
|
||||
action = [TTActionSheetConfig normalTitle:YMLocalizedString(@"XPMonentsUserInfoView1") clickAction:^{
|
||||
NSString * url= [NSString stringWithFormat:@"%@?reportUid=%@&source=%@", URLWithType(kReportRoomURL),self.monentsInfo.uid, @"WORLDDYNAMIC"];
|
||||
XPWebViewController * webVC = [[XPWebViewController alloc] init];
|
||||
webVC.url = url;
|
||||
[[XCCurrentVCStackManager shareManager].getCurrentVC.navigationController pushViewController:webVC animated:YES];
|
||||
}];
|
||||
}
|
||||
[TTPopup actionSheetWithItems:@[action]];
|
||||
}
|
||||
#pragma mark - Getters And Setters
|
||||
- (void)setMonentsInfo:(MonentsInfoModel *)monentsInfo {
|
||||
_monentsInfo = monentsInfo;
|
||||
if (_monentsInfo) {
|
||||
self.avatarImageView.imageUrl = _monentsInfo.avatar;
|
||||
NSString * nick = _monentsInfo.nick;
|
||||
if (nick.length > 8) {
|
||||
nick = [NSString stringWithFormat:@"%@…", [nick substringToIndex:8]];
|
||||
}
|
||||
self.nickLabel.text = nick.length > 0 ? nick : @"";
|
||||
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;
|
||||
}
|
||||
self.experImageView.hidden = _monentsInfo.experLevelPic.length <= 0;
|
||||
|
||||
if (_monentsInfo.charmLevelPic) {
|
||||
self.charmImageView.imageUrl = _monentsInfo.charmLevelPic;
|
||||
}
|
||||
_monentsInfo = monentsInfo;
|
||||
if (_monentsInfo) {
|
||||
self.avatarImageView.imageUrl = _monentsInfo.avatar;
|
||||
NSString * nick = _monentsInfo.nick;
|
||||
if (nick.length > 8) {
|
||||
nick = [NSString stringWithFormat:@"%@…", [nick substringToIndex:8]];
|
||||
}
|
||||
self.nickLabel.text = nick.length > 0 ? nick : @"";
|
||||
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;
|
||||
}
|
||||
self.experImageView.hidden = _monentsInfo.experLevelPic.length <= 0;
|
||||
|
||||
if (_monentsInfo.charmLevelPic) {
|
||||
self.charmImageView.imageUrl = _monentsInfo.charmLevelPic;
|
||||
}
|
||||
|
||||
if (_monentsInfo.userVipInfoVO) {
|
||||
self.nobleImageView.imageUrl = _monentsInfo.userVipInfoVO.vipIcon;
|
||||
}
|
||||
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) {
|
||||
self.nameplateImageView.imageUrl = _monentsInfo.nameplatePic;
|
||||
self.nameplateLabel.text = _monentsInfo.nameplateWord;
|
||||
self.namePlateView.hidden = NO;
|
||||
} else {
|
||||
self.namePlateView.hidden = YES;
|
||||
}
|
||||
self.charmImageView.hidden = _monentsInfo.charmLevelPic.length <= 0;
|
||||
|
||||
if (_monentsInfo.nameplateWord.length>0 && _monentsInfo.nameplatePic.length>0) {
|
||||
self.nameplateImageView.imageUrl = _monentsInfo.nameplatePic;
|
||||
self.nameplateLabel.text = _monentsInfo.nameplateWord;
|
||||
self.namePlateView.hidden = NO;
|
||||
} else {
|
||||
self.namePlateView.hidden = YES;
|
||||
}
|
||||
|
||||
|
||||
NSString * headwearUrl= _monentsInfo.headwearEffect.length > 0 ? _monentsInfo.headwearEffect : _monentsInfo.headwearPic;
|
||||
self.headWearImageView.hidden = headwearUrl.length <= 0;
|
||||
if (headwearUrl.length > 0) {
|
||||
NSURL *url = [NSURL URLWithString:headwearUrl];
|
||||
@kWeakify(self);
|
||||
[self.manager loadSpriteSheetImageWithURL:url completionBlock:^(YYSpriteSheetImage * _Nullable sprit) {
|
||||
@kStrongify(self);
|
||||
self.headWearImageView.image = sprit;
|
||||
} failureBlock:^(NSError * _Nullable error) {
|
||||
}];
|
||||
}
|
||||
self.firstTagImageView.hidden = YES;
|
||||
self.secondTagImageView.hidden = YES;
|
||||
self.thirdTagImageView.hidden = YES;
|
||||
for (int i = 0; i< _monentsInfo.labelList.count; i++) {
|
||||
NSString * imageUrl = [_monentsInfo.labelList safeObjectAtIndex1:i];
|
||||
if (i < self.tagStackView.subviews.count) {
|
||||
NetImageView * image = [self.tagStackView.subviews safeObjectAtIndex1:i];
|
||||
image.hidden = NO;
|
||||
image.imageUrl = imageUrl;
|
||||
}
|
||||
}
|
||||
self.onlineButton.hidden = _monentsInfo.inRoomUid.length <= 0;
|
||||
}
|
||||
|
||||
NSString * headwearUrl= _monentsInfo.headwearEffect.length > 0 ? _monentsInfo.headwearEffect : _monentsInfo.headwearPic;
|
||||
self.headWearImageView.hidden = headwearUrl.length <= 0;
|
||||
if (headwearUrl.length > 0) {
|
||||
NSURL *url = [NSURL URLWithString:headwearUrl];
|
||||
@kWeakify(self);
|
||||
[self.manager loadSpriteSheetImageWithURL:url completionBlock:^(YYSpriteSheetImage * _Nullable sprit) {
|
||||
@kStrongify(self);
|
||||
self.headWearImageView.image = sprit;
|
||||
} failureBlock:^(NSError * _Nullable error) {
|
||||
}];
|
||||
}
|
||||
self.firstTagImageView.hidden = YES;
|
||||
self.secondTagImageView.hidden = YES;
|
||||
self.thirdTagImageView.hidden = YES;
|
||||
for (int i = 0; i< _monentsInfo.labelList.count; i++) {
|
||||
NSString * imageUrl = [_monentsInfo.labelList safeObjectAtIndex1:i];
|
||||
if (i < self.tagStackView.subviews.count) {
|
||||
NetImageView * image = [self.tagStackView.subviews safeObjectAtIndex1:i];
|
||||
if(image != nil){
|
||||
image.hidden = NO;
|
||||
image.imageUrl = imageUrl;
|
||||
}
|
||||
}
|
||||
}
|
||||
self.onlineButton.hidden = _monentsInfo.inRoomUid.length <= 0;
|
||||
}
|
||||
}
|
||||
|
||||
- (SpriteSheetImageManager *)manager {
|
||||
if (!_manager) {
|
||||
_manager = [[SpriteSheetImageManager alloc] init];
|
||||
}
|
||||
return _manager;
|
||||
if (!_manager) {
|
||||
_manager = [[SpriteSheetImageManager alloc] init];
|
||||
}
|
||||
return _manager;
|
||||
}
|
||||
|
||||
- (YYAnimatedImageView *)headWearImageView {
|
||||
if (!_headWearImageView) {
|
||||
_headWearImageView = [[YYAnimatedImageView alloc] init];
|
||||
_headWearImageView.backgroundColor = [UIColor clearColor];
|
||||
_headWearImageView.contentMode = UIViewContentModeScaleAspectFit;
|
||||
}
|
||||
return _headWearImageView;
|
||||
if (!_headWearImageView) {
|
||||
_headWearImageView = [[YYAnimatedImageView alloc] init];
|
||||
_headWearImageView.backgroundColor = [UIColor clearColor];
|
||||
_headWearImageView.contentMode = UIViewContentModeScaleAspectFit;
|
||||
}
|
||||
return _headWearImageView;
|
||||
}
|
||||
|
||||
- (NetImageView *)avatarImageView {
|
||||
if (!_avatarImageView) {
|
||||
NetImageConfig * config = [[NetImageConfig alloc] init];
|
||||
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
|
||||
config.imageType = ImageTypeUserIcon;
|
||||
_avatarImageView = [[NetImageView alloc] initWithConfig:config];
|
||||
_avatarImageView.userInteractionEnabled = YES;
|
||||
_avatarImageView.layer.masksToBounds = YES;
|
||||
_avatarImageView.layer.cornerRadius = 20;
|
||||
_avatarImageView.contentMode = UIViewContentModeScaleAspectFill;
|
||||
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didTapAvatarGuest)];
|
||||
[_avatarImageView addGestureRecognizer:tap];
|
||||
}
|
||||
return _avatarImageView;
|
||||
if (!_avatarImageView) {
|
||||
NetImageConfig * config = [[NetImageConfig alloc] init];
|
||||
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
|
||||
config.imageType = ImageTypeUserIcon;
|
||||
_avatarImageView = [[NetImageView alloc] initWithConfig:config];
|
||||
_avatarImageView.userInteractionEnabled = YES;
|
||||
_avatarImageView.layer.masksToBounds = YES;
|
||||
_avatarImageView.layer.cornerRadius = 25;
|
||||
_avatarImageView.contentMode = UIViewContentModeScaleAspectFill;
|
||||
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didTapAvatarGuest)];
|
||||
[_avatarImageView addGestureRecognizer:tap];
|
||||
}
|
||||
return _avatarImageView;
|
||||
}
|
||||
|
||||
- (UILabel *)nickLabel {
|
||||
if (!_nickLabel) {
|
||||
_nickLabel = [[UILabel alloc] init];
|
||||
_nickLabel.font = [UIFont systemFontOfSize:14 weight:UIFontWeightMedium];
|
||||
_nickLabel.textColor = [DJDKMIMOMColor mainTextColor];
|
||||
}
|
||||
return _nickLabel;
|
||||
if (!_nickLabel) {
|
||||
_nickLabel = [[UILabel alloc] init];
|
||||
_nickLabel.font = [UIFont systemFontOfSize:14 weight:UIFontWeightMedium];
|
||||
_nickLabel.textColor = [DJDKMIMOMColor mainTextColor];
|
||||
}
|
||||
return _nickLabel;
|
||||
}
|
||||
|
||||
- (UIImageView *)sexImageView {
|
||||
if (!_sexImageView) {
|
||||
_sexImageView = [[UIImageView alloc] init];
|
||||
_sexImageView.userInteractionEnabled = YES;
|
||||
}
|
||||
return _sexImageView;
|
||||
if (!_sexImageView) {
|
||||
_sexImageView = [[UIImageView alloc] init];
|
||||
_sexImageView.userInteractionEnabled = YES;
|
||||
}
|
||||
return _sexImageView;
|
||||
}
|
||||
|
||||
- (UIStackView *)levelStackView {
|
||||
if (!_levelStackView) {
|
||||
_levelStackView = [[UIStackView alloc] init];
|
||||
_levelStackView.axis = UILayoutConstraintAxisHorizontal;
|
||||
_levelStackView.distribution = UIStackViewDistributionFill;
|
||||
_levelStackView.alignment = UIStackViewAlignmentFill;
|
||||
_levelStackView.spacing = 2;
|
||||
}
|
||||
return _levelStackView;
|
||||
if (!_levelStackView) {
|
||||
_levelStackView = [[UIStackView alloc] init];
|
||||
_levelStackView.axis = UILayoutConstraintAxisHorizontal;
|
||||
_levelStackView.distribution = UIStackViewDistributionFill;
|
||||
_levelStackView.alignment = UIStackViewAlignmentFill;
|
||||
_levelStackView.spacing = 2;
|
||||
}
|
||||
return _levelStackView;
|
||||
}
|
||||
- (NetImageView *)experImageView {
|
||||
if (!_experImageView) {
|
||||
NetImageConfig * config = [[NetImageConfig alloc] init];
|
||||
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
|
||||
config.imageType = ImageTypeUserCardLevel;
|
||||
_experImageView = [[NetImageView alloc] initWithConfig:config];
|
||||
_experImageView.userInteractionEnabled = YES;
|
||||
_experImageView.hidden = YES;
|
||||
_experImageView.contentMode = UIViewContentModeScaleAspectFit;
|
||||
}
|
||||
return _experImageView;
|
||||
if (!_experImageView) {
|
||||
NetImageConfig * config = [[NetImageConfig alloc] init];
|
||||
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
|
||||
config.imageType = ImageTypeUserCardLevel;
|
||||
_experImageView = [[NetImageView alloc] initWithConfig:config];
|
||||
_experImageView.userInteractionEnabled = YES;
|
||||
_experImageView.hidden = YES;
|
||||
_experImageView.contentMode = UIViewContentModeScaleAspectFit;
|
||||
}
|
||||
return _experImageView;
|
||||
}
|
||||
|
||||
- (NetImageView *)charmImageView {
|
||||
if (!_charmImageView) {
|
||||
NetImageConfig * config = [[NetImageConfig alloc] init];
|
||||
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
|
||||
config.imageType = ImageTypeUserCardLevel;
|
||||
_charmImageView = [[NetImageView alloc] initWithConfig:config];
|
||||
_charmImageView.userInteractionEnabled = YES;
|
||||
_charmImageView.hidden = YES;
|
||||
_charmImageView.contentMode = UIViewContentModeScaleAspectFit;
|
||||
}
|
||||
return _charmImageView;
|
||||
if (!_charmImageView) {
|
||||
NetImageConfig * config = [[NetImageConfig alloc] init];
|
||||
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
|
||||
config.imageType = ImageTypeUserCardLevel;
|
||||
_charmImageView = [[NetImageView alloc] initWithConfig:config];
|
||||
_charmImageView.userInteractionEnabled = YES;
|
||||
_charmImageView.hidden = YES;
|
||||
_charmImageView.contentMode = UIViewContentModeScaleAspectFit;
|
||||
}
|
||||
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;
|
||||
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];
|
||||
_namePlateView.backgroundColor = [UIColor clearColor];
|
||||
_namePlateView.hidden = YES;
|
||||
}
|
||||
return _namePlateView;
|
||||
if (!_namePlateView) {
|
||||
_namePlateView = [[UIView alloc] init];
|
||||
_namePlateView.backgroundColor = [UIColor clearColor];
|
||||
_namePlateView.hidden = YES;
|
||||
}
|
||||
return _namePlateView;
|
||||
}
|
||||
|
||||
- (NetImageView *)nameplateImageView {
|
||||
if (!_nameplateImageView) {
|
||||
NetImageConfig * config = [[NetImageConfig alloc] init];
|
||||
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
|
||||
config.imageType = ImageTypeUserCardLevel;
|
||||
_nameplateImageView = [[NetImageView alloc] initWithConfig:config];
|
||||
_nameplateImageView.userInteractionEnabled = YES;
|
||||
_nameplateImageView.contentMode = UIViewContentModeScaleAspectFit;
|
||||
}
|
||||
return _nameplateImageView;
|
||||
if (!_nameplateImageView) {
|
||||
NetImageConfig * config = [[NetImageConfig alloc] init];
|
||||
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
|
||||
config.imageType = ImageTypeUserCardLevel;
|
||||
_nameplateImageView = [[NetImageView alloc] initWithConfig:config];
|
||||
_nameplateImageView.userInteractionEnabled = YES;
|
||||
_nameplateImageView.contentMode = UIViewContentModeScaleAspectFit;
|
||||
}
|
||||
return _nameplateImageView;
|
||||
}
|
||||
|
||||
- (UILabel *)nameplateLabel {
|
||||
if (!_nameplateLabel) {
|
||||
_nameplateLabel = [[UILabel alloc] init];
|
||||
_nameplateLabel.font = [UIFont systemFontOfSize:10];
|
||||
_nameplateLabel.textAlignment = NSTextAlignmentCenter;
|
||||
_nameplateLabel.textColor = [UIColor whiteColor];
|
||||
}
|
||||
return _nameplateLabel;
|
||||
if (!_nameplateLabel) {
|
||||
_nameplateLabel = [[UILabel alloc] init];
|
||||
_nameplateLabel.font = [UIFont systemFontOfSize:10];
|
||||
_nameplateLabel.textAlignment = NSTextAlignmentCenter;
|
||||
_nameplateLabel.textColor = [UIColor whiteColor];
|
||||
}
|
||||
return _nameplateLabel;
|
||||
}
|
||||
|
||||
- (UIImageView *)newsUserImageView {
|
||||
if (!_newsUserImageView) {
|
||||
_newsUserImageView = [[UIImageView alloc] init];
|
||||
_newsUserImageView.userInteractionEnabled = YES;
|
||||
_newsUserImageView.image = [UIImage imageNamed:@"common_new_user"];
|
||||
_newsUserImageView.hidden = YES;
|
||||
}
|
||||
return _newsUserImageView;
|
||||
if (!_newsUserImageView) {
|
||||
_newsUserImageView = [[UIImageView alloc] init];
|
||||
_newsUserImageView.userInteractionEnabled = YES;
|
||||
_newsUserImageView.image = [UIImage imageNamed:@"common_new_user"];
|
||||
_newsUserImageView.hidden = YES;
|
||||
}
|
||||
return _newsUserImageView;
|
||||
}
|
||||
|
||||
- (UIImageView *)officalImageView {
|
||||
if (!_officalImageView) {
|
||||
_officalImageView = [[UIImageView alloc] init];
|
||||
_officalImageView.userInteractionEnabled = YES;
|
||||
_officalImageView.image = [UIImage imageNamed:@"common_offical"];
|
||||
_officalImageView.hidden = YES;
|
||||
}
|
||||
return _officalImageView;
|
||||
if (!_officalImageView) {
|
||||
_officalImageView = [[UIImageView alloc] init];
|
||||
_officalImageView.userInteractionEnabled = YES;
|
||||
_officalImageView.image = [UIImage imageNamed:@"common_offical"];
|
||||
_officalImageView.hidden = YES;
|
||||
}
|
||||
return _officalImageView;
|
||||
}
|
||||
|
||||
- (UIStackView *)tagStackView {
|
||||
if (!_tagStackView) {
|
||||
_tagStackView = [[UIStackView alloc] init];
|
||||
_tagStackView.axis = UILayoutConstraintAxisHorizontal;
|
||||
_tagStackView.distribution = UIStackViewDistributionFill;
|
||||
_tagStackView.alignment = UIStackViewAlignmentFill;
|
||||
_tagStackView.spacing = 2;
|
||||
}
|
||||
return _tagStackView;
|
||||
if (!_tagStackView) {
|
||||
_tagStackView = [[UIStackView alloc] init];
|
||||
_tagStackView.axis = UILayoutConstraintAxisHorizontal;
|
||||
_tagStackView.distribution = UIStackViewDistributionFill;
|
||||
_tagStackView.alignment = UIStackViewAlignmentFill;
|
||||
_tagStackView.spacing = 2;
|
||||
}
|
||||
return _tagStackView;
|
||||
}
|
||||
|
||||
- (NetImageView *)firstTagImageView {
|
||||
if (!_firstTagImageView) {
|
||||
_firstTagImageView = [[NetImageView alloc] init];
|
||||
_firstTagImageView.hidden = YES;
|
||||
}
|
||||
return _firstTagImageView;
|
||||
if (!_firstTagImageView) {
|
||||
_firstTagImageView = [[NetImageView alloc] init];
|
||||
_firstTagImageView.hidden = YES;
|
||||
}
|
||||
return _firstTagImageView;
|
||||
}
|
||||
|
||||
- (NetImageView *)secondTagImageView {
|
||||
if (!_secondTagImageView) {
|
||||
_secondTagImageView = [[NetImageView alloc] init];
|
||||
_secondTagImageView.hidden = YES;
|
||||
}
|
||||
return _secondTagImageView;
|
||||
if (!_secondTagImageView) {
|
||||
_secondTagImageView = [[NetImageView alloc] init];
|
||||
_secondTagImageView.hidden = YES;
|
||||
}
|
||||
return _secondTagImageView;
|
||||
}
|
||||
|
||||
- (NetImageView *)thirdTagImageView {
|
||||
if (!_thirdTagImageView) {
|
||||
_thirdTagImageView = [[NetImageView alloc] init];
|
||||
_thirdTagImageView.hidden = YES;
|
||||
}
|
||||
return _thirdTagImageView;
|
||||
if (!_thirdTagImageView) {
|
||||
_thirdTagImageView = [[NetImageView alloc] init];
|
||||
_thirdTagImageView.hidden = YES;
|
||||
}
|
||||
return _thirdTagImageView;
|
||||
}
|
||||
|
||||
- (UIButton *)onlineButton {
|
||||
if (!_onlineButton) {
|
||||
_onlineButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_onlineButton setTitle:YMLocalizedString(@"XPMonentsUserInfoView0") forState:UIControlStateNormal];
|
||||
[_onlineButton setImage:[UIImage imageNamed:@"home_search_user_online"] forState:UIControlStateNormal];
|
||||
[_onlineButton setTitleColor:[DJDKMIMOMColor appEmphasizeColor] forState:UIControlStateNormal];
|
||||
_onlineButton.backgroundColor = [UIColor clearColor];
|
||||
_onlineButton.titleLabel.font = [UIFont systemFontOfSize:10];
|
||||
_onlineButton.layer.masksToBounds = YES;
|
||||
_onlineButton.layer.cornerRadius = 18/2;
|
||||
_onlineButton.layer.borderColor = [DJDKMIMOMColor appEmphasizeColor].CGColor;
|
||||
_onlineButton.layer.borderWidth = 1;
|
||||
[_onlineButton addTarget:self action:@selector(onlineButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _onlineButton;
|
||||
if (!_onlineButton) {
|
||||
_onlineButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_onlineButton setTitle:YMLocalizedString(@"XPMonentsUserInfoView2") forState:UIControlStateNormal];
|
||||
[_onlineButton setImage:[UIImage imageNamed:@"monents_on_line_note"] forState:UIControlStateNormal];
|
||||
[_onlineButton setTitleColor:[DJDKMIMOMColor appMainColor] forState:UIControlStateNormal];
|
||||
_onlineButton.imageEdgeInsets = UIEdgeInsetsMake(0, 0, 0, 3);
|
||||
_onlineButton.backgroundColor = [UIColor clearColor];
|
||||
_onlineButton.titleLabel.font = [UIFont systemFontOfSize:10];
|
||||
_onlineButton.layer.masksToBounds = YES;
|
||||
_onlineButton.layer.cornerRadius = 18/2;
|
||||
[_onlineButton setBackgroundImage:[UIImage imageNamed:@"monents_on_line_bg"] forState:UIControlStateNormal];
|
||||
[_onlineButton addTarget:self action:@selector(onlineButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _onlineButton;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@end
|
||||
|
@@ -1,8 +1,8 @@
|
||||
//
|
||||
// YMMonentsAttentionViewController.m
|
||||
// YUMI
|
||||
// XPMonentsAttentionViewController.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by YUMI on 2022/5/18.
|
||||
// Created by 冯硕 on 2022/5/18.
|
||||
//
|
||||
|
||||
#import "XPMonentsAttentionViewController.h"
|
||||
@@ -10,12 +10,9 @@
|
||||
#import <Masonry/Masonry.h>
|
||||
#import <MJRefresh/MJRefresh.h>
|
||||
///Tool
|
||||
#import "DJDKMIMOMColor.h"
|
||||
#import "YUMIMacroUitls.h"
|
||||
|
||||
#import "XPMonentsLayoutConfig.h"
|
||||
#import "TTPopup.h"
|
||||
#import "NSArray+Safe.h"
|
||||
#import "ClientConfig.h"
|
||||
///Model
|
||||
#import "MonentsListInfoModel.h"
|
||||
///P
|
||||
@@ -25,8 +22,7 @@
|
||||
#import "XPMonentsTableViewCell.h"
|
||||
#import "XPMonentsEmptyTableViewCell.h"
|
||||
#import "XPMonentsDetailViewController.h"
|
||||
#import "XPMomentsSimpleDetailViewController.h"
|
||||
|
||||
UIKIT_EXTERN NSString *kRequestRicket;
|
||||
@interface XPMonentsAttentionViewController ()<UITableViewDelegate, UITableViewDataSource,XPMonentsAttentionProtocol, XPMonentsTableViewCellDelegate, XPMonentsDetailViewControllerDelegate>
|
||||
///列表
|
||||
@property (nonatomic,strong) UITableView *tableView;
|
||||
@@ -41,242 +37,273 @@
|
||||
@end
|
||||
|
||||
@implementation XPMonentsAttentionViewController
|
||||
|
||||
-(void)dealloc{
|
||||
[[NSNotificationCenter defaultCenter]removeObserver:self];
|
||||
}
|
||||
- (BOOL)isHiddenNavBar {
|
||||
return YES;
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (__kindof id)createPresenter {
|
||||
return [[XPMonentsAttentionPresenter alloc] init];
|
||||
return [[XPMonentsAttentionPresenter alloc] init];
|
||||
}
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
[self initHeaderAndFooterRrfresh];
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
[super viewDidLoad];
|
||||
[self initHeaderAndFooterRrfresh];
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
}
|
||||
|
||||
#pragma mark - Private Method
|
||||
- (void)initSubViews {
|
||||
[self.view addSubview:self.tableView];
|
||||
[self.view addSubview:self.tableView];
|
||||
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(requestRicketSuccess:) name:kRequestRicket object:nil];
|
||||
}
|
||||
-(void)requestRicketSuccess:(NSNotification *)not{
|
||||
if([not.object isKindOfClass:[NSDictionary class]])return;
|
||||
BOOL is = [not.object boolValue];
|
||||
if(is == YES){
|
||||
[self headerRefresh];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.mas_equalTo(self.view);
|
||||
}];
|
||||
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.mas_equalTo(self.view);
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - 下拉刷新
|
||||
- (void)initHeaderAndFooterRrfresh {
|
||||
MJRefreshNormalHeader *header = [MJRefreshNormalHeader headerWithRefreshingTarget:self refreshingAction:@selector(headerRefresh)];
|
||||
header.stateLabel.font = [UIFont systemFontOfSize:10.0];
|
||||
header.lastUpdatedTimeLabel.font = [UIFont systemFontOfSize:10.0];
|
||||
header.stateLabel.textColor = [DJDKMIMOMColor secondTextColor];
|
||||
header.lastUpdatedTimeLabel.textColor = [DJDKMIMOMColor secondTextColor];
|
||||
self.tableView.mj_header = header;
|
||||
|
||||
MJRefreshBackNormalFooter *footer = [MJRefreshBackNormalFooter footerWithRefreshingTarget:self refreshingAction:@selector(footerRefresh)];
|
||||
footer.stateLabel.textColor = [DJDKMIMOMColor secondTextColor];
|
||||
footer.stateLabel.font = [UIFont systemFontOfSize:10.0];
|
||||
self.tableView.mj_footer = footer;
|
||||
|
||||
[self headerRefresh];
|
||||
MJRefreshNormalHeader *header = [MJRefreshNormalHeader headerWithRefreshingTarget:self refreshingAction:@selector(headerRefresh)];
|
||||
header.stateLabel.font = [UIFont systemFontOfSize:10.0];
|
||||
header.lastUpdatedTimeLabel.font = [UIFont systemFontOfSize:10.0];
|
||||
header.stateLabel.textColor = [DJDKMIMOMColor secondTextColor];
|
||||
header.lastUpdatedTimeLabel.textColor = [DJDKMIMOMColor secondTextColor];
|
||||
self.tableView.mj_header = header;
|
||||
|
||||
MJRefreshBackNormalFooter *footer = [MJRefreshBackNormalFooter footerWithRefreshingTarget:self refreshingAction:@selector(footerRefresh)];
|
||||
footer.stateLabel.textColor = [DJDKMIMOMColor secondTextColor];
|
||||
footer.stateLabel.font = [UIFont systemFontOfSize:10.0];
|
||||
self.tableView.mj_footer = footer;
|
||||
|
||||
[self headerRefresh];
|
||||
}
|
||||
|
||||
#pragma mark - 刷新的fangfa
|
||||
- (void)headerRefresh {
|
||||
self.page = 1;
|
||||
[self.presenter getMonentsAttentionListPageSize:20 dynamicId:@"" state:0];
|
||||
if([AccountInfoStorage instance].isRequestRicket == YES){
|
||||
return;
|
||||
}
|
||||
self.page = 1;
|
||||
[self.presenter getMonentsAttentionListPageSize:20 dynamicId:@"" state:0];
|
||||
}
|
||||
|
||||
- (void)footerRefresh {
|
||||
if (self.hasNoMoreData) {
|
||||
[self showErrorToast:YMLocalizedString(@"XPMonentsAttentionViewController0")];
|
||||
[self.tableView.mj_footer endRefreshing];
|
||||
return;
|
||||
}
|
||||
self.page++;
|
||||
[self.presenter getMonentsAttentionListPageSize:20 dynamicId:self.listInfo.nextDynamicId state:1];
|
||||
if([AccountInfoStorage instance].isRequestRicket == YES)return;
|
||||
if (self.hasNoMoreData) {
|
||||
[self showErrorToast:YMLocalizedString(@"XPMonentsAttentionViewController0")];
|
||||
[self.tableView.mj_footer endRefreshing];
|
||||
return;
|
||||
}
|
||||
self.page++;
|
||||
[self.presenter getMonentsAttentionListPageSize:20 dynamicId:self.listInfo.nextDynamicId state:1];
|
||||
}
|
||||
|
||||
#pragma mark - UITableViewDelegate And UITableViewDataSource
|
||||
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
||||
return self.datasource.count > 0 ? self.datasource.count : 1;
|
||||
return self.datasource.count > 0 ? self.datasource.count : 1;
|
||||
}
|
||||
|
||||
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
if (self.datasource.count > 0) {
|
||||
MonentsInfoModel * monentInfo= [self.datasource safeObjectAtIndex1:indexPath.row];
|
||||
[XPMonentsLayoutConfig layoutMonentsModel:monentInfo];
|
||||
return monentInfo.rowHeight;
|
||||
}
|
||||
return KScreenHeight - kNavigationHeight - 49 - kSafeAreaBottomHeight;
|
||||
if (self.datasource.count > 0) {
|
||||
MonentsInfoModel * monentInfo= [self.datasource safeObjectAtIndex1:indexPath.row];
|
||||
[XPMonentsLayoutConfig layoutMonentsModel:monentInfo];
|
||||
if(monentInfo.squareTop && monentInfo.content.length == 0){
|
||||
return monentInfo.rowHeight + 20 ;
|
||||
}else{
|
||||
return monentInfo.rowHeight;
|
||||
}
|
||||
|
||||
}
|
||||
return KScreenHeight - kNavigationHeight - 49 - kSafeAreaBottomHeight;
|
||||
}
|
||||
|
||||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
if (self.datasource.count > 0) {
|
||||
XPMonentsTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMonentsTableViewCell class])];
|
||||
MonentsInfoModel * monentsInfo = [self.datasource safeObjectAtIndex1:indexPath.row];
|
||||
cell.delegate = self;
|
||||
cell.monentsInfo = monentsInfo;
|
||||
return cell;
|
||||
}
|
||||
XPMonentsEmptyTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMonentsEmptyTableViewCell class])];
|
||||
return cell;
|
||||
if (self.datasource.count > 0) {
|
||||
XPMonentsTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMonentsTableViewCell class])];
|
||||
MonentsInfoModel * monentsInfo = [self.datasource safeObjectAtIndex1:indexPath.row];
|
||||
cell.delegate = self;
|
||||
cell.monentsInfo = monentsInfo;
|
||||
return cell;
|
||||
}
|
||||
XPMonentsEmptyTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMonentsEmptyTableViewCell class])];
|
||||
return cell;
|
||||
}
|
||||
|
||||
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
[tableView deselectRowAtIndexPath:indexPath animated:YES];
|
||||
if (self.datasource.count > 0) {
|
||||
MonentsInfoModel * monentsInfo = [self.datasource safeObjectAtIndex1:indexPath.row];
|
||||
if ([ClientConfig shareConfig].canOpen) {
|
||||
XPMonentsDetailViewController * detailVC = [[XPMonentsDetailViewController alloc] init];
|
||||
detailVC.monentsInfo = monentsInfo;
|
||||
detailVC.delegate = self;
|
||||
[self.navigationController pushViewController:detailVC animated:YES];
|
||||
}else{
|
||||
XPMomentsSimpleDetailViewController * detailVC = [[XPMomentsSimpleDetailViewController alloc] init];
|
||||
detailVC.monentsInfo = monentsInfo;
|
||||
detailVC.delegate = self;
|
||||
[self.navigationController pushViewController:detailVC animated:YES];
|
||||
}
|
||||
}
|
||||
[tableView deselectRowAtIndexPath:indexPath animated:YES];
|
||||
if (self.datasource.count > 0) {
|
||||
XPMonentsDetailViewController * detailVC = [[XPMonentsDetailViewController alloc] init];
|
||||
MonentsInfoModel * monentsInfo = [self.datasource safeObjectAtIndex1:indexPath.row];
|
||||
detailVC.monentsInfo = monentsInfo;
|
||||
detailVC.delegate = self;
|
||||
[self.navigationController pushViewController:detailVC animated:YES];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - XPMonentsDetailViewControllerDelegate
|
||||
- (void)xPMonentsDetailViewController:(XPMonentsDetailViewController *)view deleteMonents:(NSString *)dynamicId {
|
||||
__block MonentsInfoModel * deleteInfo;
|
||||
[self.datasource enumerateObjectsUsingBlock:^(MonentsInfoModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
if (obj.dynamicId.integerValue == dynamicId.integerValue) {
|
||||
deleteInfo = obj;
|
||||
}
|
||||
}];
|
||||
- (void)xPMonentsTableViewCell:(XPMonentsTableViewCell *)view didClicShielding:(MonentsInfoModel *)monentsInfo{
|
||||
[self showLoading];
|
||||
[self.presenter requesstShieldingWtihType:@"0" objId:monentsInfo.dynamicId];
|
||||
}
|
||||
|
||||
if (deleteInfo) {
|
||||
[self.datasource removeObject:deleteInfo];
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
- (void)xPMonentsDetailViewController:(XPMonentsDetailViewController *)view deleteMonents:(NSString *)dynamicId {
|
||||
__block MonentsInfoModel * deleteInfo;
|
||||
[self.datasource enumerateObjectsUsingBlock:^(MonentsInfoModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
if (obj.dynamicId.integerValue == dynamicId.integerValue) {
|
||||
deleteInfo = obj;
|
||||
}
|
||||
}];
|
||||
|
||||
if (deleteInfo) {
|
||||
[self.datasource removeObject:deleteInfo];
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
}
|
||||
|
||||
#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]];
|
||||
[self.presenter likeMonent:monentsInfo.dynamicId status:!monentsInfo.isLike likedUid:monentsInfo.uid worldId:[NSString stringWithFormat:@"%ld", monentsInfo.worldId]];
|
||||
}
|
||||
|
||||
- (void)xPMonentsTableViewCell:(XPMonentsTableViewCell *)view didClicDelete:(MonentsInfoModel *)monentsInfo {
|
||||
[TTPopup alertWithMessage:YMLocalizedString(@"XPMonentsTopicLatestViewController1") confirmHandler:^{
|
||||
[self.presenter deleteMonents:monentsInfo.dynamicId worldId:[NSString stringWithFormat:@"%ld", monentsInfo.worldId]];
|
||||
} cancelHandler:^{
|
||||
|
||||
}];
|
||||
[TTPopup alertWithMessage:YMLocalizedString(@"XPMonentsAttentionViewController1") confirmHandler:^{
|
||||
[self.presenter deleteMonents:monentsInfo.dynamicId worldId:[NSString stringWithFormat:@"%ld", monentsInfo.worldId]];
|
||||
} cancelHandler:^{
|
||||
|
||||
}];
|
||||
}
|
||||
|
||||
- (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];
|
||||
}
|
||||
__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;
|
||||
return self.view;
|
||||
}
|
||||
|
||||
#pragma mark - XPMonentsRecommendProtocol
|
||||
- (void)getMonentsAttentionListSuccess:(MonentsListInfoModel *)listInfo state:(int)state {
|
||||
self.listInfo = listInfo;
|
||||
if (state == 0) {
|
||||
[self.datasource removeAllObjects];
|
||||
}
|
||||
if (listInfo.dynamicList.count > 0) {
|
||||
[self.datasource addObjectsFromArray:listInfo.dynamicList];
|
||||
}
|
||||
|
||||
if (state == 0) {
|
||||
self.hasNoMoreData = NO;
|
||||
[self.tableView.mj_header endRefreshing];
|
||||
} else {
|
||||
if (listInfo.dynamicList.count > 0) {
|
||||
self.hasNoMoreData = NO;
|
||||
} else {
|
||||
self.hasNoMoreData = YES;
|
||||
}
|
||||
[self.tableView.mj_footer endRefreshing];
|
||||
}
|
||||
[self.tableView reloadData];
|
||||
self.listInfo = listInfo;
|
||||
if (state == 0) {
|
||||
[self.datasource removeAllObjects];
|
||||
}
|
||||
if (listInfo.dynamicList.count > 0) {
|
||||
[self.datasource addObjectsFromArray:listInfo.dynamicList];
|
||||
}
|
||||
|
||||
if (state == 0) {
|
||||
self.hasNoMoreData = NO;
|
||||
[self.tableView.mj_header endRefreshing];
|
||||
} else {
|
||||
if (listInfo.dynamicList.count > 0) {
|
||||
self.hasNoMoreData = NO;
|
||||
} else {
|
||||
self.hasNoMoreData = YES;
|
||||
}
|
||||
[self.tableView.mj_footer endRefreshing];
|
||||
}
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
|
||||
- (void)getMonentsAttentionListFail:(NSString *)msg state:(int)state {
|
||||
if (state == 0) {
|
||||
[self.tableView.mj_header endRefreshing];
|
||||
} else {
|
||||
[self.tableView.mj_footer endRefreshing];
|
||||
}
|
||||
if (state == 0) {
|
||||
[self.tableView.mj_header endRefreshing];
|
||||
} else {
|
||||
[self.tableView.mj_footer endRefreshing];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)likeMonentsSuccess:(NSString *)dynamicId status:(BOOL)status {
|
||||
[self.datasource enumerateObjectsUsingBlock:^(MonentsInfoModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
if ([obj.dynamicId isEqualToString:dynamicId]) {
|
||||
if (status) {
|
||||
obj.isLike += 1;
|
||||
} else {
|
||||
obj.isLike -= 1;
|
||||
}
|
||||
*stop = YES;
|
||||
}
|
||||
}];
|
||||
[self.tableView reloadData];
|
||||
[self.datasource enumerateObjectsUsingBlock:^(MonentsInfoModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
if ([obj.dynamicId isEqualToString:dynamicId]) {
|
||||
if (status) {
|
||||
obj.isLike += 1;
|
||||
} else {
|
||||
obj.isLike -= 1;
|
||||
}
|
||||
*stop = YES;
|
||||
}
|
||||
}];
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
-(void)requesstShieldingSuccess:(NSString *)monentsInfo{
|
||||
[self hideHUD];
|
||||
[self showSuccessToast:YMLocalizedString(@"XPMonentsMineViewController2")];
|
||||
__block MonentsInfoModel * deleteInfo;
|
||||
[self.datasource enumerateObjectsUsingBlock:^(MonentsInfoModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
if (obj.dynamicId.integerValue == monentsInfo.integerValue) {
|
||||
deleteInfo = obj;
|
||||
}
|
||||
}];
|
||||
|
||||
if (deleteInfo) {
|
||||
[self.datasource removeObject:deleteInfo];
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)deleteMonentsSuccess:(NSString *)monentsInfo {
|
||||
[self showSuccessToast:YMLocalizedString(@"XPMonentsAttentionViewController2")];
|
||||
__block MonentsInfoModel * deleteInfo;
|
||||
[self.datasource enumerateObjectsUsingBlock:^(MonentsInfoModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
if (obj.dynamicId.integerValue == monentsInfo.integerValue) {
|
||||
deleteInfo = obj;
|
||||
}
|
||||
}];
|
||||
|
||||
if (deleteInfo) {
|
||||
[self.datasource removeObject:deleteInfo];
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
[self showSuccessToast:YMLocalizedString(@"XPMonentsAttentionViewController2")];
|
||||
__block MonentsInfoModel * deleteInfo;
|
||||
[self.datasource enumerateObjectsUsingBlock:^(MonentsInfoModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
if (obj.dynamicId.integerValue == monentsInfo.integerValue) {
|
||||
deleteInfo = obj;
|
||||
}
|
||||
}];
|
||||
|
||||
if (deleteInfo) {
|
||||
[self.datasource removeObject:deleteInfo];
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
- (UITableView *)tableView {
|
||||
if (!_tableView) {
|
||||
_tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
|
||||
_tableView.delegate = self;
|
||||
_tableView.dataSource = self;
|
||||
_tableView.tableFooterView = [UIView new];
|
||||
_tableView.contentInset = UIEdgeInsetsMake(0, 0, 100, 0);
|
||||
_tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
|
||||
_tableView.backgroundColor = [UIColor clearColor];
|
||||
if (@available(iOS 11.0, *)) {
|
||||
_tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
|
||||
}
|
||||
[_tableView registerClass:[XPMonentsTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPMonentsTableViewCell class])];
|
||||
[_tableView registerClass:[XPMonentsEmptyTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPMonentsEmptyTableViewCell class])];
|
||||
}
|
||||
return _tableView;
|
||||
if (!_tableView) {
|
||||
_tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
|
||||
_tableView.delegate = self;
|
||||
_tableView.dataSource = self;
|
||||
_tableView.tableFooterView = [UIView new];
|
||||
_tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
|
||||
_tableView.backgroundColor = [UIColor clearColor];
|
||||
if (@available(iOS 11.0, *)) {
|
||||
_tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
|
||||
}
|
||||
[_tableView registerClass:[XPMonentsTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPMonentsTableViewCell class])];
|
||||
[_tableView registerClass:[XPMonentsEmptyTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPMonentsEmptyTableViewCell class])];
|
||||
}
|
||||
return _tableView;
|
||||
}
|
||||
|
||||
|
||||
- (NSMutableArray<MonentsInfoModel *> *)datasource {
|
||||
if (!_datasource) {
|
||||
_datasource = [NSMutableArray array];
|
||||
}
|
||||
return _datasource;
|
||||
if (!_datasource) {
|
||||
_datasource = [NSMutableArray array];
|
||||
}
|
||||
return _datasource;
|
||||
}
|
||||
@end
|
||||
|
@@ -1,8 +1,8 @@
|
||||
//
|
||||
// YMMonentsDetailViewController.m
|
||||
// YUMI
|
||||
// XPMonentsDetailViewController.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by YUMI on 2022/6/22.
|
||||
// Created by 冯硕 on 2022/6/22.
|
||||
//
|
||||
|
||||
#import "XPMonentsDetailViewController.h"
|
||||
@@ -11,12 +11,9 @@
|
||||
#import <MJRefresh/MJRefresh.h>
|
||||
///Tool
|
||||
#import "XPMonentsLayoutConfig.h"
|
||||
#import "DJDKMIMOMColor.h"
|
||||
#import "QEmotionHelper.h"
|
||||
#import "QKeyboardManager.h"
|
||||
#import "TTPopup.h"
|
||||
#import "NSArray+Safe.h"
|
||||
#import "ClientConfig.h"
|
||||
///Model
|
||||
#import "MonentsInfoModel.h"
|
||||
#import "MonentsCommentModel.h"
|
||||
@@ -29,7 +26,6 @@
|
||||
#import "QKeyboardManager.h"
|
||||
#import "QEmotionBoardView.h"
|
||||
#import "XPMineUserInfoViewController.h"
|
||||
#import "XPMineSimpleUserInfoViewController.h"
|
||||
///P
|
||||
#import "XPMonentDetailPresenter.h"
|
||||
#import "XPMonentsDetailProtocol.h"
|
||||
@@ -50,286 +46,340 @@
|
||||
@end
|
||||
|
||||
@implementation XPMonentsDetailViewController
|
||||
|
||||
-(void)dealloc{
|
||||
[[NSNotificationCenter defaultCenter]removeObserver:self];
|
||||
}
|
||||
- (__kindof id)createPresenter {
|
||||
return [[XPMonentDetailPresenter alloc] init];
|
||||
return [[XPMonentDetailPresenter alloc] init];
|
||||
}
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
[self initHeaderAndFooterRrfresh];
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
}
|
||||
[self initHeaderAndFooterRrfresh];
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(refreshDynamicData:) name:@"kRefreshDynamicData" object:nil];
|
||||
|
||||
}
|
||||
-(void)refreshDynamicData:(NSNotification *)not{
|
||||
NSDictionary *refreshData = not.object;
|
||||
int type = [refreshData[@"type"] intValue];
|
||||
///type,0=点赞,1=删除,2=屏蔽,3=评论
|
||||
switch (type) {
|
||||
case 0:
|
||||
{
|
||||
|
||||
BOOL status = [refreshData[@"status"] boolValue];
|
||||
NSInteger count = self.monentsInfo.likeCount.integerValue;
|
||||
NSString *dynamicId = refreshData[@"dynamicId"];
|
||||
if([self.monentsInfo.dynamicId isEqualToString:dynamicId]){
|
||||
self.monentsInfo.isLike = status;
|
||||
if (status) {
|
||||
count += 1;
|
||||
} else {
|
||||
count -= 1;
|
||||
}
|
||||
self.monentsInfo.likeCount = [NSString stringWithFormat:@"%ld", count];
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
NSString *dynamicId = refreshData[@"dynamicId"];
|
||||
if([self.monentsInfo.dynamicId isEqualToString:dynamicId]){
|
||||
self.monentsInfo.commentCount = [NSString stringWithFormat:@"%ld",self.monentsInfo.commentCount.integerValue + 1];
|
||||
|
||||
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma mark - 下拉刷新
|
||||
- (void)initHeaderAndFooterRrfresh {
|
||||
MJRefreshNormalHeader *header = [MJRefreshNormalHeader headerWithRefreshingTarget:self refreshingAction:@selector(headerRefresh)];
|
||||
header.stateLabel.font = [UIFont systemFontOfSize:10.0];
|
||||
header.lastUpdatedTimeLabel.font = [UIFont systemFontOfSize:10.0];
|
||||
header.stateLabel.textColor = [DJDKMIMOMColor secondTextColor];
|
||||
header.lastUpdatedTimeLabel.textColor = [DJDKMIMOMColor secondTextColor];
|
||||
self.tableView.mj_header = header;
|
||||
|
||||
MJRefreshBackNormalFooter *footer = [MJRefreshBackNormalFooter footerWithRefreshingTarget:self refreshingAction:@selector(footerRefresh)];
|
||||
footer.stateLabel.textColor = [DJDKMIMOMColor secondTextColor];
|
||||
footer.stateLabel.font = [UIFont systemFontOfSize:10.0];
|
||||
self.tableView.mj_footer = footer;
|
||||
|
||||
[self headerRefresh];
|
||||
MJRefreshNormalHeader *header = [MJRefreshNormalHeader headerWithRefreshingTarget:self refreshingAction:@selector(headerRefresh)];
|
||||
header.stateLabel.font = [UIFont systemFontOfSize:10.0];
|
||||
header.lastUpdatedTimeLabel.font = [UIFont systemFontOfSize:10.0];
|
||||
header.stateLabel.textColor = [DJDKMIMOMColor secondTextColor];
|
||||
header.lastUpdatedTimeLabel.textColor = [DJDKMIMOMColor secondTextColor];
|
||||
self.tableView.mj_header = header;
|
||||
|
||||
MJRefreshBackNormalFooter *footer = [MJRefreshBackNormalFooter footerWithRefreshingTarget:self refreshingAction:@selector(footerRefresh)];
|
||||
footer.stateLabel.textColor = [DJDKMIMOMColor secondTextColor];
|
||||
footer.stateLabel.font = [UIFont systemFontOfSize:10.0];
|
||||
self.tableView.mj_footer = footer;
|
||||
|
||||
[self headerRefresh];
|
||||
}
|
||||
|
||||
- (void)headerRefresh {
|
||||
[self.presenter getMonentsDetail:self.monentsInfo.dynamicId];
|
||||
[self.presenter getMonentsCommentList:self.monentsInfo.dynamicId timestamp:@"" status:0];
|
||||
[self.presenter getMonentsDetail:self.monentsInfo.dynamicId];
|
||||
[self.presenter getMonentsCommentList:self.monentsInfo.dynamicId timestamp:@"" status:0];
|
||||
}
|
||||
|
||||
- (void)footerRefresh {
|
||||
NSString *timestamp = @"";
|
||||
if (self.datasource.count > 0) {
|
||||
MonentsCommentModel * commentInfo = [self.datasource lastObject];
|
||||
timestamp = commentInfo.publishTime;
|
||||
}
|
||||
[self.presenter getMonentsCommentList:self.monentsInfo.dynamicId timestamp:timestamp status:1];
|
||||
NSString *timestamp = @"";
|
||||
if (self.datasource.count > 0) {
|
||||
MonentsCommentModel * commentInfo = [self.datasource lastObject];
|
||||
timestamp = commentInfo.publishTime;
|
||||
}
|
||||
[self.presenter getMonentsCommentList:self.monentsInfo.dynamicId timestamp:timestamp status:1];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - Private Method
|
||||
- (void)initInputView {
|
||||
// 初始化输入工具条,frame可以先这样临时设置,下面的addBottomInputBarView方法会重置输入条frame
|
||||
// 如果你想要自定义输入条View,请参考TextFieldViewController代码
|
||||
_inputBarView = [[QInputBarView alloc] initWithFrame:CGRectMake(0,0,self.view.frame.size.width,UIInputBarViewMinHeight)];
|
||||
QInputBarViewConfiguration *inputBarViewConfiguration = [QInputBarViewConfiguration defaultInputBarViewConfiguration];
|
||||
inputBarViewConfiguration.voiceButtonHidden = YES;//隐藏语音按钮
|
||||
inputBarViewConfiguration.extendButtonHidden = YES;//隐藏拓展按钮
|
||||
[_inputBarView setupWithConfiguration:inputBarViewConfiguration];
|
||||
_inputBarView.delegate = self;
|
||||
// 初始化输入工具条,frame可以先这样临时设置,下面的addBottomInputBarView方法会重置输入条frame
|
||||
// 如果你想要自定义输入条View,请参考TextFieldViewController代码
|
||||
_inputBarView = [[QInputBarView alloc] initWithFrame:CGRectMake(0,0,self.view.frame.size.width,UIInputBarViewMinHeight)];
|
||||
QInputBarViewConfiguration *inputBarViewConfiguration = [QInputBarViewConfiguration defaultInputBarViewConfiguration];
|
||||
inputBarViewConfiguration.voiceButtonHidden = YES;//隐藏语音按钮
|
||||
inputBarViewConfiguration.extendButtonHidden = YES;//隐藏拓展按钮
|
||||
[_inputBarView setupWithConfiguration:inputBarViewConfiguration];
|
||||
_inputBarView.delegate = self;
|
||||
|
||||
//keyboard管理类,用来管理键盘,各大面板的切换
|
||||
_keyboardManager = [[QKeyboardManager alloc] initWithViewController:self];
|
||||
_keyboardManager.dataSource = self;
|
||||
//因为addBottomInputBarView方法会立刻触发delegate,所以这里需要先设置delegate
|
||||
_keyboardManager.delegate = self;
|
||||
[_keyboardManager addBottomInputBarView:_inputBarView belowViewController:NO];
|
||||
//keyboard管理类,用来管理键盘,各大面板的切换
|
||||
_keyboardManager = [[QKeyboardManager alloc] initWithViewController:self];
|
||||
_keyboardManager.dataSource = self;
|
||||
//因为addBottomInputBarView方法会立刻触发delegate,所以这里需要先设置delegate
|
||||
_keyboardManager.delegate = self;
|
||||
[_keyboardManager addBottomInputBarView:_inputBarView belowViewController:NO];
|
||||
|
||||
//把输入框(如果有的话)绑定给管理类
|
||||
[_keyboardManager bindTextView:_inputBarView.inputTextView];
|
||||
//把输入框(如果有的话)绑定给管理类
|
||||
[_keyboardManager bindTextView:_inputBarView.inputTextView];
|
||||
}
|
||||
|
||||
- (void)sendTextMessage:(NSString *)inputText {
|
||||
if (inputText.length > 0) {
|
||||
[_keyboardManager hideAllBoardView];
|
||||
if (self.commentId && self.commentId.length > 0) {
|
||||
[self.presenter replayCommon:self.commentId dynamicId:self.monentsInfo.dynamicId content:inputText];
|
||||
} else {
|
||||
[self.presenter commontMonents:self.monentsInfo.dynamicId content:inputText];
|
||||
}
|
||||
self.inputBarView.inputTextView.text = nil;
|
||||
} else {
|
||||
[self showErrorToast:YMLocalizedString(@"XPMonentsDetailViewController0")];
|
||||
}
|
||||
if (inputText.length > 0) {
|
||||
[_keyboardManager hideAllBoardView];
|
||||
if (self.commentId && self.commentId.length > 0) {
|
||||
[self.presenter replayCommon:self.commentId dynamicId:self.monentsInfo.dynamicId content:inputText];
|
||||
} else {
|
||||
[self.presenter commontMonents:self.monentsInfo.dynamicId content:inputText];
|
||||
}
|
||||
self.inputBarView.inputTextView.text = nil;
|
||||
} else {
|
||||
[self showErrorToast:YMLocalizedString(@"XPMonentsDetailViewController0")];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)initSubViews {
|
||||
self.title = YMLocalizedString(@"XPMonentsDetailViewController1");
|
||||
[self.view addSubview:self.tableView];
|
||||
[self.sectionView addSubview:self.commentLabel];
|
||||
[self initInputView];
|
||||
self.title = YMLocalizedString(@"XPMonentsDetailViewController1");
|
||||
[self.view addSubview:self.tableView];
|
||||
[self.sectionView addSubview:self.commentLabel];
|
||||
[self initInputView];
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.top.mas_equalTo(self.view);
|
||||
make.bottom.mas_equalTo(self.inputBarView.mas_top);
|
||||
}];
|
||||
|
||||
[self.commentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.sectionView).offset(15);
|
||||
make.centerY.mas_equalTo(self.sectionView);
|
||||
}];
|
||||
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.leading.trailing.top.mas_equalTo(self.view);
|
||||
make.bottom.mas_equalTo(self.inputBarView.mas_top);
|
||||
}];
|
||||
|
||||
[self.commentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.leading.mas_equalTo(self.sectionView).offset(15);
|
||||
make.centerY.mas_equalTo(self.sectionView);
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - UITableViewDelegate And UITableViewDataSource
|
||||
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
|
||||
return 2;
|
||||
return 2;
|
||||
}
|
||||
|
||||
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
||||
if (section == 0) {
|
||||
return 1;
|
||||
}
|
||||
return self.datasource.count > 0 ? self.datasource.count : 1;
|
||||
if (section == 0) {
|
||||
return 1;
|
||||
}
|
||||
return self.datasource.count > 0 ? self.datasource.count : 1;
|
||||
}
|
||||
|
||||
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
if (indexPath.section == 0) {
|
||||
[XPMonentsLayoutConfig layoutMonentsModel:self.monentsInfo];
|
||||
return self.monentsInfo.rowHeight;
|
||||
} else if(indexPath.section == 1) {
|
||||
if (self.datasource.count > 0) {
|
||||
MonentsCommentModel * commentInfo = [self.datasource safeObjectAtIndex1:indexPath.row];
|
||||
return [XPMonentsLayoutConfig commentCommentRowHeight:commentInfo];
|
||||
} else {
|
||||
return 400;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
if (indexPath.section == 0) {
|
||||
[XPMonentsLayoutConfig layoutMonentsModel:self.monentsInfo];
|
||||
|
||||
if(self.monentsInfo.squareTop && self.monentsInfo.content.length == 0){
|
||||
return self.monentsInfo.rowHeight + 20 ;
|
||||
}else{
|
||||
return self.monentsInfo.rowHeight;
|
||||
}
|
||||
} else if(indexPath.section == 1) {
|
||||
if (self.datasource.count > 0) {
|
||||
MonentsCommentModel * commentInfo = [self.datasource safeObjectAtIndex1:indexPath.row];
|
||||
return [XPMonentsLayoutConfig commentCommentRowHeight:commentInfo];
|
||||
} else {
|
||||
return 400;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
|
||||
if (section == 1) {
|
||||
return 44;
|
||||
}
|
||||
return 0.0;;
|
||||
if (section == 1) {
|
||||
return 44;
|
||||
}
|
||||
return 0.0;;
|
||||
}
|
||||
|
||||
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
|
||||
self.commentLabel.text = [NSString stringWithFormat:@"%@(%@)",YMLocalizedString(@"XPMonentsDetailViewController2"),self.monentsInfo.commentCount];
|
||||
return self.sectionView;
|
||||
self.commentLabel.text = [NSString stringWithFormat:YMLocalizedString(@"XPMonentsDetailViewController2"), self.monentsInfo.commentCount];
|
||||
return self.sectionView;
|
||||
}
|
||||
|
||||
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
|
||||
return 0.0f;
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
|
||||
return [UIView new];
|
||||
return [UIView new];
|
||||
}
|
||||
|
||||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
if (indexPath.section ==0) {
|
||||
XPMonentsTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMonentsTableViewCell class])];
|
||||
cell.delegate = self;
|
||||
cell.monentsInfo = self.monentsInfo;
|
||||
return cell;
|
||||
} else {
|
||||
if (self.datasource.count > 0) {
|
||||
XPMonentsCommentTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMonentsCommentTableViewCell class])];
|
||||
cell.commentInfo = [self.datasource safeObjectAtIndex1:indexPath.row];
|
||||
cell.delegate = self;
|
||||
return cell;
|
||||
} else {
|
||||
XPMonentsEmptyTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMonentsEmptyTableViewCell class])];
|
||||
return cell;
|
||||
}
|
||||
}
|
||||
if (indexPath.section ==0) {
|
||||
XPMonentsTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMonentsTableViewCell class])];
|
||||
cell.delegate = self;
|
||||
cell.monentsInfo = self.monentsInfo;
|
||||
return cell;
|
||||
} else {
|
||||
if (self.datasource.count > 0) {
|
||||
XPMonentsCommentTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMonentsCommentTableViewCell class])];
|
||||
cell.commentInfo = [self.datasource safeObjectAtIndex1:indexPath.row];
|
||||
cell.delegate = self;
|
||||
return cell;
|
||||
} else {
|
||||
XPMonentsEmptyTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMonentsEmptyTableViewCell class])];
|
||||
return cell;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
[tableView deselectRowAtIndexPath:indexPath animated:YES];
|
||||
if (indexPath.section == 1) {
|
||||
if (self.datasource.count > 0) {
|
||||
MonentsCommentModel* monent = [self.datasource safeObjectAtIndex1:indexPath.row];
|
||||
self.commentId = monent.commentId;
|
||||
self.inputBarView.inputTextView.placeholder = [NSString stringWithFormat:@"%@: %@", YMLocalizedString(@"XPMonentsDetailViewController3"),monent.nick];
|
||||
[self.inputBarView textViewBecomeFirstResponder];
|
||||
}
|
||||
}
|
||||
[tableView deselectRowAtIndexPath:indexPath animated:YES];
|
||||
if (indexPath.section == 1) {
|
||||
if (self.datasource.count > 0) {
|
||||
MonentsCommentModel* monent = [self.datasource safeObjectAtIndex1:indexPath.row];
|
||||
self.commentId = monent.commentId;
|
||||
self.inputBarView.inputTextView.placeholder = [NSString stringWithFormat:YMLocalizedString(@"XPMonentsDetailViewController3"), monent.nick];
|
||||
[self.inputBarView textViewBecomeFirstResponder];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
|
||||
[_keyboardManager hideAllBoardView];
|
||||
[_keyboardManager hideAllBoardView];
|
||||
}
|
||||
|
||||
#pragma mark - XPMonentsCommentTableViewCellDelegate
|
||||
- (void)xPMonentsTableViewCell:(XPMonentsTableViewCell *)view didClicShielding:(MonentsInfoModel *)monentsInfo{
|
||||
[self showLoading];
|
||||
[self.presenter requesstShieldingWtihType:@"0" objId:monentsInfo.dynamicId];
|
||||
}
|
||||
- (void)xPMonentsCommentTableViewCell:(XPMonentsCommentTableViewCell *)view didClickMoreReply:(MonentsCommentModel *)commentInfo {
|
||||
[self.presenter getMonentsCommentReplyList:self.monentsInfo.dynamicId commentId:commentInfo.commentId timestamp:commentInfo.replyInfo.nextTimestamp];
|
||||
[self.presenter getMonentsCommentReplyList:self.monentsInfo.dynamicId commentId:commentInfo.commentId timestamp:commentInfo.replyInfo.nextTimestamp];
|
||||
}
|
||||
|
||||
- (void)xPMonentsCommentTableViewCell:(XPMonentsCommentTableViewCell *)view didClickCommon:(MonentsReplyModel *)commentInfo {
|
||||
if (commentInfo) {
|
||||
self.commentId = commentInfo.replyId;
|
||||
self.inputBarView.inputTextView.placeholder = [NSString stringWithFormat:@"%@: %@",YMLocalizedString(@"XPMonentsDetailViewController3"), commentInfo.nick];
|
||||
[self.inputBarView textViewBecomeFirstResponder];
|
||||
}
|
||||
if (commentInfo) {
|
||||
self.commentId = commentInfo.replyId;
|
||||
self.inputBarView.inputTextView.placeholder = [NSString stringWithFormat:YMLocalizedString(@"XPMonentsDetailViewController4"), commentInfo.nick];
|
||||
[self.inputBarView textViewBecomeFirstResponder];
|
||||
}
|
||||
}
|
||||
- (void)xPMonentsCommentTableViewCell:(XPMonentsCommentTableViewCell *)view didClickAvatar:(NSString *)commentInfo {
|
||||
if ([ClientConfig shareConfig].canOpen) {
|
||||
XPMineUserInfoViewController * userInfoVC = [[XPMineUserInfoViewController alloc] init];
|
||||
userInfoVC.uid = commentInfo.integerValue;
|
||||
[self.navigationController pushViewController:userInfoVC animated:YES];
|
||||
}else{
|
||||
XPMineSimpleUserInfoViewController * userInfoVC = [[XPMineSimpleUserInfoViewController alloc] init];
|
||||
userInfoVC.uid = commentInfo.integerValue;
|
||||
[self.navigationController pushViewController:userInfoVC animated:YES];
|
||||
}
|
||||
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]];
|
||||
[self.presenter likeMonent:monentsInfo.dynamicId status:!monentsInfo.isLike likedUid:monentsInfo.uid worldId:[NSString stringWithFormat:@"%ld", monentsInfo.worldId]];
|
||||
}
|
||||
|
||||
- (void)xPMonentsTableViewCell:(XPMonentsTableViewCell *)view didClicDelete:(MonentsInfoModel *)monentsInfo {
|
||||
[TTPopup alertWithMessage:YMLocalizedString(@"XPMonentsDetailViewController5") confirmHandler:^{
|
||||
[self.presenter deleteMonents:monentsInfo.dynamicId worldId:[NSString stringWithFormat:@"%ld", monentsInfo.worldId]];
|
||||
} cancelHandler:^{
|
||||
[TTPopup alertWithMessage:YMLocalizedString(@"XPMonentsDetailViewController5") confirmHandler:^{
|
||||
[self.presenter deleteMonents:monentsInfo.dynamicId worldId:[NSString stringWithFormat:@"%ld", monentsInfo.worldId]];
|
||||
} cancelHandler:^{
|
||||
|
||||
}];
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)xPMonentsTableViewCell:(XPMonentsTableViewCell *)view didClicCommon:(MonentsInfoModel *)monentsInfo {
|
||||
if (monentsInfo) {
|
||||
self.commentId = nil;
|
||||
self.inputBarView.inputTextView.placeholder = YMLocalizedString(@"XPMonentsDetailViewController6");
|
||||
[self.inputBarView textViewBecomeFirstResponder];
|
||||
}
|
||||
if (monentsInfo) {
|
||||
self.commentId = nil;
|
||||
self.inputBarView.inputTextView.placeholder = YMLocalizedString(@"XPMonentsDetailViewController6");
|
||||
[self.inputBarView textViewBecomeFirstResponder];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)xPMonentsTableViewCell:(XPMonentsTableViewCell *)view didClicFold:(MonentsInfoModel *)monentsInfo {
|
||||
self.monentsInfo = monentsInfo;
|
||||
[self.tableView reloadSections:[NSIndexSet indexSetWithIndex:0] withRowAnimation:UITableViewRowAnimationNone];
|
||||
self.monentsInfo = monentsInfo;
|
||||
[self.tableView reloadSections:[NSIndexSet indexSetWithIndex:0] withRowAnimation:UITableViewRowAnimationNone];
|
||||
}
|
||||
|
||||
#pragma mark - InputBoardDataSource
|
||||
//@return 点加号按钮弹出的拓展面板View,且无需设置frame
|
||||
- (UIView *)keyboardManagerExtendBoardView:(QKeyboardManager *)keyboardManager {
|
||||
UIView *boardView = [UIView new];
|
||||
boardView.backgroundColor = UIColor.blueColor;
|
||||
return boardView;
|
||||
UIView *boardView = [UIView new];
|
||||
boardView.backgroundColor = UIColor.blueColor;
|
||||
return boardView;
|
||||
}
|
||||
|
||||
//@return 点表情按钮弹出的表情面板View,且无需设置frame
|
||||
- (UIView *)keyboardManagerEmotionBoardView:(QKeyboardManager *)keyboardManager {
|
||||
QEmotionBoardView *emotionView = [[QEmotionBoardView alloc] init];
|
||||
QEmotionHelper *faceManager = [QEmotionHelper sharedEmotionHelper];
|
||||
emotionView.emotions = faceManager.emotionArray;
|
||||
emotionView.delegate = self;
|
||||
if (@available(iOS 11.0, *)) {
|
||||
NSBundle *bundle = [NSBundle bundleForClass:[self class]];
|
||||
emotionView.backgroundColor = [UIColor colorNamed:@"q_input_extend_bg" inBundle:bundle compatibleWithTraitCollection:nil];
|
||||
} else {
|
||||
emotionView.backgroundColor = [UIColor colorWithRed:(246)/255.0f green:(246)/255.0f blue:(246)/255.0f alpha:1];
|
||||
}
|
||||
return emotionView;
|
||||
QEmotionBoardView *emotionView = [[QEmotionBoardView alloc] init];
|
||||
QEmotionHelper *faceManager = [QEmotionHelper sharedEmotionHelper];
|
||||
emotionView.emotions = faceManager.emotionArray;
|
||||
emotionView.delegate = self;
|
||||
if (@available(iOS 11.0, *)) {
|
||||
NSBundle *bundle = [NSBundle bundleForClass:[self class]];
|
||||
emotionView.backgroundColor = [UIColor colorNamed:@"q_input_extend_bg" inBundle:bundle compatibleWithTraitCollection:nil];
|
||||
} else {
|
||||
emotionView.backgroundColor = [UIColor colorWithRed:(246)/255.0f green:(246)/255.0f blue:(246)/255.0f alpha:1];
|
||||
}
|
||||
return emotionView;
|
||||
}
|
||||
|
||||
//@return 点表情按钮弹出的表情面板View的高度
|
||||
- (CGFloat)keyboardManagerEmotionBoardHeight:(QKeyboardManager *)keyboardManager {
|
||||
return 294;
|
||||
return 294;
|
||||
}
|
||||
|
||||
//@return 点加号按钮弹出的拓展面板View的高度
|
||||
- (CGFloat)keyboardManagerExtendBoardHeight:(QKeyboardManager *)keyboardManager {
|
||||
return 174;
|
||||
return 174;
|
||||
}
|
||||
|
||||
- (QInputBarViewConfiguration *)inputBarViewConfiguration {
|
||||
//输入条配置,子类可以重写
|
||||
QInputBarViewConfiguration *inputBarViewConfiguration = [QInputBarViewConfiguration defaultInputBarViewConfiguration];
|
||||
inputBarViewConfiguration.voiceButtonHidden = YES;//隐藏语音按钮
|
||||
inputBarViewConfiguration.extendButtonHidden = YES;//隐藏拓展按钮
|
||||
return inputBarViewConfiguration;
|
||||
//输入条配置,子类可以重写
|
||||
QInputBarViewConfiguration *inputBarViewConfiguration = [QInputBarViewConfiguration defaultInputBarViewConfiguration];
|
||||
inputBarViewConfiguration.voiceButtonHidden = YES;//隐藏语音按钮
|
||||
inputBarViewConfiguration.extendButtonHidden = YES;//隐藏拓展按钮
|
||||
return inputBarViewConfiguration;
|
||||
}
|
||||
|
||||
//点击表情按钮,切换到表情面板
|
||||
- (void)inputBarView:(QInputBarView *)inputBarView onEmotionButtonClick:(UIButton *)emotionSwitchButton {
|
||||
if (emotionSwitchButton.isSelected) {
|
||||
[_keyboardManager switchToEmotionBoardKeyboard];
|
||||
} else {
|
||||
self.commentId = nil;
|
||||
_inputBarView.inputTextView.placeholder = YMLocalizedString(@"XPMonentsDetailViewController7");
|
||||
[_inputBarView textViewBecomeFirstResponder];
|
||||
}
|
||||
if (emotionSwitchButton.isSelected) {
|
||||
[_keyboardManager switchToEmotionBoardKeyboard];
|
||||
} else {
|
||||
self.commentId = nil;
|
||||
_inputBarView.inputTextView.placeholder = YMLocalizedString(@"XPMonentsDetailViewController7");
|
||||
[_inputBarView textViewBecomeFirstResponder];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - QEmotionBoardViewDelegate
|
||||
@@ -339,21 +389,21 @@
|
||||
* @param emotion 被选中的表情对应的`QMUIEmotion`对象
|
||||
*/
|
||||
- (void)emotionView:(QEmotionBoardView *)emotionView didSelectEmotion:(QEmotion *)emotion atIndex:(NSInteger)index {
|
||||
//把😊插入到输入栏
|
||||
[_inputBarView insertEmotion:emotion.displayName];
|
||||
//把😊插入到输入栏
|
||||
[_inputBarView insertEmotion:emotion.displayName];
|
||||
}
|
||||
|
||||
// 删除按钮的点击事件回调
|
||||
- (void)emotionViewDidSelectDeleteButton:(QEmotionBoardView *)emotionView {
|
||||
if (![_inputBarView deleteEmotion]){
|
||||
//根据当前的光标,这次点击删除按钮并没有删除表情,那么就删除文字
|
||||
[_inputBarView.inputTextView deleteBackward];
|
||||
}
|
||||
if (![_inputBarView deleteEmotion]){
|
||||
//根据当前的光标,这次点击删除按钮并没有删除表情,那么就删除文字
|
||||
[_inputBarView.inputTextView deleteBackward];
|
||||
}
|
||||
}
|
||||
|
||||
// 发送按钮的点击事件回调
|
||||
- (void)emotionViewDidSelectSendButton:(QEmotionBoardView *)emotionView {
|
||||
[self sendTextMessage:[_inputBarView textViewInputNormalText]];
|
||||
[self sendTextMessage:[_inputBarView textViewInputNormalText]];
|
||||
}
|
||||
|
||||
|
||||
@@ -363,124 +413,130 @@
|
||||
* @param inputNormalText :"害~你好啊[微笑]"
|
||||
*/
|
||||
- (void)inputBarView:(QInputBarView *)inputBarView onKeyboardSendClick:(NSString *)inputNormalText {
|
||||
[self sendTextMessage:inputNormalText];
|
||||
[self sendTextMessage:inputNormalText];
|
||||
}
|
||||
|
||||
#pragma mark - XPMonentsDetailProtocol
|
||||
- (void)getMonentsDetailSuccess:(MonentsInfoModel *)commentInfo {
|
||||
self.monentsInfo = commentInfo;
|
||||
[self.tableView reloadData];
|
||||
self.monentsInfo = commentInfo;
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
|
||||
- (void)getMonentsCommentListSuccess:(MonentsCommentListModel *)commentInfo state:(int)state{
|
||||
if (state == 0) {
|
||||
[self.datasource removeAllObjects];
|
||||
[self.tableView.mj_header endRefreshing];
|
||||
} else {
|
||||
[self.tableView.mj_footer endRefreshing];
|
||||
}
|
||||
|
||||
if (commentInfo.commentList.count > 0) {
|
||||
[self.datasource addObjectsFromArray:commentInfo.commentList];
|
||||
}
|
||||
[self.tableView reloadData];
|
||||
if (state == 0) {
|
||||
[self.datasource removeAllObjects];
|
||||
[self.tableView.mj_header endRefreshing];
|
||||
} else {
|
||||
[self.tableView.mj_footer endRefreshing];
|
||||
}
|
||||
|
||||
if (commentInfo.commentList.count > 0) {
|
||||
[self.datasource addObjectsFromArray:commentInfo.commentList];
|
||||
}
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
|
||||
- (void)getMonentsCommentReplyListSuccess:(MonentsCommentReplyModel *)replyInfo commentId:(nonnull NSString *)commentId {
|
||||
if (commentId) {
|
||||
__block MonentsCommentModel * commentInfo;
|
||||
[self.datasource enumerateObjectsUsingBlock:^(MonentsCommentModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
if ([obj.commentId isEqualToString:commentId]) {
|
||||
commentInfo = obj;
|
||||
*stop = YES;
|
||||
}
|
||||
}];
|
||||
|
||||
if (commentInfo) {
|
||||
NSMutableArray * replyList= commentInfo.replyInfo.replyList.mutableCopy;
|
||||
[replyList addObjectsFromArray:replyInfo.replyList];
|
||||
commentInfo.replyInfo.replyList = replyList.copy;
|
||||
commentInfo.replyInfo.leftCount = replyInfo.leftCount;
|
||||
commentInfo.replyInfo.nextTimestamp = replyInfo.nextTimestamp;
|
||||
commentInfo.isReloadHeight = YES;
|
||||
}
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
if (commentId) {
|
||||
__block MonentsCommentModel * commentInfo;
|
||||
[self.datasource enumerateObjectsUsingBlock:^(MonentsCommentModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
if ([obj.commentId isEqualToString:commentId]) {
|
||||
commentInfo = obj;
|
||||
*stop = YES;
|
||||
}
|
||||
}];
|
||||
|
||||
if (commentInfo) {
|
||||
NSMutableArray * replyList= commentInfo.replyInfo.replyList.mutableCopy;
|
||||
[replyList addObjectsFromArray:replyInfo.replyList];
|
||||
commentInfo.replyInfo.replyList = replyList.copy;
|
||||
commentInfo.replyInfo.leftCount = replyInfo.leftCount;
|
||||
commentInfo.replyInfo.nextTimestamp = replyInfo.nextTimestamp;
|
||||
commentInfo.isReloadHeight = YES;
|
||||
}
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)likeMonentsSuccess:(NSString *)dynamicId status:(BOOL)status {
|
||||
if ([self.monentsInfo.dynamicId isEqualToString:dynamicId]) {
|
||||
NSInteger count = self.monentsInfo.likeCount.integerValue;
|
||||
self.monentsInfo.isLike = status;
|
||||
if (status) {
|
||||
count += 1;
|
||||
} else {
|
||||
count -= 1;
|
||||
}
|
||||
self.monentsInfo.likeCount = [NSString stringWithFormat:@"%ld", count];
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
if ([self.monentsInfo.dynamicId isEqualToString:dynamicId]) {
|
||||
|
||||
|
||||
///type,0=点赞,1=删除,2=屏蔽,3=评论
|
||||
[[NSNotificationCenter defaultCenter]postNotificationName:@"kRefreshDynamicData" object:@{@"dynamicId":dynamicId,@"type":@"0",@"status":@(status)}];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)replyMonentsSuccess {
|
||||
[self.presenter getMonentsCommentList:self.monentsInfo.dynamicId timestamp:@"" status:0];
|
||||
[self.presenter getMonentsCommentList:self.monentsInfo.dynamicId timestamp:@"" status:0];
|
||||
///type,0=点赞,1=删除,2=屏蔽,3=评论
|
||||
[[NSNotificationCenter defaultCenter]postNotificationName:@"kRefreshDynamicData" object:@{@"dynamicId":self.monentsInfo.dynamicId,@"type":@"3"}];
|
||||
}
|
||||
|
||||
- (void)commonMonentsSuccess {
|
||||
[self.presenter getMonentsCommentList:self.monentsInfo.dynamicId timestamp:@"" status:0];
|
||||
[self.presenter getMonentsCommentList:self.monentsInfo.dynamicId timestamp:@"" status:0];
|
||||
///type,0=点赞,1=删除,2=屏蔽,3=评论
|
||||
[[NSNotificationCenter defaultCenter]postNotificationName:@"kRefreshDynamicData" object:@{@"dynamicId":self.monentsInfo.dynamicId,@"type":@"3"}];
|
||||
}
|
||||
-(void)requesstShieldingSuccess:(NSString *)monentsInfo{
|
||||
[self hideHUD];
|
||||
[self showSuccessToast:YMLocalizedString(@"XPMonentsMineViewController2")];
|
||||
///type,0=点赞,1=删除,2=屏蔽,3=评论
|
||||
[[NSNotificationCenter defaultCenter]postNotificationName:@"kRefreshDynamicData" object:@{@"dynamicId":monentsInfo,@"type":@"2"}];
|
||||
[self.navigationController popViewControllerAnimated:YES];
|
||||
|
||||
}
|
||||
|
||||
- (void)deleteMonentsSuccess:(NSString *)monentsInfo {
|
||||
[self showSuccessToast:YMLocalizedString(@"XPMonentsDetailViewController8")];
|
||||
[self.navigationController popViewControllerAnimated:YES];
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(xPMonentsDetailViewController:deleteMonents:)]) {
|
||||
[self.delegate xPMonentsDetailViewController:self deleteMonents:self.monentsInfo.dynamicId];
|
||||
}
|
||||
[self showSuccessToast:YMLocalizedString(@"XPMonentsDetailViewController8")];
|
||||
///type,0=点赞,1=删除,2=屏蔽,3=评论
|
||||
[[NSNotificationCenter defaultCenter]postNotificationName:@"kRefreshDynamicData" object:@{@"dynamicId":monentsInfo,@"type":@"1"}];
|
||||
[self.navigationController popViewControllerAnimated:YES];
|
||||
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
- (UITableView *)tableView {
|
||||
if (!_tableView) {
|
||||
_tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStyleGrouped];
|
||||
_tableView.delegate = self;
|
||||
_tableView.dataSource = self;
|
||||
_tableView.tableFooterView = [UIView new];
|
||||
_tableView.tableFooterView = [UIView new];
|
||||
_tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
|
||||
_tableView.backgroundColor = [UIColor clearColor];
|
||||
if (@available(iOS 11.0, *)) {
|
||||
_tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
|
||||
}
|
||||
[_tableView registerClass:[XPMonentsTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPMonentsTableViewCell class])];
|
||||
[_tableView registerClass:[XPMonentsCommentTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPMonentsCommentTableViewCell class])];
|
||||
[_tableView registerClass:[XPMonentsEmptyTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPMonentsEmptyTableViewCell class])];
|
||||
}
|
||||
return _tableView;
|
||||
if (!_tableView) {
|
||||
_tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStyleGrouped];
|
||||
_tableView.delegate = self;
|
||||
_tableView.dataSource = self;
|
||||
_tableView.tableFooterView = [UIView new];
|
||||
_tableView.tableFooterView = [UIView new];
|
||||
_tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
|
||||
_tableView.backgroundColor = [UIColor clearColor];
|
||||
if (@available(iOS 11.0, *)) {
|
||||
_tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
|
||||
}
|
||||
[_tableView registerClass:[XPMonentsTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPMonentsTableViewCell class])];
|
||||
[_tableView registerClass:[XPMonentsCommentTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPMonentsCommentTableViewCell class])];
|
||||
[_tableView registerClass:[XPMonentsEmptyTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPMonentsEmptyTableViewCell class])];
|
||||
}
|
||||
return _tableView;
|
||||
}
|
||||
|
||||
- (UIView *)sectionView {
|
||||
if (!_sectionView) {
|
||||
_sectionView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, 44)];
|
||||
_sectionView.backgroundColor = [UIColor clearColor];
|
||||
}
|
||||
return _sectionView;
|
||||
if (!_sectionView) {
|
||||
_sectionView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, 44)];
|
||||
_sectionView.backgroundColor = [UIColor clearColor];
|
||||
}
|
||||
return _sectionView;
|
||||
}
|
||||
|
||||
- (UILabel *)commentLabel {
|
||||
if (!_commentLabel) {
|
||||
_commentLabel = [[UILabel alloc] init];
|
||||
_commentLabel.font = [UIFont systemFontOfSize:14];
|
||||
_commentLabel.textColor = [DJDKMIMOMColor mainTextColor];
|
||||
}
|
||||
return _commentLabel;
|
||||
if (!_commentLabel) {
|
||||
_commentLabel = [[UILabel alloc] init];
|
||||
_commentLabel.font = [UIFont systemFontOfSize:14];
|
||||
_commentLabel.textColor = [DJDKMIMOMColor mainTextColor];
|
||||
}
|
||||
return _commentLabel;
|
||||
}
|
||||
|
||||
- (NSMutableArray *)datasource {
|
||||
if (!_datasource) {
|
||||
_datasource = [NSMutableArray array];
|
||||
}
|
||||
return _datasource;
|
||||
if (!_datasource) {
|
||||
_datasource = [NSMutableArray array];
|
||||
}
|
||||
return _datasource;
|
||||
}
|
||||
|
||||
@end
|
||||
|
@@ -1,8 +1,8 @@
|
||||
//
|
||||
// YMMonentsLatestViewController.m
|
||||
// YUMI
|
||||
// XPMonentsLatestViewController.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by YUMI on 2022/5/18.
|
||||
// Created by 冯硕 on 2022/5/18.
|
||||
//
|
||||
|
||||
#import "XPMonentsLatestViewController.h"
|
||||
@@ -10,12 +10,8 @@
|
||||
#import <Masonry/Masonry.h>
|
||||
#import <MJRefresh/MJRefresh.h>
|
||||
///Tool
|
||||
#import "DJDKMIMOMColor.h"
|
||||
#import "YUMIMacroUitls.h"
|
||||
#import "XPMonentsLayoutConfig.h"
|
||||
#import "TTPopup.h"
|
||||
#import "NSArray+Safe.h"
|
||||
#import "ClientConfig.h"
|
||||
///Model
|
||||
#import "MonentsListInfoModel.h"
|
||||
///P
|
||||
@@ -25,8 +21,7 @@
|
||||
#import "XPMonentsTableViewCell.h"
|
||||
#import "XPMonentsEmptyTableViewCell.h"
|
||||
#import "XPMonentsDetailViewController.h"
|
||||
#import "XPMomentsSimpleDetailViewController.h"
|
||||
|
||||
UIKIT_EXTERN NSString *kRequestRicket;
|
||||
@interface XPMonentsLatestViewController ()<UITableViewDelegate, UITableViewDataSource,XPMonentsLatestProtocol, XPMonentsTableViewCellDelegate,XPMonentsDetailViewControllerDelegate>
|
||||
///列表
|
||||
@property (nonatomic,strong) UITableView *tableView;
|
||||
@@ -42,248 +37,273 @@
|
||||
|
||||
@implementation XPMonentsLatestViewController
|
||||
|
||||
- (void)dealloc {
|
||||
NSLog(@"你阿宁");
|
||||
-(void)dealloc{
|
||||
[[NSNotificationCenter defaultCenter]removeObserver:self];
|
||||
}
|
||||
|
||||
- (BOOL)isHiddenNavBar {
|
||||
return YES;
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (__kindof id)createPresenter {
|
||||
return [[XPMonentsLatestPresenter alloc] init];
|
||||
return [[XPMonentsLatestPresenter alloc] init];
|
||||
}
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
[self initHeaderAndFooterRrfresh];
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
[super viewDidLoad];
|
||||
[self initHeaderAndFooterRrfresh];
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
}
|
||||
|
||||
#pragma mark - Private Method
|
||||
- (void)initSubViews {
|
||||
[self.view addSubview:self.tableView];
|
||||
[self.view addSubview:self.tableView];
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.mas_equalTo(self.view);
|
||||
}];
|
||||
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.mas_equalTo(self.view);
|
||||
}];
|
||||
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(requestRicketSuccess:) name:kRequestRicket object:nil];
|
||||
}
|
||||
-(void)requestRicketSuccess:(NSNotification *)not{
|
||||
if([not.object isKindOfClass:[NSDictionary class]])return;
|
||||
BOOL is = [not.object boolValue];
|
||||
if(is == YES){
|
||||
[self headerRefresh];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - 下拉刷新
|
||||
- (void)initHeaderAndFooterRrfresh {
|
||||
MJRefreshNormalHeader *header = [MJRefreshNormalHeader headerWithRefreshingTarget:self refreshingAction:@selector(headerRefresh)];
|
||||
header.stateLabel.font = [UIFont systemFontOfSize:10.0];
|
||||
header.lastUpdatedTimeLabel.font = [UIFont systemFontOfSize:10.0];
|
||||
header.stateLabel.textColor = [DJDKMIMOMColor secondTextColor];
|
||||
header.lastUpdatedTimeLabel.textColor = [DJDKMIMOMColor secondTextColor];
|
||||
self.tableView.mj_header = header;
|
||||
|
||||
MJRefreshBackNormalFooter *footer = [MJRefreshBackNormalFooter footerWithRefreshingTarget:self refreshingAction:@selector(footerRefresh)];
|
||||
footer.stateLabel.textColor = [DJDKMIMOMColor secondTextColor];
|
||||
footer.stateLabel.font = [UIFont systemFontOfSize:10.0];
|
||||
self.tableView.mj_footer = footer;
|
||||
|
||||
[self headerRefresh];
|
||||
MJRefreshNormalHeader *header = [MJRefreshNormalHeader headerWithRefreshingTarget:self refreshingAction:@selector(headerRefresh)];
|
||||
header.stateLabel.font = [UIFont systemFontOfSize:10.0];
|
||||
header.lastUpdatedTimeLabel.font = [UIFont systemFontOfSize:10.0];
|
||||
header.stateLabel.textColor = [DJDKMIMOMColor secondTextColor];
|
||||
header.lastUpdatedTimeLabel.textColor = [DJDKMIMOMColor secondTextColor];
|
||||
self.tableView.mj_header = header;
|
||||
|
||||
MJRefreshBackNormalFooter *footer = [MJRefreshBackNormalFooter footerWithRefreshingTarget:self refreshingAction:@selector(footerRefresh)];
|
||||
footer.stateLabel.textColor = [DJDKMIMOMColor secondTextColor];
|
||||
footer.stateLabel.font = [UIFont systemFontOfSize:10.0];
|
||||
self.tableView.mj_footer = footer;
|
||||
|
||||
[self headerRefresh];
|
||||
}
|
||||
|
||||
#pragma mark - 刷新的fangfa
|
||||
- (void)headerRefresh {
|
||||
self.page = 1;
|
||||
[self.presenter getMonentsLatestListPageSize:20 dynamicId:@"" state:0];
|
||||
if([AccountInfoStorage instance].isRequestRicket == YES){
|
||||
return;
|
||||
}
|
||||
self.page = 1;
|
||||
[self.presenter getMonentsLatestListPageSize:20 dynamicId:@"" state:0];
|
||||
}
|
||||
|
||||
- (void)footerRefresh {
|
||||
if (self.hasNoMoreData) {
|
||||
[self showErrorToast:YMLocalizedString(@"XPMonentsLatestViewController0")];
|
||||
[self.tableView.mj_footer endRefreshing];
|
||||
return;
|
||||
}
|
||||
self.page++;
|
||||
[self.presenter getMonentsLatestListPageSize:20 dynamicId:self.listInfo.nextDynamicId state:1];
|
||||
if([AccountInfoStorage instance].isRequestRicket == YES)return;
|
||||
if (self.hasNoMoreData) {
|
||||
[self showErrorToast:YMLocalizedString(@"XPMonentsLatestViewController0")];
|
||||
[self.tableView.mj_footer endRefreshing];
|
||||
return;
|
||||
}
|
||||
self.page++;
|
||||
[self.presenter getMonentsLatestListPageSize:20 dynamicId:self.listInfo.nextDynamicId state:1];
|
||||
}
|
||||
|
||||
#pragma mark - UITableViewDelegate And UITableViewDataSource
|
||||
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
||||
return self.datasource.count > 0 ? self.datasource.count : 1;
|
||||
return self.datasource.count > 0 ? self.datasource.count : 1;
|
||||
}
|
||||
|
||||
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
if (self.datasource.count > 0) {
|
||||
MonentsInfoModel * monentInfo= [self.datasource safeObjectAtIndex1:indexPath.row];
|
||||
[XPMonentsLayoutConfig layoutMonentsModel:monentInfo];
|
||||
return monentInfo.rowHeight;
|
||||
}
|
||||
return KScreenHeight - kNavigationHeight - 49 - kSafeAreaBottomHeight;
|
||||
if (self.datasource.count > 0) {
|
||||
MonentsInfoModel * monentInfo= [self.datasource safeObjectAtIndex1:indexPath.row];
|
||||
[XPMonentsLayoutConfig layoutMonentsModel:monentInfo];
|
||||
if(monentInfo.squareTop && monentInfo.content.length == 0){
|
||||
return monentInfo.rowHeight + 20 ;
|
||||
}else{
|
||||
return monentInfo.rowHeight;
|
||||
}
|
||||
|
||||
}
|
||||
return KScreenHeight - kNavigationHeight - 49 - kSafeAreaBottomHeight;
|
||||
}
|
||||
|
||||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
if (self.datasource.count > 0) {
|
||||
XPMonentsTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMonentsTableViewCell class])];
|
||||
MonentsInfoModel * monentsInfo = [self.datasource safeObjectAtIndex1:indexPath.row];
|
||||
cell.monentsInfo = monentsInfo;
|
||||
cell.delegate = self;
|
||||
return cell;
|
||||
}
|
||||
XPMonentsEmptyTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMonentsEmptyTableViewCell class])];
|
||||
return cell;
|
||||
if (self.datasource.count > 0) {
|
||||
XPMonentsTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMonentsTableViewCell class])];
|
||||
MonentsInfoModel * monentsInfo = [self.datasource safeObjectAtIndex1:indexPath.row];
|
||||
cell.monentsInfo = monentsInfo;
|
||||
cell.delegate = self;
|
||||
return cell;
|
||||
}
|
||||
XPMonentsEmptyTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMonentsEmptyTableViewCell class])];
|
||||
return cell;
|
||||
}
|
||||
|
||||
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
[tableView deselectRowAtIndexPath:indexPath animated:YES];
|
||||
if (self.datasource.count > 0) {
|
||||
MonentsInfoModel * monentsInfo = [self.datasource safeObjectAtIndex1:indexPath.row];
|
||||
|
||||
if ([ClientConfig shareConfig].canOpen) {
|
||||
XPMonentsDetailViewController * detailVC = [[XPMonentsDetailViewController alloc] init];
|
||||
detailVC.monentsInfo = monentsInfo;
|
||||
detailVC.delegate = self;
|
||||
[self.navigationController pushViewController:detailVC animated:YES];
|
||||
}else{
|
||||
XPMomentsSimpleDetailViewController * detailVC = [[XPMomentsSimpleDetailViewController alloc] init];
|
||||
detailVC.monentsInfo = monentsInfo;
|
||||
detailVC.delegate = self;
|
||||
[self.navigationController pushViewController:detailVC animated:YES];
|
||||
}
|
||||
}
|
||||
[tableView deselectRowAtIndexPath:indexPath animated:YES];
|
||||
if (self.datasource.count > 0) {
|
||||
XPMonentsDetailViewController * detailVC = [[XPMonentsDetailViewController alloc] init];
|
||||
MonentsInfoModel * monentsInfo = [self.datasource safeObjectAtIndex1:indexPath.row];
|
||||
detailVC.monentsInfo = monentsInfo;
|
||||
detailVC.delegate = self;
|
||||
[self.navigationController pushViewController:detailVC animated:YES];
|
||||
}
|
||||
}
|
||||
#pragma mark - XPMonentsDetailViewControllerDelegate
|
||||
- (void)xPMonentsDetailViewController:(XPMonentsDetailViewController *)view deleteMonents:(NSString *)dynamicId {
|
||||
__block MonentsInfoModel * deleteInfo;
|
||||
[self.datasource enumerateObjectsUsingBlock:^(MonentsInfoModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
if (obj.dynamicId.integerValue == dynamicId.integerValue) {
|
||||
deleteInfo = obj;
|
||||
}
|
||||
}];
|
||||
|
||||
if (deleteInfo) {
|
||||
[self.datasource removeObject:deleteInfo];
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
__block MonentsInfoModel * deleteInfo;
|
||||
[self.datasource enumerateObjectsUsingBlock:^(MonentsInfoModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
if (obj.dynamicId.integerValue == dynamicId.integerValue) {
|
||||
deleteInfo = obj;
|
||||
}
|
||||
}];
|
||||
|
||||
if (deleteInfo) {
|
||||
[self.datasource removeObject:deleteInfo];
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - XPMonentsTableViewCellDelegate
|
||||
- (void)xPMonentsTableViewCell:(XPMonentsTableViewCell *)view didClicShielding:(MonentsInfoModel *)monentsInfo{
|
||||
[self showLoading];
|
||||
[self.presenter requesstShieldingWtihType:@"0" objId:monentsInfo.dynamicId];
|
||||
}
|
||||
- (void)xPMonentsTableViewCell:(XPMonentsTableViewCell *)view didClickLike:(MonentsInfoModel *)monentsInfo {
|
||||
[self.presenter likeMonent:monentsInfo.dynamicId status:!monentsInfo.isLike likedUid:monentsInfo.uid worldId:[NSString stringWithFormat:@"%ld", monentsInfo.worldId]];
|
||||
[self.presenter likeMonent:monentsInfo.dynamicId status:!monentsInfo.isLike likedUid:monentsInfo.uid worldId:[NSString stringWithFormat:@"%ld", monentsInfo.worldId]];
|
||||
}
|
||||
|
||||
- (void)xPMonentsTableViewCell:(XPMonentsTableViewCell *)view didClicDelete:(MonentsInfoModel *)monentsInfo {
|
||||
[TTPopup alertWithMessage:YMLocalizedString(@"XPMonentsLatestViewController1") confirmHandler:^{
|
||||
[self.presenter deleteMonents:monentsInfo.dynamicId worldId:[NSString stringWithFormat:@"%ld", monentsInfo.worldId]];
|
||||
} cancelHandler:^{
|
||||
|
||||
}];
|
||||
[TTPopup alertWithMessage:YMLocalizedString(@"XPMonentsLatestViewController1") confirmHandler:^{
|
||||
[self.presenter deleteMonents:monentsInfo.dynamicId worldId:[NSString stringWithFormat:@"%ld", monentsInfo.worldId]];
|
||||
} cancelHandler:^{
|
||||
|
||||
}];
|
||||
}
|
||||
|
||||
- (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];
|
||||
}
|
||||
__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;
|
||||
return self.view;
|
||||
}
|
||||
|
||||
#pragma mark - XPMonentsLatestProtocol
|
||||
- (void)getMonentsLatestListSuccess:(MonentsListInfoModel *)listInfo state:(int)state{
|
||||
self.listInfo = listInfo;
|
||||
if (state == 0) {
|
||||
[self.datasource removeAllObjects];
|
||||
}
|
||||
if (listInfo.dynamicList.count > 0) {
|
||||
[self.datasource addObjectsFromArray:listInfo.dynamicList];
|
||||
}
|
||||
|
||||
if (state == 0) {
|
||||
self.hasNoMoreData = NO;
|
||||
[self.tableView.mj_header endRefreshing];
|
||||
} else {
|
||||
if (listInfo.dynamicList.count > 0) {
|
||||
self.hasNoMoreData = NO;
|
||||
} else {
|
||||
self.hasNoMoreData = YES;
|
||||
}
|
||||
[self.tableView.mj_footer endRefreshing];
|
||||
}
|
||||
[self.tableView reloadData];
|
||||
self.listInfo = listInfo;
|
||||
if (state == 0) {
|
||||
[self.datasource removeAllObjects];
|
||||
}
|
||||
if (listInfo.dynamicList.count > 0) {
|
||||
[self.datasource addObjectsFromArray:listInfo.dynamicList];
|
||||
}
|
||||
|
||||
if (state == 0) {
|
||||
self.hasNoMoreData = NO;
|
||||
[self.tableView.mj_header endRefreshing];
|
||||
} else {
|
||||
if (listInfo.dynamicList.count > 0) {
|
||||
self.hasNoMoreData = NO;
|
||||
} else {
|
||||
self.hasNoMoreData = YES;
|
||||
}
|
||||
[self.tableView.mj_footer endRefreshing];
|
||||
}
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
|
||||
- (void)getMonentsLatestListFail:(NSString *)msg state:(int)state {
|
||||
if (state == 0) {
|
||||
[self.tableView.mj_header endRefreshing];
|
||||
} else {
|
||||
[self.tableView.mj_footer endRefreshing];
|
||||
}
|
||||
if (state == 0) {
|
||||
[self.tableView.mj_header endRefreshing];
|
||||
} else {
|
||||
[self.tableView.mj_footer endRefreshing];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)likeMonentsSuccess:(NSString *)dynamicId status:(BOOL)status {
|
||||
[self.datasource enumerateObjectsUsingBlock:^(MonentsInfoModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
if ([obj.dynamicId isEqualToString:dynamicId]) {
|
||||
NSInteger count = obj.likeCount.integerValue;
|
||||
obj.isLike = status;
|
||||
if (status) {
|
||||
count += 1;
|
||||
} else {
|
||||
count -= 1;
|
||||
}
|
||||
obj.likeCount = [NSString stringWithFormat:@"%ld", count];
|
||||
*stop = YES;
|
||||
}
|
||||
}];
|
||||
[self.tableView reloadData];
|
||||
[self.datasource enumerateObjectsUsingBlock:^(MonentsInfoModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
if ([obj.dynamicId isEqualToString:dynamicId]) {
|
||||
NSInteger count = obj.likeCount.integerValue;
|
||||
obj.isLike = status;
|
||||
if (status) {
|
||||
count += 1;
|
||||
} else {
|
||||
count -= 1;
|
||||
}
|
||||
obj.likeCount = [NSString stringWithFormat:@"%ld", count];
|
||||
*stop = YES;
|
||||
}
|
||||
}];
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
-(void)requesstShieldingSuccess:(NSString *)monentsInfo{
|
||||
[self hideHUD];
|
||||
[self showSuccessToast:YMLocalizedString(@"XPMonentsMineViewController2")];
|
||||
__block MonentsInfoModel * deleteInfo;
|
||||
[self.datasource enumerateObjectsUsingBlock:^(MonentsInfoModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
if (obj.dynamicId.integerValue == monentsInfo.integerValue) {
|
||||
deleteInfo = obj;
|
||||
}
|
||||
}];
|
||||
|
||||
if (deleteInfo) {
|
||||
[self.datasource removeObject:deleteInfo];
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)deleteMonentsSuccess:(NSString *)monentsInfo {
|
||||
[self showSuccessToast:YMLocalizedString(@"XPMonentsLatestViewController2")];
|
||||
__block MonentsInfoModel * deleteInfo;
|
||||
[self.datasource enumerateObjectsUsingBlock:^(MonentsInfoModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
if (obj.dynamicId.integerValue == monentsInfo.integerValue) {
|
||||
deleteInfo = obj;
|
||||
}
|
||||
}];
|
||||
|
||||
if (deleteInfo) {
|
||||
[self.datasource removeObject:deleteInfo];
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
[self showSuccessToast:YMLocalizedString(@"XPMonentsLatestViewController2")];
|
||||
__block MonentsInfoModel * deleteInfo;
|
||||
[self.datasource enumerateObjectsUsingBlock:^(MonentsInfoModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
if (obj.dynamicId.integerValue == monentsInfo.integerValue) {
|
||||
deleteInfo = obj;
|
||||
}
|
||||
}];
|
||||
|
||||
if (deleteInfo) {
|
||||
[self.datasource removeObject:deleteInfo];
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
- (UITableView *)tableView {
|
||||
if (!_tableView) {
|
||||
_tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
|
||||
_tableView.delegate = self;
|
||||
_tableView.dataSource = self;
|
||||
_tableView.contentInset = UIEdgeInsetsMake(0, 0, 100, 0);
|
||||
_tableView.tableFooterView = [UIView new];
|
||||
_tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
|
||||
_tableView.backgroundColor = [UIColor clearColor];
|
||||
if (@available(iOS 11.0, *)) {
|
||||
_tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
|
||||
}
|
||||
[_tableView registerClass:[XPMonentsTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPMonentsTableViewCell class])];
|
||||
[_tableView registerClass:[XPMonentsEmptyTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPMonentsEmptyTableViewCell class])];
|
||||
}
|
||||
return _tableView;
|
||||
if (!_tableView) {
|
||||
_tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
|
||||
_tableView.delegate = self;
|
||||
_tableView.dataSource = self;
|
||||
_tableView.tableFooterView = [UIView new];
|
||||
_tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
|
||||
_tableView.backgroundColor = [UIColor clearColor];
|
||||
if (@available(iOS 11.0, *)) {
|
||||
_tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
|
||||
}
|
||||
[_tableView registerClass:[XPMonentsTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPMonentsTableViewCell class])];
|
||||
[_tableView registerClass:[XPMonentsEmptyTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPMonentsEmptyTableViewCell class])];
|
||||
}
|
||||
return _tableView;
|
||||
}
|
||||
|
||||
|
||||
- (NSMutableArray<MonentsInfoModel *> *)datasource {
|
||||
if (!_datasource) {
|
||||
_datasource = [NSMutableArray array];
|
||||
}
|
||||
return _datasource;
|
||||
if (!_datasource) {
|
||||
_datasource = [NSMutableArray array];
|
||||
}
|
||||
return _datasource;
|
||||
}
|
||||
@end
|
||||
|
@@ -1,8 +1,8 @@
|
||||
//
|
||||
// YMMonentsRecommendViewController.m
|
||||
// YUMI
|
||||
// XPMonentsRecommendViewController.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by YUMI on 2022/5/11.
|
||||
// Created by 冯硕 on 2022/5/11.
|
||||
//
|
||||
|
||||
#import "XPMonentsRecommendViewController.h"
|
||||
@@ -10,12 +10,10 @@
|
||||
#import <Masonry/Masonry.h>
|
||||
#import <MJRefresh/MJRefresh.h>
|
||||
///Tool
|
||||
#import "DJDKMIMOMColor.h"
|
||||
#import "YUMIMacroUitls.h"
|
||||
|
||||
|
||||
#import "XPMonentsLayoutConfig.h"
|
||||
#import "TTPopup.h"
|
||||
#import "NSArray+Safe.h"
|
||||
#import "ClientConfig.h"
|
||||
///Model
|
||||
#import "MonentsInfoModel.h"
|
||||
#import "MonentsTopicModel.h"
|
||||
@@ -27,11 +25,11 @@
|
||||
#import "XPMonentsEmptyTableViewCell.h"
|
||||
#import "XPMonentsRecommendHeaderView.h"
|
||||
#import "XPMonentsDetailViewController.h"
|
||||
#import "XPMomentsSimpleDetailViewController.h"
|
||||
#import "XPMonentTopicContainerViewController.h"
|
||||
#import "XPMoentsTopicListViewController.h"
|
||||
|
||||
@interface XPMonentsRecommendViewController ()<UITableViewDelegate, UITableViewDataSource,XPMonentsRecommendProtocol, XPMonentsTableViewCellDelegate,XPMonentsRecommendHeaderViewDelegate, XPMonentsDetailViewControllerDelegate>
|
||||
UIKIT_EXTERN NSString *kRequestRicket;
|
||||
@interface XPMonentsRecommendViewController ()<UIGestureRecognizerDelegate,UITableViewDelegate, UITableViewDataSource,XPMonentsRecommendProtocol, XPMonentsTableViewCellDelegate,XPMonentsRecommendHeaderViewDelegate, XPMonentsDetailViewControllerDelegate>
|
||||
///列表
|
||||
@property (nonatomic,strong) UITableView *tableView;
|
||||
///数据源
|
||||
@@ -45,268 +43,303 @@
|
||||
@end
|
||||
|
||||
@implementation XPMonentsRecommendViewController
|
||||
|
||||
-(void)dealloc{
|
||||
[[NSNotificationCenter defaultCenter]removeObserver:self];
|
||||
}
|
||||
- (BOOL)isHiddenNavBar {
|
||||
return YES;
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (__kindof id)createPresenter {
|
||||
return [[XPMonentsRecommendPresenter alloc] init];
|
||||
return [[XPMonentsRecommendPresenter alloc] init];
|
||||
}
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
[self initHeaderAndFooterRrfresh];
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
[self initHeaderAndFooterRrfresh];
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
}
|
||||
|
||||
#pragma mark - Private Method
|
||||
- (void)initSubViews {
|
||||
[self.view addSubview:self.tableView];
|
||||
self.tableView.tableHeaderView = self.headerView;
|
||||
[self.view addSubview:self.tableView];
|
||||
self.tableView.contentInset = UIEdgeInsetsMake(0, 0, 100, 0);
|
||||
self.tableView.tableHeaderView = self.headerView;
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.mas_equalTo(self.view);
|
||||
}];
|
||||
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.mas_equalTo(self.view);
|
||||
}];
|
||||
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(requestRicketSuccess:) name:kRequestRicket object:nil];
|
||||
|
||||
}
|
||||
-(void)requestRicketSuccess:(NSNotification *)not{
|
||||
if([not.object isKindOfClass:[NSDictionary class]])return;
|
||||
BOOL is = [not.object boolValue];
|
||||
if(is == YES){
|
||||
[self headerRefresh];
|
||||
}else{
|
||||
[XNDJTDDLoadingTool hideOnlyView:self.tabBarController.view];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - 下拉刷新
|
||||
- (void)initHeaderAndFooterRrfresh {
|
||||
MJRefreshNormalHeader *header = [MJRefreshNormalHeader headerWithRefreshingTarget:self refreshingAction:@selector(headerRefresh)];
|
||||
header.stateLabel.font = [UIFont systemFontOfSize:10.0];
|
||||
header.lastUpdatedTimeLabel.font = [UIFont systemFontOfSize:10.0];
|
||||
header.stateLabel.textColor = [DJDKMIMOMColor secondTextColor];
|
||||
header.lastUpdatedTimeLabel.textColor = [DJDKMIMOMColor secondTextColor];
|
||||
self.tableView.mj_header = header;
|
||||
|
||||
MJRefreshBackNormalFooter *footer = [MJRefreshBackNormalFooter footerWithRefreshingTarget:self refreshingAction:@selector(footerRefresh)];
|
||||
footer.stateLabel.textColor = [DJDKMIMOMColor secondTextColor];
|
||||
footer.stateLabel.font = [UIFont systemFontOfSize:10.0];
|
||||
self.tableView.mj_footer = footer;
|
||||
|
||||
[self headerRefresh];
|
||||
MJRefreshNormalHeader *header = [MJRefreshNormalHeader headerWithRefreshingTarget:self refreshingAction:@selector(headerRefresh)];
|
||||
header.stateLabel.font = [UIFont systemFontOfSize:10.0];
|
||||
header.lastUpdatedTimeLabel.font = [UIFont systemFontOfSize:10.0];
|
||||
header.stateLabel.textColor = [DJDKMIMOMColor secondTextColor];
|
||||
header.lastUpdatedTimeLabel.textColor = [DJDKMIMOMColor secondTextColor];
|
||||
self.tableView.mj_header = header;
|
||||
|
||||
MJRefreshBackNormalFooter *footer = [MJRefreshBackNormalFooter footerWithRefreshingTarget:self refreshingAction:@selector(footerRefresh)];
|
||||
footer.stateLabel.textColor = [DJDKMIMOMColor secondTextColor];
|
||||
footer.stateLabel.font = [UIFont systemFontOfSize:10.0];
|
||||
self.tableView.mj_footer = footer;
|
||||
|
||||
[self headerRefresh];
|
||||
}
|
||||
|
||||
#pragma mark - 刷新的fangfa
|
||||
- (void)headerRefresh {
|
||||
self.page = 1;
|
||||
[self.presenter getMonentsRecommendList:self.page pageSize:20 state:0];
|
||||
[self.presenter getMonentsTopicList:self.page pageSize:20];
|
||||
[XNDJTDDLoadingTool showOnlyView:self.tabBarController.view];
|
||||
if([AccountInfoStorage instance].isRequestRicket == YES){
|
||||
return;
|
||||
}
|
||||
self.page = 1;
|
||||
[self.presenter getMonentsRecommendList:self.page pageSize:20 state:0];
|
||||
[self.presenter getMonentsTopicList:self.page pageSize:20];
|
||||
}
|
||||
|
||||
- (void)footerRefresh {
|
||||
if (self.hasNoMoreData) {
|
||||
[self showErrorToast:YMLocalizedString(@"XPMonentsRecommendViewController0")];
|
||||
[self.tableView.mj_footer endRefreshing];
|
||||
return;
|
||||
}
|
||||
self.page++;
|
||||
[self.presenter getMonentsRecommendList:self.page pageSize:20 state:1];
|
||||
if([AccountInfoStorage instance].isRequestRicket == YES)return;
|
||||
if (self.hasNoMoreData) {
|
||||
[self showErrorToast:YMLocalizedString(@"XPMonentsRecommendViewController0")];
|
||||
[self.tableView.mj_footer endRefreshing];
|
||||
return;
|
||||
}
|
||||
self.page++;
|
||||
[self.presenter getMonentsRecommendList:self.page pageSize:20 state:1];
|
||||
}
|
||||
|
||||
#pragma mark - UITableViewDelegate And UITableViewDataSource
|
||||
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
||||
return self.datasource.count > 0 ? self.datasource.count : 1;
|
||||
return self.datasource.count > 0 ? self.datasource.count : 1;
|
||||
}
|
||||
|
||||
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
if (self.datasource.count > 0) {
|
||||
MonentsInfoModel * monentInfo= [self.datasource safeObjectAtIndex1:indexPath.row];
|
||||
[XPMonentsLayoutConfig layoutMonentsModel:monentInfo];
|
||||
return monentInfo.rowHeight;
|
||||
}
|
||||
return KScreenHeight - kNavigationHeight - 49 - kSafeAreaBottomHeight;
|
||||
if (self.datasource.count > 0) {
|
||||
MonentsInfoModel * monentInfo= [self.datasource safeObjectAtIndex1:indexPath.row];
|
||||
[XPMonentsLayoutConfig layoutMonentsModel:monentInfo];
|
||||
|
||||
if(monentInfo.squareTop && monentInfo.content.length == 0){
|
||||
return monentInfo.rowHeight + 20 ;
|
||||
}else{
|
||||
return monentInfo.rowHeight;
|
||||
}
|
||||
|
||||
}
|
||||
return KScreenHeight - kNavigationHeight - 49 - kSafeAreaBottomHeight;
|
||||
}
|
||||
|
||||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
if (self.datasource.count > 0) {
|
||||
XPMonentsTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMonentsTableViewCell class])];
|
||||
MonentsInfoModel * monentsInfo = [self.datasource safeObjectAtIndex1:indexPath.row];
|
||||
cell.monentsInfo = monentsInfo;
|
||||
cell.delegate = self;
|
||||
return cell;
|
||||
}
|
||||
XPMonentsEmptyTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMonentsEmptyTableViewCell class])];
|
||||
return cell;
|
||||
if (self.datasource.count > 0) {
|
||||
XPMonentsTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMonentsTableViewCell class])];
|
||||
MonentsInfoModel * monentsInfo = [self.datasource safeObjectAtIndex1:indexPath.row];
|
||||
cell.monentsInfo = monentsInfo;
|
||||
cell.delegate = self;
|
||||
return cell;
|
||||
}
|
||||
XPMonentsEmptyTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMonentsEmptyTableViewCell class])];
|
||||
return cell;
|
||||
}
|
||||
|
||||
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
[tableView deselectRowAtIndexPath:indexPath animated:YES];
|
||||
if (self.datasource.count > 0) {
|
||||
|
||||
MonentsInfoModel * monentsInfo = [self.datasource safeObjectAtIndex1:indexPath.row];
|
||||
|
||||
if ([ClientConfig shareConfig].canOpen) {
|
||||
XPMonentsDetailViewController * detailVC = [[XPMonentsDetailViewController alloc] init];
|
||||
detailVC.monentsInfo = monentsInfo;
|
||||
detailVC.delegate = self;
|
||||
[self.navigationController pushViewController:detailVC animated:YES];
|
||||
}else{
|
||||
XPMomentsSimpleDetailViewController * detailVC = [[XPMomentsSimpleDetailViewController alloc] init];
|
||||
detailVC.monentsInfo = monentsInfo;
|
||||
detailVC.delegate = self;
|
||||
[self.navigationController pushViewController:detailVC animated:YES];
|
||||
}
|
||||
}
|
||||
[tableView deselectRowAtIndexPath:indexPath animated:YES];
|
||||
if (self.datasource.count > 0) {
|
||||
XPMonentsDetailViewController * detailVC = [[XPMonentsDetailViewController alloc] init];
|
||||
MonentsInfoModel * monentsInfo = [self.datasource safeObjectAtIndex1:indexPath.row];
|
||||
detailVC.monentsInfo = monentsInfo;
|
||||
detailVC.delegate = self;
|
||||
[self.navigationController pushViewController:detailVC animated:YES];
|
||||
}
|
||||
}
|
||||
#pragma mark - XPMonentsDetailViewControllerDelegate
|
||||
- (void)xPMonentsDetailViewController:(XPMonentsDetailViewController *)view deleteMonents:(NSString *)dynamicId {
|
||||
__block MonentsInfoModel * deleteInfo;
|
||||
[self.datasource enumerateObjectsUsingBlock:^(MonentsInfoModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
if (obj.dynamicId.integerValue == dynamicId.integerValue) {
|
||||
deleteInfo = obj;
|
||||
}
|
||||
}];
|
||||
|
||||
if (deleteInfo) {
|
||||
[self.datasource removeObject:deleteInfo];
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
__block MonentsInfoModel * deleteInfo;
|
||||
[self.datasource enumerateObjectsUsingBlock:^(MonentsInfoModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
if (obj.dynamicId.integerValue == dynamicId.integerValue) {
|
||||
deleteInfo = obj;
|
||||
}
|
||||
}];
|
||||
|
||||
if (deleteInfo) {
|
||||
[self.datasource removeObject:deleteInfo];
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - XPMonentsTableViewCellDelegate
|
||||
|
||||
- (void)xPMonentsTableViewCell:(XPMonentsTableViewCell *)view didClicShielding:(MonentsInfoModel *)monentsInfo{
|
||||
[self showLoading];
|
||||
[self.presenter requesstShieldingWtihType:@"0" objId:monentsInfo.dynamicId];
|
||||
}
|
||||
- (void)xPMonentsTableViewCell:(XPMonentsTableViewCell *)view didClickLike:(MonentsInfoModel *)monentsInfo {
|
||||
[self.presenter likeMonent:monentsInfo.dynamicId status:!monentsInfo.isLike likedUid:monentsInfo.uid worldId:[NSString stringWithFormat:@"%ld", monentsInfo.worldId]];
|
||||
[self.presenter likeMonent:monentsInfo.dynamicId status:!monentsInfo.isLike likedUid:monentsInfo.uid worldId:[NSString stringWithFormat:@"%ld", monentsInfo.worldId]];
|
||||
}
|
||||
|
||||
- (void)xPMonentsTableViewCell:(XPMonentsTableViewCell *)view didClicDelete:(MonentsInfoModel *)monentsInfo {
|
||||
[TTPopup alertWithMessage:YMLocalizedString(@"XPMonentsTopicLatestViewController1") confirmHandler:^{
|
||||
[self.presenter deleteMonents:monentsInfo.dynamicId worldId:[NSString stringWithFormat:@"%ld", monentsInfo.worldId]];
|
||||
} cancelHandler:^{
|
||||
|
||||
}];
|
||||
[TTPopup alertWithMessage:YMLocalizedString(@"XPMonentsRecommendViewController1") confirmHandler:^{
|
||||
[self.presenter deleteMonents:monentsInfo.dynamicId worldId:[NSString stringWithFormat:@"%ld", monentsInfo.worldId]];
|
||||
} cancelHandler:^{
|
||||
|
||||
}];
|
||||
}
|
||||
|
||||
- (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];
|
||||
}
|
||||
__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];
|
||||
topicVC.worldId = info.tId;
|
||||
[self.navigationController pushViewController:topicVC animated:YES];
|
||||
XPMonentTopicContainerViewController * topicVC = [[XPMonentTopicContainerViewController alloc] init];
|
||||
topicVC.worldId = info.tId;
|
||||
[self.navigationController pushViewController:topicVC animated:YES];
|
||||
}
|
||||
|
||||
- (void)xPMonentsRecommendHeaderView:(XPMonentsRecommendHeaderView *)view didClickMoreTopic:(UIButton *)sender {
|
||||
XPMoentsTopicListViewController * topicListVC = [[XPMoentsTopicListViewController alloc] init];
|
||||
[self.navigationController pushViewController:topicListVC animated:YES];
|
||||
XPMoentsTopicListViewController * topicListVC = [[XPMoentsTopicListViewController alloc] init];
|
||||
[self.navigationController pushViewController:topicListVC animated:YES];
|
||||
}
|
||||
|
||||
#pragma mark -JXCategoryListContainerViewDelegate
|
||||
- (UIView *)listView {
|
||||
return self.view;
|
||||
return self.view;
|
||||
}
|
||||
|
||||
#pragma mark - XPMonentsRecommendProtocol
|
||||
- (void)getMonentsRecommendListSuccess:(NSArray *)array state:(int)state {
|
||||
if (state == 0) {
|
||||
[self.datasource removeAllObjects];
|
||||
}
|
||||
if (array.count > 0) {
|
||||
[self.datasource addObjectsFromArray:array];
|
||||
}
|
||||
|
||||
if (state == 0) {
|
||||
self.hasNoMoreData = NO;
|
||||
[self.tableView.mj_header endRefreshing];
|
||||
} else {
|
||||
if (array.count > 0) {
|
||||
self.hasNoMoreData = NO;
|
||||
} else {
|
||||
self.hasNoMoreData = YES;
|
||||
}
|
||||
[self.tableView.mj_footer endRefreshing];
|
||||
}
|
||||
[self.tableView reloadData];
|
||||
if (state == 0) {
|
||||
[self.datasource removeAllObjects];
|
||||
}
|
||||
if (array.count > 0) {
|
||||
[self.datasource addObjectsFromArray:array];
|
||||
}
|
||||
|
||||
if (state == 0) {
|
||||
self.hasNoMoreData = NO;
|
||||
[self.tableView.mj_header endRefreshing];
|
||||
} else {
|
||||
if (array.count > 0) {
|
||||
self.hasNoMoreData = NO;
|
||||
} else {
|
||||
self.hasNoMoreData = YES;
|
||||
}
|
||||
[self.tableView.mj_footer endRefreshing];
|
||||
}
|
||||
[XNDJTDDLoadingTool hideOnlyView:self.tabBarController.view];
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
|
||||
- (void)getMonentsRecommendListFail:(NSString *)msg state:(int)state {
|
||||
if (state == 0) {
|
||||
[self.tableView.mj_header endRefreshing];
|
||||
} else {
|
||||
[self.tableView.mj_footer endRefreshing];
|
||||
}
|
||||
[XNDJTDDLoadingTool hideOnlyView:self.tabBarController.view];
|
||||
if (state == 0) {
|
||||
[self.tableView.mj_header endRefreshing];
|
||||
} else {
|
||||
[self.tableView.mj_footer endRefreshing];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)monentsTopicListSuccess:(NSArray *)array {
|
||||
self.headerView.topicList = array;
|
||||
self.headerView.topicList = array;
|
||||
}
|
||||
|
||||
- (void)likeMonentsSuccess:(NSString *)dynamicId status:(BOOL)status {
|
||||
[self.datasource enumerateObjectsUsingBlock:^(MonentsInfoModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
if ([obj.dynamicId isEqualToString:dynamicId]) {
|
||||
if (status) {
|
||||
obj.isLike += 1;
|
||||
} else {
|
||||
obj.isLike -= 1;
|
||||
}
|
||||
*stop = YES;
|
||||
}
|
||||
}];
|
||||
[self.tableView reloadData];
|
||||
[self.datasource enumerateObjectsUsingBlock:^(MonentsInfoModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
if ([obj.dynamicId isEqualToString:dynamicId]) {
|
||||
if (status) {
|
||||
obj.isLike += 1;
|
||||
} else {
|
||||
obj.isLike -= 1;
|
||||
}
|
||||
*stop = YES;
|
||||
}
|
||||
}];
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
-(void)requesstShieldingSuccess:(NSString *)monentsInfo{
|
||||
[self hideHUD];
|
||||
[self showSuccessToast:YMLocalizedString(@"XPMonentsMineViewController2")];
|
||||
__block MonentsInfoModel * deleteInfo;
|
||||
[self.datasource enumerateObjectsUsingBlock:^(MonentsInfoModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
if (obj.dynamicId.integerValue == monentsInfo.integerValue) {
|
||||
deleteInfo = obj;
|
||||
}
|
||||
}];
|
||||
if (deleteInfo) {
|
||||
[self.datasource removeObject:deleteInfo];
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)deleteMonentsSuccess:(NSString *)monentsInfo {
|
||||
[self showSuccessToast:YMLocalizedString(@"XPMonentsRecommendViewController2")];
|
||||
__block MonentsInfoModel * deleteInfo;
|
||||
[self.datasource enumerateObjectsUsingBlock:^(MonentsInfoModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
if (obj.dynamicId.integerValue == monentsInfo.integerValue) {
|
||||
deleteInfo = obj;
|
||||
}
|
||||
}];
|
||||
if (deleteInfo) {
|
||||
[self.datasource removeObject:deleteInfo];
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
[self showSuccessToast:YMLocalizedString(@"XPMonentsRecommendViewController2")];
|
||||
__block MonentsInfoModel * deleteInfo;
|
||||
[self.datasource enumerateObjectsUsingBlock:^(MonentsInfoModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
if (obj.dynamicId.integerValue == monentsInfo.integerValue) {
|
||||
deleteInfo = obj;
|
||||
}
|
||||
}];
|
||||
if (deleteInfo) {
|
||||
[self.datasource removeObject:deleteInfo];
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
- (UITableView *)tableView {
|
||||
if (!_tableView) {
|
||||
_tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
|
||||
_tableView.delegate = self;
|
||||
_tableView.dataSource = self;
|
||||
_tableView.contentInset = UIEdgeInsetsMake(0, 0, 100, 0);
|
||||
_tableView.tableFooterView = [UIView new];
|
||||
_tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
|
||||
_tableView.backgroundColor = [UIColor clearColor];
|
||||
if (@available(iOS 11.0, *)) {
|
||||
_tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
|
||||
}
|
||||
[_tableView registerClass:[XPMonentsTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPMonentsTableViewCell class])];
|
||||
[_tableView registerClass:[XPMonentsEmptyTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPMonentsEmptyTableViewCell class])];
|
||||
}
|
||||
return _tableView;
|
||||
if (!_tableView) {
|
||||
_tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
|
||||
_tableView.delegate = self;
|
||||
_tableView.dataSource = self;
|
||||
_tableView.tableFooterView = [UIView new];
|
||||
_tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
|
||||
_tableView.backgroundColor = [UIColor clearColor];
|
||||
if (@available(iOS 11.0, *)) {
|
||||
_tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
|
||||
}
|
||||
[_tableView registerClass:[XPMonentsTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPMonentsTableViewCell class])];
|
||||
[_tableView registerClass:[XPMonentsEmptyTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPMonentsEmptyTableViewCell class])];
|
||||
}
|
||||
return _tableView;
|
||||
}
|
||||
|
||||
|
||||
- (NSMutableArray<MonentsInfoModel *> *)datasource {
|
||||
if (!_datasource) {
|
||||
_datasource = [NSMutableArray array];
|
||||
}
|
||||
return _datasource;
|
||||
if (!_datasource) {
|
||||
_datasource = [NSMutableArray array];
|
||||
}
|
||||
return _datasource;
|
||||
}
|
||||
|
||||
- (XPMonentsRecommendHeaderView *)headerView {
|
||||
if (!_headerView) {
|
||||
_headerView = [[XPMonentsRecommendHeaderView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, 110)];
|
||||
_headerView.delegate = self;
|
||||
}
|
||||
return _headerView;
|
||||
if (!_headerView) {
|
||||
_headerView = [[XPMonentsRecommendHeaderView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, 145)];
|
||||
_headerView.delegate = self;
|
||||
}
|
||||
return _headerView;
|
||||
}
|
||||
|
||||
@end
|
||||
|
@@ -1,8 +1,8 @@
|
||||
//
|
||||
// YMMonentsTopicLatestViewController.m
|
||||
// YUMI
|
||||
// XPMonentsTopicLatestViewController.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by YUMI on 2022/8/18.
|
||||
// Created by 冯硕 on 2022/8/18.
|
||||
//
|
||||
|
||||
#import "XPMonentsTopicLatestViewController.h"
|
||||
@@ -10,12 +10,9 @@
|
||||
#import <Masonry/Masonry.h>
|
||||
#import <MJRefresh/MJRefresh.h>
|
||||
///Tool
|
||||
#import "DJDKMIMOMColor.h"
|
||||
#import "YUMIMacroUitls.h"
|
||||
|
||||
#import "XPMonentsLayoutConfig.h"
|
||||
#import "TTPopup.h"
|
||||
#import "NSArray+Safe.h"
|
||||
#import "ClientConfig.h"
|
||||
///Model
|
||||
#import "MonentsListInfoModel.h"
|
||||
///P
|
||||
@@ -25,9 +22,8 @@
|
||||
#import "XPMonentsTableViewCell.h"
|
||||
#import "XPMonentsEmptyTableViewCell.h"
|
||||
#import "XPMonentsDetailViewController.h"
|
||||
#import "XPMomentsSimpleDetailViewController.h"
|
||||
|
||||
@interface XPMonentsTopicLatestViewController ()<UITableViewDelegate, UITableViewDataSource,XPMonentsTopicLatestProtocol, XPMonentsTableViewCellDelegate, XPMonentsDetailViewControllerDelegate>
|
||||
@interface XPMonentsTopicLatestViewController ()<UITableViewDelegate, UITableViewDataSource,XPMonentsTopicLatestProtocol, XPMonentsTableViewCellDelegate>
|
||||
///列表
|
||||
@property (nonatomic,strong) UITableView *tableView;
|
||||
///数据源
|
||||
@@ -39,253 +35,308 @@
|
||||
@end
|
||||
|
||||
@implementation XPMonentsTopicLatestViewController
|
||||
|
||||
-(void)dealloc{
|
||||
[[NSNotificationCenter defaultCenter]removeObserver:self];
|
||||
}
|
||||
- (BOOL)isHiddenNavBar {
|
||||
return YES;
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (__kindof id)createPresenter {
|
||||
return [[XPMonentsTopicLatestPresenter alloc] init];
|
||||
return [[XPMonentsTopicLatestPresenter alloc] init];
|
||||
}
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
[self initHeaderAndFooterRrfresh];
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
}
|
||||
[super viewDidLoad];
|
||||
[self initHeaderAndFooterRrfresh];
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(refreshDynamicData:) name:@"kRefreshDynamicData" object:nil];
|
||||
|
||||
}
|
||||
-(void)refreshDynamicData:(NSNotification *)not{
|
||||
NSDictionary *refreshData = not.object;
|
||||
int type = [refreshData[@"type"] intValue];
|
||||
///type,0=点赞,1=删除,2=屏蔽,3=评论
|
||||
switch (type) {
|
||||
case 0:
|
||||
{
|
||||
|
||||
NSString *dynamicId = refreshData[@"dynamicId"];
|
||||
BOOL status = [refreshData[@"status"] boolValue];
|
||||
[self.datasource enumerateObjectsUsingBlock:^(MonentsInfoModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
if ([obj.dynamicId isEqualToString:dynamicId]) {
|
||||
if (status) {
|
||||
obj.isLike = YES;
|
||||
obj.likeCount = [NSString stringWithFormat:@"%ld",obj.likeCount.integerValue + 1];
|
||||
} else {
|
||||
obj.likeCount = [NSString stringWithFormat:@"%ld",(obj.likeCount.integerValue - 1 >= 0) ? (obj.likeCount.integerValue - 1) : 0];
|
||||
obj.isLike = NO;
|
||||
}
|
||||
*stop = YES;
|
||||
}
|
||||
}];
|
||||
|
||||
[self.tableView reloadData];
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
|
||||
NSString *dynamicId = refreshData[@"dynamicId"];
|
||||
__block MonentsInfoModel * deleteInfo;
|
||||
[self.datasource enumerateObjectsUsingBlock:^(MonentsInfoModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
if (obj.dynamicId.integerValue == dynamicId.integerValue) {
|
||||
deleteInfo = obj;
|
||||
|
||||
*stop = YES;
|
||||
}
|
||||
}];
|
||||
|
||||
if (deleteInfo) {
|
||||
[self.datasource removeObject:deleteInfo];
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
NSString *dynamicId = refreshData[@"dynamicId"];
|
||||
__block MonentsInfoModel * deleteInfo;
|
||||
[self.datasource enumerateObjectsUsingBlock:^(MonentsInfoModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
if (obj.dynamicId.integerValue == dynamicId.integerValue) {
|
||||
deleteInfo = obj;
|
||||
*stop = YES;
|
||||
|
||||
}
|
||||
}];
|
||||
|
||||
if (deleteInfo) {
|
||||
[self.datasource removeObject:deleteInfo];
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
NSString *dynamicId = refreshData[@"dynamicId"];
|
||||
[self.datasource enumerateObjectsUsingBlock:^(MonentsInfoModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
if ([obj.dynamicId isEqualToString:dynamicId]) {
|
||||
obj.commentCount = [NSString stringWithFormat:@"%ld",obj.commentCount.integerValue + 1];
|
||||
*stop = YES;
|
||||
}
|
||||
}];
|
||||
|
||||
[self.tableView reloadData];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma mark - Private Method
|
||||
- (void)initSubViews {
|
||||
[self.view addSubview:self.tableView];
|
||||
[self.view addSubview:self.tableView];
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.mas_equalTo(self.view);
|
||||
}];
|
||||
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.mas_equalTo(self.view);
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - 下拉刷新
|
||||
- (void)initHeaderAndFooterRrfresh {
|
||||
MJRefreshNormalHeader *header = [MJRefreshNormalHeader headerWithRefreshingTarget:self refreshingAction:@selector(headerRefresh)];
|
||||
header.stateLabel.font = [UIFont systemFontOfSize:10.0];
|
||||
header.lastUpdatedTimeLabel.font = [UIFont systemFontOfSize:10.0];
|
||||
header.stateLabel.textColor = [DJDKMIMOMColor secondTextColor];
|
||||
header.lastUpdatedTimeLabel.textColor = [DJDKMIMOMColor secondTextColor];
|
||||
self.tableView.mj_header = header;
|
||||
MJRefreshNormalHeader *header = [MJRefreshNormalHeader headerWithRefreshingTarget:self refreshingAction:@selector(headerRefresh)];
|
||||
header.stateLabel.font = [UIFont systemFontOfSize:10.0];
|
||||
header.lastUpdatedTimeLabel.font = [UIFont systemFontOfSize:10.0];
|
||||
header.stateLabel.textColor = [DJDKMIMOMColor secondTextColor];
|
||||
header.lastUpdatedTimeLabel.textColor = [DJDKMIMOMColor secondTextColor];
|
||||
self.tableView.mj_header = header;
|
||||
|
||||
MJRefreshBackNormalFooter *footer = [MJRefreshBackNormalFooter footerWithRefreshingTarget:self refreshingAction:@selector(footerRefresh)];
|
||||
footer.stateLabel.textColor = [DJDKMIMOMColor secondTextColor];
|
||||
footer.stateLabel.font = [UIFont systemFontOfSize:10.0];
|
||||
self.tableView.mj_footer = footer;
|
||||
MJRefreshBackNormalFooter *footer = [MJRefreshBackNormalFooter footerWithRefreshingTarget:self refreshingAction:@selector(footerRefresh)];
|
||||
footer.stateLabel.textColor = [DJDKMIMOMColor secondTextColor];
|
||||
footer.stateLabel.font = [UIFont systemFontOfSize:10.0];
|
||||
self.tableView.mj_footer = footer;
|
||||
|
||||
[self headerRefresh];
|
||||
[self headerRefresh];
|
||||
}
|
||||
|
||||
#pragma mark - 刷新的fangfa
|
||||
- (void)headerRefresh {
|
||||
[self.presenter getMonentsTopicLatestList:@"" worldId:self.worldId state:0];
|
||||
[self.presenter getMonentsTopicLatestList:@"" worldId:self.worldId state:0];
|
||||
}
|
||||
|
||||
- (void)footerRefresh {
|
||||
if (self.hasNoMoreData) {
|
||||
[self showErrorToast:YMLocalizedString(@"XPMonentsTopicLatestViewController0")];
|
||||
[self.tableView.mj_footer endRefreshing];
|
||||
return;
|
||||
}
|
||||
[self.presenter getMonentsTopicLatestList:self.listInfo.nextDynamicId worldId:self.worldId state:1];
|
||||
if (self.hasNoMoreData) {
|
||||
[self showErrorToast:YMLocalizedString(@"XPMonentsTopicLatestViewController0")];
|
||||
[self.tableView.mj_footer endRefreshing];
|
||||
return;
|
||||
}
|
||||
[self.presenter getMonentsTopicLatestList:self.listInfo.nextDynamicId worldId:self.worldId state:1];
|
||||
}
|
||||
|
||||
#pragma mark - UITableViewDelegate And UITableViewDataSource
|
||||
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
||||
return self.datasource.count > 0 ? self.datasource.count : 1;
|
||||
return self.datasource.count > 0 ? self.datasource.count : 1;
|
||||
}
|
||||
|
||||
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
if (self.datasource.count > 0) {
|
||||
MonentsInfoModel * monentInfo= [self.datasource safeObjectAtIndex1:indexPath.row];
|
||||
[XPMonentsLayoutConfig layoutMonentsModel:monentInfo];
|
||||
return monentInfo.rowHeight;
|
||||
}
|
||||
return KScreenHeight - kNavigationHeight - 49 - kSafeAreaBottomHeight;
|
||||
if (self.datasource.count > 0) {
|
||||
MonentsInfoModel * monentInfo= [self.datasource safeObjectAtIndex1:indexPath.row];
|
||||
[XPMonentsLayoutConfig layoutMonentsModel:monentInfo];
|
||||
if(monentInfo.squareTop && monentInfo.content.length == 0){
|
||||
return monentInfo.rowHeight + 20 ;
|
||||
}else{
|
||||
return monentInfo.rowHeight;
|
||||
}
|
||||
}
|
||||
return KScreenHeight - kNavigationHeight - 49 - kSafeAreaBottomHeight;
|
||||
}
|
||||
|
||||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
if (self.datasource.count > 0) {
|
||||
XPMonentsTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMonentsTableViewCell class])];
|
||||
MonentsInfoModel * monentsInfo = [self.datasource safeObjectAtIndex1:indexPath.row];
|
||||
cell.delegate = self;
|
||||
cell.monentsInfo = monentsInfo;
|
||||
return cell;
|
||||
}
|
||||
XPMonentsEmptyTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMonentsEmptyTableViewCell class])];
|
||||
return cell;
|
||||
if (self.datasource.count > 0) {
|
||||
XPMonentsTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMonentsTableViewCell class])];
|
||||
MonentsInfoModel * monentsInfo = [self.datasource safeObjectAtIndex1:indexPath.row];
|
||||
cell.delegate = self;
|
||||
cell.monentsInfo = monentsInfo;
|
||||
return cell;
|
||||
}
|
||||
XPMonentsEmptyTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMonentsEmptyTableViewCell class])];
|
||||
return cell;
|
||||
}
|
||||
|
||||
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
[tableView deselectRowAtIndexPath:indexPath animated:YES];
|
||||
if (self.datasource.count > 0) {
|
||||
|
||||
if ([ClientConfig shareConfig].canOpen) {
|
||||
XPMonentsDetailViewController * detailVC = [[XPMonentsDetailViewController alloc] init];
|
||||
MonentsInfoModel * monentsInfo = [self.datasource safeObjectAtIndex1:indexPath.row];
|
||||
detailVC.monentsInfo = monentsInfo;
|
||||
detailVC.delegate = self;
|
||||
[self.navigationController pushViewController:detailVC animated:YES];
|
||||
}else{
|
||||
XPMomentsSimpleDetailViewController * detailVC = [[XPMomentsSimpleDetailViewController alloc] init];
|
||||
MonentsInfoModel * monentsInfo = [self.datasource safeObjectAtIndex1:indexPath.row];
|
||||
detailVC.monentsInfo = monentsInfo;
|
||||
detailVC.delegate = self;
|
||||
[self.navigationController pushViewController:detailVC animated:YES];
|
||||
}
|
||||
}
|
||||
[tableView deselectRowAtIndexPath:indexPath animated:YES];
|
||||
if (self.datasource.count > 0) {
|
||||
XPMonentsDetailViewController * detailVC = [[XPMonentsDetailViewController alloc] init];
|
||||
MonentsInfoModel * monentsInfo = [self.datasource safeObjectAtIndex1:indexPath.row];
|
||||
detailVC.monentsInfo = monentsInfo;
|
||||
[self.navigationController pushViewController:detailVC animated:YES];
|
||||
}
|
||||
}
|
||||
#pragma mark - XPMonentsTableViewCellDelegate
|
||||
- (void)xPMonentsTableViewCell:(XPMonentsTableViewCell *)view didClicShielding:(MonentsInfoModel *)monentsInfo{
|
||||
[self showLoading];
|
||||
[self.presenter requesstShieldingWtihType:@"0" objId:monentsInfo.dynamicId];
|
||||
}
|
||||
- (void)xPMonentsTableViewCell:(XPMonentsTableViewCell *)view didClickLike:(MonentsInfoModel *)monentsInfo {
|
||||
[self.presenter likeMonent:monentsInfo.dynamicId status:!monentsInfo.isLike likedUid:monentsInfo.uid worldId:[NSString stringWithFormat:@"%ld", monentsInfo.worldId]];
|
||||
[self.presenter likeMonent:monentsInfo.dynamicId status:!monentsInfo.isLike likedUid:monentsInfo.uid worldId:[NSString stringWithFormat:@"%ld", monentsInfo.worldId]];
|
||||
}
|
||||
|
||||
- (void)xPMonentsTableViewCell:(XPMonentsTableViewCell *)view didClicDelete:(MonentsInfoModel *)monentsInfo {
|
||||
[TTPopup alertWithMessage:YMLocalizedString(@"XPMonentsTopicLatestViewController1") confirmHandler:^{
|
||||
[self.presenter deleteMonents:monentsInfo.dynamicId worldId:[NSString stringWithFormat:@"%ld", monentsInfo.worldId]];
|
||||
} cancelHandler:^{
|
||||
[TTPopup alertWithMessage:YMLocalizedString(@"XPMonentsTopicLatestViewController1") confirmHandler:^{
|
||||
[self.presenter deleteMonents:monentsInfo.dynamicId worldId:[NSString stringWithFormat:@"%ld", monentsInfo.worldId]];
|
||||
} cancelHandler:^{
|
||||
|
||||
}];
|
||||
}];
|
||||
}
|
||||
|
||||
- (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];
|
||||
}
|
||||
__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;
|
||||
return self.tableView;
|
||||
}
|
||||
|
||||
- (void)listViewDidScrollCallback:(void (^)(UIScrollView *))callback {
|
||||
self.scrollCallback = callback;
|
||||
self.scrollCallback = callback;
|
||||
}
|
||||
|
||||
- (UIView *)listView {
|
||||
return self.view;
|
||||
return self.view;
|
||||
}
|
||||
|
||||
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
|
||||
self.scrollCallback(scrollView);
|
||||
self.scrollCallback(scrollView);
|
||||
}
|
||||
|
||||
#pragma mark - XPMonentsDetailViewControllerDelegate
|
||||
- (void)xPMonentsDetailViewController:(XPMonentsDetailViewController *)view deleteMonents:(NSString *)dynamicId {
|
||||
__block MonentsInfoModel * deleteInfo;
|
||||
[self.datasource enumerateObjectsUsingBlock:^(MonentsInfoModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
if (obj.dynamicId.integerValue == dynamicId.integerValue) {
|
||||
deleteInfo = obj;
|
||||
}
|
||||
}];
|
||||
|
||||
if (deleteInfo) {
|
||||
[self.datasource removeObject:deleteInfo];
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - XPMonentsTopicLatestProtocol
|
||||
- (void)getMonentsTopicLatestListSuccess:(MonentsListInfoModel *)listInfo state:(int)state{
|
||||
self.listInfo = listInfo;
|
||||
if (state == 0) {
|
||||
[self.datasource removeAllObjects];
|
||||
}
|
||||
if (listInfo.dynamicList.count > 0) {
|
||||
[self.datasource addObjectsFromArray:listInfo.dynamicList];
|
||||
}
|
||||
self.listInfo = listInfo;
|
||||
if (state == 0) {
|
||||
[self.datasource removeAllObjects];
|
||||
}
|
||||
if (listInfo.dynamicList.count > 0) {
|
||||
[self.datasource addObjectsFromArray:listInfo.dynamicList];
|
||||
}
|
||||
|
||||
if (state == 0) {
|
||||
self.hasNoMoreData = NO;
|
||||
[self.tableView.mj_header endRefreshing];
|
||||
} else {
|
||||
if (listInfo.dynamicList.count > 0) {
|
||||
self.hasNoMoreData = NO;
|
||||
} else {
|
||||
self.hasNoMoreData = YES;
|
||||
}
|
||||
[self.tableView.mj_footer endRefreshing];
|
||||
}
|
||||
[self.tableView reloadData];
|
||||
if (state == 0) {
|
||||
self.hasNoMoreData = NO;
|
||||
[self.tableView.mj_header endRefreshing];
|
||||
} else {
|
||||
if (listInfo.dynamicList.count > 0) {
|
||||
self.hasNoMoreData = NO;
|
||||
} else {
|
||||
self.hasNoMoreData = YES;
|
||||
}
|
||||
[self.tableView.mj_footer endRefreshing];
|
||||
}
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
|
||||
- (void)getMonentsTopicLatestListFail:(NSString *)msg state:(int)state {
|
||||
if (state == 0) {
|
||||
[self.tableView.mj_header endRefreshing];
|
||||
} else {
|
||||
[self.tableView.mj_footer endRefreshing];
|
||||
}
|
||||
if (state == 0) {
|
||||
[self.tableView.mj_header endRefreshing];
|
||||
} else {
|
||||
[self.tableView.mj_footer endRefreshing];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)likeMonentsSuccess:(NSString *)dynamicId status:(BOOL)status {
|
||||
[self.datasource enumerateObjectsUsingBlock:^(MonentsInfoModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
if ([obj.dynamicId isEqualToString:dynamicId]) {
|
||||
if (status) {
|
||||
obj.isLike += 1;
|
||||
} else {
|
||||
obj.isLike -= 1;
|
||||
}
|
||||
*stop = YES;
|
||||
}
|
||||
}];
|
||||
[self.tableView reloadData];
|
||||
|
||||
///type,0=点赞,1=删除,2=屏蔽,3=评论
|
||||
[[NSNotificationCenter defaultCenter]postNotificationName:@"kRefreshDynamicData" object:@{@"dynamicId":dynamicId,@"type":@"0",@"status":@(status)}];
|
||||
}
|
||||
- (void)requesstShieldingSuccess:(NSString *)monentsInfo{
|
||||
[self hideHUD];
|
||||
[self showSuccessToast:YMLocalizedString(@"XPMonentsMineViewController2")];
|
||||
///type,0=点赞,1=删除,2=屏蔽,3=评论
|
||||
[[NSNotificationCenter defaultCenter]postNotificationName:@"kRefreshDynamicData" object:@{@"dynamicId":monentsInfo,@"type":@"2"}];
|
||||
}
|
||||
|
||||
- (void)deleteMonentsSuccess:(NSString *)monentsInfo {
|
||||
[self showSuccessToast:YMLocalizedString(@"XPMonentsTopicLatestViewController2")];
|
||||
__block MonentsInfoModel * deleteInfo;
|
||||
[self.datasource enumerateObjectsUsingBlock:^(MonentsInfoModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
if (obj.dynamicId.integerValue == monentsInfo.integerValue) {
|
||||
deleteInfo = obj;
|
||||
}
|
||||
}];
|
||||
|
||||
if (deleteInfo) {
|
||||
[self.datasource removeObject:deleteInfo];
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
[self showSuccessToast:YMLocalizedString(@"XPMonentsTopicLatestViewController2")];
|
||||
///type,0=点赞,1=删除,2=屏蔽,3=评论
|
||||
[[NSNotificationCenter defaultCenter]postNotificationName:@"kRefreshDynamicData" object:@{@"dynamicId":monentsInfo,@"type":@"1"}];
|
||||
|
||||
}
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
- (UITableView *)tableView {
|
||||
if (!_tableView) {
|
||||
_tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
|
||||
_tableView.delegate = self;
|
||||
_tableView.dataSource = self;
|
||||
_tableView.tableFooterView = [UIView new];
|
||||
_tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
|
||||
_tableView.backgroundColor = [UIColor clearColor];
|
||||
if (@available(iOS 11.0, *)) {
|
||||
_tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
|
||||
}
|
||||
[_tableView registerClass:[XPMonentsTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPMonentsTableViewCell class])];
|
||||
[_tableView registerClass:[XPMonentsEmptyTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPMonentsEmptyTableViewCell class])];
|
||||
}
|
||||
return _tableView;
|
||||
if (!_tableView) {
|
||||
_tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
|
||||
_tableView.delegate = self;
|
||||
_tableView.dataSource = self;
|
||||
_tableView.tableFooterView = [UIView new];
|
||||
_tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
|
||||
_tableView.backgroundColor = [UIColor clearColor];
|
||||
if (@available(iOS 11.0, *)) {
|
||||
_tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
|
||||
}
|
||||
[_tableView registerClass:[XPMonentsTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPMonentsTableViewCell class])];
|
||||
[_tableView registerClass:[XPMonentsEmptyTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPMonentsEmptyTableViewCell class])];
|
||||
}
|
||||
return _tableView;
|
||||
}
|
||||
|
||||
|
||||
- (NSMutableArray<MonentsInfoModel *> *)datasource {
|
||||
if (!_datasource) {
|
||||
_datasource = [NSMutableArray array];
|
||||
}
|
||||
return _datasource;
|
||||
if (!_datasource) {
|
||||
_datasource = [NSMutableArray array];
|
||||
}
|
||||
return _datasource;
|
||||
}
|
||||
|
||||
@end
|
||||
|
@@ -1,8 +1,8 @@
|
||||
//
|
||||
// YMMonentsTopicRecommondViewController.m
|
||||
// YUMI
|
||||
// XPMonentsTopicRecommondViewController.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by YUMI on 2022/8/18.
|
||||
// Created by 冯硕 on 2022/8/18.
|
||||
//
|
||||
|
||||
#import "XPMonentsTopicRecommondViewController.h"
|
||||
@@ -10,12 +10,9 @@
|
||||
#import <Masonry/Masonry.h>
|
||||
#import <MJRefresh/MJRefresh.h>
|
||||
///Tool
|
||||
#import "DJDKMIMOMColor.h"
|
||||
#import "YUMIMacroUitls.h"
|
||||
|
||||
#import "XPMonentsLayoutConfig.h"
|
||||
#import "TTPopup.h"
|
||||
#import "NSArray+Safe.h"
|
||||
#import "ClientConfig.h"
|
||||
///Model
|
||||
#import "MonentsListInfoModel.h"
|
||||
///P
|
||||
@@ -25,7 +22,6 @@
|
||||
#import "XPMonentsTableViewCell.h"
|
||||
#import "XPMonentsEmptyTableViewCell.h"
|
||||
#import "XPMonentsDetailViewController.h"
|
||||
#import "XPMomentsSimpleDetailViewController.h"
|
||||
|
||||
@interface XPMonentsTopicRecommondViewController ()<UITableViewDelegate, UITableViewDataSource,XPMonentsTopicRecommendProtocol, XPMonentsTableViewCellDelegate, XPMonentsDetailViewControllerDelegate>
|
||||
///列表
|
||||
@@ -41,251 +37,266 @@
|
||||
@implementation XPMonentsTopicRecommondViewController
|
||||
|
||||
- (BOOL)isHiddenNavBar {
|
||||
return YES;
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (__kindof id)createPresenter {
|
||||
return [[XPMonentsTopicRecommendPresenter alloc] init];
|
||||
return [[XPMonentsTopicRecommendPresenter alloc] init];
|
||||
}
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
[self initHeaderAndFooterRrfresh];
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
[super viewDidLoad];
|
||||
[self initHeaderAndFooterRrfresh];
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
}
|
||||
|
||||
#pragma mark - Private Method
|
||||
- (void)initSubViews {
|
||||
[self.view addSubview:self.tableView];
|
||||
[self.view addSubview:self.tableView];
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.mas_equalTo(self.view);
|
||||
}];
|
||||
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.mas_equalTo(self.view);
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - 下拉刷新
|
||||
- (void)initHeaderAndFooterRrfresh {
|
||||
MJRefreshNormalHeader *header = [MJRefreshNormalHeader headerWithRefreshingTarget:self refreshingAction:@selector(headerRefresh)];
|
||||
header.stateLabel.font = [UIFont systemFontOfSize:10.0];
|
||||
header.lastUpdatedTimeLabel.font = [UIFont systemFontOfSize:10.0];
|
||||
header.stateLabel.textColor = [DJDKMIMOMColor secondTextColor];
|
||||
header.lastUpdatedTimeLabel.textColor = [DJDKMIMOMColor secondTextColor];
|
||||
self.tableView.mj_header = header;
|
||||
MJRefreshNormalHeader *header = [MJRefreshNormalHeader headerWithRefreshingTarget:self refreshingAction:@selector(headerRefresh)];
|
||||
header.stateLabel.font = [UIFont systemFontOfSize:10.0];
|
||||
header.lastUpdatedTimeLabel.font = [UIFont systemFontOfSize:10.0];
|
||||
header.stateLabel.textColor = [DJDKMIMOMColor secondTextColor];
|
||||
header.lastUpdatedTimeLabel.textColor = [DJDKMIMOMColor secondTextColor];
|
||||
self.tableView.mj_header = header;
|
||||
|
||||
MJRefreshBackNormalFooter *footer = [MJRefreshBackNormalFooter footerWithRefreshingTarget:self refreshingAction:@selector(footerRefresh)];
|
||||
footer.stateLabel.textColor = [DJDKMIMOMColor secondTextColor];
|
||||
footer.stateLabel.font = [UIFont systemFontOfSize:10.0];
|
||||
self.tableView.mj_footer = footer;
|
||||
MJRefreshBackNormalFooter *footer = [MJRefreshBackNormalFooter footerWithRefreshingTarget:self refreshingAction:@selector(footerRefresh)];
|
||||
footer.stateLabel.textColor = [DJDKMIMOMColor secondTextColor];
|
||||
footer.stateLabel.font = [UIFont systemFontOfSize:10.0];
|
||||
self.tableView.mj_footer = footer;
|
||||
|
||||
[self headerRefresh];
|
||||
[self headerRefresh];
|
||||
}
|
||||
|
||||
#pragma mark - 刷新的fangfa
|
||||
- (void)headerRefresh {
|
||||
[self.presenter getMonentsTopicRecommendList:@"" worldId:self.worldId state:0];
|
||||
[self.presenter getMonentsTopicRecommendList:@"" worldId:self.worldId state:0];
|
||||
}
|
||||
|
||||
- (void)footerRefresh {
|
||||
if (self.hasNoMoreData) {
|
||||
[self showErrorToast:YMLocalizedString(@"XPMonentsTopicRecommondViewController0")];
|
||||
[self.tableView.mj_footer endRefreshing];
|
||||
return;
|
||||
}
|
||||
[self.presenter getMonentsTopicRecommendList:self.listInfo.nextDynamicId worldId:self.worldId state:1];
|
||||
if (self.hasNoMoreData) {
|
||||
[self showErrorToast:YMLocalizedString(@"XPMonentsTopicRecommondViewController0")];
|
||||
[self.tableView.mj_footer endRefreshing];
|
||||
return;
|
||||
}
|
||||
[self.presenter getMonentsTopicRecommendList:self.listInfo.nextDynamicId worldId:self.worldId state:1];
|
||||
}
|
||||
|
||||
#pragma mark - UITableViewDelegate And UITableViewDataSource
|
||||
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
||||
return self.datasource.count > 0 ? self.datasource.count : 1;
|
||||
return self.datasource.count > 0 ? self.datasource.count : 1;
|
||||
}
|
||||
|
||||
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
if (self.datasource.count > 0) {
|
||||
MonentsInfoModel * monentInfo= [self.datasource safeObjectAtIndex1:indexPath.row];
|
||||
[XPMonentsLayoutConfig layoutMonentsModel:monentInfo];
|
||||
return monentInfo.rowHeight;
|
||||
}
|
||||
return KScreenHeight - kNavigationHeight - 49 - kSafeAreaBottomHeight;
|
||||
if (self.datasource.count > 0) {
|
||||
MonentsInfoModel * monentInfo= [self.datasource safeObjectAtIndex1:indexPath.row];
|
||||
[XPMonentsLayoutConfig layoutMonentsModel:monentInfo];
|
||||
if(monentInfo.squareTop && monentInfo.content.length == 0){
|
||||
return monentInfo.rowHeight + 20 ;
|
||||
}else{
|
||||
return monentInfo.rowHeight;
|
||||
}
|
||||
}
|
||||
return KScreenHeight - kNavigationHeight - 49 - kSafeAreaBottomHeight;
|
||||
}
|
||||
|
||||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
if (self.datasource.count > 0) {
|
||||
XPMonentsTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMonentsTableViewCell class])];
|
||||
MonentsInfoModel * monentsInfo = [self.datasource safeObjectAtIndex1:indexPath.row];
|
||||
cell.delegate = self;
|
||||
cell.monentsInfo = monentsInfo;
|
||||
return cell;
|
||||
}
|
||||
XPMonentsEmptyTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMonentsEmptyTableViewCell class])];
|
||||
return cell;
|
||||
if (self.datasource.count > 0) {
|
||||
XPMonentsTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMonentsTableViewCell class])];
|
||||
MonentsInfoModel * monentsInfo = [self.datasource safeObjectAtIndex1:indexPath.row];
|
||||
cell.delegate = self;
|
||||
cell.isTopic = YES;
|
||||
cell.monentsInfo = monentsInfo;
|
||||
return cell;
|
||||
}
|
||||
XPMonentsEmptyTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMonentsEmptyTableViewCell class])];
|
||||
return cell;
|
||||
}
|
||||
|
||||
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
[tableView deselectRowAtIndexPath:indexPath animated:YES];
|
||||
if (self.datasource.count > 0) {
|
||||
|
||||
if ([ClientConfig shareConfig].canOpen) {
|
||||
XPMonentsDetailViewController * detailVC = [[XPMonentsDetailViewController alloc] init];
|
||||
MonentsInfoModel * monentsInfo = [self.datasource safeObjectAtIndex1:indexPath.row];
|
||||
detailVC.monentsInfo = monentsInfo;
|
||||
detailVC.delegate = self;
|
||||
[self.navigationController pushViewController:detailVC animated:YES];
|
||||
}else{
|
||||
XPMomentsSimpleDetailViewController * detailVC = [[XPMomentsSimpleDetailViewController alloc] init];
|
||||
MonentsInfoModel * monentsInfo = [self.datasource safeObjectAtIndex1:indexPath.row];
|
||||
detailVC.monentsInfo = monentsInfo;
|
||||
detailVC.delegate = self;
|
||||
[self.navigationController pushViewController:detailVC animated:YES];
|
||||
}
|
||||
}
|
||||
[tableView deselectRowAtIndexPath:indexPath animated:YES];
|
||||
if (self.datasource.count > 0) {
|
||||
XPMonentsDetailViewController * detailVC = [[XPMonentsDetailViewController alloc] init];
|
||||
MonentsInfoModel * monentsInfo = [self.datasource safeObjectAtIndex1:indexPath.row];
|
||||
detailVC.monentsInfo = monentsInfo;
|
||||
detailVC.delegate = self;
|
||||
[self.navigationController pushViewController:detailVC animated:YES];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - XPMonentsDetailViewControllerDelegate
|
||||
- (void)xPMonentsDetailViewController:(XPMonentsDetailViewController *)view deleteMonents:(NSString *)dynamicId {
|
||||
__block MonentsInfoModel * deleteInfo;
|
||||
[self.datasource enumerateObjectsUsingBlock:^(MonentsInfoModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
if (obj.dynamicId.integerValue == dynamicId.integerValue) {
|
||||
deleteInfo = obj;
|
||||
}
|
||||
}];
|
||||
|
||||
if (deleteInfo) {
|
||||
[self.datasource removeObject:deleteInfo];
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
- (void)xPMonentsDetailViewController:(XPMonentsDetailViewController *)view deleteMonents:(NSString *)dynamicId {
|
||||
__block MonentsInfoModel * deleteInfo;
|
||||
[self.datasource enumerateObjectsUsingBlock:^(MonentsInfoModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
if (obj.dynamicId.integerValue == dynamicId.integerValue) {
|
||||
deleteInfo = obj;
|
||||
}
|
||||
}];
|
||||
|
||||
if (deleteInfo) {
|
||||
[self.datasource removeObject:deleteInfo];
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - XPMonentsTableViewCellDelegate
|
||||
- (void)xPMonentsTableViewCell:(XPMonentsTableViewCell *)view didClicShielding:(MonentsInfoModel *)monentsInfo{
|
||||
[self showLoading];
|
||||
[self.presenter requesstShieldingWtihType:@"0" objId:monentsInfo.dynamicId];
|
||||
}
|
||||
- (void)xPMonentsTableViewCell:(XPMonentsTableViewCell *)view didClickLike:(MonentsInfoModel *)monentsInfo {
|
||||
[self.presenter likeMonent:monentsInfo.dynamicId status:!monentsInfo.isLike likedUid:monentsInfo.uid worldId:[NSString stringWithFormat:@"%ld", monentsInfo.worldId]];
|
||||
[self.presenter likeMonent:monentsInfo.dynamicId status:!monentsInfo.isLike likedUid:monentsInfo.uid worldId:[NSString stringWithFormat:@"%ld", monentsInfo.worldId]];
|
||||
}
|
||||
|
||||
- (void)xPMonentsTableViewCell:(XPMonentsTableViewCell *)view didClicDelete:(MonentsInfoModel *)monentsInfo {
|
||||
[TTPopup alertWithMessage:YMLocalizedString(@"XPMonentsTopicLatestViewController1") confirmHandler:^{
|
||||
[self.presenter deleteMonents:monentsInfo.dynamicId worldId:[NSString stringWithFormat:@"%ld", monentsInfo.worldId]];
|
||||
} cancelHandler:^{
|
||||
[TTPopup alertWithMessage:YMLocalizedString(@"XPMonentsTopicRecommondViewController1") confirmHandler:^{
|
||||
[self.presenter deleteMonents:monentsInfo.dynamicId worldId:[NSString stringWithFormat:@"%ld", monentsInfo.worldId]];
|
||||
} cancelHandler:^{
|
||||
|
||||
}];
|
||||
}];
|
||||
}
|
||||
|
||||
- (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];
|
||||
}
|
||||
__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;
|
||||
return self.tableView;
|
||||
}
|
||||
|
||||
- (void)listViewDidScrollCallback:(void (^)(UIScrollView *))callback {
|
||||
self.scrollCallback = callback;
|
||||
self.scrollCallback = callback;
|
||||
}
|
||||
|
||||
- (UIView *)listView {
|
||||
return self.view;
|
||||
return self.view;
|
||||
}
|
||||
|
||||
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
|
||||
self.scrollCallback(scrollView);
|
||||
self.scrollCallback(scrollView);
|
||||
}
|
||||
|
||||
#pragma mark - XPMonentsRecommendProtocol
|
||||
- (void)getMonentsTopicRecommendListSuccess:(MonentsListInfoModel *)listInfo state:(int)state {
|
||||
self.listInfo = listInfo;
|
||||
if (state == 0) {
|
||||
[self.datasource removeAllObjects];
|
||||
}
|
||||
if (listInfo.dynamicList.count > 0) {
|
||||
[self.datasource addObjectsFromArray:listInfo.dynamicList];
|
||||
}
|
||||
self.listInfo = listInfo;
|
||||
if (state == 0) {
|
||||
[self.datasource removeAllObjects];
|
||||
}
|
||||
if (listInfo.dynamicList.count > 0) {
|
||||
[self.datasource addObjectsFromArray:listInfo.dynamicList];
|
||||
}
|
||||
|
||||
if (state == 0) {
|
||||
self.hasNoMoreData = NO;
|
||||
[self.tableView.mj_header endRefreshing];
|
||||
} else {
|
||||
if (listInfo.dynamicList.count > 0) {
|
||||
self.hasNoMoreData = NO;
|
||||
} else {
|
||||
self.hasNoMoreData = YES;
|
||||
}
|
||||
[self.tableView.mj_footer endRefreshing];
|
||||
}
|
||||
[self.tableView reloadData];
|
||||
if (state == 0) {
|
||||
self.hasNoMoreData = NO;
|
||||
[self.tableView.mj_header endRefreshing];
|
||||
} else {
|
||||
if (listInfo.dynamicList.count > 0) {
|
||||
self.hasNoMoreData = NO;
|
||||
} else {
|
||||
self.hasNoMoreData = YES;
|
||||
}
|
||||
[self.tableView.mj_footer endRefreshing];
|
||||
}
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
|
||||
- (void)getMonentsTopicRecommendListFail:(NSString *)msg state:(int)state {
|
||||
if (state == 0) {
|
||||
[self.tableView.mj_header endRefreshing];
|
||||
} else {
|
||||
[self.tableView.mj_footer endRefreshing];
|
||||
}
|
||||
if (state == 0) {
|
||||
[self.tableView.mj_header endRefreshing];
|
||||
} else {
|
||||
[self.tableView.mj_footer endRefreshing];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)likeMonentsSuccess:(NSString *)dynamicId status:(BOOL)status {
|
||||
[self.datasource enumerateObjectsUsingBlock:^(MonentsInfoModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
if ([obj.dynamicId isEqualToString:dynamicId]) {
|
||||
if (status) {
|
||||
obj.isLike += 1;
|
||||
} else {
|
||||
obj.isLike -= 1;
|
||||
}
|
||||
*stop = YES;
|
||||
}
|
||||
}];
|
||||
[self.tableView reloadData];
|
||||
[self.datasource enumerateObjectsUsingBlock:^(MonentsInfoModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
if ([obj.dynamicId isEqualToString:dynamicId]) {
|
||||
if (status) {
|
||||
obj.isLike += 1;
|
||||
} else {
|
||||
obj.isLike -= 1;
|
||||
}
|
||||
*stop = YES;
|
||||
}
|
||||
}];
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
-(void)requesstShieldingSuccess:(NSString *)monentsInfo{
|
||||
[self hideHUD];
|
||||
[self showSuccessToast:YMLocalizedString(@"XPMonentsMineViewController2")];
|
||||
__block MonentsInfoModel * deleteInfo;
|
||||
[self.datasource enumerateObjectsUsingBlock:^(MonentsInfoModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
if (obj.dynamicId.integerValue == monentsInfo.integerValue) {
|
||||
deleteInfo = obj;
|
||||
}
|
||||
}];
|
||||
|
||||
if (deleteInfo) {
|
||||
[self.datasource removeObject:deleteInfo];
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
}
|
||||
- (void)deleteMonentsSuccess:(NSString *)monentsInfo {
|
||||
[self showSuccessToast:YMLocalizedString(@"XPMonentsTopicRecommondViewController2")];
|
||||
__block MonentsInfoModel * deleteInfo;
|
||||
[self.datasource enumerateObjectsUsingBlock:^(MonentsInfoModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
if (obj.dynamicId.integerValue == monentsInfo.integerValue) {
|
||||
deleteInfo = obj;
|
||||
}
|
||||
}];
|
||||
[self showSuccessToast:YMLocalizedString(@"XPMonentsTopicRecommondViewController2")];
|
||||
__block MonentsInfoModel * deleteInfo;
|
||||
[self.datasource enumerateObjectsUsingBlock:^(MonentsInfoModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
if (obj.dynamicId.integerValue == monentsInfo.integerValue) {
|
||||
deleteInfo = obj;
|
||||
}
|
||||
}];
|
||||
|
||||
if (deleteInfo) {
|
||||
[self.datasource removeObject:deleteInfo];
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
if (deleteInfo) {
|
||||
[self.datasource removeObject:deleteInfo];
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
- (UITableView *)tableView {
|
||||
if (!_tableView) {
|
||||
_tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
|
||||
_tableView.delegate = self;
|
||||
_tableView.dataSource = self;
|
||||
_tableView.tableFooterView = [UIView new];
|
||||
_tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
|
||||
_tableView.backgroundColor = [UIColor clearColor];
|
||||
if (@available(iOS 11.0, *)) {
|
||||
_tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
|
||||
}
|
||||
[_tableView registerClass:[XPMonentsTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPMonentsTableViewCell class])];
|
||||
[_tableView registerClass:[XPMonentsEmptyTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPMonentsEmptyTableViewCell class])];
|
||||
}
|
||||
return _tableView;
|
||||
if (!_tableView) {
|
||||
_tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
|
||||
_tableView.delegate = self;
|
||||
_tableView.dataSource = self;
|
||||
_tableView.tableFooterView = [UIView new];
|
||||
_tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
|
||||
_tableView.backgroundColor = [UIColor clearColor];
|
||||
if (@available(iOS 11.0, *)) {
|
||||
_tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
|
||||
}
|
||||
[_tableView registerClass:[XPMonentsTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPMonentsTableViewCell class])];
|
||||
[_tableView registerClass:[XPMonentsEmptyTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPMonentsEmptyTableViewCell class])];
|
||||
}
|
||||
return _tableView;
|
||||
}
|
||||
|
||||
|
||||
- (NSMutableArray<MonentsInfoModel *> *)datasource {
|
||||
if (!_datasource) {
|
||||
_datasource = [NSMutableArray array];
|
||||
}
|
||||
return _datasource;
|
||||
if (!_datasource) {
|
||||
_datasource = [NSMutableArray array];
|
||||
}
|
||||
return _datasource;
|
||||
}
|
||||
@end
|
||||
|
@@ -1,8 +1,8 @@
|
||||
//
|
||||
// YMMonentsViewController.m
|
||||
// YUMI
|
||||
// XPMonentsViewController.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by YUMI on 2022/5/11.
|
||||
// Created by 冯硕 on 2022/5/11.
|
||||
//
|
||||
|
||||
#import "XPMonentsViewController.h"
|
||||
@@ -11,9 +11,7 @@
|
||||
#import <NIMSDK/NIMSDK.h>
|
||||
#import <JXCategoryView/JXCategoryView.h>
|
||||
#import <JXCategoryView/JXCategoryListContainerView.h>
|
||||
///Tool
|
||||
#import "DJDKMIMOMColor.h"
|
||||
#import "YUMIMacroUitls.h"
|
||||
|
||||
///Tool
|
||||
#import "AttachMentModel.h"
|
||||
#import "MonentsUnReadModel.h"
|
||||
@@ -24,7 +22,8 @@
|
||||
#import "XPMonentsInteractiveViewController.h"
|
||||
#import "XPMonentsPublishViewController.h"
|
||||
|
||||
@interface XPMonentsViewController ()<JXCategoryViewDelegate,JXCategoryListContainerViewDelegate>
|
||||
|
||||
@interface XPMonentsViewController ()<JXCategoryViewDelegate,JXCategoryListContainerViewDelegate,NIMSystemNotificationManagerDelegate>
|
||||
///标题
|
||||
@property (nonatomic,strong) NSArray<NSString *> *titles;
|
||||
///导航栏
|
||||
@@ -36,6 +35,7 @@
|
||||
///滑块
|
||||
@property (nonatomic,strong) JXCategoryTitleView *titleView;
|
||||
@property (nonatomic, strong) JXCategoryListContainerView *listContainerView;
|
||||
|
||||
///发布的按钮
|
||||
@property (nonatomic,strong) UIButton *publishButton;
|
||||
///关注
|
||||
@@ -47,233 +47,240 @@
|
||||
@end
|
||||
|
||||
@implementation XPMonentsViewController
|
||||
@synthesize parentMode = _parentMode;
|
||||
|
||||
- (void)dealloc {
|
||||
[[NIMSDK sharedSDK].systemNotificationManager removeDelegate:self];
|
||||
[[NIMSDK sharedSDK].systemNotificationManager removeDelegate:self];
|
||||
}
|
||||
|
||||
- (BOOL)isHiddenNavBar {
|
||||
return YES;
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
[[NIMSDK sharedSDK].systemNotificationManager addDelegate:self];
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
[super viewDidLoad];
|
||||
[[NIMSDK sharedSDK].systemNotificationManager addDelegate:self];
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
}
|
||||
|
||||
#pragma mark - Private Method
|
||||
- (void)initSubViews {
|
||||
[self.view addSubview:self.navView];
|
||||
[self.view addSubview:self.listContainerView];
|
||||
[self.view addSubview:self.publishButton];
|
||||
|
||||
[self.navView addSubview:self.titleView];
|
||||
[self.navView addSubview:self.messageButton];
|
||||
[self.navView addSubview:self.dotView];
|
||||
[self.view addSubview:self.navView];
|
||||
[self.view addSubview:self.listContainerView];
|
||||
[self.view addSubview:self.publishButton];
|
||||
|
||||
[self.navView addSubview:self.titleView];
|
||||
[self.navView addSubview:self.messageButton];
|
||||
[self.navView addSubview:self.dotView];
|
||||
self.dotView.hidden = self.tabBarItem.badgeValue == 0;
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
[self.navView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.top.mas_equalTo(self.view);
|
||||
make.height.mas_equalTo(kNavigationHeight);
|
||||
}];
|
||||
|
||||
[self.titleView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.mas_equalTo(self.navView);
|
||||
make.height.mas_equalTo(20);
|
||||
make.top.mas_equalTo(self.navView).offset(kSafeAreaTopHeight + 40);
|
||||
}];
|
||||
|
||||
[self.messageButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerY.mas_equalTo(self.titleView);
|
||||
make.right.mas_equalTo(self.navView).offset(-15);
|
||||
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);
|
||||
}];
|
||||
|
||||
[self.publishButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.size.mas_equalTo(CGSizeMake(45, 45));
|
||||
make.bottom.mas_equalTo(self.view).offset(-kSafeAreaBottomHeight - 60);
|
||||
make.right.mas_equalTo(self.view).offset(-25);
|
||||
}];
|
||||
[self.navView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.top.mas_equalTo(self.view);
|
||||
make.height.mas_equalTo(kNavigationHeight);
|
||||
}];
|
||||
|
||||
[self.titleView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.mas_equalTo(self.navView);
|
||||
make.height.mas_equalTo(45);
|
||||
make.top.mas_equalTo(self.navView).offset(kSafeAreaTopHeight + 20);
|
||||
}];
|
||||
|
||||
[self.messageButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerY.mas_equalTo(self.titleView);
|
||||
make.right.mas_equalTo(self.navView).offset(-15);
|
||||
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);
|
||||
}];
|
||||
|
||||
[self.publishButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.size.mas_equalTo(CGSizeMake(45, 45));
|
||||
make.bottom.mas_equalTo(self.view).offset(-kSafeAreaBottomHeight - 30);
|
||||
make.right.mas_equalTo(self.view).offset(-15);
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - JXCategoryListContainerViewDelegate
|
||||
- (NSInteger)numberOfListsInlistContainerView:(JXCategoryListContainerView *)listContainerView {
|
||||
return self.titles.count;
|
||||
return self.titles.count;
|
||||
}
|
||||
|
||||
|
||||
// 根据下标 index 返回对应遵守并实现 `JXCategoryListContentViewDelegate` 协议的列表实例
|
||||
- (id<JXCategoryListContentViewDelegate>)listContainerView:(JXCategoryListContainerView *)listContainerView initListForIndex:(NSInteger)index {
|
||||
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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#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;
|
||||
}
|
||||
[self setTabBarItemBadge:unreadModel.total];
|
||||
}
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
[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];
|
||||
}
|
||||
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];
|
||||
[self.navigationController pushViewController:messageVC animated:YES];
|
||||
XPMonentsInteractiveViewController * messageVC = [[XPMonentsInteractiveViewController alloc] init];
|
||||
[self.navigationController pushViewController:messageVC animated:YES];
|
||||
}
|
||||
|
||||
- (void)publishButtonAction:(UIButton *)sender {
|
||||
XPMonentsPublishViewController * publishVC = [[XPMonentsPublishViewController alloc] init];
|
||||
[self.navigationController pushViewController:publishVC animated:YES];
|
||||
XPMonentsPublishViewController * publishVC = [[XPMonentsPublishViewController alloc] init];
|
||||
[self.navigationController pushViewController:publishVC animated:YES];
|
||||
}
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
- (JXCategoryListContainerView *)listContainerView {
|
||||
if (!_listContainerView) {
|
||||
_listContainerView = [[JXCategoryListContainerView alloc] initWithType:JXCategoryListContainerType_ScrollView delegate:self];
|
||||
_listContainerView.listCellBackgroundColor = [UIColor clearColor];
|
||||
}
|
||||
return _listContainerView;
|
||||
if (!_listContainerView) {
|
||||
_listContainerView = [[JXCategoryListContainerView alloc] initWithType:JXCategoryListContainerType_ScrollView delegate:self];
|
||||
_listContainerView.listCellBackgroundColor = [UIColor clearColor];
|
||||
}
|
||||
return _listContainerView;
|
||||
}
|
||||
|
||||
- (JXCategoryTitleView *)titleView {
|
||||
if (!_titleView) {
|
||||
_titleView = [[JXCategoryTitleView alloc] initWithFrame:CGRectZero];
|
||||
_titleView.backgroundColor =[UIColor clearColor];
|
||||
_titleView.delegate = self;
|
||||
_titleView.titleColor = [DJDKMIMOMColor secondTextColor];
|
||||
_titleView.titleSelectedColor = [DJDKMIMOMColor mainTextColor];
|
||||
_titleView.titleFont = [UIFont systemFontOfSize:15 weight:UIFontWeightSemibold];
|
||||
_titleView.titleSelectedFont = [UIFont systemFontOfSize:20 weight:UIFontWeightHeavy];
|
||||
_titleView.titleLabelAnchorPointStyle = JXCategoryTitleLabelAnchorPointStyleCenter;
|
||||
_titleView.contentScrollViewClickTransitionAnimationEnabled = NO;
|
||||
_titleView.averageCellSpacingEnabled = NO;
|
||||
_titleView.defaultSelectedIndex = 0;
|
||||
_titleView.cellSpacing = 20;
|
||||
_titleView.titles = self.titles;
|
||||
_titleView.listContainer = self.listContainerView;
|
||||
_titleView.defaultSelectedIndex = 1;
|
||||
CGFloat itemWidth = [YMLocalizedString(@"XPMonentsViewController0") boundingRectWithSize:CGSizeMake(100, CGFLOAT_MAX) options:NSStringDrawingTruncatesLastVisibleLine | NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:20 weight:UIFontWeightHeavy]} context:nil].size.width;
|
||||
_titleView.cellWidth = itemWidth;
|
||||
_titleView.contentEdgeInsetLeft = (KScreenWidth - itemWidth * self.titles.count - 20 * (self.titles.count - 1))/ 2;
|
||||
}
|
||||
return _titleView;
|
||||
if (!_titleView) {
|
||||
_titleView = [[JXCategoryTitleView alloc] initWithFrame:CGRectZero];
|
||||
_titleView.backgroundColor =[UIColor clearColor];
|
||||
_titleView.delegate = self;
|
||||
_titleView.titleColor = [DJDKMIMOMColor secondTextColor];
|
||||
_titleView.titleSelectedColor = [DJDKMIMOMColor mainTextColor];
|
||||
_titleView.titleFont = [UIFont systemFontOfSize:16 weight:UIFontWeightSemibold];
|
||||
_titleView.titleSelectedFont = [UIFont systemFontOfSize:22 weight:UIFontWeightHeavy];
|
||||
_titleView.titleLabelAnchorPointStyle = JXCategoryTitleLabelAnchorPointStyleCenter;
|
||||
_titleView.contentScrollViewClickTransitionAnimationEnabled = NO;
|
||||
_titleView.averageCellSpacingEnabled = NO;
|
||||
_titleView.defaultSelectedIndex = 0;
|
||||
_titleView.cellSpacing = 26;
|
||||
_titleView.titles = self.titles;
|
||||
_titleView.listContainer = self.listContainerView;
|
||||
_titleView.defaultSelectedIndex = 1;
|
||||
_titleView.contentEdgeInsetLeft = 15;
|
||||
|
||||
JXCategoryIndicatorImageView *lineView = [[JXCategoryIndicatorImageView alloc] init];
|
||||
lineView.indicatorImageViewSize = CGSizeMake(45, 10);
|
||||
lineView.verticalMargin = 7;
|
||||
lineView.indicatorImageView.image = [UIImage imageNamed:@"mine_dynamic"];
|
||||
_titleView.indicators = @[lineView];
|
||||
|
||||
}
|
||||
return _titleView;
|
||||
}
|
||||
|
||||
- (UIView *)navView {
|
||||
if (!_navView) {
|
||||
_navView = [[UIView alloc] init];
|
||||
_navView.backgroundColor = [DJDKMIMOMColor appCellBackgroundColor];
|
||||
}
|
||||
return _navView;
|
||||
if (!_navView) {
|
||||
_navView = [[UIView alloc] init];
|
||||
_navView.backgroundColor = [DJDKMIMOMColor appCellBackgroundColor];
|
||||
}
|
||||
return _navView;
|
||||
}
|
||||
|
||||
- (NSArray<NSString *> *)titles {
|
||||
if (!_titles) {
|
||||
_titles = @[YMLocalizedString(@"XPMonentsViewController1"),YMLocalizedString(@"XPMonentsViewController2"), YMLocalizedString(@"XPMonentsViewController3")];
|
||||
}
|
||||
return _titles;
|
||||
if (!_titles) {
|
||||
_titles = @[YMLocalizedString(@"XPMonentsViewController1"),YMLocalizedString(@"XPMonentsViewController2"), YMLocalizedString(@"XPMonentsViewController3")];
|
||||
}
|
||||
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;
|
||||
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;
|
||||
if (!_dotView) {
|
||||
_dotView = [[UIView alloc] init];
|
||||
_dotView.backgroundColor = UIColorFromRGB(0xFF2D55);
|
||||
_dotView.layer.masksToBounds = YES;
|
||||
_dotView.layer.cornerRadius = 5;
|
||||
_dotView.hidden = YES;
|
||||
}
|
||||
return _dotView;
|
||||
}
|
||||
|
||||
- (UIButton *)publishButton {
|
||||
if (!_publishButton) {
|
||||
_publishButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_publishButton setImage:[UIImage imageNamed:@"monents_publish"] forState:UIControlStateNormal];
|
||||
[_publishButton setImage:[UIImage imageNamed:@"monents_publish"] forState:UIControlStateSelected];
|
||||
[_publishButton addTarget:self action:@selector(publishButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _publishButton;
|
||||
if (!_publishButton) {
|
||||
_publishButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_publishButton setImage:[UIImage imageNamed:@"monents_publish"] forState:UIControlStateNormal];
|
||||
[_publishButton setImage:[UIImage imageNamed:@"monents_publish"] forState:UIControlStateSelected];
|
||||
[_publishButton addTarget:self action:@selector(publishButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _publishButton;
|
||||
}
|
||||
|
||||
- (XPMonentsAttentionViewController *)attentionVC {
|
||||
if (!_attentionVC) {
|
||||
XPMonentsAttentionViewController * attentionVC = [[XPMonentsAttentionViewController alloc] init];
|
||||
_attentionVC = attentionVC;
|
||||
}
|
||||
return _attentionVC;
|
||||
if (!_attentionVC) {
|
||||
XPMonentsAttentionViewController * attentionVC = [[XPMonentsAttentionViewController alloc] init];
|
||||
_attentionVC = attentionVC;
|
||||
}
|
||||
return _attentionVC;
|
||||
}
|
||||
|
||||
- (XPMonentsLatestViewController *)latestVC {
|
||||
if (!_latestVC) {
|
||||
_latestVC = [[XPMonentsLatestViewController alloc] init];
|
||||
}
|
||||
return _latestVC;
|
||||
if (!_latestVC) {
|
||||
_latestVC = [[XPMonentsLatestViewController alloc] init];
|
||||
}
|
||||
return _latestVC;
|
||||
}
|
||||
|
||||
- (XPMonentsRecommendViewController *)recommendVC {
|
||||
if (!_recommendVC) {
|
||||
_recommendVC = [[XPMonentsRecommendViewController alloc] init];
|
||||
}
|
||||
return _recommendVC;
|
||||
if (!_recommendVC) {
|
||||
_recommendVC = [[XPMonentsRecommendViewController alloc] init];
|
||||
}
|
||||
return _recommendVC;
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
@@ -40,4 +40,5 @@
|
||||
#import <MJExtension/MJExtension.h>
|
||||
#import "StatisticsServiceHelper.h"
|
||||
#import "YUMIConstant.h"
|
||||
#import "YUMINNNN.h"
|
||||
#endif /* PrefixHeader_pch */
|
||||
|
@@ -89,11 +89,12 @@
|
||||
"PLTimeUtil3" = "yyyy年MM月";
|
||||
"PLTimeUtil4" = "MM月dd日";
|
||||
|
||||
"NSString_Utils0" = "%@万";
|
||||
"NSString_Utils1" = "MM月dd日";
|
||||
"NSString_Utils2" = "YYYY年MM月dd日";
|
||||
"NSString_Utils3" = "刚刚";
|
||||
"NSString_Utils4" = "%ld分钟前";
|
||||
///NSString+Utils.m
|
||||
"NSString_Utils0" = "MM月dd日";
|
||||
"NSString_Utils1" = "YYYY年MM月dd日";
|
||||
"NSString_Utils2" = "刚刚";
|
||||
"NSString_Utils3" = "%ld分钟前";
|
||||
"NSString_Utils4" = "%@万";
|
||||
|
||||
"QEmotionBoardView0" = "发送";
|
||||
|
||||
@@ -2007,8 +2008,10 @@
|
||||
"XPMonentsAttentionViewController1" = "删除后不可恢复\n确定删除该动态吗";
|
||||
"XPMonentsAttentionViewController2" = "删除成功";
|
||||
|
||||
"XPMonentsMineViewController0" = "删除后不可恢复\n确定删除该动态吗";
|
||||
///XPMonentsMineViewController.m
|
||||
"XPMonentsMineViewController0" = "删除后不可恢复\n确定删除该动态吗?";
|
||||
"XPMonentsMineViewController1" = "删除成功";
|
||||
"XPMonentsMineViewController2" = "屏蔽成功";
|
||||
|
||||
"XPMonentsViewController0" = "推荐";
|
||||
"XPMonentsViewController1" = "关注";
|
||||
@@ -2017,25 +2020,31 @@
|
||||
|
||||
"XPMonentsRecommendHeaderView0" = "推荐话题";
|
||||
|
||||
"XPMonentsContentView0" = "展开";
|
||||
"XPMonentsContentView1" = "收起";
|
||||
///XPMonentsContentView.m
|
||||
"XPMonentsContentView0" = "置顶 ";
|
||||
"XPMonentsContentView1" = "展开";
|
||||
"XPMonentsContentView2" = "收起";
|
||||
|
||||
"XPMoentsTopicListView0" = "没有更多数据了";
|
||||
|
||||
"XPMonentsPublishTopicView0" = "添加话题";
|
||||
"XPMonentsPublishTopicView1" = "重新选择";
|
||||
|
||||
"XPMonentsUserInfoView0" = "直播中";
|
||||
///XPMonentsUserInfoView.m
|
||||
"XPMonentsUserInfoView0" = "删除";
|
||||
"XPMonentsUserInfoView1" = "举报";
|
||||
"XPMonentsUserInfoView2" = "直播中";
|
||||
|
||||
///XPMonentsTooBarView.m
|
||||
"XPMonentsTooBarView0" = "删除";
|
||||
"XPMonentsTooBarView1" = "举报";
|
||||
"XPMonentsTooBarView2" = "您的请求我们已经收到,我们将儘快处理";
|
||||
"XPMonentsTooBarView3" = "好友";
|
||||
"XPMonentsTooBarView4" = "朋友圈";
|
||||
"XPMonentsTooBarView5" = "微信好友";
|
||||
"XPMonentsTooBarView6" = "QQ好友";
|
||||
"XPMonentsTooBarView7" = "QQ空间";
|
||||
"XPMonentsTooBarView8" = "%@发佈了一条动态";
|
||||
"XPMonentsTooBarView1" = "举报动态或用户";
|
||||
"XPMonentsTooBarView2" = "好友";
|
||||
"XPMonentsTooBarView3" = "朋友圈";
|
||||
"XPMonentsTooBarView4" = "微信好友";
|
||||
"XPMonentsTooBarView5" = "QQ好友";
|
||||
"XPMonentsTooBarView6" = "QQ空间";
|
||||
"XPMonentsTooBarView7" = "%@发布了一条动态";
|
||||
"XPMonentsTooBarView8" = "屏蔽动态";
|
||||
|
||||
"XPMonentPublishSuccessView0" = "审核中";
|
||||
"XPMonentPublishSuccessView1" = "咻,收到小可爱的动态了呢~\n审核通过后小秘书会帮你发送并通知你哦";
|
||||
@@ -2212,7 +2221,7 @@
|
||||
"LoginVerifCodeViewController4" = "重新获取";
|
||||
|
||||
"XPLoginViewController11" = "同意隐私政策和用户协议后,才可以注册登录哦~";
|
||||
"XPMonentsMineViewController2" = "删除后不可恢複\n确定删除该动态吗?";
|
||||
|
||||
|
||||
|
||||
"PKLoginViewController1" = "同意隐私政策和用户协议后,才可以注册登录哦~";
|
||||
|
@@ -89,11 +89,12 @@
|
||||
"PLTimeUtil3" = "yyyy年MM月";
|
||||
"PLTimeUtil4" = "MM月dd日";
|
||||
|
||||
"NSString_Utils0" = "%@萬";
|
||||
"NSString_Utils1" = "MM月dd日";
|
||||
"NSString_Utils2" = "YYYY年MM月dd日";
|
||||
"NSString_Utils3" = "剛剛";
|
||||
"NSString_Utils4" = "%ld分鐘前";
|
||||
///NSString+Utils.m
|
||||
"NSString_Utils0" = "MM月dd日";
|
||||
"NSString_Utils1" = "YYYY年MM月dd日";
|
||||
"NSString_Utils2" = "剛剛";
|
||||
"NSString_Utils3" = "%ld分鐘前";
|
||||
"NSString_Utils4" = "%@萬";
|
||||
|
||||
"QEmotionBoardView0" = "發送";
|
||||
|
||||
@@ -2014,8 +2015,10 @@
|
||||
"XPMonentsAttentionViewController1" = "刪除後不可恢復\n確定刪除該動態嗎";
|
||||
"XPMonentsAttentionViewController2" = "刪除成功";
|
||||
|
||||
"XPMonentsMineViewController0" = "刪除後不可恢復\n確定刪除該動態嗎";
|
||||
///XPMonentsMineViewController.m
|
||||
"XPMonentsMineViewController0" = "刪除後不可恢復\n確定刪除該動態嗎?";
|
||||
"XPMonentsMineViewController1" = "刪除成功";
|
||||
"XPMonentsMineViewController2" = "屏蔽成功";
|
||||
|
||||
"XPMonentsViewController0" = "推薦";
|
||||
"XPMonentsViewController1" = "關註";
|
||||
@@ -2024,25 +2027,31 @@
|
||||
|
||||
"XPMonentsRecommendHeaderView0" = "推薦話題";
|
||||
|
||||
"XPMonentsContentView0" = "展開";
|
||||
"XPMonentsContentView1" = "收起";
|
||||
///XPMonentsContentView.m
|
||||
"XPMonentsContentView0" = "置頂 ";
|
||||
"XPMonentsContentView1" = "展開";
|
||||
"XPMonentsContentView2" = "收起";
|
||||
|
||||
"XPMoentsTopicListView0" = "沒有更多數據了";
|
||||
|
||||
"XPMonentsPublishTopicView0" = "添加話題";
|
||||
"XPMonentsPublishTopicView1" = "重新選擇";
|
||||
|
||||
"XPMonentsUserInfoView0" = "直播中";
|
||||
///XPMonentsUserInfoView.m
|
||||
"XPMonentsUserInfoView0" = "刪除";
|
||||
"XPMonentsUserInfoView1" = "舉報";
|
||||
"XPMonentsUserInfoView2" = "直播中";
|
||||
|
||||
///XPMonentsTooBarView.m
|
||||
"XPMonentsTooBarView0" = "刪除";
|
||||
"XPMonentsTooBarView1" = "舉報";
|
||||
"XPMonentsTooBarView2" = "您的請求我們已經收到,我們將儘快處理";
|
||||
"XPMonentsTooBarView3" = "好友";
|
||||
"XPMonentsTooBarView4" = "朋友圈";
|
||||
"XPMonentsTooBarView5" = "微信好友";
|
||||
"XPMonentsTooBarView6" = "QQ好友";
|
||||
"XPMonentsTooBarView7" = "QQ空間";
|
||||
"XPMonentsTooBarView8" = "%@發佈了一條動態";
|
||||
"XPMonentsTooBarView1" = "舉報動態或用戶";
|
||||
"XPMonentsTooBarView2" = "好友";
|
||||
"XPMonentsTooBarView3" = "朋友圈";
|
||||
"XPMonentsTooBarView4" = "微信好友";
|
||||
"XPMonentsTooBarView5" = "QQ好友";
|
||||
"XPMonentsTooBarView6" = "QQ空間";
|
||||
"XPMonentsTooBarView7" = "%@發佈了一條動態";
|
||||
"XPMonentsTooBarView8" = "屏蔽動態";
|
||||
|
||||
"XPMonentPublishSuccessView0" = "審核中";
|
||||
"XPMonentPublishSuccessView1" = "咻,收到小可愛的動態了呢~\n審核通過後小秘書會幫你發送並通知你哦";
|
||||
@@ -2218,7 +2227,7 @@
|
||||
"LoginVerifCodeViewController4" = "重新獲取";
|
||||
|
||||
"XPLoginViewController11" = "同意隱私政策和用戶協議後,才可以註冊登錄哦~";
|
||||
"XPMonentsMineViewController2" = "刪除後不可恢複\n確定刪除該動態嗎?";
|
||||
|
||||
|
||||
|
||||
"PKLoginViewController1" = "同意隱私政策和用戶協議後,才可以註冊登錄哦~";
|
||||
|