浏览代码

1.缩略图下载功能修改逻辑

huangxiaodong 1 年之前
父节点
当前提交
ac88beb4df

+ 3 - 3
创维盒子/双子星云手机/Class/Set/uploadFile/downLoadFile/downLoadPreviewViewController.m

@@ -599,9 +599,9 @@
 #pragma mark 去下载缩略图
 - (void)gotoDownThumbnailManagerFun
 {
-    if(_curCouldPhoneFileListMod.data.list && _curCouldPhoneFileListMod.data.list.count >0){
-        [[downloadThumbnailManager shareInstance] handlToDownloadThumbnailWith:_curCouldPhoneFileListMod.data.list];
-    }
+//    if(_curCouldPhoneFileListMod.data.list && _curCouldPhoneFileListMod.data.list.count >0){
+//        [[downloadThumbnailManager shareInstance] handlToDownloadThumbnailWith:_curCouldPhoneFileListMod.data.list];
+//    }
 }
 
 - (void)gotoDownloadloadFileRecordFun

+ 4 - 1
创维盒子/双子星云手机/Class/Set/uploadFile/downLoadFile/view/downLoadPreViewCell.m

@@ -6,7 +6,7 @@
 //
 
 #import "downLoadPreViewCell.h"
-
+#import "downloadThumbnailManager.h"
 
 @implementation downLoadPreViewCell
 @synthesize cellBgView;
