Browse Source

1.下载代码暂存

huangxiaodong 1 year ago
parent
commit
65c78039e5
17 changed files with 1411 additions and 123 deletions
  1. 16 0
      创维盒子/双子星云手机.xcodeproj/project.pbxproj
  2. 2 0
      创维盒子/双子星云手机/AppDelegate/Config/Notification.h
  3. 0 1
      创维盒子/双子星云手机/Class/Set/MySetViewController.m
  4. 1 1
      创维盒子/双子星云手机/Class/Set/uploadFile/PhotoPreviewViewController.m
  5. 17 9
      创维盒子/双子星云手机/Class/Set/uploadFile/downLoadFile/downLoadPreviewViewController.m
  6. 8 1
      创维盒子/双子星云手机/Class/Set/uploadFile/uploadFileManager/downloadManager.h
  7. 182 3
      创维盒子/双子星云手机/Class/Set/uploadFile/uploadFileManager/downloadManager.m
  8. 4 1
      创维盒子/双子星云手机/Class/Set/uploadFile/uploadFileRecordViewController.h
  9. 197 93
      创维盒子/双子星云手机/Class/Set/uploadFile/uploadFileRecordViewController.m
  10. 25 0
      创维盒子/双子星云手机/Class/Set/uploadFile/uploadFileView/downloadFileRecordCell.h
  11. 398 0
      创维盒子/双子星云手机/Class/Set/uploadFile/uploadFileView/downloadFileRecordCell.m
  12. 41 0
      创维盒子/双子星云手机/Class/Set/uploadFile/uploadFileView/downloadFileRecordTableView.h
  13. 496 0
      创维盒子/双子星云手机/Class/Set/uploadFile/uploadFileView/downloadFileRecordTableView.m
  14. 1 1
      创维盒子/双子星云手机/Class/Set/uploadFile/uploadImageOrVideoViewController.m
  15. 6 0
      创维盒子/双子星云手机/CloudPlayer/Model/couldPhoneFileListModel.m
  16. 16 13
      创维盒子/双子星云手机/CloudPlayer/PlayerViewController+downloadFile.m
  17. 1 0
      创维盒子/双子星云手机/zh-Hans.lproj/Localizable.strings

+ 16 - 0
创维盒子/双子星云手机.xcodeproj/project.pbxproj

@@ -255,6 +255,10 @@
 		6BBB35DE2AE76AD800E4A59B /* AudioSessionObject.m in Sources */ = {isa = PBXBuildFile; fileRef = 6BBB35DC2AE76AD800E4A59B /* AudioSessionObject.m */; };
 		6BBB35E22AE935C000E4A59B /* DDYLanguageTool.h in Headers */ = {isa = PBXBuildFile; fileRef = 6BBB35E02AE935C000E4A59B /* DDYLanguageTool.h */; };
 		6BBB35E32AE935C000E4A59B /* DDYLanguageTool.m in Sources */ = {isa = PBXBuildFile; fileRef = 6BBB35E12AE935C000E4A59B /* DDYLanguageTool.m */; };
+		6BED888A2B4E819000F76DDC /* downloadFileRecordTableView.h in Headers */ = {isa = PBXBuildFile; fileRef = 6BED88882B4E819000F76DDC /* downloadFileRecordTableView.h */; };
+		6BED888B2B4E819000F76DDC /* downloadFileRecordTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6BED88892B4E819000F76DDC /* downloadFileRecordTableView.m */; };
+		6BED888E2B4E901900F76DDC /* downloadFileRecordCell.h in Headers */ = {isa = PBXBuildFile; fileRef = 6BED888C2B4E901900F76DDC /* downloadFileRecordCell.h */; };
+		6BED888F2B4E901900F76DDC /* downloadFileRecordCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 6BED888D2B4E901900F76DDC /* downloadFileRecordCell.m */; };
 		6BF0F3D02AD391D8000AA133 /* connectDeviceManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 6BF0F3CE2AD391D8000AA133 /* connectDeviceManager.h */; };
 		6BF0F3D12AD391D8000AA133 /* connectDeviceManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 6BF0F3CF2AD391D8000AA133 /* connectDeviceManager.m */; };
 		6BF0F3D52AD3937B000AA133 /* DeviceThirdIdModel.h in Headers */ = {isa = PBXBuildFile; fileRef = 6BF0F3D32AD3937B000AA133 /* DeviceThirdIdModel.h */; };
@@ -700,6 +704,10 @@
 		6BBB35DC2AE76AD800E4A59B /* AudioSessionObject.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AudioSessionObject.m; sourceTree = "<group>"; };
 		6BBB35E02AE935C000E4A59B /* DDYLanguageTool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DDYLanguageTool.h; sourceTree = "<group>"; };
 		6BBB35E12AE935C000E4A59B /* DDYLanguageTool.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DDYLanguageTool.m; sourceTree = "<group>"; };
+		6BED88882B4E819000F76DDC /* downloadFileRecordTableView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = downloadFileRecordTableView.h; sourceTree = "<group>"; };
+		6BED88892B4E819000F76DDC /* downloadFileRecordTableView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = downloadFileRecordTableView.m; sourceTree = "<group>"; };
+		6BED888C2B4E901900F76DDC /* downloadFileRecordCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = downloadFileRecordCell.h; sourceTree = "<group>"; };
+		6BED888D2B4E901900F76DDC /* downloadFileRecordCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = downloadFileRecordCell.m; sourceTree = "<group>"; };
 		6BF0F3CE2AD391D8000AA133 /* connectDeviceManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = connectDeviceManager.h; sourceTree = "<group>"; };
 		6BF0F3CF2AD391D8000AA133 /* connectDeviceManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = connectDeviceManager.m; sourceTree = "<group>"; };
 		6BF0F3D32AD3937B000AA133 /* DeviceThirdIdModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DeviceThirdIdModel.h; sourceTree = "<group>"; };
@@ -1435,10 +1443,14 @@
 				6B72725A2B0E22D000C03F87 /* uploadFileRecordBgScorllView.m */,
 				6B72725D2B0E240F00C03F87 /* uploadFileRecordTableView.h */,
 				6B72725E2B0E240F00C03F87 /* uploadFileRecordTableView.m */,
+				6BED88882B4E819000F76DDC /* downloadFileRecordTableView.h */,
+				6BED88892B4E819000F76DDC /* downloadFileRecordTableView.m */,
 				6B1FBD382B467A8000926382 /* backupsFilerecordTableView.h */,
 				6B1FBD392B467A8000926382 /* backupsFilerecordTableView.m */,
 				6B8FF6BF2B05B24D00800981 /* uploadFileRecordCell.h */,
 				6B8FF6C02B05B24D00800981 /* uploadFileRecordCell.m */,
+				6BED888C2B4E901900F76DDC /* downloadFileRecordCell.h */,
+				6BED888D2B4E901900F76DDC /* downloadFileRecordCell.m */,
 				6B1FBD3C2B46875300926382 /* backupsFileRecordCell.h */,
 				6B1FBD3D2B46875300926382 /* backupsFileRecordCell.m */,
 				6B7272492B0AF59200C03F87 /* uploadFileRecordTableViewHeadView.h */,
@@ -1964,8 +1976,10 @@
 				181E84F72A8F451D00292B96 /* MineViewCell.h in Headers */,
 				6B8FF6C12B05B24D00800981 /* uploadFileRecordCell.h in Headers */,
 				183AE6D42A8CAFAE00B11CB0 /* UIView+View.h in Headers */,
+				6BED888A2B4E819000F76DDC /* downloadFileRecordTableView.h in Headers */,
 				6B0581AF2AFCF57300D37290 /* AJPhotoGroupCell.h in Headers */,
 				6B5D401A2B4A9850000965CF /* couldPhoneFolderListModel.h in Headers */,
+				6BED888E2B4E901900F76DDC /* downloadFileRecordCell.h in Headers */,
 				184C8ACC2A94557200F26650 /* HidenMaskSetViewController.h in Headers */,
 				18EC79DC2ABC109F0084836A /* SetPWDSecondViewController.h in Headers */,
 				6B0582852B0457C400D37290 /* uploadFileManager.h in Headers */,
@@ -2354,6 +2368,7 @@
 				A08A950327E9A4E400C544BB /* FMDatabasePool.m in Sources */,
 				A003F6D327D8425C00715CBF /* iToast.m in Sources */,
 				A08A94E027E9837600C544BB /* HWPageListCell.m in Sources */,
+				6BED888B2B4E819000F76DDC /* downloadFileRecordTableView.m in Sources */,
 				A084D69827E8657800054880 /* HWHomeListCell.m in Sources */,
 				183AE6032A89CE3C00B11CB0 /* JSONKeyMapper.m in Sources */,
 				6BF52C9B2AD5546500A617DB /* SimplePing.m in Sources */,
@@ -2401,6 +2416,7 @@
 				184C8ADE2A949DBD00F26650 /* HWVersionModel.m in Sources */,
 				6B21709D2B15CDB600656670 /* NSArray+Log.m in Sources */,
 				18FCE5352AD12FE00020F623 /* ConnectTestViewController.m in Sources */,
+				6BED888F2B4E901900F76DDC /* downloadFileRecordCell.m in Sources */,
 				183AE64C2A8A2CF000B11CB0 /* UIProgressView+AFNetworking.m in Sources */,
 				A031DD7527EC507000909527 /* HWAddFolderViewController.m in Sources */,
 				186820222AB98600005702A6 /* QRCodeScanViewController.m in Sources */,

+ 2 - 0
创维盒子/双子星云手机/AppDelegate/Config/Notification.h

@@ -81,6 +81,8 @@
 
 /* 下载文件通知*/
 #define downloadFileBeginNotification                 @"downloadFileBeginNot"
+/*下载文件更新通知*/
+#define downloadFileRefreshNotification                 @"downloadFileRefreshNot"
 
 /* 创建文件夹通知*/
 #define createFolderBeginNotification                 @"createFolderBeginNot"

