修改了动态的分享 点赞 举报

This commit is contained in:
fengshuo
2022-06-24 18:51:04 +08:00
parent 365b8aa2da
commit 1a13c09723
30 changed files with 371 additions and 38 deletions

View File

@@ -23,7 +23,7 @@
#import "XPMonentsEmptyTableViewCell.h"
#import "XPMonentsDetailViewController.h"
@interface XPMonentsLatestViewController ()<UITableViewDelegate, UITableViewDataSource,XPMonentsLatestProtocol>
@interface XPMonentsLatestViewController ()<UITableViewDelegate, UITableViewDataSource,XPMonentsLatestProtocol, XPMonentsTableViewCellDelegate>
///
@property (nonatomic,strong) UITableView *tableView;
///
@@ -116,6 +116,7 @@
XPMonentsTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMonentsTableViewCell class])];
MonentsInfoModel * monentsInfo = [self.datasource objectAtIndex:indexPath.row];
cell.monentsInfo = monentsInfo;
cell.delegate = self;
return cell;
}
XPMonentsEmptyTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMonentsEmptyTableViewCell class])];
@@ -131,6 +132,11 @@
[self.navigationController pushViewController:detailVC animated:YES];
}
}
#pragma mark - XPMonentsTableViewCellDelegate
- (void)xPMonentsTableViewCell:(XPMonentsTableViewCell *)view didClickLike:(MonentsInfoModel *)monentsInfo {
[self.presenter likeMonent:monentsInfo.dynamicId status:!monentsInfo.like likedUid:monentsInfo.uid worldId:[NSString stringWithFormat:@"%ld", monentsInfo.worldId]];
}
#pragma mark -JXCategoryListContainerViewDelegate
- (UIView *)listView {
return self.view;
@@ -168,6 +174,20 @@
}
}
- (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.like += 1;
} else {
obj.like -= 1;
}
*stop = YES;
}
}];
[self.tableView reloadData];
}
#pragma mark - Getters And Setters
- (UITableView *)tableView {
if (!_tableView) {