@@ -137,6 +137,9 @@
 - (void)setCurFileModel:(couldPhoneFileModel *)curFileModel
 {
     _curFileModel = curFileModel;
+    
+    [[downloadThumbnailManager shareInstance] handlToDownloadOneThumbnailWith:_curFileModel];
+    
     mImageView.image = [UIImage imageNamed:@"uploadFile_image"];
     if([curFileModel.fileType isEqualToString:@"video"])
     {

+ 5 - 3
创维盒子/双子星云手机/Class/Set/uploadFile/uploadFileManager/downloadThumbnailManager.h

@@ -23,11 +23,13 @@ NS_ASSUME_NONNULL_BEGIN
 
 @property(nonatomic,assign) BOOL  isPreViewTask;//预览进来的任务
 
-- (void)handlToDownloadThumbnailWith:(NSArray*)Arr;
-- (void)handlToDownloadThumbnailInDownTableViewWith:(NSArray*)Arr;
+//- (void)handlToDownloadThumbnailWith:(NSArray*)Arr;
+//- (void)handlToDownloadThumbnailInDownTableViewWith:(NSArray*)Arr;
 - (void)DownloadFileDoneOneFileFun;
 
-- (void)checkReDownloadThumbnailFileFun;
+//- (void)checkReDownloadThumbnailFileFun;
+
+- (void)handlToDownloadOneThumbnailWith:(couldPhoneFileModel*)model;
 @end
 
 NS_ASSUME_NONNULL_END

+ 80 - 74
创维盒子/双子星云手机/Class/Set/uploadFile/uploadFileManager/downloadThumbnailManager.m

@@ -37,65 +37,71 @@ static downloadThumbnailManager * cur_downloadFileShareInstance = nil;
     return self;
 }
 
-- (void)handlToDownloadThumbnailWith:(NSArray*)Arr
-{
-    _isPreViewTask = YES;
-    [self handDataArrFun:Arr];
-}
+//- (void)handlToDownloadThumbnailWith:(NSArray*)Arr
+//{
+//    _isPreViewTask = YES;
+//    [self handDataArrFun:Arr];
+//}
 
-- (void)handDataArrFun:(NSArray*)Arr{
-    if(Arr && Arr.count >0){
-        NSLock *lock = [NSLock new];
-        [lock lock];
-        if (!_waitDownloadTaskArr) {
-            _waitDownloadTaskArr = [NSMutableArray arrayWithArray:Arr];
-        }
-        else{
-            [_waitDownloadTaskArr addObjectsFromArray:Arr];
-        }
-        
-        [self planToDownloadThumbnailFun];
-        [lock unlock];
-    }
-}
+//- (void)handDataArrFun:(NSArray*)Arr{
+//    if(Arr && Arr.count >0){
+//        NSLock *lock = [NSLock new];
+//        [lock lock];
+//        if (!_waitDownloadTaskArr) {
+//            _waitDownloadTaskArr = [NSMutableArray arrayWithArray:Arr];
+//        }
+//        else{
+//            [_waitDownloadTaskArr addObjectsFromArray:Arr];
+//        }
+//        
+//        [self planToDownloadThumbnailFun];
+//        [lock unlock];
+//    }
+//}
 
-- (void)handlToDownloadThumbnailInDownTableViewWith:(NSArray*)Arr{
-    if(_isPreViewTask){
-        if (_downloadingTaskArr.count == 0 ) {
-            [self handDataArrFun:Arr];
-        }
-        else{
-            //不处理
-        }
-    }
-    else{
-        [self handDataArrFun:Arr];
-    }
-}
+//- (void)handlToDownloadThumbnailInDownTableViewWith:(NSArray*)Arr{
+//    if(_isPreViewTask){
+//        if (_downloadingTaskArr.count == 0 ) {
+//            [self handDataArrFun:Arr];
+//        }
+//        else{
+//            //不处理
+//        }
+//    }
+//    else{
+//        [self handDataArrFun:Arr];
+//    }
+//}
+
+//- (void)planToDownloadThumbnailFun
+//{
+//    if (!_downloadingTaskArr || _downloadingTaskArr.count == 0) {
+//        _downloadingTaskArr = [NSMutableArray arrayWithArray:_waitDownloadTaskArr];
+//        [_waitDownloadTaskArr removeAllObjects];
+//    }
+//    
+//    [self beginDownloadThumbnailFun];
+//}
 
-- (void)planToDownloadThumbnailFun
+- (void)handlToDownloadOneThumbnailWith:(couldPhoneFileModel*)model
 {
-    if (!_downloadingTaskArr || _downloadingTaskArr.count == 0) {
-        _downloadingTaskArr = [NSMutableArray arrayWithArray:_waitDownloadTaskArr];
-        [_waitDownloadTaskArr removeAllObjects];
-    }
-    
-    [self beginDownloadThumbnailFun];
+    [self beginDownloadThumbnailFun:model];
 }
 
-- (void)beginDownloadThumbnailFun
+- (void)beginDownloadThumbnailFun:(couldPhoneFileModel*)model
 {
-    if (_downloadingTaskArr.count > 0) {
-        _curDownloadFileModel = _downloadingTaskArr.firstObject;
-    }
-    else{
-        if(_waitDownloadTaskArr && _waitDownloadTaskArr.count>0){
-            _downloadingTaskArr = [NSMutableArray arrayWithArray:_waitDownloadTaskArr];
-            [_waitDownloadTaskArr removeAllObjects];
-            [self beginDownloadThumbnailFun];
-        }
-        return;
-    }
+    self.curDownloadFileModel = model;
+//    if (_downloadingTaskArr.count > 0) {
+//        _curDownloadFileModel = _downloadingTaskArr.firstObject;
+//    }
+//    else{
+//        if(_waitDownloadTaskArr && _waitDownloadTaskArr.count>0){
+//            _downloadingTaskArr = [NSMutableArray arrayWithArray:_waitDownloadTaskArr];
+//            [_waitDownloadTaskArr removeAllObjects];
+//            [self beginDownloadThumbnailFun];
+//        }
+//        return;
+//    }
     
     //检测本地是否已经下载文件了
     NSString *fileName = [self.curDownloadFileModel getFileNameFun];
@@ -106,7 +112,7 @@ static downloadThumbnailManager * cur_downloadFileShareInstance = nil;
         //已经下载过了
         [_downloadingTaskArr removeObject:_curDownloadFileModel];
         _curDownloadFileModel = nil;
-        [self beginDownloadThumbnailFun];
+        //[self beginDownloadThumbnailFun];
         return;
     }
     
@@ -116,28 +122,28 @@ static downloadThumbnailManager * cur_downloadFileShareInstance = nil;
 
 - (void)DownloadFileDoneOneFileFun
 {
-    [_downloadingTaskArr removeObject:_curDownloadFileModel];
-    _curDownloadFileModel = nil;
-    [self beginDownloadThumbnailFun];
-    self.taskRenewTime = [iTools getNowTimeStamp];
+//    [_downloadingTaskArr removeObject:_curDownloadFileModel];
+//    _curDownloadFileModel = nil;
+//    [self beginDownloadThumbnailFun];
+//    self.taskRenewTime = [iTools getNowTimeStamp];
     [[NSNotificationCenter defaultCenter] postNotificationName:downloadThumbnailDoneOneNotification object:nil];
 }
 
-- (void)checkReDownloadThumbnailFileFun
-{
-    NSInteger curTime = [iTools getNowTimeStamp];
-    
-    if(self.taskRenewTime == 0){
-        return;
-    }
-    
-    if(curTime - self.taskRenewTime < 10){
-        return;
-    }
-    
-    if((_downloadingTaskArr && _downloadingTaskArr.count >0)
-       ||(_waitDownloadTaskArr && _waitDownloadTaskArr.count>0)){
-        [self beginDownloadThumbnailFun];
-    }
-}
+//- (void)checkReDownloadThumbnailFileFun
+//{
+//    NSInteger curTime = [iTools getNowTimeStamp];
+//    
+//    if(self.taskRenewTime == 0){
+//        return;
+//    }
+//    
+//    if(curTime - self.taskRenewTime < 10){
+//        return;
+//    }
+//    
+//    if((_downloadingTaskArr && _downloadingTaskArr.count >0)
+//       ||(_waitDownloadTaskArr && _waitDownloadTaskArr.count>0)){
+//        [self beginDownloadThumbnailFun];
+//    }
+//}
 @end

+ 9 - 9
创维盒子/双子星云手机/Class/Set/uploadFile/uploadFileRecordViewController.m

@@ -517,15 +517,15 @@
         });
         
         //检测下预览图片是否都下载
