huangxiaodong 1 рік тому
батько
коміт
2c5e530000

+ 12 - 0
创维盒子/双子星云手机.xcodeproj/project.pbxproj

@@ -227,6 +227,10 @@
 		6B3AD6852BF48DBA0096D6B7 /* shareRecordDetailsHWViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B3AD6832BF48DBA0096D6B7 /* shareRecordDetailsHWViewController.m */; };
 		6B3AD6862BF48DBA0096D6B7 /* shareRecordDetailsHWViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B3AD6832BF48DBA0096D6B7 /* shareRecordDetailsHWViewController.m */; };
 		6B3AD6872BF48DBA0096D6B7 /* shareRecordDetailsHWViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B3AD6822BF48DBA0096D6B7 /* shareRecordDetailsHWViewController.h */; };
+		6B3AD68A2BF4AE630096D6B7 /* backupsOptionViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B3AD6882BF4AE630096D6B7 /* backupsOptionViewController.h */; };
+		6B3AD68B2BF4AE630096D6B7 /* backupsOptionViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B3AD6892BF4AE630096D6B7 /* backupsOptionViewController.m */; };
+		6B3AD68C2BF4AE630096D6B7 /* backupsOptionViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B3AD6892BF4AE630096D6B7 /* backupsOptionViewController.m */; };
+		6B3AD68D2BF4AE630096D6B7 /* backupsOptionViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B3AD6882BF4AE630096D6B7 /* backupsOptionViewController.h */; };
 		6B3F96342AD2A15A008E349E /* netWorkManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B3F96322AD2A15A008E349E /* netWorkManager.h */; };
 		6B3F96352AD2A15A008E349E /* netWorkManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B3F96332AD2A15A008E349E /* netWorkManager.m */; };
 		6B3F963A2AD2AD0B008E349E /* newWorkInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B3F96392AD2AD0B008E349E /* newWorkInterface.h */; };
@@ -1101,6 +1105,8 @@
 		6B3A4B142B6F69A500F74679 /* cloudPhoneCommonModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = cloudPhoneCommonModel.m; sourceTree = "<group>"; };
 		6B3AD6822BF48DBA0096D6B7 /* shareRecordDetailsHWViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = shareRecordDetailsHWViewController.h; sourceTree = "<group>"; };
 		6B3AD6832BF48DBA0096D6B7 /* shareRecordDetailsHWViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = shareRecordDetailsHWViewController.m; sourceTree = "<group>"; };
+		6B3AD6882BF4AE630096D6B7 /* backupsOptionViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = backupsOptionViewController.h; sourceTree = "<group>"; };
+		6B3AD6892BF4AE630096D6B7 /* backupsOptionViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = backupsOptionViewController.m; sourceTree = "<group>"; };
 		6B3F96322AD2A15A008E349E /* netWorkManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = netWorkManager.h; sourceTree = "<group>"; };
 		6B3F96332AD2A15A008E349E /* netWorkManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = netWorkManager.m; sourceTree = "<group>"; };
 		6B3F96392AD2AD0B008E349E /* newWorkInterface.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = newWorkInterface.h; sourceTree = "<group>"; };
@@ -1977,6 +1983,8 @@
 				6B9354A52BF3848D00AA8D31 /* shareRecordViewController.m */,
 				6B3AD6822BF48DBA0096D6B7 /* shareRecordDetailsHWViewController.h */,
 				6B3AD6832BF48DBA0096D6B7 /* shareRecordDetailsHWViewController.m */,
+				6B3AD6882BF4AE630096D6B7 /* backupsOptionViewController.h */,
+				6B3AD6892BF4AE630096D6B7 /* backupsOptionViewController.m */,
 			);
 			path = previewFile;
 			sourceTree = "<group>";
@@ -2657,6 +2665,7 @@
 				184C8AD52A949D5900F26650 /* AboutViewController.h in Headers */,
 				6B34DC672BF1FFB1002DD1EF /* imageCollectionViewCell.h in Headers */,
 				6B0581A22AFCF50300D37290 /* AJPhotoListCell.h in Headers */,
