Commit 96c08911 cgx

消息中心回复评论后调用阅读状态接口

1 个父辈 f26e5683
......@@ -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;
......
......@@ -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) {
......
......@@ -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
......
......@@ -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];
}
};
}
......
......@@ -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
......
......@@ -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.userID, 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.replyID, 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;
......
......@@ -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;
......
......@@ -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!