123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291 |
- //
- // allVersionView.m
- // 隐私保护
- //
- // Created by xd h on 2023/11/27.
- //
- #import "allVersionView.h"
- #import "couldphoneSysInfoModel.h"
- #import "connectDeviceManager.h"
- #import "iPhone.h"
- @interface allVersionView ()<UITableViewDelegate,UITableViewDataSource>
- {
- NSMutableArray*dataArr;
- }
- @property(nonatomic,strong)UIView *whiteBgView;
- @property(nonatomic,strong)UITableView *tableView;
- @property(nonatomic,strong)couldphoneSysInfoModel *couldphoneSysInfoMod;
- @end
- @implementation allVersionView
- - (id)initWithFrame:(CGRect)frame{
- self = [super initWithFrame:frame];
-
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(getCouldPhoneBaseInfoFun:) name:getCouldPhoneSysInfoNotification object:nil];
-
- [self drawAnyView];
-
- return self;
- }
- - (void)drawAnyView{
- dataArr = [NSMutableArray new];
-
- NSString *str1 = NSLocalizedString(@"my_set_about_version_tap_jingxiang",nil);
- NSString *str1_1 = NSLocalizedString(@"my_set_about_version_tap_jingxiang_v",nil);
- NSString *str1_2 = NSLocalizedString(@"my_set_about_version_tap_shuzhu",nil);
- NSString *str2 = NSLocalizedString(@"my_set_about_version_tap_daili",nil);
- NSString *str3 = NSLocalizedString(@"my_set_about_version_tap_TV",nil);
- NSString *str4 = NSLocalizedString(@"my_set_about_version_tap_app",nil);
- NSString *str5 = NSLocalizedString(@"my_set_about_version_tap_sn",nil);
- NSString *str6 = NSLocalizedString(@"my_set_about_version_tap_av",nil);
- NSString *str7 = NSLocalizedString(@"my_set_about_version_tap_newVersion",nil);
- NSString *str8 = @"sdnId";
- NSString *str9 = NSLocalizedString(@"netWork_title",nil);;
-
-
- [dataArr addObject:str1];
- [dataArr addObject:str1_1];
- [dataArr addObject:str1_2];
- [dataArr addObject:str2];
- [dataArr addObject:str3];
- [dataArr addObject:str4];
- [dataArr addObject:str5];
- [dataArr addObject:str6];
- [dataArr addObject:str7];
- [dataArr addObject:str8];
- [dataArr addObject:str9];
-
- self.backgroundColor = [UIColor hwColor:@"#000000" alpha:0.6];
-
- _whiteBgView = [[UIView alloc] init];
- _whiteBgView.backgroundColor = [UIColor whiteColor];
- _whiteBgView.layer.cornerRadius = 8;
- [self addSubview:_whiteBgView];
-
- [_whiteBgView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(20);
- make.right.mas_equalTo(-20);
- make.height.mas_equalTo(560);
- make.centerY.mas_equalTo(self.center).offset(-20);
- }];
-
- UIButton* delBut = [[UIButton alloc] init];
- [delBut setImage:[UIImage imageNamed:@"common_del"] forState:UIControlStateNormal];
- [delBut addTarget:self action:@selector(delViewFun) forControlEvents:UIControlEventTouchUpInside];
- [_whiteBgView addSubview:delBut];
-
- [delBut mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.mas_equalTo(0);
- make.right.mas_equalTo(0);
- make.width.mas_equalTo(40);
- make.height.mas_equalTo(40.0);
- }];
-
- UILabel * versionTipLabel = [[UILabel alloc] init];
- versionTipLabel.text = NSLocalizedString(@"my_set_about_version_tap_tip",nil) ;
- versionTipLabel.textAlignment = NSTextAlignmentCenter;
- versionTipLabel.font = [UIFont boldSystemFontOfSize:16.0];
- versionTipLabel.textColor = [UIColor blackColor];
- [_whiteBgView addSubview:versionTipLabel];
-
- [versionTipLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(15);
- make.right.mas_equalTo(-15);
- make.top.mas_equalTo(30);
- make.height.mas_equalTo(20.0);
- }];
-
- [_whiteBgView addSubview:self.tableView];
-
- [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(15);
- make.right.mas_equalTo(-15);
- make.top.mas_equalTo(versionTipLabel.mas_bottom).offset(20);
- make.bottom.mas_equalTo(-16.0);
- }];
- }
- #pragma mark - 懒加载
- - (UITableView *)tableView{
- if (!_tableView) {
- _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, 0, 0) style:UITableViewStylePlain];
- _tableView.delegate = self;
- _tableView.dataSource = self;
- _tableView.showsVerticalScrollIndicator = NO;
- _tableView.showsHorizontalScrollIndicator = NO;
- // _tableView.contentInset = UIEdgeInsetsMake(-H_STATE_BAR, 0, 0, 0);
- [_tableView setSeparatorStyle:(UITableViewCellSeparatorStyleNone)];
- [_tableView setSeparatorColor:[UIColor clearColor]];
- [_tableView setBackgroundColor:[UIColor hwColor:@"#D8D8D8" alpha:1.0]];
- [_tableView setTableFooterView:[UIView new]];
- [_tableView setBounces:YES];
- _tableView.layer.cornerRadius = 8;
- if (@available(iOS 15.0, *)) {
- _tableView.sectionHeaderTopPadding = 0;
- }
-
- }
-
- return _tableView;
- }
- - (void)delViewFun
- {
- [self removeFromSuperview];
- }
- #pragma mark - 列表委托
- - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
- return dataArr.count;
- }
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
-
- NSInteger row = indexPath.row;
- static NSString *identifier = @"UITableViewCell";
-
- UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:identifier];
- cell.selectionStyle = UITableViewCellSelectionStyleNone;
- if (!cell){
- cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:identifier];
- [cell setSelectionStyle:UITableViewCellSelectionStyleNone];
- [cell setBackgroundColor:[UIColor clearColor]];
- [cell setAccessoryType:(UITableViewCellAccessoryNone)];
-
- cell.textLabel.font = [UIFont systemFontOfSize:12.0];
- cell.textLabel.textColor = [UIColor hwColor:@"#666666" alpha:1.0];
-
- cell.detailTextLabel.font = [UIFont systemFontOfSize:14.0];
- cell.detailTextLabel.textColor = [UIColor hwColor:@"#0A132B" alpha:1.0];
- }
-
- if(row < dataArr.count){
- cell.textLabel.text = dataArr[row];
- }
-
- if(_couldphoneSysInfoMod){
- switch (row)
- {
- case 0:{
- cell.detailTextLabel.numberOfLines = 0;
- //cell.detailTextLabel.text = _couldphoneSysInfoMod.data.data.ImageVersion;
- cell.detailTextLabel.text = _couldphoneSysInfoMod.data.ImageVersion;
- }
- break;
- case 1:
- //cell.detailTextLabel.text = _couldphoneSysInfoMod.data.data.hostImgVer;
- cell.detailTextLabel.text = _couldphoneSysInfoMod.data.hostImgVer;
- break;
- case 2:
- //cell.detailTextLabel.text = _couldphoneSysInfoMod.data.data.hostAgentVer;
- cell.detailTextLabel.text = _couldphoneSysInfoMod.data.hostAgentVer;
- break;
- case 3:
- cell.detailTextLabel.numberOfLines = 0;
- //cell.detailTextLabel.text = [[NSString alloc] initWithFormat:@"%@(%@)",_couldphoneSysInfoMod.data.data.AgentVersion.versionName,_couldphoneSysInfoMod.data.data.AgentVersion.versionCode];
- cell.detailTextLabel.text = [[NSString alloc] initWithFormat:@"%@(%@)",_couldphoneSysInfoMod.data.AgentVersion.versionName,_couldphoneSysInfoMod.data.AgentVersion.versionCode];
- break;
- case 4:
- //cell.detailTextLabel.text = _couldphoneSysInfoMod.data.data.privateTV.versionName;
- cell.detailTextLabel.text = _couldphoneSysInfoMod.data.privateTV.versionName;
- break;
- case 5:{
- NSString *vers = [iPhone appVersion];
- NSString *buildNumber = [iPhone appBuildNumber];
- NSString *versionFullStr = [NSString stringWithFormat:@"V%@(%@)",vers,buildNumber];
-
- //测试
- if([CloudService rangeOfString:@"hiboxde.armclouding.com"].location == NSNotFound){
- versionFullStr = [[NSString alloc] initWithFormat:@"%@_dev",versionFullStr];
- }
-
- cell.detailTextLabel.text = versionFullStr;
- }
- break;
- case 6:{
- // if([_couldphoneSysInfoMod.data.data.sn isEqualToString:ksharedAppDelegate.DeviceThirdIdMod.data.sn]){
- // cell.detailTextLabel.text = _couldphoneSysInfoMod.data.data.sn;
- // }
- // else{
- // cell.detailTextLabel.numberOfLines = 0;
- // cell.detailTextLabel.text = [[NSString alloc] initWithFormat:@"%@(%@)",_couldphoneSysInfoMod.data.data.sn,ksharedAppDelegate.DeviceThirdIdMod.data.sn];
- // }
-
- if([_couldphoneSysInfoMod.data.sn isEqualToString:ksharedAppDelegate.DeviceThirdIdMod.data.sn]){
- cell.detailTextLabel.text = _couldphoneSysInfoMod.data.sn;
- }
- else{
- cell.detailTextLabel.numberOfLines = 0;
- cell.detailTextLabel.text = [[NSString alloc] initWithFormat:@"%@(%@)",_couldphoneSysInfoMod.data.sn,ksharedAppDelegate.DeviceThirdIdMod.data.sn];
- }
- }
- break;
- case 7:{
- //cell.detailTextLabel.text = _couldphoneSysInfoMod.data.data.AVVersion;
- cell.detailTextLabel.text = _couldphoneSysInfoMod.data.AVVersion;
- }
- break;
- case 8:{
- //cell.detailTextLabel.text = _couldphoneSysInfoMod.data.data.MyNewVersion;
- cell.detailTextLabel.text = _couldphoneSysInfoMod.data.MyNewVersion;
- }
- break;
- case 9:{
- cell.detailTextLabel.text = ksharedAppDelegate.DeviceThirdIdMod.data.sdnId;
- }
- break;
- case 10:{
- // NSString *curIp = ksharedAppDelegate.DeviceThirdIdMod.data.ip;
- // NSString * networkStr = @"_LAN";
- // if(![connectDeviceManager shareInstance].isPingOk){
- // networkStr = @"_Not_LAN";
- // }
- // cell.detailTextLabel.text = [[NSString alloc] initWithFormat:@"%@%@",curIp,networkStr];
-
- NSString * networkStr = @"公网";
- if([pingManager shareManager].isPingOk){
- networkStr = @"局域网";
- }
- cell.detailTextLabel.text = networkStr;
- }
- break;
- }
- }
- return cell;
- }
- - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
-
- NSInteger row = indexPath.row;
-
- if(row == 0){
- return 90;
- }
-
- return 40;
- }
- - (void)getCouldPhoneBaseInfoFun:(NSNotification*)not
- {
- _couldphoneSysInfoMod = [not object];
- //HLog(@"%@",baseInfoModel);
-
- if(!_couldphoneSysInfoMod || ![_couldphoneSysInfoMod isKindOfClass:[couldphoneSysInfoModel class]]){
- return;
- }
-
- KWeakSelf
- mainBlock(^{
- [weakSelf.tableView reloadData];
- });
-
- }
- @end
|