+ 0 - 1
创维盒子/双子星云手机/Class/Set/MySetViewController.m

@@ -118,7 +118,6 @@
 - (void)didiClikRightButFun:(UIButton*)but
 {
     uploadFileRecordViewController *vc = [uploadFileRecordViewController new];
-    vc.isNotUploadingType = YES;
     [self.navigationController pushViewController:vc animated:YES];
 }
 

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

@@ -355,7 +355,7 @@
     
     uploadFileRecordViewController *vc = [uploadFileRecordViewController new];
     [self.navigationController pushViewController:vc animated:YES];
-    
+    vc.isUploadingType = YES;
     [vc gotoUploadFile:_indexPathsForSelectedItems];
 }
 

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

@@ -11,11 +11,13 @@
 #import "downloadFileBottomView.h"
 #import "downloadThumbnailManager.h"
 #import "downloadManager.h"
+#import "uploadFileRecordViewController.h"
 
 @interface downLoadPreviewViewController ()<UITableViewDelegate,UITableViewDataSource>
 @property (nonatomic, strong) UITableView *tableView;
 @property (nonatomic, strong) UIButton *rightButton;
 @property (nonatomic, strong) downloadFileBottomView *downloadFileBottomV;
+@property (nonatomic,assign) BOOL didGetType;
 
 @property(nonatomic,strong) couldPhoneFileListModel *curCouldPhoneFileListMod;
 @end
@@ -202,14 +204,19 @@
 {
     [super viewWillAppear:animated];
     
-    if(_isPhotoType){
-        self.titleLabel.text = NSLocalizedString(@"my_set_no_image_upload",nil) ;
-    }
-    else{
-        self.titleLabel.text = NSLocalizedString(@"my_set_no_video_upload",nil) ;
+    if(!_didGetType){
+        if(_isPhotoType){
+            self.titleLabel.text = NSLocalizedString(@"my_set_no_image_upload",nil) ;
+        }
+        else{
+            self.titleLabel.text = NSLocalizedString(@"my_set_no_video_upload",nil) ;
+        }
+        
+        [self searchFileListFun];
+        
+        _didGetType = YES;
     }
     
-    [self searchFileListFun];
 }
 
 - (void)searchFileListFun
@@ -242,9 +249,10 @@
 
 - (void)gotoDownloadloadFileRecordFun
 {
-    [[downloadManager shareInstance] handleCouldPhoneFileModelToDownloadFileDataFunBy:_downloadFileBottomV.indexPathsForSelectedItems complete:^(NSMutableArray * _Nonnull Arr) {
-        
-    }];
+    uploadFileRecordViewController *vc = [uploadFileRecordViewController new];
+    [self.navigationController pushViewController:vc animated:YES];
+    vc.isDownloadingType = YES;
+    [vc gotoDownloadFile:_downloadFileBottomV.indexPathsForSelectedItems];
 }
 
 @end

+ 8 - 1
创维盒子/双子星云手机/Class/Set/uploadFile/uploadFileManager/downloadManager.h

@@ -22,15 +22,22 @@ NS_ASSUME_NONNULL_BEGIN
 @property (nonatomic, strong) couldPhoneFileModel *  curDownloadFileModel;
 @property (nonatomic, assign) BOOL  isSuspendType;
 @property (nonatomic, assign) BOOL  isDownloadIngType;
+@property (nonatomic, assign) NSInteger  reDownloadIngSelectIndex;
 
 +(downloadManager *)shareInstance;
 #pragma mark 读取数据库数据
 - (void)getDataInDatabaseFun:(BOOL)isReGet complete:(custom_complete_Arr)complete;
 
-- (void)handleCouldPhoneFileModelToDownloadFileDataFunBy:(NSMutableArray*)indexPathsForSelectedItems complete:(custom_complete_Arr)complete;
+-(void)handleCouldPhoneFileModelToDownloadFileDataFunBy:(NSMutableArray*)indexPathsForSelectedItems complete:(custom_complete_Arr)complete;
 
 - (void)DownloadFileDoneOneFileFun;
 
+- (void)DownloadFileChangeingOneFileFun;
+- (void)suspendDownloadFileFun:(BOOL)isSuspendAll;
+- (void)reDownloadFileFunBy:(NSMutableArray*)arr;
+
+//删除本地数据库记录
+- (void)deleteDownloadFileRecordBy:(NSMutableArray *)delArr withDelCache:(BOOL)isDelCache;
 @end
 
 NS_ASSUME_NONNULL_END

+ 182 - 3
创维盒子/双子星云手机/Class/Set/uploadFile/uploadFileManager/downloadManager.m

@@ -169,7 +169,22 @@ static downloadManager * cur_downloadManager = nil;
     
     _isSuspendType = NO;
     _isDownloadIngType = YES;
-    _curDownloadFileModel = _downLoadFileModelDataArr.lastObject;
+    
+    if(_reDownloadIngSelectIndex > 0
+       && _reDownloadIngSelectIndex < _downLoadFileModelDataArr.count){
+        _curDownloadFileModel = _downLoadFileModelDataArr[_reDownloadIngSelectIndex];
+    }
+    else
+    {
+        _curDownloadFileModel = _downLoadFileModelDataArr.firstObject;
+    }
+    
+    
+    if(!_curDownloadFileModel){
+        return;
+    }
+    
+    _curDownloadFileModel.curDownloadStateType = downloadStateUploading;
     
     [[NSNotificationCenter defaultCenter] postNotificationName:downloadFileBeginNotification object:_curDownloadFileModel];
 }
@@ -180,11 +195,175 @@ static downloadManager * cur_downloadManager = nil;
 //    NSString *fileName = [_curDownloadFileModel getFileNameFun];
 //    [cachesFileManager removeItemAtPath:fileName type:DownLoadFileType error:nil];
     
+    [self DownloadFileChangeingOneFileFun];
+    
+    if(_isSuspendType){
+        return;
+    }
+    
+    [_downLoadFileModelDataArr removeObject:_curDownloadFileModel];
+    NSMutableArray*doneArr = _databaseArr[1];
+    [doneArr addObject:_curDownloadFileModel];
+    
+    [self beginDownloadFileFun];
+}
+
+- (void)DownloadFileChangeingOneFileFun
+{
+    if(_curDownloadFileModel.curDownloadStateType == downloadStateDone){
+    
+    }
+    else if(_curDownloadFileModel.curDownloadStateType == uploadStateFail){
+        [self handleDatabaseArrDeleteObjectInDownloading:_curDownloadFileModel];
+        [self handleDatabaseArrAddObjectInFail:_curDownloadFileModel];
+    }
+
     [_curDownloadFileModel bg_saveOrUpdateAsync:^(BOOL isSuccess) {
-            
+        //HLog(@"%@ 写入 %@", model.filename, isSuccess ? @"成功":@"失败");
     }];
+        
+    
+    if(!_isSuspendType || _curDownloadFileModel.curDownloadStateType != uploadStateSuspend){
+        [[NSNotificationCenter defaultCenter] postNotificationName:downloadFileRefreshNotification object:_curDownloadFileModel];
+    }
+    
+}
+
+
+
+- (void)handleDatabaseArrDeleteObjectInDownloading:(couldPhoneFileModel*)model
+{
+    if(_databaseArr && _databaseArr.count == 3 ){
+        NSMutableArray *ingArr = _databaseArr[0];
+        [ingArr removeObject:model];
+    }
+}
+
+- (void)handleDatabaseArrAddObjectInDone:(couldPhoneFileModel*)model
+{
+    if(_databaseArr && _databaseArr.count == 3 ){
+        NSMutableArray *doneArr = _databaseArr[1];
+        [doneArr insertObject:model atIndex:0];
+    }
+}
+
+- (void)handleDatabaseArrAddObjectInFail:(couldPhoneFileModel*)model
+{
+    if(_databaseArr && _databaseArr.count == 3 ){
+        NSMutableArray *failArr = _databaseArr[2];
+        [failArr insertObject:model atIndex:0];
+    }
+}
+
+- (void)suspendDownloadFileFun:(BOOL)isSuspendAll
+{
+    _isSuspendType = YES;
+    
+    if(isSuspendAll){
+        for (couldPhoneFileModel *couldPhoneFileMod in _downLoadFileModelDataArr) {
+            couldPhoneFileMod.curDownloadStateType = downloadStateSuspend;
+        }
+    }
+}
+
+- (void)reDownloadFileFunBy:(NSMutableArray*)Arr
+{
+    if(!_downLoadFileModelDataArr){
+        _downLoadFileModelDataArr = [NSMutableArray new];
+    }
+    
+    _reDownloadIngSelectIndex = 0;
+    
+    for (uploadFileDataModel*addModel in Arr) {
+        
+        BOOL needAddModel = YES;
+        
+        for (int i=0;i< _downLoadFileModelDataArr.count;i++)
+        {
+            couldPhoneFileModel*preModel = _downLoadFileModelDataArr[i];
+            
+            if(addModel.bg_id.integerValue == preModel.bg_id.integerValue)
+            {
+                needAddModel = NO;
+                
+                if(_reDownloadIngSelectIndex == 0){
+                    _reDownloadIngSelectIndex = i;
+                    
+                    if(i==0){
+                        _reDownloadIngSelectIndex = -1;
+                    }
+                }
+                
+                break;
+            }
+        }
+        
+        if(needAddModel){
+            [_downLoadFileModelDataArr addObject:addModel];
+        }
+    }
     
-    [_downLoadFileModelDataArr removeObject:_curDownloadFileModel];
     [self beginDownloadFileFun];
 }
