Commit 9a17cce4bfa1fad964d5efbd540c68fcef44ac3d
1 parent
c0f6b9eb
0.0.3
Showing
4 changed files
with
9 additions
and
9 deletions
CNLiveDownloadManager.podspec
CNLiveDownloadManager/Classes/ViewModel/CNLiveDownloadManager.h renamed to CNLiveDownloadManager/Classes/ViewModel/CNLiveAudioDownloadManager.h
| ... | ... | @@ -8,7 +8,7 @@ |
| 8 | 8 | #import <Foundation/Foundation.h> |
| 9 | 9 | @class CNLiveAlbumAudioListModel; |
| 10 | 10 | NS_ASSUME_NONNULL_BEGIN |
| 11 | -@interface CNLiveDownloadManager : NSObject | |
| 11 | +@interface CNLiveAudioDownloadManager : NSObject | |
| 12 | 12 | // 初始化下载单例,若之前程序杀死时有正在下的任务,会自动恢复下载 |
| 13 | 13 | + (instancetype)shareManager; |
| 14 | 14 | // 开始下载 | ... | ... |
CNLiveDownloadManager/Classes/ViewModel/CNLiveDownloadManager.m renamed to CNLiveDownloadManager/Classes/ViewModel/CNLiveAudioDownloadManager.m
| ... | ... | @@ -5,7 +5,7 @@ |
| 5 | 5 | // Created by 殷巧娟 on 2019/6/1. |
| 6 | 6 | // |
| 7 | 7 | |
| 8 | -#import "CNLiveDownloadManager.h" | |
| 8 | +#import "CNLiveAudioDownloadManager.h" | |
| 9 | 9 | #import "NSString+CNLiveExtension.h" |
| 10 | 10 | #import "CNLiveAlbumAudioListModel.h" |
| 11 | 11 | #import "NSURLSession+CNLiveCorrectedResumeData.h" |
| ... | ... | @@ -19,7 +19,7 @@ |
| 19 | 19 | #import "CNLiveTimeTools.h" |
| 20 | 20 | #import "CNLiveDownload.h" |
| 21 | 21 | #define CNLiveAppKeyWindow [UIApplication sharedApplication].delegate.window |
| 22 | -;@interface CNLiveDownloadManager ()<NSURLSessionDelegate,NSURLSessionDownloadDelegate,UIAlertViewDelegate> | |
| 22 | +;@interface CNLiveAudioDownloadManager ()<NSURLSessionDelegate,NSURLSessionDownloadDelegate,UIAlertViewDelegate> | |
| 23 | 23 | @property (nonatomic, strong) NSURLSession *session; // NSURLSession |
| 24 | 24 | @property (nonatomic, strong) NSMutableDictionary *dataTaskDic; // 同时下载多个文件,需要创建多个NSURLSessionDownloadTask,用该字典来存储 |
| 25 | 25 | @property (nonatomic, strong) NSMutableDictionary *downloadTaskDic; // 记录任务调用startDownloadTask:方法时间,禁止同一任务极短时间重复调用,防止状态显示错误 |
| ... | ... | @@ -28,9 +28,9 @@ |
| 28 | 28 | @property (nonatomic, assign) BOOL isNohaveNet; //没网 |
| 29 | 29 | @end |
| 30 | 30 | |
| 31 | -@implementation CNLiveDownloadManager | |
| 31 | +@implementation CNLiveAudioDownloadManager | |
| 32 | 32 | + (instancetype)shareManager { |
| 33 | - static CNLiveDownloadManager *manager = nil; | |
| 33 | + static CNLiveAudioDownloadManager *manager = nil; | |
| 34 | 34 | static dispatch_once_t onceToken; |
| 35 | 35 | dispatch_once(&onceToken, ^{ |
| 36 | 36 | manager = [[self alloc] init]; |
| ... | ... | @@ -407,7 +407,7 @@ |
| 407 | 407 | #pragma mark -添加网络通知 |
| 408 | 408 | - (void)monitorTheNetwork { |
| 409 | 409 | __weak typeof(self) weakSelf = self; |
| 410 | - [CNLiveDownloadManager networkStatusWithBlock:^(CNLiveNetworkStatusType status) { | |
| 410 | + [CNLiveAudioDownloadManager networkStatusWithBlock:^(CNLiveNetworkStatusType status) { | |
| 411 | 411 | switch (status) { |
| 412 | 412 | case CNLiveNetworkStatusNotReachable:{ |
| 413 | 413 | NSLog(@"无网"); |
| ... | ... | @@ -475,7 +475,7 @@ |
| 475 | 475 | |
| 476 | 476 | - (void)dealloc |
| 477 | 477 | { |
| 478 | - [CNLiveDownloadManager removeNetworkStatue]; | |
| 478 | + [CNLiveAudioDownloadManager removeNetworkStatue]; | |
| 479 | 479 | [_session invalidateAndCancel]; |
| 480 | 480 | [[NSNotificationCenter defaultCenter] removeObserver:self]; |
| 481 | 481 | } | ... | ... |
CNLiveDownloadManager/Classes/ViewModel/CNLiveDataBaseManager.m