| | |
| | | |
| | | #import "EZDeviceTableViewController.h" |
| | | #import "EZEditViewController.h" |
| | | #import "EZDeviceVersion.h" |
| | | #import <EZOpenSDKFramework/EZDeviceVersion.h> |
| | | #import "EZDeviceUpgradeViewController.h" |
| | | #import "EZStorageInfo.h" |
| | | #import <EZOpenSDKFramework/EZStorageInfo.h> |
| | | #import "Toast+UIView.h" |
| | | |
| | | //#import "EzvizDeviceManager.h" |
| | |
| | | @property (nonatomic, weak) IBOutlet UISwitch *videoSwitch; |
| | | @property (nonatomic, weak) IBOutlet UISwitch *actionSwitch; |
| | | @property (weak, nonatomic) IBOutlet UISwitch *hdSwitch; |
| | | @property (weak, nonatomic) IBOutlet UISwitch *privacyMaskSwitch; |
| | | @property (weak, nonatomic) IBOutlet UIImageView *rightArrowImg; |
| | | @property (nonatomic, weak) IBOutlet UILabel *nameLabel; |
| | | @property (nonatomic, weak) IBOutlet UILabel *serialLabel; |
| | | @property (nonatomic, weak) IBOutlet UILabel *currentVersionLabel; |
| | |
| | | self.videoSwitch.on = self.deviceInfo.isEncrypt; |
| | | } |
| | | [_settingList addObject:@[NSLocalizedString(@"setting_hardware_decoding", @"硬解码")]]; |
| | | [_settingList addObject:@[NSLocalizedString(@"setting_privacy_masking", @"隐私遮蔽")]]; |
| | | [_settingList addObject:@[NSLocalizedString(@"setting_sd_card_formatting", @"SD卡格式化")]]; |
| | | [_settingList addObject:@[NSLocalizedString(@"delete", @"删除")]]; |
| | | |
| | | self.serialLabel.text = self.deviceInfo.deviceSerial; |
| | |
| | | |
| | | - (void)viewWillAppear:(BOOL)animated { |
| | | [super viewWillAppear:animated]; |
| | | self.navigationController.navigationBar.hidden = NO;//2021-02-01 |
| | | [self.tableView reloadData]; |
| | | } |
| | | |
| | |
| | | [_timer invalidate]; |
| | | _timer = nil; |
| | | } |
| | | |
| | | // self.navigationController.navigationBarHidden = YES;//2021-02-01 添加隐藏navigationBarHidden |
| | | [super viewWillDisappear:animated]; |
| | | } |
| | | |
| | |
| | | make.centerY.mas_equalTo(cell.contentView.mas_centerY); |
| | | make.height.mas_equalTo(@20); |
| | | }]; |
| | | // self.nameLabel.text = self.cameraInfo.deviceName; |
| | | self.nameLabel.text = self.deviceInfo.deviceName; |
| | | } |
| | | else if (indexPath.section == 1) |
| | | { |
| | |
| | | self.hdSwitch.on = hdStatus; |
| | | } |
| | | else if (indexPath.section == 6) |
| | | { |
| | | [cell.contentView addSubview:self.privacyMaskSwitch]; |
| | | [self.privacyMaskSwitch mas_remakeConstraints:^(MASConstraintMaker *make) { |
| | | make.trailing.mas_equalTo(@(-17)); |
| | | make.centerY.mas_equalTo(cell.contentView.mas_centerY); |
| | | make.width.mas_equalTo(@51); |
| | | make.height.mas_equalTo(@31); |
| | | }]; |
| | | self.privacyMaskSwitch.on = !self.privacyMaskSwitch.on; |
| | | } |
| | | else if (indexPath.section == 7) |
| | | { |
| | | [cell.contentView addSubview:self.rightArrowImg]; |
| | | [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); |
| | | }]; |
| | | } |
| | | else if (indexPath.section == 8) |
| | | { |
| | | cell.textLabel.textColor = [UIColor redColor]; |
| | | cell.textLabel.textAlignment = NSTextAlignmentCenter; |
| | |
| | | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath |
| | | { |
| | | [tableView deselectRowAtIndexPath:indexPath animated:YES]; |
| | | if (indexPath.section == 6) |
| | | if (indexPath.section == 8) |
| | | { |
| | | UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:nil delegate:self cancelButtonTitle:NSLocalizedString(@"cancel", @"取消") destructiveButtonTitle:NSLocalizedString(@"delete",@"删除") otherButtonTitles:nil]; |
| | | [actionSheet showInView:self.view]; |
| | | // 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]; |
| | | |
| | | } |
| | | // else if (indexPath.section == 5) |
| | | // { |
| | |
| | | { |
| | | [self performSegueWithIdentifier:@"go2Upgrade" sender:nil]; |
| | | } |
| | | else if (indexPath.section == 1) |
| | | else if (indexPath.section == 7) |
| | | { |
| | | |
| | | 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) { |
| | | [UIView dd_showMessage:@"功能开发中..."]; |
| | | }]; |
| | | [alert addAction:cancle]; |
| | | [alert addAction:sure]; |
| | | [self presentViewController:alert animated:YES completion:nil]; |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | #pragma mark - UIActionSheetDelegate Methods |
| | | - (void)deleteCurrentDevice { |
| | | __weak MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES]; |
| | | hud.labelText = NSLocalizedString(@"message_deleting", @"正在删除,请稍候..."); |
| | | |
| | | - (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex |
| | | { |
| | | if(buttonIndex == 0) |
| | | { |
| | | __weak MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES]; |
| | | hud.labelText = NSLocalizedString(@"message_deleting", @"正在删除,请稍候..."); |
| | | [EZOPENSDK deleteDevice:self.deviceInfo.deviceSerial completion:^(NSError *error) { |
| | | if(!error) |
| | | [EZHttpUtil.sharedManager deleteDeviceByHDL:self.deviceInfo.deviceSerial completion:^(ResponseData *responseData) { |
| | | [hud hide:YES]; |
| | | if(responseData.success) { |
| | | NSArray *viewControllers = self.navigationController.viewControllers; |
| | | for (UIViewController *vc in viewControllers) |
| | | { |
| | | [hud hide:YES]; |
| | | NSArray *viewControllers = self.navigationController.viewControllers; |
| | | for (UIViewController *vc in viewControllers) |
| | | if([vc isKindOfClass:[EZDeviceTableViewController class]]) |
| | | { |
| | | if([vc isKindOfClass:[EZDeviceTableViewController class]]) |
| | | { |
| | | ((EZDeviceTableViewController *)vc).needRefresh = YES; |
| | | [self.navigationController popToViewController:vc animated:YES]; |
| | | break; |
| | | } |
| | | ((EZDeviceTableViewController *)vc).needRefresh = YES; |
| | | [self.navigationController popToViewController:vc animated:YES]; |
| | | break; |
| | | } |
| | | } |
| | | }]; |
| | | } |
| | | } else { |
| | | NSString *mes = [NSString stringWithFormat:@"%@(%@)",NSLocalizedString(@"setting_opration_fail", @"操作失败"),responseData.code]; |
| | | [self.view makeToast:mes duration:2.0 position:@"center"]; |
| | | } |
| | | }]; |
| | | } |
| | | |
| | | //- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex |
| | | //{ |
| | | // if(buttonIndex == 0) |
| | | // { |
| | | // __weak MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES]; |
| | | // hud.labelText = NSLocalizedString(@"message_deleting", @"正在删除,请稍候..."); |
| | | //// [EZOPENSDK deleteDevice:self.deviceInfo.deviceSerial completion:^(NSError *error) { |
| | | //// if(!error) |
| | | //// { |
| | | //// [hud hide:YES]; |
| | | //// NSArray *viewControllers = self.navigationController.viewControllers; |
| | | //// for (UIViewController *vc in viewControllers) |
| | | //// { |
| | | //// if([vc isKindOfClass:[EZDeviceTableViewController class]]) |
| | | //// { |
| | | //// ((EZDeviceTableViewController *)vc).needRefresh = YES; |
| | | //// [self.navigationController popToViewController:vc animated:YES]; |
| | | //// break; |
| | | //// } |
| | | //// } |
| | | //// } |
| | | //// }]; |
| | | // |
| | | // [EZHttpUtil.sharedManager deleteDeviceByHDL:self.deviceInfo.deviceSerial completion:^(ResponseData *responseData) { |
| | | // [hud hide:YES]; |
| | | // if(responseData.success) |
| | | // { |
| | | // NSArray *viewControllers = self.navigationController.viewControllers; |
| | | // for (UIViewController *vc in viewControllers) |
| | | // { |
| | | // if([vc isKindOfClass:[EZDeviceTableViewController class]]) |
| | | // { |
| | | // ((EZDeviceTableViewController *)vc).needRefresh = YES; |
| | | // [self.navigationController popToViewController:vc animated:YES]; |
| | | // break; |
| | | // } |
| | | // } |
| | | // }else{ |
| | | // NSString *mes = [NSString stringWithFormat:@"%@(%@)",NSLocalizedString(@"setting_opration_fail", @"操作失败"),responseData.code]; |
| | | // |
| | | // [self.view makeToast:mes duration:2.0 position:@"center"]; |
| | | // } |
| | | // }]; |
| | | // |
| | | // |
| | | // } |
| | | //} |
| | | |
| | | #pragma mark - UIAlertViewDelegate Methods |
| | | |
| | |
| | | [[NSUserDefaults standardUserDefaults] synchronize]; |
| | | } |
| | | |
| | | - (IBAction)privacyMasking:(id)sender { |
| | | UISwitch *pmSwitch = (UISwitch*)sender; |
| | | BOOL status = pmSwitch.isOn; |
| | | } |
| | | |
| | | - (IBAction)encryptChanged:(id)sender |
| | | { |
| | | if(!self.videoSwitch.on) |