Commit ad6e557b by wanggang

增加下载完成通知

parent a1efd29b
......@@ -707,6 +707,12 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 6993EC242D8AF84C1273D9A5 /* Pods-WXDownloadingComponent.debug.xcconfig */;
buildSettings = {
ARCHS = (
arm64,
arm64e,
armv7,
armv7s,
);
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEAD_CODE_STRIPPING = NO;
......@@ -742,6 +748,12 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 174BC2B187AD7DCACE6ED9D2 /* Pods-WXDownloadingComponent.release.xcconfig */;
buildSettings = {
ARCHS = (
arm64,
arm64e,
armv7,
armv7s,
);
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEAD_CODE_STRIPPING = NO;
......
......@@ -273,6 +273,17 @@ typedef NS_ENUM(NSInteger, DownloadRejectReason) {
/// 试卷的文件大小
@property (nonatomic, strong) NSString *pdf_size;
/// 下载内容对应的 channel,题库、IIP 等
@property (nonatomic, copy) NSString *channel;
/// 是否新线
@property (nonatomic, assign) BOOL isNewLine;
/// 题库相关下载的 PDF 类型和来源
@property (nonatomic, assign) WXDownloadPDFSourceType pdfSourceType;
@end
NS_ASSUME_NONNULL_END
......@@ -361,6 +361,8 @@
weakSelf.downloadModel.down_state = stateCompleted;
weakSelf.downloadModel.down_date = [WXCOUtility getTimeNow];
[[CODownloadManager sharedInstance] co_syncDownRecordForDownloadModel:weakSelf.downloadModel];
[[NSNotificationCenter defaultCenter] postNotificationName:WXDownloadingTaskDidCompleteNotification object:weakSelf.downloadModel];
}
else if (error.code == -999) { } // 取消或暂停
else if (error.code == -1005) { } // 网络连接已中断 在网络切换时发生
......
......@@ -15,6 +15,18 @@
//字符串是否为空
#define WXCOStringIsEmpty(str) ([str isKindOfClass:[NSNull class]] || str == nil || [str length] < 1 ? YES : NO )
/// 文件下载完成的通知,object 参数传递当前下载的 CODownloadModel 实例
#define WXDownloadingTaskDidCompleteNotification @"WXDownloadingTaskDidCompleteNotification"
/// 分为默认列表类型 和 下载模式下的类型
typedef NS_ENUM(NSUInteger, COLessonModelDownloadType) {
COLessonModelDownloadTypeDisable, //不可下载
COLessonModelDownloadTypeCanDownload, //可下载
COLessonModelDownloadTypeHasDownload, //已下载 并完成
COLessonModelDownloadTypeDownloading, //正在下载
COLessonModelDownloadTypeSelected, //选中准备下载
};
/// 节点下载状态(针对视频、直接打开的PDF等)
typedef NS_ENUM (NSInteger, DownloadState) {
/// 未下载
......
......@@ -146,6 +146,9 @@
model.need_sync = needSyncValueYES;
model.is_show = isShowValueYES;
model.check_expired = checkExpiredValueNO;
model.channel = paperModel.channel;
model.isNewLine = paperModel.isNewLine;
model.pdfSourceType = paperModel.pdfSourceType;
[self.newDownloadModels addObject:model]; // 新生成的下载模型数据
return model;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment