Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
陈高翔
/
DreamSleep-iOS
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 6775a078
由
cgx
编写于
2022-10-11 15:15:06 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
优化动态评论回复显示
1 个父辈
6eba11ea
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
23 个修改的文件
包含
454 行增加
和
136 行删除
DreamSleep/DreamSleep.xcodeproj/project.pbxproj
DreamSleep/DreamSleep/Basement/Category/NSString+Extras.h
DreamSleep/DreamSleep/Basement/Category/NSString+Extras.m
DreamSleep/DreamSleep/Basement/Category/UILabel+Extras.h
DreamSleep/DreamSleep/Basement/Category/UILabel+Extras.m
DreamSleep/DreamSleep/Basement/DSConfig/Info_Debug.plist
DreamSleep/DreamSleep/Class/CommunityModule/Controller/CommunityController.m
DreamSleep/DreamSleep/Class/CommunityModule/Controller/MessageController.h
DreamSleep/DreamSleep/Class/CommunityModule/Controller/MessageController.m
DreamSleep/DreamSleep/Class/CommunityModule/Model/ComReplyModel.h
DreamSleep/DreamSleep/Class/CommunityModule/Model/ComReplyModel.m
DreamSleep/DreamSleep/Class/CommunityModule/View/CommentReplyCell.h
DreamSleep/DreamSleep/Class/CommunityModule/View/CommentReplyCell.m
DreamSleep/DreamSleep/Class/CommunityModule/View/CommentCell.h → DreamSleep/DreamSleep/Class/CommunityModule/View/DynamicCommentCell.h
DreamSleep/DreamSleep/Class/CommunityModule/View/CommentCell.m → DreamSleep/DreamSleep/Class/CommunityModule/View/DynamicCommentCell.m
DreamSleep/DreamSleep/Class/CommunityModule/View/DynamicDetailView.m
DreamSleep/DreamSleep/Class/CommunityModule/View/InteractView.h
DreamSleep/DreamSleep/Class/CommunityModule/View/MessageNotiCell.h
DreamSleep/DreamSleep/Class/CommunityModule/View/MessageNotiCell.m
DreamSleep/DreamSleep/Class/CommunityModule/View/MessageNotiView.h
DreamSleep/DreamSleep/Class/CommunityModule/View/MessageNotiView.m
DreamSleep/DreamSleep/Class/CommunityModule/View/ReplyDetailView.m
DreamSleep/DreamSleep/Class/CommunityModule/View/TextInputAlertView.m
DreamSleep/DreamSleep.xcodeproj/project.pbxproj
查看文件 @
6775a07
此文件的差异被折叠,
点击展开。
DreamSleep/DreamSleep/Basement/Category/NSString+Extras.h
查看文件 @
6775a07
...
@@ -38,6 +38,11 @@ NS_ASSUME_NONNULL_BEGIN
...
@@ -38,6 +38,11 @@ NS_ASSUME_NONNULL_BEGIN
/// 获取格式化时间
/// 获取格式化时间
/// @param time time(单位:s)
/// @param time time(单位:s)
+
(
NSString
*
)
getFormatTime
:(
NSInteger
)
time
;
+
(
NSString
*
)
getFormatTime
:(
NSInteger
)
time
;
/// 计算字符串行数
/// @param width width
/// @param attributes attributes
-
(
NSArray
*
)
getLinesArrayOfStringWidth
:(
CGFloat
)
width
attributes
:(
NSDictionary
*
)
attributes
;
@end
@end
NS_ASSUME_NONNULL_END
NS_ASSUME_NONNULL_END
DreamSleep/DreamSleep/Basement/Category/NSString+Extras.m
查看文件 @
6775a07
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
//
//
#import "NSString+Extras.h"
#import "NSString+Extras.h"
#import <CoreText/CoreText.h>
@implementation
NSString
(
Extras
)
@implementation
NSString
(
Extras
)
...
@@ -60,4 +61,34 @@
...
@@ -60,4 +61,34 @@
return
[
NSString
stringWithFormat
:
@"%02ld:%02ld"
,
minutes
,
seconds
];
return
[
NSString
stringWithFormat
:
@"%02ld:%02ld"
,
minutes
,
seconds
];
}
}
-
(
NSArray
*
)
getLinesArrayOfStringWidth
:(
CGFloat
)
width
attributes
:(
NSDictionary
*
)
attributes
{
NSMutableAttributedString
*
attStr
=
[[
NSMutableAttributedString
alloc
]
initWithString
:
self
attributes
:
attributes
];
CTFramesetterRef
frameSetter
=
CTFramesetterCreateWithAttributedString
((
CFAttributedStringRef
)
attStr
);
CGMutablePathRef
path
=
CGPathCreateMutable
();
CGPathAddRect
(
path
,
NULL
,
CGRectMake
(
0
,
0
,
width
,
100000
));
CTFrameRef
frame
=
CTFramesetterCreateFrame
(
frameSetter
,
CFRangeMake
(
0
,
0
),
path
,
NULL
);
NSArray
*
lines
=
(
NSArray
*
)
CTFrameGetLines
(
frame
);
NSMutableArray
*
linesArray
=
[[
NSMutableArray
alloc
]
init
];
for
(
id
line
in
lines
)
{
CTLineRef
lineRef
=
(
__bridge
CTLineRef
)
line
;
CFRange
lineRange
=
CTLineGetStringRange
(
lineRef
);
NSRange
range
=
NSMakeRange
(
lineRange
.
location
,
lineRange
.
length
);
NSString
*
lineString
=
[
self
substringWithRange
:
range
];
CFAttributedStringSetAttribute
((
CFMutableAttributedStringRef
)
attStr
,
lineRange
,
kCTKernAttributeName
,
(
CFTypeRef
)([
NSNumber
numberWithFloat
:
0
.
0
]));
CFAttributedStringSetAttribute
((
CFMutableAttributedStringRef
)
attStr
,
lineRange
,
kCTKernAttributeName
,
(
CFTypeRef
)([
NSNumber
numberWithInt
:
0
.
0
]));
[
linesArray
addObject
:
lineString
];
}
CGPathRelease
(
path
);
CFRelease
(
frame
);
CFRelease
(
frameSetter
);
return
(
NSArray
*
)
linesArray
;
}
@end
@end
DreamSleep/DreamSleep/Basement/Category/UILabel+Extras.h
查看文件 @
6775a07
...
@@ -25,8 +25,10 @@ NS_ASSUME_NONNULL_BEGIN
...
@@ -25,8 +25,10 @@ NS_ASSUME_NONNULL_BEGIN
+
(
UILabel
*
)
labWithText
:(
NSString
*
)
text
font
:(
UIFont
*
)
font
fit
:(
BOOL
)
fit
;
+
(
UILabel
*
)
labWithText
:(
NSString
*
)
text
font
:(
UIFont
*
)
font
fit
:(
BOOL
)
fit
;
// 根据
文本
及字体计算UILabel的高度
// 根据
text
及字体计算UILabel的高度
+
(
CGFloat
)
getHeightByWidth
:(
CGFloat
)
width
text
:(
NSString
*
)
text
font
:(
UIFont
*
)
font
;
+
(
CGFloat
)
getHeightByWidth
:(
CGFloat
)
width
text
:(
NSString
*
)
text
font
:(
UIFont
*
)
font
;
// 根据attributedText及字体计算UILabel的高度
+
(
CGFloat
)
getHeightByWidth
:(
CGFloat
)
width
attributedText
:(
NSAttributedString
*
)
attributedText
font
:(
UIFont
*
)
font
;
// 根据文本及字体计算UILabel的宽度
// 根据文本及字体计算UILabel的宽度
+
(
CGFloat
)
getWidthWithText
:(
NSString
*
)
text
font
:(
UIFont
*
)
font
;
+
(
CGFloat
)
getWidthWithText
:(
NSString
*
)
text
font
:(
UIFont
*
)
font
;
@end
@end
...
...
DreamSleep/DreamSleep/Basement/Category/UILabel+Extras.m
查看文件 @
6775a07
...
@@ -54,8 +54,7 @@
...
@@ -54,8 +54,7 @@
return
lab
;
return
lab
;
}
}
+
(
CGFloat
)
getHeightByWidth
:(
CGFloat
)
width
text
:(
NSString
*
)
text
font
:(
UIFont
*
)
font
+
(
CGFloat
)
getHeightByWidth
:(
CGFloat
)
width
text
:(
NSString
*
)
text
font
:(
UIFont
*
)
font
{
{
UILabel
*
label
=
[[
UILabel
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
width
,
0
)];
UILabel
*
label
=
[[
UILabel
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
width
,
0
)];
label
.
text
=
text
;
label
.
text
=
text
;
label
.
font
=
font
;
label
.
font
=
font
;
...
@@ -65,6 +64,16 @@
...
@@ -65,6 +64,16 @@
return
ceil
(
height
);
return
ceil
(
height
);
}
}
+
(
CGFloat
)
getHeightByWidth
:(
CGFloat
)
width
attributedText
:(
NSAttributedString
*
)
attributedText
font
:(
UIFont
*
)
font
{
UILabel
*
label
=
[[
UILabel
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
width
,
0
)];
label
.
attributedText
=
attributedText
;
label
.
font
=
font
;
label
.
numberOfLines
=
0
;
[
label
sizeToFit
];
CGFloat
height
=
label
.
frame
.
size
.
height
;
return
ceil
(
height
);
}
+
(
CGFloat
)
getWidthWithText
:(
NSString
*
)
text
font
:(
UIFont
*
)
font
{
+
(
CGFloat
)
getWidthWithText
:(
NSString
*
)
text
font
:(
UIFont
*
)
font
{
UILabel
*
label
=
[[
UILabel
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
1000
,
0
)];
UILabel
*
label
=
[[
UILabel
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
1000
,
0
)];
label
.
text
=
text
;
label
.
text
=
text
;
...
...
DreamSleep/DreamSleep/Basement/DSConfig/Info_Debug.plist
查看文件 @
6775a07
...
@@ -91,6 +91,10 @@
...
@@ -91,6 +91,10 @@
<key>
NSAllowsArbitraryLoads
</key>
<key>
NSAllowsArbitraryLoads
</key>
<true/>
<true/>
</dict>
</dict>
<key>
NSBonjourServices
</key>
<array>
<string>
_dartobservatory._tcp
</string>
</array>
<key>
Privacy - Photo Library Additions Usage Description
</key>
<key>
Privacy - Photo Library Additions Usage Description
</key>
<string>
APP需要您的同意,才能访问相册。
</string>
<string>
APP需要您的同意,才能访问相册。
</string>
<key>
UIBackgroundModes
</key>
<key>
UIBackgroundModes
</key>
...
@@ -99,11 +103,5 @@
...
@@ -99,11 +103,5 @@
</array>
</array>
<key>
UIStatusBarStyle
</key>
<key>
UIStatusBarStyle
</key>
<string>
UIStatusBarStyleLightContent
</string>
<string>
UIStatusBarStyleLightContent
</string>
<key>
NSBonjourServices
</key>
<array>
<string>
_dartobservatory._tcp
</string>
</array>
<key>
NSLocalNetworkUsageDescription
</key>
<string>
需要访问本地网络权限
</string>
</dict>
</dict>
</plist>
</plist>
DreamSleep/DreamSleep/Class/CommunityModule/Controller/CommunityController.m
查看文件 @
6775a07
...
@@ -9,13 +9,12 @@
...
@@ -9,13 +9,12 @@
#import "CommunityView.h"
#import "CommunityView.h"
#import "ComListViewModel.h"
#import "ComListViewModel.h"
#import "DynamicController.h"
#import "DynamicController.h"
#import "
TestFlutter
Controller.h"
#import "
Message
Controller.h"
#import "ReportController.h"
#import "ReportController.h"
#import "DynamicDetailController.h"
#import "DynamicDetailController.h"
@interface
CommunityController
()
<
CommunityViewDelegate
,
DynamicControllerDelegate
,
DynamicDetailControllerDelegate
>
@interface
CommunityController
()
<
CommunityViewDelegate
,
DynamicControllerDelegate
,
DynamicDetailControllerDelegate
>
@property
(
nonatomic
,
strong
)
CommunityView
*
communityView
;
@property
(
nonatomic
,
strong
)
CommunityView
*
communityView
;
@property
(
nonatomic
,
strong
)
TestFlutterController
*
flutterEngine
;
@property
(
nonatomic
,
assign
)
int
offset
;
@property
(
nonatomic
,
assign
)
int
offset
;
@property
(
nonatomic
,
strong
)
NSURLSessionDataTask
*
likeDataTask
;
@property
(
nonatomic
,
strong
)
NSURLSessionDataTask
*
likeDataTask
;
/// 存储动态id
/// 存储动态id
...
@@ -54,8 +53,7 @@
...
@@ -54,8 +53,7 @@
[
LoginUtils
jumpToLoginControllerWithTarget
:
self
];
[
LoginUtils
jumpToLoginControllerWithTarget
:
self
];
return
;
return
;
}
}
self
.
flutterEngine
=
[
TestFlutterController
new
];
[
self
.
navigationController
pushViewController
:[
MessageController
new
]
animated
:
YES
];
[
self
.
navigationController
pushViewController
:
self
.
flutterEngine
animated
:
YES
];
}
}
#pragma mark - CommunityViewDelegate
#pragma mark - CommunityViewDelegate
...
...
DreamSleep/DreamSleep/Class/CommunityModule/Controller/MessageController.h
0 → 100644
查看文件 @
6775a07
//
// MessageController.h
// DreamSleep
//
// Created by peter on 2022/10/10.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
/// 社区消息通知页面
@interface
MessageController
:
UIViewController
@end
NS_ASSUME_NONNULL_END
DreamSleep/DreamSleep/Class/CommunityModule/Controller/MessageController.m
0 → 100644
查看文件 @
6775a07
//
// MessageController.m
// DreamSleep
//
// Created by peter on 2022/10/10.
//
#import "MessageController.h"
#import "MessageNotiView.h"
@interface
MessageController
()
<
MessageNotiViewDelegate
>
@property
(
nonatomic
,
strong
)
MessageNotiView
*
messageNotiView
;
@end
@implementation
MessageController
-
(
void
)
loadView
{
self
.
view
=
self
.
messageNotiView
;
}
-
(
void
)
viewDidLoad
{
[
super
viewDidLoad
];
self
.
navigationItem
.
title
=
@"消息中心"
;
}
#pragma mark - 品牌模式
-
(
NaviStyle
)
navigationBarStyle
{
return
NaviStyleDefault
;
}
#pragma mark - lazy
-
(
MessageNotiView
*
)
messageNotiView
{
if
(
!
_messageNotiView
)
{
_messageNotiView
=
[[
MessageNotiView
alloc
]
initWithDelegate
:
self
];
}
return
_messageNotiView
;
}
@end
DreamSleep/DreamSleep/Class/CommunityModule/Model/ComReplyModel.h
查看文件 @
6775a07
...
@@ -9,10 +9,6 @@
...
@@ -9,10 +9,6 @@
#import "CommentModel.h"
#import "CommentModel.h"
#import "ReplyModel.h"
#import "ReplyModel.h"
#define kContentLeftMargin 84
#define kContentRightMargin 30
#define kMaxContentHeight 40
NS_ASSUME_NONNULL_BEGIN
NS_ASSUME_NONNULL_BEGIN
FOUNDATION_EXTERN
UIFont
*
const
CommentContentFont
;
FOUNDATION_EXTERN
UIFont
*
const
CommentContentFont
;
...
@@ -23,23 +19,23 @@ FOUNDATION_EXTERN UIFont * const CommentContentFont;
...
@@ -23,23 +19,23 @@ FOUNDATION_EXTERN UIFont * const CommentContentFont;
@property
(
nonatomic
,
strong
)
CommentModel
*
commentModel
;
@property
(
nonatomic
,
strong
)
CommentModel
*
commentModel
;
/// 回复model
/// 回复model
@property
(
nonatomic
,
strong
)
ReplyModel
*
replyModel
;
@property
(
nonatomic
,
strong
)
ReplyModel
*
replyModel
;
/// 是否展开全部评论内容
@property
(
nonatomic
,
assign
)
BOOL
isShowAllCommentContent
;
-
(
NSString
*
)
replyNickName
;
-
(
NSString
*
)
replyNickName
;
+
(
UIFont
*
)
commentContentFont
;
+
(
UIFont
*
)
commentContentFont
;
+
(
UIFont
*
)
replayNickNameFont
;
+
(
UIFont
*
)
replyNickNameFont
;
+
(
UIFont
*
)
replayContentFont
;
+
(
UIFont
*
)
replyContentFont
;
-
(
NSAttributedString
*
)
replyContentAttriStr
;
-
(
CGFloat
)
commentContentLeftMargin
;
-
(
CGFloat
)
commentContentRightMargin
;
-
(
CGFloat
)
commentContentHeight
;
-
(
CGFloat
)
commentContentHeight
;
-
(
CGFloat
)
showAllBtnHeight
;
-
(
CGFloat
)
replyNickNameW
;
-
(
CGFloat
)
replayNickNameW
;
-
(
CGSize
)
replyContentSize
;
-
(
CGSize
)
replayContentSize
;
-
(
CGFloat
)
replyViewHeight
;
-
(
CGFloat
)
replyViewHeight
;
-
(
CGFloat
)
commentCellHeight
;
-
(
CGFloat
)
commentCellHeight
;
-
(
BOOL
)
isHiddenShowAllBtn
;
@end
@end
NS_ASSUME_NONNULL_END
NS_ASSUME_NONNULL_END
DreamSleep/DreamSleep/Class/CommunityModule/Model/ComReplyModel.m
查看文件 @
6775a07
...
@@ -7,14 +7,19 @@
...
@@ -7,14 +7,19 @@
#import "ComReplyModel.h"
#import "ComReplyModel.h"
// 回复内容显示最大行数
#define kMaxReplyLine 2
@implementation
ComReplyModel
@implementation
ComReplyModel
#pragma mark - 模型字段映射
+
(
nullable
NSDictionary
<
NSString
*
,
id
>
*
)
modelCustomPropertyMapper
{
+
(
nullable
NSDictionary
<
NSString
*
,
id
>
*
)
modelCustomPropertyMapper
{
return
@{
@"commentModel"
:
@"comment"
,
return
@{
@"commentModel"
:
@"comment"
,
@"replyModel"
:
@"reply"
@"replyModel"
:
@"reply"
};
};
}
}
#pragma mark - public
-
(
NSString
*
)
replyNickName
{
-
(
NSString
*
)
replyNickName
{
return
[
NSString
stringWithFormat
:
@"%@:"
,
self
.
replyModel
.
nick_name
];
return
[
NSString
stringWithFormat
:
@"%@:"
,
self
.
replyModel
.
nick_name
];
}
}
...
@@ -23,41 +28,65 @@
...
@@ -23,41 +28,65 @@
return
SysFont
(
14
);
return
SysFont
(
14
);
}
}
+
(
UIFont
*
)
repl
a
yNickNameFont
{
+
(
UIFont
*
)
replyNickNameFont
{
return
SysFont
(
15
);
return
SysFont
(
15
);
}
}
+
(
UIFont
*
)
repl
a
yContentFont
{
+
(
UIFont
*
)
replyContentFont
{
return
SysFont
(
14
);
return
SysFont
(
14
);
}
}
-
(
CGFloat
)
commentContentHeight
{
-
(
NSAttributedString
*
)
replyContentAttriStr
{
CGFloat
contentW
=
kScreenWidth
-
kContentLeftMargin
-
kContentRightMargin
;
NSString
*
replyContentStr
=
self
.
replyModel
.
content
?
self
.
replyModel
.
content
:
@""
;
NSString
*
content
=
self
.
commentModel
.
content
;
NSMutableAttributedString
*
replyAttStr
=
[[
NSMutableAttributedString
alloc
]
initWithString
:
replyContentStr
attributes
:[
self
replyContentAttributes
:
NO
]];
CGFloat
commentH
=
[
UILabel
getHeightByWidth
:
contentW
text
:
content
font
:
[
ComReplyModel
commentContentFont
]];
return
self
.
isShowAllCommentContent
?
commentH
:
(
commentH
>
kMaxContentHeight
?
kMaxContentHeight
:
commentH
);
if
([
self
replyContentMaxLines
].
count
>
kMaxReplyLine
)
{
// 1、获取显示最多行字符串
NSMutableString
*
mLineStr
=
[
NSMutableString
string
];
for
(
NSInteger
i
=
0
;
i
<
kMaxReplyLine
;
i
++
)
{
[
mLineStr
appendString
:[
self
replyContentMaxLines
][
i
]];
}
// 2、截取字符串最后1个位置,用于填充自定义富文本
NSString
*
subLineStr
=
[
mLineStr
substringWithRange
:
NSMakeRange
(
0
,
mLineStr
.
length
-
1
)];
// 3、将subLineStr转换未富文本
replyAttStr
=
[[
NSMutableAttributedString
alloc
]
initWithString
:
subLineStr
attributes
:[
self
replyContentAttributes
:
NO
]];
// 4、自定义结尾富文本
NSMutableAttributedString
*
dotAtrStr
=
[[
NSMutableAttributedString
alloc
]
initWithString
:
@"..."
attributes
:[
self
replyContentAttributes
:
YES
]];
[
replyAttStr
appendAttributedString
:
dotAtrStr
.
copy
];
}
return
replyAttStr
.
copy
;
}
}
-
(
CGFloat
)
showAllBtnHeight
{
-
(
CGFloat
)
commentContentLeftMargin
{
return
[
self
isHiddenShowAllBtn
]
?
0
:
10
;
return
84
;
}
}
-
(
CGFloat
)
replayNickNameW
{
-
(
CGFloat
)
commentContentRightMargin
{
CGFloat
replayNameLabW
=
[
UILabel
getWidthWithText
:[
self
replyNickName
]
font
:[
ComReplyModel
replayNickNameFont
]];
return
30
;
return
replayNameLabW
>
75
?
75
:
replayNameLabW
;
}
-
(
CGFloat
)
commentContentHeight
{
CGFloat
commentContentW
=
kScreenWidth
-
[
self
commentContentLeftMargin
]
-
[
self
commentContentRightMargin
];
NSString
*
content
=
self
.
commentModel
.
content
;
return
[
UILabel
getHeightByWidth
:
commentContentW
text
:
content
font
:
[
ComReplyModel
commentContentFont
]];
}
}
-
(
CGSize
)
replayContentSize
{
-
(
CGFloat
)
replyNickNameW
{
CGFloat
replayContentW
=
kScreenWidth
-
kContentLeftMargin
-
kContentRightMargin
-
[
self
replayNickNameW
]
-
16
;
CGFloat
replyNameLabW
=
[
UILabel
getWidthWithText
:[
self
replyNickName
]
font
:[
ComReplyModel
replyNickNameFont
]];
CGFloat
replayContentH
=
[
UILabel
getHeightByWidth
:
replayContentW
text
:
self
.
replyModel
.
content
font
:
[
ComReplyModel
replayContentFont
]];
return
replyNameLabW
>
75
?
75
:
replyNameLabW
;
replayContentH
=
replayContentH
>
kMaxContentHeight
?
:
replayContentH
;
}
return
CGSizeMake
(
replayContentW
,
replayContentH
);
-
(
CGSize
)
replyContentSize
{
CGFloat
replyContentW
=
[
self
replyContentMaxW
];
CGFloat
replyContentH
=
[
UILabel
getHeightByWidth
:
replyContentW
attributedText
:[
self
replyContentAttriStr
]
font
:
[
ComReplyModel
replyContentFont
]];
return
CGSizeMake
(
replyContentW
,
replyContentH
);
}
}
-
(
CGFloat
)
replyViewHeight
{
-
(
CGFloat
)
replyViewHeight
{
CGFloat
replayViewH
=
0
;
CGFloat
replayViewH
=
0
;
if
(
self
.
replyModel
)
{
if
(
self
.
replyModel
)
{
replayViewH
=
9
+
[
self
repl
a
yContentSize
].
height
+
(
self
.
commentModel
.
total_replys
>
1
?
37
:
9
);
replayViewH
=
9
+
[
self
replyContentSize
].
height
+
(
self
.
commentModel
.
total_replys
>
1
?
37
:
9
);
}
}
return
replayViewH
;
return
replayViewH
;
}
}
...
@@ -67,20 +96,31 @@
...
@@ -67,20 +96,31 @@
CGFloat
commentH
=
[
self
commentContentHeight
];
CGFloat
commentH
=
[
self
commentContentHeight
];
CGFloat
replayViewH
=
[
self
replyViewHeight
]
+
(
self
.
replyModel
?
12
:
0
);
CGFloat
replayViewH
=
[
self
replyViewHeight
]
+
(
self
.
replyModel
?
12
:
0
);
CGFloat
bottomMargin
=
15
;
CGFloat
bottomMargin
=
15
;
CGFloat
showAllBtnH
=
[
self
showAllBtnHeight
];
return
topH
+
commentH
+
replayViewH
+
bottomMargin
;
return
topH
+
commentH
+
showAllBtnH
+
replayViewH
+
bottomMargin
;
}
#pragma mark - private
-
(
NSArray
*
)
replyContentMaxLines
{
return
[
self
.
replyModel
.
content
getLinesArrayOfStringWidth
:[
self
replyContentMaxW
]
attributes
:@{
NSFontAttributeName
:
[
ComReplyModel
replyContentFont
]}];
}
}
-
(
BOOL
)
isHiddenShowAllBtn
{
-
(
CGFloat
)
replyContentMaxW
{
if
(
self
.
isShowAllCommentContent
)
{
return
kScreenWidth
-
[
self
commentContentLeftMargin
]
-
[
self
commentContentRightMargin
]
-
[
self
replyNickNameW
]
-
16
;
return
YES
;
}
-
(
NSDictionary
*
)
replyContentAttributes
:
(
BOOL
)
isTail
{
NSMutableParagraphStyle
*
paragraphStyle
=
[[
NSMutableParagraphStyle
alloc
]
init
];
paragraphStyle
.
minimumLineHeight
=
[
ComReplyModel
replyContentFont
].
lineHeight
;
paragraphStyle
.
maximumLineHeight
=
[
ComReplyModel
replyContentFont
].
lineHeight
;
paragraphStyle
.
alignment
=
NSTextAlignmentLeft
;
NSMutableDictionary
*
mAttributes
=
[
NSMutableDictionary
dictionaryWithDictionary
:
@{
NSFontAttributeName
:
[
ComReplyModel
replyContentFont
],
NSParagraphStyleAttributeName
:
paragraphStyle
}];
// 只有1条回复高亮...
if
(
isTail
&&
self
.
commentModel
.
total_replys
<
2
)
{
[
mAttributes
setObject
:
BrandColor
forKey
:
NSForegroundColorAttributeName
];
}
}
// 只有评论没有回复并且评论内容只显示一部分,则"显示全部"按钮显示
return
mAttributes
.
copy
;
CGFloat
contentW
=
kScreenWidth
-
kContentLeftMargin
-
kContentRightMargin
;
NSString
*
content
=
self
.
commentModel
.
content
;
CGFloat
commentH
=
[
UILabel
getHeightByWidth
:
contentW
text
:
content
font
:
[
ComReplyModel
commentContentFont
]];
BOOL
isGreaterMax
=
commentH
>
kMaxContentHeight
;
return
!
(
self
.
commentModel
&&
self
.
replyModel
==
nil
&&
isGreaterMax
);
}
}
@end
@end
DreamSleep/DreamSleep/Class/CommunityModule/View/CommentReplyCell.h
0 → 100644
查看文件 @
6775a07
//
// CommentReplyCell.h
// DreamSleep
//
// Created by peter on 2022/10/10.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
/// 消息中心评论回复cell
@interface
CommentReplyCell
:
UITableViewCell
@end
NS_ASSUME_NONNULL_END
DreamSleep/DreamSleep/Class/CommunityModule/View/CommentReplyCell.m
0 → 100644
查看文件 @
6775a07
//
// CommentReplyCell.m
// DreamSleep
//
// Created by peter on 2022/10/10.
//
#import "CommentReplyCell.h"
@implementation
CommentReplyCell
-
(
void
)
awakeFromNib
{
[
super
awakeFromNib
];
// Initialization code
}
-
(
void
)
setSelected
:
(
BOOL
)
selected
animated
:
(
BOOL
)
animated
{
[
super
setSelected
:
selected
animated
:
animated
];
// Configure the view for the selected state
}
@end
DreamSleep/DreamSleep/Class/CommunityModule/View/CommentCell.h
→
DreamSleep/DreamSleep/Class/CommunityModule/View/
Dynamic
CommentCell.h
查看文件 @
6775a07
//
//
// CommentCell.h
//
Dynamic
CommentCell.h
// DreamSleep
// DreamSleep
//
//
// Created by peter on 2022/10/8.
// Created by peter on 2022/10/8.
...
@@ -8,22 +8,18 @@
...
@@ -8,22 +8,18 @@
#import <UIKit/UIKit.h>
#import <UIKit/UIKit.h>
#import "ComReplyModel.h"
#import "ComReplyModel.h"
/// 用户点击评论内容回调
typedef
void
(
^
TapCommentContentLabBlock
)(
void
);
/// 显示全部评论内容回调
typedef
void
(
^
TapAllCommentContentBlock
)(
void
);
/// 查看评论所有回复内容回调
/// 查看评论所有回复内容回调
typedef
void
(
^
LookAllRelpyListBlock
)(
void
);
typedef
void
(
^
LookAllRelpyListBlock
)(
void
);
NS_ASSUME_NONNULL_BEGIN
NS_ASSUME_NONNULL_BEGIN
/// 评论、部分回复cell
/// 动态评论、部分回复cell
@interface
CommentCell
:
UITableViewCell
@interface
DynamicCommentCell
:
UITableViewCell
@property
(
nonatomic
,
strong
)
ComReplyModel
*
comReplyModel
;
@property
(
nonatomic
,
strong
)
ComReplyModel
*
comReplyModel
;
@property
(
nonatomic
,
copy
)
TapCommentContentLabBlock
tapCommentContentLabBlock
;
@property
(
nonatomic
,
copy
)
TapAllCommentContentBlock
tapAllCommentContentBlock
;
@property
(
nonatomic
,
copy
)
LookAllRelpyListBlock
lookAllRelpyListBlock
;
@property
(
nonatomic
,
copy
)
LookAllRelpyListBlock
lookAllRelpyListBlock
;
@end
@end
NS_ASSUME_NONNULL_END
NS_ASSUME_NONNULL_END
DreamSleep/DreamSleep/Class/CommunityModule/View/CommentCell.m
→
DreamSleep/DreamSleep/Class/CommunityModule/View/
Dynamic
CommentCell.m
查看文件 @
6775a07
//
//
// CommentCell.m
//
Dynamic
CommentCell.m
// DreamSleep
// DreamSleep
//
//
// Created by peter on 2022/10/8.
// Created by peter on 2022/10/8.
//
//
#import "CommentCell.h"
#import "
Dynamic
CommentCell.h"
@interface
CommentCell
()
@interface
Dynamic
CommentCell
()
@property
(
nonatomic
,
strong
)
UIImageView
*
userIcon
;
@property
(
nonatomic
,
strong
)
UIImageView
*
userIcon
;
@property
(
nonatomic
,
strong
)
UILabel
*
userNameLab
;
@property
(
nonatomic
,
strong
)
UILabel
*
userNameLab
;
@property
(
nonatomic
,
strong
)
UILabel
*
timeLab
;
@property
(
nonatomic
,
strong
)
UILabel
*
timeLab
;
@property
(
nonatomic
,
strong
)
UILabel
*
commentContentLab
;
@property
(
nonatomic
,
strong
)
UILabel
*
commentContentLab
;
@property
(
nonatomic
,
strong
)
UIButton
*
showAllBtn
;
@property
(
nonatomic
,
strong
)
UIView
*
replyView
;
@property
(
nonatomic
,
strong
)
UIView
*
replyView
;
@property
(
nonatomic
,
strong
)
UILabel
*
replyUserLab
;
@property
(
nonatomic
,
strong
)
UILabel
*
replyUserLab
;
@property
(
nonatomic
,
strong
)
UILabel
*
replyContentLab
;
@property
(
nonatomic
,
strong
)
UILabel
*
replyContentLab
;
@property
(
nonatomic
,
strong
)
UIButton
*
totalReplyBtn
;
@property
(
nonatomic
,
strong
)
UIButton
*
totalReplyBtn
;
@end
@end
@implementation
CommentCell
@implementation
Dynamic
CommentCell
-
(
instancetype
)
initWithStyle
:(
UITableViewCellStyle
)
style
reuseIdentifier
:(
NSString
*
)
reuseIdentifier
{
-
(
instancetype
)
initWithStyle
:(
UITableViewCellStyle
)
style
reuseIdentifier
:(
NSString
*
)
reuseIdentifier
{
if
(
self
=
[
super
initWithStyle
:
style
reuseIdentifier
:
reuseIdentifier
])
{
if
(
self
=
[
super
initWithStyle
:
style
reuseIdentifier
:
reuseIdentifier
])
{
...
@@ -30,7 +29,6 @@
...
@@ -30,7 +29,6 @@
[
self
.
contentView
addSubview
:
self
.
userNameLab
];
[
self
.
contentView
addSubview
:
self
.
userNameLab
];
[
self
.
contentView
addSubview
:
self
.
timeLab
];
[
self
.
contentView
addSubview
:
self
.
timeLab
];
[
self
.
contentView
addSubview
:
self
.
commentContentLab
];
[
self
.
contentView
addSubview
:
self
.
commentContentLab
];
[
self
.
contentView
addSubview
:
self
.
showAllBtn
];
[
self
.
contentView
addSubview
:
self
.
replyView
];
[
self
.
contentView
addSubview
:
self
.
replyView
];
[
self
.
userIcon
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
[
self
.
userIcon
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
...
@@ -58,39 +56,32 @@
...
@@ -58,39 +56,32 @@
self
.
userNameLab
.
text
=
comReplyModel
.
commentModel
.
nick_name
;
self
.
userNameLab
.
text
=
comReplyModel
.
commentModel
.
nick_name
;
self
.
timeLab
.
text
=
comReplyModel
.
commentModel
.
publish_time
;
self
.
timeLab
.
text
=
comReplyModel
.
commentModel
.
publish_time
;
self
.
commentContentLab
.
text
=
comReplyModel
.
commentModel
.
content
;
self
.
commentContentLab
.
text
=
comReplyModel
.
commentModel
.
content
;
self
.
showAllBtn
.
hidden
=
[
comReplyModel
isHiddenShowAllBtn
];
self
.
replyUserLab
.
text
=
[
comReplyModel
replyNickName
];
self
.
replyUserLab
.
text
=
[
comReplyModel
replyNickName
];
self
.
replyContentLab
.
text
=
comReplyModel
.
replyModel
.
content
;
self
.
replyContentLab
.
attributedText
=
[
comReplyModel
replyContentAttriStr
]
;
[
self
.
totalReplyBtn
setTitle
:[
NSString
stringWithFormat
:
@"共%d条回复>"
,
comReplyModel
.
commentModel
.
total_replys
]
forState
:
UIControlStateNormal
];
[
self
.
totalReplyBtn
setTitle
:[
NSString
stringWithFormat
:
@"共%d条回复>"
,
comReplyModel
.
commentModel
.
total_replys
]
forState
:
UIControlStateNormal
];
self
.
totalReplyBtn
.
hidden
=
comReplyModel
.
commentModel
.
total_replys
>
1
?
NO
:
YES
;
self
.
totalReplyBtn
.
hidden
=
comReplyModel
.
commentModel
.
total_replys
>
1
?
NO
:
YES
;
[
self
.
commentContentLab
mas_remakeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
[
self
.
commentContentLab
mas_remakeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
top
.
equalTo
(
self
.
userIcon
.
mas_bottom
).
offset
(
8
);
make
.
top
.
equalTo
(
self
.
userIcon
.
mas_bottom
).
offset
(
8
);
make
.
left
.
equalTo
(
self
.
contentView
).
offset
(
kContentLeftMargin
);
make
.
left
.
equalTo
(
self
.
contentView
).
offset
(
[
comReplyModel
commentContentLeftMargin
]
);
make
.
right
.
equalTo
(
self
.
contentView
).
offset
(
-
kContentRightMargin
);
make
.
right
.
equalTo
(
self
.
contentView
).
offset
(
-
[
comReplyModel
commentContentRightMargin
]
);
make
.
height
.
equalTo
(
@
([
comReplyModel
commentContentHeight
]));
make
.
height
.
equalTo
(
@
([
comReplyModel
commentContentHeight
]));
}];
}];
[
self
.
showAllBtn
mas_remakeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
top
.
equalTo
(
self
.
commentContentLab
.
mas_bottom
);
make
.
right
.
equalTo
(
self
.
commentContentLab
);
make
.
height
.
equalTo
(
@
([
comReplyModel
showAllBtnHeight
]));
}];
[
self
.
replyView
mas_remakeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
[
self
.
replyView
mas_remakeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
top
.
equalTo
(
self
.
showAllBtn
.
mas_bottom
).
offset
(
12
);
make
.
top
.
equalTo
(
self
.
commentContentLab
.
mas_bottom
).
offset
(
12
);
make
.
left
.
right
.
equalTo
(
self
.
commentContentLab
);
make
.
left
.
right
.
equalTo
(
self
.
commentContentLab
);
make
.
height
.
equalTo
(
@
([
comReplyModel
replyViewHeight
]));
make
.
height
.
equalTo
(
@
([
comReplyModel
replyViewHeight
]));
}];
}];
[
self
.
replyUserLab
mas_remakeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
[
self
.
replyUserLab
mas_remakeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
top
.
equalTo
(
self
.
replyView
).
offset
(
8
);
make
.
top
.
equalTo
(
self
.
replyView
).
offset
(
8
);
make
.
left
.
equalTo
(
self
.
replyView
).
offset
(
8
);
make
.
left
.
equalTo
(
self
.
replyView
).
offset
(
8
);
make
.
width
.
equalTo
(
@
([
comReplyModel
repl
a
yNickNameW
]));
make
.
width
.
equalTo
(
@
([
comReplyModel
replyNickNameW
]));
}];
}];
[
self
.
replyContentLab
mas_remakeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
[
self
.
replyContentLab
mas_remakeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
top
.
equalTo
(
self
.
reply
View
).
offset
(
9
);
make
.
top
.
equalTo
(
self
.
reply
UserLab
);
make
.
left
.
equalTo
(
self
.
replyUserLab
.
mas_right
);
make
.
left
.
equalTo
(
self
.
replyUserLab
.
mas_right
);
make
.
size
.
mas_equalTo
([
comReplyModel
repl
a
yContentSize
]);
make
.
size
.
mas_equalTo
([
comReplyModel
replyContentSize
]);
}];
}];
[
self
.
totalReplyBtn
mas_remakeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
[
self
.
totalReplyBtn
mas_remakeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
left
.
equalTo
(
self
.
replyUserLab
);
make
.
left
.
equalTo
(
self
.
replyUserLab
);
...
@@ -99,9 +90,9 @@
...
@@ -99,9 +90,9 @@
}
}
#pragma mark - private
#pragma mark - private
-
(
void
)
popReplyInputView
{
-
(
void
)
lookAllRelpyList
{
if
(
self
.
tapCommentContentLab
Block
)
{
if
(
self
.
lookAllRelpyList
Block
)
{
self
.
tapCommentContentLab
Block
();
self
.
lookAllRelpyList
Block
();
}
}
}
}
...
@@ -137,50 +128,32 @@
...
@@ -137,50 +128,32 @@
_commentContentLab
.
dk_textColorPicker
=
DKColorPickerWithColors
(
MainTextColor
,
ColorFromHexA
(
0xFFFFFF
,
.
5
),
DSWhite
);
_commentContentLab
.
dk_textColorPicker
=
DKColorPickerWithColors
(
MainTextColor
,
ColorFromHexA
(
0xFFFFFF
,
.
5
),
DSWhite
);
_commentContentLab
.
numberOfLines
=
0
;
_commentContentLab
.
numberOfLines
=
0
;
_commentContentLab
.
userInteractionEnabled
=
YES
;
_commentContentLab
.
userInteractionEnabled
=
YES
;
UITapGestureRecognizer
*
tapGR
=
[[
UITapGestureRecognizer
alloc
]
initWithTarget
:
self
action
:
@selector
(
popReplyInputView
)];
[
_commentContentLab
addGestureRecognizer
:
tapGR
];
}
}
return
_commentContentLab
;
return
_commentContentLab
;
}
}
-
(
UIButton
*
)
showAllBtn
{
if
(
!
_showAllBtn
)
{
WS
(
weakSelf
);
_showAllBtn
=
[
UIButton
btnWithTitle
:
@"显示全部"
titleColor
:
BrandColor
font
:
SysFont
(
10
)];
[
_showAllBtn
addTouchUpInsideHandler
:
^
(
NSInteger
tag
)
{
if
(
weakSelf
.
tapAllCommentContentBlock
)
{
weakSelf
.
tapAllCommentContentBlock
();
}
}];
}
return
_showAllBtn
;
}
-
(
UIView
*
)
replyView
{
-
(
UIView
*
)
replyView
{
if
(
!
_replyView
)
{
if
(
!
_replyView
)
{
_replyView
=
[
UIView
new
];
_replyView
=
[
UIView
new
];
[
_replyView
cornerRadius
:
12
];
[
_replyView
cornerRadius
:
12
];
_replyView
.
dk_backgroundColorPicker
=
DKColorPickerWithColors
(
BGColor
,
CornerViewDarkColor
,
BGColor
);
_replyView
.
dk_backgroundColorPicker
=
DKColorPickerWithColors
(
BGColor
,
CornerViewDarkColor
,
BGColor
);
UITapGestureRecognizer
*
tapGR
=
[[
UITapGestureRecognizer
alloc
]
initWithTarget
:
self
action
:
@selector
(
lookAllRelpyList
)];
[
_replyView
addGestureRecognizer
:
tapGR
];
UILabel
*
replyUserLab
=
[
UILabel
labWithFont
:[
ComReplyModel
repl
a
yNickNameFont
]];
UILabel
*
replyUserLab
=
[
UILabel
labWithFont
:[
ComReplyModel
replyNickNameFont
]];
replyUserLab
.
dk_textColorPicker
=
DKColorPickerWithColors
(
SubTitleColor
,
DkTitleColor
,
DSWhite
);
replyUserLab
.
dk_textColorPicker
=
DKColorPickerWithColors
(
SubTitleColor
,
DkTitleColor
,
DSWhite
);
[
_replyView
addSubview
:
replyUserLab
];
[
_replyView
addSubview
:
replyUserLab
];
self
.
replyUserLab
=
replyUserLab
;
self
.
replyUserLab
=
replyUserLab
;
UILabel
*
replyContentLab
=
[
UILabel
labWithFont
:[
ComReplyModel
repl
a
yContentFont
]];
UILabel
*
replyContentLab
=
[
UILabel
labWithFont
:[
ComReplyModel
replyContentFont
]];
replyContentLab
.
numberOfLines
=
0
;
replyContentLab
.
numberOfLines
=
0
;
replyContentLab
.
dk_textColorPicker
=
DKColorPickerWithColors
(
MainTextColor
,
ColorFromHexA
(
0xFFFFFF
,
.
5
),
DSWhite
);
replyContentLab
.
dk_textColorPicker
=
DKColorPickerWithColors
(
MainTextColor
,
ColorFromHexA
(
0xFFFFFF
,
.
5
),
DSWhite
);
[
_replyView
addSubview
:
replyContentLab
];
[
_replyView
addSubview
:
replyContentLab
];
self
.
replyContentLab
=
replyContentLab
;
self
.
replyContentLab
=
replyContentLab
;
WS
(
weakSelf
);
UIButton
*
totalReplyBtn
=
[
UIButton
btnWithTitle
:
@""
font
:
SysFont
(
15
)];
UIButton
*
totalReplyBtn
=
[
UIButton
btnWithTitle
:
@""
font
:
SysFont
(
15
)];
[
totalReplyBtn
setTitleColor
:
BrandColor
forState
:
UIControlStateNormal
];
[
totalReplyBtn
setTitleColor
:
BrandColor
forState
:
UIControlStateNormal
];
[
totalReplyBtn
addTouchUpInsideHandler
:
^
(
NSInteger
tag
)
{
totalReplyBtn
.
userInteractionEnabled
=
NO
;
if
(
weakSelf
.
lookAllRelpyListBlock
)
{
weakSelf
.
lookAllRelpyListBlock
();
}
}];
[
_replyView
addSubview
:
totalReplyBtn
];
[
_replyView
addSubview
:
totalReplyBtn
];
self
.
totalReplyBtn
=
totalReplyBtn
;
self
.
totalReplyBtn
=
totalReplyBtn
;
}
}
...
...
DreamSleep/DreamSleep/Class/CommunityModule/View/DynamicDetailView.m
查看文件 @
6775a07
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
#import "DynamicDetailView.h"
#import "DynamicDetailView.h"
#import "InteractView.h"
#import "InteractView.h"
#import "ComDynamicCell.h"
#import "ComDynamicCell.h"
#import "CommentCell.h"
#import "
Dynamic
CommentCell.h"
#define kSectionHeaderHeight 48
#define kSectionHeaderHeight 48
#define kSectionFooterHeight 8
#define kSectionFooterHeight 8
...
@@ -154,31 +154,11 @@
...
@@ -154,31 +154,11 @@
cell
.
model
=
self
.
detailListArr
[
indexPath
.
section
];
cell
.
model
=
self
.
detailListArr
[
indexPath
.
section
];
return
cell
;
return
cell
;
}
else
{
}
else
{
CommentCell
*
cell
=
[
tableView
dequeueReusableCellWithIdentifier
:
NSStringFromClass
([
CommentCell
class
])
forIndexPath
:
indexPath
];
WS
(
weakSelf
);
DynamicCommentCell
*
cell
=
[
tableView
dequeueReusableCellWithIdentifier
:
NSStringFromClass
([
DynamicCommentCell
class
])
forIndexPath
:
indexPath
];
NSArray
*
comment_reply_arr
=
self
.
detailListArr
[
indexPath
.
section
];
NSArray
*
comment_reply_arr
=
self
.
detailListArr
[
indexPath
.
section
];
ComReplyModel
*
comReplyModel
=
comment_reply_arr
[
indexPath
.
row
];
ComReplyModel
*
comReplyModel
=
comment_reply_arr
[
indexPath
.
row
];
cell
.
comReplyModel
=
comReplyModel
;
cell
.
comReplyModel
=
comReplyModel
;
WS
(
weakSelf
);
cell
.
tapCommentContentLabBlock
=
^
{
/*
// 1、自己不能回复自己
if ([LoginUtils getUserID] == comReplyModel.commentModel.user_id) {
[DSProgressHUD showToast:@"不能对自己发布的评论进行回复!"];
return;
}
// 2、动态发布者才能进行回复
ComDynModel *talkModel = self.detailListArr[0];
if ([LoginUtils getUserID] == talkModel.userID) {
[weakSelf.interactView popReplyInputBoxWithCommentUser:comReplyModel.commentModel.nick_name];
} else {
[DSProgressHUD showToast:@"只有动态发布者才能回复!"];
}
*/
};
cell
.
tapAllCommentContentBlock
=
^
{
comReplyModel
.
isShowAllCommentContent
=
YES
;
[
weakSelf
.
dynamicDetailView
reloadSections
:[
NSIndexSet
indexSetWithIndex
:
1
]
withRowAnimation
:
UITableViewRowAnimationNone
];
};
cell
.
lookAllRelpyListBlock
=
^
{
cell
.
lookAllRelpyListBlock
=
^
{
if
(
weakSelf
.
delegate
&&
[
weakSelf
.
delegate
respondsToSelector
:
@selector
(
jumpReplyListView
:)])
{
if
(
weakSelf
.
delegate
&&
[
weakSelf
.
delegate
respondsToSelector
:
@selector
(
jumpReplyListView
:)])
{
[
weakSelf
.
delegate
jumpReplyListView
:
comReplyModel
.
commentModel
.
comment_id
];
[
weakSelf
.
delegate
jumpReplyListView
:
comReplyModel
.
commentModel
.
comment_id
];
...
@@ -197,7 +177,7 @@
...
@@ -197,7 +177,7 @@
_dynamicDetailView
.
backgroundColor
=
DSClearColor
;
_dynamicDetailView
.
backgroundColor
=
DSClearColor
;
_dynamicDetailView
.
showsVerticalScrollIndicator
=
NO
;
_dynamicDetailView
.
showsVerticalScrollIndicator
=
NO
;
_dynamicDetailView
.
separatorStyle
=
UITableViewCellSeparatorStyleNone
;
_dynamicDetailView
.
separatorStyle
=
UITableViewCellSeparatorStyleNone
;
[
_dynamicDetailView
registerClass
:[
CommentCell
class
]
forCellReuseIdentifier
:
NSStringFromClass
([
CommentCell
class
])];
[
_dynamicDetailView
registerClass
:[
DynamicCommentCell
class
]
forCellReuseIdentifier
:
NSStringFromClass
([
Dynamic
CommentCell
class
])];
_dynamicDetailView
.
contentInsetAdjustmentBehavior
=
UIScrollViewContentInsetAdjustmentNever
;
_dynamicDetailView
.
contentInsetAdjustmentBehavior
=
UIScrollViewContentInsetAdjustmentNever
;
UIView
*
footView
=
[[
UIView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
kScreenWidth
,
CGFLOAT_MIN
)];
UIView
*
footView
=
[[
UIView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
kScreenWidth
,
CGFLOAT_MIN
)];
_dynamicDetailView
.
tableFooterView
=
footView
;
_dynamicDetailView
.
tableFooterView
=
footView
;
...
...
DreamSleep/DreamSleep/Class/CommunityModule/View/InteractView.h
查看文件 @
6775a07
...
@@ -28,7 +28,7 @@ NS_ASSUME_NONNULL_BEGIN
...
@@ -28,7 +28,7 @@ NS_ASSUME_NONNULL_BEGIN
-
(
void
)
updateLikeBtnState
:(
BOOL
)
isLike
likeCount
:(
int
)
likeCount
;
-
(
void
)
updateLikeBtnState
:(
BOOL
)
isLike
likeCount
:(
int
)
likeCount
;
-
(
void
)
updateRemarkCount
:(
int
)
remarkCount
;
-
(
void
)
updateRemarkCount
:(
int
)
remarkCount
;
/// 弹出回复输入框
/// 弹出回复输入框
(第一版暂不考虑)
/// @param commentUser @评论者
/// @param commentUser @评论者
-
(
void
)
popReplyInputBoxWithCommentUser
:(
NSString
*
)
commentUser
;
-
(
void
)
popReplyInputBoxWithCommentUser
:(
NSString
*
)
commentUser
;
...
...
DreamSleep/DreamSleep/Class/CommunityModule/View/MessageNotiCell.h
0 → 100644
查看文件 @
6775a07
//
// MessageNotiCell.h
// DreamSleep
//
// Created by peter on 2022/10/10.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
/// 消息中心顶部官方通知和点赞通知cell
@interface
MessageNotiCell
:
UITableViewCell
@end
NS_ASSUME_NONNULL_END
DreamSleep/DreamSleep/Class/CommunityModule/View/MessageNotiCell.m
0 → 100644
查看文件 @
6775a07
//
// MessageNotiCell.m
// DreamSleep
//
// Created by peter on 2022/10/10.
//
#import "MessageNotiCell.h"
@interface
MessageNotiCell
()
@property
(
nonatomic
,
strong
)
UIImageView
*
icon
;
@property
(
nonatomic
,
strong
)
UILabel
*
titleLab
;
@property
(
nonatomic
,
strong
)
UILabel
*
detailLab
;
@end
@implementation
MessageNotiCell
-
(
instancetype
)
initWithStyle
:(
UITableViewCellStyle
)
style
reuseIdentifier
:(
NSString
*
)
reuseIdentifier
{
if
(
self
=
[
super
initWithStyle
:
style
reuseIdentifier
:
reuseIdentifier
])
{
self
.
selectionStyle
=
UITableViewCellSelectionStyleNone
;
self
.
backgroundColor
=
DSClearColor
;
[
self
.
contentView
addSubview
:
self
.
icon
];
[
self
.
contentView
addSubview
:
self
.
titleLab
];
[
self
.
contentView
addSubview
:
self
.
detailLab
];
[
self
.
icon
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
left
.
equalTo
(
self
.
contentView
).
offset
(
30
);
make
.
top
.
equalTo
(
self
.
contentView
);
make
.
size
.
mas_equalTo
(
CGSizeMake
(
40
,
40
));
}];
[
self
.
titleLab
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
left
.
equalTo
(
self
.
icon
.
mas_right
).
offset
(
14
);
make
.
top
.
equalTo
(
self
.
icon
);
make
.
right
.
equalTo
(
self
.
contentView
).
offset
(
-
30
);
}];
[
self
.
detailLab
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
left
.
equalTo
(
self
.
titleLab
);
make
.
bottom
.
equalTo
(
self
.
icon
);
}];
}
return
self
;
}
@end
DreamSleep/DreamSleep/Class/CommunityModule/View/MessageNotiView.h
0 → 100644
查看文件 @
6775a07
//
// MessageNotiView.h
// DreamSleep
//
// Created by peter on 2022/10/10.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@protocol
MessageNotiViewDelegate
<
NSObject
>
@end
/// 消息通知view
@interface
MessageNotiView
:
UITableView
@property
(
nonatomic
,
weak
)
id
<
MessageNotiViewDelegate
>
messageDelegate
;
-
(
instancetype
)
initWithDelegate
:(
id
<
MessageNotiViewDelegate
>
)
messageDelegate
;
@end
NS_ASSUME_NONNULL_END
DreamSleep/DreamSleep/Class/CommunityModule/View/MessageNotiView.m
0 → 100644
查看文件 @
6775a07
//
// MessageNotiView.m
// DreamSleep
//
// Created by peter on 2022/10/10.
//
#import "MessageNotiView.h"
#import "MessageNotiCell.h"
#import "CommentReplyCell.h"
static
int
secHeaderHeight
=
52
;
static
int
secFooterHeight
=
8
;
@interface
MessageNotiView
()
<
UITableViewDelegate
,
UITableViewDataSource
>
@property
(
nonatomic
,
strong
)
NSArray
*
messageListArr
;
@end
@implementation
MessageNotiView
-
(
instancetype
)
initWithDelegate
:(
id
<
MessageNotiViewDelegate
>
)
messageDelegate
{
if
(
self
=
[
super
initWithFrame
:
CGRectZero
style
:
UITableViewStyleGrouped
])
{
self
.
messageDelegate
=
messageDelegate
;
self
.
dk_backgroundColorPicker
=
DKColorPickerWithColors
(
DSWhite
,
DarkColor
,
DSWhite
);
self
.
messageListArr
=
@[
@"1"
,
@"2"
];
self
.
delegate
=
self
;
self
.
dataSource
=
self
;
self
.
showsVerticalScrollIndicator
=
NO
;
self
.
separatorStyle
=
UITableViewCellSeparatorStyleNone
;
[
self
registerClass
:[
MessageNotiCell
class
]
forCellReuseIdentifier
:
NSStringFromClass
([
MessageNotiCell
class
])];
[
self
registerClass
:[
CommentReplyCell
class
]
forCellReuseIdentifier
:
NSStringFromClass
([
CommentReplyCell
class
])];
self
.
contentInsetAdjustmentBehavior
=
UIScrollViewContentInsetAdjustmentNever
;
UIView
*
footView
=
[[
UIView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
kScreenWidth
,
CGFLOAT_MIN
)];
self
.
tableFooterView
=
footView
;
}
return
self
;
}
#pragma mark - UITableViewDelegate, UITableViewDataSource
-
(
NSInteger
)
numberOfSectionsInTableView
:(
UITableView
*
)
tableView
{
return
self
.
messageListArr
.
count
;
}
-
(
NSInteger
)
tableView
:(
UITableView
*
)
tableView
numberOfRowsInSection
:(
NSInteger
)
section
{
if
(
section
==
0
)
{
return
2
;
}
else
{
return
10
;
}
}
-
(
CGFloat
)
tableView
:(
UITableView
*
)
tableView
heightForRowAtIndexPath
:(
NSIndexPath
*
)
indexPath
{
if
(
indexPath
.
section
==
0
)
{
return
77
;
}
else
{
return
100
;
}
}
-
(
CGFloat
)
tableView
:(
UITableView
*
)
tableView
heightForHeaderInSection
:(
NSInteger
)
section
{
return
section
==
0
?
CGFLOAT_MIN
:
secHeaderHeight
;
}
-
(
UIView
*
)
tableView
:(
UITableView
*
)
tableView
viewForHeaderInSection
:(
NSInteger
)
section
{
UIView
*
header
=
[[
UIView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
kScreenWidth
,
0
)];
header
.
dk_backgroundColorPicker
=
DKColorPickerWithColors
(
DSWhite
,
DarkColor
,
DSWhite
);
if
(
section
==
0
)
{
header
.
height
=
0
;
}
else
{
header
.
height
=
secHeaderHeight
;
UILabel
*
totalReplyCountLab
=
[
UILabel
labWithFont
:
BoldFont
(
15
)];
totalReplyCountLab
.
dk_textColorPicker
=
DKColorPickerWithKey
(
Dk_TITLE
);
totalReplyCountLab
.
origin
=
CGPointMake
(
15
,
15
);
totalReplyCountLab
.
text
=
@"评论和回复"
;
[
totalReplyCountLab
sizeToFit
];
[
header
addSubview
:
totalReplyCountLab
];
}
return
header
;
}
-
(
CGFloat
)
tableView
:(
UITableView
*
)
tableView
heightForFooterInSection
:(
NSInteger
)
section
{
return
section
==
self
.
messageListArr
.
count
-
1
?
CGFLOAT_MIN
:
secFooterHeight
;
}
-
(
UIView
*
)
tableView
:(
UITableView
*
)
tableView
viewForFooterInSection
:(
NSInteger
)
section
{
UIView
*
footer
=
[[
UIView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
kScreenWidth
,
section
==
self
.
messageListArr
.
count
-
1
?
CGFLOAT_MIN
:
secFooterHeight
)];
footer
.
dk_backgroundColorPicker
=
DKColorPickerWithColors
(
BGColor
,
AlertDarkColor
,
DSWhite
);
return
footer
;
}
-
(
UITableViewCell
*
)
tableView
:(
UITableView
*
)
tableView
cellForRowAtIndexPath
:(
NSIndexPath
*
)
indexPath
{
if
(
indexPath
.
section
==
0
)
{
MessageNotiCell
*
cell
=
[
tableView
dequeueReusableCellWithIdentifier
:
NSStringFromClass
([
MessageNotiCell
class
])
forIndexPath
:
indexPath
];
return
cell
;
}
else
{
CommentReplyCell
*
cell
=
[
tableView
dequeueReusableCellWithIdentifier
:
NSStringFromClass
([
CommentReplyCell
class
])
forIndexPath
:
indexPath
];
return
cell
;
}
}
@end
DreamSleep/DreamSleep/Class/CommunityModule/View/ReplyDetailView.m
查看文件 @
6775a07
...
@@ -25,7 +25,6 @@
...
@@ -25,7 +25,6 @@
self
.
delegate
=
self
;
self
.
delegate
=
self
;
self
.
dataSource
=
self
;
self
.
dataSource
=
self
;
self
.
backgroundColor
=
DSClearColor
;
self
.
showsVerticalScrollIndicator
=
NO
;
self
.
showsVerticalScrollIndicator
=
NO
;
self
.
separatorStyle
=
UITableViewCellSeparatorStyleNone
;
self
.
separatorStyle
=
UITableViewCellSeparatorStyleNone
;
[
self
registerClass
:[
MajorCommentCell
class
]
forCellReuseIdentifier
:
NSStringFromClass
([
MajorCommentCell
class
])];
[
self
registerClass
:[
MajorCommentCell
class
]
forCellReuseIdentifier
:
NSStringFromClass
([
MajorCommentCell
class
])];
...
...
DreamSleep/DreamSleep/Class/CommunityModule/View/TextInputAlertView.m
查看文件 @
6775a07
...
@@ -118,6 +118,7 @@
...
@@ -118,6 +118,7 @@
[
DSProgressHUD
showToast
:
@"请输入评论内容"
];
[
DSProgressHUD
showToast
:
@"请输入评论内容"
];
return
;
return
;
}
}
content
=
[
NSString
transferSpecialCharacters
:
content
];
if
(
self
.
tapFinishBlock
)
{
if
(
self
.
tapFinishBlock
)
{
self
.
tapFinishBlock
(
sender
.
tag
,
content
);
self
.
tapFinishBlock
(
sender
.
tag
,
content
);
}
}
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论