Преглед изворни кода

1.后台文件传输---开发中

huangxiaodong пре 1 година
родитељ
комит
5375832c3d
27 измењених фајлова са 465 додато и 64 уклоњено
  1. 11 2
      创维盒子/双子星云手机/AppDelegate/Config/Const.h
  2. 11 2
      创维盒子/双子星云手机/AppDelegate/Config/Const.m
  3. 1 0
      创维盒子/双子星云手机/Class/Guide/QRCodeScanViewController.m
  4. 6 0
      创维盒子/双子星云手机/Class/Set/ChangeDevice/QRCodeScanForChangeDeviceViewController.m
  5. 1 1
      创维盒子/双子星云手机/Class/Set/uploadFile/fileTransfeSet/backupsSetViewController.h
  6. 3 3
      创维盒子/双子星云手机/Class/Set/uploadFile/fileTransfeSet/backupsSetViewController.m
  7. 296 46
      创维盒子/双子星云手机/Class/Set/uploadFile/fileTransfeSet/fileTransfeSetViewController.m
  8. 3 0
      创维盒子/双子星云手机/Class/Set/uploadFile/uploadFileManager/backupsFileManager.h
  9. 14 1
      创维盒子/双子星云手机/Class/Set/uploadFile/uploadFileManager/backupsFileManager.m
  10. 2 0
      创维盒子/双子星云手机/Class/Set/uploadFile/uploadFileManager/downloadManager.h
  11. 20 1
      创维盒子/双子星云手机/Class/Set/uploadFile/uploadFileManager/downloadManager.m
  12. 2 0
      创维盒子/双子星云手机/Class/Set/uploadFile/uploadFileManager/uploadFileManager.h
  13. 16 1
      创维盒子/双子星云手机/Class/Set/uploadFile/uploadFileManager/uploadFileManager.m
  14. 1 1
      创维盒子/双子星云手机/Class/Set/uploadFile/uploadFileView/backupsFilerecordTableView.m
  15. 1 1
      创维盒子/双子星云手机/Class/Set/view/mySetHeadView.m
  16. 7 0
      创维盒子/双子星云手机/CloudPlayer/PlayerViewController+AppDelegate.m
  17. 1 1
      创维盒子/双子星云手机/CloudPlayer/PlayerViewController+backupsFile.m
  18. 1 1
      创维盒子/双子星云手机/CloudPlayer/PlayerViewController+downloadFile.m
  19. 2 0
      创维盒子/双子星云手机/CloudPlayer/PlayerViewController+otherDelegate.h
  20. 26 0
      创维盒子/双子星云手机/CloudPlayer/PlayerViewController+otherDelegate.mm
  21. 1 1
      创维盒子/双子星云手机/CloudPlayer/PlayerViewController+upLoadFile.m
  22. 1 0
      创维盒子/双子星云手机/CloudPlayer/PlayerViewController.h
  23. 1 0
      创维盒子/双子星云手机/CloudPlayer/PlayerViewController.mm
  24. 5 0
      创维盒子/双子星云手机/Vendor/BackgroundKeepAlive/AudioSessionObject.h
  25. 21 1
      创维盒子/双子星云手机/Vendor/BackgroundKeepAlive/AudioSessionObject.m
  26. 10 0
      创维盒子/双子星云手机/zh-Hans.lproj/Localizable.strings
  27. 1 1
      创维盒子/双子星云手机/zh-Hant.lproj/Localizable.strings

+ 11 - 2
创维盒子/双子星云手机/AppDelegate/Config/Const.h

@@ -87,7 +87,7 @@ UIKIT_EXTERN NSString *const Const_need_random_Change_Params;
 UIKIT_EXTERN NSString *const Const_did_show_image_version_date;
 
 /*标记是否使用流量上传下载*/
-UIKIT_EXTERN NSString *const Const_file_Transfe_canUse_Cellular;
+UIKIT_EXTERN NSString *const Const_file_Transfe_canUse_Cellular_all;
 
 /*标记是否阅读过上传提醒*/
 UIKIT_EXTERN NSString *const Const_file_upLoad_need_read;
@@ -105,7 +105,16 @@ UIKIT_EXTERN NSString *const Const_photo_backups_state;
 UIKIT_EXTERN NSString *const Const_photo_backups_default_path;
 
 /*标记是否使用流量备份*/
-UIKIT_EXTERN NSString *const Const_file_backups_canUse_Cellular;
+//UIKIT_EXTERN NSString *const Const_file_Transfe_canUse_Cellular_all;
+
+/*标记是否开启后台传输文件*/
+UIKIT_EXTERN NSString *const Const_file_Transfe_working_background;
+
+/*标记是否设置过开启后台传输文件*/
+UIKIT_EXTERN NSString *const Const_file_Transfe_didSet_working_background;
+
+/*标记是否开启全速模式*/
+UIKIT_EXTERN NSString *const Const_file_Transfe_full_speed;
 
 /*标记是否阅读过备份提醒*/
 UIKIT_EXTERN NSString *const Const_file_backups_need_read;

+ 11 - 2
创维盒子/双子星云手机/AppDelegate/Config/Const.m

@@ -83,7 +83,7 @@ NSString *const Const_need_random_Change_Params  = @"need_random_Change_Params";
 NSString *const Const_did_show_image_version_date  = @"did_show_image_version_date";
 
 /*标记是否使用流量上传下载*/
-NSString *const Const_file_Transfe_canUse_Cellular  = @"file_Transfe_canUse_Cellular";
+NSString *const Const_file_Transfe_canUse_Cellular_all  = @"file_Transfe_canUse_Cellular_all";
 
 /*标记是否阅读过上传提醒*/
 NSString *const Const_file_upLoad_need_read = @"file_upload_need_read";
