MySetViewController.m 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300
  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. }
  141. - (MineViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
  142. NSInteger row = indexPath.row;
  143. static NSString *identifier = @"MineViewCell";
  144. MineViewCell * cell = [tableView dequeueReusableCellWithIdentifier:identifier];
  145. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  146. if (!cell){
  147. cell = [[MineViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:identifier];
  148. [cell setSelectionStyle:UITableViewCellSelectionStyleNone];
  149. [cell setBackgroundColor:[UIColor clearColor]];
  150. [cell setAccessoryType:(UITableViewCellAccessoryNone)];
  151. }
  152. [cell.bgViewLayer removeFromSuperlayer];
  153. [cell.titleLabel2 setHidden:YES];
  154. [cell.rightImage setHidden:NO];
  155. [cell.lineView setHidden:NO];
  156. [cell.maskSwitch setHidden:YES];
  157. if (row == 0){
  158. [cell.titleLabel setText:NSLocalizedString(@"my_set_no_modify_pwd",nil)];
  159. [cell.mImageView setImage:[UIImage imageNamed:@"mdoify_pwd"]];
  160. /*上圆角*/
  161. //设置部分圆角 贝塞尔曲线
  162. UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, SCREEN_W-30 , 60)
  163. byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight
  164. cornerRadii:CGSizeMake(8, 8)];
  165. CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
  166. maskLayer.frame = cell.cellBgView.bounds;
  167. maskLayer.path = maskPath.CGPath;
  168. cell.bgViewLayer = maskLayer;
  169. cell.cellBgView.layer.mask = cell.bgViewLayer;
  170. }else if (row == 1){
  171. [cell.titleLabel setText:NSLocalizedString(@"my_set_no_change_logo",nil)];
  172. [cell.mImageView setImage:[UIImage imageNamed:@"icon_change_logo"]];
  173. // }else if (row == 2){
  174. // [cell.titleLabel setText:NSLocalizedString(@"mask_view_hiden_set_hiden",nil)];
  175. // [cell.mImageView setImage:[UIImage imageNamed:@"icon-jincheng"]];
  176. // }else if (row == 3){
  177. }else if (row == 2){
  178. [cell.titleLabel setText:NSLocalizedString(@"my_set_no_fanzhuan_exit",nil)];
  179. [cell.mImageView setImage:[UIImage imageNamed:@"fanzhuan"]];
  180. [cell.rightImage setHidden:YES];
  181. [cell.maskSwitch setHidden:NO];
  182. //}else if (row == 4){/*版本信息*/
  183. }else if (row == 3){/*版本信息*/
  184. [cell.titleLabel setText:NSLocalizedString(@"my_set_no_check_update",nil)];
  185. [cell.mImageView setImage:[UIImage imageNamed:@"app_update"]];
  186. [cell.titleLabel2 setText:[iPhone appVersion]];
  187. [cell.titleLabel2 setHidden:NO];
  188. //}else if (row == 5){/*更换设备*/
  189. }else if (row == 4){/*更换设备*/
  190. [cell.titleLabel setText:NSLocalizedString(@"my_set_no_change_phone",nil)];
  191. [cell.mImageView setImage:[UIImage imageNamed:@"icon_change_ohone"]];
  192. //}else if (row == 6){
  193. }else if (row == 5){
  194. [cell.titleLabel setText:NSLocalizedString(@"my_set_no_restart_phone",nil)];
  195. [cell.mImageView setImage:[UIImage imageNamed:@"icon-gengxin"]];
  196. /*下圆角*/
  197. UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, SCREEN_W-30 , 60)
  198. byRoundingCorners:UIRectCornerBottomLeft | UIRectCornerBottomRight
  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. [cell.lineView setHidden:YES];
  206. }
  207. return cell;
  208. }
  209. - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
  210. return 60;
  211. }
  212. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
  213. [tableView deselectRowAtIndexPath:indexPath animated:YES];
  214. NSInteger row = indexPath.row;
  215. if (0 == row){
  216. /*修改密码*/
  217. ModifyPWDFirstViewController *nextVC = [[ModifyPWDFirstViewController alloc] init];
  218. [self.navigationController pushViewController:nextVC animated:YES];
  219. }else if (1 == row){
  220. /*更换图标*/
  221. ChangeLogoViewController *nextVC = [[ChangeLogoViewController alloc] init];
  222. [self.navigationController pushViewController:nextVC animated:YES];
  223. }else if (2 == row){/*进城隐藏*/
  224. // HidenMaskSetViewController *nextVC = [[HidenMaskSetViewController alloc] init];
  225. // [self.navigationController pushViewController:nextVC animated:YES];
  226. // }else if (3 == row){/*设备翻转*/
  227. // ;
  228. }
  229. //else if (4 == row){/*版本信息*/
  230. else if (3 == row){/*版本信息*/
  231. AboutViewController *vc = [[AboutViewController alloc] init];
  232. [self.navigationController pushViewController:vc animated:YES];
  233. //}else if (5 == row){/*更换设备*/
  234. }else if (4 == row){/*更换设备*/
  235. TipsQRCodeForChangeDeviceViewController *vc = [[TipsQRCodeForChangeDeviceViewController alloc] init];
  236. [self.navigationController pushViewController:vc animated:YES];
  237. // }else if (6 == row){/*重启空间*/
  238. }else if (5 == row){/*重启空间*/
  239. /*弹窗提示重启*/
  240. ComontAlretViewController *nextVC = [[ComontAlretViewController alloc] initWithTiTle:NSLocalizedString(@"my_set_no_restart_phone_tips",nil)
  241. msg:nil
  242. cancelTitle:NSLocalizedString(@"other_cancel",nil)
  243. okTitle:NSLocalizedString(@"my_set_no_restart_phone_btn_ok",nil) isOkBtnHighlight:NO
  244. didClickOk:^{
  245. } didClickCancel:^{
  246. }];
  247. nextVC.modalPresentationStyle = UIModalPresentationCustom;
  248. nextVC.delegate = self;
  249. [self presentViewController:nextVC animated:YES completion:^{
  250. nextVC.view.superview.backgroundColor = [UIColor clearColor];
  251. }];
  252. }
  253. }
  254. - (void)CommonAlertokBtnClickPressed{
  255. // /*重启云手机*/
  256. // 通过指令通道发送 {"type":"reboot"}
  257. if(_needToReboot){
  258. _needToReboot();
  259. }
  260. //提示语
  261. [[iToast makeText:NSLocalizedString(@"my_set_no_restart_phone_ok_tips",nil)] show];
  262. }
  263. @end