diff --git a/Pica.xcodeproj/project.pbxproj b/Pica.xcodeproj/project.pbxproj index e44bb6c..02fb81d 100644 --- a/Pica.xcodeproj/project.pbxproj +++ b/Pica.xcodeproj/project.pbxproj @@ -23,6 +23,8 @@ 3329FE4D265B7BAA0054F39B /* PCKnightRankRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 3329FE4C265B7BAA0054F39B /* PCKnightRankRequest.m */; }; 3329FE50265B83F60054F39B /* PCComicRankCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 3329FE4F265B83F60054F39B /* PCComicRankCell.m */; }; 3329FE53265B90C40054F39B /* PCKnightRankCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 3329FE52265B90C40054F39B /* PCKnightRankCell.m */; }; + 332F292827CDF1E90003F642 /* PCComicSimilarRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 332F292727CDF1E90003F642 /* PCComicSimilarRequest.m */; }; + 332F294527CF7DB70003F642 /* PCComicRecommendView.m in Sources */ = {isa = PBXBuildFile; fileRef = 332F294427CF7DB70003F642 /* PCComicRecommendView.m */; }; 33454F032797EF4F00778FAC /* PCImagePreviewView.m in Sources */ = {isa = PBXBuildFile; fileRef = 33454F022797EF4F00778FAC /* PCImagePreviewView.m */; }; 334EAD6725593BB400B0231C /* PCComic.m in Sources */ = {isa = PBXBuildFile; fileRef = 334EAD6625593BB400B0231C /* PCComic.m */; }; 334EAD6B25593E7900B0231C /* PCTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 334EAD6A25593E7900B0231C /* PCTableViewCell.m */; }; @@ -177,6 +179,11 @@ 3329FE4F265B83F60054F39B /* PCComicRankCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PCComicRankCell.m; sourceTree = ""; }; 3329FE51265B90C40054F39B /* PCKnightRankCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PCKnightRankCell.h; sourceTree = ""; }; 3329FE52265B90C40054F39B /* PCKnightRankCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PCKnightRankCell.m; sourceTree = ""; }; + 332F292427CC6BA30003F642 /* PCStatisticHeader.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PCStatisticHeader.h; sourceTree = ""; }; + 332F292627CDF1E90003F642 /* PCComicSimilarRequest.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PCComicSimilarRequest.h; sourceTree = ""; }; + 332F292727CDF1E90003F642 /* PCComicSimilarRequest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PCComicSimilarRequest.m; sourceTree = ""; }; + 332F294327CF7DB70003F642 /* PCComicRecommendView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PCComicRecommendView.h; sourceTree = ""; }; + 332F294427CF7DB70003F642 /* PCComicRecommendView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PCComicRecommendView.m; sourceTree = ""; }; 33454F012797EF4F00778FAC /* PCImagePreviewView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PCImagePreviewView.h; sourceTree = ""; }; 33454F022797EF4F00778FAC /* PCImagePreviewView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PCImagePreviewView.m; sourceTree = ""; }; 334EAD6525593BB400B0231C /* PCComic.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PCComic.h; sourceTree = ""; }; @@ -764,6 +771,7 @@ 334EAD752559409A00B0231C /* PCDefineHeader.h */, 334EAD94255A6DCC00B0231C /* PCIconHeader.h */, 330B10F626A193470075A9A0 /* PCLocalKeyHeader.h */, + 332F292427CC6BA30003F642 /* PCStatisticHeader.h */, ); path = Header; sourceTree = ""; @@ -955,6 +963,8 @@ 3306A451266A17FF00FC397A /* PCCommentLikeRequest.m */, 336886C727ACF0F200474151 /* PCComicCollectionRequest.h */, 336886C627ACF0F200474151 /* PCComicCollectionRequest.m */, + 332F292627CDF1E90003F642 /* PCComicSimilarRequest.h */, + 332F292727CDF1E90003F642 /* PCComicSimilarRequest.m */, ); path = Request; sourceTree = ""; @@ -988,6 +998,8 @@ 330FA71A2664CFF000C146BE /* PCSearchRecordView.m */, 33BF13EE26CA75FA002EC325 /* PCTiledImageView.h */, 33BF13EF26CA75FA002EC325 /* PCTiledImageView.m */, + 332F294327CF7DB70003F642 /* PCComicRecommendView.h */, + 332F294427CF7DB70003F642 /* PCComicRecommendView.m */, ); path = View; sourceTree = ""; @@ -1260,6 +1272,7 @@ 337AD6CB2678A1E7009EA2D1 /* PCChatManager.m in Sources */, 33AD9438255107C70079DFAE /* PCCategoryController.m in Sources */, 334EAE17255BDA8E00B0231C /* PCCommentCell.m in Sources */, + 332F292827CDF1E90003F642 /* PCComicSimilarRequest.m in Sources */, 3306A44F266A0EAF00FC397A /* PCCommentPublishRequest.m in Sources */, 33DC428C27B62E8100D8A105 /* NSFWFile.m in Sources */, 33D41111279AA9200017957E /* PCLocalAuthentication.m in Sources */, @@ -1306,6 +1319,7 @@ 334EADDD255A8A8500B0231C /* UIView+PCAdd.m in Sources */, 33AD93D8255017170079DFAE /* main.m in Sources */, 3358C8B7265F88F30000D17F /* PCPunchInRequest.m in Sources */, + 332F294527CF7DB70003F642 /* PCComicRecommendView.m in Sources */, 33D41114279AABBB0017957E /* PCAuthenticationController.m in Sources */, 33669FFF2553E18C00AEC598 /* PCComicDetailRequest.m in Sources */, 3377E97D26E9AB93005F7E3B /* PCNameSetRequest.m in Sources */, @@ -1480,7 +1494,6 @@ DEVELOPMENT_TEAM = WX7HG5RLRC; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", - "$(PROJECT_DIR)/Pica/TencentOpenApi", "$(PROJECT_DIR)/Pica", ); INFOPLIST_FILE = Pica/Info.plist; @@ -1490,7 +1503,7 @@ "@executable_path/Frameworks", ); LIBRARY_SEARCH_PATHS = "$(inherited)"; - MARKETING_VERSION = 1.2.1; + MARKETING_VERSION = 1.2.2; PRODUCT_BUNDLE_IDENTIFIER = com.yuecheng.pica; PRODUCT_NAME = "$(TARGET_NAME)"; TARGETED_DEVICE_FAMILY = 1; @@ -1507,7 +1520,6 @@ DEVELOPMENT_TEAM = WX7HG5RLRC; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", - "$(PROJECT_DIR)/Pica/TencentOpenApi", "$(PROJECT_DIR)/Pica", ); INFOPLIST_FILE = Pica/Info.plist; @@ -1517,7 +1529,7 @@ "@executable_path/Frameworks", ); LIBRARY_SEARCH_PATHS = "$(inherited)"; - MARKETING_VERSION = 1.2.1; + MARKETING_VERSION = 1.2.2; PRODUCT_BUNDLE_IDENTIFIER = com.yuecheng.pica; PRODUCT_NAME = "$(TARGET_NAME)"; TARGETED_DEVICE_FAMILY = 1; diff --git a/Pica/Category/Controller/PCCategoryController.m b/Pica/Category/Controller/PCCategoryController.m index d16c9a8..256551a 100644 --- a/Pica/Category/Controller/PCCategoryController.m +++ b/Pica/Category/Controller/PCCategoryController.m @@ -240,6 +240,7 @@ - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPa controller = list; } if (controller) { + [MobClick event:PC_EVENT_CATEGORY_CLICK attributes:@{@"title" : category.title}]; [self.navigationController pushViewController:controller animated:YES]; } } diff --git a/Pica/Category/Controller/PCComicDetailController.m b/Pica/Category/Controller/PCComicDetailController.m index 0ac6bdc..6761e74 100644 --- a/Pica/Category/Controller/PCComicDetailController.m +++ b/Pica/Category/Controller/PCComicDetailController.m @@ -9,17 +9,22 @@ #import "PCComicDetailController.h" #import "PCComicDetailRequest.h" #import "PCComicEpisodeRequest.h" +#import "PCComicSimilarRequest.h" #import "PCComicInfoView.h" #import "PCComicEpisodeView.h" #import "PCComicHistory.h" #import "PCComicPictureController.h" +#import "PCComicRecommendView.h" @interface PCComicDetailController () +@property (nonatomic, strong) PCComicRecommendView *recommendView; @property (nonatomic, copy) NSString *comicId; @property (nonatomic, strong) PCComic *comic; @property (nonatomic, strong) PCComicEpisodeRequest *episodeRequest; +@property (nonatomic, strong) PCComicSimilarRequest *similarRequest; @property (nonatomic, strong) NSMutableArray *episodeArray; +@property (nonatomic, copy) NSArray *similarArray; @property (nonatomic, assign) BOOL continueReadTag; @@ -45,6 +50,7 @@ - (void)viewDidLoad { [self requestComicDetail]; [self requestComicEpisode]; + [self requestComicSimilar]; } - (void)initTableView { @@ -93,6 +99,14 @@ - (void)requestComicEpisode { }]; } +- (void)requestComicSimilar { + [self.similarRequest sendRequest:^(NSArray * response) { + self.similarArray = response; + } failure:^(NSError * _Nonnull error) { + + }]; +} + #pragma mark - Action - (void)continuReadAction:(QMUIButton *)sender { PCComic *comic = [kPCComicHistory comicWithId:self.comicId]; @@ -130,11 +144,11 @@ - (void)continuReadAction:(QMUIButton *)sender { #pragma mark - TableView - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { - return 1; + return 2; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { - return self.episodeArray.count; + return section == 0 ? self.episodeArray.count : 0; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { @@ -161,25 +175,33 @@ - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPa } - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section { - PCComic *comic = [kPCComicHistory comicWithId:self.comicId]; - return (comic.historyEpisodeTitle && - comic.historyEpisodeId) ? 44 : 0; + if (section == 0) { + PCComic *comic = [kPCComicHistory comicWithId:self.comicId]; + return (comic.historyEpisodeTitle && + comic.historyEpisodeId) ? 44 : 0; + } else { + return self.similarArray.count ? self.recommendView.qmui_height : CGFLOAT_MIN; + } } - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { - PCComic *comic = [kPCComicHistory comicWithId:self.comicId]; - if ((comic.historyEpisodeTitle && - comic.historyEpisodeId)) { - QMUIButton *button = [[QMUIButton alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 44)]; - button.backgroundColor = UIColorWhite; - [button setTitle:[NSString stringWithFormat:@"续看 %@", comic.historyEpisodeTitle] forState:UIControlStateNormal]; - button.titleLabel.font = UIFontMake(14); - button.titleEdgeInsets = UIEdgeInsetsMake(0, 15, 0, 0); - button.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft; - [button addTarget:self action:@selector(continuReadAction:) forControlEvents:UIControlEventTouchUpInside]; - return button; + if (section == 0) { + PCComic *comic = [kPCComicHistory comicWithId:self.comicId]; + if ((comic.historyEpisodeTitle && + comic.historyEpisodeId)) { + QMUIButton *button = [[QMUIButton alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 44)]; + button.backgroundColor = UIColorWhite; + [button setTitle:[NSString stringWithFormat:@"续看 %@", comic.historyEpisodeTitle] forState:UIControlStateNormal]; + button.titleLabel.font = UIFontMake(14); + button.titleEdgeInsets = UIEdgeInsetsMake(0, 15, 0, 0); + button.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft; + [button addTarget:self action:@selector(continuReadAction:) forControlEvents:UIControlEventTouchUpInside]; + return button; + } else { + return nil; + } } else { - return nil; + return self.similarArray.count ? self.recommendView : nil; } } @@ -210,6 +232,20 @@ - (PCComicEpisodeRequest *)episodeRequest { return _episodeRequest; } +- (PCComicSimilarRequest *)similarRequest { + if (!_similarRequest) { + _similarRequest = [[PCComicSimilarRequest alloc] initWithComicId:self.comicId]; + } + return _similarRequest; +} + +- (PCComicRecommendView *)recommendView { + if (!_recommendView) { + _recommendView = [[PCComicRecommendView alloc] init]; + } + return _recommendView; +} + #pragma mark - Set - (void)setComic:(PCComic *)comic { _comic = comic; @@ -218,4 +254,12 @@ - (void)setComic:(PCComic *)comic { self.tableView.tableHeaderView = [self tableHeaderView]; } +- (void)setSimilarArray:(NSArray *)similarArray { + _similarArray = similarArray; + self.recommendView.comicArray = similarArray; + [self.recommendView sizeToFit]; + [self.tableView reloadData]; +} + + @end diff --git a/Pica/Category/Controller/PCComicListController.m b/Pica/Category/Controller/PCComicListController.m index 402eeaa..25273b1 100644 --- a/Pica/Category/Controller/PCComicListController.m +++ b/Pica/Category/Controller/PCComicListController.m @@ -46,7 +46,8 @@ - (void)viewDidLoad { case PCComicListTypeHistory: self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemTrash target:self action:@selector(deleteAction:)]; break; - case PCComicListTypeRecommend: + case PCComicListTypeSearch: + [MobClick event:PC_EVENT_SEARCH attributes:@{@"keyword" : self.keyword}]; break; default: self.navigationItem.rightBarButtonItem = [UIBarButtonItem qmui_itemWithTitle:@"新到旧" target:self action:@selector(sortAction:)]; diff --git a/Pica/Category/Controller/PCComicPictureController.m b/Pica/Category/Controller/PCComicPictureController.m index b9685b8..b4a3874 100644 --- a/Pica/Category/Controller/PCComicPictureController.m +++ b/Pica/Category/Controller/PCComicPictureController.m @@ -144,6 +144,7 @@ - (void)exportAction:(UIBarButtonItem *)sender { NSString *localPath = [[NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) firstObject] stringByAppendingPathComponent:@"comic_temp.html"]; BOOL success = [html writeToFile:localPath atomically:YES encoding:NSUTF8StringEncoding error:nil]; if (success) { + [MobClick event:PC_EVENT_COMIC_EXPORT]; NSMutableArray *activityItems = [NSMutableArray array]; [activityItems addObject:[NSURL fileURLWithPath:localPath]]; diff --git a/Pica/Category/Controller/PCCommentController.m b/Pica/Category/Controller/PCCommentController.m index 7eca937..f9c76c6 100644 --- a/Pica/Category/Controller/PCCommentController.m +++ b/Pica/Category/Controller/PCCommentController.m @@ -229,6 +229,7 @@ - (void)requestComment { } - (void)publishComment { + [MobClick event:PC_EVENT_COMMENT]; QMUITips *loading = [QMUITips showLoadingInView:DefaultTipsParentView]; [self.publishRequest sendRequest:^(PCComment *comment) { diff --git a/Pica/Category/Request/PCComicSimilarRequest.h b/Pica/Category/Request/PCComicSimilarRequest.h new file mode 100644 index 0000000..74d0f86 --- /dev/null +++ b/Pica/Category/Request/PCComicSimilarRequest.h @@ -0,0 +1,20 @@ +// +// PCComicSimilarRequest.h +// Pica +// +// Created by Fancy on 2022/3/1. +// Copyright © 2022 fancy. All rights reserved. +// + +#import "PCRequest.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface PCComicSimilarRequest : PCRequest + +@property (nonatomic, copy) NSString *comicId; +- (instancetype)initWithComicId:(NSString *)comicId; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Pica/Category/Request/PCComicSimilarRequest.m b/Pica/Category/Request/PCComicSimilarRequest.m new file mode 100644 index 0000000..f27e28e --- /dev/null +++ b/Pica/Category/Request/PCComicSimilarRequest.m @@ -0,0 +1,46 @@ +// +// PCComicSimilarRequest.m +// Pica +// +// Created by Fancy on 2022/3/1. +// Copyright © 2022 fancy. All rights reserved. +// + +#import "PCComicSimilarRequest.h" +#import +#import "PCComic.h" + +@implementation PCComicSimilarRequest + +- (instancetype)initWithComicId:(NSString *)comicId { + if (self = [super init]) { + _comicId = [comicId copy]; + } + return self; +} + +- (void)sendRequest:(void (^)(id response))success + failure:(void (^)(NSError *error))failure { + [super sendRequest:success failure:failure]; + + [self startWithCompletionBlockWithSuccess:^(__kindof YTKBaseRequest * _Nonnull request) { + NSArray *comics = [NSArray yy_modelArrayWithClass:PCComic.class json:request.responseJSONObject[@"data"][@"comics"]]; + !success ? : success(comics); + } failure:^(__kindof YTKBaseRequest * _Nonnull request) { + !failure ? : failure(request.error); + }]; +} + +- (NSString *)requestUrl { + return [NSString stringWithFormat:PC_API_COMICS_RECOMMENDATION, self.comicId]; +} + +- (NSDictionary *)requestHeaderFieldValueDictionary { + return [PCRequest headerWithUrl:[self requestUrl] method:@"GET" time:[NSDate date]]; +} + +- (YTKRequestMethod)requestMethod { + return YTKRequestMethodGET; +} + +@end diff --git a/Pica/Category/View/PCComicRecommendView.h b/Pica/Category/View/PCComicRecommendView.h new file mode 100644 index 0000000..66ccf54 --- /dev/null +++ b/Pica/Category/View/PCComicRecommendView.h @@ -0,0 +1,19 @@ +// +// PCComicRecommendView.h +// Pica +// +// Created by Fancy on 2022/3/2. +// Copyright © 2022 fancy. All rights reserved. +// + +#import + +NS_ASSUME_NONNULL_BEGIN +@class PCComic; +@interface PCComicRecommendView : UIView + +@property (nonatomic, copy) NSArray *comicArray; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Pica/Category/View/PCComicRecommendView.m b/Pica/Category/View/PCComicRecommendView.m new file mode 100644 index 0000000..72354cf --- /dev/null +++ b/Pica/Category/View/PCComicRecommendView.m @@ -0,0 +1,139 @@ +// +// PCComicRecommendView.m +// Pica +// +// Created by Fancy on 2022/3/2. +// Copyright © 2022 fancy. All rights reserved. +// + +#import "PCComicRecommendView.h" +#import "PCVendorHeader.h" +#import "PCDefineHeader.h" +#import "PCComic.h" +#import "PCCommonUI.h" +#import "PCComicDetailController.h" +#import "PCComicHistory.h" +#import "UIImageView+PCAdd.h" + +@interface PCComicRecommendView () + +@property (nonatomic, strong) QMUILabel *titleLabel; +@property (nonatomic, strong) UICollectionView *collectionView; + +@end + +@implementation PCComicRecommendView + +- (instancetype)initWithCoder:(NSCoder *)coder { + if (self = [super initWithCoder:coder]) { + [self didInitialize]; + } + return self; +} + +- (instancetype)initWithFrame:(CGRect)frame { + if ([super initWithFrame:frame]) { + [self didInitialize]; + } + return self; +} + +- (void)didInitialize { + self.backgroundColor = UIColorWhite; + [self addSubview:self.titleLabel]; + [self addSubview:self.collectionView]; +} + +- (void)layoutSubviews { + [super layoutSubviews]; + + CGFloat width = self.qmui_width; + self.titleLabel.frame = CGRectMake(15, 20, width - 30, QMUIViewSelfSizingHeight); + self.collectionView.frame = CGRectMake(0, self.titleLabel.qmui_bottom + 10, width, width / 5 / 9 * 16); +} + +- (CGSize)sizeThatFits:(CGSize)size { + CGFloat height = 0; + height += 20 + [self.titleLabel sizeThatFits:CGSizeMax].height + 10 + SCREEN_WIDTH / 5 / 9 * 16 + 60 + 15; + return CGSizeMake(SCREEN_WIDTH, height); +} + +#pragma mark - CollectionView +- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView { + return 1; +} + +- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { + return self.comicArray.count; +} + +- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { + UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"UICollectionViewCell" forIndexPath:indexPath]; + + UIImageView *coverView = [cell.contentView viewWithTag:1000]; + if (!coverView) { + coverView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, cell.qmui_width, cell.qmui_height - 60)]; + coverView.contentMode = UIViewContentModeScaleAspectFill; + coverView.clipsToBounds = YES; + coverView.tag = 1000; + [cell.contentView addSubview:coverView]; + } + QMUILabel *titleLabel = [cell.contentView viewWithTag:1001]; + if (!titleLabel) { + titleLabel = [[QMUILabel alloc] init]; + titleLabel.tag = 1001; + titleLabel.font = UIFontMake(12); + titleLabel.numberOfLines = 2; + [cell.contentView addSubview:titleLabel]; + } + + PCComic *comic = self.comicArray[indexPath.item]; + [coverView pc_setImageWithURL:comic.thumb.imageURL]; + titleLabel.text = comic.title; + titleLabel.frame = CGRectMake(0, coverView.qmui_bottom, cell.qmui_width, QMUIViewSelfSizingHeight); + return cell; +} + +- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { + [collectionView deselectItemAtIndexPath:indexPath animated:NO]; + PCComic *comic = self.comicArray[indexPath.item]; + [kPCComicHistory saveComic:comic]; + PCComicDetailController *detail = [[PCComicDetailController alloc] initWithComicId:comic.comicId]; + [[QMUIHelper visibleViewController].navigationController pushViewController:detail animated:YES]; +} + +#pragma mark - Get +- (QMUILabel *)titleLabel { + if (!_titleLabel) { + _titleLabel = [[QMUILabel alloc] qmui_initWithFont:UIFontMake(15) textColor:UIColorBlack]; + _titleLabel.text = @"看了这本子的人也在看"; + } + return _titleLabel; +} + +- (UICollectionView *)collectionView { + if (!_collectionView) { + UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; + layout.minimumLineSpacing = 0; + layout.minimumInteritemSpacing = 0; + layout.scrollDirection = UICollectionViewScrollDirectionHorizontal; + CGFloat width = floorf(SCREEN_WIDTH / 5); + layout.itemSize = CGSizeMake(width, width / 9 * 16 + 60); + _collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout]; + _collectionView.showsHorizontalScrollIndicator = NO; + _collectionView.delegate = self; + _collectionView.dataSource = self; + _collectionView.backgroundColor = UIColorClear; + [_collectionView registerClass:[UICollectionViewCell class] forCellWithReuseIdentifier:@"UICollectionViewCell"]; + _collectionView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; + } + return _collectionView; +} + +#pragma mark - Set +- (void)setComicArray:(NSArray *)comicArray { + _comicArray = comicArray; + [self.collectionView reloadData]; +} + +@end diff --git a/Pica/Chat/Controller/PCChatListController.m b/Pica/Chat/Controller/PCChatListController.m index 44d9739..c4261cd 100644 --- a/Pica/Chat/Controller/PCChatListController.m +++ b/Pica/Chat/Controller/PCChatListController.m @@ -68,6 +68,7 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath [tableView deselectRowAtIndexPath:indexPath animated:YES]; PCChatList *list = self.listArray[indexPath.row]; + [MobClick event:PC_EVENT_CHATROOM_CLICK attributes:@{@"title" : list.title}]; PCChatViewController *chat = [[PCChatViewController alloc] initWithURL:list.socketUrl]; chat.title = list.title; [self.navigationController pushViewController:chat animated:YES]; diff --git a/Pica/Common/Configuration/QMUIConfigurationTemplateDefault.m b/Pica/Common/Configuration/QMUIConfigurationTemplateDefault.m index 82c36de..062f729 100644 --- a/Pica/Common/Configuration/QMUIConfigurationTemplateDefault.m +++ b/Pica/Common/Configuration/QMUIConfigurationTemplateDefault.m @@ -97,7 +97,7 @@ - (void)applyConfigurationTemplate { QMUICMI.navBarDisabledAlpha = 0.2f; // NavBarDisabledAlpha : QMUINavigationButton 在 disabled 时的 alpha QMUICMI.navBarButtonFont = UIFontMake(14); // NavBarButtonFont : QMUINavigationButtonTypeNormal 的字体(由于系统存在一些 bug,这个属性默认不对 UIBarButtonItem 生效) QMUICMI.navBarButtonFontBold = UIFontBoldMake(17); // NavBarButtonFontBold : QMUINavigationButtonTypeBold 的字体 - QMUICMI.navBarBackgroundImage = [UIImageMake(@"navigationbar_background") resizableImageWithCapInsets:UIEdgeInsetsMake(0, 1, 0, 1) resizingMode:UIImageResizingModeStretch]; // NavBarBackgroundImage : UINavigationBar 的背景图,注意 navigationBar 的高度会受多个因素(是否全面屏、是否使用了 navigationItem.prompt、是否将 UISearchBar 作为 titleView)的影响,要检查各种情况是否都显示正常。 + QMUICMI.navBarBackgroundImage = nil; // NavBarBackgroundImage : UINavigationBar 的背景图,注意 navigationBar 的高度会受多个因素(是否全面屏、是否使用了 navigationItem.prompt、是否将 UISearchBar 作为 titleView)的影响,要检查各种情况是否都显示正常。 QMUICMI.navBarShadowImage = nil; // NavBarShadowImage : UINavigationBar.shadowImage,也即导航栏底部那条分隔线,配合 NavBarShadowImageColor 使用。 QMUICMI.navBarShadowImageColor = UIColorClear; // NavBarShadowImageColor : UINavigationBar.shadowImage 的颜色,如果为 nil,则使用 NavBarShadowImage 的值,如果 NavBarShadowImage 也为 nil,则使用系统默认的分隔线。如果不为 nil,而 NavBarShadowImage 为 nil,则自动创建一张 1px 高的图并将其设置为 NavBarShadowImageColor 的颜色然后设置上去,如果 NavBarShadowImage 不为 nil 且 renderingMode 不为 UIImageRenderingModeAlwaysOriginal,则将 NavBarShadowImage 设置为 NavBarShadowImageColor 的颜色然后设置上去。 QMUICMI.navBarBarTintColor = nil; // NavBarBarTintColor : UINavigationBar.barTintColor,也即背景色 @@ -114,7 +114,7 @@ - (void)applyConfigurationTemplate { QMUICMI.navBarLoadingMarginRight = 3; // NavBarLoadingMarginRight : QMUINavigationTitleView 里左边 loading 的右边距 QMUICMI.navBarAccessoryViewMarginLeft = 5; // NavBarAccessoryViewMarginLeft : QMUINavigationTitleView 里右边 accessoryView 的左边距 - QMUICMI.navBarActivityIndicatorViewStyle = UIActivityIndicatorViewStyleGray;// NavBarActivityIndicatorViewStyle : QMUINavigationTitleView 里左边 loading 的主题 + QMUICMI.navBarActivityIndicatorViewStyle = UIActivityIndicatorViewStyleMedium;// NavBarActivityIndicatorViewStyle : QMUINavigationTitleView 里左边 loading 的主题 QMUICMI.navBarAccessoryViewTypeDisclosureIndicatorImage = [[UIImage qmui_imageWithShape:QMUIImageShapeTriangle size:CGSizeMake(8, 5) tintColor:nil] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]; // NavBarAccessoryViewTypeDisclosureIndicatorImage : QMUINavigationTitleView 右边箭头的图片 #pragma mark - TabBar diff --git a/Pica/Common/Controller/PCTableViewController.h b/Pica/Common/Controller/PCTableViewController.h index 575176f..333d67d 100644 --- a/Pica/Common/Controller/PCTableViewController.h +++ b/Pica/Common/Controller/PCTableViewController.h @@ -8,6 +8,7 @@ #import "PCVendorHeader.h" #import "PCDefineHeader.h" #import "PCCommonUI.h" +#import "PCStatisticHeader.h" NS_ASSUME_NONNULL_BEGIN diff --git a/Pica/Common/Controller/PCViewController.h b/Pica/Common/Controller/PCViewController.h index 9d521e2..c7dc5bf 100644 --- a/Pica/Common/Controller/PCViewController.h +++ b/Pica/Common/Controller/PCViewController.h @@ -9,6 +9,7 @@ #import "PCVendorHeader.h" #import "PCDefineHeader.h" #import "PCCommonUI.h" +#import "PCStatisticHeader.h" NS_ASSUME_NONNULL_BEGIN diff --git a/Pica/Header/PCAPIHeader.h b/Pica/Header/PCAPIHeader.h index a44bab3..93f193d 100644 --- a/Pica/Header/PCAPIHeader.h +++ b/Pica/Header/PCAPIHeader.h @@ -51,6 +51,8 @@ #define PC_API_COMICS_COMMENTS_LIKE @"comments/%@/like" //评论举报 #define PC_API_COMICS_COMMENTS_REPORT @"comments/%@/report" +//相关漫画 +#define PC_API_COMICS_RECOMMENDATION @"comics/%@/recommendation" //个人信息 #define PC_API_USERS_PROFILE_ME @"users/profile" #define PC_API_USERS_PROFILE @"users/%@/profile" diff --git a/Pica/Header/PCStatisticHeader.h b/Pica/Header/PCStatisticHeader.h new file mode 100644 index 0000000..d52735e --- /dev/null +++ b/Pica/Header/PCStatisticHeader.h @@ -0,0 +1,18 @@ +// +// PCStatisticHeader.h +// Pica +// +// Created by Fancy on 2022/2/28. +// Copyright © 2022 fancy. All rights reserved. +// + +#ifndef PCStatisticHeader_h +#define PCStatisticHeader_h + +#define PC_EVENT_CATEGORY_CLICK @"category_click" +#define PC_EVENT_COMIC_EXPORT @"comic_export" +#define PC_EVENT_CHATROOM_CLICK @"chatroom_lick" +#define PC_EVENT_COMMENT @"comment" +#define PC_EVENT_SEARCH @"search" + +#endif /* PCStatisticHeader_h */ diff --git a/README.md b/README.md index 6993dce..9294ffc 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,9 @@ API来自 [picacomic-api](https://github.com/czp3009/picacomic-api) #### 更新日志 +**v1.2.2** +* 增加“看了这个本子的人也在看” + **v1.2.1** * 增加iOS庇护所分类 * 图片详情页支持导出本子单话html