@@ -101,7 +101,16 @@ NSString *const Const_photo_backups_state = @"photo_backups_state";
 NSString *const Const_photo_backups_default_path = @"photo_backups_default_path";
 
 /*标记是否使用流量备份*/
-NSString *const Const_file_backups_canUse_Cellular = @"file_backups_canUse_Cellular";
+//NSString *const Const_file_Transfe_canUse_Cellular_all = @"file_backups_canUse_Cellular";
+
+/*标记是否开启后台传输文件*/
+NSString *const Const_file_Transfe_working_background = @"file_Transfe_working_background";
+
+/*标记是否设置过开启后台传输文件*/
+NSString *const Const_file_Transfe_didSet_working_background = @"file_Transfe_didSet_working_background";
+
+/*标记是否开启全速模式*/
+NSString *const Const_file_Transfe_full_speed = @"file_Transfe_full_speed";
 
 /*标记是否阅读过备份提醒*/
 NSString *const Const_file_backups_need_read = @"file_backups_need_read";

+ 1 - 0
创维盒子/双子星云手机/Class/Guide/QRCodeScanViewController.m

@@ -339,6 +339,7 @@ bool isDownType = YES;
 {
     NSDictionary *newDict = [[NSDictionary alloc] initWithObjectsAndKeys:sn,Const_Have_Add_Device_SN, nil];
     [HWDataManager setObjectWithKey:Const_Have_Add_Device value:newDict];
+    [HWDataManager setBoolWithKey:stringKeyAddSn(Const_file_Transfe_working_background) value:YES];
     
     /*下一步*/
     GuideViewController *nextVC = [[GuideViewController alloc] init];

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

@@ -337,6 +337,12 @@ bool isDownType22 = YES;
                 [dict setObject:resStr forKey:Const_Have_Add_Device_SN];
                 [HWDataManager setObjectWithKey:Const_Have_Add_Device value:dict];
                 
+                BOOL didSetBackWork = [HWDataManager getBoolWithKey:stringKeyAddSn(Const_file_Transfe_didSet_working_background)];
+                if(!didSetBackWork){
+                    [HWDataManager setBoolWithKey:stringKeyAddSn(Const_file_Transfe_didSet_working_background) value:YES];
+                    [HWDataManager setBoolWithKey:stringKeyAddSn(Const_file_Transfe_working_background) value:YES];
+                }
+                
                 //尝试修复偶现扫码切换云机 已经扫码到 要输新SN密码 但是云机显示是旧SN的 延时一秒跳转
                 dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
                     [self.navigationController popToRootViewControllerAnimated:NO];

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

@@ -8,7 +8,7 @@
 #import "BaseViewController.h"
 
 NS_ASSUME_NONNULL_BEGIN
-
+//此文件弃用
 @interface backupsSetViewController : BaseViewController
 
 @end

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

@@ -10,7 +10,7 @@
 #import "fileSetTableViewCell.h"
 #import "fileTransferPathCheckViewController.h"
 #import "backupsFileManager.h"
-
+//此文件弃用
 @interface backupsSetViewController ()<UITableViewDelegate,UITableViewDataSource>
 @property (nonatomic, strong) UITableView *tableView;
 @property (nonatomic, strong) UIView *tailView;
@@ -308,7 +308,7 @@
     if (row == 0){
         [cell.titleLabel setText:NSLocalizedString(@"File_backups_set_Cellular",nil)];
         
-        BOOL haveOpenMask = [HWDataManager getBoolWithKey:stringKeyAddSn(Const_file_backups_canUse_Cellular)];
+        BOOL haveOpenMask = [HWDataManager getBoolWithKey:stringKeyAddSn(Const_file_Transfe_canUse_Cellular_all)];
         [cell.maskSwitch setOn:haveOpenMask];
         
         /*上圆角*/
@@ -362,7 +362,7 @@
 - (void)didClickSwitchBy:(BOOL)SwitchOn withRow:(NSInteger)row
 {
     if(row == 0){
-        [HWDataManager setBoolWithKey:stringKeyAddSn(Const_file_backups_canUse_Cellular) value:SwitchOn];
+        [HWDataManager setBoolWithKey:stringKeyAddSn(Const_file_Transfe_canUse_Cellular_all) value:SwitchOn];
     }
     else{
         [HWDataManager setBoolWithKey:stringKeyAddSn(Const_file_backups_battery_level) value:SwitchOn];

+ 296 - 46
创维盒子/双子星云手机/Class/Set/uploadFile/fileTransfeSet/fileTransfeSetViewController.m

@@ -9,11 +9,13 @@
 #import "fileSetTableViewCell.h"
 #import "fileTransferPathCheckViewController.h"
 #import "uploadFileManager.h"
+#import "backupsFileManager.h"
 
 @interface fileTransfeSetViewController ()<UITableViewDelegate,UITableViewDataSource>
 @property (nonatomic, strong) UITableView *tableView;
 @property (nonatomic, strong) UIView *tailView;
 @property (nonatomic, strong) UILabel *uploadFilePathLabel;
+@property (nonatomic, strong) UILabel *backupsFilePathLabel;
 @end
 
 @implementation fileTransfeSetViewController
@@ -25,7 +27,7 @@
     [self.toolBar setHidden:YES];
     [self.navigationBar setHidden:YES];
     [self.navBarBGView setHidden:NO];
-    [self.titleLabel setText:NSLocalizedString(@"set_upload_download_tip",nil)];
+    [self.titleLabel setText:NSLocalizedString(@"set_file_Transfer_WWAN_title",nil)];
     [self.view setBackgroundColor:HWF5F7FAColor];
     
     [self drawAnyView];
@@ -36,6 +38,7 @@
     [super viewWillAppear:animated];
     
     [self setUploadFilePathLabelTitleFun];
+    [self setBackupsFilePathLabelTitleFun];
 }
 
 - (void)drawAnyView{
@@ -81,20 +84,21 @@
 #pragma mark - 懒加载
 - (UIView *)tailView{
     if (!_tailView) {
-        _tailView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_W, 110 +15)];
+        _tailView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_W, 110 +15 + 110)];
         
         UIView *tailBgView = [[UIView alloc] init];
         tailBgView.backgroundColor = [UIColor whiteColor];
         tailBgView.layer.cornerRadius = 8;
+        tailBgView.tag = 1;
         [_tailView addSubview:tailBgView];
         
-        UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didClickTailViewFun)];
+        UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didClickTailViewFun:)];
         [tailBgView addGestureRecognizer:tap];
         
         [tailBgView mas_makeConstraints:^(MASConstraintMaker *make) {
             make.left.mas_equalTo(15);
             make.right.mas_equalTo(-15);
-            make.bottom.mas_equalTo(0);
+            make.height.mas_equalTo(90);
             make.top.mas_equalTo(15);
         }];
         
