瀏覽代碼

1.接收 保存里面的编辑 和长按 删除等交互完成

huangxiaodong 1 年之前
父節點
當前提交
7dcdd01dba

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

@@ -187,6 +187,10 @@
 		6B1F7FCB2C0064B500954720 /* boxReceiveFileRecordCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B1F7FC92C0064B400954720 /* boxReceiveFileRecordCell.m */; };
 		6B1F7FCC2C0064B500954720 /* boxReceiveFileRecordCell.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B1F7FC82C0064B400954720 /* boxReceiveFileRecordCell.h */; };
 		6B1F7FCD2C0064B500954720 /* boxReceiveFileRecordCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B1F7FC92C0064B400954720 /* boxReceiveFileRecordCell.m */; };
+		6B1F7FD62C00772500954720 /* boxDownloadFileManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B1F7FD42C00772500954720 /* boxDownloadFileManager.h */; };
+		6B1F7FD72C00772500954720 /* boxDownloadFileManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B1F7FD52C00772500954720 /* boxDownloadFileManager.m */; };
+		6B1F7FD82C00772500954720 /* boxDownloadFileManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B1F7FD42C00772500954720 /* boxDownloadFileManager.h */; };
+		6B1F7FD92C00772500954720 /* boxDownloadFileManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B1F7FD52C00772500954720 /* boxDownloadFileManager.m */; };
 		6B1FBD222B43DAD200926382 /* backupsSetViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B1FBD202B43DAD200926382 /* backupsSetViewController.h */; };
 		6B1FBD232B43DAD200926382 /* backupsSetViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B1FBD212B43DAD200926382 /* backupsSetViewController.m */; };
 		6B1FBD262B4503E700926382 /* photosBackupsTaskModel.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B1FBD242B4503E700926382 /* photosBackupsTaskModel.h */; };
@@ -1181,6 +1185,8 @@
 		6B1CC2CD2B6B6D6B00AD4217 /* commandSendCheckModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = commandSendCheckModel.m; sourceTree = "<group>"; };
 		6B1F7FC82C0064B400954720 /* boxReceiveFileRecordCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = boxReceiveFileRecordCell.h; sourceTree = "<group>"; };
 		6B1F7FC92C0064B400954720 /* boxReceiveFileRecordCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = boxReceiveFileRecordCell.m; sourceTree = "<group>"; };
+		6B1F7FD42C00772500954720 /* boxDownloadFileManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = boxDownloadFileManager.h; sourceTree = "<group>"; };
+		6B1F7FD52C00772500954720 /* boxDownloadFileManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = boxDownloadFileManager.m; sourceTree = "<group>"; };
 		6B1FBD202B43DAD200926382 /* backupsSetViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = backupsSetViewController.h; sourceTree = "<group>"; };
 		6B1FBD212B43DAD200926382 /* backupsSetViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = backupsSetViewController.m; sourceTree = "<group>"; };
 		6B1FBD242B4503E700926382 /* photosBackupsTaskModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = photosBackupsTaskModel.h; sourceTree = "<group>"; };
@@ -2126,6 +2132,8 @@
 				6B7272522B0CABC600C03F87 /* cachesFileManager.m */,
 				6B6ABEF02BFF6B4C00480BAC /* boxSaveFileManager.h */,
 				6B6ABEF12BFF6B4C00480BAC /* boxSaveFileManager.m */,
+				6B1F7FD42C00772500954720 /* boxDownloadFileManager.h */,
+				6B1F7FD52C00772500954720 /* boxDownloadFileManager.m */,
 			);
 			path = uploadFileManager;
 			sourceTree = "<group>";
@@ -2949,6 +2957,7 @@
 				18963B462AB84398006E7C50 /* GuideView.h in Headers */,
 				6B1FBD322B455DBD00926382 /* PlayerViewController+upLoadFile.h in Headers */,
 				6B72725B2B0E22D000C03F87 /* uploadFileRecordBgScorllView.h in Headers */,
+				6B1F7FD62C00772500954720 /* boxDownloadFileManager.h in Headers */,
 				18A909982ABC4A3300E6D2BE /* ComontAlretViewController.h in Headers */,
 				6B7272532B0CABC600C03F87 /* cachesFileManager.h in Headers */,
 				6B1FBD3E2B46875300926382 /* backupsFileRecordCell.h in Headers */,
