72 lines
2.7 KiB
Objective-C
72 lines
2.7 KiB
Objective-C
//
|
|
// WXYZ_DownloadHelper.h
|
|
// WXReader
|
|
//
|
|
// Created by Andrew on 2020/4/1.
|
|
// Copyright © 2020 Andrew. All rights reserved.
|
|
//
|
|
|
|
#import <Foundation/Foundation.h>
|
|
#import "WXYZ_DownloadManagerProtocol.h"
|
|
|
|
NS_ASSUME_NONNULL_BEGIN
|
|
|
|
// 章节记录文件key
|
|
#define chapterRecordKey(production_id, chapter_id) [TFUtilsHelper stringToMD5:[NSString stringWithFormat:@"%@%@", [TFUtilsHelper formatStringWithInteger:production_id], [TFUtilsHelper formatStringWithInteger:chapter_id]]]
|
|
|
|
|
|
@interface WXYZ_DownloadHelper : NSObject
|
|
|
|
interface_singleton
|
|
|
|
/*
|
|
增
|
|
**/
|
|
|
|
// 作品下载记录
|
|
- (void)recordDownloadProductionWithProductionModel:(TFProductionModel *)productionModel productionType:(TFProductionType)productionType;
|
|
|
|
/*
|
|
删
|
|
**/
|
|
|
|
// 删除作品文件夹
|
|
- (void)removeDownloadProductionFolderWithProduction_id:(NSInteger)production_id productionType:(TFProductionType)productionType;
|
|
|
|
// 删除章节文件夹
|
|
- (BOOL)removeDownloadChapterFolderWithProduction_id:(NSInteger)production_id chapter_ids:(NSArray <NSString *>*)chapter_ids productionType:(TFProductionType)productionType;
|
|
/*
|
|
查
|
|
**/
|
|
|
|
// 作品章节是否下载
|
|
- (BOOL)isChapterDownloadedWithProduction_id:(NSInteger)production_id chapter_id:(NSInteger)chapter_id productionType:(TFProductionType)productionType;
|
|
|
|
// 下载作品文件夹路径
|
|
- (NSString *)getDownloadProductionFolderPathWithProduction_id:(NSInteger)production_id productionType:(TFProductionType)productionType;
|
|
|
|
// 下载章节文件夹路径
|
|
- (NSString *)getDownloadChapterFolderPathWithProduction_id:(NSInteger)production_id chapter_id:(NSInteger)chapter_id productionType:(TFProductionType)productionType;
|
|
|
|
// 下载作品记录文件路径
|
|
- (NSString *)getDownloadProductionRecordPlistFilePathWithProductionType:(TFProductionType)productionType;
|
|
|
|
// 获取下载章节数
|
|
- (NSInteger)getDownloadChapterCountWithProduction_id:(NSInteger)production_id productionType:(TFProductionType)productionType;
|
|
|
|
// 获取类别下的所有下载作品model
|
|
- (NSArray <TFProductionModel *> *)getDownloadProductionArrayWithProductionType:(TFProductionType)productionType;
|
|
|
|
// 获取某一已下载作品model
|
|
- (TFProductionModel *)getDownloadProductionModelWithProduction_id:(NSInteger)production_id productionType:(TFProductionType)productionType;
|
|
|
|
// 章节记录缓存变量
|
|
- (NSMutableDictionary *)chaptersRecordDownloadDictionaryWithProduction_id:(NSInteger)production_id productionType:(TFProductionType)productionType modelClass:(__nullable Class)modelClass;
|
|
|
|
// 写入章节记录文件
|
|
- (BOOL)writeToChapterPlistFileWithProduction_id:(NSInteger)production_id productionType:(TFProductionType)productionType modelClass:(Class)modelClass;
|
|
|
|
@end
|
|
|
|
NS_ASSUME_NONNULL_END
|