| | |
| | | @property (nonatomic, weak) IBOutlet UILabel *nVersionLabel; |
| | | @property (nonatomic, weak) IBOutlet UIImageView *updateImageView; |
| | | @property (nonatomic, strong) UIButton *deleteButton; |
| | | @property (nonatomic, strong) UIButton *privacyMaskButton; // 隐私遮蔽执行过程提醒按钮 |
| | | @property (nonatomic, strong) EZDeviceVersion *deviceVersion; |
| | | @property (nonatomic, strong) NSTimer *timer; |
| | | @property (nonatomic, assign) BOOL isCatEye; // 是否为猫眼 |
| | | @property (nonatomic, assign) BOOL privacyMasking; // 隐私遮蔽设置中 |
| | | |
| | | @end |
| | | |
| | |
| | | [super viewDidLoad]; |
| | | |
| | | self.title = NSLocalizedString(@"setting_device_set_title", @"设备设置"); |
| | | // 猫眼 CS-DH1, CS-DP1, CS-CV336, CS-CTQ1P |
| | | // 门锁 DL30V,Y3000FV,DL20VC,DL31FS,DL30F,DL30,Y3000FVS,Y3000F |
| | | self.isCatEye = NO; |
| | | self.privacyMasking = NO; |
| | | self.privacyMaskSwitch.on = NO; |
| | | if ([self.deviceInfo.deviceType containsString:@"CS-DH1"] || [self.deviceInfo.deviceType containsString:@"CS-DP1"] || [self.deviceInfo.deviceType containsString:@"CS-CV336"] || [self.deviceInfo.deviceType containsString:@"CS-CTQ1P"]) { |
| | | self.isCatEye = YES; |
| | | } |
| | | // Uncomment the following line to preserve selection between presentations. |
| | | // self.clearsSelectionOnViewWillAppear = NO; |
| | | |
| | |
| | | self.videoSwitch.on = self.deviceInfo.isEncrypt; |
| | | } |
| | | [_settingList addObject:@[NSLocalizedString(@"setting_hardware_decoding", @"硬解码")]]; |
| | | if (!self.isCatEye) { |
| | | [_settingList addObject:@[NSLocalizedString(@"setting_privacy_masking", @"隐私遮蔽")]]; |
| | | [_settingList addObject:@[NSLocalizedString(@"setting_sd_card_formatting", @"SD卡格式化")]]; |
| | | } |
| | | [_settingList addObject:@[NSLocalizedString(@"delete", @"删除")]]; |
| | | |
| | | self.serialLabel.text = self.deviceInfo.deviceSerial; |
| | |
| | | [self.privacyMaskSwitch setOn:NO]; |
| | | [self getPrivacyMaskSwitchStatus]; |
| | | self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone; |
| | | |
| | | [self.privacyMaskSwitch addSubview:self.privacyMaskButton]; |
| | | [self.privacyMaskButton addTarget:self action:@selector(privacyMaskingAction:) forControlEvents:UIControlEventTouchUpInside]; |
| | | [self.privacyMaskButton mas_makeConstraints:^(MASConstraintMaker *make) { |
| | | make.edges.mas_equalTo(UIEdgeInsetsZero); |
| | | }]; |
| | | // [[EzvizDeviceManager sharedManager] startP2PHolePunching:_cameraInfo.cameraId completion:^(BOOL result, NSError *error) { |
| | | // NSLog(@"result = %d, error = %@", result, error); |
| | | // }]; |
| | |
| | | __weak __typeof(self)weakSelf = self; |
| | | [EZHttpUtil.sharedManager getCoverSwitchStatus:self.deviceInfo.deviceSerial completion:^(ResponseData * _Nonnull responseData) { |
| | | if(responseData.success) { |
| | | NSLog(@"#############打印数据:%@", responseData); |
| | | NSDictionary *dataDic = responseData.data; |
| | | if (dataDic && [[dataDic allKeys] containsObject:@"enable"]) { // 包含隐私遮蔽功能属性 |
| | | weakSelf.privacyMaskSwitch.enabled = YES; |
| | | [weakSelf.privacyMaskSwitch setOn:[[dataDic objectForKey:@"enable"] boolValue]]; |
| | | } else { // 不包含该功能 |
| | | weakSelf.privacyMaskSwitch.enabled = NO; |
| | | } |
| | | } else { |
| | | weakSelf.privacyMaskSwitch.enabled = NO; |
| | | } |
| | | }]; |
| | | } |
| | |
| | | cell.textLabel.textColor = HDLEZHEXCOLOR(0x1B2D4D, 1.0); |
| | | cell.textLabel.textAlignment = NSTextAlignmentLeft; |
| | | cell.accessoryType = UITableViewCellAccessoryNone; |
| | | cell.accessoryView = nil; |
| | | if (indexPath.section == 0) |
| | | { |
| | | [cell.contentView addSubview:self.nameLabel]; |
| | |
| | | } |
| | | else if (indexPath.section == 6) |
| | | { |
| | | if (self.isCatEye) { // 猫眼 |
| | | 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 { // 摄像头 |
| | | [cell.contentView addSubview:self.privacyMaskSwitch]; |
| | | [self.privacyMaskSwitch mas_remakeConstraints:^(MASConstraintMaker *make) { |
| | | make.trailing.mas_equalTo(@(-17)); |
| | |
| | | make.width.mas_equalTo(@51); |
| | | make.height.mas_equalTo(@31); |
| | | }]; |
| | | self.privacyMaskSwitch.on = !self.privacyMaskSwitch.on; |
| | | } |
| | | } |
| | | else if (indexPath.section == 7) |
| | | { |
| | |
| | | } |
| | | |
| | | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { |
| | | return (indexPath.section == 8) ? 92 : 50.; |
| | | return ((!self.isCatEye && indexPath.section == 8) || (self.isCatEye && indexPath.section == 6)) ? 92 : 50.; |
| | | } |
| | | |
| | | - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section { |
| | |
| | | } |
| | | |
| | | - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section { |
| | | return (section == 0 || section == 2 || section == 6) ? 8.0f : 0.001f; |
| | | return (section == 0 || section == 2 || (!self.isCatEye && section == 6)) ? 8.0f : 0.001f; |
| | | } |
| | | |
| | | - (nullable UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { |
| | |
| | | UIAlertController *alert=[UIAlertController alertControllerWithTitle:HDLEZLocallizedString(@"alert_title") message:HDLEZLocallizedString(@"setting_formatting_alert_message") preferredStyle:UIAlertControllerStyleAlert]; |
| | | UIAlertAction *cancle=[UIAlertAction actionWithTitle:HDLEZLocallizedString(@"device_temp_cancle") style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) { |
| | | }]; |
| | | __weak __typeof(self)weakSelf = self; |
| | | UIAlertAction *sure=[UIAlertAction actionWithTitle:HDLEZLocallizedString(@"device_temp_sure") style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { |
| | | [EZOPENSDK formatStorage:self.deviceInfo.deviceSerial |
| | | storageIndex:0 |
| | | completion:^(NSError *error) { |
| | | if (error) { |
| | | NSLog(@"format command error = %@", error); |
| | | [UIView dd_showMessage:error.description]; |
| | | [UIView dd_showMessage:NSLocalizedString(@"setting_sd_card_fail", @"格式化失败,请重新再试")]; |
| | | } else { |
| | | NSLog(@"format command error = %@", error); |
| | | [UIView dd_showMessage:NSLocalizedString(@"setting_sd_card_success", @"格式化成功")]; |
| | | } |
| | | }]; |
| | | }]; |
| | | [alert addAction:cancle]; |
| | |
| | | - (IBAction)privacyMasking:(id)sender { |
| | | UISwitch *pmSwitch = (UISwitch*)sender; |
| | | BOOL status = pmSwitch.isOn; |
| | | |
| | | // if (self.privacyMasking) { |
| | | // self.privacyMaskSwitch.on = !status; |
| | | // [UIView dd_showMessage:@"正在执行中,请稍后再试"]; |
| | | // return; |
| | | // } |
| | | // |
| | | // NSLog(@"#############设置状态:%@", status ? @"开启" : @"关闭"); |
| | | __weak __typeof(self)weakSelf = self; |
| | | self.privacyMaskSwitch.enabled = NO; |
| | | self.privacyMaskButton.hidden = NO; |
| | | [self performSelector:@selector(delayPrivacyMasking) withObject:nil afterDelay:10.0]; |
| | | [EZHttpUtil.sharedManager coverSwitchStatus:self.deviceInfo.deviceSerial enable:(status ? 1 : 0) completion:^(ResponseData * _Nonnull responseData) { |
| | | if(responseData.success) { |
| | | NSLog(@"#############设置成功:%@", responseData.data); |
| | | } else { |
| | | NSLog(@"#############设置失败:%@", responseData.message); |
| | | [UIView dd_showMessage:NSLocalizedString(@"setting_privacy_masking_fail", @"设置失败,请稍后再试")]; |
| | | [weakSelf.privacyMaskSwitch setOn:!status]; |
| | | } |
| | | weakSelf.privacyMaskSwitch.enabled = YES; |
| | | }]; |
| | | } |
| | | |
| | | - (void)privacyMaskingAction:(id)sender { |
| | | [UIView dd_showMessage:NSLocalizedString(@"setting_privacy_masking_ing", @"正在执行中,请稍后再试")]; |
| | | } |
| | | |
| | | - (void)delayPrivacyMasking { |
| | | self.privacyMaskButton.hidden = YES; |
| | | // self.privacyMaskSwitch.enabled = YES; |
| | | } |
| | | |
| | | - (IBAction)encryptChanged:(id)sender |
| | |
| | | return _deleteButton; |
| | | } |
| | | |
| | | - (UIButton *)privacyMaskButton { |
| | | if (!_privacyMaskButton) { |
| | | _privacyMaskButton = [UIButton buttonWithType:UIButtonTypeCustom]; |
| | | _privacyMaskButton.backgroundColor = [UIColor clearColor]; |
| | | _privacyMaskButton.hidden = YES; |
| | | } |
| | | return _privacyMaskButton; |
| | | } |
| | | |
| | | @end |