@@ -3118,6 +3127,7 @@
 				6BD506FB2B9576A4006E7CB0 /* GuideView.h in Headers */,
 				6BD506FC2B9576A4006E7CB0 /* PlayerViewController+upLoadFile.h in Headers */,
 				6BD506FD2B9576A4006E7CB0 /* uploadFileRecordBgScorllView.h in Headers */,
+				6B1F7FD82C00772500954720 /* boxDownloadFileManager.h in Headers */,
 				6BD506FE2B9576A4006E7CB0 /* ComontAlretViewController.h in Headers */,
 				6BD506FF2B9576A4006E7CB0 /* cachesFileManager.h in Headers */,
 				6BD507002B9576A4006E7CB0 /* backupsFileRecordCell.h in Headers */,
@@ -3634,6 +3644,7 @@
 				6BD507682B9576A4006E7CB0 /* FMResultSet.m in Sources */,
 				6B34DC6E2BF2070D002DD1EF /* titleLabelReusableView.m in Sources */,
 				6BD507692B9576A4006E7CB0 /* UIScrollView+EmptyDataSet.m in Sources */,
+				6B1F7FD92C00772500954720 /* boxDownloadFileManager.m in Sources */,
 				6BD5076A2B9576A4006E7CB0 /* SafeForKey.m in Sources */,
 				6BD5076B2B9576A4006E7CB0 /* JSONModel.m in Sources */,
 				6BD5076C2B9576A4006E7CB0 /* PlayerViewController+AppDelegate.m in Sources */,
@@ -3888,6 +3899,7 @@
 				A08A950427E9A4E400C544BB /* FMResultSet.m in Sources */,
 				6B34DC6C2BF2070D002DD1EF /* titleLabelReusableView.m in Sources */,
 				A003F6C227D841FF00715CBF /* UIScrollView+EmptyDataSet.m in Sources */,
+				6B1F7FD72C00772500954720 /* boxDownloadFileManager.m in Sources */,
 				183AE7C82A8CB39100B11CB0 /* SafeForKey.m in Sources */,
 				183AE6042A89CE3C00B11CB0 /* JSONModel.m in Sources */,
 				18FCE5492AD15E750020F623 /* PlayerViewController+AppDelegate.m in Sources */,

+ 8 - 6
创维盒子/双子星云手机/AppDelegate/AppDelegate.m

@@ -44,12 +44,14 @@
 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
     
     //保护App,一般常见的问题不会导致闪退,增强App的健壮性,同时会将错误抛出来,根据每个App自身的日志渠道记录
-    [JJException configExceptionCategory:JJExceptionGuardAll];
-    [JJException startGuardException];
-    [JJException registerExceptionHandle:self];
-    
-    //Default value:NO  no表示异常不退出 YES 表示退出  开发时应该设置为YES
-    JJException.exceptionWhenTerminate = YES;
+
+//    [JJException configExceptionCategory:JJExceptionGuardAll];
+//    [JJException startGuardException];
+//    [JJException registerExceptionHandle:self];
+//    
+//    //Default value:NO  no表示异常不退出 YES 表示退出  开发时应该设置为YES
+//    JJException.exceptionWhenTerminate = YES;
+
     
     //test code
 //    NSArray * arr = @[];

+ 1 - 1
创维盒子/双子星云手机/AppDelegate/PrefixHeader.pch

@@ -130,7 +130,7 @@ isBangsScreen; \
 #define USEAQAAC  NO
 #define USEOPENGL  YES
 #define USELOCALKEYBOARD  NO/*是否使用键盘透传*/
-#define fullScreenShow  YES
+#define fullScreenShow  NO
 
 #define P2PModelList_bg_tableName(userName) [[NSString alloc] initWithFormat:@"P2PModelList_bg_tableName_%@",userName];
 #define DB_HWBuryPointModelList_TableName   @"DB_HWBuryPointModelList_New"

+ 12 - 15
创维盒子/双子星云手机/AppDelegate/SceneDelegate.m

@@ -35,6 +35,7 @@
 #import "NASMsgModel.h"
 #import "queryOneShareModel.h"
 #import "boxSaveFileManager.h"
+#import "boxDownloadFileManager.h"
 
 @interface SceneDelegate ()<SetUsePWDViewControllerDelegate,GuideViewControllerDelegate>
 @property(nonatomic, strong)   CalculatorViewController *calculatorVC;
