1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069 |
- //
- // MySetViewController.m
- // 双子星云手机
- //
- // Created by APPLE on 2023/8/17.
- //
- #import "MySetViewController.h"
- #import <SDWebImage.h>
- #import <Masonry.h>
- #import "HelpDownScrollView.h"
- #import "MineViewCell.h"
- #import "ChangeLogoViewController.h"
- #import "HidenMaskSetViewController.h"
- #import "CustomerWebViewController.h"
- #import "AboutViewController.h"
- #import "iPhone.h"
- #import "CloudPhoneAPI.h"
- #import "ComontAlretViewController.h"
- #import "ModifyPWDFirstViewController.h"
- #import "TipsQRCodeForChangeDeviceViewController.h"
- #import "connectDeviceManager.h"
- #import "mySetHeadView.h"
- #import "uploadImageOrVideoViewController.h"
- #import "TZImagePickerController.h"
- #import "uploadFileRecordViewController.h"
- #import "privacyModeViewController.h"
- #import "TvStatusModel.h"
- #import "inputPWDViewController.h"
- #import "fileTransferPopView.h"
- #import "fileTransfeSetViewController.h"
- #import "backupsSetViewController.h"
- #import "downLoadPreviewViewController.h"
- #import "uploadFileDataModel.h"
- #import "uploadFileManager.h"
- #import "downloadManager.h"
- #import "clearCacheAlretViewController.h"
- @interface MySetViewController ()<HelpDownScrollViewDelegate,UITableViewDelegate,UITableViewDataSource,ComontAlretViewControllerDelegate>
- {
- UIButton* rightButton;
- UIView* rightRedView;
-
- UILabel *phoneLabel;
- UILabel *vipTypeTipsLabel;
- UIButton *tvP2PBtn;
-
- BOOL hadUploadTaskType;
- BOOL hadDownloadTaskType;
- }
- @property (nonatomic, strong, nullable) UITableView *tableView;
- @property (nonatomic, strong, nullable) mySetHeadView *customTableHeadView;
- @end
- @implementation MySetViewController
- - (void)viewDidLoad {
- [super viewDidLoad];
- // Do any additional setup after loading the view.
-
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(getCouldPhoneTvStatusFun:) name:getCouldPhoneTvStatusNotification object:nil];
-
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(uploadFileAllTaskDoneNot:) name:uploadFileAllTaskDoneNotification object:nil];
-
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(downloadFileAllTaskDoneNot:) name:downloadFileAllTaskDoneNotification object:nil];
-
- [self drawAnyView];
- }
- - (void)viewWillAppear:(BOOL)animated
- {
- [super viewWillAppear:animated];
- [[UIApplication sharedApplication] setStatusBarHidden:NO];
-
- if(_getTvStatus){
- _getTvStatus();
- }
-
- }
- - (void)viewDidAppear:(BOOL)animated{
- [super viewDidAppear:animated];
- [self checkFileTransferTask];
- }
- - (void)drawAnyView{
- [self.view setBackgroundColor:HWF5F7FAColor];
-
- [self.toolBar setHidden:YES];
- [self.navigationBar setHidden:YES];
- [self.navBarBGView setHidden:NO];
- [self.titleLabel setText:NSLocalizedString(@"more_set",nil)];
-
- rightButton = [[UIButton alloc] init];
- [rightButton setImage:[UIImage imageNamed:@"icon_file_transfer"] forState:UIControlStateNormal];
- [rightButton addTarget:self action:@selector(didiClikRightButFun:) forControlEvents:UIControlEventTouchUpInside];
- [self.navBarBGView addSubview:rightButton];
-
- [rightButton 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];
- [rightButton 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.view addSubview:self.tableView];
- [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(0);
- make.right.mas_equalTo(0);
- make.bottom.mas_equalTo(0);
- make.top.equalTo(self.navBarBGView.mas_bottom).offset(5.f);
- }];
- }
- - (mySetHeadView *)customTableHeadView{
-
- if(!_customTableHeadView){
- CGFloat PrivacyBgW = SCREEN_W - 20;
- CGFloat PrivacyBgH = 116.0 * PrivacyBgW / (345.0);
-
- CGFloat totalHeight = 10 + PrivacyBgH + (110+15) + (110+15)+(135+ 88 + 15);
-
- _customTableHeadView = [[mySetHeadView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_W, totalHeight)];
-
- KWeakSelf
- #pragma mark 上传文件相关处理
- _customTableHeadView.didClickBut = ^(NSInteger tag) {
- [weakSelf didClickUploadFileByTag:tag];
- };
- }
-
- return _customTableHeadView;
- }
- - (void)didiClikRightButFun:(UIButton*)but
- {
- uploadFileRecordViewController *vc = [uploadFileRecordViewController new];
- [self.navigationController pushViewController:vc animated:YES];
- }
- #pragma mark 点击文件上传相关
- - (void)didClickUploadFileByTag:(NSInteger)tag
- {
- HLog(@"hhh %ld",tag);
- KWeakSelf
- switch (tag) {
- case 1:
- {
- if(!ksharedAppDelegate.isWebSockLinkOKAginType){
- [[iToast makeText:NSLocalizedString(@"check_could_phone_state",nil)] show];
- return;
- }
-
- fileTransfeSetViewController *nextVC = [fileTransfeSetViewController new];
- [self.navigationController pushViewController:nextVC animated:YES];
- }
- break;
- case 2:
- case 3:
- {
- 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;
- }
-
- fileTransferPopView * fileTransferPopV = [[fileTransferPopView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_W, SCREEN_H)];
- if(tag==2){
- fileTransferPopV.fileTransferType =1;
- }
- else{
- fileTransferPopV.fileTransferType =2;
- }
- [self.view.window addSubview:fileTransferPopV];
-
-
- fileTransferPopV.didClickBut = ^(NSInteger tag) {
- [weakSelf gotoFileTransferFunBy:tag];
- };
-
- }
- break;
- case 4:
- {
- inputPWDViewController *nextVC = [inputPWDViewController new];
- nextVC.isCheckPwdType = YES;
- [self.navigationController pushViewController:nextVC animated:YES];
-
-
- nextVC.didInputRightPwdFun = ^{
- [weakSelf gotoPrivacyModeVCFun];
- };
- }
- break;
- case 5:
- {
- // backupsSetViewController *nextVC = [backupsSetViewController new];
- // [self.navigationController pushViewController:nextVC animated:YES];
-
- fileTransfeSetViewController *nextVC = [fileTransfeSetViewController new];
- [self.navigationController pushViewController:nextVC animated:YES];
-
- }
- break;
- case 10:
- {
- TipsQRCodeForChangeDeviceViewController *vc = [[TipsQRCodeForChangeDeviceViewController alloc] init];
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case 7:
- {
- /*弹窗提示关闭备份*/
- 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 gotoClosePhotosBackupsFun];
- } didClickCancel:^{
-
- }];
- nextVC.modalPresentationStyle = UIModalPresentationCustom;
- [self presentViewController:nextVC animated:YES completion:^{
- nextVC.view.superview.backgroundColor = [UIColor clearColor];
- }];
- }
- break;
- case 11:
- {
- /*弹窗提示重启*/
- ComontAlretViewController *nextVC = [[ComontAlretViewController alloc] initWithTiTle:NSLocalizedString(@"my_set_no_restart_phone_tips",nil)
- msg:nil
- imageStr:nil
- cancelTitle:NSLocalizedString(@"other_cancel",nil)
- okTitle:NSLocalizedString(@"my_set_no_restart_phone_btn_ok",nil) isOkBtnHighlight:NO
- didClickOk:^{
-
- } didClickCancel:^{
-
- }];
- nextVC.modalPresentationStyle = UIModalPresentationCustom;
- nextVC.delegate = self;
- [self presentViewController:nextVC animated:YES completion:^{
- nextVC.view.superview.backgroundColor = [UIColor clearColor];
- }];
- }
- break;
- case 12:
- {
- [self RestoreFactoryAleartFun];
- }
- break;
- case 13:
- {
- CustomerWebViewController *vc = [[CustomerWebViewController alloc] init];
- vc.titleStr = NSLocalizedString(@"my_set_no_common_problem",nil);
- NSString *url = @"https://cliys.armclouding.com/h5/microserviceUserH5/commonProblem/questionIndex.html";
- vc.webUrl = url;
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case 14:
- {
- AboutViewController *vc = [[AboutViewController alloc] init];
- vc.getSysInfo = ^{
- if(self->_getSysInfo){
- self->_getSysInfo();
- }
- };
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case 15:
- {
- [self clickClearCacheButtonFun];
- }
- break;
- default:
- break;
- }
-
- }
- - (void)gotoClosePhotosBackupsFun
- {
- [[self customTableHeadView] closeImageBackupsFun];
- }
- - (void)checkDidHadUploadTaskFunWith:(NSInteger)tag
- {
- KWeakSelf
- [[uploadFileManager shareInstance] getDataInDatabaseFun:YES complete:^(NSMutableArray * _Nonnull Arr) {
- mainBlock(^{
- if(Arr && Arr.count== 3){
- NSArray *uploadingArr = Arr.firstObject;
- if(uploadingArr.count == 0){
- [weakSelf gotoUploadFileFunWith:tag];
- }
- else{
- [[iToast makeText:NSLocalizedString(@"upload_task_not_done_tip",nil)] show];
- }
- }
- else{
- [weakSelf gotoUploadFileFunWith:tag];
- };
- });
-
- }];
- }
- - (void)gotoUploadFileFunWith:(NSInteger)tag
- {
- if(self->_getBaseInfo){
- self->_getBaseInfo();
- }
-
- uploadImageOrVideoViewController *vc = [uploadImageOrVideoViewController new];
- if(tag ==11){
- vc.isPhotoType = YES;
- }
- else{
- vc.isPhotoType = NO;
- }
- [self.navigationController pushViewController:vc animated:YES];
- }
- - (void)checkDidHadDownloadTaskFunWith:(NSInteger)tag
- {
- KWeakSelf
- [[downloadManager shareInstance] getDataInDatabaseFun:YES complete:^(NSMutableArray * _Nonnull Arr) {
- mainBlock(^{
- if(Arr && Arr.count== 3){
- NSArray *downloadingArr = Arr.firstObject;
- if(downloadingArr.count == 0){
- [weakSelf gotoDownloadFileFunWith:tag];
- }
- else{
- [[iToast makeText:NSLocalizedString(@"download_task_not_done_tip",nil)] show];
- }
- }
- else{
- [weakSelf gotoDownloadFileFunWith:tag];
- };
- });
-
- }];
- }
- - (void)gotoDownloadFileFunWith:(NSInteger)tag
- {
- downLoadPreviewViewController *vc = [downLoadPreviewViewController new];
- if(tag ==12){
- vc.isPhotoType = YES;
- }
- else{
- vc.isPhotoType = NO;
- }
-
- [self.navigationController pushViewController:vc animated:YES];
- }
- #pragma mark 点击图片或者视频
- - (void)gotoFileTransferFunBy:(NSInteger)tag
- {
- if(tag == 11 ||tag == 21){
- [self checkDidHadUploadTaskFunWith:tag];
- }
- else if(tag == 12 ||tag == 22){
- [self checkDidHadDownloadTaskFunWith:tag];
- }
- }
- - (UIView *)tableFoorView{
- UIView *bgView = [[UIView alloc] initWithFrame:(CGRectMake(0, 0, SCREEN_W, 48.f + 40))];
- [bgView setBackgroundColor:[UIColor clearColor]];
-
- tvP2PBtn = [[UIButton alloc] initWithFrame:(CGRectMake(15, 20, SCREEN_W - 2*15.f, 48.f))];
- [tvP2PBtn setBackgroundColor:HWFFFFFFColor];
- [tvP2PBtn setTitle:NSLocalizedString(@"my_set_no_TV_p2p",nil) forState:(UIControlStateNormal)];
- [tvP2PBtn setTitle:NSLocalizedString(@"my_set_no_close_TV_p2p",nil) forState:(UIControlStateSelected)];
- [tvP2PBtn setTitleColor:HW0A132BColor forState:(UIControlStateNormal)];
- [tvP2PBtn.titleLabel setFont:[UIFont boldSystemFontOfSize:14.f]];
- [tvP2PBtn addTarget:self
- action:@selector(tvP2PBtnPressed)
- forControlEvents:(UIControlEventTouchUpInside)];
- [tvP2PBtn.layer setCornerRadius:8.f];
- [bgView addSubview:tvP2PBtn];
- return bgView;
- }
- #pragma mark 点击投屏
- - (void)tvP2PBtnPressed{
-
- if(tvP2PBtn.selected)
- {
- [self showCloseTVP2PFun];
- }
- else{
- [self showTVP2PFun];
- }
- }
- #pragma mark 显示投屏提示语
- - (void)showTVP2PFun{
- /*弹窗提示TV投屏*/
- ComontAlretViewController *nextVC = [[ComontAlretViewController alloc] initWithTiTle:NSLocalizedString(@"my_set_TVP2P_Open_title",nil)
- msg:NSLocalizedString(@"my_set_TVP2P_Open_Subtitle",nil)
- imageStr:nil
- cancelTitle:NSLocalizedString(@"my_set_TVP2P_Open_sure",nil)
- okTitle:nil isOkBtnHighlight:NO
- didClickOk:^{
- HLog(@"111");
- } didClickCancel:^{
- //HLog(@"2222");
- [self gotoSetTVP2PFun];
- }];
- nextVC.modalPresentationStyle = UIModalPresentationCustom;
- [self presentViewController:nextVC animated:YES completion:^{
- nextVC.view.superview.backgroundColor = [UIColor clearColor];
- }];
- }
- #pragma mark 确认开始TV投屏
- -(void)gotoSetTVP2PFun
- {
- if(_needToTVP2P){
- _needToTVP2P();
- }
- [self.navigationController popViewControllerAnimated:YES];
- }
- #pragma mark 显示关闭投屏提示语
- - (void)showCloseTVP2PFun{
- /*弹窗提示TV投屏*/
- ComontAlretViewController *nextVC = [[ComontAlretViewController alloc] initWithTiTle:NSLocalizedString(@"my_set_no_close_TV_p2p_tip",nil)
- msg:nil
- imageStr:nil
- cancelTitle:NSLocalizedString(@"other_cancel",nil)
- okTitle:NSLocalizedString(@"my_set_TVP2P_Open_sure",nil) isOkBtnHighlight:YES
- didClickOk:^{
- [self gotoCloseTVP2PFun];
- } didClickCancel:^{
- //HLog(@"2222");
-
- }];
- nextVC.modalPresentationStyle = UIModalPresentationCustom;
- [self presentViewController:nextVC animated:YES completion:^{
- nextVC.view.superview.backgroundColor = [UIColor clearColor];
- }];
-
-
- }
- #pragma mark 确认开始TV投屏
- -(void)gotoCloseTVP2PFun
- {
- if(_closeTVP2P){
- _closeTVP2P();
- tvP2PBtn.selected = NO;
- }
-
- tvP2PBtn.userInteractionEnabled = NO;
- dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
- self->tvP2PBtn.userInteractionEnabled = YES;
- });
- }
- - (void)helpDownScrollViewBePressed:(nonnull id)sender withIndex:(NSInteger)index {
- HLog(@"\n----点击了第个%ld按钮----",index);
- if (index == 0){
- ChangeLogoViewController *nextVC = [[ChangeLogoViewController alloc] init];
- [self.navigationController pushViewController:nextVC animated:YES];
- }else if (index == 1){/**/
- HidenMaskSetViewController *nextVC = [[HidenMaskSetViewController alloc] init];
- [self.navigationController pushViewController:nextVC animated:YES];
- }
- }
- #pragma mark - 懒加载
- - (UITableView *)tableView{
- if (!_tableView) {
- _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_W, SCREEN_H - TABBARHEIGHT) style:UITableViewStylePlain];
- _tableView.delegate = self;
- _tableView.dataSource = self;
- _tableView.showsVerticalScrollIndicator = NO;
- _tableView.showsHorizontalScrollIndicator = NO;
- // _tableView.contentInset = UIEdgeInsetsMake(-H_STATE_BAR, 0, 0, 0);
- [_tableView setSeparatorStyle:(UITableViewCellSeparatorStyleNone)];
- [_tableView setSeparatorColor:[UIColor clearColor]];
- [_tableView setBackgroundColor:[UIColor clearColor]];
- [_tableView setTableFooterView:[UIView new]];
- [_tableView setBounces:YES];
- if (@available(iOS 15.0, *)) {
- _tableView.sectionHeaderTopPadding = 0;
- }
-
- [_tableView setTableFooterView:[self tableFoorView]];
- [_tableView setTableHeaderView:[self customTableHeadView]];
- }
-
- return _tableView;
- }
- #pragma mark - 列表委托
- - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
- return 0;
- //return 1;
- }
- - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
- return 0;
- //return 6;
- //return 5;//去掉更换icon
- }
- - (MineViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
-
- NSInteger row = indexPath.row;
- static NSString *identifier = @"MineViewCell";
-
- MineViewCell * cell = [tableView dequeueReusableCellWithIdentifier:identifier];
- cell.selectionStyle = UITableViewCellSelectionStyleNone;
- if (!cell){
- cell = [[MineViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:identifier];
- [cell setSelectionStyle:UITableViewCellSelectionStyleNone];
- [cell setBackgroundColor:[UIColor clearColor]];
- [cell setAccessoryType:(UITableViewCellAccessoryNone)];
- }
- [cell.bgViewLayer removeFromSuperlayer];
- [cell.titleLabel2 setHidden:YES];
- [cell.rightImage setHidden:NO];
- [cell.lineView setHidden:NO];
- [cell.maskSwitch setHidden:YES];
- if (row == 0){
-
- [cell.titleLabel setText:NSLocalizedString(@"my_set_Privacy_Model",nil)];
- [cell.mImageView setImage:[UIImage imageNamed:@"icon_Privacy_model"]];
-
- // [cell.titleLabel setText:NSLocalizedString(@"my_set_no_modify_pwd",nil)];
- // [cell.mImageView setImage:[UIImage imageNamed:@"mdoify_pwd"]];
-
- /*上圆角*/
- //设置部分圆角 贝塞尔曲线
- UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, SCREEN_W-30 , 60)
- byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight
- 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;
- // }else if (row == 1){
- // [cell.titleLabel setText:NSLocalizedString(@"my_set_no_change_logo",nil)];
- // [cell.mImageView setImage:[UIImage imageNamed:@"icon_change_logo"]];
- // // }else if (row == 2){
- // // [cell.titleLabel setText:NSLocalizedString(@"mask_view_hiden_set_hiden",nil)];
- // // [cell.mImageView setImage:[UIImage imageNamed:@"icon-jincheng"]];
- // // }else if (row == 3){
- // }else if (row == 1){
- // [cell.titleLabel setText:NSLocalizedString(@"my_set_no_fanzhuan_exit",nil)];
- // [cell.mImageView setImage:[UIImage imageNamed:@"fanzhuan"]];
- // [cell.rightImage setHidden:YES];
- // [cell.maskSwitch setHidden:NO];
- //}else if (row == 4){/*版本信息*/
- }else if (row == 1){/*版本信息*/
- [cell.titleLabel setText:NSLocalizedString(@"my_set_no_check_update",nil)];
- [cell.mImageView setImage:[UIImage imageNamed:@"app_update"]];
- [cell.titleLabel2 setText:[iPhone appVersion]];
- [cell.titleLabel2 setHidden:NO];
- //}else if (row == 5){/*更换设备*/
- }else if (row == 2){/*更换设备*/
- [cell.titleLabel setText:NSLocalizedString(@"my_set_no_change_phone",nil)];
- [cell.mImageView setImage:[UIImage imageNamed:@"icon_change_ohone"]];
- //}else if (row == 6){
- }else if (row == 3){/*常见问题*/
- [cell.titleLabel setText:NSLocalizedString(@"my_set_no_common_problem",nil)];
- [cell.mImageView setImage:[UIImage imageNamed:@"icon_common_problem"]];
- }else if (row == 4){/*回复出厂*/
- [cell.titleLabel setText:NSLocalizedString(@"my_set_no_Restore_Factory",nil)];
- [cell.mImageView setImage:[UIImage imageNamed:@"icon_Restore_Factory"]];
- }else if (row == 5){/*重启空间*/
- [cell.titleLabel setText:NSLocalizedString(@"my_set_no_restart_phone",nil)];
- [cell.mImageView setImage:[UIImage imageNamed:@"icon-gengxin"]];
- /*下圆角*/
- 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];
- }
- return cell;
- }
- - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
- return 60;
- }
- - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
- [tableView deselectRowAtIndexPath:indexPath animated:YES];
-
- NSInteger row = indexPath.row;
- if (0 == row){
-
- inputPWDViewController *nextVC = [inputPWDViewController new];
- nextVC.isCheckPwdType = YES;
- [self.navigationController pushViewController:nextVC animated:YES];
-
- KWeakSelf
- nextVC.didInputRightPwdFun = ^{
- [weakSelf gotoPrivacyModeVCFun];
- };
-
-
- /*修改密码*/
- // ModifyPWDFirstViewController *nextVC = [[ModifyPWDFirstViewController alloc] init];
- // [self.navigationController pushViewController:nextVC animated:YES];
- // }else if (1 == row){
- // /*更换图标*/
- // ChangeLogoViewController *nextVC = [[ChangeLogoViewController alloc] init];
- // [self.navigationController pushViewController:nextVC animated:YES];
- // }else if (1 == row){/*进城隐藏*/
- // HidenMaskSetViewController *nextVC = [[HidenMaskSetViewController alloc] init];
- // [self.navigationController pushViewController:nextVC animated:YES];
- // }else if (3 == row){/*设备翻转*/
- // ;
- }
- //else if (4 == row){/*版本信息*/
- else if (1 == row){/*版本信息*/
- AboutViewController *vc = [[AboutViewController alloc] init];
- vc.getSysInfo = ^{
- if(self->_getSysInfo){
- self->_getSysInfo();
- }
- };
- [self.navigationController pushViewController:vc animated:YES];
- //}else if (5 == row){/*更换设备*/
- }else if (2 == row){/*更换设备*/
- TipsQRCodeForChangeDeviceViewController *vc = [[TipsQRCodeForChangeDeviceViewController alloc] init];
- [self.navigationController pushViewController:vc animated:YES];
- }else if (3 == row){/*常见问题*/
- CustomerWebViewController *vc = [[CustomerWebViewController alloc] init];
- vc.titleStr = NSLocalizedString(@"my_set_no_common_problem",nil);
- NSString *url = @"https://cliys.armclouding.com/h5/microserviceUserH5/commonProblem/questionIndex.html";
- vc.webUrl = url;
- [self.navigationController pushViewController:vc animated:YES];
-
- }else if (4 == row){/*恢复出厂*/
- [self RestoreFactoryAleartFun];
- }else if (5 == row){/*重启空间*/
- /*弹窗提示重启*/
- ComontAlretViewController *nextVC = [[ComontAlretViewController alloc] initWithTiTle:NSLocalizedString(@"my_set_no_restart_phone_tips",nil)
- msg:nil
- imageStr:nil
- cancelTitle:NSLocalizedString(@"other_cancel",nil)
- okTitle:NSLocalizedString(@"my_set_no_restart_phone_btn_ok",nil) isOkBtnHighlight:NO
- didClickOk:^{
-
- } didClickCancel:^{
-
- }];
- nextVC.modalPresentationStyle = UIModalPresentationCustom;
- nextVC.delegate = self;
- [self presentViewController:nextVC animated:YES completion:^{
- nextVC.view.superview.backgroundColor = [UIColor clearColor];
- }];
- }
- }
- #pragma mark 去设置隐私
- - (void)gotoPrivacyModeVCFun
- {
- privacyModeViewController *nextVC = [[privacyModeViewController alloc] init];
- [self.navigationController pushViewController:nextVC animated:YES];
- }
- - (void)CommonAlertokBtnClickPressed{
- // /*重启云手机*/
- // 通过指令通道发送 {"type":"reboot"}
- if(_needToReboot){
- _needToReboot();
- }
-
- //提示语
- [[iToast makeText:NSLocalizedString(@"player_link_rebooting_Tips",nil)] show];
- }
- #pragma mark 点击恢复出厂
- - (void)RestoreFactoryAleartFun
- {
- KWeakSelf
- /*弹窗提示恢复出厂*/
- ComontAlretViewController *nextVC = [[ComontAlretViewController alloc] initWithTiTle:NSLocalizedString(@"my_set_no_Restore_Factory_tips",nil)
- msg:NSLocalizedString(@"my_set_no_Restore_Factory_msg",nil)
- imageStr:@"icon_Restore_Factory_big"
- cancelTitle:NSLocalizedString(@"my_set_TVP2P_Open_sure",nil)
- okTitle:NSLocalizedString(@"other_cancel",nil) isOkBtnHighlight:YES
- didClickOk:^{
-
- } didClickCancel:^{
- //点击确定
- [weakSelf gotoResetFun];
- }];
- nextVC.modalPresentationStyle = UIModalPresentationCustom;
-
- [self presentViewController:nextVC animated:YES completion:^{
- nextVC.view.superview.backgroundColor = [UIColor clearColor];
- }];
- }
- #pragma mark 点击了恢复出厂
- - (void)gotoResetFun
- {
- if(_needToReset){
- _needToReset();
- }
-
- [self RestoreFactoryingFun];
- }
- #pragma mark 恢复出厂中
- - (void)RestoreFactoryingFun
- {
- KWeakSelf
- /*弹窗提示恢复出厂*/
- ComontAlretViewController *nextVC = [[ComontAlretViewController alloc] initWithTiTle:NSLocalizedString(@"my_set_no_Restore_Factorying_tips",nil)
- msg:NSLocalizedString(@"my_set_no_Restore_Factorying_msg",nil)
- imageStr:nil
- cancelTitle:NSLocalizedString(@"my_set_no_Restore_Factorying",nil)
- okTitle:nil
- isOkBtnHighlight:NO
- didClickOk:^{
- [weakSelf RestoreFactoryCompleteFun];
- } didClickCancel:^{
-
- }];
-
- [nextVC setButtonCountdownFun:180];//90
-
- nextVC.modalPresentationStyle = UIModalPresentationCustom;
-
- [self presentViewController:nextVC animated:YES completion:^{
- nextVC.view.superview.backgroundColor = [UIColor clearColor];
- }];
- }
- #pragma mark 恢复出厂倒计时结束
- - (void)RestoreFactoryCompleteFun
- {
- KWeakSelf
- //瑞云发起重连
- NSString *snStr = [connectDeviceManager shareInstance].DeviceThirdIdMod.data.changeSn;
- if(snStr){
- [[connectDeviceManager shareInstance] getThridMsgBySN:snStr needReconnect:YES didNetEnd:^(NSInteger didSuc) {
- if(didSuc){
- if(self->_needToResetAndOk){
- self->_needToResetAndOk();
- }
- }
- else{
- [weakSelf RestoreFactoryCompleteFun];
- return;
- }
- }];
- }
-
-
- /*弹窗提示恢复出厂*/
- ComontAlretViewController *nextVC = [[ComontAlretViewController alloc] initWithTiTle:NSLocalizedString(@"my_set_no_Restore_Factory_ok_tips",nil)
- msg:NSLocalizedString(@"my_set_no_Restore_Factory_ok_msg",nil)
- imageStr:nil
- cancelTitle:NSLocalizedString(@"my_set_no_Restore_FactoryOK",nil)
- okTitle:nil
- isOkBtnHighlight:NO
- didClickOk:^{
-
- } didClickCancel:^{
- [weakSelf.navigationController popViewControllerAnimated:YES];
- }];
-
-
-
- nextVC.modalPresentationStyle = UIModalPresentationCustom;
-
- [self presentViewController:nextVC animated:YES completion:^{
- nextVC.view.superview.backgroundColor = [UIColor clearColor];
- }];
- }
- - (void)getCouldPhoneTvStatusFun:(NSNotification*)not
- {
- TvStatusModel *model = [not object];
- //HLog(@"%@",baseInfoModel);
-
- if(!model || ![model isKindOfClass:[TvStatusModel class]]){
- return;
- }
-
- if([model.msg containsString:@"PushStreamBActivity"]){
- tvP2PBtn.selected = YES;
- }
- else{
- tvP2PBtn.selected = NO;
- }
-
- }
- - (void)uploadFileAllTaskDoneNot:(NSNotification*)not
- {
- hadUploadTaskType = NO;
- [self setRightButtonRedTypeFun];
- }
- - (void)downloadFileAllTaskDoneNot:(NSNotification*)not
- {
- hadDownloadTaskType = NO;
- [self setRightButtonRedTypeFun];
- }
- - (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;
- }
- });
- }
- #pragma mark 清理缓存相关
- - (void)clickClearCacheButtonFun
- {
- KWeakSelf
- /*弹窗提示清除缓存*/
- clearCacheAlretViewController *nextVC = [[clearCacheAlretViewController alloc] initWithTiTle:NSLocalizedString(@"my_set_no_clear_cache",nil)
- msg:NSLocalizedString(@"clear_cache_tip",nil)
- imageStr:nil
- cancelTitle:NSLocalizedString(@"other_cancel",nil)
- okTitle:NSLocalizedString(@"other_clear",nil) isOkBtnHighlight:YES
- didClickOk:^(BOOL isSelect) {
- [weakSelf handleClearCacheFunWith:isSelect];
- } didClickCancel:^{
-
- }];
- nextVC.modalPresentationStyle = UIModalPresentationCustom;
- [self presentViewController:nextVC animated:YES completion:^{
- nextVC.view.superview.backgroundColor = [UIColor clearColor];
- }];
-
- }
- - (void)handleClearCacheFunWith:(BOOL)isSelectFileTransfer
- {
- [self ClearCommonCacheFun];
-
- if(isSelectFileTransfer){
- [self clearCacheByFileTransferFun];
- }
- }
- - (void)ClearCommonCacheFun
- {
- NSString *ruiyunLogPath = [NSString stringWithFormat:@"%@/logs/debug_0.log",CachesPatch];
- [[NSFileManager defaultManager] removeItemAtPath:ruiyunLogPath error:nil];
-
- NSString *appLogPath = [NSString stringWithFormat:@"%@/logs/app.log",CachesPatch];
- [[NSFileManager defaultManager] removeItemAtPath:appLogPath error:nil];
-
- //
- NSString *downLoadThumbnailPath = [NSString stringWithFormat:@"%@/DownLoadThumbnail",CachesPatch];
- [[NSFileManager defaultManager] removeItemAtPath:downLoadThumbnailPath error:nil];
- }
- - (void)clearCacheByFileTransferFun
- {
- //清理图片
- BOOL needReUploadingType = NO;
- NSString *ImagePath = [NSString stringWithFormat:@"%@/Image",CachesPatch];
- if([uploadFileManager shareInstance].curUploadFileDataModel
- && [uploadFileManager shareInstance].curUploadFileDataModel.curUploadFileType == uploadFileTypeImage
- && [uploadFileManager shareInstance].curUploadFileDataModel.curUploadStateType == uploadStateUploading){
-
- [uploadFileManager shareInstance].curUploadFileDataModel.curUploadStateType = uploadStateSuspend;
- needReUploadingType = YES;
- }
-
- [[NSFileManager defaultManager] removeItemAtPath:ImagePath error:nil];
-
- if(needReUploadingType){
- dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
- [uploadFileManager shareInstance].curUploadFileDataModel.curUploadStateType = uploadStateUploading;
- });
- }
-
- //清理视频文件
- NSString *videoPath = [NSString stringWithFormat:@"%@/Video",CachesPatch];
-
- NSString *backupsingVideoName = nil;
- if([backupsFileManager shareInstance].curPhotosBackupsTaskMod
- && [backupsFileManager shareInstance].curPhotosBackupsTaskMod.curUploadFileType == uploadFileTypeVideo){
- backupsingVideoName = [backupsFileManager shareInstance].curPhotosBackupsTaskMod.filename;
- }
-
- NSString *uploadingVideoName = nil;
- if([uploadFileManager shareInstance].curUploadFileDataModel
- && [uploadFileManager shareInstance].curUploadFileDataModel.curUploadFileType == uploadFileTypeVideo){
- uploadingVideoName = [uploadFileManager shareInstance].curUploadFileDataModel.filename;
- }
-
- if(backupsingVideoName || uploadingVideoName){
-
- NSMutableString *fileName = [NSMutableString new];
-
- if(backupsingVideoName){
- [fileName appendString:backupsingVideoName];
- }
-
- if(uploadingVideoName){
- if(fileName.length > 0){
- [fileName appendString:@"|"];
- }
-
- [fileName appendString:uploadingVideoName];
- }
-
- [self deleteFilesInDirectoryAtPath:videoPath withOutFileName:fileName];
- }
- else{
- [[NSFileManager defaultManager] removeItemAtPath:videoPath error:nil];
- }
-
-
- //清理下载中
- NSString *downLoadingPath = [NSString stringWithFormat:@"%@/DownLoadFlie",CachesPatch];
-
- NSString *downLoadingFileName = nil;
- if([downloadManager shareInstance].curDownloadFileModel
- && ([downloadManager shareInstance].curDownloadFileModel.curDownloadStateType == downloadStateUploading
- ||[downloadManager shareInstance].curDownloadFileModel.curDownloadStateType == downloadStateSuspend)){
- downLoadingFileName = [[downloadManager shareInstance].curDownloadFileModel getFileNameFun];
-
- [self deleteFilesInDirectoryAtPath:downLoadingPath withOutFileName:downLoadingFileName];
- }
- else{
- [[NSFileManager defaultManager] removeItemAtPath:downLoadingPath error:nil];
- }
-
- //清理数据库表 完成的
-
- //下载完成
- NSMutableString* where = [[NSMutableString alloc] initWithString:@"where "];
- NSString *curStr = [NSString stringWithFormat:@"%@=%@ ",bg_sqlKey(@"curDownloadStateType"),bg_sqlValue([NSNumber numberWithInt:downloadStateDone])];
- [where appendString:curStr];
-
- [couldPhoneFileModel bg_deleteAsync:download_tableName where:where complete:^(BOOL isSuccess) {
- }];
-
- //上传完成
- NSMutableString* where2 = [[NSMutableString alloc] initWithString:@"where "];
- NSString *curStr2 = [NSString stringWithFormat:@"%@=%@ ",bg_sqlKey(@"curUploadStateType"),bg_sqlValue([NSNumber numberWithInt:uploadStateDone])];
- [where2 appendString:curStr2];
-
- [uploadFileDataModel bg_deleteAsync:upLoadFile_image_tableName where:where2 complete:^(BOOL isSuccess) {
- }];
-
- }
- - (BOOL)deleteFilesInDirectoryAtPath:(NSString *)path withOutFileName:(NSString*)fileNames {
- NSFileManager *fileManager = [NSFileManager defaultManager];
-
- NSArray *fileNameArr = [fileNames componentsSeparatedByString:@"|"];
-
-
- // 使用NSDirectoryEnumerator遍历目录
- NSDirectoryEnumerator *directoryEnumerator = [fileManager enumeratorAtPath:path];
- NSString *fileName;
- while ((fileName = [directoryEnumerator nextObject])) {
-
- BOOL canDelType = YES;
-
- for (NSString*noDelfileName in fileNameArr) {
- if([noDelfileName isEqualToString:fileName]){
- canDelType = NO;
- break;
- }
- }
-
- if(canDelType){
- NSString *filePath = [path stringByAppendingPathComponent:fileName];
-
- // 如果是文件,则删除它
- if ([fileManager fileExistsAtPath:filePath]) {
- BOOL success = [fileManager removeItemAtPath:filePath error:nil];
- if (!success) {
- // 如果删除失败,返回NO并处理错误
- return NO;
- }
- }
- }
-
- }
-
- // 所有文件都成功删除,返回YES
- return YES;
- }
- @end
|