+
+- (void)handleDatabaseArrByDelete:(couldPhoneFileModel*)delModel
+{
+    if(_databaseArr && _databaseArr.count == 3 ){
+        
+        if(delModel.curDownloadStateType == downloadStateDone)
+        {
+            NSMutableArray *arr = _databaseArr[1];
+            [arr removeObject:delModel];
+        }
+        else if(delModel.curDownloadStateType == downloadStateFail){
+            NSMutableArray *arr = _databaseArr[2];
+            [arr removeObject:delModel];
+        }
+        else{
+            NSMutableArray *arr = _databaseArr[0];
+            [arr removeObject:delModel];
+        }
+    }
+}
+
+
+- (void)deleteDownloadFileRecordBy:(NSMutableArray *)delArr withDelCache:(BOOL)isDelCache
+{
+    //逻辑待优化
+    BOOL isSuc = false;
+    
+    BOOL isDelUploadingModel = false;
+    
+    NSMutableArray *curDelArr = [NSMutableArray arrayWithArray:delArr];
+    for (couldPhoneFileModel *couldPhoneFileMod in curDelArr) {
+        
+        NSMutableString* where = [[NSMutableString alloc] initWithString:@"where "];
+        
+        NSString *curStr =  [NSString stringWithFormat:@"%@=%@ ",bg_sqlKey(@"bg_id"),bg_sqlValue(couldPhoneFileMod.bg_id)];
+        [where appendString:curStr];
+        
+        [couldPhoneFileModel bg_deleteAsync:download_tableName where:where complete:^(BOOL isSuccess) {
+        }];
+       
+       //isSuc =  [couldPhoneFileModel bg_delete:download_tableName where:where];
+        
+        [self handleDatabaseArrByDelete:couldPhoneFileMod];
+        
+        if(couldPhoneFileMod.bg_id.integerValue == _curDownloadFileModel.bg_id.integerValue){
+            isDelUploadingModel = YES;
+            [self suspendDownloadFileFun:NO];
+        }
+
+    }
+    
+    if(isDelUploadingModel){
+        _isDownloadIngType = NO;
+        if(_downLoadFileModelDataArr > 0){
+            [self beginDownloadFileFun];
+        }
+    }
+    
+    [[NSNotificationCenter defaultCenter] postNotificationName:downloadFileRefreshNotification object:_curDownloadFileModel];
+    
+}
 @end

+ 4 - 1
创维盒子/双子星云手机/Class/Set/uploadFile/uploadFileRecordViewController.h

@@ -13,8 +13,11 @@ NS_ASSUME_NONNULL_BEGIN
 
 @interface uploadFileRecordViewController : BaseViewController
 //
-@property (nonatomic, assign) BOOL isNotUploadingType;//上传页面进入
+@property (nonatomic, assign) BOOL isUploadingType;//上传页面进入
 -(void)gotoUploadFile:(NSMutableArray*)indexPathsForSelectedItems;
+
+@property (nonatomic, assign) BOOL isDownloadingType;//下载页面进入
+-(void)gotoDownloadFile:(NSMutableArray*)selectedItems;
 @end
 
 NS_ASSUME_NONNULL_END

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

@@ -18,18 +18,18 @@
 #import "backupsFilerecordTableView.h"
 #import "backupsFileManager.h"
 #import "photosBackupsTaskModel.h"
-
+#import "downloadManager.h"
+#import "downloadFileRecordTableView.h"
 
 @interface uploadFileRecordViewController ()<UIScrollViewDelegate>
 
 //选中的项
 @property (nonatomic, strong) NSMutableArray *indexPathsForSelectedItems;
 @property (nonatomic, strong) uploadFileRecordheadView *uploadFileRecordheadV;
-//@property (nonatomic, strong) uploadFileRecordBodyView *uploadFileRecordBodyV;
 
 @property (nonatomic, strong) uploadFileRecordBgScorllView *uploadFileRecordBgScorllV;
 @property (nonatomic, strong) uploadFileRecordTableView *leftTableView;
-@property (nonatomic, strong) uploadFileRecordTableView *midTableView;
+@property (nonatomic, strong) downloadFileRecordTableView *midTableView;
 @property (nonatomic, strong) backupsFilerecordTableView *rightTableView;
 
 //@property (nonatomic,strong) uploadFileRecordTableViewHeadView *leftHeadView;
@@ -59,6 +59,8 @@
     
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(backupsFileRefreshFun:)  name:backupsFileRefreshNotification  object:nil];
     
+    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(downloadFileRefreshFun:)  name:downloadFileRefreshNotification  object:nil];
+    
     [self.view setBackgroundColor:[UIColor whiteColor]];
     
     self.titleLabel.text = NSLocalizedString(@"my_set_no_File_Transfer_List",nil) ;
@@ -68,19 +70,42 @@
     [self.navBarBGView setHidden:NO];
     self.navBarBGView.backgroundColor = [UIColor whiteColor];
     
-    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
-        [self initbaseUIFun];
-        [self getDataInDatabaseFun];
-        [self getBackupsDatabaseFun];
-    });
+    [self initbaseUIFun];
 }
 
 - (void)viewWillAppear:(BOOL)animated
 {
     [super viewWillAppear:animated];
     
+    [self getAllDataFun];
 }
 
+#pragma mark 获取数据
+- (void)getAllDataFun
+{
+    if(!_isUploadingType){
+        [self getUploadDataInDatabaseFun];
+    }
+    
+    if(!_isDownloadingType){
+        [self getDownloadDataInDatabaseFun:YES];
+    }
+    else{
+        KWeakSelf
+        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
+            [weakSelf delayChangeUIFun];
+        });
+    }
+    
+    [self getBackupsDatabaseFun];
+}
+
+- (void)delayChangeUIFun
+{
+    _selectIndex = 2;
+    [self didClickHeadFun:_selectIndex];
+    [self didScorllBodyFun:_selectIndex];
+}
 
 #pragma mark UI
 - (void)initbaseUIFun
@@ -101,9 +126,8 @@
         [weakSelf didClickHeadFun: index];
     };
     
-//    CGRect rrr2= self.navBarBGView.frame;
-//    CGRect rrr= _uploadFileRecordheadV.frame;
-    CGFloat curHeight = SCREEN_H - CGRectGetMaxY(self.navBarBGView.frame) - 50 - 15;
+    //CGFloat curHeight = SCREEN_H - CGRectGetMaxY(self.navBarBGView.frame) - 50 - 15;
+    CGFloat curHeight = SCREEN_H - (H_STATE_BAR + 64.f) - 50 - 15;
     
     
     _uploadFileRecordBgScorllV= [[uploadFileRecordBgScorllView alloc] init];
@@ -140,7 +164,7 @@
         [weakSelf RefreshUploadViewFun];
     };
     
-    _midTableView = [[uploadFileRecordTableView alloc] init];
+    _midTableView = [[downloadFileRecordTableView alloc] init];
     _midTableView.tag = 101;
     [_uploadFileRecordBgScorllV addSubview:_midTableView];
 
@@ -155,6 +179,11 @@
         weakSelf.isEditType = YES;
     };
     
+    _midTableView.didClickSectionHeadViewRightButton = ^(NSInteger section) {
+        [weakSelf didClikRightButInDownloadTableVieFunBy:section];
+    };
+
+    
     _rightTableView = [[backupsFilerecordTableView alloc] init];
     _rightTableView.tag = 102;
     [_uploadFileRecordBgScorllV addSubview:_rightTableView];
@@ -358,12 +387,6 @@
 {
     
     [self realGotoUploadFile:indexPathsForSelectedItems];
-//    KWeakSelf
-//    [[uploadFileManager shareInstance] getDataInDatabaseFun:YES complete:^(NSMutableArray * _Nonnull Arr) {
-//
-//        [weakSelf realGotoUploadFile:indexPathsForSelectedItems];
-//    }];
-    
 }
 
 - (void)realGotoUploadFile:(NSMutableArray *)indexPathsForSelectedItems
@@ -377,20 +400,15 @@
         weakSelf.leftTableView.outSideDataArr = Arr;
         [weakSelf.leftTableView reloadDataFun];
         
-        //weakSelf.midTableView.curDataArr = Arr[1];
-        [weakSelf.midTableView reloadDataFun];
-        
-//        weakSelf.rightTableView.curDataArr = Arr[2];
-//        [weakSelf.rightTableView reloadDataFun];
     }];
 }
 
 #pragma mark 读取数据库数据
-- (void)getDataInDatabaseFun
+- (void)getUploadDataInDatabaseFun
 {
     
     KWeakSelf
-    [[uploadFileManager shareInstance] getDataInDatabaseFun:_isNotUploadingType complete:^(NSMutableArray * _Nonnull Arr) {
+    [[uploadFileManager shareInstance] getDataInDatabaseFun:YES complete:^(NSMutableArray * _Nonnull Arr) {
         //[weakSelf setRecordBodyDataFunBy:Arr];
         
         if(!Arr ||Arr.count != 3){
@@ -400,7 +418,7 @@
         
         NSMutableArray *curLoadIngArr = Arr[0];
         //不是上传视频和进来的  所以上传状态(上传中和等待)改为暂停
-        if(self->_isNotUploadingType && ![uploadFileManager shareInstance].isUploadIngType){
+        if(![uploadFileManager shareInstance].isUploadIngType){
             for (uploadFileDataModel * curModel in curLoadIngArr) {
                 curModel.curUploadStateType = uploadStateSuspend;
             }
@@ -417,56 +435,6 @@
         });
     }];
     
-    
-    
-//    _allDataArr = [NSMutableArray new];
-//
-//    KWeakSelf
-//    [uploadFileDataModel bg_findAllAsync:upLoadFile_image_tableName complete:^(NSArray * _Nullable array) {
-//        NSMutableArray *failArr = [NSMutableArray new];
-//        NSMutableArray *doneArr = [NSMutableArray new];
-//        NSMutableArray *otherArr = [NSMutableArray new];
-//
-//            for (uploadFileDataModel * curModel in array) {
-//
-//                //图片 和视频 还原
-//                if(curModel.curUploadFileType == uploadFileTypeImage){
-//                    NSString*pathStr = [cachesFileManager getFilePathWithName:curModel.filename type:uploadFileTypeImage];
-//                    curModel.imageData = [NSData dataWithContentsOfFile:pathStr];
-//                }
-//                else if(curModel.curUploadFileType == uploadFileTypeVideo){
-//                    NSString*pathStr = [cachesFileManager getFilePathWithName:curModel.videoFirstImageName type:uploadFileTypeImage];
-//                    curModel.imageData = [NSData dataWithContentsOfFile:pathStr];
-//
-//                    if(curModel.curUploadStateType != uploadStateDone){
-//                        NSString*videoPathStr = [cachesFileManager getFilePathWithName:curModel.filename type:uploadFileTypeVideo];
-//                        curModel.videoData = [NSData dataWithContentsOfFile:videoPathStr];
-//                    }
-//                }
-//
-//                if(curModel.curUploadStateType == uploadStateFail){
-//                    [failArr addObject:curModel];
-//                }
-//                else if(curModel.curUploadStateType == uploadStateDone){
-//                    [doneArr addObject:curModel];
-//                }
-//                else{
-//                    //不是上传视频和进来的  所以上传状态(上传中和等待)改为暂停
-//                    if(self->_isNotUploadingType && ![uploadFileManager shareInstance].isUploadIngType){
-//                        curModel.curUploadStateType = uploadStateSuspend;
-//                    }
-//
-//                    [otherArr addObject:curModel];
-//                }
-//            }
-//
-//        [self->_allDataArr addObject:otherArr];
-//        [self->_allDataArr addObject:doneArr];
-//        [self->_allDataArr addObject:failArr];
-//
-//        self->_uploadFileRecordBodyV.allDataArr = self->_allDataArr;
-//    }];
-
 }
 
 - (void)getBackupsDatabaseFun
@@ -480,6 +448,36 @@
     }];
 }
 
