MySetViewController.m 19 KB

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