| | |
| | | @property (nonatomic, weak) IBOutlet UILabel *currentVersionLabel; |
| | | @property (nonatomic, weak) IBOutlet UILabel *nVersionLabel; |
| | | @property (nonatomic, weak) IBOutlet UIImageView *updateImageView; |
| | | @property (nonatomic, strong) UIButton *deleteButton; |
| | | @property (nonatomic, strong) EZDeviceVersion *deviceVersion; |
| | | @property (nonatomic, strong) NSTimer *timer; |
| | | |
| | |
| | | self.serialLabel.text = self.deviceInfo.deviceSerial; |
| | | |
| | | self.updateImageView.hidden = YES; |
| | | __weak __typeof(self)weakSelf = self; |
| | | [EZOPENSDK getDeviceVersion:self.deviceInfo.deviceSerial |
| | | completion:^(EZDeviceVersion *version, NSError *error) { |
| | | _deviceVersion = version; |
| | | self.currentVersionLabel.text = version.currentVersion; |
| | | if(version.isNeedUpgrade) |
| | | { |
| | | self.nVersionLabel.text = version.latestVersion; |
| | | self.updateImageView.hidden = NO; |
| | | } |
| | | else |
| | | { |
| | | self.updateImageView.hidden = YES; |
| | | self.nVersionLabel.text = version.currentVersion; |
| | | } |
| | | }]; |
| | | weakSelf.deviceVersion = version; |
| | | weakSelf.currentVersionLabel.text = version.currentVersion; |
| | | if(version.isNeedUpgrade) { |
| | | weakSelf.nVersionLabel.text = version.latestVersion; |
| | | weakSelf.updateImageView.hidden = NO; |
| | | } else { |
| | | weakSelf.updateImageView.hidden = YES; |
| | | weakSelf.nVersionLabel.text = version.currentVersion; |
| | | } |
| | | }]; |
| | | [self.privacyMaskSwitch setOn:NO]; |
| | | [self getPrivacyMaskSwitchStatus]; |
| | | self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone; |
| | | // [[EzvizDeviceManager sharedManager] startP2PHolePunching:_cameraInfo.cameraId completion:^(BOOL result, NSError *error) { |
| | | // NSLog(@"result = %d, error = %@", result, error); |
| | | // }]; |
| | |
| | | // Dispose of any resources that can be recreated. |
| | | } |
| | | |
| | | - (void)getPrivacyMaskSwitchStatus { // 获取镜头遮蔽开关状态 |
| | | __weak __typeof(self)weakSelf = self; |
| | | [EZHttpUtil.sharedManager getCoverSwitchStatus:self.deviceInfo.deviceSerial completion:^(ResponseData * _Nonnull responseData) { |
| | | if(responseData.success) { |
| | | NSLog(@"#############打印数据:%@", responseData); |
| | | } |
| | | }]; |
| | | } |
| | | |
| | | #pragma mark - Table view data source |
| | | |
| | | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { |
| | |
| | | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"EZSettingCell" forIndexPath:indexPath]; |
| | | |
| | | // Configure the cell... |
| | | cell.backgroundColor = [UIColor whiteColor]; |
| | | cell.contentView.backgroundColor = [UIColor whiteColor]; |
| | | cell.textLabel.text = [[_settingList dd_objectAtIndex:indexPath.section] dd_objectAtIndex:indexPath.row]; |
| | | |
| | | cell.textLabel.textColor = HDLEZHEXCOLOR(0x1B2D4D, 1.0); |
| | | cell.textLabel.textAlignment = NSTextAlignmentLeft; |
| | | cell.accessoryType = UITableViewCellAccessoryNone; |
| | | if (indexPath.section == 0) |
| | | { |
| | | [cell.contentView addSubview:self.nameLabel]; |
| | | cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; |
| | | // cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; |
| | | UIImageView *accessoryImgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"hdl_ez_list_next"]]; |
| | | accessoryImgView.frame = CGRectMake(0, 0, 16, 16); |
| | | cell.accessoryView = accessoryImgView; |
| | | [self.nameLabel mas_remakeConstraints:^(MASConstraintMaker *make) { |
| | | make.leading.mas_equalTo(@140); |
| | | make.trailing.mas_equalTo(cell.contentView.mas_trailing); |
| | | make.trailing.mas_equalTo(cell.contentView.mas_trailing).offset(-10); |
| | | make.centerY.mas_equalTo(cell.contentView.mas_centerY); |
| | | make.height.mas_equalTo(@20); |
| | | }]; |
| | |
| | | [self.rightArrowImg mas_remakeConstraints:^(MASConstraintMaker *make) { |
| | | make.trailing.mas_equalTo(@(-17)); |
| | | make.centerY.mas_equalTo(cell.contentView.mas_centerY); |
| | | make.width.mas_equalTo(@20); |
| | | make.height.mas_equalTo(@20); |
| | | make.width.mas_equalTo(@16); |
| | | make.height.mas_equalTo(@16); |
| | | }]; |
| | | } |
| | | else if (indexPath.section == 8) |
| | | { |
| | | cell.textLabel.textColor = [UIColor redColor]; |
| | | cell.textLabel.textAlignment = NSTextAlignmentCenter; |
| | | cell.backgroundColor = [UIColor clearColor]; |
| | | cell.contentView.backgroundColor = [UIColor clearColor]; |
| | | cell.textLabel.text = @""; |
| | | [cell.contentView addSubview:self.deleteButton]; |
| | | [self.deleteButton addTarget:self action:@selector(deleteAction) forControlEvents:UIControlEventTouchUpInside]; |
| | | [self.deleteButton mas_remakeConstraints:^(MASConstraintMaker *make) { |
| | | make.centerX.mas_equalTo(cell.contentView.mas_centerX); |
| | | make.left.mas_equalTo(cell.contentView.mas_left).offset(77.); |
| | | make.bottom.mas_equalTo(cell.contentView.mas_bottom); |
| | | make.height.mas_equalTo(@44); |
| | | }]; |
| | | } |
| | | else if (indexPath.section == 3) |
| | | { |
| | |
| | | return cell; |
| | | } |
| | | |
| | | - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section |
| | | { |
| | | return 5.0f; |
| | | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { |
| | | return (indexPath.section == 8) ? 92 : 50.; |
| | | } |
| | | |
| | | - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section { |
| | | return 0.0001f; |
| | | } |
| | | |
| | | - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section { |
| | | return (section == 0 || section == 2 || section == 6) ? 8.0f : 0.001f; |
| | | } |
| | | |
| | | - (nullable UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { |
| | | return nil; |
| | | } |
| | | |
| | | - (nullable UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section { |
| | | return nil; |
| | | } |
| | | |
| | | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath |
| | |
| | | // UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:nil delegate:self cancelButtonTitle:NSLocalizedString(@"cancel", @"取消") destructiveButtonTitle:NSLocalizedString(@"delete",@"删除") otherButtonTitles:nil]; |
| | | // [actionSheet showInView:self.view]; |
| | | |
| | | __weak __typeof(self)weakSelf = self; |
| | | UIAlertController *actionSheet = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet]; |
| | | |
| | | [actionSheet addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"cancel", @"取消") style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) { |
| | | [weakSelf dismissViewControllerAnimated:YES completion:^{ |
| | | }]; |
| | | }]]; |
| | | |
| | | [actionSheet addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"delete",@"删除") style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) { |
| | | [weakSelf deleteCurrentDevice]; |
| | | [weakSelf dismissViewControllerAnimated:YES completion:^{ |
| | | }]; |
| | | }]]; |
| | | |
| | | [self presentViewController:actionSheet animated:YES completion:nil]; |
| | | // __weak __typeof(self)weakSelf = self; |
| | | // UIAlertController *actionSheet = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet]; |
| | | // |
| | | // [actionSheet addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"cancel", @"取消") style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) { |
| | | // [weakSelf dismissViewControllerAnimated:YES completion:^{ |
| | | // }]; |
| | | // }]]; |
| | | // |
| | | // [actionSheet addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"delete",@"删除") style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) { |
| | | // [weakSelf deleteCurrentDevice]; |
| | | // [weakSelf dismissViewControllerAnimated:YES completion:^{ |
| | | // }]; |
| | | // }]]; |
| | | // |
| | | // [self presentViewController:actionSheet animated:YES completion:nil]; |
| | | |
| | | } |
| | | // else if (indexPath.section == 5) |
| | |
| | | } |
| | | } |
| | | |
| | | - (void)deleteAction { |
| | | __weak __typeof(self)weakSelf = self; |
| | | UIAlertController *actionSheet = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet]; |
| | | |
| | | [actionSheet addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"cancel", @"取消") style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) { |
| | | [weakSelf dismissViewControllerAnimated:YES completion:^{ |
| | | }]; |
| | | }]]; |
| | | |
| | | [actionSheet addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"delete",@"删除") style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) { |
| | | [weakSelf deleteCurrentDevice]; |
| | | [weakSelf dismissViewControllerAnimated:YES completion:^{ |
| | | }]; |
| | | }]]; |
| | | |
| | | [self presentViewController:actionSheet animated:YES completion:nil]; |
| | | } |
| | | |
| | | #pragma mark - Getter |
| | | - (UIButton *)deleteButton { |
| | | if (!_deleteButton) { |
| | | _deleteButton = [UIButton buttonWithType:UIButtonTypeCustom]; |
| | | _deleteButton.backgroundColor = [UIColor whiteColor]; |
| | | [_deleteButton setTitle:NSLocalizedString(@"delete", @"删除") forState:UIControlStateNormal]; |
| | | [_deleteButton setTitleColor:HDLEZHEXCOLOR(0xFF4747, 1.0) forState:UIControlStateNormal]; |
| | | _deleteButton.titleLabel.font = HDLEZ_Get_FontRegularWithSize(HDLEZ_FontSize_16); |
| | | _deleteButton.layer.cornerRadius = 22.; |
| | | _deleteButton.clipsToBounds = YES; |
| | | } |
| | | return _deleteButton; |
| | | } |
| | | |
| | | @end |