@@ -138,6 +142,64 @@
         }];
         
         [self setUploadFilePathLabelTitleFun];
+        
+        //相册备份设置
+        UIView *tailBgView2 = [[UIView alloc] init];
+        tailBgView2.backgroundColor = [UIColor whiteColor];
+        tailBgView2.layer.cornerRadius = 8;
+        tailBgView2.tag = 2;
+        [_tailView addSubview:tailBgView2];
+        
+        UITapGestureRecognizer *tap2 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didClickTailViewFun:)];
+        [tailBgView2 addGestureRecognizer:tap2];
+        
+        [tailBgView2 mas_makeConstraints:^(MASConstraintMaker *make) {
+            make.left.mas_equalTo(15);
+            make.right.mas_equalTo(-15);
+            make.height.mas_equalTo(90);
+            make.top.mas_equalTo(tailBgView.mas_bottom).offset(15.0);
+        }];
+        
+        UILabel *titleLab2 = [[UILabel alloc] init];
+        titleLab2.text = NSLocalizedString(@"File_backups_path_set",nil);
+        titleLab2.font = [UIFont boldSystemFontOfSize:14.0];
+        titleLab2.textColor = [UIColor hwColor:@"#0A132B" alpha:1.0];
+        [tailBgView2 addSubview:titleLab2];
+        
+        [titleLab2 mas_makeConstraints:^(MASConstraintMaker *make) {
+            make.left.mas_equalTo(10);
+            make.right.mas_equalTo(-50);
+            make.height.mas_equalTo(20);
+            make.top.mas_equalTo(20);
+        }];
+        
+        /*右侧箭头*/
+        UIImageView *rightImage2 = [[UIImageView alloc] init];
+        [rightImage2 setBackgroundColor:[UIColor clearColor]];
+        [rightImage2 setImage:[UIImage imageNamed:@"cell_right_access"]];
+        [tailBgView2 addSubview:rightImage2];
+        [rightImage2 mas_makeConstraints:^(MASConstraintMaker *make) {
+            make.width.mas_equalTo(28);
+            make.right.mas_equalTo(-15.f);
+            make.height.mas_equalTo(28);
+            make.centerY.equalTo(titleLab2.mas_centerY);
+        }];
+        
+        _backupsFilePathLabel=[[UILabel alloc] init];
+        //titleLab.text = NSLocalizedString(@"File_upload_path_set",nil);
+        _backupsFilePathLabel.font = [UIFont systemFontOfSize:12.0];
+        _backupsFilePathLabel.textColor = [UIColor hwColor:@"#6A6A6A" alpha:1.0];
+        _backupsFilePathLabel.numberOfLines = 0;
+        [tailBgView2 addSubview:_backupsFilePathLabel];
+        
+        [_backupsFilePathLabel mas_makeConstraints:^(MASConstraintMaker *make) {
+            make.left.mas_equalTo(15);
+            make.right.mas_equalTo(-15);
+            make.bottom.mas_equalTo(-10);
+            make.top.mas_equalTo(titleLab2.mas_bottom).offset(10.0);
+        }];
+        
+        [self setBackupsFilePathLabelTitleFun];
     }
     
     return _tailView;
@@ -181,8 +243,58 @@
     _uploadFilePathLabel.attributedText = noteStr;
 }
 
+- (void)setBackupsFilePathLabelTitleFun
+{
+    NSString * leftStr = NSLocalizedString(@"File_backups_path_way_tip2",nil);
+    
+    NSString * backupsDefaultPath = [HWDataManager getStringWithKey:stringKeyAddSn(Const_photo_backups_default_path)];
+    
+    if(!backupsDefaultPath || backupsDefaultPath.length == 0){
+        backupsDefaultPath = Const_default_backups_path;
+        [HWDataManager setStringWithKey:stringKeyAddSn(Const_photo_backups_default_path) value:backupsDefaultPath];
+    }
+    
+    if([backupsDefaultPath containsString:@"mnt/media_rw"]){
+        backupsDefaultPath = [backupsDefaultPath stringByReplacingOccurrencesOfString:@"mnt/media_rw" withString:NSLocalizedString(@"disk_Extra_default_tip",nil)];
+    }
+    else if([backupsDefaultPath containsString:@"storage/emulated/0"]){
+        backupsDefaultPath = [backupsDefaultPath stringByReplacingOccurrencesOfString:@"storage/emulated/0" withString:NSLocalizedString(@"disk_phone_default_tip",nil)];
+    }
+    else if([backupsDefaultPath containsString:@"sdcard"]){
+        backupsDefaultPath = [backupsDefaultPath stringByReplacingOccurrencesOfString:@"sdcard" withString:NSLocalizedString(@"disk_phone_default_tip",nil)];
+    }
+    
+    NSString * rightStr = backupsDefaultPath;
+    
+    NSString *totalStr = [[NSString alloc] initWithFormat:@"%@%@",leftStr,rightStr];
+    
+    NSMutableAttributedString *noteStr = [[NSMutableAttributedString alloc] initWithString:totalStr];
+    
+    NSRange redRange = NSMakeRange([totalStr rangeOfString:rightStr].location, [totalStr rangeOfString:rightStr].length);
+    [noteStr addAttribute:NSForegroundColorAttributeName value:[UIColor hwColor:@"#01B7EA" alpha:0.8] range:redRange];
+    [noteStr addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:12.0] range:redRange];
+    // 设置行间距
+    NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
+    [paragraphStyle setLineSpacing:5];        //设置行间距
+    
+    [noteStr addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, [totalStr  length])];
+    
+    _backupsFilePathLabel.attributedText = noteStr;
+}
 #pragma mark 尾部事件
