Browse Source

1.接收 的下载 显示和删除完成

huangxiaodong 1 year ago
parent
commit
d7a92a5842

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

@@ -463,6 +463,10 @@
 		6B9714402BCD00CA00CE0096 /* ComontAlretType2ViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B97143D2BCD00C900CE0096 /* ComontAlretType2ViewController.h */; };
 		6B9714412BCD00CA00CE0096 /* ComontAlretType2ViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B97143D2BCD00C900CE0096 /* ComontAlretType2ViewController.h */; };
 		6B9714422BCD00CA00CE0096 /* ComontAlretType2ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B97143E2BCD00C900CE0096 /* ComontAlretType2ViewController.m */; };
+		6BA08F082C0187DD00A2242D /* boxDownloadFileRecordCell.h in Headers */ = {isa = PBXBuildFile; fileRef = 6BA08F062C0187DC00A2242D /* boxDownloadFileRecordCell.h */; };
+		6BA08F092C0187DD00A2242D /* boxDownloadFileRecordCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 6BA08F072C0187DC00A2242D /* boxDownloadFileRecordCell.m */; };
+		6BA08F0A2C0187DD00A2242D /* boxDownloadFileRecordCell.h in Headers */ = {isa = PBXBuildFile; fileRef = 6BA08F062C0187DC00A2242D /* boxDownloadFileRecordCell.h */; };
+		6BA08F0B2C0187DD00A2242D /* boxDownloadFileRecordCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 6BA08F072C0187DC00A2242D /* boxDownloadFileRecordCell.m */; };
 		6BA533382B16E65500D1CB5C /* TvStatusModel.h in Headers */ = {isa = PBXBuildFile; fileRef = 6BA533362B16E65500D1CB5C /* TvStatusModel.h */; };
 		6BA533392B16E65500D1CB5C /* TvStatusModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 6BA533372B16E65500D1CB5C /* TvStatusModel.m */; };
 		6BBB35D92AE7645200E4A59B /* RunInBackground.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = 6BBB35D62AE7645200E4A59B /* RunInBackground.mp3 */; };
@@ -1392,6 +1396,8 @@
 		6B9354AB2BF3879200AA8D31 /* shareRecordTableViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = shareRecordTableViewCell.m; sourceTree = "<group>"; };
 		6B97143D2BCD00C900CE0096 /* ComontAlretType2ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ComontAlretType2ViewController.h; sourceTree = "<group>"; };
 		6B97143E2BCD00C900CE0096 /* ComontAlretType2ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ComontAlretType2ViewController.m; sourceTree = "<group>"; };
+		6BA08F062C0187DC00A2242D /* boxDownloadFileRecordCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = boxDownloadFileRecordCell.h; sourceTree = "<group>"; };
+		6BA08F072C0187DC00A2242D /* boxDownloadFileRecordCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = boxDownloadFileRecordCell.m; sourceTree = "<group>"; };
 		6BA533362B16E65500D1CB5C /* TvStatusModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TvStatusModel.h; sourceTree = "<group>"; };
 		6BA533372B16E65500D1CB5C /* TvStatusModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TvStatusModel.m; sourceTree = "<group>"; };
 		6BBB35D62AE7645200E4A59B /* RunInBackground.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = RunInBackground.mp3; sourceTree = "<group>"; };
@@ -2361,6 +2367,8 @@
 				6B6ABEEB2BFF5B2F00480BAC /* receiveSaveRecordTableView.m */,
 				6B1F7FC82C0064B400954720 /* boxReceiveFileRecordCell.h */,
 				6B1F7FC92C0064B400954720 /* boxReceiveFileRecordCell.m */,
+				6BA08F062C0187DC00A2242D /* boxDownloadFileRecordCell.h */,
+				6BA08F072C0187DC00A2242D /* boxDownloadFileRecordCell.m */,
 			);
 			path = receiveView;
 			sourceTree = "<group>";
