MySetViewController.m 17 KB

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