MySetViewController.m 18 KB

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