-- (void)didClickTailViewFun
+- (void)didClickTailViewFun:(UITapGestureRecognizer*)tap
+{
+    UIView *curView = tap.view;
+    
+    if(curView.tag == 1){
+        [self gotoSetUploadPathFun];
+    }
+    else if (curView.tag == 2){
+        [self gotoSetBackupsPathFun];
+    }
+}
+
+-(void)gotoSetUploadPathFun
 {
     uploadFileDataModel* model = [uploadFileManager shareInstance].curUploadFileDataModel;
     
@@ -192,7 +304,7 @@
                 if(Arr && Arr.count== 3){
                     NSArray *uploadingArr = Arr.firstObject;
                     if(uploadingArr.count == 0){
-                        [self gotofileTransferPathCheckVCFun];
+                        [self gotofileTransferPathCheckVCFunWithType:1];
                     }
                     else{
                         [[iToast makeText:NSLocalizedString(@"File_upload_set_default_path_tip",nil)] show];
@@ -232,7 +344,7 @@
         }
         
         if(isExtraFileType && !isExtraPathFind){
-            [self gotofileTransferPathCheckVCFun];
+            [self gotofileTransferPathCheckVCFunWithType:1];
         }
         else{
             [[iToast makeText:NSLocalizedString(@"File_upload_set_default_path_tip",nil)] show];
@@ -240,21 +352,96 @@
         
     }
     else{
-        [self gotofileTransferPathCheckVCFun];
+        [self gotofileTransferPathCheckVCFunWithType:1];
     }
 
 }
 
-- (void)gotofileTransferPathCheckVCFun
+#pragma mark 设置备份路径相关
+- (void)gotoSetBackupsPathFun
+{
+    
+    photosBackupsTaskModel* model = [backupsFileManager shareInstance].curPhotosBackupsTaskMod;
+    
+    if(!model){
+        KWeakSelf
+        [photosBackupsTaskModel bg_findAsync:backups_photos_tableName limit:1 orderBy:nil desc:YES complete:^(NSArray * _Nullable array) {
+            mainBlock(^{
+                if(array && array.count > 0){
+                    photosBackupsTaskModel *preModel = array.lastObject;
+                    if(preModel.curBackupsState == backupsStateUploading
+                        ||preModel.curBackupsState == backupsStateSuspend
+                       ){
+                        [[iToast makeText:NSLocalizedString(@"File_backups_set_default_path_tip",nil)] show];
+                    }
+                    else{
+                        [self gotofileTransferPathCheckVCFunWithType:2];
+                    }
+                }
+                else{
+                    [self gotofileTransferPathCheckVCFunWithType:2];
+                }
+            });
+                
+        }];
+         
+    }
+    else if(model.curBackupsState == backupsStateUploading
+          //|| model.curBackupsState == backupsStateSuspend
+       )
+        {
+         
+         //判断尺寸路径是否存在
+         
+         NSString * uploadDefaultPath = [HWDataManager getStringWithKey:stringKeyAddSn(Const_photo_backups_default_path)];
+         
+         BOOL isExtraFileType = NO;
+         BOOL isExtraPathFind = NO;
+         if(uploadDefaultPath){
+             if(![uploadDefaultPath containsString:@"sdcard/"]){
+                 isExtraFileType = YES;
+             }
+         }
+         
+         if(uploadDefaultPath && ksharedAppDelegate.cloudPhoneExtraFileListMod){
+             NSArray*arr =  ksharedAppDelegate.cloudPhoneExtraFileListMod.data;
+             
+             for (cloudPhoneExtraFileModel*model in arr) {
+                 if([uploadDefaultPath containsString:model.extraPath]){
+                     
+                     isExtraPathFind = YES;
+                     break;
+                 }
+             }
+             
+             
+         }
+         
+         if(isExtraFileType && !isExtraPathFind){
+             [self gotofileTransferPathCheckVCFunWithType:2];
+         }
+         else{
+             [[iToast makeText:NSLocalizedString(@"File_backups_set_default_path_tip",nil)] show];
+         }
+         
+     }
+    else{
+        [self gotofileTransferPathCheckVCFunWithType:2];
+    }
+    
+}
+
+//type 1 上传 2备份
+- (void)gotofileTransferPathCheckVCFunWithType:(NSInteger)type
 {
     fileTransferPathCheckViewController *vc = [fileTransferPathCheckViewController new];
-    vc.curType = 1;
+    vc.curType = type;
     [self.navigationController pushViewController:vc animated:YES];
 }
 
 #pragma mark - 列表委托
 - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
-    return 1;
+    return 3;
 }
 
 - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
