Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
陈高翔
/
DreamSleep-iOS
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 96c08911
由
cgx
编写于
2022-11-03 16:12:34 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
消息中心回复评论后调用阅读状态接口
1 个父辈
f26e5683
隐藏空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
48 行增加
和
34 行删除
DreamSleep/DreamSleep.xcodeproj/project.pbxproj
DreamSleep/DreamSleep/Class/CommunityModule/MessageCenter/Controller/MessageController.m
DreamSleep/DreamSleep/Class/CommunityModule/MessageCenter/View/MessageNotiView.h
DreamSleep/DreamSleep/Class/CommunityModule/MessageCenter/View/MessageNotiView.m
DreamSleep/DreamSleep/Class/CommunityModule/MessageCenter/ViewModel/MessageCenterViewModel.h
DreamSleep/DreamSleep/Class/CommunityModule/MessageCenter/ViewModel/MessageCenterViewModel.m
DreamSleep/DreamSleep/Class/CommunityModule/View/TextInput/TextInputAlertView.h
DreamSleep/DreamSleep/Class/CommunityModule/View/TextInput/TextInputAlertView.m
DreamSleep/DreamSleep.xcodeproj/project.pbxproj
查看文件 @
96c0891
...
...
@@ -3233,7 +3233,7 @@
CODE_SIGN_ENTITLEMENTS = DreamSleep/Basement/DSConfig/DreamSleepDebug.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION =
9
;
CURRENT_PROJECT_VERSION =
10
;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 4NDZ6UX8PW;
...
...
@@ -3316,7 +3316,7 @@
CODE_SIGN_ENTITLEMENTS = DreamSleep/DreamSleep.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION =
9
;
CURRENT_PROJECT_VERSION =
10
;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 4NDZ6UX8PW;
ENABLE_BITCODE = NO;
...
...
@@ -3459,7 +3459,7 @@
CODE_SIGN_ENTITLEMENTS = DreamSleep/Basement/DSConfig/DreamSleepBeta.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION =
9
;
CURRENT_PROJECT_VERSION =
10
;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 4NDZ6UX8PW;
...
...
DreamSleep/DreamSleep/Class/CommunityModule/MessageCenter/Controller/MessageController.m
查看文件 @
96c0891
...
...
@@ -57,18 +57,8 @@
[
self
.
navigationController
pushViewController
:
praiseVC
animated
:
YES
];
}
}
else
{
// 1、先更新阅读状态
[
self
.
messageCenterVM
updateReadStatus
:
indexPath
status
:
1
];
[
self
.
messageNotiView
refreshReadStatusView
:
indexPath
];
// 2、调用更新状态接口
int
notiID
=
(
int
)[
self
.
messageCenterVM
getNotiIDWithIndexPath
:
indexPath
];
[
MessageCenterViewModel
updateCommentReplyReadStatusWithID
:
notiID
completion
:
^
(
MessageCenterViewModel
*
_Nonnull
requestModel
)
{
if
(
requestModel
.
resCode
!=
DSResCodeSuccess
)
{
// 3、阅读状态回滚
[
self
.
messageCenterVM
updateReadStatus
:
indexPath
status
:
0
];
[
self
.
messageNotiView
refreshReadStatusView
:
indexPath
];
}
}];
// 更新阅读状态
[
self
updateReadStatus
:
indexPath
];
ReplyListController
*
replyList
=
[
ReplyListController
new
];
replyList
.
commentID
=
(
int
)[
self
.
messageCenterVM
getUserCommentIDWithIndexPath
:
indexPath
];
...
...
@@ -76,18 +66,37 @@
}
}
-
(
void
)
replyContent
:
(
NSString
*
)
content
userMessageModel
:
(
id
)
userMessageModel
{
-
(
void
)
replyContent
:
(
NSString
*
)
content
indexPath
:
(
NSIndexPath
*
)
indexPath
{
[
DSProgressHUD
showProgressHUDWithInfo
:
@""
];
[
MessageCenterViewModel
userReplyCommentWithContent
:
content
userMessageModel
:
userMessageModel
completion
:^
(
MessageCenterViewModel
*
_Nonnull
requestModel
)
{
[
self
.
messageCenterVM
userReplyCommentWithContent
:
content
indexPath
:
indexPath
completion
:^
(
MessageCenterViewModel
*
_Nonnull
requestModel
)
{
[
DSProgressHUD
dissmissProgressHUD
];
if
(
requestModel
.
resCode
==
DSResCodeSuccess
)
{
[
self
.
messageNotiView
dismissKeyBoard
];
// 更新阅读状态
[
self
updateReadStatus
:
indexPath
];
}
else
{
[
DSProgressHUD
showToast
:
requestModel
.
errMessage
];
}
}];
}
#pragma mark - private
-
(
void
)
updateReadStatus
:
(
NSIndexPath
*
)
indexPath
{
// 1、先更新阅读状态
[
self
.
messageCenterVM
updateReadStatus
:
indexPath
status
:
1
];
[
self
.
messageNotiView
refreshReadStatusView
:
indexPath
];
// 2、调用更新状态接口
int
notiID
=
(
int
)[
self
.
messageCenterVM
getNotiIDWithIndexPath
:
indexPath
];
[
MessageCenterViewModel
updateCommentReplyReadStatusWithID
:
notiID
completion
:
^
(
MessageCenterViewModel
*
_Nonnull
requestModel
)
{
if
(
requestModel
.
resCode
!=
DSResCodeSuccess
)
{
// 3、阅读状态回滚
[
self
.
messageCenterVM
updateReadStatus
:
indexPath
status
:
0
];
[
self
.
messageNotiView
refreshReadStatusView
:
indexPath
];
}
}];
}
#pragma mark - lazy
-
(
MessageNotiView
*
)
messageNotiView
{
if
(
!
_messageNotiView
)
{
...
...
DreamSleep/DreamSleep/Class/CommunityModule/MessageCenter/View/MessageNotiView.h
查看文件 @
96c0891
...
...
@@ -11,12 +11,14 @@
NS_ASSUME_NONNULL_BEGIN
@protocol
MessageNotiViewDelegate
<
NSObject
>
/// 点击评论回复cell,调用更新阅读状态接口
/// @param indexPath indexPath
-
(
void
)
didSelectRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
;
/// 消息中心回复评论
/// @param content 回复内容
/// @param
userMessageModel 用户消息数据model
-
(
void
)
replyContent
:(
NSString
*
)
content
userMessageModel
:(
id
)
userMessageModel
;
/// @param
indexPath indexPath
-
(
void
)
replyContent
:(
NSString
*
)
content
indexPath
:(
NSIndexPath
*
)
indexPath
;
@end
/// 消息通知view
...
...
DreamSleep/DreamSleep/Class/CommunityModule/MessageCenter/View/MessageNotiView.m
查看文件 @
96c0891
...
...
@@ -116,7 +116,7 @@ static int secFooterHeight = 8;
MessageComReplyModel
*
model
=
userNotiList
[
indexPath
.
row
];
cell
.
comReplyModel
=
model
;
cell
.
tapReplyBtnBlock
=
^
{
[
weakSelf
.
textInputAlertView
showReplyTextAlertWithCommentUser
:
model
.
nickName
model
:
model
];
[
weakSelf
.
textInputAlertView
showReplyTextAlertWithCommentUser
:
model
.
nickName
indexPath
:
indexPath
];
};
return
cell
;
}
...
...
@@ -133,9 +133,9 @@ static int secFooterHeight = 8;
if
(
!
_textInputAlertView
)
{
WS
(
weakSelf
);
_textInputAlertView
=
[[
TextInputAlertView
alloc
]
initWithFrame
:[
UIScreen
mainScreen
].
bounds
];
_textInputAlertView
.
tapReplyBlock
=
^
(
NSString
*
_Nonnull
content
,
id
_Nonnull
model
)
{
if
(
weakSelf
.
messageDelegate
&&
[
weakSelf
.
messageDelegate
respondsToSelector
:
@selector
(
replyContent
:
userMessageModel
:
)])
{
[
weakSelf
.
messageDelegate
replyContent
:
content
userMessageModel
:
model
];
_textInputAlertView
.
tapReplyBlock
=
^
(
NSString
*
_Nonnull
content
,
NSIndexPath
*
indexPath
)
{
if
(
weakSelf
.
messageDelegate
&&
[
weakSelf
.
messageDelegate
respondsToSelector
:
@selector
(
replyContent
:
indexPath
:
)])
{
[
weakSelf
.
messageDelegate
replyContent
:
content
indexPath
:
indexPath
];
}
};
}
...
...
DreamSleep/DreamSleep/Class/CommunityModule/MessageCenter/ViewModel/MessageCenterViewModel.h
查看文件 @
96c0891
...
...
@@ -21,9 +21,9 @@ NS_ASSUME_NONNULL_BEGIN
/// 消息中心用户回复评论接口
/// @param content 回复内容
/// @param
userMessageModel 消息model
/// @param
indexPath 消息数据model标识
/// @param completion completion
+
(
NSURLSessionDataTask
*
)
userReplyCommentWithContent
:(
NSString
*
)
content
userMessageModel
:(
id
)
userMessageModel
completion
:(
void
(
^
)(
MessageCenterViewModel
*
requestModel
))
completion
;
-
(
NSURLSessionDataTask
*
)
userReplyCommentWithContent
:(
NSString
*
)
content
indexPath
:(
NSIndexPath
*
)
indexPath
completion
:(
void
(
^
)(
MessageCenterViewModel
*
requestModel
))
completion
;
/// 获取消息中心评论回复用户评论id
/// @param indexPath indexPath
...
...
DreamSleep/DreamSleep/Class/CommunityModule/MessageCenter/ViewModel/MessageCenterViewModel.m
查看文件 @
96c0891
...
...
@@ -77,11 +77,13 @@
});
}
+
(
NSURLSessionDataTask
*
)
userReplyCommentWithContent
:
(
NSString
*
)
content
userMessageModel
:
(
id
)
userMessageModel
completion
:
(
void
(
^
)(
MessageCenterViewModel
*
requestModel
))
completion
{
MessageComReplyModel
*
model
=
userMessageModel
;
-
(
NSURLSessionDataTask
*
)
userReplyCommentWithContent
:
(
NSString
*
)
content
indexPath
:
(
NSIndexPath
*
)
indexPath
completion
:
(
void
(
^
)(
MessageCenterViewModel
*
requestModel
))
completion
{
NSArray
*
userNotiList
=
self
.
messageListArr
[
indexPath
.
section
];
MessageComReplyModel
*
model
=
userNotiList
[
indexPath
.
row
];
MessageCenterViewModel
*
requestModel
=
[[
MessageCenterViewModel
alloc
]
init
];
NSString
*
api
=
@"user_reply_comment"
;
NSString
*
argStr
=
[
NSString
stringWithFormat
:
@"mutation{%@(user_id:%ld,
talk_id:%ld,comment_id:%ld,content:
\"
%@
\"
)}"
,
api
,
model
.
user
ID
,
model
.
talkID
,
model
.
commentID
,
content
];
NSString
*
argStr
=
[
NSString
stringWithFormat
:
@"mutation{%@(user_id:%ld,
reply_id:%ld,talk_id:%ld,comment_id:%ld,content:
\"
%@
\"
)}"
,
api
,
model
.
userID
,
model
.
reply
ID
,
model
.
talkID
,
model
.
commentID
,
content
];
return
[
MessageCenterViewModel
httpPostBodyRequestWithAPI
:
api
params
:@{
@"query"
:
argStr
}
view
:
nil
hasNetActivity
:
YES
loadingInfo
:
nil
hasFailInfo
:
NO
success
:^
(
NSDictionary
*
_Nonnull
apiDic
)
{
DSLog
(
@"用户-回复评论接口apiDic:%@"
,
apiDic
);
requestModel
.
resCode
=
DSResCodeSuccess
;
...
...
DreamSleep/DreamSleep/Class/CommunityModule/View/TextInput/TextInputAlertView.h
查看文件 @
96c0891
...
...
@@ -12,7 +12,7 @@ NS_ASSUME_NONNULL_BEGIN
/// 发布评论回调block
typedef
void
(
^
TapFinishBlock
)(
NSInteger
tag
,
NSString
*
content
);
/// 回复评论回调block
typedef
void
(
^
TapReplyBlock
)(
NSString
*
content
,
id
model
);
typedef
void
(
^
TapReplyBlock
)(
NSString
*
content
,
NSIndexPath
*
indexPath
);
/// 文本评论、回复弹框
@interface
TextInputAlertView
:
UIView
...
...
@@ -23,7 +23,8 @@ typedef void(^TapReplyBlock)(NSString * content, id model);
-
(
void
)
showTextInputAlertView
;
-
(
void
)
showReplyTextAlertWithCommentUser
:(
NSString
*
)
commentUser
model
:(
id
)
model
;
// 显示回复评论弹框
-
(
void
)
showReplyTextAlertWithCommentUser
:(
NSString
*
)
commentUser
indexPath
:(
NSIndexPath
*
)
indexPath
;
-
(
void
)
dismiss
;
...
...
DreamSleep/DreamSleep/Class/CommunityModule/View/TextInput/TextInputAlertView.m
查看文件 @
96c0891
...
...
@@ -16,7 +16,7 @@
@property
(
nonatomic
,
strong
)
UIButton
*
replyBtn
;
@property
(
nonatomic
,
assign
)
CGFloat
duration
;
@property
(
nonatomic
,
copy
)
NSString
*
commentUserFlag
;
@property
(
nonatomic
,
strong
)
id
userMessageModel
;
@property
(
nonatomic
,
strong
)
NSIndexPath
*
curIndexPath
;
@end
@implementation
TextInputAlertView
...
...
@@ -91,10 +91,10 @@
[
self
.
replyBtn
setTitle
:
@"发布"
forState
:
UIControlStateNormal
];
}
-
(
void
)
showReplyTextAlertWithCommentUser
:
(
NSString
*
)
commentUser
model
:
(
id
)
model
{
-
(
void
)
showReplyTextAlertWithCommentUser
:
(
NSString
*
)
commentUser
indexPath
:
(
NSIndexPath
*
)
indexPath
{
[
self
showTextInputAlertView
];
self
.
replyBtn
.
tag
=
2
;
self
.
userMessageModel
=
model
;
self
.
curIndexPath
=
indexPath
;
[
self
.
replyBtn
setTitle
:
@"回复"
forState
:
UIControlStateNormal
];
self
.
commentUserFlag
=
commentUser
?
[
NSString
stringWithFormat
:
@"@%@,"
,
commentUser
]
:
@""
;
self
.
textView
.
text
=
self
.
commentUserFlag
;
...
...
@@ -132,7 +132,7 @@
}
}
else
if
(
sender
.
tag
==
2
)
{
// 回复
if
(
self
.
tapReplyBlock
)
{
self
.
tapReplyBlock
(
content
,
self
.
userMessageModel
);
self
.
tapReplyBlock
(
content
,
self
.
curIndexPath
);
}
}
}
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论