Browse Source

1.图片详情页面删除图片处理---未完成

huangxiaodong 8 months ago
parent
commit
25fb5760d1

+ 1 - 1
创维盒子/双子星云手机/Class/Set/previewFile/imageDetailsScrollViewController.h

@@ -16,7 +16,7 @@ NS_ASSUME_NONNULL_BEGIN
 
 @property(nonatomic,assign)BOOL canShareType;
 
-@property (nonatomic,copy) void (^didNeedToRegetDataFun)(void);
+@property (nonatomic,copy) void (^didNeedDeleteFile)(NSString*filePath);
 @end
 
 NS_ASSUME_NONNULL_END

+ 4 - 2
创维盒子/双子星云手机/Class/Set/previewFile/imageDetailsScrollViewController.m

@@ -415,9 +415,11 @@
 {
     NSMutableDictionary*paraDict = [NSMutableDictionary new];
     
+    NSString *deleteFilePath = @"";
     if(_index >=0 &&  _index < _totalDataArr.count){
         NASFilePicDataArrModel *dataModel = _totalDataArr[_index];
         NSArray *pathArr = @[dataModel.path];
+        deleteFilePath = dataModel.path;
         //NSArray *pathArr = @[dataModel.path,dataModel.path];
         [paraDict setValue:pathArr forKey:@"path"];
     }
@@ -432,8 +434,8 @@
         if(model && model.status == 0){
             [[iToast makeText:NSLocalizedString(@"delete_file_suc_msg",nil)] show];
             
-            if(weakSelf.didNeedToRegetDataFun){
-                weakSelf.didNeedToRegetDataFun();
+            if(weakSelf.didNeedDeleteFile){
+                weakSelf.didNeedDeleteFile(deleteFilePath);
             }
             
             [weakSelf didDeleteSucFun];

+ 32 - 32
创维盒子/双子星云手机/Class/Set/previewFile/previewImageOrVideoViewController.m

@@ -464,12 +464,7 @@
         if (timeArrModel.list.count > row) {
             //NASFilePicDataArrModel * dataModel = timeArrModel.list[row];
             
-            if(_isPhotoType){
-                [self didClickPicDetailsWithSection:section withRow:row];
-            }
-            else{
-                [self didClickVideoWithSection:section withRow:row];
-            }
+            [self didClickPicDetailsWithSection:section withRow:row];
         }
     }
 }
@@ -1109,37 +1104,13 @@
         vc.canShareType = canShareType;
         
         KWeakSelf
-        vc.didNeedToRegetDataFun = ^{
-            [weakSelf delayedGetFileListFun];
+        vc.didNeedDeleteFile = ^(NSString * _Nonnull filePath) {
+            [weakSelf deleteNetDataByFilePath:filePath];
         };
-    }
-}
-
-#pragma mark 点击视频详情
-- (void)didClickVideoWithSection:(NSInteger)section withRow:(NSInteger)row{
-    
-    if(_curNASFilePicModel){
-        if(section < _curNASFilePicModel.data.fileList.count){
-            NASFilePicTimeArrModel *timeModel = _curNASFilePicModel.data.fileList[section];
-            
-            if(row < timeModel.list.count){
-                NASFilePicDataArrModel *dataModel = timeModel.list[row];
-                //videoPlayViewController *vc = [videoPlayViewController new];
-                videoPlayByAVPlayerViewController *vc = [videoPlayByAVPlayerViewController new];
-                vc.VideoDataMode = dataModel;
-                [self.navigationController pushViewController:vc animated:YES];
-                
-                KWeakSelf
-                vc.didNeedToRegetDataFun = ^{
-                   // [weakSelf getFileListFun];
-                };
-            }
-        }
         
     }
 }
 
-
 - (void)gotoDownLoadFileFun
 {
     if(_didSelectListArr.count == 0){
@@ -1310,6 +1281,35 @@
     
     [self.dataCollectionView reloadData];
 }
+    
+#pragma mark 图片详情删除成功后 对应删除原来获取的网络数据
+- (void)deleteNetDataByFilePath:(NSString*)filePath
+{
+    if(!filePath || filePath.length == 0){
+        return;
+    }
+    
+    BOOL didFineFile = NO;
+    for (NASFilePicTimeArrModel *timeArrModel in _curNASFilePicModel.data.fileList) {
+        NSMutableArray *afterFilterArr = [NSMutableArray new];
+        for (NASFilePicDataArrModel * dataModel in timeArrModel.list) {
+            if(![dataModel.path isEqualToString:filePath]){
+                [afterFilterArr addObject:dataModel];
+            }
+            else{
+                didFineFile = YES;
+                break;
+            }
+        }
+        timeArrModel.list = (NSArray<NASFilePicDataArrModel>*)afterFilterArr;
+        
+        if(didFineFile){
+            break;
+        }
+    }
+    
+    [self.dataCollectionView reloadData];
+}
 
 - (void)delayedGetFileListFun{
     KWeakSelf