+				6B3AD68A2BF4AE630096D6B7 /* backupsOptionViewController.h in Headers */,
 				187076772A9F400300F15F7F /* PlayerLoadingView.h in Headers */,
 				6B1CC2CE2B6B6D6B00AD4217 /* commandSendCheckModel.h in Headers */,
 				6B0581602AFCD0DF00D37290 /* uploadImageOrVideoViewController.h in Headers */,
@@ -2798,6 +2807,7 @@
 				6BD506F22B9576A4006E7CB0 /* AboutViewController.h in Headers */,
 				6B34DC692BF1FFB1002DD1EF /* imageCollectionViewCell.h in Headers */,
 				6BD506F32B9576A4006E7CB0 /* AJPhotoListCell.h in Headers */,
+				6B3AD68D2BF4AE630096D6B7 /* backupsOptionViewController.h in Headers */,
 				6BD506F42B9576A4006E7CB0 /* PlayerLoadingView.h in Headers */,
 				6BD506F52B9576A4006E7CB0 /* commandSendCheckModel.h in Headers */,
 				6BD506F62B9576A4006E7CB0 /* uploadImageOrVideoViewController.h in Headers */,
@@ -3230,6 +3240,7 @@
 				6BD507262B9576A4006E7CB0 /* UIColor+Colors.m in Sources */,
 				6BD507272B9576A4006E7CB0 /* AJPhotoListView.m in Sources */,
 				6BD507282B9576A4006E7CB0 /* PwdInPutView.m in Sources */,
+				6B3AD68C2BF4AE630096D6B7 /* backupsOptionViewController.m in Sources */,
 				6BD507292B9576A4006E7CB0 /* RYShearDeviceUDPManager.m in Sources */,
 				6BD5072A2B9576A4006E7CB0 /* TipsQRCodeForChangeDeviceViewController.m in Sources */,
 				6B9354972BF33F2700AA8D31 /* editShareView.m in Sources */,
@@ -3456,6 +3467,7 @@
 				A003F6B627D841EE00715CBF /* UIColor+Colors.m in Sources */,
 				6B05819E2AFCF4E800D37290 /* AJPhotoListView.m in Sources */,
 				18E557292A3C60ED005CC84B /* PwdInPutView.m in Sources */,
+				6B3AD68B2BF4AE630096D6B7 /* backupsOptionViewController.m in Sources */,
 				18BB18422AC417CB00A36F63 /* RYShearDeviceUDPManager.m in Sources */,
 				18F9CB062ABD7835003FF71A /* TipsQRCodeForChangeDeviceViewController.m in Sources */,
 				6B9354942BF33F2700AA8D31 /* editShareView.m in Sources */,

+ 7 - 0
创维盒子/双子星云手机/Class/Set/MySetViewController.m

@@ -40,6 +40,7 @@
 #import "previewImageOrVideoViewController.h"
 #import "previewAudioOrDocumentViewController.h"
 #import "shareRecordViewController.h"
+#import "backupsOptionViewController.h"
 
 @interface MySetViewController ()<HelpDownScrollViewDelegate,UITableViewDelegate,UITableViewDataSource,ComontAlretViewControllerDelegate>
 {
@@ -198,6 +199,12 @@
             [self.navigationController pushViewController:vc animated:YES];
         }
             break;
