Przeglądaj źródła

1.上传中认为开启中 点击非上传中的任务暂停,把上传中的任务暂停了

huangxiaodong 1 rok temu
rodzic
commit
38f9e5eeaf

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

@@ -681,7 +681,7 @@
     [self enterMainVCFromScene];
     
     //clear下载和上传的已经获取的数据
-    [[uploadFileManager shareInstance] suspendUploadFileFun:YES];
+    [[uploadFileManager shareInstance] suspendUploadFileFun:YES withModel:nil];
     [uploadFileManager shareInstance].databaseArr = [NSMutableArray new];
     [uploadFileManager shareInstance].fileModelDataArr = [NSMutableArray new];
     [uploadFileManager shareInstance].curUploadFileDataModel.curUploadStateType = uploadStateWait;

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

@@ -277,7 +277,7 @@ bool isDownType22 = YES;
 - (void)handleScanCodeResultFun:(NSString*)resultStr
 {
     
-    [[uploadFileManager shareInstance] suspendUploadFileFun:YES];
+    [[uploadFileManager shareInstance] suspendUploadFileFun:YES withModel:nil];
     [[downloadManager shareInstance] suspendDownloadFileFun:YES];
     [[backupsFileManager shareInstance] suspendBackupsFileFun];
     

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

@@ -40,8 +40,8 @@ NS_ASSUME_NONNULL_BEGIN
 
 //把TZAssetModel 转成 我们需要上传的model
 - (void)handlTZAssetModelToUploadFileDataFunBy:(NSMutableArray*)indexPathsForSelectedItems complete:(custom_complete_Arr)complete;
-//暂停上传
-- (void)suspendUploadFileFun:(BOOL)isSuspendAll;
+//暂停上传 当 isSuspendAll为NO时候 传指定暂停哪一个
+- (void)suspendUploadFileFun:(BOOL)isSuspendAll withModel:(uploadFileDataModel*)model;
 //文件重新上传
 - (void)reUploadFileFunBy:(NSMutableArray*)Arr withAll:(BOOL)isAllType;
 

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

@@ -645,16 +645,16 @@ static uploadFileManager * cur_uploadFileShareInstance = nil;
 }
 
 //暂停上传完成
-- (void)suspendUploadFileFun:(BOOL)isSuspendAll
+- (void)suspendUploadFileFun:(BOOL)isSuspendAll withModel:(uploadFileDataModel*)model
 {
     
     if(!_fileModelDataArr || !_curUploadFileDataModel){
         return;
     }
     
-    [[NSNotificationCenter defaultCenter] postNotificationName:uploadFileSuspendNotification object:nil];
-    
     if(isSuspendAll){
+        [[NSNotificationCenter defaultCenter] postNotificationName:uploadFileSuspendNotification object:nil];
+        
         for (uploadFileDataModel*model in _fileModelDataArr) {
             model.curUploadStateType = uploadStateSuspend;
         }
@@ -666,13 +666,23 @@ static uploadFileManager * cur_uploadFileShareInstance = nil;
         }];
     }
     else{
-        
-        _curUploadFileDataModel.curUploadStateType = uploadStateSuspend;
-        [self changeUploadFileState:uploadStateSuspend withDidUploadBytes:_curUploadFileDataModel.didUploadBytes withModel:_curUploadFileDataModel complete:^(BOOL isSuccess) {
+        uploadFileDataModel *curModel = _curUploadFileDataModel;
+        if(model){
+            curModel = model;
+        }
+        else{
+            [[NSNotificationCenter defaultCenter] postNotificationName:uploadFileSuspendNotification object:nil];
+        }
+
+        curModel.curUploadStateType = uploadStateSuspend;
+        [self changeUploadState:uploadStateSuspend withModelArr:@[curModel] complete:^(BOOL isSuccess) {
+            [self->_fileModelDataArr removeObject:model];
+            
+            if(curModel.bg_id.integerValue == self->_curUploadFileDataModel.bg_id.integerValue){
+                //开启下一个任务
+                [self beginUploadFileFun];
+            }
             
-            [self->_fileModelDataArr removeObject:self->_curUploadFileDataModel];
-            //处理完暂停某一个后 开启下一个任务
-            [self beginUploadFileFun];
         }];
         
     }

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

@@ -771,7 +771,7 @@
     _leftTableView.uploadingHeadView.rightButton.selected = !_leftTableView.uploadingHeadView.rightButton.selected;
     
     if(_leftTableView.uploadingHeadView.rightButton.selected){
-        [[uploadFileManager shareInstance] suspendUploadFileFun:YES];
+        [[uploadFileManager shareInstance] suspendUploadFileFun:YES withModel:nil];
         [_leftTableView reloadDataFun];
     }
     else{

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

@@ -474,7 +474,7 @@
 - (void)handleUploadingStateTapFunBy:(BOOL)isSuspendType with:(uploadFileDataModel*)model
 {
     if (isSuspendType) {
-        [[uploadFileManager shareInstance] suspendUploadFileFun:NO];
+        [[uploadFileManager shareInstance] suspendUploadFileFun:NO withModel:model];
     }
     else{
         NSMutableArray*arr = [NSMutableArray new];

+ 2 - 2
创维盒子/双子星云手机/CloudPlayer/PlayerViewController+upLoadFile.m

@@ -302,7 +302,7 @@
                 }
                  else if ([status isEqualToString:@"2"]) {
                      [self clearUploadFileDataFun];
-                     [[uploadFileManager shareInstance] suspendUploadFileFun:YES];
+                     [[uploadFileManager shareInstance] suspendUploadFileFun:YES withModel:nil];
                      
                      NSString *tipStr = NSLocalizedString(@"disk_not_find_tip",nil);
                      mainBlock(^{
@@ -311,7 +311,7 @@
                  }
                  else if ([status isEqualToString:@"5"]) {
                      [self clearUploadFileDataFun];
-                     [[uploadFileManager shareInstance] suspendUploadFileFun:YES];
+                     [[uploadFileManager shareInstance] suspendUploadFileFun:YES withModel:nil];
                      
                      NSString *tipStr = NSLocalizedString(@"disk_space_not_tip",nil);
                      mainBlock(^{