Browse Source

1. 备份暂停和开启

huangxiaodong 1 year ago
parent
commit
dfb4769958

+ 7 - 2
创维盒子/双子星云手机/Class/Set/uploadFile/photoView/backupsFileRecordCell.m

@@ -237,12 +237,12 @@
     _fileImageView.image = [UIImage imageNamed:@"uploadFile_image"];
     
     _fileSpeedlabel.hidden = YES;
+    _rightTiplabel.hidden = YES;
+    _progressBgView.hidden = NO;
     
     if(_curPhotosBackupsTaskModel.curBackupsState == backupsStateUploading){
        
         _upLoadStateButton.hidden = NO;
-        _progressBgView.hidden = NO;
-        _rightTiplabel.hidden = YES;
         
         [_upLoadStateButton setImage:[UIImage imageNamed:@"uploadFile_suspend"] forState:UIControlStateNormal];
         _fileSpeedlabel.hidden = NO;
@@ -274,7 +274,12 @@
         _curPhotosBackupsTaskModel.preTimeInterval = _curPhotosBackupsTaskModel.curTimeInterval;
     }
     else if(_curPhotosBackupsTaskModel.curBackupsState == backupsStateSuspend){
+        
         [_upLoadStateButton setImage:[UIImage imageNamed:@"uploadFile_start"] forState:UIControlStateNormal];
+        _fileSpeedlabel.text = _curPhotosBackupsTaskModel.backupsTipMsg;
+        _fileSpeedlabel.hidden = NO;
+        
+        _upLoadStateButton.hidden = NO;
     }
     else if(_curPhotosBackupsTaskModel.curBackupsState == backupsStateFail){
         _upLoadStateButton.hidden = YES;

+ 36 - 35
创维盒子/双子星云手机/Class/Set/uploadFile/photoView/backupsFilerecordTableView.m

@@ -8,7 +8,7 @@
 #import "backupsFilerecordTableView.h"
 
 #import "UIScrollView+EmptyDataSet.h"
-#import "uploadFileManager.h"
+#import "backupsFileManager.h"
 #import "backupsFileRecordCell.h"
 
 @interface backupsFilerecordTableView()<UITableViewDataSource,UITableViewDelegate,DZNEmptyDataSetSource, DZNEmptyDataSetDelegate>
@@ -199,10 +199,10 @@
 
             cell.didTapPressClick = ^{
                 if(model.curBackupsState == backupsStateUploading){
-                    //[weakSelf handleUploadingStateTapFunBy:YES with:model];
+                    [weakSelf handleBackupsingStateTapFunBy:YES with:model];
                 }
                 else if(model.curBackupsState == backupsStateSuspend){
-                    //[weakSelf handleUploadingStateTapFunBy:NO with:model];
+                    [weakSelf handleBackupsingStateTapFunBy:NO with:model];
                 }
                 
             };
@@ -416,35 +416,36 @@
 
 #pragma mark 单个点击选中后删除
 - (void)deleteModelOneByOneFun{
-    if(!_selectModelArr || _selectModelArr.count==0){
-        
-        return;
-    }
-    
-    KWeakSelf
-    [[uploadFileManager shareInstance] deleteUploadFileRecordBy:_selectModelArr withDelCache:YES complete:^(BOOL isSuccess) {
-        HLog(@"isSuccess:%d",isSuccess);
-        
-        if(isSuccess){
-            NSMutableArray *curArr = self->_curDataArr;
-            [curArr removeObjectsInArray:self->_selectModelArr];
-            [weakSelf reloadDataFun];
-            self->_selectModelArr = [NSMutableArray new];
-        }
-    }];
+//    if(!_selectModelArr || _selectModelArr.count==0){
+//
+//        return;
+//    }
+//
+//    KWeakSelf
+//    [[uploadFileManager shareInstance] deleteUploadFileRecordBy:_selectModelArr withDelCache:YES complete:^(BOOL isSuccess) {
+//        HLog(@"isSuccess:%d",isSuccess);
+//
+//        if(isSuccess){
+//            NSMutableArray *curArr = self->_curDataArr;
+//            [curArr removeObjectsInArray:self->_selectModelArr];
+//            [weakSelf reloadDataFun];
+//            self->_selectModelArr = [NSMutableArray new];
+//        }
+//    }];
 }
 
 
 #pragma mark 处理上传中的 状态点击事件
-- (void)handleUploadingStateTapFunBy:(BOOL)isSuspendType with:(uploadFileDataModel*)model
+- (void)handleBackupsingStateTapFunBy:(BOOL)isSuspendType  with:(photosBackupsTaskModel*)model
 {
     if (isSuspendType) {
-        [[uploadFileManager shareInstance] suspendUploadFileFun:NO];
+        model.isSuspendType = YES;
+        model.curBackupsState = backupsStateSuspend;
+        
+        [[backupsFileManager shareInstance] suspendBackupsFileFun];
     }
     else{
-        NSMutableArray*arr = [NSMutableArray new];
-        [arr addObject:model];
-        [[uploadFileManager shareInstance] reUploadFileFunBy:arr];
+        [[backupsFileManager shareInstance] reBackupsFileFunBy:model];
     }
     
 }
@@ -452,17 +453,17 @@
 #pragma mark 处理上传中的 状态点击事件
 - (void)handleUploadFailStateWith:(uploadFileDataModel*)model{
     
-    [_curDataArr removeObject:model];
-    [self reloadDataFun];
-    
-    if(_didClickReUploadBlock){
-        _didClickReUploadBlock(model);
-    }
-    
-    NSMutableArray*arr = [NSMutableArray new];
-    model.curUploadStateType = uploadStateWait;
-    [arr addObject:model];
-    [[uploadFileManager shareInstance] reUploadFileFunBy:arr];
+//    [_curDataArr removeObject:model];
+//    [self reloadDataFun];
+//
+//    if(_didClickReUploadBlock){
+//        _didClickReUploadBlock(model);
+//    }
+//
+//    NSMutableArray*arr = [NSMutableArray new];
+//    model.curUploadStateType = uploadStateWait;
+//    [arr addObject:model];
+//    [[uploadFileManager shareInstance] reUploadFileFunBy:arr];
     
 }
 @end

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

@@ -30,6 +30,10 @@ NS_ASSUME_NONNULL_BEGIN
 
 //修改文件上传的状态
 - (void)changeBackupsFileStateWithSpeedFun;
+
+- (void)suspendBackupsFileFun;
+//文件重新备份
+- (void)reBackupsFileFunBy:(photosBackupsTaskModel*)model;
 @end
 
 NS_ASSUME_NONNULL_END

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

@@ -260,4 +260,35 @@ static backupsFileManager * cur_backupsFileShareInstance = nil;
     [[NSNotificationCenter defaultCenter] postNotificationName:backupsFileRefreshNotification object:_curPhotosBackupsTaskMod];
 }
 
