소스 검색

1.修改上传的全部暂停 全部开启bug
2.文件切割异常bug
3.单点消息一分钟发一次

huangxiaodong 1 년 전
부모
커밋
041d3385a6

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

@@ -11,6 +11,8 @@
 #import "RSATool.h"
 #import "connectDeviceManager.h"
 #import "uploadFileManager.h"
+#import "downloadManager.h"
+#import "backupsFileManager.h"
 #import <TZImageManager.h>
 #import <TZImagePickerController.h>
 
@@ -259,6 +261,8 @@ bool isDownType22 = YES;
 {
     
     [[uploadFileManager shareInstance] suspendUploadFileFun:YES];
+    [[downloadManager shareInstance] suspendDownloadFileFun:YES];
+    [[backupsFileManager shareInstance] suspendBackupsFileFun];
     
     NSString *resStr = resultStr;
     if(resStr.length > 22)

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

@@ -246,6 +246,14 @@ static uploadFileManager * cur_uploadFileShareInstance = nil;
         //_curUploadFileDataModel = _fileModelDataArr.lastObject;
     }
     
+//    //做个异常处理
+//    if(_databaseArr.count == 3){
+//        NSMutableArray *uploadIngArr = _databaseArr[0];
+//        if(_fileModelDataArr.count != uploadIngArr.count){
+//            _databaseArr[0] = _fileModelDataArr;
+//        }
+//    }
+    
     
     if(!_curUploadFileDataModel){
         return;
@@ -257,6 +265,9 @@ static uploadFileManager * cur_uploadFileShareInstance = nil;
         _curUploadFileDataModel.imageData = [NSData dataWithContentsOfFile:pathStr];
         
         if(_curUploadFileDataModel.imageData && _curUploadFileDataModel.imageData.length >0){
+            if(_curUploadFileDataModel.totalBytes == 0){
+                _curUploadFileDataModel.totalBytes = _curUploadFileDataModel.imageData.length;
+            }
             
             [[NSNotificationCenter defaultCenter] postNotificationName:uploadFileBeginNotification object:_curUploadFileDataModel];
             return;
@@ -507,14 +518,17 @@ static uploadFileManager * cur_uploadFileShareInstance = nil;
 //暂停上传完成
 - (void)suspendUploadFileFun:(BOOL)isSuspendAll
 {
-//    if(isSuspendAll){
-//
-//    }
     
     if(!_fileModelDataArr || !_curUploadFileDataModel){
         return;
     }
     
+    if(isSuspendAll){
+        for (uploadFileDataModel*model in _fileModelDataArr) {
+            model.curUploadStateType = uploadStateSuspend;
+        }
+    }
+    
     _isSuspendType = YES;
     _isUploadIngType = NO;
     
@@ -536,6 +550,10 @@ static uploadFileManager * cur_uploadFileShareInstance = nil;
         _fileModelDataArr = [NSMutableArray new];
     }
     
+    for (uploadFileDataModel*model in Arr) {
+        model.curUploadStateType = uploadStateUploading;
+    }
+    
     if(isAllType)
     {
         _fileModelDataArr = Arr;

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

@@ -674,6 +674,7 @@
     
     if(_leftTableView.uploadingHeadView.rightButton.selected){
         [[uploadFileManager shareInstance] suspendUploadFileFun:YES];
+        [_leftTableView reloadDataFun];
     }
     else{
         NSMutableArray *leftArr = _leftTableView.uploadingArr;

+ 4 - 3
创维盒子/双子星云手机/Class/Set/uploadFile/uploadFileView/uploadFileRecordCell.m

@@ -309,11 +309,12 @@
 //        totalSize = [curUploadFileDataModel.videoData length];
 //    }
     
-    if(totalSize == 0.0){
-        totalSize += 0.0001;
+    
+    CGFloat curProgress = 0.0;
+    if(totalSize > 1024){
+        curProgress = curUploadFileDataModel.didUploadBytes/(totalSize*1.0);
     }
     
-    CGFloat curProgress = curUploadFileDataModel.didUploadBytes/(totalSize*1.0);
     
     //HLog(@"hxdhxdddddddd %@ -- %f -- %ld",curUploadFileDataModel.bg_id,curProgress,curUploadFileDataModel.didUploadBytes );
     

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

@@ -148,7 +148,7 @@
     
     self.backupsCutFileDataArr = [self backupsFileCutPartsBy:self.backupsAllFileData withDidUpLoadSize:[fileLengthNum integerValue]];
     
-    if(!self.backupsCutFileDataArr){
+    if(!self.backupsCutFileDataArr || self.backupsCutFileDataArr.count == 0){
         [[backupsFileManager shareInstance] getDataWrongToChangeFailFun];
         return;
     }
@@ -176,7 +176,7 @@
 
    // self.cutFileDataArr = [self fileCutPartsBy:self.AllFileData withDidUpLoadSize:[fileLengthNum integerValue]];
     
-    if(!self.backupsCutFileDataArr){
+    if(!self.backupsCutFileDataArr || self.backupsCutFileDataArr.count == 0){
         [self clearBackupsFileDataFun];
         [[backupsFileManager shareInstance] getDataWrongToChangeFailFun];
         

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

@@ -118,7 +118,7 @@
     
     self.cutFileDataArr = [self fileCutPartsBy:self.AllFileData withDidUpLoadSize:[fileLengthNum integerValue]];
     
-    if(!self.cutFileDataArr){
+    if(!self.cutFileDataArr || self.cutFileDataArr.count == 0){
         [self clearUploadFileDataFun];
         [[uploadFileManager shareInstance] uploadFileFailFun];
         
@@ -155,7 +155,7 @@
 
    // self.cutFileDataArr = [self fileCutPartsBy:self.AllFileData withDidUpLoadSize:[fileLengthNum integerValue]];
     
-    if(!self.cutFileDataArr){
+    if(!self.cutFileDataArr ||self.cutFileDataArr.count ==0){
         [self clearUploadFileDataFun];
         [[uploadFileManager shareInstance] uploadFileFailFun];
         
@@ -192,6 +192,11 @@
     if (fileHandle) {
        
         long long endOfFile = [fileHandle seekToEndOfFile];
+        
+        if(self.curUploadFileDataMod.totalBytes == 0){//异常处理
+            self.curUploadFileDataMod.totalBytes = endOfFile;
+        }
+        
         if (endOfFile >=  chunkSize) {
             
             // 读取文件的分段数据到某个位置
@@ -421,8 +426,11 @@
                 NSRange range = NSMakeRange(index*subs, allLength);
                 
                 //NSLog(@"%@",NSStringFromRange(range));
+                NSData *subdata = [data subdataWithRange:range];
                 
-                [dataArray addObject:[data subdataWithRange:range]];
+                if(subdata){
+                    [dataArray addObject:subdata];
+                }
                 
                 allLength = 0;
             }

+ 1 - 1
创维盒子/双子星云手机/CloudPlayer/PlayerViewController.mm

@@ -2859,7 +2859,7 @@ static int  couneeee = 0;
         [self checkAllTaskFun];
         
         _offlineNotTime ++;
-        if(_offlineNotTime > 6){
+        if(_offlineNotTime > 6 && self.commandChannelManager){
             NSString *commondStr  = @"{\"type\":\"forwardMsg\",\"data\":\"offline_notification\"}";
             [self send_data:commondStr];
             _offlineNotTime = 0;