MySetViewController.m 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485
  1. //
  2. // MySetViewController.m
  3. // 双子星云手机
  4. //
  5. // Created by APPLE on 2023/8/17.
  6. //
  7. #import "MySetViewController.h"
  8. #import <SDWebImage.h>
  9. #import <Masonry.h>
  10. #import "HelpDownScrollView.h"
  11. #import "MineViewCell.h"
  12. #import "ChangeLogoViewController.h"
  13. #import "HidenMaskSetViewController.h"
  14. #import "CustomerWebViewController.h"
  15. #import "AboutViewController.h"
  16. #import "iPhone.h"
  17. #import "CloudPhoneAPI.h"
  18. #import "ComontAlretViewController.h"
  19. #import "ModifyPWDFirstViewController.h"
  20. #import "TipsQRCodeForChangeDeviceViewController.h"
  21. #import "connectDeviceManager.h"
  22. #import "mySetHeadView.h"
  23. #import "uploadImageOrVideoViewController.h"
  24. #import "TZImagePickerController.h"
  25. #import "uploadFileRecordViewController.h"
  26. #import "privacyModeViewController.h"
  27. @interface MySetViewController ()<HelpDownScrollViewDelegate,UITableViewDelegate,UITableViewDataSource,ComontAlretViewControllerDelegate>
  28. {
  29. UILabel *phoneLabel;
  30. UILabel *vipTypeTipsLabel;
  31. }
  32. @property (nonatomic, strong, nullable) UITableView *tableView;
  33. @end
  34. @implementation MySetViewController
  35. - (void)viewDidLoad {
  36. [super viewDidLoad];
  37. // Do any additional setup after loading the view.
  38. [self drawAnyView];
  39. }
  40. - (void)drawAnyView{
  41. [self.view setBackgroundColor:HWF5F7FAColor];
  42. [self.toolBar setHidden:YES];
  43. [self.navigationBar setHidden:YES];
  44. [self.navBarBGView setHidden:NO];
  45. [self.titleLabel setText:NSLocalizedString(@"more_set",nil)];
  46. [self.view addSubview:self.tableView];
  47. [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
  48. make.left.mas_equalTo(0);
  49. make.right.mas_equalTo(0);
  50. make.bottom.mas_equalTo(0);
  51. make.top.equalTo(self.navBarBGView.mas_bottom).offset(5.f);
  52. }];
  53. }
  54. - (UIView *)tableHeadView{
  55. UIView *bgView = [[UIView alloc] initWithFrame:(CGRectMake(0, 0, SCREEN_W, 108.f + 15))];
  56. [bgView setBackgroundColor:[UIColor clearColor]];
  57. mySetHeadView *headView = [[mySetHeadView alloc] init];
  58. [bgView addSubview:headView];
  59. headView.layer.cornerRadius = 8;
  60. headView.layer.masksToBounds = YES;
  61. [headView mas_makeConstraints:^(MASConstraintMaker *make) {
  62. make.left.mas_equalTo(15);
  63. make.right.mas_equalTo(-15);
  64. make.top.mas_equalTo(0);
  65. make.bottom.mas_equalTo(-15);
  66. }];
  67. #pragma mark 上传文件相关处理
  68. headView.didClickBut = ^(NSInteger tag) {
  69. if(tag ==2 || tag ==3){
  70. if(self->_getBaseInfo){
  71. self->_getBaseInfo();
  72. }
  73. uploadImageOrVideoViewController *vc = [uploadImageOrVideoViewController new];
  74. if(tag ==2){
  75. vc.isPhotoType = YES;
  76. }
  77. else{
  78. vc.isPhotoType = NO;
  79. }
  80. [self.navigationController pushViewController:vc animated:YES];
  81. }
  82. else if(tag == 1){
  83. uploadFileRecordViewController *vc = [uploadFileRecordViewController new];
  84. vc.isNotUploadingType = YES;
  85. [self.navigationController pushViewController:vc animated:YES];
  86. }
  87. };
  88. return bgView;
  89. }
  90. - (UIView *)tableFoorView{
  91. UIView *bgView = [[UIView alloc] initWithFrame:(CGRectMake(0, 0, SCREEN_W, 68.f))];
  92. [bgView setBackgroundColor:[UIColor clearColor]];
  93. UIButton *tvP2PBtn = [[UIButton alloc] initWithFrame:(CGRectMake(15, 20, SCREEN_W - 2*15.f, 48.f))];
  94. [tvP2PBtn setBackgroundColor:HWFFFFFFColor];
  95. [tvP2PBtn setTitle:NSLocalizedString(@"my_set_no_TV_p2p",nil) forState:(UIControlStateNormal)];
  96. [tvP2PBtn setTitleColor:HW0A132BColor forState:(UIControlStateNormal)];
  97. [tvP2PBtn.titleLabel setFont:[UIFont boldSystemFontOfSize:14.f]];
  98. [tvP2PBtn addTarget:self
  99. action:@selector(tvP2PBtnPressed)
  100. forControlEvents:(UIControlEventTouchUpInside)];
  101. [tvP2PBtn.layer setCornerRadius:8.f];
  102. [bgView addSubview:tvP2PBtn];
  103. return bgView;
  104. }
  105. #pragma mark 点击投屏
  106. - (void)tvP2PBtnPressed{
  107. [self showTVP2PFun];
  108. }
  109. #pragma mark 显示投屏提示语
  110. - (void)showTVP2PFun{
  111. /*弹窗提示TV投屏*/
  112. ComontAlretViewController *nextVC = [[ComontAlretViewController alloc] initWithTiTle:NSLocalizedString(@"my_set_TVP2P_Open_title",nil)
  113. msg:NSLocalizedString(@"my_set_TVP2P_Open_Subtitle",nil)
  114. imageStr:nil
  115. cancelTitle:NSLocalizedString(@"my_set_TVP2P_Open_sure",nil)
  116. okTitle:nil isOkBtnHighlight:NO
  117. didClickOk:^{
  118. HLog(@"111");
  119. } didClickCancel:^{
  120. //HLog(@"2222");
  121. [self gotoSetTVP2PFun];
  122. }];
  123. nextVC.modalPresentationStyle = UIModalPresentationCustom;
  124. [self presentViewController:nextVC animated:YES completion:^{
  125. nextVC.view.superview.backgroundColor = [UIColor clearColor];
  126. }];
  127. }
  128. #pragma mark 确认开始TV投屏
  129. -(void)gotoSetTVP2PFun
  130. {
  131. if(_needToTVP2P){
  132. _needToTVP2P();
  133. }
  134. [self.navigationController popViewControllerAnimated:YES];
  135. }
  136. /*
  137. #pragma mark - Navigation
  138. // In a storyboard-based application, you will often want to do a little preparation before navigation
  139. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  140. // Get the new view controller using [segue destinationViewController].
  141. // Pass the selected object to the new view controller.
  142. }
  143. */
  144. - (void)helpDownScrollViewBePressed:(nonnull id)sender withIndex:(NSInteger)index {
  145. HLog(@"\n----点击了第个%ld按钮----",index);
  146. if (index == 0){
  147. ChangeLogoViewController *nextVC = [[ChangeLogoViewController alloc] init];
  148. [self.navigationController pushViewController:nextVC animated:YES];
  149. }else if (index == 1){/**/
  150. HidenMaskSetViewController *nextVC = [[HidenMaskSetViewController alloc] init];
  151. [self.navigationController pushViewController:nextVC animated:YES];
  152. }
  153. }
  154. #pragma mark - 懒加载
  155. - (UITableView *)tableView{
  156. if (!_tableView) {
  157. _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_W, SCREEN_H - TABBARHEIGHT) style:UITableViewStylePlain];
  158. _tableView.delegate = self;
  159. _tableView.dataSource = self;
  160. _tableView.showsVerticalScrollIndicator = NO;
  161. _tableView.showsHorizontalScrollIndicator = NO;
  162. // _tableView.contentInset = UIEdgeInsetsMake(-H_STATE_BAR, 0, 0, 0);
  163. [_tableView setSeparatorStyle:(UITableViewCellSeparatorStyleNone)];
  164. [_tableView setSeparatorColor:[UIColor clearColor]];
  165. [_tableView setBackgroundColor:[UIColor clearColor]];
  166. [_tableView setTableFooterView:[UIView new]];
  167. [_tableView setBounces:YES];
  168. if (@available(iOS 15.0, *)) {
  169. _tableView.sectionHeaderTopPadding = 0;
  170. }
  171. [_tableView setTableFooterView:[self tableFoorView]];
  172. [_tableView setTableHeaderView:[self tableHeadView]];
  173. }
  174. return _tableView;
  175. }
  176. #pragma mark - 列表委托
  177. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
  178. return 1;
  179. }
  180. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
  181. return 6;
  182. //return 5;//去掉更换icon
  183. }
  184. - (MineViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
  185. NSInteger row = indexPath.row;
  186. static NSString *identifier = @"MineViewCell";
  187. MineViewCell * cell = [tableView dequeueReusableCellWithIdentifier:identifier];
  188. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  189. if (!cell){
  190. cell = [[MineViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:identifier];
  191. [cell setSelectionStyle:UITableViewCellSelectionStyleNone];
  192. [cell setBackgroundColor:[UIColor clearColor]];
  193. [cell setAccessoryType:(UITableViewCellAccessoryNone)];
  194. }
  195. [cell.bgViewLayer removeFromSuperlayer];
  196. [cell.titleLabel2 setHidden:YES];
  197. [cell.rightImage setHidden:NO];
  198. [cell.lineView setHidden:NO];
  199. [cell.maskSwitch setHidden:YES];
  200. if (row == 0){
  201. [cell.titleLabel setText:NSLocalizedString(@"my_set_Privacy_Model",nil)];
  202. [cell.mImageView setImage:[UIImage imageNamed:@"icon_Privacy_model"]];
  203. // [cell.titleLabel setText:NSLocalizedString(@"my_set_no_modify_pwd",nil)];
  204. // [cell.mImageView setImage:[UIImage imageNamed:@"mdoify_pwd"]];
  205. /*上圆角*/
  206. //设置部分圆角 贝塞尔曲线
  207. UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, SCREEN_W-30 , 60)
  208. byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight
  209. cornerRadii:CGSizeMake(8, 8)];
  210. CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
  211. maskLayer.frame = cell.cellBgView.bounds;
  212. maskLayer.path = maskPath.CGPath;
  213. cell.bgViewLayer = maskLayer;
  214. cell.cellBgView.layer.mask = cell.bgViewLayer;
  215. // }else if (row == 1){
  216. // [cell.titleLabel setText:NSLocalizedString(@"my_set_no_change_logo",nil)];
  217. // [cell.mImageView setImage:[UIImage imageNamed:@"icon_change_logo"]];
  218. // // }else if (row == 2){
  219. // // [cell.titleLabel setText:NSLocalizedString(@"mask_view_hiden_set_hiden",nil)];
  220. // // [cell.mImageView setImage:[UIImage imageNamed:@"icon-jincheng"]];
  221. // // }else if (row == 3){
  222. // }else if (row == 1){
  223. // [cell.titleLabel setText:NSLocalizedString(@"my_set_no_fanzhuan_exit",nil)];
  224. // [cell.mImageView setImage:[UIImage imageNamed:@"fanzhuan"]];
  225. // [cell.rightImage setHidden:YES];
  226. // [cell.maskSwitch setHidden:NO];
  227. //}else if (row == 4){/*版本信息*/
  228. }else if (row == 1){/*版本信息*/
  229. [cell.titleLabel setText:NSLocalizedString(@"my_set_no_check_update",nil)];
  230. [cell.mImageView setImage:[UIImage imageNamed:@"app_update"]];
  231. [cell.titleLabel2 setText:[iPhone appVersion]];
  232. [cell.titleLabel2 setHidden:NO];
  233. //}else if (row == 5){/*更换设备*/
  234. }else if (row == 2){/*更换设备*/
  235. [cell.titleLabel setText:NSLocalizedString(@"my_set_no_change_phone",nil)];
  236. [cell.mImageView setImage:[UIImage imageNamed:@"icon_change_ohone"]];
  237. //}else if (row == 6){
  238. }else if (row == 3){/*常见问题*/
  239. [cell.titleLabel setText:NSLocalizedString(@"my_set_no_common_problem",nil)];
  240. [cell.mImageView setImage:[UIImage imageNamed:@"icon_common_problem"]];
  241. }else if (row == 4){/*回复出厂*/
  242. [cell.titleLabel setText:NSLocalizedString(@"my_set_no_Restore_Factory",nil)];
  243. [cell.mImageView setImage:[UIImage imageNamed:@"icon_Restore_Factory"]];
  244. }else if (row == 5){/*重启空间*/
  245. [cell.titleLabel setText:NSLocalizedString(@"my_set_no_restart_phone",nil)];
  246. [cell.mImageView setImage:[UIImage imageNamed:@"icon-gengxin"]];
  247. /*下圆角*/
  248. UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, SCREEN_W-30 , 60)
  249. byRoundingCorners:UIRectCornerBottomLeft | UIRectCornerBottomRight
  250. cornerRadii:CGSizeMake(8, 8)];
  251. CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
  252. maskLayer.frame = cell.cellBgView.bounds;
  253. maskLayer.path = maskPath.CGPath;
  254. cell.bgViewLayer = maskLayer;
  255. cell.cellBgView.layer.mask = cell.bgViewLayer;
  256. [cell.lineView setHidden:YES];
  257. }
  258. return cell;
  259. }
  260. - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
  261. return 60;
  262. }
  263. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
  264. [tableView deselectRowAtIndexPath:indexPath animated:YES];
  265. NSInteger row = indexPath.row;
  266. if (0 == row){
  267. privacyModeViewController *nextVC = [[privacyModeViewController alloc] init];
  268. [self.navigationController pushViewController:nextVC animated:YES];
  269. /*修改密码*/
  270. // ModifyPWDFirstViewController *nextVC = [[ModifyPWDFirstViewController alloc] init];
  271. // [self.navigationController pushViewController:nextVC animated:YES];
  272. // }else if (1 == row){
  273. // /*更换图标*/
  274. // ChangeLogoViewController *nextVC = [[ChangeLogoViewController alloc] init];
  275. // [self.navigationController pushViewController:nextVC animated:YES];
  276. // }else if (1 == row){/*进城隐藏*/
  277. // HidenMaskSetViewController *nextVC = [[HidenMaskSetViewController alloc] init];
  278. // [self.navigationController pushViewController:nextVC animated:YES];
  279. // }else if (3 == row){/*设备翻转*/
  280. // ;
  281. }
  282. //else if (4 == row){/*版本信息*/
  283. else if (1 == row){/*版本信息*/
  284. AboutViewController *vc = [[AboutViewController alloc] init];
  285. vc.getSysInfo = ^{
  286. if(self->_getSysInfo){
  287. self->_getSysInfo();
  288. }
  289. };
  290. [self.navigationController pushViewController:vc animated:YES];
  291. //}else if (5 == row){/*更换设备*/
  292. }else if (2 == row){/*更换设备*/
  293. TipsQRCodeForChangeDeviceViewController *vc = [[TipsQRCodeForChangeDeviceViewController alloc] init];
  294. [self.navigationController pushViewController:vc animated:YES];
  295. }else if (3 == row){/*常见问题*/
  296. CustomerWebViewController *vc = [[CustomerWebViewController alloc] init];
  297. vc.titleStr = NSLocalizedString(@"my_set_no_common_problem",nil);
  298. NSString *url = @"https://cliys.armclouding.com/h5/microserviceUserH5/commonProblem/questionIndex.html";
  299. vc.webUrl = url;
  300. [self.navigationController pushViewController:vc animated:YES];
  301. }else if (4 == row){/*恢复出厂*/
  302. [self RestoreFactoryAleartFun];
  303. }else if (5 == row){/*重启空间*/
  304. /*弹窗提示重启*/
  305. ComontAlretViewController *nextVC = [[ComontAlretViewController alloc] initWithTiTle:NSLocalizedString(@"my_set_no_restart_phone_tips",nil)
  306. msg:nil
  307. imageStr:nil
  308. cancelTitle:NSLocalizedString(@"other_cancel",nil)
  309. okTitle:NSLocalizedString(@"my_set_no_restart_phone_btn_ok",nil) isOkBtnHighlight:NO
  310. didClickOk:^{
  311. } didClickCancel:^{
  312. }];
  313. nextVC.modalPresentationStyle = UIModalPresentationCustom;
  314. nextVC.delegate = self;
  315. [self presentViewController:nextVC animated:YES completion:^{
  316. nextVC.view.superview.backgroundColor = [UIColor clearColor];
  317. }];
  318. }
  319. }
  320. - (void)CommonAlertokBtnClickPressed{
  321. // /*重启云手机*/
  322. // 通过指令通道发送 {"type":"reboot"}
  323. if(_needToReboot){
  324. _needToReboot();
  325. }
  326. //提示语
  327. [[iToast makeText:NSLocalizedString(@"player_link_rebooting_Tips",nil)] show];
  328. }
  329. #pragma mark 点击恢复出厂
  330. - (void)RestoreFactoryAleartFun
  331. {
  332. KWeakSelf
  333. /*弹窗提示恢复出厂*/
  334. ComontAlretViewController *nextVC = [[ComontAlretViewController alloc] initWithTiTle:NSLocalizedString(@"my_set_no_Restore_Factory_tips",nil)
  335. msg:NSLocalizedString(@"my_set_no_Restore_Factory_msg",nil)
  336. imageStr:@"icon_Restore_Factory_big"
  337. cancelTitle:NSLocalizedString(@"my_set_TVP2P_Open_sure",nil)
  338. okTitle:NSLocalizedString(@"other_cancel",nil) isOkBtnHighlight:YES
  339. didClickOk:^{
  340. } didClickCancel:^{
  341. //点击确定
  342. [weakSelf gotoResetFun];
  343. }];
  344. nextVC.modalPresentationStyle = UIModalPresentationCustom;
  345. [self presentViewController:nextVC animated:YES completion:^{
  346. nextVC.view.superview.backgroundColor = [UIColor clearColor];
  347. }];
  348. }
  349. #pragma mark 点击了恢复出厂
  350. - (void)gotoResetFun
  351. {
  352. if(_needToReset){
  353. _needToReset();
  354. }
  355. [self RestoreFactoryingFun];
  356. }
  357. #pragma mark 恢复出厂中
  358. - (void)RestoreFactoryingFun
  359. {
  360. KWeakSelf
  361. /*弹窗提示恢复出厂*/
  362. ComontAlretViewController *nextVC = [[ComontAlretViewController alloc] initWithTiTle:NSLocalizedString(@"my_set_no_Restore_Factorying_tips",nil)
  363. msg:NSLocalizedString(@"my_set_no_Restore_Factorying_msg",nil)
  364. imageStr:nil
  365. cancelTitle:NSLocalizedString(@"my_set_no_Restore_Factorying",nil)
  366. okTitle:nil
  367. isOkBtnHighlight:NO
  368. didClickOk:^{
  369. [weakSelf RestoreFactoryCompleteFun];
  370. } didClickCancel:^{
  371. }];
  372. [nextVC setButtonCountdownFun:180];//90
  373. nextVC.modalPresentationStyle = UIModalPresentationCustom;
  374. [self presentViewController:nextVC animated:YES completion:^{
  375. nextVC.view.superview.backgroundColor = [UIColor clearColor];
  376. }];
  377. }
  378. #pragma mark 恢复出厂倒计时结束
  379. - (void)RestoreFactoryCompleteFun
  380. {
  381. KWeakSelf
  382. //瑞云发起重连
  383. NSString *snStr = [connectDeviceManager shareInstance].DeviceThirdIdMod.data.sn;
  384. if(snStr){
  385. [[connectDeviceManager shareInstance] getThridMsgBySN:snStr needReconnect:YES didNetEnd:^(bool didSuc) {
  386. if(didSuc){
  387. if(self->_needToResetAndOk){
  388. self->_needToResetAndOk();
  389. }
  390. }
  391. else{
  392. [weakSelf RestoreFactoryCompleteFun];
  393. return;
  394. }
  395. }];
  396. }
  397. /*弹窗提示恢复出厂*/
  398. ComontAlretViewController *nextVC = [[ComontAlretViewController alloc] initWithTiTle:NSLocalizedString(@"my_set_no_Restore_Factory_ok_tips",nil)
  399. msg:NSLocalizedString(@"my_set_no_Restore_Factory_ok_msg",nil)
  400. imageStr:nil
  401. cancelTitle:NSLocalizedString(@"my_set_no_Restore_FactoryOK",nil)
  402. okTitle:nil
  403. isOkBtnHighlight:NO
  404. didClickOk:^{
  405. } didClickCancel:^{
  406. [weakSelf.navigationController popViewControllerAnimated:YES];
  407. }];
  408. nextVC.modalPresentationStyle = UIModalPresentationCustom;
  409. [self presentViewController:nextVC animated:YES completion:^{
  410. nextVC.view.superview.backgroundColor = [UIColor clearColor];
  411. }];
  412. }
  413. @end