MySetViewController.m 19 KB

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