allVersionView.m 11 KB

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