123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167 |
- //
- // MySetViewController.m
- // Private-X
- //
- // 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"
- #import "customShareManageTool.h"
- #import "previewImageOrVideoViewController.h"
- #import "previewAudioOrDocumentViewController.h"
- #import "previewFileAndFolderViewController.h"
- #import "shareRecordViewController.h"
- #import "backupsOptionViewController.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 100:{
- //[[customShareManageTool sharedManager] shareType:1 withShareUrl:@"https://baidu.com" withShareTitle:@"我是标题" withShareContent:@"我是测试内容"];
- previewImageOrVideoViewController *vc = [previewImageOrVideoViewController new];
- vc.isPhotoType = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case 101:{
- //[[customShareManageTool sharedManager] shareType:2 withShareUrl:@"https://baidu.com" withShareTitle:@"我是标题" withShareContent:@"我是测试内容"];
- previewImageOrVideoViewController *vc = [previewImageOrVideoViewController new];
- vc.isPhotoType = NO;
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case 102:{
- //[[customShareManageTool sharedManager] shareType:3 withShareUrl:@"https://baidu.com" withShareTitle:@"我是标题" withShareContent:@"我是测试内容"];
- previewAudioOrDocumentViewController *vc = [previewAudioOrDocumentViewController new];
- vc.isAudioType = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case 103:{
- previewFileAndFolderViewController *vc = [previewFileAndFolderViewController new];
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case 104:{
- shareRecordViewController *vc = [shareRecordViewController new];
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case 105:{
- backupsOptionViewController *vc = [backupsOptionViewController new];
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case 106:
- {
- 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 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 10:{
- inputPWDViewController *nextVC = [inputPWDViewController new];
- nextVC.isCheckPwdType = YES;
- [self.navigationController pushViewController:nextVC animated:YES];
-
-
- nextVC.didInputRightPwdFun = ^{
- [weakSelf gotoPrivacyModeVCFun];
- };
- }
- break;
- case 11:
- {
- TipsQRCodeForChangeDeviceViewController *vc = [[TipsQRCodeForChangeDeviceViewController alloc] init];
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case 12:
- {
- /*弹窗提示重启*/
- 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 13:
- {
- [self RestoreFactoryAleartFun];
- }
- break;
- case 14:
- {
- 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 15:
- {
- AboutViewController *vc = [[AboutViewController alloc] init];
- vc.getSysInfo = ^{
- if(self->_getSysInfo){
- self->_getSysInfo();
- }
- };
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case 16:
- {
- [self clickClearCacheButtonFun];
- }
- break;
- default:
- break;
- }
-
- }
- - (void)gotoClosePhotosBackupsFun
- {
- [[self customTableHeadView] closeImageBackupsFun];
- }
- - (void)checkDidHadUploadTaskFunWith:(NSInteger)tag
- {
- KWeakSelf
- [[nasUploadFileManager 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
- {
- //[[webSocketManager shareInstance] getBaseInfoFun];
-
- 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 = ksharedAppDelegate.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
-
- [[nasUploadFileManager 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(), ^{
- [[nasDownloadFileManager 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
|