+#pragma mark 读取数据库数据
+- (void)getDownloadDataInDatabaseFun:(BOOL)isRegetType
+{
+    KWeakSelf
+    [[downloadManager shareInstance] getDataInDatabaseFun:isRegetType complete:^(NSMutableArray * _Nonnull Arr) {
+      
+        if(!Arr ||Arr.count != 3){
+            HLog(@"数据库出错\n\n\n");
+            return;
+        }
+        
+        NSMutableArray *curLoadIngArr = Arr[0];
+        //不是上传视频和进来的  所以上传状态(上传中和等待)改为暂停
+        if(![downloadManager shareInstance].isDownloadIngType){
+            for (couldPhoneFileModel * curModel in curLoadIngArr) {
+                curModel.curDownloadStateType = downloadStateSuspend;
+            }
+        }
+        
+        mainBlock(^{
+            weakSelf.midTableView.outSideDataArr = Arr;
+            [weakSelf.midTableView reloadDataFun];
+            
+            //[weakSelf handleUploadingRightButFun];
+        });
+    }];
+    
+}
+
+
 #pragma mark 处理上传中的 全部暂停等
 - (void)handleUploadingRightButFun
 {
@@ -503,23 +501,6 @@
 }
 
 
-#pragma mark 给RecordBody 设置数据
-//- (void)setRecordBodyDataFunBy:(NSMutableArray*)arr
-//{
-//    if(!arr || ![arr isKindOfClass:[NSMutableArray class]] || arr.count !=3){
-//        return;
-//    }
-//    //不是上传视频和进来的  所以上传状态(上传中和等待)改为暂停
-//    if(self->_isNotUploadingType && ![uploadFileManager shareInstance].isUploadIngType){
-//        NSMutableArray *otherArr = arr[0];
-//        for (uploadFileDataModel * curModel in otherArr) {
-//            curModel.curUploadStateType = uploadStateSuspend;
-//        }
-//
-//    }
-//
-//    //_uploadFileRecordBodyV.allDataArr = arr;
-//}
 
 - (void)uploadFileRefreshFun:(NSNotification*)not
 {
@@ -817,4 +798,127 @@
     photosBackupsTaskMod.curTimeInterval = [[NSDate date] timeIntervalSince1970];
     _rightTableView.photosBackupsIngTaskModel = photosBackupsTaskMod;
 }
+
+-(void)gotoDownloadFile:(NSMutableArray*)selectedItems
+{
+    KWeakSelf
+    [[downloadManager shareInstance] handleCouldPhoneFileModelToDownloadFileDataFunBy:selectedItems complete:^(NSMutableArray * _Nonnull Arr) {
+        
+        if(!Arr ||Arr.count != 3){
+            HLog(@"数据库出错\n\n\n");
+            return;
+        }
+        
+        NSMutableArray *curLoadIngArr = Arr[0];
+        
+        mainBlock(^{
+            weakSelf.midTableView.outSideDataArr = Arr;
+            [weakSelf.midTableView reloadDataFun];
+            //[weakSelf handleUploadingRightButFun];
+        });
+    }];
+}
+
+- (void)downloadFileRefreshFun:(NSNotification*)not
+{
+    couldPhoneFileModel *downloadTaskMod = [not object];
+    HLog(@"hhhhhhh1 %@ didDownloadBytes:%ld",downloadTaskMod.name,downloadTaskMod.didDownloadBytes);
+    
+    downloadTaskMod.curTimeInterval = [[NSDate date] timeIntervalSince1970];
+    
+    if(downloadTaskMod.curDownloadStateType == downloadStateDone){
+        [self getDownloadDataInDatabaseFun:NO];
+    }
+    else{
+        [_midTableView RefreshAllDataFun];
+    }
+}
+
+#pragma mark 1.3版本UI修改后 下载文件列表的头部点击事件
+- (void)didClikRightButInDownloadTableVieFunBy:(NSInteger)section
+{
+    if(section == 0){
+        [self didClickAllSuspendInDownLoadingFun];
+    }
+    else if(section == 1){//成功
+        [self didClickClearDownLoadRecordInDoneFun];
+    }
+    else if(section == 2){//失败
+        [self didClickClearRecordInDownLoadFailFun];
+    }
+}
+
+#pragma mark 点击下载中的全部暂停
+- (void)didClickAllSuspendInDownLoadingFun
+{
+    _midTableView.downloadingHeadView.rightButton.selected = !_midTableView.downloadingHeadView.rightButton.selected;
+    
+    if(_midTableView.downloadingHeadView.rightButton.selected){
+        [[downloadManager shareInstance] suspendDownloadFileFun:YES];
+    }
+    else{
+        NSMutableArray *leftArr = _midTableView.downloadingArr;
+        [[downloadManager shareInstance] reDownloadFileFunBy:leftArr];
+    }
+}
+
+
+#pragma mark 点击下载成功的清空记录
+- (void)didClickClearDownLoadRecordInDoneFun
+{
+    /*弹窗提示二次确认*/
+    KWeakSelf
+    ComontAlretViewController *nextVC = [[ComontAlretViewController alloc] initWithTiTle:NSLocalizedString(@"File_upload_Record_clear_Tip_title",nil)
+                                                                                     msg:NSLocalizedString(@"File_upload_Record_clear_done_Tip_msg",nil)
+                                                                                imageStr:nil
+                                                                             cancelTitle:NSLocalizedString(@"other_cancel",nil)
+                                                                                 okTitle:NSLocalizedString(@"other_comment_ok",nil) isOkBtnHighlight:YES
+                                                                              didClickOk:^{
+        [weakSelf ClearAllRecordInDownloadDoneFun];
+    } didClickCancel:^{
+        
+    }];
+    nextVC.modalPresentationStyle = UIModalPresentationCustom;
+  
+    [self presentViewController:nextVC animated:YES completion:^{
+        nextVC.view.superview.backgroundColor = [UIColor clearColor];
+    }];
+
+}
+
+- (void)ClearAllRecordInDownloadDoneFun
+{
+    [[downloadManager shareInstance] deleteDownloadFileRecordBy:_midTableView.downloadDoneArr withDelCache:YES];
+}
+
+
+#pragma mark 点击上传失败的清空记录
+- (void)didClickClearRecordInDownLoadFailFun
+{
+    /*弹窗提示二次确认*/
+    KWeakSelf
+    ComontAlretViewController *nextVC = [[ComontAlretViewController alloc] initWithTiTle:NSLocalizedString(@"File_upload_Record_clear_Tip_title",nil)
+                                                                                     msg:NSLocalizedString(@"File_upload_Record_clear_fail_Tip_msg",nil)
+                                                                                imageStr:nil
+                                                                             cancelTitle:NSLocalizedString(@"other_cancel",nil)
+                                                                                 okTitle:NSLocalizedString(@"other_comment_ok",nil) isOkBtnHighlight:YES
+                                                                              didClickOk:^{
+        [weakSelf ClearAllRecordInDownloadFailFun];
+    } didClickCancel:^{
+        
+    }];
+    nextVC.modalPresentationStyle = UIModalPresentationCustom;
+  
+    [self presentViewController:nextVC animated:YES completion:^{
+        nextVC.view.superview.backgroundColor = [UIColor clearColor];
+    }];
+
+}
+
+- (void)ClearAllRecordInDownloadFailFun
+{
+    [[downloadManager shareInstance] deleteDownloadFileRecordBy:_midTableView.downloadfailArr withDelCache:YES];
+}
+
+
 @end

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

@@ -0,0 +1,25 @@
+//
+//  downloadFileRecordCell.h
+//  隐私保护
+//
+//  Created by xd h on 2024/1/10.
+//
+
+#import <UIKit/UIKit.h>
+//#import "couldPhoneFileModel.h"
+#import "couldPhoneFileListModel.h"
+NS_ASSUME_NONNULL_BEGIN
+
+@interface downloadFileRecordCell : UITableViewCell
+@property(nonatomic,strong) couldPhoneFileModel * curCouldPhoneFileModel;
+@property (nonatomic,assign) BOOL isEditType;
+@property (nonatomic,assign) BOOL isSelectType;
+
+@property (nonatomic,copy) void (^didLongPressClick)(void);
+//点击按钮
+@property (nonatomic,copy) void (^didClckSelectBut)(BOOL isSelect);
+//手势点击
+@property (nonatomic,copy) void (^didTapPressClick)(void);
+@end
+
+NS_ASSUME_NONNULL_END

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