@@ -1065,7 +1066,7 @@
         [self saveFileToBoxFunBy:model];
     }
     else if([type isEqualToString:@"download"]){
-        
+        [self downloadFileToAppFunBy:model];
     }
     
     
@@ -1076,26 +1077,12 @@
 {
     NSMutableDictionary*paraDict = [NSMutableDictionary new];
     
-//    NSString *str1 = @"[";
-//    NSString *str2 = @"]";
-//    NSMutableString *dataStr = [NSMutableString new];
-    
     NSMutableArray *pathArr = [NSMutableArray new];
     
     for (ShareFileDataModel*dataModel in sharemodel.data.fileListVOS){
-//        if(dataStr.length != 0){
-//            [dataStr appendString:@","];
-//        }
-//        [dataStr appendString:@"\""];
-//        [dataStr appendString:dataModel.fileUrl];
-//        [dataStr appendString:@"\""];
-        
         [pathArr addObject:dataModel.fileUrl];
     }
     
-//    NSString *totalStr = [[NSString alloc] initWithFormat:@"%@%@%@",str1,dataStr,str2];
-//    [paraDict setValue:totalStr forKey:@"urls"];
-    
     if (pathArr) {
         NSString *jsonStr = [iTools toJsonStrWithArray:pathArr];
         if(jsonStr){
@@ -1125,12 +1112,22 @@
     }];
 }
 
+#pragma mark 下载文件到手机
+- (void)downloadFileToAppFunBy:(queryOneShareModel*)sharemodel
+{
+    [self gotoUploadFileRecordVCFunByType:1 withModel:sharemodel];
+}
+
+
 #pragma mark 跳转传输列表
 - (void)gotoUploadFileRecordVCFunByType:(NSInteger)type withModel:(queryOneShareModel*)sharemodel
 {
     if(type == 2){
         [[boxSaveFileManager shareInstance] addBoxSaveRecordFunBy:sharemodel.data.fileListVOS];
     }
+    else if (type == 1){
+        [[boxDownloadFileManager shareInstance] addBoxDownloadRecordFunBy:sharemodel.data.fileListVOS];
+    }
     
     uploadFileRecordViewController *vc = [uploadFileRecordViewController new];
     vc.isReceiveType = type;

+ 3 - 2
创维盒子/双子星云手机/Class/Set/uploadFile/receiveView/boxReceiveFileRecordCell.m

@@ -86,13 +86,14 @@
     _fileNamelabel.font = [UIFont systemFontOfSize:14.0];
     _fileNamelabel.textColor = [UIColor blackColor];
     _fileNamelabel.numberOfLines = 0;
+    _fileNamelabel.lineBreakMode = NSLineBreakByTruncatingMiddle;
     //_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(30);
+        make.height.mas_equalTo(35);
         make.bottom.equalTo(_fileImageView.mas_centerY).offset(0);
     }];
     
@@ -106,7 +107,7 @@
         make.left.mas_equalTo(_fileImageView.mas_right).offset(10);
         make.right.mas_equalTo(_upLoadStateButton.mas_left).offset(-10);
         make.height.mas_equalTo(15);
-        make.top.mas_equalTo(_fileNamelabel.mas_bottom).offset(3);
+        make.top.mas_equalTo(_fileNamelabel.mas_bottom).offset(0);
     }];
     
     

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

@@ -10,7 +10,12 @@
 NS_ASSUME_NONNULL_BEGIN
 
 @interface receiveHeadView : UIView
+@property(nonatomic,strong) UIButton * downLoadButton;
+@property(nonatomic,strong) UIButton * saveButton;
+
 @property (nonatomic,copy) void (^didClickbuttonFun)(NSInteger tag);
+
+- (void)didClickButFun:(UIButton*)but;
 @end
 
 NS_ASSUME_NONNULL_END

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

@@ -13,8 +13,6 @@
     
 }
 
-@property(nonatomic,strong) UIButton * downLoadButton;
-@property(nonatomic,strong) UIButton * saveButton;
 @property(nonatomic,strong) UIView * selectBgView;
 
 @end

+ 35 - 55
创维盒子/双子星云手机/Class/Set/uploadFile/receiveView/receiveSaveRecordTableView.m

