allVersionView.m 8.5 KB

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