MySetViewController.m 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  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. @interface MySetViewController ()<HelpDownScrollViewDelegate,UITableViewDelegate,UITableViewDataSource,ComontAlretViewControllerDelegate>
  22. {
  23. UILabel *phoneLabel;
  24. UILabel *vipTypeTipsLabel;
  25. }
  26. @property (nonatomic, strong, nullable) UITableView *tableView;
  27. @end
  28. @implementation MySetViewController
  29. - (void)viewDidLoad {
  30. [super viewDidLoad];
  31. // Do any additional setup after loading the view.
  32. [self drawAnyView];
  33. }
  34. - (void)drawAnyView{
  35. [self.view setBackgroundColor:HWF5F7FAColor];
  36. [self.toolBar setHidden:YES];
  37. [self.navigationBar setHidden:YES];
  38. [self.navBarBGView setHidden:NO];
  39. [self.titleLabel setText:NSLocalizedString(@"more_set",nil)];
  40. [self.view addSubview:self.tableView];
  41. [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
  42. make.left.mas_equalTo(0);
  43. make.right.mas_equalTo(0);
  44. make.bottom.mas_equalTo(0);
  45. make.top.equalTo(self.navBarBGView.mas_bottom).offset(5.f);
  46. }];
  47. }
  48. - (UIView *)tableFoorView{
  49. UIView *bgView = [[UIView alloc] initWithFrame:(CGRectMake(0, 0, SCREEN_W, 68.f))];
  50. [bgView setBackgroundColor:[UIColor clearColor]];
  51. UIButton *tvP2PBtn = [[UIButton alloc] initWithFrame:(CGRectMake(15, 20, SCREEN_W - 2*15.f, 48.f))];
  52. [tvP2PBtn setBackgroundColor:HWFFFFFFColor];
  53. [tvP2PBtn setTitle:NSLocalizedString(@"my_set_no_TV_p2p",nil) forState:(UIControlStateNormal)];
  54. [tvP2PBtn setTitleColor:HW0A132BColor forState:(UIControlStateNormal)];
  55. [tvP2PBtn.titleLabel setFont:[UIFont boldSystemFontOfSize:14.f]];
  56. [tvP2PBtn addTarget:self
  57. action:@selector(tvP2PBtnPressed)
  58. forControlEvents:(UIControlEventTouchUpInside)];
  59. [tvP2PBtn.layer setCornerRadius:8.f];
  60. [bgView addSubview:tvP2PBtn];
  61. return bgView;
  62. }
  63. #pragma mark 点击投屏
  64. - (void)tvP2PBtnPressed{
  65. [self showTVP2PFun];
  66. }
  67. #pragma mark 显示投屏提示语
  68. - (void)showTVP2PFun{
  69. /*弹窗提示TV投屏*/
  70. ComontAlretViewController *nextVC = [[ComontAlretViewController alloc] initWithTiTle:NSLocalizedString(@"my_set_TVP2P_Open_title",nil)
  71. msg:NSLocalizedString(@"my_set_TVP2P_Open_Subtitle",nil)
  72. cancelTitle:NSLocalizedString(@"my_set_TVP2P_Open_sure",nil)
  73. okTitle:nil isOkBtnHighlight:NO
  74. didClickOk:^{
  75. HLog(@"111");
  76. } didClickCancel:^{
  77. //HLog(@"2222");
  78. [self gotoSetTVP2PFun];
  79. }];
  80. nextVC.modalPresentationStyle = UIModalPresentationCustom;
  81. [self presentViewController:nextVC animated:YES completion:^{
  82. nextVC.view.superview.backgroundColor = [UIColor clearColor];
  83. }];
  84. }
  85. #pragma mark 确认开始TV投屏
  86. -(void)gotoSetTVP2PFun
  87. {
  88. if(_needToTVP2P){
  89. _needToTVP2P();
  90. }
  91. [self.navigationController popViewControllerAnimated:YES];
  92. }
  93. /*
  94. #pragma mark - Navigation
  95. // In a storyboard-based application, you will often want to do a little preparation before navigation
  96. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  97. // Get the new view controller using [segue destinationViewController].
  98. // Pass the selected object to the new view controller.
  99. }
  100. */
  101. - (void)helpDownScrollViewBePressed:(nonnull id)sender withIndex:(NSInteger)index {
  102. HLog(@"\n----点击了第个%ld按钮----",index);
  103. if (index == 0){
  104. ChangeLogoViewController *nextVC = [[ChangeLogoViewController alloc] init];
  105. [self.navigationController pushViewController:nextVC animated:YES];
  106. }else if (index == 1){/**/
  107. HidenMaskSetViewController *nextVC = [[HidenMaskSetViewController alloc] init];
  108. [self.navigationController pushViewController:nextVC animated:YES];
  109. }
  110. }
  111. #pragma mark - 懒加载
  112. - (UITableView *)tableView{
  113. if (!_tableView) {
  114. _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_W, SCREEN_H - TABBARHEIGHT) style:UITableViewStylePlain];
  115. _tableView.delegate = self;
  116. _tableView.dataSource = self;
  117. _tableView.showsVerticalScrollIndicator = NO;
  118. _tableView.showsHorizontalScrollIndicator = NO;
  119. // _tableView.contentInset = UIEdgeInsetsMake(-H_STATE_BAR, 0, 0, 0);
  120. [_tableView setSeparatorStyle:(UITableViewCellSeparatorStyleNone)];
  121. [_tableView setSeparatorColor:[UIColor clearColor]];
  122. [_tableView setBackgroundColor:[UIColor clearColor]];
  123. [_tableView setTableFooterView:[UIView new]];
  124. [_tableView setBounces:YES];
  125. if (@available(iOS 15.0, *)) {
  126. _tableView.sectionHeaderTopPadding = 0;
  127. }
  128. //TV投屏 阿胡说暂不做
  129. [_tableView setTableFooterView:[self tableFoorView]];
  130. }
  131. return _tableView;
  132. }
  133. #pragma mark - 列表委托
  134. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
  135. return 1;
  136. }
  137. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
  138. //return 7;
  139. //return 6;//去掉隐藏进程
  140. return 5;//去掉更换icon
  141. }
  142. - (MineViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
  143. NSInteger row = indexPath.row;
  144. static NSString *identifier = @"MineViewCell";
  145. MineViewCell * cell = [tableView dequeueReusableCellWithIdentifier:identifier];
  146. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  147. if (!cell){
  148. cell = [[MineViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:identifier];
  149. [cell setSelectionStyle:UITableViewCellSelectionStyleNone];
  150. [cell setBackgroundColor:[UIColor clearColor]];
  151. [cell setAccessoryType:(UITableViewCellAccessoryNone)];
  152. }
  153. [cell.bgViewLayer removeFromSuperlayer];
  154. [cell.titleLabel2 setHidden:YES];
  155. [cell.rightImage setHidden:NO];
  156. [cell.lineView setHidden:NO];
  157. [cell.maskSwitch setHidden:YES];
  158. if (row == 0){
  159. [cell.titleLabel setText:NSLocalizedString(@"my_set_no_modify_pwd",nil)];
  160. [cell.mImageView setImage:[UIImage imageNamed:@"mdoify_pwd"]];
  161. /*上圆角*/
  162. //设置部分圆角 贝塞尔曲线
  163. UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, SCREEN_W-30 , 60)
  164. byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight
  165. cornerRadii:CGSizeMake(8, 8)];
  166. CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
  167. maskLayer.frame = cell.cellBgView.bounds;
  168. maskLayer.path = maskPath.CGPath;
  169. cell.bgViewLayer = maskLayer;
  170. cell.cellBgView.layer.mask = cell.bgViewLayer;
  171. // }else if (row == 1){
  172. // [cell.titleLabel setText:NSLocalizedString(@"my_set_no_change_logo",nil)];
  173. // [cell.mImageView setImage:[UIImage imageNamed:@"icon_change_logo"]];
  174. // // }else if (row == 2){
  175. // // [cell.titleLabel setText:NSLocalizedString(@"mask_view_hiden_set_hiden",nil)];
  176. // // [cell.mImageView setImage:[UIImage imageNamed:@"icon-jincheng"]];
  177. // // }else if (row == 3){
  178. }else if (row == 1){
  179. [cell.titleLabel setText:NSLocalizedString(@"my_set_no_fanzhuan_exit",nil)];
  180. [cell.mImageView setImage:[UIImage imageNamed:@"fanzhuan"]];
  181. [cell.rightImage setHidden:YES];
  182. [cell.maskSwitch setHidden:NO];
  183. //}else if (row == 4){/*版本信息*/
  184. }else if (row == 2){/*版本信息*/
  185. [cell.titleLabel setText:NSLocalizedString(@"my_set_no_check_update",nil)];
  186. [cell.mImageView setImage:[UIImage imageNamed:@"app_update"]];
  187. [cell.titleLabel2 setText:[iPhone appVersion]];
  188. [cell.titleLabel2 setHidden:NO];
  189. //}else if (row == 5){/*更换设备*/
  190. }else if (row == 3){/*更换设备*/
  191. [cell.titleLabel setText:NSLocalizedString(@"my_set_no_change_phone",nil)];
  192. [cell.mImageView setImage:[UIImage imageNamed:@"icon_change_ohone"]];
  193. //}else if (row == 6){
  194. }else if (row == 4){
  195. [cell.titleLabel setText:NSLocalizedString(@"my_set_no_restart_phone",nil)];
  196. [cell.mImageView setImage:[UIImage imageNamed:@"icon-gengxin"]];
  197. /*下圆角*/
  198. UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, SCREEN_W-30 , 60)
  199. byRoundingCorners:UIRectCornerBottomLeft | UIRectCornerBottomRight
  200. cornerRadii:CGSizeMake(8, 8)];
  201. CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
  202. maskLayer.frame = cell.cellBgView.bounds;
  203. maskLayer.path = maskPath.CGPath;
  204. cell.bgViewLayer = maskLayer;
  205. cell.cellBgView.layer.mask = cell.bgViewLayer;
  206. [cell.lineView setHidden:YES];
  207. }
  208. return cell;
  209. }
  210. - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
  211. return 60;
  212. }
  213. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
  214. [tableView deselectRowAtIndexPath:indexPath animated:YES];
  215. NSInteger row = indexPath.row;
  216. if (0 == row){
  217. /*修改密码*/
  218. ModifyPWDFirstViewController *nextVC = [[ModifyPWDFirstViewController alloc] init];
  219. [self.navigationController pushViewController:nextVC animated:YES];
  220. // }else if (1 == row){
  221. // /*更换图标*/
  222. // ChangeLogoViewController *nextVC = [[ChangeLogoViewController alloc] init];
  223. // [self.navigationController pushViewController:nextVC animated:YES];
  224. }else if (1 == row){/*进城隐藏*/
  225. // HidenMaskSetViewController *nextVC = [[HidenMaskSetViewController alloc] init];
  226. // [self.navigationController pushViewController:nextVC animated:YES];
  227. // }else if (3 == row){/*设备翻转*/
  228. // ;
  229. }
  230. //else if (4 == row){/*版本信息*/
  231. else if (2 == row){/*版本信息*/
  232. AboutViewController *vc = [[AboutViewController alloc] init];
  233. [self.navigationController pushViewController:vc animated:YES];
  234. //}else if (5 == row){/*更换设备*/
  235. }else if (3 == row){/*更换设备*/
  236. TipsQRCodeForChangeDeviceViewController *vc = [[TipsQRCodeForChangeDeviceViewController alloc] init];
  237. [self.navigationController pushViewController:vc animated:YES];
  238. // }else if (6 == row){/*重启空间*/
  239. }else if (4 == row){/*重启空间*/
  240. /*弹窗提示重启*/
  241. ComontAlretViewController *nextVC = [[ComontAlretViewController alloc] initWithTiTle:NSLocalizedString(@"my_set_no_restart_phone_tips",nil)
  242. msg:nil
  243. cancelTitle:NSLocalizedString(@"other_cancel",nil)
  244. okTitle:NSLocalizedString(@"my_set_no_restart_phone_btn_ok",nil) isOkBtnHighlight:NO
  245. didClickOk:^{
  246. } didClickCancel:^{
  247. }];
  248. nextVC.modalPresentationStyle = UIModalPresentationCustom;
  249. nextVC.delegate = self;
  250. [self presentViewController:nextVC animated:YES completion:^{
  251. nextVC.view.superview.backgroundColor = [UIColor clearColor];
  252. }];
  253. }
  254. }
  255. - (void)CommonAlertokBtnClickPressed{
  256. // /*重启云手机*/
  257. // 通过指令通道发送 {"type":"reboot"}
  258. if(_needToReboot){
  259. _needToReboot();
  260. }
  261. //提示语
  262. [[iToast makeText:NSLocalizedString(@"player_link_rebooting_Tips",nil)] show];
  263. }
  264. @end