@@ -264,7 +451,8 @@
 
 - (fileSetTableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
     
-    __block NSInteger row = indexPath.row;
+    //__block NSInteger row = indexPath.row;
+    __block NSInteger section = indexPath.section;
     static NSString *identifier = @"fileSetTableViewCell";
     
     fileSetTableViewCell * cell =  [tableView dequeueReusableCellWithIdentifier:identifier];
@@ -283,11 +471,22 @@
         
     }
     
+    UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, SCREEN_W-30 , 60)
+                                                   byRoundingCorners:UIRectCornerAllCorners
+                                                         cornerRadii:CGSizeMake(8, 8)];
+    CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
+    maskLayer.frame = cell.cellBgView.bounds;
+    maskLayer.path = maskPath.CGPath;
+    cell.bgViewLayer = maskLayer;
+    cell.cellBgView.layer.mask = cell.bgViewLayer;
+    
+    [cell.lineView setHidden:YES];
     
-    if (row == 0){
-        [cell.titleLabel setText:NSLocalizedString(@"File_Transfer_set_Cellular",nil)];
+    
+    if (section == 0){
+        [cell.titleLabel setText:NSLocalizedString(@"file_Transfer_By_Cellular",nil)];
         
-        BOOL haveOpenMask = [HWDataManager getBoolWithKey:stringKeyAddSn(Const_file_Transfe_canUse_Cellular)];
+        BOOL haveOpenMask = [HWDataManager getBoolWithKey:stringKeyAddSn(Const_file_Transfe_canUse_Cellular_all)];
         [cell.maskSwitch setOn:haveOpenMask];
         
         /*上圆角*/
@@ -295,39 +494,43 @@
 //        UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, SCREEN_W-30 , 60)
 //                                                       byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight
 //                                                             cornerRadii:CGSizeMake(8, 8)];
-        UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, SCREEN_W-30 , 60)
-                                                       byRoundingCorners:UIRectCornerAllCorners
-                                                             cornerRadii:CGSizeMake(8, 8)];
-        CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
-        maskLayer.frame = cell.cellBgView.bounds;
-        maskLayer.path = maskPath.CGPath;
-        cell.bgViewLayer = maskLayer;
-        cell.cellBgView.layer.mask = cell.bgViewLayer;
-        
-        [cell.lineView setHidden:YES];
-        
-    }else if (row == 1){
-        [cell.titleLabel setText:NSLocalizedString(@"File_Transfer_set_battery_level",nil)];
- 
-        BOOL haveOpenMask = [HWDataManager getBoolWithKey:stringKeyAddSn(Const_file_Transfe_battery_level)];
+    }
+    else if (section == 1){
+        [cell.titleLabel setText:NSLocalizedString(@"File_Transfer_background_working",nil)];
+        
+        BOOL haveOpenMask = [HWDataManager getBoolWithKey:stringKeyAddSn(Const_file_Transfe_working_background)];
+        [cell.maskSwitch setOn:haveOpenMask];
+    }
+    else if (section == 2){
+        [cell.titleLabel setText:NSLocalizedString(@"File_Transfer_full_speed",nil)];
+        
+        BOOL haveOpenMask = [HWDataManager getBoolWithKey:stringKeyAddSn(Const_file_Transfe_full_speed)];
         [cell.maskSwitch setOn:haveOpenMask];
-
-        /*下圆角*/
-        UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, SCREEN_W-30 , 60)
-                                                       byRoundingCorners:UIRectCornerBottomLeft | UIRectCornerBottomRight
-                                                             cornerRadii:CGSizeMake(8, 8)];
-        CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
-        maskLayer.frame = cell.cellBgView.bounds;
-        maskLayer.path = maskPath.CGPath;
-        cell.bgViewLayer = maskLayer;
-        cell.cellBgView.layer.mask = cell.bgViewLayer;
-        
-        [cell.lineView setHidden:YES];
     }
+    
+    
+//    else if (row == 1){
+//        [cell.titleLabel setText:NSLocalizedString(@"File_Transfer_set_battery_level",nil)];
+// 
+//        BOOL haveOpenMask = [HWDataManager getBoolWithKey:stringKeyAddSn(Const_file_Transfe_battery_level)];
+//        [cell.maskSwitch setOn:haveOpenMask];
+//
+//        /*下圆角*/
+//        UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, SCREEN_W-30 , 60)
+//                                                       byRoundingCorners:UIRectCornerBottomLeft | UIRectCornerBottomRight
+//                                                             cornerRadii:CGSizeMake(8, 8)];
+//        CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
+//        maskLayer.frame = cell.cellBgView.bounds;
+//        maskLayer.path = maskPath.CGPath;
+//        cell.bgViewLayer = maskLayer;
+//        cell.cellBgView.layer.mask = cell.bgViewLayer;
+//        
+//        [cell.lineView setHidden:YES];
+//    }
 
     KWeakSelf
     cell.didClickSwitch = ^(BOOL SwitchOn) {
-        [weakSelf didClickSwitchBy:SwitchOn withRow:row];
+        [weakSelf didClickSwitchBy:SwitchOn withRow:section];
     };
     
     return cell;
@@ -337,14 +540,61 @@
     return 60;
 }
 
+- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
+    if(section==2){
+        return 5+10+30;
+    }
+    return 5+10+20;
+}
+
+- (UIView*)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
+    
+    UIView *tailView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_W, 5+10+20)];
+    if(section==2){
+        tailView.frame = CGRectMake(0, 0, SCREEN_W, 5+10+30);
+    }
+    
+    UILabel *lab = [[UILabel alloc] init];
+    lab.font = [UIFont systemFontOfSize:12.0];
+    lab.textColor = [UIColor hwColor:@"666666" alpha:1.0];
+    lab.numberOfLines = 0;
+    //lab.backgroundColor = [UIColor redColor];
+    [tailView addSubview:lab];
+    
+    [lab mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.left.mas_equalTo(15);
+        make.right.mas_equalTo(-15);
+        make.bottom.mas_equalTo(-10);
+        make.top.mas_equalTo(5);
+    }];
+    
+    if(section==0){
+        [lab setText:NSLocalizedString(@"File_Transfer_By_Cellular_tip2",nil)];
+    }
+    else if(section==1){
+        [lab setText:NSLocalizedString(@"File_Transfer_background_working_tip",nil)];
+    }
+    else if(section==2){
+        [lab setText:NSLocalizedString(@"File_Transfer_full_speed_tip",nil)];
+    }
+    
+    return  tailView;
+}
+
 - (void)didClickSwitchBy:(BOOL)SwitchOn withRow:(NSInteger)row
 {
     if(row == 0){
-        [HWDataManager setBoolWithKey:stringKeyAddSn(Const_file_Transfe_canUse_Cellular) value:SwitchOn];
+        [HWDataManager setBoolWithKey:stringKeyAddSn(Const_file_Transfe_canUse_Cellular_all) value:SwitchOn];
     }
-    else{
-        [HWDataManager setBoolWithKey:stringKeyAddSn(Const_file_Transfe_battery_level) value:SwitchOn];
+    else if(row == 1){
+        [HWDataManager setBoolWithKey:stringKeyAddSn(Const_file_Transfe_working_background) value:SwitchOn];
+    }
+    else if(row == 2){
+        [HWDataManager setBoolWithKey:stringKeyAddSn(Const_file_Transfe_full_speed) value:SwitchOn];
     }
+//    else{
+//        [HWDataManager setBoolWithKey:stringKeyAddSn(Const_file_Transfe_battery_level) value:SwitchOn];
+//    }
 }
 
 @end

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

@@ -39,6 +39,9 @@ NS_ASSUME_NONNULL_BEGIN
 
 //检查是否需要重新备份
 - (void)checkReBackupsFileFun;
+
+//检查是否在备份中
+- (BOOL)checkBackupsingFun;
 @end
 
 NS_ASSUME_NONNULL_END

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

@@ -175,7 +175,7 @@ static backupsFileManager * cur_backupsFileShareInstance = nil;
 
 - (void)beginBackupsFileFun
 {
-    BOOL isCanUseCellular = [HWDataManager getBoolWithKey:stringKeyAddSn(Const_file_backups_canUse_Cellular)];
+    BOOL isCanUseCellular = [HWDataManager getBoolWithKey:stringKeyAddSn(Const_file_Transfe_canUse_Cellular_all)];
     if(!isCanUseCellular){//不允许流量上传
         //
         if([AFNetworkReachabilityManager sharedManager].networkReachabilityStatus == AFNetworkReachabilityStatusReachableViaWWAN){
@@ -397,4 +397,17 @@ static backupsFileManager * cur_backupsFileShareInstance = nil;
     
     [self beginBackupsFileFun];
 }
+
+//检查是否在备份中
+- (BOOL)checkBackupsingFun{
+    if(!_curPhotosBackupsTaskMod){
+        return NO;
+    }
+    
+    if(_curPhotosBackupsTaskMod.curBackupsState != backupsStateUploading){
+        return NO;
+    }
+    
+    return YES;
+}
 @end

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

@@ -40,6 +40,8 @@ NS_ASSUME_NONNULL_BEGIN
 //删除本地数据库记录
 - (void)deleteDownloadFileRecordBy:(NSMutableArray *)delArr withDelCache:(BOOL)isDelCache;
 - (void)checkReDownloadFileFun;
+//检测是否未下载中
+- (BOOL)checkDownloadingFun;
 - (void)checkHadDownloadTaskWithComplete:(custom_complete_B)complete;
 @end
 

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

@@ -210,7 +210,7 @@ static downloadManager * cur_downloadManager = nil;
         return;
     }
     
-    BOOL isCanUseCellular = [HWDataManager getBoolWithKey:stringKeyAddSn(Const_file_Transfe_canUse_Cellular)];
+    BOOL isCanUseCellular = [HWDataManager getBoolWithKey:stringKeyAddSn(Const_file_Transfe_canUse_Cellular_all)];
     if(!isCanUseCellular){//不允许流量上传
         //
         if([AFNetworkReachabilityManager sharedManager].networkReachabilityStatus == AFNetworkReachabilityStatusReachableViaWWAN){
@@ -551,6 +551,25 @@ static downloadManager * cur_downloadManager = nil;
     [[NSNotificationCenter defaultCenter] postNotificationName:downloadFileBeginNotification object:_curDownloadFileModel];
 }
 
+- (BOOL)checkDownloadingFun
+{
+    if(!_curDownloadFileModel){
+        return NO;
+    }
+    
+    if(_curDownloadFileModel.curDownloadStateType == downloadStateDone
+       ||_curDownloadFileModel.curDownloadStateType == downloadStateFail
+       ||_curDownloadFileModel.curDownloadStateType == downloadStateSuspend){
+        return NO;
+    }
+    
+    if(_isSuspendType){
+        return NO;
+    }
+    
+    return YES;
+}
+
 - (void)didDownloadAllTaskDoneFun
 {
     [[NSNotificationCenter defaultCenter] postNotificationName:downloadFileAllTaskDoneNotification object:nil];

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

@@ -57,6 +57,8 @@ NS_ASSUME_NONNULL_BEGIN
 - (void)deleteUploadFileRecordBy:(NSMutableArray *)delArr withDelCache:(BOOL)isDelCache complete:(custom_complete_B)complete;
 
 - (void)checkReUploadFileFun;
+//检测是否在上传中
+- (BOOL)checkUploadingFun;
 
 - (void)checkHadUploadTaskWithComplete:(custom_complete_B)complete;
 @end

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

@@ -250,7 +250,7 @@ static uploadFileManager * cur_uploadFileShareInstance = nil;
 //        return;
 //    }
     
-    BOOL isCanUseCellular = [HWDataManager getBoolWithKey:stringKeyAddSn(Const_file_Transfe_canUse_Cellular)];
+    BOOL isCanUseCellular = [HWDataManager getBoolWithKey:stringKeyAddSn(Const_file_Transfe_canUse_Cellular_all)];
     if(!isCanUseCellular){//不允许流量上传
         //
         if([AFNetworkReachabilityManager sharedManager].networkReachabilityStatus == AFNetworkReachabilityStatusReachableViaWWAN){
@@ -937,6 +937,21 @@ static uploadFileManager * cur_uploadFileShareInstance = nil;
     [[NSNotificationCenter defaultCenter] postNotificationName:uploadFileBeginNotification object:_curUploadFileDataModel];
 }
 
+- (BOOL)checkUploadingFun
+{
+    if(!_curUploadFileDataModel
+       || _curUploadFileDataModel.curUploadStateType == uploadStateDone
+       || _curUploadFileDataModel.curUploadStateType == uploadStateSuspend){
+        return NO;
+    }
+    
+    if(_isSuspendType){
+        return NO;
+    }
+    
+    return YES;
+}
+
 - (void)checkHadUploadTaskWithComplete:(custom_complete_B)complete
 {
     [self getDataInDatabaseFun:NO complete:^(NSMutableArray * _Nonnull Arr) {

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

@@ -258,7 +258,7 @@
             return;
         }
         
-        BOOL isCanUseCellular = [HWDataManager getBoolWithKey:stringKeyAddSn(Const_file_backups_canUse_Cellular)];
+        BOOL isCanUseCellular = [HWDataManager getBoolWithKey:stringKeyAddSn(Const_file_Transfe_canUse_Cellular_all)];
 
         if(!isCanUseCellular){//不允许流量备份
             //

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

@@ -486,7 +486,7 @@
 
 - (void)openImageBackupsFun
 {
-    BOOL isCanUseCellular = [HWDataManager getBoolWithKey:stringKeyAddSn(Const_file_backups_canUse_Cellular)];
+    BOOL isCanUseCellular = [HWDataManager getBoolWithKey:stringKeyAddSn(Const_file_Transfe_canUse_Cellular_all)];
     if(!isCanUseCellular){//不允许流量上传
         //
         if([AFNetworkReachabilityManager sharedManager].networkReachabilityStatus == AFNetworkReachabilityStatusReachableViaWWAN){

+ 7 - 0
创维盒子/双子星云手机/CloudPlayer/PlayerViewController+AppDelegate.m

@@ -13,6 +13,8 @@
 #import "ShortcutManager.h"
 #import <objc/runtime.h>
 #import "RCCommandHelp.h"
+#import "AudioSessionObject.h"
+#import "PlayerViewController+otherDelegate.h"
 
 //@interface PlayerViewController(AppDelegate)
 //
@@ -64,6 +66,11 @@
     
     self.needToDissconnectType = YES;
     [self disconnectVideoServer];
+    
+    HLog(@"开始进入后台");
+    [cachesFileManager writeLogsWithMsg:@"EnterBackground"];
+    
+    [AudioSessionObject shareManager];
 }
 
 - (void)applicationDidBecomeActive:(NSNotification *)notification

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

@@ -330,7 +330,7 @@
     }
 
     
-    BOOL isCanUseCellular = [HWDataManager getBoolWithKey:stringKeyAddSn(Const_file_backups_canUse_Cellular)];
+    BOOL isCanUseCellular = [HWDataManager getBoolWithKey:stringKeyAddSn(Const_file_Transfe_canUse_Cellular_all)];
 
     if(!isCanUseCellular){//不允许流量备份
         //

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

@@ -107,7 +107,7 @@
             return;
         }
         
-        BOOL isCanUseCellular = [HWDataManager getBoolWithKey:stringKeyAddSn(Const_file_Transfe_canUse_Cellular)];
+        BOOL isCanUseCellular = [HWDataManager getBoolWithKey:stringKeyAddSn(Const_file_Transfe_canUse_Cellular_all)];
         if(!isCanUseCellular){//不允许流量上传
             //
             if([AFNetworkReachabilityManager sharedManager].networkReachabilityStatus == AFNetworkReachabilityStatusReachableViaWWAN){

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

@@ -37,6 +37,8 @@ NS_ASSUME_NONNULL_BEGIN
 - (void)handleDownloadResponseFunBy:(id)message;
 
 - (void)checkAllTaskFun;
+//检测是否正在进行的文件传输任务
+- (void)checkFileTransfeTaskFun;
 - (void)addCommandSendTaskFunWithType:(NSString*)type WithCommandStr:(NSString*)commandStr;
 - (void)deleteCommandSendTaskFunWith:(NSString*)type;
 - (void)getExtraFilesResponseFun:(NSDictionary *)dataDict;

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

@@ -436,6 +436,32 @@
     [[downloadManager shareInstance] checkReDownloadFileFun];
     
     [self checkCommandSendTaskFun];
+    
+    if([AudioSessionObject shareManager].isBackgroundType){
+        [self checkFileTransfeTaskFun];
+    }
+    
+    HLog(@"checkAllTaskFun");
+}
+
+//检测是否正在进行的文件传输任务
+- (void)checkFileTransfeTaskFun
+{
+    
+   BOOL isBackupsingType = [[backupsFileManager shareInstance] checkBackupsingFun];
+   BOOL isUploadingType = [[uploadFileManager shareInstance] checkUploadingFun];
+   BOOL isDownloadingType = [[downloadManager shareInstance] checkDownloadingFun];
+    
+    if (isBackupsingType || isUploadingType || isDownloadingType) {
+        HLog(@"后台保活中");
+        [cachesFileManager writeLogsWithMsg:@"Background working"];
+    }
+    else{
+        HLog(@"停止后台保活");
+        [cachesFileManager writeLogsWithMsg:@"stop Background working"];
+        [[AudioSessionObject shareManager] stopBackgroundActiveFun];
+    }
+    
 }
 
 -(void)addCommandSendTaskFunWithType:(NSString*)type WithCommandStr:(NSString*)commandStr

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

@@ -349,7 +349,7 @@
         return;
     }
     
-    BOOL isCanUseCellular = [HWDataManager getBoolWithKey:stringKeyAddSn(Const_file_Transfe_canUse_Cellular)];
+    BOOL isCanUseCellular = [HWDataManager getBoolWithKey:stringKeyAddSn(Const_file_Transfe_canUse_Cellular_all)];
     
     if(!isCanUseCellular){//不允许流量备份
         //

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

@@ -27,6 +27,7 @@
 #import "USBInsertPopView.h"
 #import "cloudPhoneCommonModel.h"
 #import "ComontAlretViewController.h"
+#import "AudioSessionObject.h"
 
 @protocol PlayerViewControllerDelegate <NSObject>
 

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

@@ -2997,6 +2997,7 @@ static int  couneeee = 0;
 - (void)timerChange {
     
     //self.currentTime++;// 0、定时器计数
+    //HLog(@"111111111111111");
     
     [self extensionAdjustBtnFrameCheckAdjustTime];// 1、悬浮球3s后 自动靠边隐藏
     

+ 5 - 0
创维盒子/双子星云手机/Vendor/BackgroundKeepAlive/AudioSessionObject.h

@@ -10,6 +10,8 @@
 NS_ASSUME_NONNULL_BEGIN
 
 @interface AudioSessionObject : NSObject
+@property (nonatomic, assign) BOOL isBackgroundType;
+
 /// 创建单利
 + (AudioSessionObject *)shareManager;
 
@@ -21,6 +23,9 @@ NS_ASSUME_NONNULL_BEGIN
 
 /// 停止播放音乐
 - (void)stopPlayAudioSession;
+
+//停止后台活跃
+- (void)stopBackgroundActiveFun;
 @end
 
 NS_ASSUME_NONNULL_END

+ 21 - 1
创维盒子/双子星云手机/Vendor/BackgroundKeepAlive/AudioSessionObject.m

@@ -35,6 +35,7 @@
     if (self) {
         [self addNoti];
         [self creatAVAudioSessionObject];
+        _isBackgroundType = YES;
     }
     return self;
 }
@@ -54,6 +55,15 @@
 
 - (void)appDidEnterBackground {
     NSLog(@"%@ appDidEnterBackground",NSStringFromClass([self class]));
+    
+//    BOOL isBackground = [HWDataManager getBoolWithKey:stringKeyAddSn(Const_file_Transfe_working_background)];
+//    if (!isBackground) {
+//        return;
+//    }
+//    
+//    _isBackgroundType = YES;
+    
+    [[AVAudioSession sharedInstance] setActive: YES error: nil];
     [self startPlayAudioSession];
     
     
@@ -85,9 +95,19 @@
 - (void)stopPlayAudioSession{
     NSLog(@"%@ stopPlayAudioSession",NSStringFromClass([self class]));
    [_audioPlayer stop];
+    _isBackgroundType = NO;
 }
 
- 
+ - (void)stopBackgroundActiveFun
+{
+    [self stopPlayAudioSession];
+    [self.timer invalidate];
+    [[UIApplication sharedApplication] endBackgroundTask:self.self.backgrounTask];
+    
+    //设置后台模式和锁屏模式下依然能够播放
+    //[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback withOptions:AVAudioSessionCategoryOptionMixWithOthers error:nil];
+    [[AVAudioSession sharedInstance] setActive: NO error: nil];
+}
  
 #pragma mark - 定时器设置判断后台保活时间,如果将要被后台杀死,重新唤醒
 - (void)applyToSystemForMoreTime {

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

@@ -411,3 +411,13 @@
 "download_video_disable_state"   = "IOS系统仅支持MP4、MOV、3GP、M4V 的视频格式,其他格式无法下载";
 "download_image_disable_state"   = "IOS系统仅支持JPG 、PNG、GIF、TIFF、BMP,heic,jpeg,heif的图片格式,其他格式无法下载";
 "download_image_to_album_fail"   = "保存到相册失败";
+
+//1.4
+"set_file_Transfer_WWAN_title" = "传输设置";
+"file_Transfer_By_Cellular"   = "手机流量传输";
+"File_Transfer_By_Cellular_tip2"   = "开启状态WIFI与流量均支持传输";
+"File_Transfer_background_working"   = "后台运行";
+"File_Transfer_background_working_tip"   = "开启后台文件传输,将会消耗您的电量和流量";
+"File_Transfer_full_speed"   = "全速模式";
+"File_Transfer_full_speed_tip"   = "开启全速模式传输速度将会加快。建议在不使用云机的情况下开启,开启可能会影响云机操作体验";
+"File_backups_path_way_tip2"   = "相册文件默认备份至:";

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

@@ -214,7 +214,7 @@
 
 "single_sign_on_Tips_logout" = "下線通知";
 "single_sign_on_Tips_one" = "您的Private-x與";
-"single_sign_on_Tips_two" = "在另一台手機登錄了。如非本人操作,則密碼可能已洩漏,建議前往修改密碼";
+"single_sign_on_Tips_two" = "在另一台設備登錄了。如非本人操作,則密碼可能已洩漏,建議前往修改密碼";
 "single_sign_on_exit" = "退出";
 "single_sign_on_login_again" = "重新登錄";