MySetViewController.m 19 KB

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