+- (void)suspendBackupsFileFun
+{
+    if(!_curPhotosBackupsTaskMod){
+        return;
+    }
+    
+    _curPhotosBackupsTaskMod.curBackupsState = backupsStateSuspend;
+    _curPhotosBackupsTaskMod.backupsTipMsg = NSLocalizedString(@"File_backups_Record_tip_Suspend",nil);
+    
+    [_curPhotosBackupsTaskMod bg_saveOrUpdateAsync:^(BOOL isSuccess) {
+        if(isSuccess){
+            [self changeBackupsFileStateWithSpeedFun];
+        }
+    }];
+    
+}
+
+//文件重新备份
+- (void)reBackupsFileFunBy:(photosBackupsTaskModel*)model
+{
+    model.isSuspendType = NO;
+    model.curBackupsState = backupsStateUploading;
+    _curPhotosBackupsTaskMod = model;
+    
+    [_curPhotosBackupsTaskMod bg_saveOrUpdateAsync:^(BOOL isSuccess) {
+        if(isSuccess){
+            [self beginBackupsFileFun];
+        }
+    }];
+    
+}
 @end

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

@@ -264,14 +264,8 @@
 #pragma mark 处理上传过程
 - (void)handleBackupsingFun:(NSNumber*)fileLengthNum
 {
-    if(self.isSuspendBackupsType){
-        //暂停
-//        self.taskUid = nil;
-//        NSInteger didUploadSize = fileLengthNum.longLongValue;
-//        [[uploadFileManager shareInstance] changeUploadFileState:uploadStateSuspend withDidUploadBytes:didUploadSize  withModel:self.curUploadFileDataMod complete:^(BOOL isSuccess) {
-//
-//        }];
-        
+    if(self.curPhotosBackupsTaskMod.isSuspendType){
+        [self clearBackupsFileDataFun];
         return;
     }
     
@@ -302,7 +296,6 @@
     self.backupsIndexOfUploadFlie = 0;
     self.backupsCutFileDataArr = nil;
     self.curPhotosBackupsTaskMod = nil;
-    self.isSuspendBackupsType = NO;
     
 }
 

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

@@ -120,8 +120,6 @@
 @property (nonatomic, assign) NSInteger backupsIndexOfUploadFlie;
 //@property (nonatomic, assign) NSInteger cutFileEachPieceSzie;
 @property (nonatomic, strong) photosBackupsTaskModel *curPhotosBackupsTaskMod;
-@property (nonatomic, assign) BOOL isSuspendBackupsType;
-
 
 
 /**

+ 1 - 1
创维盒子/双子星云手机/zh-Hans.lproj/Localizable.strings

@@ -351,4 +351,4 @@
 "File_Transfer_List_head_title_ing"   = "正在传输";
 "File_Transfer_List_head_title_fail"   = "传输失败";
 "File_Transfer_List_head_title_done"   = "已完成";
-
+"File_backups_Record_tip_Suspend"   = "已暂停";