小说绘上架版本
This commit is contained in:
+17
@@ -0,0 +1,17 @@
|
||||
//
|
||||
// WXYZ_FeedbackAddCollectionViewCell.h
|
||||
// WXReader
|
||||
//
|
||||
// Created by Andrew on 2019/12/27.
|
||||
// Copyright © 2019 Andrew. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface WXYZ_FeedbackAddCollectionViewCell : UICollectionViewCell
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
//
|
||||
// WXYZ_FeedbackAddCollectionViewCell.m
|
||||
// WXReader
|
||||
//
|
||||
// Created by Andrew on 2019/12/27.
|
||||
// Copyright © 2019 Andrew. All rights reserved.
|
||||
//
|
||||
|
||||
#import "WXYZ_FeedbackAddCollectionViewCell.h"
|
||||
|
||||
@implementation WXYZ_FeedbackAddCollectionViewCell
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
if (self = [super initWithFrame:frame]) {
|
||||
[self createSubviews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)createSubviews
|
||||
{
|
||||
self.backgroundColor = kGrayViewColor;
|
||||
|
||||
UIImageView *addImage = [[UIImageView alloc] init];
|
||||
addImage.image = [UIImage imageNamed:@"public_rack_add"];
|
||||
[self addSubview:addImage];
|
||||
|
||||
[addImage mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.mas_equalTo(self.mas_centerX);
|
||||
make.centerY.mas_equalTo(self.mas_centerY);
|
||||
make.width.height.mas_equalTo(self.mas_width).multipliedBy(0.3);
|
||||
}];
|
||||
}
|
||||
|
||||
@end
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
//
|
||||
// WXYZ_FeedbackCollectionViewCell.h
|
||||
// WXReader
|
||||
//
|
||||
// Created by Andrew on 2019/12/27.
|
||||
// Copyright © 2019 Andrew. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "WXYZ_FeedbackPhotoModel.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface WXYZ_FeedbackCollectionViewCell : UICollectionViewCell
|
||||
|
||||
@property (nonatomic, strong) WXYZ_FeedbackPhotoModel *photoModel;
|
||||
|
||||
@property (nonatomic, strong) UIImage *uploadImage;
|
||||
|
||||
@property (nonatomic, strong) UIImageView *feedbackImage;
|
||||
|
||||
@property (nonatomic, assign) NSInteger cellIndex;
|
||||
|
||||
@property (nonatomic, copy) void(^deleteImageBlock)(NSInteger index);
|
||||
|
||||
@property (nonatomic, copy) void(^finishedUploadBlock)(NSString *img);
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
+94
@@ -0,0 +1,94 @@
|
||||
//
|
||||
// WXYZ_FeedbackCollectionViewCell.m
|
||||
// WXReader
|
||||
//
|
||||
// Created by Andrew on 2019/12/27.
|
||||
// Copyright © 2019 Andrew. All rights reserved.
|
||||
//
|
||||
|
||||
#import "WXYZ_FeedbackCollectionViewCell.h"
|
||||
#import "WXYZ_FeedbackPhotoManager.h"
|
||||
|
||||
@interface WXYZ_FeedbackCollectionViewCell ()
|
||||
|
||||
@property (nonatomic, strong) UIActivityIndicatorView *activityView;
|
||||
|
||||
@property (nonatomic, strong) UIButton *closeButton;
|
||||
|
||||
@end
|
||||
|
||||
@implementation WXYZ_FeedbackCollectionViewCell
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
if (self = [super initWithFrame:frame]) {
|
||||
[self createSubviews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)createSubviews
|
||||
{
|
||||
self.feedbackImage = [[UIImageView alloc] init];
|
||||
self.feedbackImage.contentMode = UIViewContentModeScaleAspectFill;
|
||||
self.feedbackImage.clipsToBounds = YES;
|
||||
self.feedbackImage.image = HoldImage;
|
||||
[self addSubview:self.feedbackImage];
|
||||
|
||||
[self.feedbackImage mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.mas_equalTo(self);
|
||||
}];
|
||||
|
||||
self.activityView = [[UIActivityIndicatorView alloc] init];
|
||||
self.activityView.activityIndicatorViewStyle = UIActivityIndicatorViewStyleGray;
|
||||
self.activityView.hidesWhenStopped = YES;
|
||||
[self addSubview:self.activityView];
|
||||
|
||||
[self.activityView startAnimating];
|
||||
|
||||
[self.activityView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.mas_equalTo(self.mas_centerX);
|
||||
make.centerY.mas_equalTo(self.mas_centerY);
|
||||
make.width.height.mas_equalTo(30);
|
||||
}];
|
||||
|
||||
self.closeButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
self.closeButton.hidden = YES;
|
||||
self.closeButton.adjustsImageWhenHighlighted = NO;
|
||||
[self.closeButton setImageEdgeInsets:UIEdgeInsetsMake(0, 10, 10, 0)];
|
||||
[self.closeButton setImage:[UIImage imageNamed:@"feedback_photo_delete"] forState:UIControlStateNormal];
|
||||
[self.closeButton addTarget:self action:@selector(deleteClick) forControlEvents:UIControlEventTouchUpInside];
|
||||
[self addSubview:self.closeButton];
|
||||
|
||||
[self.closeButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.right.mas_equalTo(self.mas_right);
|
||||
make.top.mas_equalTo(self.mas_top);
|
||||
make.width.height.mas_equalTo(self.mas_width).multipliedBy(0.3);
|
||||
}];
|
||||
|
||||
|
||||
}
|
||||
|
||||
- (void)setPhotoModel:(WXYZ_FeedbackPhotoModel *)photoModel
|
||||
{
|
||||
_photoModel = photoModel;
|
||||
|
||||
if (photoModel.show_img.length > 0) {
|
||||
WS(weakSelf)
|
||||
[self.feedbackImage setImageWithURL:[NSURL URLWithString:photoModel.show_img] placeholder:HoldImage options:YYWebImageOptionSetImageWithFadeAnimation completion:^(UIImage * _Nullable image, NSURL * _Nonnull url, YYWebImageFromType from, YYWebImageStage stage, NSError * _Nullable error) {
|
||||
[weakSelf.activityView stopAnimating];
|
||||
weakSelf.closeButton.hidden = NO;
|
||||
}];
|
||||
} else {
|
||||
self.feedbackImage.image = HoldImage;
|
||||
[self.activityView startAnimating];
|
||||
self.closeButton.hidden = YES;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)deleteClick
|
||||
{
|
||||
[[WXYZ_FeedbackPhotoManager sharedManager] deletePhotoWithPhotoModel:self.photoModel];
|
||||
}
|
||||
|
||||
@end
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// WXYZ_FeedbackContactTableViewCell.h
|
||||
// WXReader
|
||||
//
|
||||
// Created by Andrew on 2019/12/27.
|
||||
// Copyright © 2019 Andrew. All rights reserved.
|
||||
//
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface WXYZ_FeedbackContactTableViewCell : TFBasicTableViewCell
|
||||
|
||||
@property (nonatomic, copy) void(^contactDidChange)(NSString *contactString);
|
||||
|
||||
@property (nonatomic, copy) void(^willBeginEditing)(void);
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
//
|
||||
// WXYZ_FeedbackContactTableViewCell.m
|
||||
// WXReader
|
||||
//
|
||||
// Created by Andrew on 2019/12/27.
|
||||
// Copyright © 2019 Andrew. All rights reserved.
|
||||
//
|
||||
|
||||
#import "WXYZ_FeedbackContactTableViewCell.h"
|
||||
|
||||
@interface WXYZ_FeedbackContactTableViewCell () <UITextFieldDelegate>
|
||||
{
|
||||
UITextField *textField;
|
||||
}
|
||||
|
||||
@property (nonatomic, copy) NSString *contactString;
|
||||
|
||||
@end
|
||||
|
||||
@implementation WXYZ_FeedbackContactTableViewCell
|
||||
|
||||
- (void)createSubviews
|
||||
{
|
||||
[super createSubviews];
|
||||
|
||||
textField = [[UITextField alloc] init];
|
||||
textField.backgroundColor = [UIColor clearColor];
|
||||
textField.font = kMainFont;
|
||||
textField.delegate = self;
|
||||
textField.clearButtonMode = UITextFieldViewModeWhileEditing;
|
||||
textField.textColor = kBlackColor;
|
||||
NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:TFLocalizedString(@"邮箱/手机号")];
|
||||
[attributedString setAttributes:@{NSFontAttributeName:kMainFont, NSForegroundColorAttributeName:kColorRGBA(199, 199, 205, 1)} range:NSMakeRange(0, attributedString.length)];
|
||||
textField.attributedPlaceholder = attributedString;
|
||||
[self.contentView addSubview:textField];
|
||||
|
||||
[textField mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.contentView.mas_left).with.offset(kMargin);
|
||||
make.top.mas_equalTo(self.contentView.mas_top);
|
||||
make.width.mas_equalTo(SCREEN_WIDTH - 2 * kMargin);
|
||||
make.height.mas_equalTo(KCellHeight);
|
||||
make.bottom.mas_equalTo(self.contentView.mas_bottom).priorityLow();
|
||||
}];
|
||||
}
|
||||
|
||||
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
|
||||
{
|
||||
if ([string isEqualToString:@""]) {
|
||||
return YES;
|
||||
}
|
||||
|
||||
if (textField.text.length >= 30) {
|
||||
textField.text = [textField.text substringToIndex:30];
|
||||
return NO;
|
||||
}
|
||||
|
||||
if (self.contactDidChange) {
|
||||
self.contactDidChange(textField.text);
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField
|
||||
{
|
||||
if (self.willBeginEditing) {
|
||||
self.willBeginEditing();
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
|
||||
@end
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
//
|
||||
// WXYZ_FeedbackPhotoManager.h
|
||||
// WXReader
|
||||
//
|
||||
// Created by Andrew on 2019/12/28.
|
||||
// Copyright © 2019 Andrew. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "WXYZ_FeedbackPhotoModel.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface WXYZ_FeedbackPhotoManager : NSObject
|
||||
|
||||
@property (nonatomic, assign, readonly) BOOL isUploading;
|
||||
|
||||
@property (nonatomic, copy) void(^deletePhotoBlock)(WXYZ_FeedbackPhotoModel *photoModel);
|
||||
|
||||
interface_singleton
|
||||
|
||||
- (void)addPhotoImage:(UIImage *)image complete:(void(^)(WXYZ_FeedbackPhotoModel *photoModel))completeBlock;
|
||||
|
||||
- (void)deletePhotoWithPhotoModel:(WXYZ_FeedbackPhotoModel *)photoModel;
|
||||
|
||||
- (void)removeAllPhotoImageWithPhotoArray:(NSArray *)dataSources;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
+97
@@ -0,0 +1,97 @@
|
||||
//
|
||||
// WXYZ_FeedbackPhotoManager.m
|
||||
// WXReader
|
||||
//
|
||||
// Created by Andrew on 2019/12/28.
|
||||
// Copyright © 2019 Andrew. All rights reserved.
|
||||
//
|
||||
|
||||
#import "WXYZ_FeedbackPhotoManager.h"
|
||||
|
||||
@interface WXYZ_FeedbackPhotoManager ()
|
||||
|
||||
@property (nonatomic, strong) NSMutableSet *uploadSet;
|
||||
|
||||
@end
|
||||
|
||||
@implementation WXYZ_FeedbackPhotoManager
|
||||
|
||||
implementation_singleton(WXYZ_FeedbackPhotoManager)
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
if (self = [super init]) {
|
||||
self.uploadSet = [NSMutableSet set];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)addPhotoImage:(UIImage *)image complete:(void(^)(WXYZ_FeedbackPhotoModel *photoModel))completeBlock
|
||||
{
|
||||
NSString *imageBase64 = [TFViewHelper getBase64StringWithImageData:UIImagePNGRepresentation(image)];
|
||||
if (imageBase64.length == 0 || !imageBase64) {
|
||||
if (completeBlock) {
|
||||
completeBlock(nil);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
[self.uploadSet addObject:@"upload"];
|
||||
|
||||
WS(weakSelf)
|
||||
[TFNetworkTools POST:Upload_Image parameters:@{@"image":imageBase64} model:WXYZ_FeedbackPhotoModel.class success:^(BOOL isSuccess, id _Nullable t_model, TFNetworkRequestModel *requestModel) {
|
||||
if (isSuccess) {
|
||||
!completeBlock ?: completeBlock(t_model);
|
||||
} else {
|
||||
[TFPromptManager showPromptViewWithStatus:TFPromptStatusError promptTitle:TFLocalizedString(@"图片上传失败")];
|
||||
!completeBlock ?: completeBlock(nil);
|
||||
}
|
||||
|
||||
[weakSelf.uploadSet removeObject:[weakSelf.uploadSet anyObject]];
|
||||
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
|
||||
[TFPromptManager showPromptWithError:error defaultText:nil];
|
||||
// [weakSelf.uploadSet removeObject:[weakSelf.uploadSet anyObject]];
|
||||
!completeBlock ?: completeBlock(nil);
|
||||
}];
|
||||
}
|
||||
|
||||
- (BOOL)isUploading
|
||||
{
|
||||
return self.uploadSet.count > 0;
|
||||
}
|
||||
|
||||
- (void)deletePhotoWithPhotoModel:(WXYZ_FeedbackPhotoModel *)photoModel
|
||||
{
|
||||
if (photoModel.show_img.length <= 0) {
|
||||
[TFPromptManager showPromptViewWithStatus:TFPromptStatusError promptTitle:TFLocalizedString(@"图片删除失败")];
|
||||
return;
|
||||
}
|
||||
|
||||
[self removeAllPhotoImageWithPhotoArray:@[photoModel]];
|
||||
|
||||
if (photoModel) {
|
||||
if (self.deletePhotoBlock) {
|
||||
self.deletePhotoBlock(photoModel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)removeAllPhotoImageWithPhotoArray:(NSArray *)dataSources
|
||||
{
|
||||
[self.uploadSet removeAllObjects];
|
||||
|
||||
if (dataSources.count <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
NSMutableArray *imgs = [NSMutableArray arrayWithCapacity:3];
|
||||
for (WXYZ_FeedbackPhotoModel *t_model in dataSources) {
|
||||
if (t_model.img) {
|
||||
[imgs addObject:t_model.img];
|
||||
}
|
||||
}
|
||||
|
||||
[TFNetworkTools POST:Delete_Upload_Image parameters:@{@"image":[imgs componentsJoinedByString:@"||"]} model:nil success:nil failure:nil];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,21 @@
|
||||
//
|
||||
// WXYZ_FeedbackPhotoModel.h
|
||||
// WXReader
|
||||
//
|
||||
// Created by Andrew on 2019/12/28.
|
||||
// Copyright © 2019 Andrew. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface WXYZ_FeedbackPhotoModel : NSObject
|
||||
|
||||
@property (nonatomic, copy) NSString *img; // 图片相对地址,这个值传递保存
|
||||
|
||||
@property (nonatomic, copy) NSString *show_img; // 图片显示地址
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,13 @@
|
||||
//
|
||||
// WXYZ_FeedbackPhotoModel.m
|
||||
// WXReader
|
||||
//
|
||||
// Created by Andrew on 2019/12/28.
|
||||
// Copyright © 2019 Andrew. All rights reserved.
|
||||
//
|
||||
|
||||
#import "WXYZ_FeedbackPhotoModel.h"
|
||||
|
||||
@implementation WXYZ_FeedbackPhotoModel
|
||||
|
||||
@end
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// WXYZ_FeedbackPhotoTableViewCell.h
|
||||
// WXReader
|
||||
//
|
||||
// Created by Andrew on 2019/12/27.
|
||||
// Copyright © 2019 Andrew. All rights reserved.
|
||||
//
|
||||
#import "WXYZ_ImagePicker.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface WXYZ_FeedbackPhotoTableViewCell : TFBasicTableViewCell <DPImagePickerDelegate, UICollectionViewDelegate, UICollectionViewDataSource>
|
||||
|
||||
@property (nonatomic, copy) void(^operationPhotosBlock)(NSMutableArray *photosSource);
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
+144
@@ -0,0 +1,144 @@
|
||||
//
|
||||
// WXYZ_FeedbackPhotoTableViewCell.m
|
||||
// WXReader
|
||||
//
|
||||
// Created by Andrew on 2019/12/27.
|
||||
// Copyright © 2019 Andrew. All rights reserved.
|
||||
//
|
||||
|
||||
#import "WXYZ_FeedbackPhotoTableViewCell.h"
|
||||
#import "WXYZ_FeedbackAddCollectionViewCell.h"
|
||||
#import "WXYZ_FeedbackCollectionViewCell.h"
|
||||
#import "TFPhotoBrowser.h"
|
||||
#import "WXYZ_FeedbackPhotoManager.h"
|
||||
#import "NSObject+Observer.h"
|
||||
|
||||
@interface WXYZ_FeedbackPhotoTableViewCell ()
|
||||
|
||||
@property (nonatomic, strong) NSMutableArray *photosSource;
|
||||
|
||||
@property (nonatomic, strong) UICollectionView *mainCollectionView;
|
||||
|
||||
@end
|
||||
|
||||
@implementation WXYZ_FeedbackPhotoTableViewCell
|
||||
|
||||
- (void)createSubviews
|
||||
{
|
||||
[super createSubviews];
|
||||
|
||||
self.photosSource = [NSMutableArray array];
|
||||
|
||||
UICollectionViewFlowLayout *mainCollectionViewFlowLayout = [[UICollectionViewFlowLayout alloc] init];
|
||||
mainCollectionViewFlowLayout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
|
||||
mainCollectionViewFlowLayout.minimumLineSpacing = kHalfMargin;
|
||||
mainCollectionViewFlowLayout.minimumInteritemSpacing = 0;
|
||||
CGFloat width = (SCREEN_WIDTH - (2 * kHalfMargin) - (2 * mainCollectionViewFlowLayout.minimumLineSpacing)) / 3.0;
|
||||
mainCollectionViewFlowLayout.itemSize = CGSizeMake(width, width);
|
||||
|
||||
self.mainCollectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:mainCollectionViewFlowLayout];
|
||||
self.mainCollectionView.userInteractionEnabled = YES;
|
||||
self.mainCollectionView.backgroundColor = [UIColor clearColor];
|
||||
self.mainCollectionView.showsVerticalScrollIndicator = NO;
|
||||
self.mainCollectionView.showsHorizontalScrollIndicator = NO;
|
||||
self.mainCollectionView.alwaysBounceVertical = YES;
|
||||
self.mainCollectionView.delegate = self;
|
||||
self.mainCollectionView.dataSource = self;
|
||||
if (@available(iOS 11.0, *)) {
|
||||
self.mainCollectionView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
|
||||
} else {
|
||||
// Fallback on earlier versions
|
||||
}
|
||||
[self.mainCollectionView registerClass:[WXYZ_FeedbackCollectionViewCell class] forCellWithReuseIdentifier:@"WXYZ_FeedbackCollectionViewCell"];
|
||||
[self.mainCollectionView registerClass:[WXYZ_FeedbackAddCollectionViewCell class] forCellWithReuseIdentifier:@"WXYZ_FeedbackAddCollectionViewCell"];
|
||||
[self.contentView addSubview:self.mainCollectionView];
|
||||
|
||||
[self.mainCollectionView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.contentView.mas_left).with.offset(kHalfMargin);
|
||||
make.top.mas_equalTo(self.contentView.mas_top).with.offset(kHalfMargin);
|
||||
make.height.mas_equalTo(width);
|
||||
make.width.mas_equalTo(SCREEN_WIDTH - kMargin);
|
||||
make.bottom.mas_equalTo(self.contentView.mas_bottom).with.offset(- kHalfMargin).priorityLow();
|
||||
}];
|
||||
|
||||
|
||||
WS(weakSelf)
|
||||
[WXYZ_FeedbackPhotoManager sharedManager].deletePhotoBlock = ^(WXYZ_FeedbackPhotoModel * _Nonnull photoModel) {
|
||||
[weakSelf.photosSource removeObject:photoModel];
|
||||
[weakSelf.mainCollectionView reloadData];
|
||||
if (weakSelf.operationPhotosBlock) {
|
||||
weakSelf.operationPhotosBlock(weakSelf.photosSource);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
|
||||
{
|
||||
if (self.photosSource.count < 3) {
|
||||
return self.photosSource.count + 1;
|
||||
}
|
||||
|
||||
if (self.photosSource.count >= 3) {
|
||||
return 3;
|
||||
}
|
||||
|
||||
return self.photosSource.count;
|
||||
}
|
||||
|
||||
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
if (indexPath.row == self.photosSource.count && self.photosSource.count < 3) {
|
||||
static NSString *CellIdentifier = @"WXYZ_FeedbackAddCollectionViewCell";
|
||||
WXYZ_FeedbackAddCollectionViewCell __weak *cell = [collectionView dequeueReusableCellWithReuseIdentifier:CellIdentifier forIndexPath:indexPath];
|
||||
return cell;
|
||||
} else {
|
||||
WS(weakSelf)
|
||||
static NSString *CellIdentifier = @"WXYZ_FeedbackCollectionViewCell";
|
||||
WXYZ_FeedbackCollectionViewCell __weak *cell = [collectionView dequeueReusableCellWithReuseIdentifier:CellIdentifier forIndexPath:indexPath];
|
||||
cell.photoModel = [self.photosSource objectOrNilAtIndex:indexPath.row];
|
||||
cell.cellIndex = indexPath.row;
|
||||
cell.deleteImageBlock = ^(NSInteger index) {
|
||||
[weakSelf.mainCollectionView reloadData];
|
||||
};
|
||||
return cell;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
if ([[collectionView cellForItemAtIndexPath:indexPath] isKindOfClass:[WXYZ_FeedbackAddCollectionViewCell class]]) {
|
||||
WXYZ_ImagePicker *picker = [WXYZ_ImagePicker sharedManager];
|
||||
picker.editPhoto = NO;
|
||||
picker.delegate = self;
|
||||
[picker showLibraryInController:[TFViewHelper getCurrentViewController]];
|
||||
} else {
|
||||
WXYZ_FeedbackPhotoModel *photoModel = [self.photosSource objectOrNilAtIndex:indexPath.row];
|
||||
TFPhotoBrowser *browser = [TFPhotoBrowser new];
|
||||
browser.dataSource = @[photoModel.show_img].mutableCopy;
|
||||
browser.downLoadNeeded = YES;
|
||||
browser.currentPhotoIndex = 0;
|
||||
[[TFViewHelper getCurrentViewController] presentViewController:browser animated:YES completion:nil];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)imagePickerDidFinishPickingWithOriginalImage:(UIImage *)originalImage editedImage:(UIImage *)editedImage
|
||||
{
|
||||
WS(weakSelf)
|
||||
WXYZ_FeedbackPhotoModel *photoModel = [[WXYZ_FeedbackPhotoModel alloc] init];
|
||||
photoModel.show_img = @"";
|
||||
[self.photosSource addObject:photoModel];
|
||||
[self.mainCollectionView reloadData];
|
||||
|
||||
[[WXYZ_FeedbackPhotoManager sharedManager] addPhotoImage:originalImage complete:^(WXYZ_FeedbackPhotoModel * _Nonnull photoModel) {
|
||||
if (photoModel) {
|
||||
[weakSelf.photosSource removeLastObject];
|
||||
[weakSelf.photosSource addObject:photoModel];
|
||||
[weakSelf.mainCollectionView reloadData];
|
||||
if (weakSelf.operationPhotosBlock) {
|
||||
weakSelf.operationPhotosBlock(weakSelf.photosSource);
|
||||
}
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
@end
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
//
|
||||
// WXYZ_FeedbackSubViewController.h
|
||||
// WXReader
|
||||
//
|
||||
// Created by Andrew on 2018/7/4.
|
||||
// Copyright © 2018年 Andrew. All rights reserved.
|
||||
//
|
||||
|
||||
|
||||
@interface WXYZ_FeedbackSubViewController : TFBasicViewController
|
||||
|
||||
@end
|
||||
+301
@@ -0,0 +1,301 @@
|
||||
//
|
||||
// WXYZ_FeedbackSubViewController.m
|
||||
// WXReader
|
||||
//
|
||||
// Created by Andrew on 2018/7/4.
|
||||
// Copyright © 2018年 Andrew. All rights reserved.
|
||||
//
|
||||
|
||||
#import "WXYZ_FeedbackSubViewController.h"
|
||||
|
||||
#import "WXYZ_FeedbackTextViewTableViewCell.h"
|
||||
#import "WXYZ_FeedbackPhotoTableViewCell.h"
|
||||
#import "WXYZ_FeedbackContactTableViewCell.h"
|
||||
|
||||
#import "TFTextView.h"
|
||||
#import "TFKeyboardManager.h"
|
||||
#import "WXYZ_FeedbackPhotoManager.h"
|
||||
|
||||
@interface WXYZ_FeedbackSubViewController () <UITableViewDelegate, UITableViewDataSource>
|
||||
{
|
||||
UIButton *submitButton;
|
||||
TFKeyboardManager *keyboardManager;
|
||||
}
|
||||
|
||||
@property (nonatomic, strong) NSString *contentString;
|
||||
|
||||
@property (nonatomic, strong) NSString *contactString;
|
||||
|
||||
@end
|
||||
|
||||
@implementation WXYZ_FeedbackSubViewController
|
||||
|
||||
- (void)viewDidLoad
|
||||
{
|
||||
[super viewDidLoad];
|
||||
[self initialize];
|
||||
[self createSubviews];
|
||||
}
|
||||
|
||||
- (void)viewWillAppear:(BOOL)animated
|
||||
{
|
||||
[super viewWillAppear:animated];
|
||||
[self setStatusBarDefaultStyle];
|
||||
}
|
||||
|
||||
- (void)viewDidAppear:(BOOL)animated
|
||||
{
|
||||
[super viewDidAppear:animated];
|
||||
[self navigationCanSlidingBack:NO];
|
||||
}
|
||||
|
||||
- (void)initialize
|
||||
{
|
||||
[self setNavigationBarTitle:TFLocalizedString(@"意见反馈")];
|
||||
[self hiddenNavigationBarLeftButton];
|
||||
self.view.backgroundColor = kGrayViewColor;
|
||||
}
|
||||
|
||||
- (void)createSubviews
|
||||
{
|
||||
UIButton *leftButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
leftButton.backgroundColor = [UIColor clearColor];
|
||||
leftButton.frame = CGRectMake(kHalfMargin, PUB_NAVBAR_OFFSET + 20, 44, 44);
|
||||
leftButton.adjustsImageWhenHighlighted = NO;
|
||||
[leftButton.titleLabel setFont:kMainFont];
|
||||
[leftButton setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
|
||||
[leftButton setImageEdgeInsets:UIEdgeInsetsMake(12, 6, 12, 18)];
|
||||
[leftButton setImage:[[UIImage imageNamed:@"public_back"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate] forState:UIControlStateNormal];
|
||||
[leftButton setTintColor:kBlackColor];
|
||||
[leftButton addTarget:self action:@selector(giveUpSubmit) forControlEvents:UIControlEventTouchUpInside];
|
||||
[self.navigationBar addSubview:leftButton];
|
||||
|
||||
self.mainTableViewGroup.delegate = self;
|
||||
self.mainTableViewGroup.dataSource = self;
|
||||
[self.view addSubview:self.mainTableViewGroup];
|
||||
|
||||
[self.mainTableViewGroup mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(0);
|
||||
make.top.mas_equalTo(PUB_NAVBAR_HEIGHT);
|
||||
make.width.mas_equalTo(SCREEN_WIDTH);
|
||||
make.height.mas_equalTo(SCREEN_HEIGHT - PUB_NAVBAR_HEIGHT - PUB_TABBAR_HEIGHT);
|
||||
}];
|
||||
|
||||
submitButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
submitButton.backgroundColor = kRedColor;
|
||||
[submitButton setTitle:TFLocalizedString(@"提交") forState:UIControlStateNormal];
|
||||
[submitButton setTitleColor:kWhiteColor forState:UIControlStateNormal];
|
||||
[submitButton.titleLabel setFont:kMainFont];
|
||||
[submitButton addTarget:self action:@selector(netRequest) forControlEvents:UIControlEventTouchUpInside];
|
||||
[self.view addSubview:submitButton];
|
||||
|
||||
[submitButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.bottom.mas_equalTo(self.view.mas_bottom).with.offset(- PUB_TABBAR_OFFSET);
|
||||
make.left.mas_equalTo(0);
|
||||
make.width.mas_equalTo(SCREEN_WIDTH);
|
||||
make.height.mas_equalTo(PUB_TABBAR_HEIGHT - PUB_TABBAR_OFFSET);
|
||||
}];
|
||||
|
||||
WS(weakSelf)
|
||||
keyboardManager = [[TFKeyboardManager alloc] initObserverWithAdaptiveMovementView:self.mainTableViewGroup];
|
||||
keyboardManager.keyboardHeightChanged = ^(CGFloat keyboardHeight, CGFloat shouldMoveDistance, CGRect shouldMoveFrame) {
|
||||
[weakSelf.mainTableViewGroup setMj_y:weakSelf.mainTableViewGroup.mj_y + shouldMoveDistance];
|
||||
};
|
||||
}
|
||||
|
||||
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
WS(weakSelf)
|
||||
switch (indexPath.section) {
|
||||
case 0:
|
||||
{
|
||||
static NSString *cellName = @"WXYZ_FeedbackTextViewTableViewCell";
|
||||
WXYZ_FeedbackTextViewTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellName];
|
||||
if (!cell) {
|
||||
cell = [[WXYZ_FeedbackTextViewTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellName];
|
||||
}
|
||||
cell.textViewDidChange = ^(NSString * _Nonnull contentString) {
|
||||
weakSelf.contentString = contentString;
|
||||
};
|
||||
cell.selectionStyle = UITableViewCellSelectionStyleNone;
|
||||
return cell;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
{
|
||||
static NSString *cellName = @"WXYZ_FeedbackPhotoTableViewCell";
|
||||
WXYZ_FeedbackPhotoTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellName];
|
||||
if (!cell) {
|
||||
cell = [[WXYZ_FeedbackPhotoTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellName];
|
||||
}
|
||||
cell.operationPhotosBlock = ^(NSMutableArray * _Nonnull photosSource) {
|
||||
weakSelf.dataSourceArray = photosSource;
|
||||
};
|
||||
cell.selectionStyle = UITableViewCellSelectionStyleNone;
|
||||
return cell;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
static NSString *cellName = @"WXYZ_FeedbackContactTableViewCell";
|
||||
WXYZ_FeedbackContactTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellName];
|
||||
if (!cell) {
|
||||
cell = [[WXYZ_FeedbackContactTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellName];
|
||||
}
|
||||
cell.contactDidChange = ^(NSString * _Nonnull contactString) {
|
||||
weakSelf.contactString = contactString;
|
||||
};
|
||||
|
||||
__weak WXYZ_FeedbackContactTableViewCell *weakCell = cell;
|
||||
cell.willBeginEditing = ^{
|
||||
keyboardManager.adaptiveMovementView = weakCell;
|
||||
};
|
||||
cell.selectionStyle = UITableViewCellSelectionStyleNone;
|
||||
return cell;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return [[UITableViewCell alloc] init];
|
||||
}
|
||||
|
||||
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
|
||||
{
|
||||
return KCellHeight;
|
||||
}
|
||||
|
||||
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
|
||||
{
|
||||
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, KCellHeight)];
|
||||
view.backgroundColor = kGrayViewColor;
|
||||
|
||||
UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(kHalfMargin, 0, SCREEN_WIDTH - 2 * kHalfMargin, 40)];
|
||||
titleLabel.textColor = kGrayTextColor;
|
||||
titleLabel.font = kFont15;
|
||||
[view addSubview:titleLabel];
|
||||
|
||||
switch (section) {
|
||||
case 0:
|
||||
titleLabel.text = TFLocalizedString(@"问题反馈");
|
||||
break;
|
||||
case 1:
|
||||
titleLabel.text = TFLocalizedString(@"提供问题截图(选填)");
|
||||
break;
|
||||
case 2:
|
||||
titleLabel.text = TFLocalizedString(@"联系方式(至少填写一项)");
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
|
||||
{
|
||||
if (section == 2) {
|
||||
return PUB_TABBAR_OFFSET == 0 ? 10 : PUB_TABBAR_OFFSET;
|
||||
}
|
||||
return CGFLOAT_MIN;
|
||||
}
|
||||
|
||||
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
|
||||
{
|
||||
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, PUB_TABBAR_OFFSET == 0 ? 10 : PUB_TABBAR_OFFSET)];
|
||||
view.backgroundColor = [UIColor clearColor];
|
||||
return view;
|
||||
}
|
||||
|
||||
- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView
|
||||
{
|
||||
[TFKeyboardManager hideKeyboard];
|
||||
}
|
||||
|
||||
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
|
||||
{
|
||||
[TFKeyboardManager hideKeyboard];
|
||||
}
|
||||
|
||||
- (void)giveUpSubmit
|
||||
{
|
||||
WS(weakSelf)
|
||||
if (self.contentString.length > 0 || self.contactString.length > 0 || [WXYZ_FeedbackPhotoManager sharedManager].isUploading || self.dataSourceArray.count > 0) {
|
||||
TFAlertView *alert = [[TFAlertView alloc] init];
|
||||
alert.alertDetailContent = TFLocalizedString(@"您有修改尚未提交,是否放弃修改?");
|
||||
alert.confirmTitle = TFLocalizedString(@"放弃修改");
|
||||
alert.cancelTitle = TFLocalizedString(@"取消");
|
||||
alert.confirmButtonClickBlock = ^{
|
||||
[[WXYZ_FeedbackPhotoManager sharedManager] removeAllPhotoImageWithPhotoArray:weakSelf.dataSourceArray];
|
||||
[weakSelf popViewController];
|
||||
};
|
||||
[alert showAlertView];
|
||||
return;
|
||||
}
|
||||
|
||||
[self popViewController];
|
||||
}
|
||||
|
||||
- (void)netRequest
|
||||
{
|
||||
[TFKeyboardManager hideKeyboard];
|
||||
|
||||
if (self.contentString.length == 0) {
|
||||
[TFPromptManager showPromptViewWithStatus:TFPromptStatusError promptTitle:TFLocalizedString(@"请完善问题描述")];
|
||||
return;
|
||||
}
|
||||
|
||||
if (self.contactString.length == 0) {
|
||||
[TFPromptManager showPromptViewWithStatus:TFPromptStatusError promptTitle:TFLocalizedString(@"请填写联系方式")];
|
||||
return;
|
||||
}
|
||||
|
||||
if ([WXYZ_FeedbackPhotoManager sharedManager].isUploading) {
|
||||
[TFPromptManager showPromptViewWithStatus:TFPromptStatusSuccess promptTitle:TFLocalizedString(@"图片正在上传中,请稍后")];
|
||||
return;
|
||||
}
|
||||
|
||||
NSMutableDictionary *t_dic = [NSMutableDictionary dictionary];
|
||||
[t_dic setObject:self.contentString forKey:@"content"];
|
||||
[t_dic setObject:self.contactString forKey:@"contact"];
|
||||
if (self.dataSourceArray.count > 0) {
|
||||
NSMutableArray *imgs = [NSMutableArray arrayWithCapacity:3];
|
||||
for (WXYZ_FeedbackPhotoModel *t_model in self.dataSourceArray) {
|
||||
[imgs addObject:t_model.img];
|
||||
}
|
||||
[t_dic setObject:[imgs componentsJoinedByString:@"||"] forKey:@"imgs"];
|
||||
}
|
||||
|
||||
submitButton.enabled = NO;
|
||||
|
||||
WS(weakSelf)
|
||||
[TFNetworkTools POST:Sub_Feed_Back parameters:t_dic model:nil success:^(BOOL isSuccess, id _Nullable t_model, TFNetworkRequestModel *requestModel) {
|
||||
if (isSuccess) {
|
||||
[TFPromptManager showPromptViewWithStatus:TFPromptStatusSuccess promptTitle:TFLocalizedString(@"反馈成功")];
|
||||
[weakSelf.navigationController popViewControllerAnimated:YES];
|
||||
} else {
|
||||
SS(strongSelf)
|
||||
strongSelf->submitButton.enabled = YES;
|
||||
[TFPromptManager showPromptViewWithStatus:TFPromptStatusError promptTitle:requestModel.msg];
|
||||
}
|
||||
} failure:nil];
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[keyboardManager stopKeyboardObserver];
|
||||
}
|
||||
|
||||
@end
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
//
|
||||
// WXYZ_FeedbackTextViewTableViewCell.h
|
||||
// WXReader
|
||||
//
|
||||
// Created by Andrew on 2019/12/27.
|
||||
// Copyright © 2019 Andrew. All rights reserved.
|
||||
//
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface WXYZ_FeedbackTextViewTableViewCell : TFBasicTableViewCell
|
||||
|
||||
@property (nonatomic, copy) void(^textViewDidChange)(NSString *contentString);
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
//
|
||||
// WXYZ_FeedbackTextViewTableViewCell.m
|
||||
// WXReader
|
||||
//
|
||||
// Created by Andrew on 2019/12/27.
|
||||
// Copyright © 2019 Andrew. All rights reserved.
|
||||
//
|
||||
|
||||
#import "WXYZ_FeedbackTextViewTableViewCell.h"
|
||||
#import "TFTextView.h"
|
||||
|
||||
@interface WXYZ_FeedbackTextViewTableViewCell () <TFTextViewDelegate>
|
||||
|
||||
@property (nonatomic ,copy) NSString *contentString;
|
||||
|
||||
@end
|
||||
|
||||
@implementation WXYZ_FeedbackTextViewTableViewCell
|
||||
{
|
||||
TFTextView *textView;
|
||||
}
|
||||
|
||||
- (void)createSubviews
|
||||
{
|
||||
[super createSubviews];
|
||||
|
||||
textView = [[TFTextView alloc] initWithFrame:CGRectZero];
|
||||
textView.maxWordCount = 200;
|
||||
textView.delegate = self;
|
||||
textView.layer.cornerRadius = 4;
|
||||
[textView resetPlaceholderText:TFLocalizedString(@"请详细描述您遇到的问题并告知具体操作步骤,我们会尽快答复您的问题哦")];
|
||||
[self.contentView addSubview:textView];
|
||||
|
||||
[textView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.contentView.mas_left).with.offset(kHalfMargin);
|
||||
make.top.mas_equalTo(self.contentView.mas_top);
|
||||
make.width.mas_equalTo(SCREEN_WIDTH - kMargin);
|
||||
make.height.mas_equalTo(200);
|
||||
make.bottom.mas_equalTo(self.contentView.mas_bottom).priorityLow();
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)textViewDidChange:(NSString *)text
|
||||
{
|
||||
if (self.textViewDidChange) {
|
||||
self.textViewDidChange(text);
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,70 @@
|
||||
//
|
||||
// TFBasicVoiceHeaderView.h
|
||||
// WXReader
|
||||
//
|
||||
// Created by 谢腾飞 on 2020/12/1.
|
||||
// Copyright © 2020 xtfei_2011@126.com. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "WXYZ_PlayPageModel.h"
|
||||
#import "CKAudioProgressView.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
typedef NS_ENUM(NSUInteger, TFBasicVoicePlayerState) {
|
||||
|
||||
TFBasicVoicePlayerStateLoading,
|
||||
TFBasicVoicePlayerStatePlaying,
|
||||
TFBasicVoicePlayerStatePause,
|
||||
TFBasicVoicePlayerStateStoped,
|
||||
TFBasicVoicePlayerStateFail
|
||||
};
|
||||
|
||||
@interface TFBasicVoiceHeaderView : UIView
|
||||
|
||||
@property (nonatomic ,assign) TFProductionType productionType;
|
||||
|
||||
@property (nonatomic ,strong) WXYZ_RelationModel *relationModel;
|
||||
|
||||
@property (nonatomic ,strong) NSArray <TFProductionChapterModel *> *chapter_list;
|
||||
|
||||
@property (nonatomic ,strong) TFProductionChapterModel *productionChapterModel;
|
||||
|
||||
@property (nonatomic ,strong) TFProductionChapterModel *temp_chapterModel; // 临时章节信息记录
|
||||
|
||||
@property (nonatomic ,strong) TFButton *timingButton; // 定时按钮
|
||||
|
||||
@property (nonatomic ,strong) TFButton *speedButton; // 语速按钮
|
||||
|
||||
@property (nonatomic ,strong) TFButton *voiceButton; // 声音按钮
|
||||
|
||||
@property (nonatomic ,assign) TFBasicVoicePlayerState playerState;
|
||||
|
||||
@property (nonatomic ,strong) CKAudioProgressView *timelineProgress; // 播放进度
|
||||
|
||||
@property (nonatomic ,copy) void (^checkOriginalBlock)(TFProductionChapterModel *chapterModel);
|
||||
|
||||
@property (nonatomic ,copy) void (^checkRelationProductionBlock)(WXYZ_RelationModel *relationModel);
|
||||
|
||||
@property (nonatomic ,copy) void (^resetPlayerBlock)(BOOL immediateReset);
|
||||
|
||||
- (instancetype)initWithProductionType:(TFProductionType)productionType;
|
||||
|
||||
- (void)createSubviews;
|
||||
|
||||
// 上一首
|
||||
- (void)skipToLastChapter;
|
||||
|
||||
// 下一首
|
||||
- (void)skipToNextChapter;
|
||||
|
||||
// 显示充值页
|
||||
- (void)showPayView;
|
||||
|
||||
// 设置关联作品标题
|
||||
- (void)setRelationViewTitle:(NSString *)title;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,808 @@
|
||||
//
|
||||
// TFBasicVoiceHeaderView.m
|
||||
// WXReader
|
||||
//
|
||||
// Created by 谢腾飞 on 2020/12/1.
|
||||
// Copyright © 2020 xtfei_2011@126.com. All rights reserved.
|
||||
//
|
||||
|
||||
#import "TFBasicVoiceHeaderView.h"
|
||||
#import "WXYZ_BookAiPlayPageViewController.h"
|
||||
#import "WXYZ_TouchAssistantView.h"
|
||||
#import "WXYZ_AudioPlayPageMenuView.h"
|
||||
#import "WXYZ_ChapterBottomPayBar.h"
|
||||
#import "TFReadRecordManager.h"
|
||||
|
||||
#import "WXYZ_Player.h"
|
||||
#if __has_include(<iflyMSC/IFlyMSC.h>)
|
||||
#import "iflyMSC/IFlyMSC.h"
|
||||
#endif
|
||||
|
||||
#import "WXYZ_AudioSettingHelper.h"
|
||||
#import "TFReaderBookManager.h"
|
||||
#import "TFReaderSettingHelper.h"
|
||||
#import "WXYZ_AudioDownloadManager.h"
|
||||
|
||||
#import "UIControl+EventInterval.h"
|
||||
|
||||
@interface TFBasicVoiceHeaderView ()<CKAudioProgressViewDelegate>
|
||||
{
|
||||
TFProductionCoverView *bookImageView; // 作品图片
|
||||
UILabel *chapterNameLabel;
|
||||
UILabel *bookNameLabel;
|
||||
|
||||
UIButton *fastForwardButton; // 快进
|
||||
UIButton *fastBackButton; // 快退
|
||||
|
||||
UIButton *playButton; // 播放按钮
|
||||
UIActivityIndicatorView *playButtonIndicator; // 播放loading
|
||||
UIButton *previousButton; // 上一首
|
||||
UIButton *nextButton; // 下一首
|
||||
|
||||
|
||||
TFButton *chapterButton; // 目录
|
||||
TFButton *originalButton; // 原文
|
||||
|
||||
UIButton *relationView;
|
||||
UILabel *relationChapterTitle;
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation TFBasicVoiceHeaderView
|
||||
|
||||
- (instancetype)initWithProductionType:(TFProductionType)productionType
|
||||
{
|
||||
if (self = [super init]) {
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(resetPlayerInfo) name:Notification_Reset_Player_Inof object:nil];
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeLanguage) name:Notification_Switch_Language object:nil];
|
||||
|
||||
self.productionType = productionType;
|
||||
|
||||
[self createSubviews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)changeLanguage
|
||||
{
|
||||
self.timingButton.buttonTitle = TFLocalizedString(@"定时");
|
||||
self.speedButton.buttonTitle = TFLocalizedString(@"语速");
|
||||
chapterButton.buttonTitle = TFLocalizedString(@"目录");
|
||||
}
|
||||
|
||||
- (void)createSubviews
|
||||
{
|
||||
// 作品图片
|
||||
bookImageView = [[TFProductionCoverView alloc] initWithProductionType:TFProductionTypeNovel coverDirection:TFProductionCoverDirectionVertical];
|
||||
bookImageView.userInteractionEnabled = YES;
|
||||
[self addSubview:bookImageView];
|
||||
|
||||
[bookImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.mas_equalTo(self.mas_centerX);
|
||||
make.top.mas_equalTo(self.mas_top).with.offset(kMargin);
|
||||
make.width.mas_equalTo(BOOK_WIDTH);
|
||||
make.height.mas_equalTo(BOOK_HEIGHT);
|
||||
}];
|
||||
|
||||
// 章节名
|
||||
chapterNameLabel = [[UILabel alloc] init];
|
||||
chapterNameLabel.textAlignment = NSTextAlignmentCenter;
|
||||
chapterNameLabel.textColor = kBlackColor;
|
||||
chapterNameLabel.backgroundColor = kWhiteColor;
|
||||
chapterNameLabel.font = kBoldFont17;
|
||||
[self addSubview:chapterNameLabel];
|
||||
|
||||
[chapterNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.mas_equalTo(bookImageView.mas_centerX);
|
||||
make.top.mas_equalTo(bookImageView.mas_bottom).with.offset(kHalfMargin);
|
||||
make.width.mas_equalTo(SCREEN_WIDTH - 2 * kMargin);
|
||||
make.height.mas_equalTo(kLabelHeight);
|
||||
}];
|
||||
|
||||
// 作者
|
||||
bookNameLabel = [[UILabel alloc] init];
|
||||
bookNameLabel.backgroundColor = kWhiteColor;
|
||||
bookNameLabel.textColor = kGrayTextColor;
|
||||
bookNameLabel.textAlignment = NSTextAlignmentCenter;
|
||||
bookNameLabel.font = kFont11;
|
||||
[self addSubview:bookNameLabel];
|
||||
|
||||
[bookNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(chapterNameLabel.mas_bottom);
|
||||
make.centerX.mas_equalTo(chapterNameLabel.mas_centerX);
|
||||
make.width.mas_equalTo(chapterNameLabel.mas_width);
|
||||
make.height.mas_equalTo(chapterNameLabel.mas_height);
|
||||
}];
|
||||
|
||||
if (self.productionType == TFProductionTypeAudio) {
|
||||
|
||||
fastBackButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
fastBackButton.tag = 1;
|
||||
fastBackButton.enabled = NO;
|
||||
fastBackButton.touchEventInterval = 0.5;
|
||||
[fastBackButton setImageEdgeInsets:UIEdgeInsetsMake(6, 12, 6, 0)];
|
||||
[fastBackButton setImage:[UIImage imageNamed:@"audio_fast_back"] forState:UIControlStateNormal];
|
||||
[fastBackButton addTarget:self action:@selector(adjustProgress:) forControlEvents:UIControlEventTouchUpInside];
|
||||
[self addSubview:fastBackButton];
|
||||
|
||||
[fastBackButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.mas_left).with.offset(kMoreHalfMargin);
|
||||
make.top.mas_equalTo(bookNameLabel.mas_bottom).with.offset(kMargin);
|
||||
make.width.height.mas_equalTo(30);
|
||||
}];
|
||||
|
||||
fastForwardButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
fastForwardButton.tag = 0;
|
||||
fastForwardButton.enabled = NO;
|
||||
fastForwardButton.touchEventInterval = 0.5;
|
||||
[fastForwardButton setImageEdgeInsets:UIEdgeInsetsMake(6, 0, 6, 12)];
|
||||
[fastForwardButton setImage:[UIImage imageNamed:@"audio_fast_forward"] forState:UIControlStateNormal];
|
||||
[fastForwardButton addTarget:self action:@selector(adjustProgress:) forControlEvents:UIControlEventTouchUpInside];
|
||||
[self addSubview:fastForwardButton];
|
||||
|
||||
[fastForwardButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.right.mas_equalTo(self.mas_right).with.offset(- kMoreHalfMargin);
|
||||
make.centerY.mas_equalTo(fastBackButton.mas_centerY);
|
||||
make.width.height.mas_equalTo(30);
|
||||
}];
|
||||
|
||||
self.timelineProgress = [[CKAudioProgressView alloc] initWithFrame:CGRectZero type:CKAudioProgressTypeTimeline];
|
||||
self.timelineProgress.playedBgColor = kMainColor;
|
||||
self.timelineProgress.cachedBgColor = kMainColorAlpha(0.2);
|
||||
self.timelineProgress.delegate = self;
|
||||
self.timelineProgress.userInteractionEnabled = NO;
|
||||
[self.timelineProgress updateProgress:0 audioLength:0];
|
||||
[self addSubview:self.timelineProgress];
|
||||
|
||||
[self.timelineProgress mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(fastBackButton.mas_right).with.offset(kHalfMargin);
|
||||
make.right.mas_equalTo(fastForwardButton.mas_left).with.offset(- kHalfMargin);
|
||||
make.centerY.mas_equalTo(fastBackButton.mas_centerY);
|
||||
make.height.mas_equalTo(30);
|
||||
}];
|
||||
}
|
||||
|
||||
playButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
playButton.adjustsImageWhenHighlighted = NO;
|
||||
playButton.enabled = NO;
|
||||
playButton.touchEventInterval = 0.5;
|
||||
[playButton setImage:[UIImage imageNamed:@"audio_play_loading"] forState:UIControlStateNormal];
|
||||
[playButton addTarget:self action:@selector(playButtonClick) forControlEvents:UIControlEventTouchUpInside];
|
||||
[self addSubview:playButton];
|
||||
|
||||
[playButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.mas_equalTo(bookImageView.mas_centerX);
|
||||
if (self.productionType == TFProductionTypeAudio) {
|
||||
make.top.mas_equalTo(self.timelineProgress.mas_bottom).with.offset(kMargin);
|
||||
} else {
|
||||
make.top.mas_equalTo(bookNameLabel.mas_bottom).with.offset(kMargin);
|
||||
}
|
||||
make.width.height.mas_equalTo(bookImageView.mas_width).with.multipliedBy(0.5);
|
||||
}];
|
||||
|
||||
playButtonIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:(UIActivityIndicatorViewStyleWhite)];
|
||||
playButtonIndicator.color = kWhiteColor;
|
||||
playButtonIndicator.hidesWhenStopped = YES;
|
||||
[playButton addSubview:playButtonIndicator];
|
||||
[playButtonIndicator startAnimating];
|
||||
|
||||
[playButtonIndicator mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.mas_equalTo(playButton.mas_centerX).with.offset(1);
|
||||
make.centerY.mas_equalTo(playButton.mas_centerY).with.offset(1);
|
||||
make.width.height.mas_equalTo(playButton);
|
||||
}];
|
||||
|
||||
previousButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
previousButton.adjustsImageWhenHighlighted = NO;
|
||||
previousButton.enabled = NO;
|
||||
previousButton.tag = 1;
|
||||
previousButton.touchEventInterval = 0.5;
|
||||
[previousButton setImage:[UIImage imageNamed:@"audio_previous_unenable"] forState:UIControlStateNormal];
|
||||
[previousButton addTarget:self action:@selector(skipToLastChapter) forControlEvents:UIControlEventTouchUpInside];
|
||||
[self addSubview:previousButton];
|
||||
|
||||
[previousButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerY.mas_equalTo(playButton.mas_centerY);
|
||||
make.right.mas_equalTo(bookImageView.mas_left).with.offset(- kMargin);
|
||||
make.width.height.mas_equalTo(playButton.mas_width).with.multipliedBy(0.4);
|
||||
}];
|
||||
|
||||
nextButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
nextButton.adjustsImageWhenHighlighted = NO;
|
||||
nextButton.enabled = NO;
|
||||
nextButton.tag = 2;
|
||||
nextButton.touchEventInterval = 0.5;
|
||||
[nextButton setImage:[UIImage imageNamed:@"audio_next_unenable"] forState:UIControlStateNormal];
|
||||
[nextButton addTarget:self action:@selector(skipToNextChapter) forControlEvents:UIControlEventTouchUpInside];
|
||||
[self addSubview:nextButton];
|
||||
|
||||
[nextButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerY.mas_equalTo(playButton.mas_centerY);
|
||||
make.left.mas_equalTo(bookImageView.mas_right).with.offset(kMargin);
|
||||
make.width.height.mas_equalTo(previousButton);
|
||||
}];
|
||||
|
||||
CGFloat buttonSpace = (SCREEN_WIDTH - 2 * kMargin - 5 * 80) / 4;
|
||||
if (self.productionType == TFProductionTypeAudio) {
|
||||
buttonSpace = (SCREEN_WIDTH - 2 * kMargin - 4 * 80) / 3;
|
||||
}
|
||||
|
||||
self.timingButton = [[TFButton alloc] initWithFrame:CGRectZero buttonTitle:TFLocalizedString(@"定时") buttonImageName:@"audio_speech_timing" buttonIndicator:TFButtonIndicatorTitleBottom];
|
||||
self.timingButton.tag = 0;
|
||||
self.timingButton.buttonTitleFont = kFont10;
|
||||
self.timingButton.graphicDistance = 5;
|
||||
self.timingButton.buttonImageScale = 0.5;
|
||||
[self.timingButton addTarget:self action:@selector(toolBarButtonClick:) forControlEvents:UIControlEventTouchUpInside];
|
||||
[self addSubview:self.timingButton];
|
||||
|
||||
[self.timingButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(kMargin);
|
||||
make.top.mas_equalTo(playButton.mas_bottom).with.offset(kMargin);
|
||||
make.width.mas_equalTo(80);
|
||||
make.height.mas_equalTo(50);
|
||||
}];
|
||||
|
||||
self.speedButton = [[TFButton alloc] initWithFrame:CGRectZero buttonTitle:TFLocalizedString(@"语速") buttonImageName:[NSString stringWithFormat:@"audio_speech_speed%@", [TFUtilsHelper formatStringWithInteger:[[WXYZ_AudioSettingHelper sharedManager] getReadSpeedWithProducitionType:self.productionType]]] buttonIndicator:TFButtonIndicatorTitleBottom];
|
||||
self.speedButton.tag = 1;
|
||||
self.speedButton.buttonTitleFont = kFont10;
|
||||
self.speedButton.graphicDistance = 5;
|
||||
self.speedButton.buttonImageScale = 0.55;
|
||||
[self.speedButton addTarget:self action:@selector(toolBarButtonClick:) forControlEvents:UIControlEventTouchUpInside];
|
||||
[self addSubview:self.speedButton];
|
||||
|
||||
[self.speedButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.timingButton.mas_right).with.offset(buttonSpace);
|
||||
make.top.mas_equalTo(self.timingButton.mas_top);
|
||||
make.width.mas_equalTo(self.timingButton.mas_width);
|
||||
make.height.mas_equalTo(self.timingButton.mas_height);
|
||||
}];
|
||||
|
||||
if (self.productionType == TFProductionTypeAi) {
|
||||
self.voiceButton = [[TFButton alloc] initWithFrame:CGRectZero buttonTitle:TFLocalizedString([[WXYZ_AudioSettingHelper sharedManager] getReadVoiceTitleWithProducitionType:TFProductionTypeAi]) buttonImageName:@"audio_speech_tone" buttonIndicator:TFButtonIndicatorTitleBottom];
|
||||
self.voiceButton.tag = 2;
|
||||
self.voiceButton.buttonTitleFont = kFont10;
|
||||
self.voiceButton.graphicDistance = 5;
|
||||
self.voiceButton.buttonImageScale = 0.5;
|
||||
[self.voiceButton addTarget:self action:@selector(toolBarButtonClick:) forControlEvents:UIControlEventTouchUpInside];
|
||||
[self addSubview:self.voiceButton];
|
||||
|
||||
[self.voiceButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.speedButton.mas_right).with.offset(buttonSpace);
|
||||
make.top.mas_equalTo(self.timingButton.mas_top);
|
||||
make.width.mas_equalTo(self.timingButton.mas_width);
|
||||
make.height.mas_equalTo(self.timingButton.mas_height);
|
||||
}];
|
||||
}
|
||||
|
||||
chapterButton = [[TFButton alloc] initWithFrame:CGRectZero buttonTitle:TFLocalizedString(@"目录") buttonImageName:@"audio_speech_catalogue" buttonIndicator:TFButtonIndicatorTitleBottom];
|
||||
chapterButton.tag = 3;
|
||||
chapterButton.buttonTitleFont = kFont10;
|
||||
chapterButton.graphicDistance = 5;
|
||||
chapterButton.buttonImageScale = 0.5;
|
||||
[chapterButton addTarget:self action:@selector(toolBarButtonClick:) forControlEvents:UIControlEventTouchUpInside];
|
||||
[self addSubview:chapterButton];
|
||||
|
||||
[chapterButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
if (self.productionType == TFProductionTypeAudio) {
|
||||
make.left.mas_equalTo(self.speedButton.mas_right).with.offset(buttonSpace);
|
||||
} else {
|
||||
make.left.mas_equalTo(self.voiceButton.mas_right).with.offset(buttonSpace);
|
||||
}
|
||||
make.top.mas_equalTo(self.timingButton.mas_top);
|
||||
make.width.mas_equalTo(self.timingButton.mas_width);
|
||||
make.height.mas_equalTo(self.timingButton.mas_height);
|
||||
}];
|
||||
|
||||
originalButton = [[TFButton alloc] initWithFrame:CGRectZero buttonTitle:TFLocalizedString(@"原文") buttonImageName:@"audio_speech_original" buttonIndicator:TFButtonIndicatorTitleBottom];
|
||||
originalButton.tag = 4;
|
||||
originalButton.buttonTitleFont = kFont10;
|
||||
originalButton.graphicDistance = 5;
|
||||
originalButton.buttonImageScale = 0.5;
|
||||
[originalButton addTarget:self action:@selector(toolBarButtonClick:) forControlEvents:UIControlEventTouchUpInside];
|
||||
[self addSubview:originalButton];
|
||||
|
||||
[originalButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(chapterButton.mas_right).with.offset(buttonSpace);
|
||||
make.top.mas_equalTo(self.timingButton.mas_top);
|
||||
make.width.mas_equalTo(80);
|
||||
make.height.mas_equalTo(self.timingButton.mas_height);
|
||||
}];
|
||||
|
||||
relationView = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
relationView.backgroundColor = kGrayViewColor;
|
||||
relationView.layer.cornerRadius = 6;
|
||||
relationView.clipsToBounds = YES;
|
||||
[relationView addTarget:self action:@selector(relationProductionClick) forControlEvents:UIControlEventTouchUpInside];
|
||||
[self addSubview:relationView];
|
||||
|
||||
[relationView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(kHalfMargin);
|
||||
make.top.mas_equalTo(originalButton.mas_bottom).with.offset(kMargin);
|
||||
make.width.mas_equalTo(SCREEN_WIDTH - kMargin);
|
||||
make.height.mas_equalTo(80);
|
||||
}];
|
||||
|
||||
UIImageView *relationIcon = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"audio_change_to_sound"]];
|
||||
if (self.productionType == TFProductionTypeAudio) {
|
||||
relationIcon.image = [UIImage imageNamed:@"audio_change_to_ai"];
|
||||
}
|
||||
relationIcon.userInteractionEnabled = YES;
|
||||
[relationView addSubview:relationIcon];
|
||||
|
||||
[relationIcon mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(kMargin);
|
||||
make.centerY.mas_equalTo(relationView.mas_centerY);
|
||||
make.width.height.mas_equalTo(relationView.mas_height).with.multipliedBy(0.5);
|
||||
}];
|
||||
|
||||
UIImageView *connerImage = [[UIImageView alloc] init];
|
||||
connerImage.image = [UIImage imageNamed:@"public_more"];
|
||||
[relationView addSubview:connerImage];
|
||||
|
||||
[connerImage mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.right.mas_equalTo(relationView.mas_right).with.offset(- kMargin);
|
||||
make.centerY.mas_equalTo(relationView.mas_centerY);
|
||||
make.width.height.mas_equalTo(10);
|
||||
}];
|
||||
|
||||
UILabel *relationLabel = [[UILabel alloc] init];
|
||||
relationLabel.text = TFLocalizedString(@"切换到有声阅读");
|
||||
if (self.productionType == TFProductionTypeAudio) {
|
||||
relationLabel.text = TFLocalizedString(@"切换到AI语音阅读");
|
||||
}
|
||||
relationLabel.textColor = kBlackColor;
|
||||
relationLabel.textAlignment = NSTextAlignmentLeft;
|
||||
relationLabel.font = kMainFont;
|
||||
[relationView addSubview:relationLabel];
|
||||
|
||||
[relationLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(relationIcon.mas_right).with.offset(kHalfMargin);
|
||||
make.right.mas_equalTo(connerImage.mas_left).with.offset(- kHalfMargin);
|
||||
make.bottom.mas_equalTo(connerImage.mas_centerY);
|
||||
make.height.mas_equalTo(relationView.mas_height).multipliedBy(0.3);
|
||||
}];
|
||||
|
||||
relationChapterTitle = [[UILabel alloc] init];
|
||||
relationChapterTitle.textColor = kGrayTextColor;
|
||||
relationChapterTitle.textAlignment = NSTextAlignmentLeft;
|
||||
relationChapterTitle.font = kFont10;
|
||||
[relationView addSubview:relationChapterTitle];
|
||||
|
||||
[relationChapterTitle mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(relationIcon.mas_right).with.offset(kHalfMargin);
|
||||
make.right.mas_equalTo(connerImage.mas_left).with.offset(- kHalfMargin);
|
||||
make.top.mas_equalTo(connerImage.mas_centerY);
|
||||
make.height.mas_equalTo(relationView.mas_height).multipliedBy(0.3);
|
||||
}];
|
||||
|
||||
}
|
||||
|
||||
- (void)setProductionChapterModel:(TFProductionChapterModel *)productionChapterModel
|
||||
{
|
||||
_productionChapterModel = productionChapterModel;
|
||||
|
||||
// 封面
|
||||
[bookImageView resetDefaultHoldImage];
|
||||
bookImageView.coverImageUrl = productionChapterModel.cover;
|
||||
|
||||
// 章节
|
||||
chapterNameLabel.text = [TFUtilsHelper formatStringWithObject:productionChapterModel.chapter_title?:@""];
|
||||
|
||||
// 标题
|
||||
bookNameLabel.text = [TFUtilsHelper formatStringWithObject:productionChapterModel.name?:@""];
|
||||
|
||||
// 设置总音频时长
|
||||
self.timelineProgress.totalTimeLength = productionChapterModel.duration_second;
|
||||
|
||||
// 下一首
|
||||
if (productionChapterModel.last_chapter > 0 && productionChapterModel.last_chapter) {
|
||||
[previousButton setImage:[UIImage imageNamed:@"audio_previous_enable"] forState:UIControlStateNormal];
|
||||
previousButton.enabled = YES;
|
||||
} else {
|
||||
[previousButton setImage:[UIImage imageNamed:@"audio_previous_unenable"] forState:UIControlStateNormal];
|
||||
previousButton.enabled = NO;
|
||||
}
|
||||
|
||||
// 上一首
|
||||
if (productionChapterModel.next_chapter > 0 && productionChapterModel.next_chapter) {
|
||||
[nextButton setImage:[UIImage imageNamed:@"audio_next_enable"] forState:UIControlStateNormal];
|
||||
nextButton.enabled = YES;
|
||||
} else {
|
||||
[nextButton setImage:[UIImage imageNamed:@"audio_next_unenable"] forState:UIControlStateNormal];
|
||||
nextButton.enabled = NO;
|
||||
}
|
||||
|
||||
[self layoutIfNeeded];
|
||||
}
|
||||
|
||||
- (void)setRelationModel:(WXYZ_RelationModel *)relationModel
|
||||
{
|
||||
_relationModel = relationModel;
|
||||
|
||||
// 更新关联作品章节标题
|
||||
relationChapterTitle.text = [[TFReadRecordManager shareManagerWithProductionType:(self.productionType == TFProductionTypeAudio?TFProductionTypeAi:TFProductionTypeAudio)] getReadingRecordChapterTitleWithProduction_id:relationModel.production_id]?:relationModel.chapter_title?:@"";
|
||||
|
||||
if (self.productionType == TFProductionTypeAudio) {
|
||||
if (relationModel.production_id > 0) {
|
||||
relationView.hidden = NO;
|
||||
originalButton.hidden = NO;
|
||||
CGFloat buttonSpace = (SCREEN_WIDTH - 2 * kMargin - 4 * 80) / 3;
|
||||
[self.timingButton mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(kMargin);
|
||||
}];
|
||||
[self.speedButton mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.timingButton.mas_right).with.offset(buttonSpace);
|
||||
}];
|
||||
[chapterButton mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.speedButton.mas_right).with.offset(buttonSpace);
|
||||
}];
|
||||
|
||||
if ([TFUtilsHelper getAiReadSwitchState]) {
|
||||
[relationView mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(80);
|
||||
}];
|
||||
} else {
|
||||
[relationView mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(CGFLOAT_MIN);
|
||||
}];
|
||||
}
|
||||
} else {
|
||||
relationView.hidden = YES;
|
||||
originalButton.hidden = YES;
|
||||
CGFloat buttonSpace = (SCREEN_WIDTH - 4 * kMargin - 3 * 80) / 2;
|
||||
[self.timingButton mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(2 * kMargin);
|
||||
}];
|
||||
[self.speedButton mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.timingButton.mas_right).with.offset(buttonSpace);
|
||||
}];
|
||||
[chapterButton mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.speedButton.mas_right).with.offset(buttonSpace);
|
||||
}];
|
||||
[relationView mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(CGFLOAT_MIN);
|
||||
}];
|
||||
}
|
||||
} else {
|
||||
if (relationModel.production_id > 0 && [TFUtilsHelper getAiReadSwitchState]) {
|
||||
relationView.hidden = NO;
|
||||
[relationView mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(80);
|
||||
}];
|
||||
} else {
|
||||
relationView.hidden = YES;
|
||||
[relationView mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(CGFLOAT_MIN);
|
||||
}];
|
||||
}
|
||||
}
|
||||
|
||||
[self layoutIfNeeded];
|
||||
}
|
||||
|
||||
- (void)layoutSubviews
|
||||
{
|
||||
[super layoutSubviews];
|
||||
|
||||
self.frame = CGRectMake(0, 0, SCREEN_WIDTH, relationView.bottom + kHalfMargin);
|
||||
}
|
||||
|
||||
// 设置关联作品标题
|
||||
- (void)setRelationViewTitle:(NSString *)title
|
||||
{
|
||||
// 更新关联作品章节标题
|
||||
relationChapterTitle.text = title;
|
||||
}
|
||||
|
||||
#pragma mark - CKAudioProgressViewDelegate
|
||||
// 拖动进度条
|
||||
- (void)audioProgresstouchEndhCurrentTime:(NSInteger)currentTime totalTime:(NSInteger)totalTime
|
||||
{
|
||||
if ([WXYZ_Player sharedPlayer].state == TFBasicVoicePlayerStateStoped) {
|
||||
return;
|
||||
}
|
||||
|
||||
self.playerState = TFBasicVoicePlayerStateLoading;
|
||||
|
||||
[[WXYZ_Player sharedPlayer] seekToTime:(float)currentTime / totalTime completionBlock:^{
|
||||
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - 点击事件
|
||||
- (void)playButtonClick
|
||||
{
|
||||
if (self.productionChapterModel.is_preview == 1 && ![TFUserInfoManager shareInstance].auto_sub) {
|
||||
[self showPayView];
|
||||
return;
|
||||
}
|
||||
|
||||
if ([TFNetworkManager networkingStatus] == NO && ![[WXYZ_AudioDownloadManager sharedManager] isChapterDownloadedWithProduction_id:self.productionChapterModel.production_id chapter_id:self.productionChapterModel.chapter_id]) {
|
||||
[TFPromptManager showPromptViewWithStatus:TFPromptStatusError promptTitle:TFLocalizedString(@"当前为离线状态,只可查看缓存内容哦")];
|
||||
return;
|
||||
}
|
||||
|
||||
if (self.productionType == TFProductionTypeAi) {
|
||||
[[WXYZ_Player sharedPlayer] pause];
|
||||
|
||||
if (self.playerState == TFBasicVoicePlayerStatePlaying) {
|
||||
[[IFlySpeechSynthesizer sharedInstance] pauseSpeaking];
|
||||
} else {
|
||||
[[IFlySpeechSynthesizer sharedInstance] resumeSpeaking];
|
||||
if (self.resetPlayerBlock) {
|
||||
self.resetPlayerBlock(NO);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
[[IFlySpeechSynthesizer sharedInstance] pauseSpeaking];
|
||||
|
||||
if ([WXYZ_Player sharedPlayer].state == TFBasicVoicePlayerStatePlaying) {
|
||||
[[WXYZ_Player sharedPlayer] pause];
|
||||
self.playerState = TFBasicVoicePlayerStatePause;
|
||||
} else if ([WXYZ_Player sharedPlayer].state == TFBasicVoicePlayerStatePause) {
|
||||
[[WXYZ_Player sharedPlayer] play];
|
||||
self.playerState = TFBasicVoicePlayerStatePlaying;
|
||||
if ([WXYZ_BookAiPlayPageViewController sharedManager].speaking) {
|
||||
[[IFlySpeechSynthesizer sharedInstance] pauseSpeaking];
|
||||
}
|
||||
} else if ([WXYZ_Player sharedPlayer].state == TFBasicVoicePlayerStateStoped) {
|
||||
[[WXYZ_Player sharedPlayer] reloadData]; // 需在传入数据源后调用
|
||||
[[WXYZ_Player sharedPlayer] playWithAudioId:0];
|
||||
} else if ([WXYZ_Player sharedPlayer].state == TFBasicVoicePlayerStateFail) {
|
||||
[TFPromptManager showPromptViewWithStatus:TFPromptStatusError promptTitle:TFLocalizedString(@"播放出错")];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)skipToLastChapter
|
||||
{
|
||||
self.playerState = TFBasicVoicePlayerStateLoading;
|
||||
|
||||
NSInteger skipChapter_id = 0;
|
||||
if (self.productionChapterModel.last_chapter > 0) {
|
||||
skipChapter_id = self.productionChapterModel.last_chapter;
|
||||
}
|
||||
|
||||
if (skipChapter_id == 0) {
|
||||
[TFPromptManager showPromptViewWithStatus:TFPromptStatusError promptTitle:TFLocalizedString(@"章节正在更新中")];
|
||||
return;
|
||||
}
|
||||
|
||||
if (self.productionType == TFProductionTypeAi) {
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:Notification_Change_AiBook_Chapter object:[TFUtilsHelper formatStringWithInteger:skipChapter_id]];
|
||||
} else {
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:Notification_Change_Audio_Chapter object:[TFUtilsHelper formatStringWithInteger:skipChapter_id]];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)skipToNextChapter
|
||||
{
|
||||
self.playerState = TFBasicVoicePlayerStateLoading;
|
||||
|
||||
NSInteger skipChapter_id = 0;
|
||||
if (self.productionChapterModel.next_chapter > 0) {
|
||||
skipChapter_id = self.productionChapterModel.next_chapter;
|
||||
}
|
||||
|
||||
if (skipChapter_id == 0) {
|
||||
[TFPromptManager showPromptViewWithStatus:TFPromptStatusError promptTitle:TFLocalizedString(@"章节正在更新中")];
|
||||
return;
|
||||
}
|
||||
|
||||
if (self.productionType == TFProductionTypeAi) {
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:Notification_Change_AiBook_Chapter object:[TFUtilsHelper formatStringWithInteger:skipChapter_id]];
|
||||
} else {
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:Notification_Change_Audio_Chapter object:[TFUtilsHelper formatStringWithInteger:skipChapter_id]];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)relationProductionClick
|
||||
{
|
||||
if ([TFUtilsHelper getAiReadSwitchState]) {
|
||||
if (self.checkRelationProductionBlock) {
|
||||
self.checkRelationProductionBlock(self.relationModel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 快进或快退
|
||||
- (void)adjustProgress:(UIButton *)sender
|
||||
{
|
||||
sender.enabled = NO;
|
||||
CGFloat valuePercentage = 0;
|
||||
CGFloat currentTime = [[WXYZ_Player sharedPlayer] currentTime];
|
||||
CGFloat totalTime = [[WXYZ_Player sharedPlayer] totalTime];
|
||||
if (sender.tag == 0) { // 快进
|
||||
if (currentTime + 15 > totalTime) {
|
||||
valuePercentage = 1;
|
||||
} else {
|
||||
valuePercentage = (currentTime + 15) / totalTime;
|
||||
}
|
||||
} else { // 快退
|
||||
if (currentTime - 15 > 0) {
|
||||
valuePercentage = (currentTime - 15) / totalTime;
|
||||
}
|
||||
}
|
||||
|
||||
[[WXYZ_Player sharedPlayer] seekToTime:valuePercentage completionBlock:^{
|
||||
sender.enabled = YES;
|
||||
}];
|
||||
[self.timelineProgress updateProgress:valuePercentage audioLength:totalTime];
|
||||
|
||||
}
|
||||
|
||||
- (void)toolBarButtonClick:(UIButton *)sender
|
||||
{
|
||||
if (sender.tag == 4) {
|
||||
if (self.productionType == TFProductionTypeAi) {
|
||||
[[TFReaderSettingHelper sharedManager] setLocationMemoryOfChapterIndex:[self.productionChapterModel.display_order integerValue] pagerIndex:0 book_id:self.productionChapterModel.production_id];
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:NSNotification_Retry_Chapter object:@"1"];
|
||||
}
|
||||
if (self.checkOriginalBlock) {
|
||||
self.checkOriginalBlock(self.productionChapterModel);
|
||||
}
|
||||
return;
|
||||
}
|
||||
WS(weakSelf)
|
||||
|
||||
WXYZ_AudioPlayPageMenuView *playPageMenuView = [[WXYZ_AudioPlayPageMenuView alloc] init];
|
||||
switch (sender.tag) {
|
||||
case 0:
|
||||
[playPageMenuView showWithMenuType:WXYZ_MenuTypeTiming];
|
||||
break;
|
||||
case 1:
|
||||
if (self.productionType == TFProductionTypeAudio) {
|
||||
[playPageMenuView showWithMenuType:WXYZ_MenuTypeAudioSpeed];
|
||||
} else {
|
||||
[playPageMenuView showWithMenuType:WXYZ_MenuTypeAiSpeed];
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
[playPageMenuView showWithMenuType:WXYZ_MenuTypeAiVoice];
|
||||
break;
|
||||
case 3:
|
||||
playPageMenuView.menuListArray = self.chapter_list;
|
||||
if (self.chapter_list.firstObject.total_chapters != 0) {
|
||||
playPageMenuView.totalChapter = self.chapter_list.firstObject.total_chapters;
|
||||
} else {
|
||||
playPageMenuView.totalChapter = self.chapter_list.count;
|
||||
}
|
||||
if (self.productionType == TFProductionTypeAudio) {
|
||||
[playPageMenuView showWithMenuType:WXYZ_MenuTypeAudioDirectory];
|
||||
} else {
|
||||
[playPageMenuView showWithMenuType:WXYZ_MenuTypeAiDirectory];
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
playPageMenuView.chooseMenuBlock = ^(WXYZ_MenuType menuType, NSInteger chooseIndex) {
|
||||
switch (menuType) {
|
||||
case WXYZ_MenuTypeTiming:
|
||||
{
|
||||
SS(strongSelf)
|
||||
[[WXYZ_AudioSettingHelper sharedManager] startTimingFinishBlock:^{
|
||||
if ([[WXYZ_AudioSettingHelper sharedManager] getReadTiming] == 1) {
|
||||
strongSelf.timingButton.buttonTitle = TFLocalizedString(@"听完本章节");
|
||||
} else if ([[WXYZ_AudioSettingHelper sharedManager] getReadTiming] == 0) {
|
||||
strongSelf.timingButton.buttonTitle = TFLocalizedString(@"定时");
|
||||
}
|
||||
}];
|
||||
}
|
||||
break;
|
||||
case WXYZ_MenuTypeAiSpeed:
|
||||
case WXYZ_MenuTypeAudioSpeed:
|
||||
weakSelf.speedButton.buttonImageName = [NSString stringWithFormat:@"audio_speech_speed%@", [TFUtilsHelper formatStringWithInteger:chooseIndex]];
|
||||
|
||||
if (weakSelf.productionType == TFProductionTypeAudio) {
|
||||
[[WXYZ_Player sharedPlayer] setRate:[[[[WXYZ_AudioSettingHelper sharedManager] getReadSpeedValuesWithProducitionType:weakSelf.productionType] objectAtIndex:[[WXYZ_AudioSettingHelper sharedManager] getReadSpeedWithProducitionType:weakSelf.productionType]] floatValue]];
|
||||
} else {
|
||||
if (weakSelf.resetPlayerBlock) {
|
||||
weakSelf.resetPlayerBlock(YES);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case WXYZ_MenuTypeAiVoice:
|
||||
self.voiceButton.buttonTitle = TFLocalizedString([[WXYZ_AudioSettingHelper sharedManager] getReadVoiceTitleWithProducitionType:TFProductionTypeAi]);
|
||||
if (weakSelf.resetPlayerBlock) {
|
||||
weakSelf.resetPlayerBlock(YES);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
};
|
||||
playPageMenuView.chooseDirectoryMenuBlock = ^(NSInteger chapter_id, NSInteger chooseIndex) {
|
||||
if (weakSelf.productionType == TFProductionTypeAudio) {
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:Notification_Change_Audio_Chapter object:[TFUtilsHelper formatStringWithInteger:chapter_id]];
|
||||
} else {
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:Notification_Change_AiBook_Chapter object:[TFUtilsHelper formatStringWithInteger:chapter_id]];
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
- (void)resetPlayerInfo
|
||||
{
|
||||
self.temp_chapterModel = [[TFProductionChapterModel alloc] init];
|
||||
}
|
||||
|
||||
- (void)showPayView
|
||||
{
|
||||
if (![[WXYZ_AudioSettingHelper sharedManager] isPlayPageShowingWithProductionType:TFProductionTypeAi] && ![[WXYZ_AudioSettingHelper sharedManager] isPlayPageShowingWithProductionType:TFProductionTypeAudio]) {
|
||||
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
[TFPromptManager showPromptViewWithStatus:TFPromptStatusError promptTitle:TFLocalizedString(@"听到付费章节啦")];
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
WS(weakSelf)
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
|
||||
WXYZ_ChapterBottomPayBar *payBar = [[WXYZ_ChapterBottomPayBar alloc] initWithChapterModel:self.productionChapterModel barType:WXYZ_BottomPayBarTypeBuyChapter productionType:self.productionType];
|
||||
payBar.paySuccessChaptersBlock = ^(NSArray<NSString *> * _Nonnull success_chapter_ids) {
|
||||
if (weakSelf.productionType == TFProductionTypeAi) {
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:Notification_Change_AiBook_Chapter object:[TFUtilsHelper formatStringWithInteger:weakSelf.productionChapterModel.chapter_id] userInfo:@{@"success_chapter_ids":success_chapter_ids}];
|
||||
} else {
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:Notification_Change_Audio_Chapter object:[TFUtilsHelper formatStringWithInteger:weakSelf.productionChapterModel.chapter_id]];
|
||||
}
|
||||
};
|
||||
[payBar showBottomPayBar];
|
||||
});
|
||||
}
|
||||
|
||||
- (void)setPlayerState:(TFBasicVoicePlayerState)playerState
|
||||
{
|
||||
if (self) {
|
||||
_playerState = playerState;
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
switch (playerState) {
|
||||
case TFBasicVoicePlayerStateLoading:
|
||||
fastForwardButton.enabled = NO;
|
||||
fastBackButton.enabled = NO;
|
||||
playButton.enabled = NO;
|
||||
[playButton setImage:[UIImage imageNamed:@"audio_play_loading"] forState:UIControlStateNormal];
|
||||
[playButtonIndicator startAnimating];
|
||||
break;
|
||||
case TFBasicVoicePlayerStatePlaying:
|
||||
fastForwardButton.enabled = YES;
|
||||
fastBackButton.enabled = YES;
|
||||
playButton.enabled = YES;
|
||||
[playButton setImage:[UIImage imageNamed:@"audio_suspended"] forState:UIControlStateNormal];
|
||||
[playButtonIndicator stopAnimating];
|
||||
self.timelineProgress.userInteractionEnabled = YES;
|
||||
[[WXYZ_TouchAssistantView sharedManager] playPlayerState];
|
||||
if (self.productionType == TFProductionTypeAudio && [[WXYZ_Player sharedPlayer] progress] == 0) {
|
||||
[self.timelineProgress updateProgress:0 audioLength:[[WXYZ_Player sharedPlayer] totalTime]];
|
||||
}
|
||||
break;
|
||||
case TFBasicVoicePlayerStatePause:
|
||||
fastForwardButton.enabled = YES;
|
||||
fastBackButton.enabled = YES;
|
||||
playButton.enabled = YES;
|
||||
[playButton setImage:[UIImage imageNamed:@"audio_play"] forState:UIControlStateNormal];
|
||||
[playButtonIndicator stopAnimating];
|
||||
[[WXYZ_TouchAssistantView sharedManager] pausePlayerState];
|
||||
break;
|
||||
case TFBasicVoicePlayerStateFail:
|
||||
[TFPromptManager showPromptViewWithStatus:TFPromptStatusError promptTitle:TFLocalizedString(@"播放出错")];
|
||||
case TFBasicVoicePlayerStateStoped:
|
||||
fastForwardButton.enabled = NO;
|
||||
fastBackButton.enabled = NO;
|
||||
playButton.enabled = YES;
|
||||
[playButton setImage:[UIImage imageNamed:@"audio_play"] forState:UIControlStateNormal];
|
||||
[playButtonIndicator stopAnimating];
|
||||
[[WXYZ_TouchAssistantView sharedManager] stopPlayerState];
|
||||
[self.timelineProgress updateCacheProgress:0];
|
||||
[self.timelineProgress updateProgress:0 audioLength:0];
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,39 @@
|
||||
//
|
||||
// WXYZ_PlayPageModel.h
|
||||
// WXReader
|
||||
//
|
||||
// Created by Andrew on 2020/3/10.
|
||||
// Copyright © 2020 Andrew. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@class TFCommentsListModel, TFAdvertModel, WXYZ_RelationModel;
|
||||
|
||||
@interface WXYZ_PlayPageModel : NSObject
|
||||
|
||||
@property (nonatomic, assign) NSInteger comment_total_count;
|
||||
|
||||
@property (nonatomic, strong) TFCommentsModel *comment;
|
||||
|
||||
@property (nonatomic, strong) NSArray <TFProductionModel *> *list;
|
||||
|
||||
@property (nonatomic, strong) WXYZ_RelationModel *relation;
|
||||
|
||||
@property (nonatomic, strong) TFAdvertModel *advert;
|
||||
|
||||
@end
|
||||
|
||||
@interface WXYZ_RelationModel : NSObject
|
||||
|
||||
@property (nonatomic, assign) NSInteger production_id;
|
||||
|
||||
@property (nonatomic, assign) NSInteger chapter_id;
|
||||
|
||||
@property (nonatomic, copy) NSString *chapter_title;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,31 @@
|
||||
//
|
||||
// WXYZ_PlayPageModel.m
|
||||
// WXReader
|
||||
//
|
||||
// Created by Andrew on 2020/3/10.
|
||||
// Copyright © 2020 Andrew. All rights reserved.
|
||||
//
|
||||
|
||||
#import "WXYZ_PlayPageModel.h"
|
||||
|
||||
@implementation WXYZ_PlayPageModel
|
||||
|
||||
+ (NSDictionary<NSString *,id> *)modelContainerPropertyGenericClass{
|
||||
return @{@"comment" : [TFCommentsModel class],
|
||||
@"list" : [TFProductionModel class],
|
||||
@"advert" : [TFAdvertModel class],
|
||||
@"relation" : [WXYZ_RelationModel class]
|
||||
};
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation WXYZ_RelationModel
|
||||
|
||||
+ (NSDictionary *)modelCustomPropertyMapper {
|
||||
return @{
|
||||
@"production_id" :@[@"book_id", @"comic_id", @"audio_id"]
|
||||
};
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user