@@ -9,7 +9,7 @@
 #import "boxReceiveFileRecordCell.h"
 #import "UIScrollView+EmptyDataSet.h"
 #import "uploadFileRecordTableViewHeadView.h"
-
+#import "boxSaveFileManager.h"
 @interface receiveSaveRecordTableView()<UITableViewDataSource,UITableViewDelegate,DZNEmptyDataSetSource, DZNEmptyDataSetDelegate>
 {
    
@@ -141,26 +141,13 @@
             
             KWeakSelf
             cell.didLongPressClick = ^{
-                //[weakSelf didLongPressClickFun];
+                [weakSelf didLongPressClickFun];
             };
 
             cell.didClckSelectBut = ^(BOOL isSelect) {
-               // [weakSelf selectModelOneByOne:model BySelect:isSelect];
+                [weakSelf selectModelOneByOne:model BySelect:isSelect];
             };
 
-            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];
-//                }
-            };
         }
     }
     
@@ -337,7 +324,7 @@
         [_boxSaveingHeadView.rightButton setTitle:rightStr forState:UIControlStateNormal];
         [_boxSaveingHeadView.rightButton setTitle:rightSelectStr forState:UIControlStateSelected];
 
-        if(_boxSavefailArr.count == 0){
+        if(_boxSaveingArr.count == 0){
             _boxSaveingHeadView.hidden = YES;
         }
         else{
@@ -418,7 +405,7 @@
 }
 
 #pragma mark 单个点击选中 取消
-- (void)selectModelOneByOne:(couldPhoneFileModel*)model BySelect:(BOOL)isSelcet
+- (void)selectModelOneByOne:(ShareFileDataModel*)model BySelect:(BOOL)isSelcet
 {
     if(isSelcet){
         [_selectModelArr addObject:model];
@@ -437,53 +424,46 @@
         return;
     }
     
-    //[[downloadManager shareInstance] deleteDownloadFileRecordBy:_selectModelArr withDelCache:YES];
+    [[boxSaveFileManager shareInstance] deleteBoxSaveFileRecordBy:_selectModelArr];
+    
+    for (ShareFileDataModel *dataModel in _selectModelArr) {
+        [self handleTotalArrByDelete:dataModel];
+    }
     
     [_selectModelArr removeAllObjects];
-    //重新拿数据
-    [self refreshGetDatabaseFun];
-}
 
-#pragma mark 删除后重新拿数据
-- (void)refreshGetDatabaseFun
-{
-    if(_didNeedRefreshGetDatabaseFun){
-        _didNeedRefreshGetDatabaseFun();
-    }
+    [self reloadDataFun];
 }
 
-#pragma mark 处理上传中的 状态点击事件
-- (void)handleDownloadingStateTapFunBy:(BOOL)isSuspendType with:(couldPhoneFileModel*)model
+- (void)handleTotalArrByDelete:(ShareFileDataModel*)delModel
 {
-//    if (isSuspendType) {
-//        [[downloadManager shareInstance] suspendDownloadFileFun:NO withModel:model];
-//    }
-//    else{
-//        NSMutableArray*arr = [NSMutableArray new];
-//        [arr addObject:model];
-//        [[downloadManager shareInstance] reDownloadFileFunBy:arr withAll:NO];
-//    }
-//
-//    [self reloadDataFun];
+    if(delModel.saveboxStateType == saveBoxStateDone)
+    {
+        NSMutableArray *arr = _boxSaveDoneArr;
+        [self deteleModel:delModel inArr:arr];
+    }
+    else if(delModel.saveboxStateType == saveBoxStateFail){
+        NSMutableArray *arr = _boxSavefailArr;
+        [self deteleModel:delModel inArr:arr];
+    }
+    else{
+        NSMutableArray *arr = _boxSaveingArr;
+        [self deteleModel:delModel inArr:arr];
+    }
+    
 }
 
-#pragma mark 处理上传中的 状态点击事件
-- (void)handleUploadFailStateWith:(couldPhoneFileModel*)model{
+#pragma mark  处理删除内存数据
+- (void)deteleModel:(ShareFileDataModel*)delModel inArr:(NSMutableArray*)delArr{
     
-//    [_downloadfailArr removeObject:model];
-//    [_downloadingArr addObject:model];
-//
-//    [self RefreshAllDataFun];
-//
-//    if(_didClickReUploadBlock){
-//        _didClickReUploadBlock(model);
-//    }
-//
-//    NSMutableArray*arr = [NSMutableArray new];
-//    model.curDownloadStateType = downloadStateWait;
-//    [arr addObject:model];
-//    [[downloadManager shareInstance] reDownloadFileFunBy:arr withAll:NO];
+    for (ShareFileDataModel *dataModel in delArr) {
+        if(delModel.bg_id.integerValue == dataModel.bg_id.integerValue){
+            [delArr removeObject:dataModel];
+            break;;
+        }
+    }
     
 }
+
 @end
 

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

@@ -10,8 +10,14 @@
 NS_ASSUME_NONNULL_BEGIN
 
 @interface receiveView : UIView
-
+@property (nonatomic, assign) NSInteger isReceiveType;//h5分享页面进入
+@property (nonatomic,assign) BOOL isEditType;
+@property (nonatomic,assign) BOOL isSelectAllType;
+@property (nonatomic,strong) NSMutableArray *selectModelArr;
+@property (nonatomic,copy) void (^didLongPressClick)(void);
 - (void)getAllDataFun;
+#pragma mark 单个点击选中后删除
+- (void)deleteModelOneByOneFun;
 @end
 
 NS_ASSUME_NONNULL_END

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

@@ -69,11 +69,24 @@
         make.top.equalTo(_curReceiveHeadView.mas_bottom).offset(0);
         make.bottom.mas_equalTo(40);
     }];