@@ -0,0 +1,398 @@
+//
+//  downloadFileRecordCell.m
+//  隐私保护
+//
+//  Created by xd h on 2024/1/10.
+//
+
+#import "downloadFileRecordCell.h"
+
+#import "cachesFileManager.h"
+#import <SDWebImage/SDWebImage.h>
+
+@interface downloadFileRecordCell ()
+@property(nonatomic,strong) UIImageView *fileImageView;
+@property(nonatomic,strong) UIButton *upLoadStateButton;
+
+@property (nonatomic, strong) UIButton *selectButton;
+
+@property(nonatomic,strong) UIView *progressBgView;
+@property(nonatomic,strong) UIView *progressSelectView;
+@property(nonatomic,strong) CAGradientLayer *glayer;
+
+@property(nonatomic,strong) UILabel *fileNamelabel;
+@property(nonatomic,strong) UILabel *fileProgresslabel;
+@property(nonatomic,strong) UILabel *fileSpeedlabel;
+@end
+
+@implementation downloadFileRecordCell
+
+- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
+{
+    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
+    
+    if (self)
+    {
+        [self drawView];
+    }
+    
+    return self;
+}
+
+- (void)drawView
+{
+    _fileImageView = [[UIImageView alloc] init];
+    //_fileImageView.backgroundColor = [UIColor greenColor];
+    [self.contentView addSubview:_fileImageView];
+    
+    [_fileImageView mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.left.mas_equalTo(15);
+        make.width.mas_equalTo(34);
+        make.height.mas_equalTo(34);
+        make.bottom.mas_equalTo(-18);
+    }];
+    
+    _upLoadStateButton = [[UIButton alloc] init];
+    //_upLoadStateButton.backgroundColor = [UIColor redColor];
+    [self.contentView addSubview:_upLoadStateButton];
+    [_upLoadStateButton addTarget:self action:@selector(tapClick:) forControlEvents:UIControlEventTouchUpInside];
+    
+    [_upLoadStateButton mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.right.mas_equalTo(-5);
+        make.width.mas_equalTo(50);
+        make.height.mas_equalTo(50);
+        make.bottom.mas_equalTo(-18);
+    }];
+    
+    if (self.selectButton == nil) {
+        UIButton *but = [[UIButton alloc] init];
+        [but setImage:[UIImage imageNamed:@"upload_file_uncheck"] forState:UIControlStateNormal];
+        [but setImage:[UIImage imageNamed:@"upload_file_check"] forState:UIControlStateSelected];
+        [self.contentView addSubview:but];
+        [but addTarget:self action:@selector(didClickSelectButFun:) forControlEvents:UIControlEventTouchUpInside];
+        but.hidden = YES;
+        //but.backgroundColor = [UIColor greenColor];
+        //but.frame = CGRectMake([UIScreen mainScreen].bounds.size.width -10 - 25, 0, 25, 25);
+        [but mas_makeConstraints:^(MASConstraintMaker *make) {
+            make.width.mas_equalTo(30);
+            make.height.mas_equalTo(30);
+            make.centerX.mas_equalTo(_upLoadStateButton.mas_centerX);
+            make.centerY.mas_equalTo(_upLoadStateButton.mas_centerY);
+        }];
+        
+        self.selectButton = but;
+    }
+    
+    _progressBgView = [[UIView alloc] init];
+    _progressBgView.backgroundColor = [UIColor hwColor:@"#F9F9F9" alpha:1.0];
+    _progressBgView.layer.cornerRadius = 1.5;
+    _progressBgView.layer.masksToBounds = YES;
+    [self.contentView addSubview:_progressBgView];
+    
+    [_progressBgView mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.left.mas_equalTo(_fileImageView.mas_right).offset(10);
+        make.right.mas_equalTo(_upLoadStateButton.mas_left).offset(-10);
+        make.height.mas_equalTo(2);
+        make.centerY.mas_equalTo(0);
+    }];
+    
+    _progressSelectView = [[UIView alloc] init];
+    //_progressSelectView.backgroundColor = [UIColor hwColor:@"#F9F9F9" alpha:1.0];
+    _progressSelectView.layer.cornerRadius = 1.5;
+    _progressSelectView.layer.masksToBounds = YES;
+    [_progressBgView addSubview:_progressSelectView];
+    
+//    [_progressSelectView mas_makeConstraints:^(MASConstraintMaker *make) {
+//        make.left.mas_equalTo(0);
+//        make.right.mas_equalTo(-100);
+//        make.height.mas_equalTo(3);
+//        make.centerY.mas_equalTo(0);
+//    }];
+    
+    // gradient
+    _glayer = [CAGradientLayer layer];
+    _glayer.startPoint = CGPointMake(0, 0.5);
+    _glayer.endPoint = CGPointMake(1, 0.5);
+    _glayer.colors = @[(__bridge id)[UIColor hwColor:@"#0BDDFD" alpha:1.0].CGColor, (__bridge id)[UIColor hwColor:@"#048CFB" alpha:1.0].CGColor];
+    _glayer.locations = @[@(0), @(1.0f)];
+    [_progressSelectView.layer addSublayer:_glayer];
+    
+    CGRect frame = CGRectMake(0, 0, SCREEN_W, 2);
+    //_progressSelectView.frame = frame;
+    _glayer.frame = frame;
+    
+    _fileNamelabel = [[UILabel alloc] init];
+    _fileNamelabel.font = [UIFont boldSystemFontOfSize:16.0];
+    //_fileNamelabel.backgroundColor = [UIColor greenColor];
+    [self.contentView addSubview:_fileNamelabel];
+    
+    [_fileNamelabel mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.left.mas_equalTo(_fileImageView.mas_right).offset(10);
+        make.right.mas_equalTo(_upLoadStateButton.mas_left).offset(-10);
+        make.height.mas_equalTo(19);
+        make.bottom.mas_equalTo(_progressBgView.mas_top).offset(-3);
+    }];
+    
+    _fileProgresslabel = [[UILabel alloc] init];
+    _fileProgresslabel.font = [UIFont systemFontOfSize:12.0];
+    _fileProgresslabel.textColor = [UIColor hwColor:@"#959799" alpha:1.0];
+    //_fileProgresslabel.backgroundColor = [UIColor greenColor];
+    [self.contentView addSubview:_fileProgresslabel];
+    
+    [_fileProgresslabel mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.left.mas_equalTo(_fileImageView.mas_right).offset(10);
+        make.right.mas_equalTo(_progressBgView.mas_centerX).offset(100);
+        make.height.mas_equalTo(15);
+        make.top.mas_equalTo(_progressBgView.mas_bottom).offset(3);
+    }];
+    
+    _fileSpeedlabel = [[UILabel alloc] init];
+    _fileSpeedlabel.font = [UIFont systemFontOfSize:12.0];
+    _fileSpeedlabel.textColor = [UIColor hwColor:@"#959799" alpha:1.0];
+    _fileSpeedlabel.textAlignment = NSTextAlignmentRight;
+    //_fileSpeedlabel.backgroundColor = [UIColor blackColor];
+    [self.contentView addSubview:_fileSpeedlabel];
+    
+    [_fileSpeedlabel mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.right.mas_equalTo(_upLoadStateButton.mas_left).offset(-10);
+        make.left.mas_equalTo(_progressBgView.mas_centerX);
+        make.height.mas_equalTo(15);
+        make.top.mas_equalTo(_progressBgView.mas_bottom).offset(3);
+    }];
+    
+    //长按手势
+    UILongPressGestureRecognizer *longPressGesture = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longPressClick:)];
+    //用几个手指触屏,默认1
+    longPressGesture.numberOfTouchesRequired = 1;
+    //设置最短长按时间,单位为秒(默认0.5)
+    longPressGesture.minimumPressDuration = 1;
+    //设置手势识别期间所允许的手势可移动范围
+    longPressGesture.allowableMovement = 10;
+    [self.contentView addGestureRecognizer:longPressGesture];
+
+}
+
+- (void)setIsEditType:(BOOL)isEditType
+{
+    _isEditType = isEditType;
+    
+    if(isEditType){
+        self.selectButton.hidden = NO;
+        
+//        if(_curUploadFileDataModel.curUploadStateType == uploadStateWait
+//           ||_curUploadFileDataModel.curUploadStateType == uploadStateUploading
+//           ||_curUploadFileDataModel.curUploadStateType == uploadStateSuspend){
+            _upLoadStateButton.hidden = YES;
+        //}
+    }
+    else{
+        self.selectButton.hidden = YES;
+        
+        if(_curCouldPhoneFileModel.curDownloadStateType == downloadStateWait
+           ||_curCouldPhoneFileModel.curDownloadStateType == downloadStateUploading
+           ||_curCouldPhoneFileModel.curDownloadStateType == downloadStateSuspend){
+            _upLoadStateButton.hidden = NO;
+        }
+    }
+}
+
+- (void)setIsSelectType:(BOOL)isSelectType
+{
+    _isSelectType = isSelectType;
+    
+    if(isSelectType){
+        self.selectButton.selected = YES;
+    }
+    else{
+        self.selectButton.selected = NO;
+    }
+}
+
+- (void)setCurCouldPhoneFileModel:(couldPhoneFileModel *)curCouldPhoneFileModel
+{
+  
+    _fileSpeedlabel.hidden = YES;
+    _progressBgView.hidden = NO;
+    _upLoadStateButton.hidden = NO;
+    
+    _curCouldPhoneFileModel = curCouldPhoneFileModel;
+    
+    if(_curCouldPhoneFileModel.curDownloadStateType != downloadStateDone){
+        //HLog(@"hhhhhhh2  %@ %ld ",_curCouldPhoneFileModel.name,_curCouldPhoneFileModel.didDownloadBytes);
+    }
+    
+//    NSString*pathStr = [cachesFileManager getFilePathWithName:curUploadFileDataModel.filename type:curUploadFileDataModel.curUploadFileType];
+//    UIImage *image = [UIImage imageWithContentsOfFile:pathStr];
+//
+//    if(image){
+//        _fileImageView.image = image;
+//    }
+//    else
+    {
+        _fileImageView.image = [UIImage imageNamed:@"uploadFile_image"];
+    }
+    
+    _fileNamelabel.text = curCouldPhoneFileModel.name;
+    
+    //进度设置
+    CGRect frame = CGRectMake(0, 0, SCREEN_W - 15*2 - 34*2, 2);
+    
+    NSInteger totalSize = curCouldPhoneFileModel.length;
+    if(totalSize == 0.0){
+        totalSize += 0.0001;
+    }
+    
+    CGFloat curProgress = curCouldPhoneFileModel.didDownloadBytes/(totalSize*1.0);
+    
+    if(curProgress > 1){
+        curProgress = 1;
+    }
+    
+    frame.size.width =  frame.size.width * curProgress;
+    
+    if (isnan(frame.size.width))
+    {
+        HLog(@"计算出错了");
+        frame.size.width = 10.0;
+    }
+    
+//    HLog(@"%f, %f, %f, %f,",frame.origin.x,frame.origin.y,frame.size.width,frame.size.height);
+//    HLog(@"%@",_progressSelectView);
+    
+    _progressSelectView.frame = frame;
+    //_glayer.frame = frame;
+    
+    NSString * totalSizeStr = nil;
+    NSInteger totalSize_k = totalSize / 1024;
+    if(totalSize_k < 1024){
+        totalSizeStr = [[NSString alloc] initWithFormat:@"%ldKB",totalSize_k];
+    }
+    else if( totalSize_k >= 1024 && totalSize_k < 1024*1024){
+        totalSizeStr = [[NSString alloc] initWithFormat:@"%.1fMB",totalSize_k/1024.0];
+        
+    }
+    else{
+        totalSizeStr = [[NSString alloc] initWithFormat:@"%.2fG",totalSize_k/1024.0/1024.0];
+    }
+    
+    NSString * didUploadStr = nil;
+    NSInteger didUploadSize_k = curCouldPhoneFileModel.didDownloadBytes / 1024;
+    if(didUploadSize_k < 1024){
+        didUploadStr = [[NSString alloc] initWithFormat:@"%ldKB",didUploadSize_k];
+    }
+    else if( didUploadSize_k >= 1024 && didUploadSize_k < 1024*1024){
+        didUploadStr = [[NSString alloc] initWithFormat:@"%.1fMB",didUploadSize_k/1024.0];
+        
+    }
+    else{
+        didUploadStr = [[NSString alloc] initWithFormat:@"%.2fG",didUploadSize_k/1024.0/1024.0];
+    }
+    
+    if(curCouldPhoneFileModel.curDownloadStateType == downloadStateWait){
+        [_upLoadStateButton setImage:[UIImage imageNamed:@"uploadFile_wait"] forState:UIControlStateNormal];
+    }
+    else if(curCouldPhoneFileModel.curDownloadStateType == downloadStateUploading){
+        [_upLoadStateButton setImage:[UIImage imageNamed:@"uploadFile_suspend"] forState:UIControlStateNormal];
+        _fileSpeedlabel.hidden = NO;
+        
+        //
+        _fileSpeedlabel.text = @"";
+        
+        if(curCouldPhoneFileModel.preTimeInterval <= 0){
+            _fileSpeedlabel.text = @"--";
+        }
+        else{
+            NSTimeInterval  timers = curCouldPhoneFileModel.curTimeInterval - curCouldPhoneFileModel.preTimeInterval;
+            
+            if(timers > 0){
+                long speed= 1*1024*1024 / timers;
+                NSString * speedStr = nil;
+                NSInteger speed_k = speed / (1024);
+                if(speed_k < 1024){
+                    speedStr = [[NSString alloc] initWithFormat:@"%ldKB/s",speed_k];
+                }
+                else {
+                    speedStr = [[NSString alloc] initWithFormat:@"%.1fMB/s",speed_k/1024.0];
+                }
+                
+                _fileSpeedlabel.text = speedStr;
+            }
+        }
+        
+        curCouldPhoneFileModel.preTimeInterval = curCouldPhoneFileModel.curTimeInterval;
+    }
+    else if(curCouldPhoneFileModel.curDownloadStateType == downloadStateSuspend){
+        [_upLoadStateButton setImage:[UIImage imageNamed:@"uploadFile_start"] forState:UIControlStateNormal];
+    }
+    else if(curCouldPhoneFileModel.curDownloadStateType == downloadStateFail){
+        [_upLoadStateButton setImage:[UIImage imageNamed:@"uploadFile_reStart"] forState:UIControlStateNormal];
+        _progressBgView.hidden = YES;
+    }
+    else{
+        _upLoadStateButton.hidden = YES;
+        _progressBgView.hidden = YES;
+    }
+    
+    
+    if(curCouldPhoneFileModel.curDownloadStateType == downloadStateDone){
+        NSString*tipStr = NSLocalizedString(@"File_download_Path_default_done",nil);
+        _fileProgresslabel.text = [[NSString alloc] initWithFormat:@"%@  %@",totalSizeStr,tipStr];
+    }
+    else if(curCouldPhoneFileModel.curDownloadStateType == downloadStateFail){
+        _fileProgresslabel.text = [[NSString alloc] initWithFormat:@"%@",totalSizeStr];
+    }
+    else{
+        _fileProgresslabel.text = [[NSString alloc] initWithFormat:@"%@/%@",didUploadStr,totalSizeStr];
+    }
+    
+}
+
+
+-(void)longPressClick:(UILongPressGestureRecognizer *)press{
+    //state属性是所有手势父类提供的方法,用于记录手势的状态
+    if(press.state == UIGestureRecognizerStateBegan){
+        //NSLog(@"长按手势开始响应!");
+        
+        if(_didLongPressClick){
+            _didLongPressClick();
+        }
+        
+    }else if (press.state == UIGestureRecognizerStateChanged){
+        //NSLog(@"长按手势状态发生改变!");
+    }else{
+        //NSLog(@"长按手势结束!");
+    }
+
+}
+
+- (void)didClickSelectButFun:(UIButton*)but
+{
+    but.selected = !but.selected;
+    if(_didClckSelectBut){
+        _didClckSelectBut(but.selected);
+    }
+}
+
+- (void)tapClick:(UIButton*)but{
+    if(_didTapPressClick){
+        _didTapPressClick();
+    }
+    
+    if(_curCouldPhoneFileModel.curDownloadStateType == downloadStateUploading){
+        [_upLoadStateButton setImage:[UIImage imageNamed:@"uploadFile_start"] forState:UIControlStateNormal];
+        
+    }
+    else if(_curCouldPhoneFileModel.curDownloadStateType == downloadStateSuspend){
+       
+        [_upLoadStateButton setImage:[UIImage imageNamed:@"uploadFile_suspend"] forState:UIControlStateNormal];
+    }
+    
+    
+    but.userInteractionEnabled = NO;
+    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
+        but.userInteractionEnabled = YES;
+    });
+}
+
+@end
+

