allVersionView.m 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. //
  2. // allVersionView.m
  3. // 隐私保护
  4. //
  5. // Created by xd h on 2023/11/27.
  6. //
  7. #import "allVersionView.h"
  8. #import "couldphoneSysInfoModel.h"
  9. #import "connectDeviceManager.h"
  10. #import "iPhone.h"
  11. @interface allVersionView ()<UITableViewDelegate,UITableViewDataSource>
  12. {
  13. NSMutableArray*dataArr;
  14. }
  15. @property(nonatomic,strong)UIView *whiteBgView;
  16. @property(nonatomic,strong)UITableView *tableView;
  17. @property(nonatomic,strong)couldphoneSysInfoModel *couldphoneSysInfoMod;
  18. @end
  19. @implementation allVersionView
  20. - (id)initWithFrame:(CGRect)frame{
  21. self = [super initWithFrame:frame];
  22. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(getCouldPhoneBaseInfoFun:) name:getCouldPhoneSysInfoNotification object:nil];
  23. [self drawAnyView];
  24. return self;
  25. }
  26. - (void)drawAnyView{
  27. dataArr = [NSMutableArray new];
  28. NSString *str1 = NSLocalizedString(@"my_set_about_version_tap_jingxiang",nil);
  29. NSString *str2 = NSLocalizedString(@"my_set_about_version_tap_daili",nil);
  30. NSString *str3 = NSLocalizedString(@"my_set_about_version_tap_TV",nil);
  31. NSString *str4 = NSLocalizedString(@"my_set_about_version_tap_app",nil);
  32. NSString *str5 = NSLocalizedString(@"my_set_about_version_tap_sn",nil);
  33. NSString *str6 = NSLocalizedString(@"my_set_about_version_tap_av",nil);
  34. [dataArr addObject:str1];
  35. [dataArr addObject:str2];
  36. [dataArr addObject:str3];
  37. [dataArr addObject:str4];
  38. [dataArr addObject:str5];
  39. [dataArr addObject:str6];
  40. self.backgroundColor = [UIColor hwColor:@"#000000" alpha:0.6];
  41. _whiteBgView = [[UIView alloc] init];
  42. _whiteBgView.backgroundColor = [UIColor whiteColor];
  43. _whiteBgView.layer.cornerRadius = 8;
  44. [self addSubview:_whiteBgView];
  45. [_whiteBgView mas_makeConstraints:^(MASConstraintMaker *make) {
  46. make.left.mas_equalTo(20);
  47. make.right.mas_equalTo(-20);
  48. make.height.mas_equalTo(380);
  49. make.centerY.mas_equalTo(self.center).offset(-20);
  50. }];
  51. UIButton* delBut = [[UIButton alloc] init];
  52. [delBut setImage:[UIImage imageNamed:@"common_del"] forState:UIControlStateNormal];
  53. [delBut addTarget:self action:@selector(delViewFun) forControlEvents:UIControlEventTouchUpInside];
  54. [_whiteBgView addSubview:delBut];
  55. [delBut mas_makeConstraints:^(MASConstraintMaker *make) {
  56. make.top.mas_equalTo(0);
  57. make.right.mas_equalTo(0);
  58. make.width.mas_equalTo(40);
  59. make.height.mas_equalTo(40.0);
  60. }];
  61. UILabel * versionTipLabel = [[UILabel alloc] init];
  62. versionTipLabel.text = NSLocalizedString(@"my_set_about_version_tap_tip",nil) ;
  63. versionTipLabel.textAlignment = NSTextAlignmentCenter;
  64. versionTipLabel.font = [UIFont boldSystemFontOfSize:16.0];
  65. [_whiteBgView addSubview:versionTipLabel];
  66. [versionTipLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  67. make.left.mas_equalTo(15);
  68. make.right.mas_equalTo(-15);
  69. make.top.mas_equalTo(30);
  70. make.height.mas_equalTo(20.0);
  71. }];
  72. [_whiteBgView addSubview:self.tableView];
  73. [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
  74. make.left.mas_equalTo(15);
  75. make.right.mas_equalTo(-15);
  76. make.top.mas_equalTo(versionTipLabel.mas_bottom).offset(20);
  77. make.bottom.mas_equalTo(-16.0);
  78. }];
  79. }
  80. #pragma mark - 懒加载
  81. - (UITableView *)tableView{
  82. if (!_tableView) {
  83. _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, 0, 0) style:UITableViewStylePlain];
  84. _tableView.delegate = self;
  85. _tableView.dataSource = self;
  86. _tableView.showsVerticalScrollIndicator = NO;
  87. _tableView.showsHorizontalScrollIndicator = NO;
  88. // _tableView.contentInset = UIEdgeInsetsMake(-H_STATE_BAR, 0, 0, 0);
  89. [_tableView setSeparatorStyle:(UITableViewCellSeparatorStyleNone)];
  90. [_tableView setSeparatorColor:[UIColor clearColor]];
  91. [_tableView setBackgroundColor:[UIColor hwColor:@"#D8D8D8" alpha:1.0]];
  92. [_tableView setTableFooterView:[UIView new]];
  93. [_tableView setBounces:YES];
  94. _tableView.layer.cornerRadius = 8;
  95. if (@available(iOS 15.0, *)) {
  96. _tableView.sectionHeaderTopPadding = 0;
  97. }
  98. }
  99. return _tableView;
  100. }
  101. - (void)delViewFun
  102. {
  103. [self removeFromSuperview];
  104. }
  105. #pragma mark - 列表委托
  106. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
  107. return dataArr.count;
  108. }
  109. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
  110. NSInteger row = indexPath.row;
  111. static NSString *identifier = @"UITableViewCell";
  112. UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:identifier];
  113. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  114. if (!cell){
  115. cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:identifier];
  116. [cell setSelectionStyle:UITableViewCellSelectionStyleNone];
  117. [cell setBackgroundColor:[UIColor clearColor]];
  118. [cell setAccessoryType:(UITableViewCellAccessoryNone)];
  119. cell.textLabel.font = [UIFont systemFontOfSize:12.0];
  120. cell.textLabel.textColor = [UIColor hwColor:@"#666666" alpha:1.0];
  121. cell.detailTextLabel.font = [UIFont systemFontOfSize:14.0];
  122. cell.detailTextLabel.textColor = [UIColor hwColor:@"#0A132B" alpha:1.0];
  123. }
  124. if(row < dataArr.count){
  125. cell.textLabel.text = dataArr[row];
  126. }
  127. if(_couldphoneSysInfoMod){
  128. switch (row)
  129. {
  130. case 0:{
  131. cell.detailTextLabel.numberOfLines = 0;
  132. cell.detailTextLabel.text = _couldphoneSysInfoMod.data.data.ImageVersion;
  133. }
  134. break;
  135. case 1:
  136. cell.detailTextLabel.text = _couldphoneSysInfoMod.data.data.AgentVersion.versionName;
  137. break;
  138. case 2:
  139. cell.detailTextLabel.text = _couldphoneSysInfoMod.data.data.privateTV.versionName;
  140. break;
  141. case 3:{
  142. NSString *vers = [iPhone appVersion];
  143. cell.detailTextLabel.text = [NSString stringWithFormat:@"V%@",vers];
  144. }
  145. break;
  146. case 4:
  147. //cell.detailTextLabel.text = _couldphoneSysInfoMod.data.data.sn;
  148. cell.detailTextLabel.text = [connectDeviceManager shareInstance].DeviceThirdIdMod.data.sn;
  149. break;
  150. case 5:{
  151. cell.detailTextLabel.text = _couldphoneSysInfoMod.data.data.AVVersion;
  152. }
  153. break;
  154. }
  155. }
  156. return cell;
  157. }
  158. - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
  159. NSInteger row = indexPath.row;
  160. if(row == 0){
  161. return 90;
  162. }
  163. return 40;
  164. }
  165. - (void)getCouldPhoneBaseInfoFun:(NSNotification*)not
  166. {
  167. _couldphoneSysInfoMod = [not object];
  168. //HLog(@"%@",baseInfoModel);
  169. if(!_couldphoneSysInfoMod || ![_couldphoneSysInfoMod isKindOfClass:[couldphoneSysInfoModel class]]){
  170. return;
  171. }
  172. [self.tableView reloadData];
  173. }
  174. @end