Skip to content

Commit

Permalink
Merge branch 'release/v1.2.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
fanyuecheng committed Mar 3, 2022
2 parents d19d5ad + dfd4a5a commit c83c885
Show file tree
Hide file tree
Showing 17 changed files with 334 additions and 24 deletions.
20 changes: 16 additions & 4 deletions Pica.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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 */; };
Expand Down Expand Up @@ -177,6 +179,11 @@
3329FE4F265B83F60054F39B /* PCComicRankCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PCComicRankCell.m; sourceTree = "<group>"; };
3329FE51265B90C40054F39B /* PCKnightRankCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PCKnightRankCell.h; sourceTree = "<group>"; };
3329FE52265B90C40054F39B /* PCKnightRankCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PCKnightRankCell.m; sourceTree = "<group>"; };
332F292427CC6BA30003F642 /* PCStatisticHeader.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PCStatisticHeader.h; sourceTree = "<group>"; };
332F292627CDF1E90003F642 /* PCComicSimilarRequest.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PCComicSimilarRequest.h; sourceTree = "<group>"; };
332F292727CDF1E90003F642 /* PCComicSimilarRequest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PCComicSimilarRequest.m; sourceTree = "<group>"; };
332F294327CF7DB70003F642 /* PCComicRecommendView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PCComicRecommendView.h; sourceTree = "<group>"; };
332F294427CF7DB70003F642 /* PCComicRecommendView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PCComicRecommendView.m; sourceTree = "<group>"; };
33454F012797EF4F00778FAC /* PCImagePreviewView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PCImagePreviewView.h; sourceTree = "<group>"; };
33454F022797EF4F00778FAC /* PCImagePreviewView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PCImagePreviewView.m; sourceTree = "<group>"; };
334EAD6525593BB400B0231C /* PCComic.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PCComic.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -764,6 +771,7 @@
334EAD752559409A00B0231C /* PCDefineHeader.h */,
334EAD94255A6DCC00B0231C /* PCIconHeader.h */,
330B10F626A193470075A9A0 /* PCLocalKeyHeader.h */,
332F292427CC6BA30003F642 /* PCStatisticHeader.h */,
);
path = Header;
sourceTree = "<group>";
Expand Down Expand Up @@ -955,6 +963,8 @@
3306A451266A17FF00FC397A /* PCCommentLikeRequest.m */,
336886C727ACF0F200474151 /* PCComicCollectionRequest.h */,
336886C627ACF0F200474151 /* PCComicCollectionRequest.m */,
332F292627CDF1E90003F642 /* PCComicSimilarRequest.h */,
332F292727CDF1E90003F642 /* PCComicSimilarRequest.m */,
);
path = Request;
sourceTree = "<group>";
Expand Down Expand Up @@ -988,6 +998,8 @@
330FA71A2664CFF000C146BE /* PCSearchRecordView.m */,
33BF13EE26CA75FA002EC325 /* PCTiledImageView.h */,
33BF13EF26CA75FA002EC325 /* PCTiledImageView.m */,
332F294327CF7DB70003F642 /* PCComicRecommendView.h */,
332F294427CF7DB70003F642 /* PCComicRecommendView.m */,
);
path = View;
sourceTree = "<group>";
Expand Down Expand Up @@ -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 */,
Expand Down Expand Up @@ -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 */,
Expand Down Expand Up @@ -1480,7 +1494,6 @@
DEVELOPMENT_TEAM = WX7HG5RLRC;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Pica/TencentOpenApi",
"$(PROJECT_DIR)/Pica",
);
INFOPLIST_FILE = Pica/Info.plist;
Expand All @@ -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;
Expand All @@ -1507,7 +1520,6 @@
DEVELOPMENT_TEAM = WX7HG5RLRC;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Pica/TencentOpenApi",
"$(PROJECT_DIR)/Pica",
);
INFOPLIST_FILE = Pica/Info.plist;
Expand All @@ -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;
Expand Down
1 change: 1 addition & 0 deletions Pica/Category/Controller/PCCategoryController.m
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}
}
Expand Down
78 changes: 61 additions & 17 deletions Pica/Category/Controller/PCComicDetailController.m
Original file line number Diff line number Diff line change
Expand Up @@ -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 <PCComicEpisode *> *episodeArray;
@property (nonatomic, copy) NSArray <PCComic *> *similarArray;

@property (nonatomic, assign) BOOL continueReadTag;

Expand All @@ -45,6 +50,7 @@ - (void)viewDidLoad {

[self requestComicDetail];
[self requestComicEpisode];
[self requestComicSimilar];
}

- (void)initTableView {
Expand Down Expand Up @@ -93,6 +99,14 @@ - (void)requestComicEpisode {
}];
}

- (void)requestComicSimilar {
[self.similarRequest sendRequest:^(NSArray <PCComic *>* response) {
self.similarArray = response;
} failure:^(NSError * _Nonnull error) {

}];
}

#pragma mark - Action
- (void)continuReadAction:(QMUIButton *)sender {
PCComic *comic = [kPCComicHistory comicWithId:self.comicId];
Expand Down Expand Up @@ -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 {
Expand All @@ -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;
}
}

Expand Down Expand Up @@ -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;
Expand All @@ -218,4 +254,12 @@ - (void)setComic:(PCComic *)comic {
self.tableView.tableHeaderView = [self tableHeaderView];
}

- (void)setSimilarArray:(NSArray<PCComic *> *)similarArray {
_similarArray = similarArray;
self.recommendView.comicArray = similarArray;
[self.recommendView sizeToFit];
[self.tableView reloadData];
}


@end
3 changes: 2 additions & 1 deletion Pica/Category/Controller/PCComicListController.m
Original file line number Diff line number Diff line change
Expand Up @@ -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:)];
Expand Down
1 change: 1 addition & 0 deletions Pica/Category/Controller/PCComicPictureController.m
Original file line number Diff line number Diff line change
Expand Up @@ -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]];

Expand Down
1 change: 1 addition & 0 deletions Pica/Category/Controller/PCCommentController.m
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ - (void)requestComment {
}

- (void)publishComment {
[MobClick event:PC_EVENT_COMMENT];
QMUITips *loading = [QMUITips showLoadingInView:DefaultTipsParentView];

[self.publishRequest sendRequest:^(PCComment *comment) {
Expand Down
20 changes: 20 additions & 0 deletions Pica/Category/Request/PCComicSimilarRequest.h
Original file line number Diff line number Diff line change
@@ -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
46 changes: 46 additions & 0 deletions Pica/Category/Request/PCComicSimilarRequest.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
//
// PCComicSimilarRequest.m
// Pica
//
// Created by Fancy on 2022/3/1.
// Copyright © 2022 fancy. All rights reserved.
//

#import "PCComicSimilarRequest.h"
#import <YYModel/YYModel.h>
#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<NSString *,NSString *> *)requestHeaderFieldValueDictionary {
return [PCRequest headerWithUrl:[self requestUrl] method:@"GET" time:[NSDate date]];
}

- (YTKRequestMethod)requestMethod {
return YTKRequestMethodGET;
}

@end
19 changes: 19 additions & 0 deletions Pica/Category/View/PCComicRecommendView.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//
// PCComicRecommendView.h
// Pica
//
// Created by Fancy on 2022/3/2.
// Copyright © 2022 fancy. All rights reserved.
//

#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN
@class PCComic;
@interface PCComicRecommendView : UIView

@property (nonatomic, copy) NSArray <PCComic *>*comicArray;

@end

NS_ASSUME_NONNULL_END
Loading

0 comments on commit c83c885

Please sign in to comment.