+ 41 - 0
创维盒子/双子星云手机/Class/Set/uploadFile/uploadFileView/downloadFileRecordTableView.h

@@ -0,0 +1,41 @@
+//
+//  downloadFileRecordTableView.h
+//  隐私保护
+//
+//  Created by xd h on 2024/1/10.
+//
+
+#import <UIKit/UIKit.h>
+#import "uploadFileRecordTableViewHeadView.h"
+#import "downloadManager.h"
+//#import "couldPhoneFileModel.h"
+#import "couldPhoneFileListModel.h"
+NS_ASSUME_NONNULL_BEGIN
+
+@interface downloadFileRecordTableView : UITableView
+@property (nonatomic, strong) NSMutableArray *outSideDataArr;
+@property (nonatomic, strong)NSMutableArray *downloadingArr;
+@property (nonatomic, strong)NSMutableArray *downloadfailArr;
+@property (nonatomic, strong)NSMutableArray *downloadDoneArr;
+
+@property (nonatomic,strong) uploadFileRecordTableViewHeadView *downloadingHeadView;
+@property (nonatomic,strong) uploadFileRecordTableViewHeadView *failHeadView;
+@property (nonatomic,strong) uploadFileRecordTableViewHeadView *doneHeadView;
+
+@property (nonatomic,assign) BOOL isEditType;
+@property (nonatomic,assign) BOOL isSelectAllType;
+@property (nonatomic,strong) NSMutableArray *selectModelArr;
+
+@property (nonatomic,copy) void (^didLongPressClick)(void);
+@property (nonatomic,copy) void (^didClickReUploadBlock)(couldPhoneFileModel* model);
+
+@property (nonatomic,copy) void (^didClickSectionHeadViewRightButton)(NSInteger section);
+@property (nonatomic,copy) void (^didNeedRefreshGetDatabaseFun)(void);
+
+-(void)reloadDataFun;
+- (void)RefreshAllDataFun;
+#pragma mark 单个点击选中后删除
+- (void)deleteModelOneByOneFun;
+@end
+
+NS_ASSUME_NONNULL_END

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