+    
+    _saveRecordTableView.didLongPressClick = ^{
+        [weakSelf handleLongPressClickFun];
+    };
+}
+
+#pragma mark 长按事件传出去
+- (void)handleLongPressClickFun
+{
+    if(self->_didLongPressClick){
+        self->_didLongPressClick();
+    }
 }
 
 #pragma mark 点击下载和接收
 - (void)didClickHeadButtonFun:(NSInteger)tag
 {
+    _isReceiveType = tag;
     if(tag == 1){
         _downloadRecordTableView.hidden = NO;
         _saveRecordTableView.hidden = YES;
@@ -84,6 +97,38 @@
     }
 }
 
+- (void)setIsReceiveType:(NSInteger)isReceiveType
+{
+    _isReceiveType = isReceiveType;
+    
+    if(isReceiveType == 2){
+        [_curReceiveHeadView didClickButFun:_curReceiveHeadView.saveButton];
+    }
+    
+}
+
+- (void)setIsEditType:(BOOL)isEditType{
+    _isEditType = isEditType;
+    
+    if(_isReceiveType == 1){
+        _downloadRecordTableView.isEditType = isEditType;
+    }
+    else{
+        _saveRecordTableView.isEditType = isEditType;
+    }
+}
+
+#pragma mark  点击全选
+- (void)setIsSelectAllType:(BOOL)isSelectAllType
+{
+    if(_isReceiveType == 1){
+        _downloadRecordTableView.isSelectAllType = isSelectAllType;
+    }
+    else{
+        _saveRecordTableView.isSelectAllType = isSelectAllType;
+    }
+}
+
 #pragma mark 获取本地数据库数据
 - (void)getAllDataFun{
     
@@ -105,4 +150,26 @@
     
     
 }
+
+- (NSMutableArray*)selectModelArr
+{
+    if(_isReceiveType == 1){
+        return _downloadRecordTableView.selectModelArr;
+    }
+    else{
+        return _saveRecordTableView.selectModelArr;
+    }
+    
+    return [NSMutableArray new];
+}
+
+#pragma mark 单个点击选中后删除
+- (void)deleteModelOneByOneFun{
+    if(_isReceiveType == 1){
+        [_downloadRecordTableView deleteModelOneByOneFun];
+    }
+    else{
+        [_saveRecordTableView deleteModelOneByOneFun];
+    }
+}
 @end

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