+        case 105:{
+            backupsOptionViewController *vc = [backupsOptionViewController new];
+            [self.navigationController pushViewController:vc animated:YES];
+        }
+            break;
+            
             
         case 1:
         {

+ 16 - 0
创维盒子/双子星云手机/Class/Set/previewFile/backupsOptionViewController.h

@@ -0,0 +1,16 @@
+//
+//  backupsOptionViewController.h
+//  双子星云手机
+//
+//  Created by xd h on 2024/5/15.
+//
+
+#import "BaseViewController.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface backupsOptionViewController : BaseViewController
+
+@end
+
+NS_ASSUME_NONNULL_END

+ 325 - 0
创维盒子/双子星云手机/Class/Set/previewFile/backupsOptionViewController.m

@@ -0,0 +1,325 @@
+//
+//  backupsOptionViewController.m
+//  双子星云手机
+//
+//  Created by xd h on 2024/5/15.
+//
+
+#import "backupsOptionViewController.h"
+#import "uploadFileRecordViewController.h"
+#import "downloadManager.h"
+#import "backupsFileManager.h"
+#import "AFNetworkReachabilityManager.h"
+
+@interface backupsOptionViewController ()
+{
+    UIButton* rightTransferListButton;//传输列表
+    UIView* rightRedView;
+    
+    BOOL hadUploadTaskType;
+    BOOL hadDownloadTaskType;
+}
+@property(nonatomic,strong) UIButton* imageBackupsButton;
+@property(nonatomic,strong)UILabel*imageBackupsLabel;
+@end
+
+@implementation backupsOptionViewController
+
+- (void)viewDidLoad {
+    [super viewDidLoad];
+    // Do any additional setup after loading the view.
+    
+    [self.toolBar setHidden:YES];
+    [self.navigationBar setHidden:YES];
+    [self.navBarBGView setHidden:NO];
+    self.navBarBGView.backgroundColor = [UIColor whiteColor];
+    [self.view setBackgroundColor:[UIColor hwColor:@"#F5F7FA"]];
+    self.titleLabel.text = NSLocalizedString(@"my_set_no_File_backups",nil);
+    
+    [self drawAnyView];
+    
+    rightTransferListButton = [[UIButton alloc] init];
+    [rightTransferListButton setImage:[UIImage imageNamed:@"icon_file_transfer"] forState:UIControlStateNormal];
+    [rightTransferListButton addTarget:self action:@selector(didiClikRightButGotoTransferListFun:) forControlEvents:UIControlEventTouchUpInside];
+    [self.navBarBGView addSubview:rightTransferListButton];
+    
+    [rightTransferListButton mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.width.mas_equalTo(40);
+        make.height.mas_equalTo(40);
+        make.right.mas_equalTo(-15);
+        make.centerY.mas_equalTo(self.titleLabel.mas_centerY);
+    }];
+    
+    rightRedView = [[UIView alloc] init];
+    rightRedView.backgroundColor = [UIColor hwColor:@"#DD4E4E" alpha:1.0];
+    [rightTransferListButton addSubview:rightRedView];
+    rightRedView.layer.cornerRadius = 7;
+    rightRedView.hidden = YES;
+    
+    [rightRedView mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.width.mas_equalTo(14);
+        make.height.mas_equalTo(14);
+        make.right.mas_equalTo(0);
+        make.top.mas_equalTo(6);
+    }];
+    
+    [self setBackupsStateFun];
+}
+
+- (void)drawAnyView
+{
+   
+    UIView*imageBackupsBgView = [[UIView alloc] init];
+    imageBackupsBgView.backgroundColor = [UIColor whiteColor];
+    imageBackupsBgView.layer.cornerRadius = 8;
+    [self.view addSubview:imageBackupsBgView];
+
+    [imageBackupsBgView mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.right.mas_equalTo(-10);
+        make.left.mas_equalTo(10);
+        make.top.equalTo(self.navBarBGView.mas_bottom).offset(40.f);
+        make.height.mas_equalTo(56);
+    }];
+
+    UIImageView *backupsImageV = [[UIImageView alloc] init];
+    backupsImageV.image = [UIImage imageNamed:@"image_backups_icon"];
+    [imageBackupsBgView addSubview:backupsImageV];
+
+    [backupsImageV mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.centerY.mas_equalTo(0);
+        make.left.mas_equalTo(10);
+        make.width.mas_equalTo(28);
+        make.height.mas_equalTo(28);
+    }];
+
+    UILabel *imageBackupsTitleLabel = [[UILabel alloc] init];
+    imageBackupsTitleLabel.text = NSLocalizedString(@"set_Privacy_title_image",nil) ;
+    imageBackupsTitleLabel.font = [UIFont systemFontOfSize:14.0];
+    imageBackupsTitleLabel.textColor = [UIColor blackColor];
+    [imageBackupsBgView addSubview:imageBackupsTitleLabel];
+
+    [imageBackupsTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.centerY.mas_equalTo(-10);
+        make.left.mas_equalTo(backupsImageV.mas_right).offset(10);
+        make.right.mas_equalTo(-(10+60+10));
+        make.height.mas_equalTo(20);
+    }];
+
+    _imageBackupsLabel = [[UILabel alloc] init];
+    //_imageBackupsLabel.text = NSLocalizedString(@"set_Privacy_title_image_open",nil) ;
+    _imageBackupsLabel.font = [UIFont systemFontOfSize:12.0];
+    _imageBackupsLabel.textColor = [UIColor hwColor:@"#6A6A6A" alpha:1.0];
+    [imageBackupsBgView addSubview:_imageBackupsLabel];
+
+    [_imageBackupsLabel mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.centerY.mas_equalTo(10);
+        make.left.mas_equalTo(backupsImageV.mas_right).offset(10);
+        make.right.mas_equalTo(-(10+60+10));
+        make.height.mas_equalTo(20);
+    }];
+
+    _imageBackupsButton = [[UIButton alloc] init];
+    _imageBackupsButton.backgroundColor = [UIColor hwColor:@"#DCF4FB" alpha:1.0];
+    _imageBackupsButton.tag = 7;
+    [_imageBackupsButton addTarget:self action:@selector(didClickButFun:) forControlEvents:UIControlEventTouchUpInside];
+    _imageBackupsButton.layer.cornerRadius = 12.0;
+    _imageBackupsButton.layer.masksToBounds = YES;
+    [_imageBackupsButton setTitle:NSLocalizedString(@"common_open",nil) forState:UIControlStateNormal];
+    [_imageBackupsButton setTitle:NSLocalizedString(@"common_close",nil) forState:UIControlStateSelected];
+    [_imageBackupsButton setTitleColor:[UIColor hwColor:@"#01B7EA" alpha:1.0] forState:UIControlStateNormal];
+    _imageBackupsButton.titleLabel.font = [UIFont systemFontOfSize:12.0];
+    [imageBackupsBgView addSubview:_imageBackupsButton];
+
+    [_imageBackupsButton mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.right.mas_equalTo(-10);
+        make.centerY.mas_equalTo(0);
+        make.width.mas_equalTo(60);
+        make.height.mas_equalTo(24);
+    }];
+
+}
+
+- (void)closeImageBackupsFun
+{
+    [HWDataManager setBoolWithKey:stringKeyAddSn(Const_photo_backups_state) value:NO];
+    [self setBackupsStateFun];
+    //处理相册备份
+    [[backupsFileManager shareInstance] suspendBackupsFileFun];
+}
+
+- (void)openImageBackupsFun
+{
+    BOOL isCanUseCellular = [HWDataManager getBoolWithKey:stringKeyAddSn(Const_file_Transfe_canUse_Cellular_all)];
+    if(!isCanUseCellular){//不允许流量上传
+        //
+        if([AFNetworkReachabilityManager sharedManager].networkReachabilityStatus == AFNetworkReachabilityStatusReachableViaWWAN){
+            mainBlock(^{
+                [[iToast makeText:NSLocalizedString(@"File_Transfer_By_Cellular_tip",nil)] show];
+            });
+
+            return;
+        }
+        
+    }
+
+    [self showBackupsReadTipFun];
+    
+    [HWDataManager setBoolWithKey:stringKeyAddSn(Const_photo_backups_state) value:YES];
+    [self setBackupsStateFun];
+    [[iToast makeText:NSLocalizedString(@"set_Privacy_title_image_open",nil)] show];
+    //处理相册备份
+    [[backupsFileManager shareInstance] handlePhotosBackupsFun];
+}
+
+- (void)showBackupsReadTipFun
+{
+    BOOL didReadbackupsTipType = [HWDataManager getBoolWithKey:Const_file_backups_need_read];
+    if(didReadbackupsTipType){//阅读过
+        return;
+    }
+    
+    //KWeakSelf
+    /*弹窗提示恢复出厂*/
+    ComontAlretViewController *nextVC = [[ComontAlretViewController alloc] initWithTiTle:nil
+                                                                                     msg:NSLocalizedString(@"backups_need_read_msg",nil)
+                                                                                imageStr:nil
+                                                                             cancelTitle:NSLocalizedString(@"guide_set_pwd_guide_know",nil)
+                                                                                 okTitle:nil
+                                                                        isOkBtnHighlight:NO
+                                                                              didClickOk:^{
+        
+    } didClickCancel:^{
+        [HWDataManager setBoolWithKey:Const_file_backups_need_read value:YES];
+    }];
+    
+    nextVC.modalPresentationStyle = UIModalPresentationCustom;
+    
+    [[iTools appRootViewController] presentViewController:nextVC animated:YES completion:^{
+        nextVC.view.superview.backgroundColor = [UIColor clearColor];
+    }];
+    
+}
+
+- (void)setBackupsStateFun
+{
+    BOOL haveOpenBackups = [HWDataManager getBoolWithKey:stringKeyAddSn(Const_photo_backups_state)];
+    
+    _imageBackupsButton.selected = haveOpenBackups;
+    
+    if(haveOpenBackups){
+        _imageBackupsLabel.text = NSLocalizedString(@"set_Privacy_title_image_open",nil) ;
+    }
+    else
+    {
+        _imageBackupsLabel.text = NSLocalizedString(@"set_Privacy_title_image_close",nil) ;
+    }
+}
+
+#pragma mark  按钮点击事件
+- (void)didClickButFun:(UIButton*)but
+{
+    //NSInteger tag = but.tag;
+    
+    //HLog(@"xxxx:%ld",tag)
+    
+    BOOL haveOpenBackups = [HWDataManager getBoolWithKey:stringKeyAddSn(Const_photo_backups_state)];
+    
+    if(!haveOpenBackups){
+        
+        if(ksharedAppDelegate.DisabledFileTransferType){
+            if(ksharedAppDelegate.isImageNewFor130){
+                [[iToast makeText:NSLocalizedString(@"File_Transfer_Disable_tip",nil)] show];
+            }
+            else{
+                [[iToast makeText:NSLocalizedString(@"File_Transfer_Disable_tip2",nil)] show];
+            }
+            return;
+        }
+        
+        if(!ksharedAppDelegate.isWebSockLinkOKAginType){
+            [[iToast makeText:NSLocalizedString(@"check_could_phone_state",nil)] show];
+            return;
+        }
+        
+        //相册权限
+        if (![[TZImageManager manager] authorizationStatusAuthorized]){
+            [PHPhotoLibrary requestAuthorization:^(PHAuthorizationStatus status) {
+                if(status == PHAuthorizationStatusAuthorized){
+                    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
+                        [self openImageBackupsFun];
+                    });
+                    
+                }
+            }];
+        }
+        else{
+            [self openImageBackupsFun];
+        }
+        
+        return;
+    }
+    else{
+        KWeakSelf
+        /*弹窗提示关闭备份*/
+        ComontAlretViewController *nextVC = [[ComontAlretViewController alloc] initWithTiTle:NSLocalizedString(@"File_backups_set_close_title",nil)
+                                                                                         msg:NSLocalizedString(@"File_backups_set_close_tip",nil)
+                                                                                    imageStr:nil
+                                                                                 cancelTitle:NSLocalizedString(@"other_cancel",nil)
+                                                                                     okTitle:NSLocalizedString(@"other_comment_ok",nil) isOkBtnHighlight:YES
+                                                                                  didClickOk:^{
+            [weakSelf closeImageBackupsFun];
+        } didClickCancel:^{
+           
+        }];
+        nextVC.modalPresentationStyle = UIModalPresentationCustom;
+        [self presentViewController:nextVC animated:YES completion:^{
+            nextVC.view.superview.backgroundColor = [UIColor clearColor];
+        }];
+    }
+}
+
+
+- (void)checkFileTransferTask
+{//有个偶现的闪退在BGFMDB
+    
+    [[uploadFileManager shareInstance] checkHadUploadTaskWithComplete:^(BOOL isSuccess) {
+        self->hadUploadTaskType = isSuccess;
+        [self setRightButtonRedTypeFun];
+    }];
+    
+    KWeakSelf
+    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
+        [[downloadManager shareInstance] checkHadDownloadTaskWithComplete:^(BOOL isSuccess) {
+            self->hadDownloadTaskType = isSuccess;
+            [weakSelf setRightButtonRedTypeFun];
+        }];
+    });
+   
+}
+
+- (void)setRightButtonRedTypeFun
+{
+    mainBlock(^{
+        if(self->hadUploadTaskType || self->hadDownloadTaskType){
+            self->rightRedView.hidden = NO;
+        }
+        else{
+            self->rightRedView.hidden = YES;
+        }
+
+    });
+}
+
+
+- (void)didiClikRightButGotoTransferListFun:(UIButton*)but
+{
+    uploadFileRecordViewController *vc = [uploadFileRecordViewController new];
+    [self.navigationController pushViewController:vc animated:YES];
+}
+
+
+- (void)viewDidAppear:(BOOL)animated{
+    [super viewDidAppear:animated];
+    [self checkFileTransferTask];
+}
+@end