@@ -0,0 +1,496 @@
+//
+//  downloadFileRecordTableView.m
+//  隐私保护
+//
+//  Created by xd h on 2024/1/10.
+//
+
+#import "downloadFileRecordTableView.h"
+#import "downloadFileRecordCell.h"
+#import "UIScrollView+EmptyDataSet.h"
+#import "uploadFileRecordTableViewHeadView.h"
+
+@interface downloadFileRecordTableView()<UITableViewDataSource,UITableViewDelegate,DZNEmptyDataSetSource, DZNEmptyDataSetDelegate>
+{
+   
+}
+
+
+@property (nonatomic, strong) NSMutableArray *curDataArr;
+@end
+
+@implementation downloadFileRecordTableView
+
+- (id)initWithFrame:(CGRect)frame {
+    self = [super initWithFrame:frame];
+    if (self) {
+        [self initCommon];
+        [self initTableHeaderInSectionFun];
+        _selectModelArr = [NSMutableArray new];
+        _curDataArr = [NSMutableArray new];
+    }
+    return self;
+}
+
+- (void)initCommon {
+    self.delegate = self;
+    self.dataSource = self;
+    self.showsVerticalScrollIndicator = NO;
+    self.showsHorizontalScrollIndicator = NO;
+    [self setSeparatorStyle:(UITableViewCellSeparatorStyleNone)];
+    [self setSeparatorColor:[UIColor clearColor]];
+    [self setBackgroundColor:[UIColor clearColor]];
+    [self setTableFooterView:[UIView new]];
+    [self setBounces:YES];
+    if (@available(iOS 15.0, *)) {
+        self.sectionHeaderTopPadding = 0;
+    }
+    
+    //空数据引入第三方开源处理
+    self.emptyDataSetSource = self;
+    self.emptyDataSetDelegate = self;
+}
+
+- (void)setOutSideDataArr:(NSMutableArray *)outSideDataArr{
+    
+    if(!outSideDataArr || outSideDataArr.count != 3){
+        return;
+    }
+    
+    _outSideDataArr = outSideDataArr;
+    
+    _downloadingArr = outSideDataArr[0];
+    _downloadDoneArr = outSideDataArr[1];
+    _downloadfailArr = outSideDataArr[2];
+    
+    [self RefreshAllDataFun];
+}
+
+- (void)RefreshAllDataFun
+{
+    NSMutableArray *totalArr = [NSMutableArray new];
+    
+    if(_downloadingArr.count>0){
+        [totalArr addObject:_downloadingArr];
+    }
+    
+    if(_downloadfailArr.count>0){
+        [totalArr addObject:_downloadfailArr];
+    }
+    
+    if(_downloadDoneArr.count>0){
+        [totalArr addObject:_downloadDoneArr];
+    }
+    
+    _curDataArr = totalArr;
+    
+    [self reloadDataFun];
+}
+
+#pragma mark - 列表委托
+- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
+    return _curDataArr.count;
+}
+
+- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
+    
+    if(section < _curDataArr.count){
+        NSArray *curArr = _curDataArr[section];
+        return curArr.count;
+    }
+    
+    return 0;
+    
+}
+
+- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
+    
+    NSInteger row = indexPath.row;
+    NSInteger section = indexPath.section;
+    static NSString *identifier = @"downloadFileRecordCell";
+    
+    downloadFileRecordCell * cell =  [tableView dequeueReusableCellWithIdentifier:identifier];
+    cell.selectionStyle = UITableViewCellSelectionStyleNone;
+    if (!cell){
+        cell = [[downloadFileRecordCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:identifier];
+        [cell setSelectionStyle:UITableViewCellSelectionStyleNone];
+        [cell setBackgroundColor:[UIColor clearColor]];
+        [cell setAccessoryType:(UITableViewCellAccessoryNone)];
+    }
+    
+    if(section < _curDataArr.count){
+        NSMutableArray *curArr = _curDataArr[section];
+        
+        if(row < curArr.count){
+            couldPhoneFileModel *model = curArr[row];
+            cell.curCouldPhoneFileModel = model;
+            cell.isEditType = _isEditType;
+
+            if(_isEditType){
+                if([_selectModelArr containsObject:model]){
+                    cell.isSelectType = YES;
+                }
+                else{
+                    cell.isSelectType = NO;
+                }
+            }
+            
+            KWeakSelf
+            cell.didLongPressClick = ^{
+                [weakSelf didLongPressClickFun];
+            };
+
+            cell.didClckSelectBut = ^(BOOL isSelect) {
+                //[weakSelf selectModelOneByOne:model BySelect:isSelect];
+            };
+
+            cell.didTapPressClick = ^{
+                if(model.curDownloadStateType == downloadStateUploading){
+                    [weakSelf handleDownloadingStateTapFunBy:YES with:model];
+                }
+                else if(model.curDownloadStateType == downloadStateSuspend){
+                    [weakSelf handleDownloadingStateTapFunBy:NO with:model];
+                }
+                else if(model.curDownloadStateType == downloadStateFail){
+                    [weakSelf handleUploadFailStateWith:model];
+                }
+            };
+        }
+    }
+    
+    return cell;
+}
+
+- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
+    return 70;
+}
+
+- (UIView*)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
+{
+    NSInteger curType = 0;// 0 上传中  1 失败 2 完成
+    if(section == 2){
+        curType = 2;
+    }
+    else if(section == 1){
+        if(_downloadingArr.count == 0){
+            curType = 2;
+        }
+        else if(_downloadfailArr.count == 0){
+            curType = 2;
+        }
+        else{
+            curType = 1;
+        }
+    }
+    else{
+        if(_downloadingArr.count > 0){
+            curType = 0;
+        }
+        else if(_downloadfailArr.count > 0){
+            curType = 1;
+        }
+        else{
+            curType = 2;
+        }
+    }
+    
+    
+    [self RefresHeadUIFun];
+    
+    if(curType == 2){
+        return _doneHeadView;
+    }
+    else if(curType == 1){
+        return _failHeadView;
+    }
+    else{
+        return _downloadingHeadView;
+    }
+    
+}
+
+- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
+{
+    return 40;
+}
+- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
+    [tableView deselectRowAtIndexPath:indexPath animated:YES];
+    
+}
+
+#pragma mark 空数据
+- (UIImage *)imageForEmptyDataSet:(UIScrollView *)scrollView {
+    
+    NSString *imageName = @"uploadFile_noData";
+    
+    if(self.tag == 101){
+        imageName = @"uploadFile_noData";
+    }
+    else if(self.tag == 102){
+        imageName = @"uploadFile_noData";
+    }
+    
+    return [UIImage imageNamed:imageName];
+}
+
+- (NSAttributedString *)titleForEmptyDataSet:(UIScrollView *)scrollView {
+    NSString *text = NSLocalizedString(@"File_upload_Record_no_data",nil);
+    
+    if(self.tag == 101){
+        text = NSLocalizedString(@"File_download_Record_no_data",nil);
+    }
+    else if(self.tag == 102){
+        text = NSLocalizedString(@"File_backups_Record_no_data",nil);
+    }
+    
+    NSDictionary *attributes = @{NSFontAttributeName: [UIFont systemFontOfSize:16.0f],
+                                 NSForegroundColorAttributeName: HW999999Color};
+    
+    return [[NSAttributedString alloc] initWithString:text attributes:attributes];
+}
+
+//调整图片位置
+- (CGFloat)verticalOffsetForEmptyDataSet:(UIScrollView *)scrollView {
+    return -150;
+}
+
+-(void)reloadDataFun{
+    mainBlock(^{
+        [self RefresHeadUIFun];
+        [self reloadData];
+    });
+}
+
+#pragma mark 初始化段头
+- (void)initTableHeaderInSectionFun
+{
+    KWeakSelf
+    if(!_downloadingHeadView){
+        _downloadingHeadView = [[uploadFileRecordTableViewHeadView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_W, 40)];
+        //headView.backgroundColor = [UIColor greenColor];
+        
+        NSString *leftStr =  NSLocalizedString(@"File_upload_Record_uploading",nil);
+        NSString *rightStr =  NSLocalizedString(@"File_upload_Record_all_suspend",nil);
+        NSString *rightSelectStr =  NSLocalizedString(@"File_upload_Record_all_open",nil);
+        NSString *titleStr = [[NSString alloc] initWithFormat:@"%@ (%ld)",leftStr,_downloadingArr.count];
+
+        _downloadingHeadView.titleLabel.text = titleStr;
+        [_downloadingHeadView.rightButton setTitle:rightStr forState:UIControlStateNormal];
+        [_downloadingHeadView.rightButton setTitle:rightSelectStr forState:UIControlStateSelected];
+        
+        _downloadingHeadView.didClickButFun = ^{
+            [weakSelf didClickRightButtonFun:0];
+        };
+    }
+    
+
+    if(!_failHeadView){
+        _failHeadView = [[uploadFileRecordTableViewHeadView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_W, 40)];
+        //headView.backgroundColor = [UIColor greenColor];
+        
+        NSString *leftStr =  NSLocalizedString(@"File_upload_Record_did_upload",nil);
+        NSString *rightStr =  NSLocalizedString(@"File_upload_Record_clear_Record",nil);
+        NSString *titleStr = [[NSString alloc] initWithFormat:@"%@ (%ld)",leftStr,_downloadfailArr.count];
+
+         _failHeadView.titleLabel.text = titleStr;
+        [_failHeadView.rightButton setTitle:rightStr forState:UIControlStateNormal];
+         
+        _failHeadView.didClickButFun = ^{
+            [weakSelf didClickRightButtonFun:2];
+        };
+    }
+    
+    if(!_doneHeadView){
+        _doneHeadView = [[uploadFileRecordTableViewHeadView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_W, 40)];
+        //headView.backgroundColor = [UIColor greenColor];
+        
+        NSString *leftStr =  NSLocalizedString(@"File_upload_Record_did_upload",nil);
+        NSString *rightStr =  NSLocalizedString(@"File_upload_Record_clear_Record",nil);
+        NSString *titleStr = [[NSString alloc] initWithFormat:@"%@ (%ld)",leftStr,_downloadDoneArr.count];
+
+        _doneHeadView.titleLabel.text = titleStr;
+        [_doneHeadView.rightButton setTitle:rightStr forState:UIControlStateNormal];
+        
+        _doneHeadView.didClickButFun = ^{
+            [weakSelf didClickRightButtonFun:1];
+        };
+    }
+     
+    
+}
+
+#pragma mark 点击头部右边按钮
+- (void)didClickRightButtonFun:(NSInteger)section
+{
+    if(_didClickSectionHeadViewRightButton){
+        _didClickSectionHeadViewRightButton(section);
+    }
+}
+
+#pragma mark 刷新头部数据
+-(void)RefresHeadUIFun
+{
+
+    if(_downloadingHeadView){
+        NSString *leftStr =  NSLocalizedString(@"File_upload_Record_uploading",nil);
+        NSString *rightStr =  NSLocalizedString(@"File_upload_Record_all_suspend",nil);
+        NSString *rightSelectStr =  NSLocalizedString(@"File_upload_Record_all_open",nil);
+        NSString *titleStr = [[NSString alloc] initWithFormat:@"%@ (%ld)",leftStr,_downloadingArr.count];
+
+        _downloadingHeadView.titleLabel.text = titleStr;
+        [_downloadingHeadView.rightButton setTitle:rightStr forState:UIControlStateNormal];
+        [_downloadingHeadView.rightButton setTitle:rightSelectStr forState:UIControlStateSelected];
+        
+        if(_downloadingArr.count == 0){
+            _downloadingHeadView.hidden = YES;
+        }
+        else{
+            _downloadingHeadView.hidden = NO;
+        }
+    }
+    
+        
+     if(_failHeadView){
+        NSString *leftStr =  NSLocalizedString(@"File_upload_Record_did_upload",nil);
+        NSString *rightStr =  NSLocalizedString(@"File_upload_Record_clear_Record",nil);
+        NSString *titleStr = [[NSString alloc] initWithFormat:@"%@ (%ld)",leftStr,_downloadfailArr.count];
+
+         _failHeadView.titleLabel.text = titleStr;
+        [_failHeadView.rightButton setTitle:rightStr forState:UIControlStateNormal];
+         
+         if(_downloadfailArr.count == 0){
+             _failHeadView.hidden = YES;
+         }
+         else{
+             _failHeadView.hidden = NO;
+         }
+    }
+    
+    if(_doneHeadView){
+        NSString *leftStr =  NSLocalizedString(@"File_upload_Record_did_upload",nil);
+        NSString *rightStr =  NSLocalizedString(@"File_upload_Record_clear_Record",nil);
+        NSString *titleStr = [[NSString alloc] initWithFormat:@"%@ (%ld)",leftStr,_downloadDoneArr.count];
+
+        _doneHeadView.titleLabel.text = titleStr;
+        [_doneHeadView.rightButton setTitle:rightStr forState:UIControlStateNormal];
+        
+        if(_downloadDoneArr.count == 0){
+            _doneHeadView.hidden = YES;
+        }
+        else{
+            _doneHeadView.hidden = NO;
+        }
+    }
+}
+
+#pragma mark  点击全选
+- (void)setIsSelectAllType:(BOOL)isSelectAllType
+{
+    //_selectModelArr = [NSMutableArray arrayWithArray:_curDataArr];
+    
+    _selectModelArr = [NSMutableArray new];
+    
+    [_selectModelArr addObjectsFromArray:_downloadingArr];
+    [_selectModelArr addObjectsFromArray:_downloadfailArr];
+    [_selectModelArr addObjectsFromArray:_downloadDoneArr];
+    
+    [self reloadDataFun];
+}
+
+-(void)setIsEditType:(BOOL)isEditType
+{
+    _isEditType = isEditType;
+    
+    if(_isEditType){
+        //_bgScrollV.scrollEnabled = NO;
+    }
+    else{
+        //_bgScrollV.scrollEnabled = YES;
+        [_selectModelArr removeAllObjects];
+        
+    }
+    
+    [self reloadDataFun];
+}
+
+#pragma mark cell长按时间
+- (void)didLongPressClickFun{
+        self.isEditType = YES;
+        if(self->_didLongPressClick){
+            self->_didLongPressClick();
+        }
+}
+
+#pragma mark 单个点击选中 取消
+- (void)selectModelOneByOne:(uploadFileDataModel*)model BySelect:(BOOL)isSelcet
+{
+    if(isSelcet){
+        [_selectModelArr addObject:model];
+    }
+    else{
+        [_selectModelArr removeObject:model];
+    }
+}
+
+#pragma mark 单个点击选中后删除
+- (void)deleteModelOneByOneFun{
+    if(!_selectModelArr || _selectModelArr.count==0){
+        
+        return;
+    }
+    
+    KWeakSelf
+    [[uploadFileManager shareInstance] deleteUploadFileRecordBy:_selectModelArr withDelCache:YES complete:^(BOOL isSuccess) {
+        HLog(@"isSuccess:%d",isSuccess);
+        
+        if(isSuccess){
+//            NSMutableArray *curArr = self->_curDataArr;
+//            [curArr removeObjectsInArray:self->_selectModelArr];
+//            [weakSelf reloadDataFun];
+            self->_selectModelArr = [NSMutableArray new];
+            
+            //重新拿数据
+            [weakSelf refreshGetDatabaseFun];
+        }
+    }];
+}
+
+#pragma mark 删除后重新拿数据
+- (void)refreshGetDatabaseFun
+{
+    if(_didNeedRefreshGetDatabaseFun){
+        _didNeedRefreshGetDatabaseFun();
+    }
+}
+
+#pragma mark 处理上传中的 状态点击事件
+- (void)handleDownloadingStateTapFunBy:(BOOL)isSuspendType with:(couldPhoneFileModel*)model
+{
+    if (isSuspendType) {
+        [[downloadManager shareInstance] suspendDownloadFileFun:NO];
+    }
+    else{
+        NSMutableArray*arr = [NSMutableArray new];
+        [arr addObject:model];
+        [[downloadManager shareInstance] reDownloadFileFunBy:arr];
+    }
+    
+}
+
+#pragma mark 处理上传中的 状态点击事件
+- (void)handleUploadFailStateWith:(uploadFileDataModel*)model{
+    
+//    [_curDataArr removeObject:model];
+//    [self reloadDataFun];
+//
+//    if(_didClickReUploadBlock){
+//        _didClickReUploadBlock(model);
+//    }
+//
+//    NSMutableArray*arr = [NSMutableArray new];
+//    model.curUploadStateType = uploadStateWait;
+//    [arr addObject:model];
+//    [[uploadFileManager shareInstance] reUploadFileFunBy:arr];
+    
+}
+@end

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

