allVersionView.m 7.6 KB

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