@@ -2902,6 +2910,7 @@
 				6B5B60652B3D5FD8009A2AE2 /* fileTransfeSetViewController.h in Headers */,
 				6B4D23B12B33DDBC005B718A /* imageVersionRenewTipView.h in Headers */,
 				6B0582892B045E0B00D37290 /* uploadFileDataModel.h in Headers */,
+				6BA08F082C0187DD00A2242D /* boxDownloadFileRecordCell.h in Headers */,
 				6BF52C972AD5546500A617DB /* SimplePing.h in Headers */,
 				6B3F96342AD2A15A008E349E /* netWorkManager.h in Headers */,
 				6B7EA7B02BF73DEB002D5CC2 /* addShareModel.h in Headers */,
@@ -3073,6 +3082,7 @@
 				6BD506CF2B9576A4006E7CB0 /* fileTransfeSetViewController.h in Headers */,
 				6BD506D02B9576A4006E7CB0 /* imageVersionRenewTipView.h in Headers */,
 				6BD506D12B9576A4006E7CB0 /* uploadFileDataModel.h in Headers */,
+				6BA08F0A2C0187DD00A2242D /* boxDownloadFileRecordCell.h in Headers */,
 				6BD506D22B9576A4006E7CB0 /* SimplePing.h in Headers */,
 				6BD506D32B9576A4006E7CB0 /* netWorkManager.h in Headers */,
 				6B7EA7B22BF73DEB002D5CC2 /* addShareModel.h in Headers */,
@@ -3557,6 +3567,7 @@
 				6BD5071A2B9576A4006E7CB0 /* AFURLResponseSerialization.m in Sources */,
 				6BD5071B2B9576A4006E7CB0 /* HWHistoryViewController.m in Sources */,
 				6BD5071C2B9576A4006E7CB0 /* backupsSetViewController.m in Sources */,
+				6BA08F0B2C0187DD00A2242D /* boxDownloadFileRecordCell.m in Sources */,
 				6BD5071D2B9576A4006E7CB0 /* diskListBgView.m in Sources */,
 				6BD5071E2B9576A4006E7CB0 /* iTools.m in Sources */,
 				6BD5071F2B9576A4006E7CB0 /* SetPWDSecondViewController.m in Sources */,
@@ -3813,6 +3824,7 @@
 				183AE6542A8A2CF000B11CB0 /* AFURLResponseSerialization.m in Sources */,
 				A0295B1227ED938B009C5D8B /* HWHistoryViewController.m in Sources */,
 				6B1FBD232B43DAD200926382 /* backupsSetViewController.m in Sources */,
+				6BA08F092C0187DD00A2242D /* boxDownloadFileRecordCell.m in Sources */,
 				6B45C50D2B5FA80E007E6911 /* diskListBgView.m in Sources */,
 				A003F6D127D8425C00715CBF /* iTools.m in Sources */,
 				18EC79DD2ABC109F0084836A /* SetPWDSecondViewController.m in Sources */,
@@ -4472,7 +4484,7 @@
 				CODE_SIGN_IDENTITY = "Apple Development";
 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
 				CODE_SIGN_STYLE = Manual;