@@ -549,7 +549,7 @@
 {
     uploadFileRecordViewController *vc = [uploadFileRecordViewController new];
     [self.navigationController pushViewController:vc animated:YES];
-    
+    vc.isUploadingType = YES;
     [vc gotoUploadFile:_indexPathsForSelectedItems];
 }
 

+ 6 - 0
创维盒子/双子星云手机/CloudPlayer/Model/couldPhoneFileListModel.m

@@ -23,6 +23,12 @@
 @end
 
 @implementation couldPhoneFileArrModel
+/**
+ 设置不需要存储的属性, 在模型.m文件中实现该函数.
+ */
++(NSArray *)bg_ignoreKeys{
+   return @[@"list"];
+}
 
 @end
 

+ 16 - 13
创维盒子/双子星云手机/CloudPlayer/PlayerViewController+downloadFile.m

@@ -79,20 +79,23 @@
     
     self.curDownloadFileModel.didDownloadBytes = didDownloadBytes;
    
-    if(isDownloadDone){
-        NSInteger i;
-    }
-    
-    if(endOfFile == self.curDownloadFileModel.length){
-        NSInteger i;
-    }
+//    if(isDownloadDone){
+//        NSInteger i;
+//    }
+//
+//    if(endOfFile == self.curDownloadFileModel.length){
+//        NSInteger i;
+//    }
     
     if(isDownloadDone || endOfFile == self.curDownloadFileModel.length){
         [self handleDownloadDoneFun];
     }
     else{//获取下一片
-        if(isDownloadDone){
-            NSInteger i;
+        
+        [[downloadManager shareInstance] DownloadFileChangeingOneFileFun];
+        
+        if([downloadManager shareInstance].isSuspendType){
+            return;
         }
         
         NSString * commandStr = [RCCommandHelp applyForDownloadFileBy:self.downloadFileTaskUid withFilePath:self.curDownloadFileModel.path withPosition:didDownloadBytes];
@@ -128,12 +131,12 @@
      } completionHandler:^(BOOL success, NSError * _Nullable error) {
          //NSLog(@"success = %d, error = %@", success, error);
          if (success) {
-             HLog(@"已将视频保存至相册");
+             HLog(@"已将图片保存至相册");
              NSString *fileName = [self.curDownloadFileModel getFileNameFun];
              [cachesFileManager removeItemAtPath:fileName type:DownLoadFileType error:nil];
              
          } else {
-             HLog(@"未能将视频保存至相册");
+             HLog(@"未能将图片保存至相册");
          }
          
          [[downloadManager shareInstance] DownloadFileDoneOneFileFun];
@@ -151,12 +154,12 @@
     fileURLWithPath:pathStr]];
     } completionHandler:^(BOOL success, NSError * _Nullable error) {
         if (success) {
-            HLog(@"已将图片保存至相册");
+            HLog(@"已将视频保存至相册");
             //NSString *fileName = [self.curDownloadFileModel getFileNameFun];
             [cachesFileManager removeItemAtPath:fileName type:DownLoadFileType error:nil];
             
         } else {
-            HLog(@"未能将图片保存至相册");
+            HLog(@"未能将视频保存至相册");
         }
         
         [[downloadManager shareInstance] DownloadFileDoneOneFileFun];

+ 1 - 0
创维盒子/双子星云手机/zh-Hans.lproj/Localizable.strings

@@ -357,3 +357,4 @@
 "File_backups_Record_tip_Suspend"   = "已暂停";
 "File_backups_set_default_path_tip"   = "请停止备份操作后再更改路径";
 "File_download_Path_default"   = "下载路径  相册";
+"File_download_Path_default_done"   = "下载到:相册";