@@ -0,0 +1,28 @@
+//
+//  boxDownloadFileManager.h
+//  双子星云手机
+//
+//  Created by xd h on 2024/5/24.
+//
+
+#import <Foundation/Foundation.h>
+#import "queryOneShareModel.h"
+#import "uploadFileManager.h"
+NS_ASSUME_NONNULL_BEGIN
+
+
+#define share_box_download_tableName [[NSString alloc] initWithFormat:@"share_download_tableName_%@",[connectDeviceManager shareInstance].DeviceThirdIdMod.data.sn]
+
+@interface boxDownloadFileManager : NSObject
++(boxDownloadFileManager *)shareInstance;
+
+//数据库数据
+@property (nonatomic, strong) NSMutableArray * _Nullable databaseArr;
+
+//添加保存记录 NSArray<ShareFileDataModel>* fileListVOS;
+- (void)addBoxDownloadRecordFunBy:(NSArray*)arr;
+#pragma mark 读取数据库数据
+- (void)getDataInDatabaseFun:(BOOL)isReGet complete:(custom_complete_Arr)complete;
+@end
+
+NS_ASSUME_NONNULL_END

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

@@ -0,0 +1,102 @@
+//
+//  boxDownloadFileManager.m
+//  双子星云手机
+//
+//  Created by xd h on 2024/5/24.
+//
+
+#import "boxDownloadFileManager.h"
+
+@implementation boxDownloadFileManager
+static boxDownloadFileManager * cur_boxDownloadFileShareInstance = nil;
++(boxDownloadFileManager *)shareInstance;
+{
+    static dispatch_once_t onceToken;
+    
+    dispatch_once(&onceToken, ^{
+        cur_boxDownloadFileShareInstance = [[boxDownloadFileManager alloc] init];
+        
+    });
+    
+    return cur_boxDownloadFileShareInstance;
+}
+
+- (id)init
+{
+    self = [super init];
+    
+    if (self) {
+        //[self initManager];
+    }
+    
+    return self;
+}
+
+//添加保存记录
+- (void)addBoxDownloadRecordFunBy:(NSArray*)arr{
+    if(arr && arr.count >0 ){
+        
+        for (ShareFileDataModel*model in arr) {
+            model.bg_tableName = share_box_download_tableName;
+        }
+        
+        //[ShareFileDataModel bg_saveOrUpdateArray:arr];
+        [ShareFileDataModel bg_saveOrUpdateArrayAsync:arr complete:^(BOOL isSuccess) {
+                    
+        }];
+    }
+}
+
+#pragma mark 读取数据库数据
+- (void)getDataInDatabaseFun:(BOOL)isReGet complete:(custom_complete_Arr)complete
+{
+    if(_databaseArr && _databaseArr.count == 3 && !isReGet){
+        complete(_databaseArr);
+        return;
+    }
+    
+    if(!_databaseArr)
+    {
+        _databaseArr = [NSMutableArray new];
+    }
+    
+    //KWeakSelf
+    //dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT,0), ^{
+//    NSLock *lock = [NSLock new];
+//    [lock lock];
+        [ShareFileDataModel bg_findAsync:share_box_download_tableName limit:0 orderBy:nil desc:YES complete:^(NSArray * _Nullable array) {
+            NSMutableArray *failArr = [NSMutableArray new];
+            NSMutableArray *doneArr = [NSMutableArray new];
+            NSMutableArray *otherArr = [NSMutableArray new];
+            if(array && array.count >0){
+                for (ShareFileDataModel * curModel in array) {
+                    
+                    if(curModel.saveboxStateType == saveBoxStateFail){
+                        [failArr addObject:curModel];
+                    }
+                    else if(curModel.saveboxStateType == saveBoxStateDone){
+                        [doneArr addObject:curModel];
+                    }
+                    else{
+                        [otherArr addObject:curModel];
+                    }
+                }
+            }
+            NSLock *lock = [NSLock new];
+            [lock lock];
+            
+            NSMutableArray *newArr = [NSMutableArray new];
+            [newArr addObject:otherArr];
+            [newArr addObject:doneArr];
+            [newArr addObject:failArr];
+            self->_databaseArr = newArr;
+            
+            [lock unlock];
+            
+            complete(self->_databaseArr);
+        }];
+   // [lock unlock];
+    //});
+
+}
+@end

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

@@ -22,6 +22,9 @@ NS_ASSUME_NONNULL_BEGIN
 - (void)addBoxSaveRecordFunBy:(NSArray*)arr;
 #pragma mark 读取数据库数据
 - (void)getDataInDatabaseFun:(BOOL)isReGet complete:(custom_complete_Arr)complete;
+
+#pragma mark 删除本地数据库记录
+- (void)deleteBoxSaveFileRecordBy:(NSMutableArray *)delArr;
 @end
 
 NS_ASSUME_NONNULL_END

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