-				CURRENT_PROJECT_VERSION = 9;
+				CURRENT_PROJECT_VERSION = 10;
 				DEVELOPMENT_TEAM = "";
 				"DEVELOPMENT_TEAM[sdk=iphoneos*]" = 6SV76WTUUR;
 				FRAMEWORK_SEARCH_PATHS = (
@@ -4553,7 +4565,7 @@
 				CODE_SIGN_IDENTITY = "Apple Development";
 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
 				CODE_SIGN_STYLE = Manual;
-				CURRENT_PROJECT_VERSION = 9;
+				CURRENT_PROJECT_VERSION = 10;
 				DEVELOPMENT_TEAM = "";
 				"DEVELOPMENT_TEAM[sdk=iphoneos*]" = 6SV76WTUUR;
 				FRAMEWORK_SEARCH_PATHS = (

+ 11 - 0
创维盒子/双子星云手机/Class/Set/previewFile/model/ShareRecordModel.h

@@ -18,6 +18,14 @@ typedef enum{
     saveBoxStateFail,
 }shareSaveBoxStateType;
 
+typedef enum{
+    downloadBoxStateBegin = 0,
+    downloadBoxStateUploading,//占位 未用到
+    downloadBoxStateSuspend,//占位 未用到
+    downloadBoxStateDone,
+    downloadBoxStateFail,
+}shareDownloadBoxStateType;
+
 @interface ShareFileDataModel : SuperModel
 @property (nonatomic, copy) NSString*fileName;
 @property (nonatomic, copy) NSString*fileSize;
@@ -30,6 +38,9 @@ typedef enum{
 //自定义
 @property (nonatomic, assign) shareSaveBoxStateType saveboxStateType;
 @property (nonatomic, copy) NSString*boxSavePath;//保存路口
+
+//
+@property (nonatomic, assign) shareDownloadBoxStateType downloadBoxStateType;
 @end
 
 @protocol ShareFileDataModel;

+ 24 - 0
创维盒子/双子星云手机/Class/Set/uploadFile/receiveView/boxDownloadFileRecordCell.h

@@ -0,0 +1,24 @@
+//
+//  boxDownloadFileRecordCell.h
+//  双子星云手机
+//
+//  Created by xd h on 2024/5/25.
+//
+
+#import <UIKit/UIKit.h>
+#import "queryOneShareModel.h"
+NS_ASSUME_NONNULL_BEGIN
+
+@interface boxDownloadFileRecordCell : UITableViewCell
+@property(nonatomic,strong) ShareFileDataModel * curShareFileDataModel;
+@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

+ 475 - 0
创维盒子/双子星云手机/Class/Set/uploadFile/receiveView/boxDownloadFileRecordCell.m

@@ -0,0 +1,475 @@
+//
+//  boxDownloadFileRecordCell.m
+//  双子星云手机
+//
+//  Created by xd h on 2024/5/25.
+//
+
+#import "boxDownloadFileRecordCell.h"
+
+#import "cachesFileManager.h"
+#import <SDWebImage/SDWebImage.h>
+#import "downloadThumbnailManager.h"
+
+@interface boxDownloadFileRecordCell ()
+@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 boxDownloadFileRecordCell
+
+- (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];
+    [_fileImageView setContentMode:(UIViewContentModeScaleAspectFit)];
+    [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.textColor = [UIColor blackColor];
+    //_fileNamelabel.backgroundColor = [UIColor greenColor];
+    _fileNamelabel.lineBreakMode = NSLineBreakByTruncatingMiddle;
+    [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(_curShareFileDataModel.downloadBoxStateType == downloadBoxStateBegin
+           ||_curShareFileDataModel.downloadBoxStateType == downloadBoxStateUploading
+           ||_curShareFileDataModel.downloadBoxStateType == downloadBoxStateSuspend){
+            _upLoadStateButton.hidden = NO;
+        }
+    }
+}
+
+- (void)setIsSelectType:(BOOL)isSelectType
+{
+    _isSelectType = isSelectType;
+    
+    if(isSelectType){
+        self.selectButton.selected = YES;
+    }
+    else{
+        self.selectButton.selected = NO;
+    }
+}
+
+- (void)setCurShareFileDataModel:(ShareFileDataModel *)curShareFileDataModel
+{
+  
+    _fileSpeedlabel.hidden = YES;
+    _progressBgView.hidden = NO;
+    _upLoadStateButton.hidden = NO;
+    
+    _curShareFileDataModel = curShareFileDataModel;
+    
+    NSArray *nameArr= [curShareFileDataModel.fileName componentsSeparatedByString:@"."];
+    
+    //HLog(@"fileName: %@",curShareFileDataModel.fileName);
+    if (nameArr.count >= 2) {
+        NSString *lastName = nameArr.lastObject;
+        
+        lastName = [lastName lowercaseString];
+        //HLog(@"lastName: %@",lastName);
+        if ([lastName rangeOfString:@"txt"].location != NSNotFound) {
+            _fileImageView.image = [UIImage imageNamed:@"uploadFile_TXT"];
+        }
+        else if ([lastName rangeOfString:@"pdf"].location != NSNotFound) {
+            _fileImageView.image = [UIImage imageNamed:@"uploadFile_pdf"];
+        }
+        else if ([lastName rangeOfString:@"xlsx"].location != NSNotFound) {
+            _fileImageView.image = [UIImage imageNamed:@"uploadFile_xlsx"];
+        }
+        else if ([lastName rangeOfString:@"doc"].location != NSNotFound
+                 ||[lastName rangeOfString:@"docx"].location != NSNotFound) {
+            _fileImageView.image = [UIImage imageNamed:@"uploadFile_doc"];
+        }
+        else if ([lastName rangeOfString:@"mp3"].location != NSNotFound
+                 ||[lastName rangeOfString:@"wav"].location != NSNotFound
+                 ||[lastName rangeOfString:@"flac"].location != NSNotFound
+                 ||[lastName rangeOfString:@"aac"].location != NSNotFound
+                 ||[lastName rangeOfString:@"ogg"].location != NSNotFound
+                 ) {
+            _fileImageView.image = [UIImage imageNamed:@"uploadFile_audio"];
+        }
+        else if ([lastName rangeOfString:@"jpg"].location != NSNotFound
+                 ||[lastName rangeOfString:@"jpeg"].location != NSNotFound
+                 ||[lastName rangeOfString:@"png"].location != NSNotFound
+                 ||[lastName rangeOfString:@"gif"].location != NSNotFound
+                 ||[lastName rangeOfString:@"bmp"].location != NSNotFound
+                 ||[lastName rangeOfString:@"svg"].location != NSNotFound
+                 ||[lastName rangeOfString:@"tiff"].location != NSNotFound
+                 ||[lastName rangeOfString:@"heic"].location != NSNotFound
+                 ) {//JPG、JPEG、PNG、GIF、BMP、SVG、TIFF、HEIC。
+            //MP4、AVI、FLV、WMV、MKV、TS、MOV、RMVB。
+            
+            NSString *fileUrl = curShareFileDataModel.headUrl;
+            fileUrl = [fileUrl  stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
+            UIImage * defaultImage = [UIImage imageNamed:@"uploadFile_image"];
+            [_fileImageView sd_setImageWithURL:[NSURL URLWithString:fileUrl] placeholderImage:defaultImage completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {
+                if(image){
+                    //HLog(@"11图片1:%@",imageURL.absoluteString);
+                }
+                else{
+                    //HLog(@"11图片0:%@",imageURL.absoluteString);
+                }
+                
+            }];
+        }
+        else if ([lastName rangeOfString:@"mp4"].location != NSNotFound
+                 ||[lastName rangeOfString:@"avi"].location != NSNotFound
+                 ||[lastName rangeOfString:@"flv"].location != NSNotFound
+                 ||[lastName rangeOfString:@"wmv"].location != NSNotFound
+                 ||[lastName rangeOfString:@"wkm"].location != NSNotFound
+                 ||[lastName rangeOfString:@"ts"].location != NSNotFound
+                 ||[lastName rangeOfString:@"mov"].location != NSNotFound
+                 ||[lastName rangeOfString:@"rmvb"].location != NSNotFound
+                 ) {//JPG、JPEG、PNG、GIF、BMP、SVG、TIFF、HEIC。
+            //MP4、AVI、FLV、WMV、MKV、TS、MOV、RMVB。
+            
+            NSString *fileUrl = curShareFileDataModel.headUrl;
+            fileUrl = [fileUrl  stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
+            UIImage * defaultImage = [UIImage imageNamed:@"uploadFile_Video"];
+            [_fileImageView sd_setImageWithURL:[NSURL URLWithString:fileUrl] placeholderImage:defaultImage completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {
+                if(image){
+                    //HLog(@"11图片1:%@",imageURL.absoluteString);
+                }
+                else{
+                    //HLog(@"11图片0:%@",imageURL.absoluteString);
+                }
+                
+            }];
+        }
+        else{
+            _fileImageView.image = [UIImage imageNamed:@"uploadFile_other"];
+        }
+    }
+    
+    
+    _fileNamelabel.text = curShareFileDataModel.fileName;
+    
+    
+
+//    //进度设置
+//    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;
+//                
+//                long speed= (curCouldPhoneFileModel.didDownloadBytes - curCouldPhoneFileModel.preDownloadBytes) / 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;
+//        curCouldPhoneFileModel.preDownloadBytes = curCouldPhoneFileModel.didDownloadBytes;
+//    }
+//    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(_curShareFileDataModel.downloadBoxStateType == downloadBoxStateUploading){
+        [_upLoadStateButton setImage:[UIImage imageNamed:@"uploadFile_start"] forState:UIControlStateNormal];
+        
+    }
+    else if(_curShareFileDataModel.downloadBoxStateType == downloadBoxStateSuspend){
+       
+        [_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

+ 1 - 0
创维盒子/双子星云手机/Class/Set/uploadFile/receiveView/receiveDownloadRecordTableView.h

@@ -8,6 +8,7 @@
 #import <UIKit/UIKit.h>
 #import "uploadFileRecordTableViewHeadView.h"
 #import "couldPhoneFileListModel.h"
+#import "boxDownloadFileManager.h"
 
 NS_ASSUME_NONNULL_BEGIN
 

+ 162 - 137
创维盒子/双子星云手机/Class/Set/uploadFile/receiveView/receiveDownloadRecordTableView.m

@@ -7,7 +7,7 @@
 
 #import "receiveDownloadRecordTableView.h"
 
-#import "downloadFileRecordCell.h"
+#import "boxDownloadFileRecordCell.h"
 #import "UIScrollView+EmptyDataSet.h"
 #import "uploadFileRecordTableViewHeadView.h"
 
@@ -108,12 +108,12 @@
     
     NSInteger row = indexPath.row;
     NSInteger section = indexPath.section;
-    static NSString *identifier = @"downloadFileRecordCell";
+    static NSString *identifier = @"boxDownloadFileRecordCell";
     
-    downloadFileRecordCell * cell =  [tableView dequeueReusableCellWithIdentifier:identifier];
+    boxDownloadFileRecordCell * cell =  [tableView dequeueReusableCellWithIdentifier:identifier];
     cell.selectionStyle = UITableViewCellSelectionStyleNone;
     if (!cell){
-        cell = [[downloadFileRecordCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:identifier];
+        cell = [[boxDownloadFileRecordCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:identifier];
         [cell setSelectionStyle:UITableViewCellSelectionStyleNone];
         [cell setBackgroundColor:[UIColor clearColor]];
         [cell setAccessoryType:(UITableViewCellAccessoryNone)];
@@ -123,8 +123,8 @@
         NSMutableArray *curArr = _curDataArr[section];
         
         if(row < curArr.count){
-            couldPhoneFileModel *model = curArr[row];
-            cell.curCouldPhoneFileModel = model;
+            ShareFileDataModel *model = curArr[row];
+            cell.curShareFileDataModel = model;
             cell.isEditType = _isEditType;
 
             if(_isEditType){
@@ -146,17 +146,17 @@
             };
 
             cell.didTapPressClick = ^{
-                if(model.curDownloadStateType == downloadStateUploading){
-                    model.curDownloadStateType = downloadStateSuspend;
-                    [weakSelf handleDownloadingStateTapFunBy:YES with:model];
-                }
-                else if(model.curDownloadStateType == downloadStateSuspend){
-                    model.curDownloadStateType = downloadStateUploading;
-                    [weakSelf handleDownloadingStateTapFunBy:NO with:model];
-                }
-                else if(model.curDownloadStateType == downloadStateFail){
-                    [weakSelf handleUploadFailStateWith:model];
-                }
+//                if(model.curDownloadStateType == downloadStateUploading){
+//                    model.curDownloadStateType = downloadStateSuspend;
+//                    [weakSelf handleDownloadingStateTapFunBy:YES with:model];
+//                }
+//                else if(model.curDownloadStateType == downloadStateSuspend){
+//                    model.curDownloadStateType = downloadStateUploading;
+//                    [weakSelf handleDownloadingStateTapFunBy:NO with:model];
+//                }
+//                else if(model.curDownloadStateType == downloadStateFail){
+//                    [weakSelf handleUploadFailStateWith:model];
+//                }
             };
         }
     }
@@ -200,16 +200,15 @@
     
     [self RefresHeadUIFun];
     
-    return [UIView new];
-//    if(curType == 2){
-//        return _doneHeadView;
-//    }
-//    else if(curType == 1){
-//        return _failHeadView;
-//    }
-//    else{
-//        return _downloadingHeadView;
-//    }
+    if(curType == 2){
+        return _doneHeadView;
+    }
+    else if(curType == 1){
+        return _failHeadView;
+    }
+    else{
+        return _downloadingHeadView;
+    }
     
 }
 
@@ -256,58 +255,58 @@
 - (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_downloading",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_download_fail",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_download",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];
-//        };
-//    }
-//     
-//    
+    if(!_downloadingHeadView){
+        _downloadingHeadView = [[uploadFileRecordTableViewHeadView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_W, 40)];
+        //headView.backgroundColor = [UIColor greenColor];
+        
+        NSString *leftStr =  NSLocalizedString(@"File_upload_Record_downloading",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_download_fail",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_download",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 点击头部右边按钮
@@ -322,56 +321,56 @@
 -(void)RefresHeadUIFun
 {
 
-//    if(_downloadingHeadView){
-//        NSString *leftStr =  NSLocalizedString(@"File_upload_Record_downloading",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_download_fail",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_download",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;
-//        }
-//    }
+    if(_downloadingHeadView){
+        NSString *leftStr =  NSLocalizedString(@"File_upload_Record_downloading",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_download_fail",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_download",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  点击全选
@@ -413,7 +412,7 @@
 }
 
 #pragma mark 单个点击选中 取消
-- (void)selectModelOneByOne:(couldPhoneFileModel*)model BySelect:(BOOL)isSelcet
+- (void)selectModelOneByOne:(ShareFileDataModel*)model BySelect:(BOOL)isSelcet
 {
     if(isSelcet){
         [_selectModelArr addObject:model];
@@ -432,21 +431,47 @@
         return;
     }
     
-    //[[downloadManager shareInstance] deleteDownloadFileRecordBy:_selectModelArr withDelCache:YES];
+    [[boxDownloadFileManager shareInstance] deleteBoxSaveFileRecordBy:_selectModelArr];
+    
+    for (ShareFileDataModel *dataModel in _selectModelArr) {
+        [self handleTotalArrByDelete:dataModel];
+    }
     
     [_selectModelArr removeAllObjects];
-    //重新拿数据
-    [self refreshGetDatabaseFun];
+    [self reloadDataFun];
 }
 
-#pragma mark 删除后重新拿数据
-- (void)refreshGetDatabaseFun
+- (void)handleTotalArrByDelete:(ShareFileDataModel*)delModel
 {
-    if(_didNeedRefreshGetDatabaseFun){
-        _didNeedRefreshGetDatabaseFun();
+    if(delModel.downloadBoxStateType == downloadBoxStateDone)
+    {
+        NSMutableArray *arr = _downloadDoneArr;
+        [self deteleModel:delModel inArr:arr];
+    }
+    else if(delModel.downloadBoxStateType == downloadBoxStateFail){
+        NSMutableArray *arr = _downloadfailArr;
+        [self deteleModel:delModel inArr:arr];
+    }
+    else{
+        NSMutableArray *arr = _downloadingArr;
+        [self deteleModel:delModel inArr:arr];
     }
+    
 }
 
+#pragma mark  处理删除内存数据
+- (void)deteleModel:(ShareFileDataModel*)delModel inArr:(NSMutableArray*)delArr{
+    
+    for (ShareFileDataModel *dataModel in delArr) {
+        if(delModel.bg_id.integerValue == dataModel.bg_id.integerValue){
+            [delArr removeObject:dataModel];
+            break;;
+        }
+    }
+    
+}
+
+
 #pragma mark 处理上传中的 状态点击事件
 - (void)handleDownloadingStateTapFunBy:(BOOL)isSuspendType with:(couldPhoneFileModel*)model
 {

+ 20 - 0
创维盒子/双子星云手机/Class/Set/uploadFile/receiveView/receiveView.m

@@ -11,6 +11,7 @@
 #import "receiveSaveRecordTableView.h"
 #import "boxSaveFileManager.h"
 #import "downStatusModel.h"
+#import "boxDownloadFileManager.h"
 
 @interface receiveView ()
 {
@@ -27,6 +28,7 @@
 - (id)initWithFrame:(CGRect)frame{
     self = [super initWithFrame:frame];
     [self setBackgroundColor:[UIColor whiteColor]];
+    _isReceiveType = 1;
     [self drawAnyView];
     
     return self;
@@ -60,6 +62,10 @@
         make.bottom.mas_equalTo(40);
     }];
     
+    _downloadRecordTableView.didLongPressClick = ^{
+        [weakSelf handleLongPressClickFun];
+    };
+    
     _saveRecordTableView = [[receiveSaveRecordTableView alloc] init];
     _saveRecordTableView.hidden = YES;
     [self addSubview:_saveRecordTableView];
@@ -133,6 +139,7 @@
 #pragma mark 获取本地数据库数据
 - (void)getAllDataFun{
     
+    [self getBoxDownLoadDataFun];
     [self getBoxSaveDataFun];
 }
 
@@ -249,4 +256,17 @@
     [_saveRecordTableView RefreshAllDataFun];
 }
 
+#pragma mark 读取盒子下载的数据库
+- (void)getBoxDownLoadDataFun
+{
+    KWeakSelf
+    [[boxDownloadFileManager shareInstance] getDataInDatabaseFun:NO complete:^(NSMutableArray * _Nonnull Arr) {
+        [weakSelf AferGetBoxDownloadDataBy:Arr];
+    }];
+}
+
+- (void)AferGetBoxDownloadDataBy:(NSMutableArray*)arr
+{
+    _downloadRecordTableView.outSideDataArr = arr;
+}
 @end

+ 7 - 0
创维盒子/双子星云手机/Class/Set/uploadFile/uploadFileManager/boxDownloadFileManager.h

@@ -23,6 +23,13 @@ NS_ASSUME_NONNULL_BEGIN
 - (void)addBoxDownloadRecordFunBy:(NSArray*)arr;
 #pragma mark 读取数据库数据
 - (void)getDataInDatabaseFun:(BOOL)isReGet complete:(custom_complete_Arr)complete;
+
+#pragma mark 删除本地数据库记录
+- (void)deleteBoxSaveFileRecordBy:(NSMutableArray *)delArr;
+
+#pragma mark 更新本地数据库记录
+//- (void)updataBoxSaveDataBy:(downStatusModel*)downStatusMod;
+
 @end
 
 NS_ASSUME_NONNULL_END

+ 110 - 0
创维盒子/双子星云手机/Class/Set/uploadFile/uploadFileManager/boxDownloadFileManager.m

@@ -99,4 +99,114 @@ static boxDownloadFileManager * cur_boxDownloadFileShareInstance = nil;
     //});
 
 }
+
+- (void)handleDatabaseArrByDelete:(ShareFileDataModel*)delModel
+{
+    if(_databaseArr && _databaseArr.count == 3 ){
+        
+        if(delModel.downloadBoxStateType == downloadBoxStateDone)
+        {
+            NSMutableArray *arr = _databaseArr[1];
+            [self deteleModel:delModel inArr:arr];
+        }
+        else if(delModel.downloadBoxStateType == downloadBoxStateFail){
+            NSMutableArray *arr = _databaseArr[2];
+            [self deteleModel:delModel inArr:arr];
+        }
+        else{
+            NSMutableArray *arr = _databaseArr[0];
+            [self deteleModel:delModel inArr:arr];
+        }
+    }
+}
+
+#pragma mark  处理删除内存数据
+- (void)deteleModel:(ShareFileDataModel*)delModel inArr:(NSMutableArray*)delArr{
+    
+    for (ShareFileDataModel *dataModel in delArr) {
+        if(delModel.bg_id.integerValue == dataModel.bg_id.integerValue){
+            [delArr removeObject:dataModel];
+            break;;
+        }
+    }
+    
+}
+
+#pragma mark 删除本地数据库记录
+- (void)deleteBoxSaveFileRecordBy:(NSMutableArray *)delArr{
+  
+    NSMutableArray *curDelArr = [NSMutableArray arrayWithArray:delArr];
+    for (ShareFileDataModel *dataModel in curDelArr) {
+        
+        //1.内存数据删除
+        [self handleDatabaseArrByDelete:dataModel];
+        
+        //2.删除数据量
+        NSMutableString* where = [[NSMutableString alloc] initWithString:@"where "];
+        
+        NSString *curStr =  [NSString stringWithFormat:@"%@=%@ ",bg_sqlKey(@"bg_id"),bg_sqlValue(dataModel.bg_id)];
+        [where appendString:curStr];
+        
+        [ShareFileDataModel bg_deleteAsync:share_box_download_tableName where:where complete:^(BOOL isSuccess) {
+            if(isSuccess){
+                
+            }
+        }];
+        
+    }
+    
+}
+
+
+#pragma mark 更新本地数据库记录
+//- (void)updataBoxSaveDataBy:(downStatusModel*)downStatusMod
+//{
+//    
+//    //1.修改数据库
+//    NSMutableArray *firstArr = [NSMutableArray arrayWithArray:_databaseArr[0]] ;
+//    NSMutableArray *needUpdatArr = [NSMutableArray new];
+//    
+//    for (downStatusDataModel*updataModel in downStatusMod.data) {
+//
+//        for (ShareFileDataModel* model in firstArr) {
+//            if ([updataModel.url isEqualToString:model.fileUrl]) {
+//                if (updataModel.curStatus == 0
+//                    || updataModel.curStatus == 3) {
+//                    //不用处理
+//                }
+//                else if (updataModel.curStatus == 1) {
+//                    
+//                    [self handleDatabaseArrByDelete:model];
+//                    
+//                    //成功
+//                    model.saveboxStateType = saveBoxStateDone;
+//                    [needUpdatArr addObject:model];
+//                    
+//                    NSMutableArray *doneArr = _databaseArr[1];
+//                    [doneArr addObject:model];
+//                    
+//                }
+//                else{
+//                    [self handleDatabaseArrByDelete:model];
+//                    
+//                    //失败
+//                    model.saveboxStateType = saveBoxStateFail;
+//                    [needUpdatArr addObject:model];
+//                    
+//                    NSMutableArray *failArr = _databaseArr[2];
+//                    [failArr addObject:model];
+//                }
+//                break;
+//            }
+//        }
+//    }
+//    
+//    if(needUpdatArr.count > 0){
+//        [ShareFileDataModel bg_saveOrUpdateArrayAsync:needUpdatArr complete:^(BOOL isSuccess) {
+//
+//        }];
+//    }
+//    
+//    
+//}
 @end

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

@@ -340,7 +340,7 @@
         return;
     }
     else if(_selectIndex == 4){
-        selectModelArr = _curReceiveView.selectModelArr;;
+        selectModelArr = _curReceiveView.selectModelArr;
     }
     
     if(!selectModelArr || selectModelArr.count== 0){