From 83de5ad48e86873b698c904f8954576e8b31dfb5 Mon Sep 17 00:00:00 2001 From: Davin <591807572@qq.com> Date: 星期二, 20 六月 2023 11:35:36 +0800 Subject: [PATCH] feature 门锁全屏 && 设置页面UI --- EZSDK/EZSDK/EZ/UIViewControllers/EZSettingViewController.m | 157 +++++++++++++++++++++++++++++++++++++++------------- 1 files changed, 118 insertions(+), 39 deletions(-) diff --git a/EZSDK/EZSDK/EZ/UIViewControllers/EZSettingViewController.m b/EZSDK/EZSDK/EZ/UIViewControllers/EZSettingViewController.m index a4071bb..ad334b8 100644 --- a/EZSDK/EZSDK/EZ/UIViewControllers/EZSettingViewController.m +++ b/EZSDK/EZSDK/EZ/UIViewControllers/EZSettingViewController.m @@ -26,6 +26,8 @@ @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; @@ -78,6 +80,8 @@ 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; @@ -214,6 +218,27 @@ } 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; } @@ -277,10 +302,27 @@ - (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) // { @@ -294,9 +336,18 @@ { [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]; } } @@ -353,17 +404,57 @@ } #pragma mark - UIActionSheetDelegate Methods +- (void)deleteCurrentDevice { + __weak MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES]; + hud.labelText = NSLocalizedString(@"message_deleting", @"姝e湪鍒犻櫎锛岃绋嶅��..."); -- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex -{ - if(buttonIndex == 0) - { - __weak MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES]; - hud.labelText = NSLocalizedString(@"message_deleting", @"姝e湪鍒犻櫎锛岃绋嶅��..."); -// [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) + { + 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"]; + } + }]; +} + +//- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex +//{ +// if(buttonIndex == 0) +// { +// __weak MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES]; +// hud.labelText = NSLocalizedString(@"message_deleting", @"姝e湪鍒犻櫎锛岃绋嶅��..."); +//// [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) // { -// [hud hide:YES]; // NSArray *viewControllers = self.navigationController.viewControllers; // for (UIViewController *vc in viewControllers) // { @@ -374,33 +465,16 @@ // break; // } // } +// }else{ +// NSString *mes = [NSString stringWithFormat:@"%@(%@)",NSLocalizedString(@"setting_opration_fail", @"鎿嶄綔澶辫触"),responseData.code]; +// +// [self.view makeToast:mes duration:2.0 position:@"center"]; // } // }]; - - [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 @@ -465,6 +539,11 @@ [[NSUserDefaults standardUserDefaults] synchronize]; } +- (IBAction)privacyMasking:(id)sender { + UISwitch *pmSwitch = (UISwitch*)sender; + BOOL status = pmSwitch.isOn; +} + - (IBAction)encryptChanged:(id)sender { if(!self.videoSwitch.on) -- Gitblit v1.8.0