allVersionView.m 7.8 KB

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