Commit 694925e7 cgx

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

1 个父辈 a57b9a2a
...@@ -3233,7 +3233,7 @@ ...@@ -3233,7 +3233,7 @@
CODE_SIGN_ENTITLEMENTS = DreamSleep/Basement/DSConfig/DreamSleepDebug.entitlements; CODE_SIGN_ENTITLEMENTS = DreamSleep/Basement/DSConfig/DreamSleepDebug.entitlements;
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Manual; CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 9; CURRENT_PROJECT_VERSION = 10;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEFINES_MODULE = YES; DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 4NDZ6UX8PW; DEVELOPMENT_TEAM = 4NDZ6UX8PW;
...@@ -3316,7 +3316,7 @@ ...@@ -3316,7 +3316,7 @@
CODE_SIGN_ENTITLEMENTS = DreamSleep/DreamSleep.entitlements; CODE_SIGN_ENTITLEMENTS = DreamSleep/DreamSleep.entitlements;
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 9; CURRENT_PROJECT_VERSION = 10;
DEFINES_MODULE = YES; DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 4NDZ6UX8PW; DEVELOPMENT_TEAM = 4NDZ6UX8PW;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
...@@ -3459,7 +3459,7 @@ ...@@ -3459,7 +3459,7 @@
CODE_SIGN_ENTITLEMENTS = DreamSleep/Basement/DSConfig/DreamSleepBeta.entitlements; CODE_SIGN_ENTITLEMENTS = DreamSleep/Basement/DSConfig/DreamSleepBeta.entitlements;
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 9; CURRENT_PROJECT_VERSION = 10;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEFINES_MODULE = YES; DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 4NDZ6UX8PW; DEVELOPMENT_TEAM = 4NDZ6UX8PW;
......
...@@ -57,18 +57,8 @@ ...@@ -57,18 +57,8 @@
[self.navigationController pushViewController:praiseVC animated:YES]; [self.navigationController pushViewController:praiseVC animated:YES];
} }
} else { } else {
// 1、先更新阅读状态 // 更新阅读状态
[self.messageCenterVM updateReadStatus:indexPath status:1]; [self updateReadStatus:indexPath];
[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];
}
}];
ReplyListController *replyList = [ReplyListController new]; ReplyListController *replyList = [ReplyListController new];
replyList.commentID = (int)[self.messageCenterVM getUserCommentIDWithIndexPath:indexPath]; replyList.commentID = (int)[self.messageCenterVM getUserCommentIDWithIndexPath:indexPath];
...@@ -76,18 +66,37 @@ ...@@ -76,18 +66,37 @@
} }
} }
- (void)replyContent:(NSString *)content userMessageModel:(id)userMessageModel { - (void)replyContent:(NSString *)content indexPath:(NSIndexPath *)indexPath {
[DSProgressHUD showProgressHUDWithInfo:@""]; [DSProgressHUD showProgressHUDWithInfo:@""];
[MessageCenterViewModel userReplyCommentWithContent:content userMessageModel:userMessageModel completion:^(MessageCenterViewModel * _Nonnull requestModel) { [self.messageCenterVM userReplyCommentWithContent:content indexPath:indexPath completion:^(MessageCenterViewModel * _Nonnull requestModel) {
[DSProgressHUD dissmissProgressHUD]; [DSProgressHUD dissmissProgressHUD];
if (requestModel.resCode == DSResCodeSuccess) { if (requestModel.resCode == DSResCodeSuccess) {
[self.messageNotiView dismissKeyBoard]; [self.messageNotiView dismissKeyBoard];
// 更新阅读状态
[self updateReadStatus:indexPath];
} else { } else {
[DSProgressHUD showToast:requestModel.errMessage]; [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 #pragma mark - lazy
- (MessageNotiView *)messageNotiView { - (MessageNotiView *)messageNotiView {
if (!_messageNotiView) { if (!_messageNotiView) {
......
...@@ -11,12 +11,14 @@ ...@@ -11,12 +11,14 @@
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@protocol MessageNotiViewDelegate <NSObject> @protocol MessageNotiViewDelegate <NSObject>
/// 点击评论回复cell,调用更新阅读状态接口
/// @param indexPath indexPath
- (void)didSelectRowAtIndexPath:(NSIndexPath *)indexPath; - (void)didSelectRowAtIndexPath:(NSIndexPath *)indexPath;
/// 消息中心回复评论 /// 消息中心回复评论
/// @param content 回复内容 /// @param content 回复内容
/// @param userMessageModel 用户消息数据model /// @param indexPath indexPath
- (void)replyContent:(NSString *)content userMessageModel:(id)userMessageModel; - (void)replyContent:(NSString *)content indexPath:(NSIndexPath *)indexPath;
@end @end
/// 消息通知view /// 消息通知view
......
...@@ -116,7 +116,7 @@ static int secFooterHeight = 8; ...@@ -116,7 +116,7 @@ static int secFooterHeight = 8;
MessageComReplyModel *model = userNotiList[indexPath.row]; MessageComReplyModel *model = userNotiList[indexPath.row];
cell.comReplyModel = model; cell.comReplyModel = model;
cell.tapReplyBtnBlock = ^{ cell.tapReplyBtnBlock = ^{
[weakSelf.textInputAlertView showReplyTextAlertWithCommentUser:model.nickName model:model]; [weakSelf.textInputAlertView showReplyTextAlertWithCommentUser:model.nickName indexPath:indexPath];
}; };
return cell; return cell;
} }
...@@ -133,9 +133,9 @@ static int secFooterHeight = 8; ...@@ -133,9 +133,9 @@ static int secFooterHeight = 8;
if (!_textInputAlertView) { if (!_textInputAlertView) {
WS(weakSelf); WS(weakSelf);
_textInputAlertView = [[TextInputAlertView alloc] initWithFrame:[UIScreen mainScreen].bounds]; _textInputAlertView = [[TextInputAlertView alloc] initWithFrame:[UIScreen mainScreen].bounds];
_textInputAlertView.tapReplyBlock = ^(NSString * _Nonnull content, id _Nonnull model) { _textInputAlertView.tapReplyBlock = ^(NSString * _Nonnull content, NSIndexPath * indexPath) {
if (weakSelf.messageDelegate && [weakSelf.messageDelegate respondsToSelector:@selector(replyContent:userMessageModel:)]) { if (weakSelf.messageDelegate && [weakSelf.messageDelegate respondsToSelector:@selector(replyContent:indexPath:)]) {
[weakSelf.messageDelegate replyContent:content userMessageModel:model]; [weakSelf.messageDelegate replyContent:content indexPath:indexPath];
} }
}; };
} }
......
...@@ -21,9 +21,9 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -21,9 +21,9 @@ NS_ASSUME_NONNULL_BEGIN
/// 消息中心用户回复评论接口 /// 消息中心用户回复评论接口
/// @param content 回复内容 /// @param content 回复内容
/// @param userMessageModel 消息model /// @param indexPath 消息数据model标识
/// @param completion completion /// @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 /// 获取消息中心评论回复用户评论id
/// @param indexPath indexPath /// @param indexPath indexPath
......
...@@ -77,11 +77,13 @@ ...@@ -77,11 +77,13 @@
}); });
} }
+ (NSURLSessionDataTask *)userReplyCommentWithContent:(NSString *)content userMessageModel:(id)userMessageModel completion:(void (^)(MessageCenterViewModel *requestModel))completion { - (NSURLSessionDataTask *)userReplyCommentWithContent:(NSString *)content indexPath:(NSIndexPath *)indexPath completion:(void (^)(MessageCenterViewModel *requestModel))completion {
MessageComReplyModel *model = userMessageModel; NSArray *userNotiList = self.messageListArr[indexPath.section];
MessageComReplyModel *model = userNotiList[indexPath.row];
MessageCenterViewModel * requestModel = [[MessageCenterViewModel alloc] init]; MessageCenterViewModel * requestModel = [[MessageCenterViewModel alloc] init];
NSString *api = @"user_reply_comment"; 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) { return [MessageCenterViewModel httpPostBodyRequestWithAPI:api params:@{@"query" : argStr} view:nil hasNetActivity:YES loadingInfo:nil hasFailInfo:NO success:^(NSDictionary * _Nonnull apiDic) {
DSLog(@"用户-回复评论接口apiDic:%@", apiDic); DSLog(@"用户-回复评论接口apiDic:%@", apiDic);
requestModel.resCode = DSResCodeSuccess; requestModel.resCode = DSResCodeSuccess;
......
...@@ -12,7 +12,7 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -12,7 +12,7 @@ NS_ASSUME_NONNULL_BEGIN
/// 发布评论回调block /// 发布评论回调block
typedef void(^TapFinishBlock)(NSInteger tag, NSString * content); typedef void(^TapFinishBlock)(NSInteger tag, NSString * content);
/// 回复评论回调block /// 回复评论回调block
typedef void(^TapReplyBlock)(NSString * content, id model); typedef void(^TapReplyBlock)(NSString * content, NSIndexPath * indexPath);
/// 文本评论、回复弹框 /// 文本评论、回复弹框
@interface TextInputAlertView : UIView @interface TextInputAlertView : UIView
...@@ -23,7 +23,8 @@ typedef void(^TapReplyBlock)(NSString * content, id model); ...@@ -23,7 +23,8 @@ typedef void(^TapReplyBlock)(NSString * content, id model);
- (void)showTextInputAlertView; - (void)showTextInputAlertView;
- (void)showReplyTextAlertWithCommentUser:(NSString *)commentUser model:(id)model; // 显示回复评论弹框
- (void)showReplyTextAlertWithCommentUser:(NSString *)commentUser indexPath:(NSIndexPath *)indexPath;
- (void)dismiss; - (void)dismiss;
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
@property (nonatomic, strong) UIButton *replyBtn; @property (nonatomic, strong) UIButton *replyBtn;
@property (nonatomic, assign) CGFloat duration; @property (nonatomic, assign) CGFloat duration;
@property (nonatomic, copy) NSString *commentUserFlag; @property (nonatomic, copy) NSString *commentUserFlag;
@property (nonatomic, strong) id userMessageModel; @property (nonatomic, strong) NSIndexPath *curIndexPath;
@end @end
@implementation TextInputAlertView @implementation TextInputAlertView
...@@ -91,10 +91,10 @@ ...@@ -91,10 +91,10 @@
[self.replyBtn setTitle:@"发布" forState:UIControlStateNormal]; [self.replyBtn setTitle:@"发布" forState:UIControlStateNormal];
} }
- (void)showReplyTextAlertWithCommentUser:(NSString *)commentUser model:(id)model { - (void)showReplyTextAlertWithCommentUser:(NSString *)commentUser indexPath:(NSIndexPath *)indexPath {
[self showTextInputAlertView]; [self showTextInputAlertView];
self.replyBtn.tag = 2; self.replyBtn.tag = 2;
self.userMessageModel = model; self.curIndexPath = indexPath;
[self.replyBtn setTitle:@"回复" forState:UIControlStateNormal]; [self.replyBtn setTitle:@"回复" forState:UIControlStateNormal];
self.commentUserFlag = commentUser ? [NSString stringWithFormat:@"@%@,", commentUser] : @""; self.commentUserFlag = commentUser ? [NSString stringWithFormat:@"@%@,", commentUser] : @"";
self.textView.text = self.commentUserFlag; self.textView.text = self.commentUserFlag;
...@@ -132,7 +132,7 @@ ...@@ -132,7 +132,7 @@
} }
} else if (sender.tag == 2) { // 回复 } else if (sender.tag == 2) { // 回复
if (self.tapReplyBlock) { if (self.tapReplyBlock) {
self.tapReplyBlock(content, self.userMessageModel); self.tapReplyBlock(content, self.curIndexPath);
} }
} }
} }
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!