|
@@ -16,6 +16,7 @@
|
|
|
#import "JXSuperPlayer.h"
|
|
#import "JXSuperPlayer.h"
|
|
|
#import <AVFoundation/AVFoundation.h>
|
|
#import <AVFoundation/AVFoundation.h>
|
|
|
#import "JXCollectionViewController.h"
|
|
#import "JXCollectionViewController.h"
|
|
|
|
|
+#import "JXCommentViewController.h"
|
|
|
@interface JXDetailViewController () <JXSuperPlayerDelegate, UICollectionViewDelegate, UICollectionViewDataSource,JXCollectionViewControllerDelegate>
|
|
@interface JXDetailViewController () <JXSuperPlayerDelegate, UICollectionViewDelegate, UICollectionViewDataSource,JXCollectionViewControllerDelegate>
|
|
|
|
|
|
|
|
// 播放器
|
|
// 播放器
|
|
@@ -122,8 +123,8 @@
|
|
|
NSLog(@"⏯️ 自动滚动检查 - 剧集总数: %lu", (unsigned long)self.episodes.count);
|
|
NSLog(@"⏯️ 自动滚动检查 - 剧集总数: %lu", (unsigned long)self.episodes.count);
|
|
|
if (self.episodes.count > 0) {
|
|
if (self.episodes.count > 0) {
|
|
|
NSLog(@"⏯️ 滚动到第一集");
|
|
NSLog(@"⏯️ 滚动到第一集");
|
|
|
- [self.episodeCollectionView scrollToItemAtIndexPath:[NSIndexPath indexPathForItem:0 inSection:0]
|
|
|
|
|
- atScrollPosition:UICollectionViewScrollPositionCenteredVertically
|
|
|
|
|
|
|
+ [self.episodeCollectionView scrollToItemAtIndexPath:[NSIndexPath indexPathForItem:self.playIndex inSection:0]
|
|
|
|
|
+ atScrollPosition:UICollectionViewScrollPositionCenteredVertically
|
|
|
animated:NO];
|
|
animated:NO];
|
|
|
} else {
|
|
} else {
|
|
|
NSLog(@"❌ 剧集列表为空,无法播放");
|
|
NSLog(@"❌ 剧集列表为空,无法播放");
|
|
@@ -188,12 +189,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
// 右侧互动按钮
|
|
// 右侧互动按钮
|
|
|
-// [self setupInteractionButtonsForCell:cell atY:y];
|
|
|
|
|
|
|
+ [self setupInteractionButtonsForCell:cell];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
UILabel * seeL = [[UILabel alloc] initWithFrame:CGRectMake(16, kScreenHeight - 14-safebottom, SCREEN_WIDTH - 32, 14)];
|
|
UILabel * seeL = [[UILabel alloc] initWithFrame:CGRectMake(16, kScreenHeight - 14-safebottom, SCREEN_WIDTH - 32, 14)];
|
|
|
seeL.font = [UIFont systemFontOfSize:14 weight:UIFontWeightMedium];
|
|
seeL.font = [UIFont systemFontOfSize:14 weight:UIFontWeightMedium];
|
|
|
seeL.textColor = [UIColor colorWithRed:173/255.0 green:173/255.0 blue:173/255.0 alpha:1];
|
|
seeL.textColor = [UIColor colorWithRed:173/255.0 green:173/255.0 blue:173/255.0 alpha:1];
|
|
@@ -218,20 +217,29 @@
|
|
|
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(showHJ:)];
|
|
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(showHJ:)];
|
|
|
[bottomView addGestureRecognizer:tap];
|
|
[bottomView addGestureRecognizer:tap];
|
|
|
|
|
|
|
|
- UILabel *descLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, CGRectGetMinY(bottomView.frame)-60, width - 32, 40)];
|
|
|
|
|
|
|
+ UILabel *descLabel = [[UILabel alloc] init];
|
|
|
descLabel.font = [UIFont systemFontOfSize:15 weight:UIFontWeightMedium];
|
|
descLabel.font = [UIFont systemFontOfSize:15 weight:UIFontWeightMedium];
|
|
|
descLabel.textColor = [UIColor whiteColor];
|
|
descLabel.textColor = [UIColor whiteColor];
|
|
|
descLabel.numberOfLines = 2;
|
|
descLabel.numberOfLines = 2;
|
|
|
[cell.contentView addSubview:descLabel];
|
|
[cell.contentView addSubview:descLabel];
|
|
|
[cell.contentView bringSubviewToFront:descLabel];
|
|
[cell.contentView bringSubviewToFront:descLabel];
|
|
|
|
|
+ [descLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
|
+ make.bottom.equalTo(bottomView.mas_top).offset(-15);
|
|
|
|
|
+ make.left.equalTo(cell.contentView).offset(16);
|
|
|
|
|
+ make.width.mas_equalTo(SCREEN_WIDTH - 90);
|
|
|
|
|
+ }];
|
|
|
|
|
|
|
|
-
|
|
|
|
|
- UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, CGRectGetMinY(descLabel.frame) - 50, width - 100, 40)];
|
|
|
|
|
|
|
+ UILabel *titleLabel = [[UILabel alloc] init];
|
|
|
titleLabel.font = [UIFont boldSystemFontOfSize:18];
|
|
titleLabel.font = [UIFont boldSystemFontOfSize:18];
|
|
|
titleLabel.textColor = [UIColor whiteColor];
|
|
titleLabel.textColor = [UIColor whiteColor];
|
|
|
titleLabel.numberOfLines = 2;
|
|
titleLabel.numberOfLines = 2;
|
|
|
[cell.contentView addSubview:titleLabel];
|
|
[cell.contentView addSubview:titleLabel];
|
|
|
[cell.contentView bringSubviewToFront:titleLabel];
|
|
[cell.contentView bringSubviewToFront:titleLabel];
|
|
|
|
|
+ [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
|
+ make.bottom.equalTo(descLabel.mas_top).offset(-12.5);
|
|
|
|
|
+ make.left.equalTo(cell.contentView).offset(16);
|
|
|
|
|
+ make.width.mas_equalTo(SCREEN_WIDTH - 90);
|
|
|
|
|
+ }];
|
|
|
|
|
|
|
|
// // 作者
|
|
// // 作者
|
|
|
// UILabel *authorLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, y, width - 32, 20)];
|
|
// UILabel *authorLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, y, width - 32, 20)];
|
|
@@ -251,7 +259,7 @@
|
|
|
//
|
|
//
|
|
|
// // 更新标签
|
|
// // 更新标签
|
|
|
titleLabel.text = self.drama.title ?: @"";
|
|
titleLabel.text = self.drama.title ?: @"";
|
|
|
- descLabel.text = self.drama.desc ?: @"";
|
|
|
|
|
|
|
+ descLabel.text = episode.title ?: @"";
|
|
|
// authorLabel.text = [NSString stringWithFormat:@"@%@", self.drama.authorInfo ?: @"未知"];
|
|
// authorLabel.text = [NSString stringWithFormat:@"@%@", self.drama.authorInfo ?: @"未知"];
|
|
|
//
|
|
//
|
|
|
// // 剧集编号和标题
|
|
// // 剧集编号和标题
|
|
@@ -278,7 +286,6 @@
|
|
|
- (void)showCollectionDialogWithDramaId:(NSString *)dramaId {
|
|
- (void)showCollectionDialogWithDramaId:(NSString *)dramaId {
|
|
|
JXCollectionViewController *collectionVC = [[JXCollectionViewController alloc] initWithDramaId:dramaId];
|
|
JXCollectionViewController *collectionVC = [[JXCollectionViewController alloc] initWithDramaId:dramaId];
|
|
|
collectionVC.delegate = self;
|
|
collectionVC.delegate = self;
|
|
|
-
|
|
|
|
|
// 设置弹窗样式(底部弹出)
|
|
// 设置弹窗样式(底部弹出)
|
|
|
if (@available(iOS 15.0, *)) {
|
|
if (@available(iOS 15.0, *)) {
|
|
|
UISheetPresentationController *sheet = collectionVC.sheetPresentationController;
|
|
UISheetPresentationController *sheet = collectionVC.sheetPresentationController;
|
|
@@ -291,6 +298,25 @@
|
|
|
|
|
|
|
|
[self presentViewController:collectionVC animated:YES completion:nil];
|
|
[self presentViewController:collectionVC animated:YES completion:nil];
|
|
|
}
|
|
}
|
|
|
|
|
+- (void)commentDidClicked{
|
|
|
|
|
+ JXEpisode *episode = self.episodes[self.currentEpisodeIndex];
|
|
|
|
|
+ JXCommentViewController *commentVC = [[JXCommentViewController alloc] initWithDramaId:[NSString stringWithFormat:@"%ld",episode.dramaId]];
|
|
|
|
|
+ // 设置弹窗样式(底部弹出)
|
|
|
|
|
+ if (@available(iOS 15.0, *)) {
|
|
|
|
|
+ UISheetPresentationController *sheet = commentVC.sheetPresentationController;
|
|
|
|
|
+ sheet.detents = @[
|
|
|
|
|
+ [UISheetPresentationControllerDetent mediumDetent],
|
|
|
|
|
+ [UISheetPresentationControllerDetent largeDetent]
|
|
|
|
|
+ ];
|
|
|
|
|
+ sheet.prefersGrabberVisible = YES;
|
|
|
|
|
+ }
|
|
|
|
|
+ [self presentViewController:commentVC animated:YES completion:^{
|
|
|
|
|
+ NSLog(@"[JXShortDrama] 🗨️ commentVC present 完成!");
|
|
|
|
|
+ }];
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
- (void)collectionViewControllerDidSelectEpisode:(NSString *)episodeId {
|
|
- (void)collectionViewControllerDidSelectEpisode:(NSString *)episodeId {
|
|
|
NSLog(@"[JXShortDrama] 选择播放剧集: %@", episodeId);
|
|
NSLog(@"[JXShortDrama] 选择播放剧集: %@", episodeId);
|
|
|
|
|
|
|
@@ -317,56 +343,48 @@
|
|
|
|
|
|
|
|
#pragma mark - Helper Methods
|
|
#pragma mark - Helper Methods
|
|
|
|
|
|
|
|
-- (void)setupInteractionButtonsForCell:(UICollectionViewCell *)cell atY:(CGFloat)y {
|
|
|
|
|
|
|
+- (void)setupInteractionButtonsForCell:(UICollectionViewCell *)cell {
|
|
|
CGFloat width = cell.contentView.bounds.size.width;
|
|
CGFloat width = cell.contentView.bounds.size.width;
|
|
|
-
|
|
|
|
|
- UIView *container = [[UIView alloc] initWithFrame:CGRectMake(width - 70, y, 60, 180)];
|
|
|
|
|
|
|
+ UIView *container = [[UIView alloc] initWithFrame:CGRectMake(width - 48, kScreenHeight - safebottom - 190 - 90, 32, 190)];
|
|
|
[cell.contentView addSubview:container];
|
|
[cell.contentView addSubview:container];
|
|
|
|
|
|
|
|
- CGFloat buttonY = 0;
|
|
|
|
|
|
|
|
|
|
// 点赞
|
|
// 点赞
|
|
|
- UIButton *likeButton = [UIButton buttonWithType:UIButtonTypeSystem];
|
|
|
|
|
- likeButton.frame = CGRectMake(10, buttonY, 40, 40);
|
|
|
|
|
- [likeButton setImage:[UIImage systemImageNamed:@"heart"] forState:UIControlStateNormal];
|
|
|
|
|
- [likeButton setImage:[UIImage systemImageNamed:@"heart.fill"] forState:UIControlStateSelected];
|
|
|
|
|
- likeButton.tintColor = [UIColor whiteColor];
|
|
|
|
|
|
|
+ UIButton *likeButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
|
|
|
+ likeButton.frame = CGRectMake(0, 0, 32, 32);
|
|
|
|
|
+ [likeButton setImage:[UIImage imageNamed:@"icon 1.1"] forState:UIControlStateNormal];
|
|
|
|
|
+ [likeButton setImage:[UIImage imageNamed:@"icon 1.5"] forState:UIControlStateSelected];
|
|
|
[container addSubview:likeButton];
|
|
[container addSubview:likeButton];
|
|
|
|
|
|
|
|
- UILabel *likeCountLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, buttonY + 40, 60, 20)];
|
|
|
|
|
|
|
+ UILabel *likeCountLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 40, 32, 18)];
|
|
|
likeCountLabel.textAlignment = NSTextAlignmentCenter;
|
|
likeCountLabel.textAlignment = NSTextAlignmentCenter;
|
|
|
likeCountLabel.font = [UIFont systemFontOfSize:12];
|
|
likeCountLabel.font = [UIFont systemFontOfSize:12];
|
|
|
likeCountLabel.textColor = [UIColor whiteColor];
|
|
likeCountLabel.textColor = [UIColor whiteColor];
|
|
|
likeCountLabel.text = [self formatCount:self.interaction.likeCount];
|
|
likeCountLabel.text = [self formatCount:self.interaction.likeCount];
|
|
|
[container addSubview:likeCountLabel];
|
|
[container addSubview:likeCountLabel];
|
|
|
|
|
|
|
|
- buttonY += 70;
|
|
|
|
|
-
|
|
|
|
|
// 收藏
|
|
// 收藏
|
|
|
- UIButton *favoriteButton = [UIButton buttonWithType:UIButtonTypeSystem];
|
|
|
|
|
- favoriteButton.frame = CGRectMake(10, buttonY, 40, 40);
|
|
|
|
|
- [favoriteButton setImage:[UIImage systemImageNamed:@"star"] forState:UIControlStateNormal];
|
|
|
|
|
- [favoriteButton setImage:[UIImage systemImageNamed:@"star.fill"] forState:UIControlStateSelected];
|
|
|
|
|
- favoriteButton.tintColor = [UIColor whiteColor];
|
|
|
|
|
|
|
+ UIButton *favoriteButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
|
|
|
+ favoriteButton.frame = CGRectMake(0, CGRectGetMaxY(likeCountLabel.frame) + 20, 32, 32);
|
|
|
|
|
+ [favoriteButton setImage:[UIImage imageNamed:@"icon 1.2"] forState:UIControlStateNormal];
|
|
|
|
|
+ [favoriteButton setImage:[UIImage imageNamed:@"icon 1.5"] forState:UIControlStateSelected];
|
|
|
[container addSubview:favoriteButton];
|
|
[container addSubview:favoriteButton];
|
|
|
|
|
|
|
|
- UILabel *favoriteCountLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, buttonY + 40, 60, 20)];
|
|
|
|
|
|
|
+ UILabel *favoriteCountLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(favoriteButton.frame), 32, 18)];
|
|
|
favoriteCountLabel.textAlignment = NSTextAlignmentCenter;
|
|
favoriteCountLabel.textAlignment = NSTextAlignmentCenter;
|
|
|
favoriteCountLabel.font = [UIFont systemFontOfSize:12];
|
|
favoriteCountLabel.font = [UIFont systemFontOfSize:12];
|
|
|
favoriteCountLabel.textColor = [UIColor whiteColor];
|
|
favoriteCountLabel.textColor = [UIColor whiteColor];
|
|
|
favoriteCountLabel.text = [self formatCount:self.interaction.favoriteCount];
|
|
favoriteCountLabel.text = [self formatCount:self.interaction.favoriteCount];
|
|
|
[container addSubview:favoriteCountLabel];
|
|
[container addSubview:favoriteCountLabel];
|
|
|
|
|
|
|
|
- buttonY += 70;
|
|
|
|
|
|
|
|
|
|
// 评论
|
|
// 评论
|
|
|
- UIButton *commentButton = [UIButton buttonWithType:UIButtonTypeSystem];
|
|
|
|
|
- commentButton.frame = CGRectMake(10, buttonY, 40, 40);
|
|
|
|
|
- [commentButton setImage:[UIImage systemImageNamed:@"bubble.right"] forState:UIControlStateNormal];
|
|
|
|
|
- commentButton.tintColor = [UIColor whiteColor];
|
|
|
|
|
|
|
+ UIButton *commentButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
|
|
|
+ commentButton.frame = CGRectMake(0, CGRectGetMaxY(favoriteCountLabel.frame) + 20, 32, 32);
|
|
|
|
|
+ [commentButton setImage:[UIImage imageNamed:@"icon 1.3"] forState:UIControlStateNormal];
|
|
|
[container addSubview:commentButton];
|
|
[container addSubview:commentButton];
|
|
|
-// [commentButton addTarget:self action:@selector(commentDidClicked) forControlEvents:UIControlEventTouchUpInside];
|
|
|
|
|
- UILabel *commentCountLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, buttonY + 40, 60, 20)];
|
|
|
|
|
|
|
+ [commentButton addTarget:self action:@selector(commentDidClicked) forControlEvents:UIControlEventTouchUpInside];
|
|
|
|
|
+ UILabel *commentCountLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(commentButton.frame) , 32, 18)];
|
|
|
commentCountLabel.textAlignment = NSTextAlignmentCenter;
|
|
commentCountLabel.textAlignment = NSTextAlignmentCenter;
|
|
|
commentCountLabel.font = [UIFont systemFontOfSize:12];
|
|
commentCountLabel.font = [UIFont systemFontOfSize:12];
|
|
|
commentCountLabel.textColor = [UIColor whiteColor];
|
|
commentCountLabel.textColor = [UIColor whiteColor];
|