@@ -106,4 +106,60 @@ static boxSaveFileManager * cur_boxSaveFileShareInstance = nil;
     //});
 
 }
+
+- (void)handleDatabaseArrByDelete:(ShareFileDataModel*)delModel
+{
+    if(_databaseArr && _databaseArr.count == 3 ){
+        
+        if(delModel.saveboxStateType == saveBoxStateDone)
+        {
+            NSMutableArray *arr = _databaseArr[1];
+            [self deteleModel:delModel inArr:arr];
+        }
+        else if(delModel.saveboxStateType == saveBoxStateFail){
+            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{
+  
+    BOOL isSuc = false;
+    
+    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(ShareFileDataModel.bg_id)];
+        [where appendString:curStr];
+        
+        [ShareFileDataModel bg_deleteAsync:share_box_save_tableName where:where complete:^(BOOL isSuccess) {
+        }];
+        
+    }
+    
+}
 @end

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

@@ -244,6 +244,10 @@
         make.height.mas_equalTo(curHeight);
     }];
  
+    _curReceiveView.didLongPressClick = ^{
+        weakSelf.isEditType = YES;
+    };
+    
     _uploadFileRecordBgScorllV.contentSize = CGSizeMake(SCREEN_W*4.0, curHeight);
     
 //    _leftHeadView =  [[uploadFileRecordTableViewHeadView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_W, 40)];
@@ -335,6 +339,9 @@
     else if(_selectIndex == 3){
         return;
     }
+    else if(_selectIndex == 4){
+        selectModelArr = _curReceiveView.selectModelArr;;
+    }
     
     if(!selectModelArr || selectModelArr.count== 0){
         
@@ -354,6 +361,9 @@
     else if(_selectIndex == 3){
         delTipTip = NSLocalizedString(@"File_upload_Record_clear_fail_Tip_msg",nil);
     }
+    else if(_selectIndex == 4){
+        delTipTip = NSLocalizedString(@"File_upload_Record_clear_done_Tip_msg",nil);
+    }
     
     /*弹窗提示二次确认*/
     KWeakSelf
@@ -391,6 +401,10 @@
             [SVProgressHUD dismiss];
         });
     }
+    else if(_selectIndex == 4){
+        [_curReceiveView deleteModelOneByOneFun];
+        [SVProgressHUD dismiss];
+    }
 }
 
 #pragma mark 头部点击 背景滚动
@@ -715,6 +729,9 @@
         else if(_selectIndex == 3){
             //self.rightTableView.isSelectAllType = YES;
         }
+        else if(_selectIndex == 4){
+            self.curReceiveView.isSelectAllType = YES;
+        }
     }
 }
 
@@ -732,6 +749,8 @@
     
     //_leftHeadView.rightButton.userInteractionEnabled = !isEditType;
     
+    _curReceiveView.isEditType = isEditType;
+    
     if(_isEditType){
        
         CGFloat curHeight = SCREEN_H - CGRectGetMaxY(self.navBarBGView.frame) - 50 - 15 - (60 + safeArea);
@@ -764,6 +783,12 @@
             make.height.mas_equalTo(curHeight);
         }];
         
+        [_curReceiveView mas_remakeConstraints:^(MASConstraintMaker *make) {
+            make.left.mas_equalTo(SCREEN_W*3.0);
+            make.width.mas_equalTo(SCREEN_W);
+            make.top.mas_equalTo(0);
+            make.height.mas_equalTo(curHeight);
+        }];
     }
     else{
 
@@ -796,6 +821,13 @@
             make.top.mas_equalTo(0);
             make.height.mas_equalTo(curHeight);
         }];
+        
+        [_curReceiveView mas_remakeConstraints:^(MASConstraintMaker *make) {
+            make.left.mas_equalTo(SCREEN_W*3.0);
+            make.width.mas_equalTo(SCREEN_W);
+            make.top.mas_equalTo(0);
+            make.height.mas_equalTo(curHeight);
+        }];
     }
 }
 
@@ -1075,8 +1107,11 @@
 - (void)setIsReceiveType:(NSInteger)isReceiveType
 {
     _isReceiveType = isReceiveType;
-    [self delayChangeUIFunWithIndex:4];
+    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
+        [self delayChangeUIFunWithIndex:4];
+    });
     
+    _curReceiveView.isReceiveType = isReceiveType;
     [_curReceiveView getAllDataFun];
 }
 @end