-        if(isRegetType){
-            if(Arr &&Arr.count == 3){
-                NSArray *downingArr = Arr[0];
-                dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
-                    [[downloadThumbnailManager shareInstance] handlToDownloadThumbnailInDownTableViewWith:downingArr];
-                });
-            }
-            
-        }
+//        if(isRegetType){
+//            if(Arr &&Arr.count == 3){
+//                NSArray *downingArr = Arr[0];
+//                dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
+//                    [[downloadThumbnailManager shareInstance] handlToDownloadThumbnailInDownTableViewWith:downingArr];
+//                });
+//            }
+//            
+//        }
         
     }];
     

+ 3 - 0
创维盒子/双子星云手机/Class/Set/uploadFile/uploadFileView/downloadFileRecordCell.m

@@ -9,6 +9,7 @@
 
 #import "cachesFileManager.h"
 #import <SDWebImage/SDWebImage.h>
+#import "downloadThumbnailManager.h"
 
 @interface downloadFileRecordCell ()
 @property(nonatomic,strong) UIImageView *fileImageView;
@@ -219,6 +220,8 @@
     
     _curCouldPhoneFileModel = curCouldPhoneFileModel;
     
+    [[downloadThumbnailManager shareInstance] handlToDownloadOneThumbnailWith:_curCouldPhoneFileModel];
+    
     if(_curCouldPhoneFileModel.curDownloadStateType != downloadStateDone){
         //HLog(@"hhhhhhh2  %@ %ld ",_curCouldPhoneFileModel.name,_curCouldPhoneFileModel.didDownloadBytes);
     }

+ 1 - 1
创维盒子/双子星云手机/CloudPlayer/PlayerViewController+otherDelegate.mm

@@ -445,7 +445,7 @@
     [[uploadFileManager shareInstance] checkReUploadFileFun];
     [[downloadManager shareInstance] checkReDownloadFileFun];
     
-    [[downloadThumbnailManager shareInstance] checkReDownloadThumbnailFileFun];
+    //[[downloadThumbnailManager shareInstance] checkReDownloadThumbnailFileFun];
     
     [self checkCommandSendTaskFun];