12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115 |
- //
- // 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);
- CGFloat totalHeight = 10 + 220 + 25 + 220 +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:isSelectFileTransfer];
- }
- - (void)ClearCommonCacheFun:(BOOL)isSelectFileTransfer
- {
- NSString *ruiyunLogPath = [NSString stringWithFormat:@"%@/logs/debug_0.log",CachesPatch];
- long logSize1 = [iTools fileSizeAtPath:ruiyunLogPath];
- [[NSFileManager defaultManager] removeItemAtPath:ruiyunLogPath error:nil];
-
- NSString *appLogPath = [NSString stringWithFormat:@"%@/logs/app.log",CachesPatch];
- long logSize2 = [iTools fileSizeAtPath:appLogPath];
-
- [[NSFileManager defaultManager] removeItemAtPath:appLogPath error:nil];
-
- //
- NSString *downLoadThumbnailPath = [NSString stringWithFormat:@"%@/DownLoadThumbnail",CachesPatch];
- long logSize3 = [iTools folderSizeAtPath:downLoadThumbnailPath];
-
- [[NSFileManager defaultManager] removeItemAtPath:downLoadThumbnailPath error:nil];
-
- long clearTotal = logSize1 + logSize2 + logSize3;
-
- if(isSelectFileTransfer){
- [self clearCacheByFileTransferFun:clearTotal];
- }
- else{
- [self showClearAllTipBy:clearTotal];
- }
-
- }
- - (void)showClearAllTipBy:(long)clearTotal
- {
- long clearTotalK = clearTotal /1024;
-
- NSString *tipStr1 = NSLocalizedString(@"my_set_no_clear_finish",nil);
- NSString *tipStr2 = @"";
-
- if(clearTotalK > 1024*1024){
- tipStr2 = [[NSString alloc] initWithFormat:@"%.02fGB",clearTotalK/1024.0/1024.0];
- }
- else if(clearTotalK > 1024){
- tipStr2 = [[NSString alloc] initWithFormat:@"%.02fMB",clearTotalK/1024.0];
- }
- else //if(clearTotalK > 0)
- {
- tipStr2 = [[NSString alloc] initWithFormat:@"%ldKB",clearTotalK];
- }
-
- NSString *tipfullStr = [[NSString alloc] initWithFormat:@"%@%@",tipStr1,tipStr2];
- //提示语
- [[iToast makeText:tipfullStr] show];
- }
- - (void)clearCacheByFileTransferFun:(long)clearTotal
- {
- //清理图片
- BOOL needReUploadingType = NO;
- NSString *ImagePath = [NSString stringWithFormat:@"%@/Image",CachesPatch];
- long imageAllSize = [iTools folderSizeAtPath:ImagePath];
-
- 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];
- long vide0AllSizeBeforeClear = [iTools folderSizeAtPath:videoPath];
-
- 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];
- }
-
- long vide0AllSizeAfterClear = [iTools folderSizeAtPath:videoPath];
-
-
- //清理下载中
- NSString *downLoadingPath = [NSString stringWithFormat:@"%@/DownLoadFlie",CachesPatch];
- long downLoadingSizeBeforeClear = [iTools folderSizeAtPath:downLoadingPath];
-
- 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];
- }
-
- long downLoadingSizeAfterClear = [iTools folderSizeAtPath:downLoadingPath];
-
-
- //清理数据库表 完成的
-
- //下载完成
- NSMutableString* where = [[NSMutableString alloc] initWithString:@"where "];
- NSString *curStr = [NSString stringWithFormat:@"%@=%@ or %@=%@ ",bg_sqlKey(@"curDownloadStateType"),bg_sqlValue([NSNumber numberWithInt:downloadStateDone]),bg_sqlKey(@"curDownloadStateType"),bg_sqlValue([NSNumber numberWithInt:downloadStateFail])];
- [where appendString:curStr];
- [couldPhoneFileModel bg_deleteAsync:download_tableName where:where complete:^(BOOL isSuccess) {
- }];
-
- //上传完成
- NSMutableString* where2 = [[NSMutableString alloc] initWithString:@"where "];
- NSString *curStr2 = [NSString stringWithFormat:@"%@=%@ or %@=%@ ",bg_sqlKey(@"curUploadStateType"),bg_sqlValue([NSNumber numberWithInt:uploadStateDone]),
- bg_sqlKey(@"curUploadStateType"),bg_sqlValue([NSNumber numberWithInt:uploadStateFail])];
- [where2 appendString:curStr2];
-
- [uploadFileDataModel bg_deleteAsync:upLoadFile_image_tableName where:where2 complete:^(BOOL isSuccess) {
- }];
-
- long curTotolSize = (downLoadingSizeBeforeClear - downLoadingSizeAfterClear) + (vide0AllSizeBeforeClear - vide0AllSizeAfterClear) + imageAllSize + clearTotal;
-
- [self showClearAllTipBy:curTotolSize];
- }
- - (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
|