From b4e1288a9b63eb820e9c9489c56aac4bf6b31067 Mon Sep 17 00:00:00 2001
From: Davin <591807572@qq.com>
Date: 星期三, 18 十二月 2024 14:34:16 +0800
Subject: [PATCH] feature 图片资源更新
---
EZSDK/EZSDK/EZ/UIViewControllers/EZSettingViewController.m | 237 ++++++++++++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 210 insertions(+), 27 deletions(-)
diff --git a/EZSDK/EZSDK/EZ/UIViewControllers/EZSettingViewController.m b/EZSDK/EZSDK/EZ/UIViewControllers/EZSettingViewController.m
index 9ae55a2..29fae09 100644
--- a/EZSDK/EZSDK/EZ/UIViewControllers/EZSettingViewController.m
+++ b/EZSDK/EZSDK/EZ/UIViewControllers/EZSettingViewController.m
@@ -17,6 +17,8 @@
#import "EZDeviceUpgradeViewController.h"
#import <EZOpenSDKFramework/EZStorageInfo.h>
#import "Toast+UIView.h"
+#import "HDLEZDetectionTypeViewController.h"
+#import "HDLEZMirrorFlipView.h"
//#import "EzvizDeviceManager.h"
@@ -25,6 +27,7 @@
@property (nonatomic, strong) NSMutableArray *settingList;
@property (nonatomic, weak) IBOutlet UISwitch *videoSwitch;
@property (nonatomic, weak) IBOutlet UISwitch *actionSwitch;
+@property (nonatomic, strong) UIImageView *actionRightArrow;
@property (weak, nonatomic) IBOutlet UISwitch *hdSwitch;
@property (weak, nonatomic) IBOutlet UISwitch *privacyMaskSwitch;
@property (weak, nonatomic) IBOutlet UIImageView *rightArrowImg;
@@ -33,9 +36,14 @@
@property (nonatomic, weak) IBOutlet UILabel *currentVersionLabel;
@property (nonatomic, weak) IBOutlet UILabel *nVersionLabel;
@property (nonatomic, weak) IBOutlet UIImageView *updateImageView;
+@property (nonatomic, strong) HDLEZMirrorFlipView *mirrorFlipView;
@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; // 闅愮閬斀璁剧疆涓�
+@property (nonatomic, copy) NSString *mirrorFlipCommand; // 闀滃儚缈昏浆鍛戒护
@end
@@ -50,6 +58,14 @@
[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;
@@ -81,8 +97,10 @@
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鍗℃牸寮忓寲")]];
+ 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;
@@ -101,9 +119,35 @@
weakSelf.nVersionLabel.text = version.currentVersion;
}
}];
+ [[EZHttpUtil sharedManager] getDeviceCapacity:self.deviceInfo.deviceSerial completion:^(ResponseData * _Nonnull responseData) {
+ NSLog(@"#######闀滃儚缈昏浆鍊艰繑鍥炵粨鏋滐細%@", [responseData yy_modelToJSONString]);
+ if (responseData.success && responseData.data) {
+ NSLog(@"#######闀滃儚缈昏浆鍊间负锛�%@", responseData.data);
+ BOOL ptzCenterMirror = [[responseData.data objectForKey:@"ptzCenterMirror"] boolValue];
+ BOOL ptzLeftRightMirror = [[responseData.data objectForKey:@"ptzLeftRightMirror"] boolValue];
+ BOOL ptzTopBottomMirror = [[responseData.data objectForKey:@"ptzTopBottomMirror"] boolValue];
+ if (ptzTopBottomMirror) {
+ weakSelf.mirrorFlipCommand = @"0";
+ }
+ if (ptzLeftRightMirror) {
+ weakSelf.mirrorFlipCommand = @"1";
+ }
+ if (ptzCenterMirror) {
+ weakSelf.mirrorFlipCommand = @"2";
+ }
+ [weakSelf.tableView reloadData];
+ }
+ }];
+
[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);
// }];
@@ -170,7 +214,15 @@
__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;
}
}];
}
@@ -195,6 +247,18 @@
cell.textLabel.textColor = HDLEZHEXCOLOR(0x1B2D4D, 1.0);
cell.textLabel.textAlignment = NSTextAlignmentLeft;
cell.accessoryType = UITableViewCellAccessoryNone;
+ cell.accessoryView = nil;
+ cell.selectionStyle = UITableViewCellSelectionStyleNone;
+ UIView *separatorLine = [[UIView alloc] init];
+ separatorLine.hidden = YES; // 榛樿闅愯棌鍒嗗壊绾�
+ [cell.contentView addSubview:separatorLine];
+ separatorLine.backgroundColor = HDLEZHEXCOLOR(0xECEDEE, 1.);
+ [separatorLine mas_makeConstraints:^(MASConstraintMaker *make) {
+ make.left.mas_equalTo(cell.contentView.mas_left).offset(16.);
+ make.bottom.mas_equalTo(cell.contentView.mas_bottom);
+ make.right.mas_equalTo(cell.contentView.mas_right).offset(-16.);
+ make.height.mas_equalTo(0.5);
+ }];
if (indexPath.section == 0)
{
[cell.contentView addSubview:self.nameLabel];
@@ -215,40 +279,62 @@
[cell.contentView addSubview:self.serialLabel];
[self.serialLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
make.leading.mas_equalTo(@140);
- make.trailing.mas_equalTo(cell.contentView.mas_trailing).offset(-34);
+ make.trailing.mas_equalTo(cell.contentView.mas_trailing).offset(-16);
make.centerY.mas_equalTo(cell.contentView.mas_centerY);
make.height.mas_equalTo(@20);
}];
self.serialLabel.text = self.deviceInfo.deviceSerial;
+ separatorLine.hidden = NO;
}
else if (indexPath.section == 5)
{
[cell.contentView addSubview:self.hdSwitch];
[self.hdSwitch mas_remakeConstraints:^(MASConstraintMaker *make) {
- make.trailing.mas_equalTo(@(-17));
+ make.trailing.mas_equalTo(@(-16));
make.centerY.mas_equalTo(cell.contentView.mas_centerY);
make.width.mas_equalTo(@51);
make.height.mas_equalTo(@31);
}];
BOOL hdStatus = [[NSUserDefaults standardUserDefaults] boolForKey:[NSString stringWithFormat:@"EZVideoPlayHardDecodingStatus_%@", self.deviceInfo.deviceSerial]];
self.hdSwitch.on = hdStatus;
+ separatorLine.hidden = NO;
}
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;
+ if (self.isCatEye) { // 鐚溂
+ cell.backgroundColor = [UIColor clearColor];
+ cell.contentView.backgroundColor = [UIColor clearColor];
+ cell.textLabel.text = @"";
+ if (self.mirrorFlipCommand && self.mirrorFlipCommand.length > 0) {
+ [cell.contentView addSubview:self.mirrorFlipView];
+ __weak __typeof(self)weakSelf = self;
+ [self.mirrorFlipView configTitle:NSLocalizedString(@"api_mirror_flip", @"鐢婚潰缈昏浆") subTitle:NSLocalizedString(@"api_mirror_flip_trip", @"鐐瑰嚮鍚庤棰戠敾闈細缈昏浆灞曠ず锛岄�傚悎鍊掕鐨勫満鏅�") click:^{
+ [weakSelf mirrorFlipAction];
+ }];
+ }
+ [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(@(-16));
+ make.centerY.mas_equalTo(cell.contentView.mas_centerY);
+ make.width.mas_equalTo(@51);
+ make.height.mas_equalTo(@31);
+ }];
+ }
}
else if (indexPath.section == 7)
{
[cell.contentView addSubview:self.rightArrowImg];
[self.rightArrowImg mas_remakeConstraints:^(MASConstraintMaker *make) {
- make.trailing.mas_equalTo(@(-17));
+ make.trailing.mas_equalTo(@(-16));
make.centerY.mas_equalTo(cell.contentView.mas_centerY);
make.width.mas_equalTo(@16);
make.height.mas_equalTo(@16);
@@ -259,6 +345,13 @@
cell.backgroundColor = [UIColor clearColor];
cell.contentView.backgroundColor = [UIColor clearColor];
cell.textLabel.text = @"";
+ if (self.mirrorFlipCommand && self.mirrorFlipCommand.length > 0) {
+ [cell.contentView addSubview:self.mirrorFlipView];
+ __weak __typeof(self)weakSelf = self;
+ [self.mirrorFlipView configTitle:NSLocalizedString(@"api_mirror_flip", @"鐢婚潰缈昏浆") subTitle:NSLocalizedString(@"api_mirror_flip_trip", @"鐐瑰嚮鍚庤棰戠敾闈細缈昏浆灞曠ず锛岄�傚悎鍊掕鐨勫満鏅�") click:^{
+ [weakSelf mirrorFlipAction];
+ }];
+ }
[cell.contentView addSubview:self.deleteButton];
[self.deleteButton addTarget:self action:@selector(deleteAction) forControlEvents:UIControlEventTouchUpInside];
[self.deleteButton mas_remakeConstraints:^(MASConstraintMaker *make) {
@@ -270,23 +363,32 @@
}
else if (indexPath.section == 3)
{
- [cell.contentView addSubview:self.actionSwitch];
- [self.actionSwitch mas_remakeConstraints:^(MASConstraintMaker *make) {
- make.trailing.mas_equalTo(@(-17));
+// [cell.contentView addSubview:self.actionSwitch];
+// [self.actionSwitch mas_remakeConstraints:^(MASConstraintMaker *make) {
+// make.trailing.mas_equalTo(@(-16));
+// make.centerY.mas_equalTo(cell.contentView.mas_centerY);
+// make.width.mas_equalTo(@51);
+// make.height.mas_equalTo(@31);
+// }];
+ [cell.contentView addSubview:self.actionRightArrow];
+ [self.actionRightArrow mas_remakeConstraints:^(MASConstraintMaker *make) {
+ make.trailing.mas_equalTo(@(-16));
make.centerY.mas_equalTo(cell.contentView.mas_centerY);
- make.width.mas_equalTo(@51);
- make.height.mas_equalTo(@31);
+ make.width.mas_equalTo(@16);
+ make.height.mas_equalTo(@16);
}];
+ separatorLine.hidden = NO;
}
else if (indexPath.section == 4)
{
[cell.contentView addSubview:self.videoSwitch];
[self.videoSwitch mas_remakeConstraints:^(MASConstraintMaker *make) {
- make.trailing.mas_equalTo(@(-17));
+ make.trailing.mas_equalTo(@(-16));
make.centerY.mas_equalTo(cell.contentView.mas_centerY);
make.width.mas_equalTo(@51);
make.height.mas_equalTo(@31);
}];
+ separatorLine.hidden = NO;
}
else
{
@@ -295,17 +397,18 @@
[cell.contentView addSubview:self.currentVersionLabel];
[self.currentVersionLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
make.leading.mas_equalTo(@140);
- make.trailing.mas_equalTo(cell.contentView.mas_trailing).offset(-34);
+ make.trailing.mas_equalTo(cell.contentView.mas_trailing).offset(-16);
make.centerY.mas_equalTo(cell.contentView.mas_centerY);
make.height.mas_equalTo(@20);
}];
+ separatorLine.hidden = NO;
}
else
{
[cell.contentView addSubview:self.nVersionLabel];
[self.nVersionLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
make.leading.mas_equalTo(@140);
- make.trailing.mas_equalTo(cell.contentView.mas_trailing).offset(-34);
+ make.trailing.mas_equalTo(cell.contentView.mas_trailing).offset(-16);
make.centerY.mas_equalTo(cell.contentView.mas_centerY);
make.height.mas_equalTo(@20);
}];
@@ -321,7 +424,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)) ? (self.mirrorFlipCommand && self.mirrorFlipCommand.length > 0 ? 192 : 92) : 50.;
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
@@ -329,7 +432,7 @@
}
- (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 {
@@ -376,19 +479,29 @@
else if (indexPath.section == 2 && indexPath.row == 1 && self.updateImageView.hidden == NO)
{
[self performSegueWithIdentifier:@"go2Upgrade" sender:nil];
+ }else if (indexPath.section == 3)
+ {
+ HDLEZDetectionTypeViewController *detectionTypeVC = [[HDLEZDetectionTypeViewController alloc] init];
+ detectionTypeVC.deviceInfo = self.deviceInfo;
+
+ [self.navigationController pushViewController:detectionTypeVC animated:YES];
}
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) {
[EZOPENSDK formatStorage:self.deviceInfo.deviceSerial
storageIndex:0
completion:^(NSError *error) {
- NSLog(@"format command error = %@", error);
- [UIView dd_showMessage:error.description];
+ if (error) {
+ NSLog(@"format command error = %@", error);
+ [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];
@@ -588,6 +701,37 @@
- (IBAction)privacyMasking:(id)sender {
UISwitch *pmSwitch = (UISwitch*)sender;
BOOL status = pmSwitch.isOn;
+
+// if (self.privacyMasking) {
+// self.privacyMaskSwitch.on = !status;
+// [UIView dd_showMessage:@"姝e湪鎵ц涓紝璇风◢鍚庡啀璇�"];
+// 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", @"姝e湪鎵ц涓紝璇风◢鍚庡啀璇�")];
+}
+
+- (void)delayPrivacyMasking {
+ self.privacyMaskButton.hidden = YES;
+// self.privacyMaskSwitch.enabled = YES;
}
- (IBAction)encryptChanged:(id)sender
@@ -639,6 +783,20 @@
[self presentViewController:actionSheet animated:YES completion:nil];
}
+- (void)mirrorFlipAction {
+ __weak MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
+ __weak __typeof(self)weakSelf = self;
+ [[EZHttpUtil sharedManager] setPtzMiroor:self.deviceInfo.deviceSerial command:self.mirrorFlipCommand completion:^(ResponseData * _Nonnull responseData) {
+ NSLog(@"#######璁剧疆闀滃儚缈昏浆鍊艰繑鍥炵粨鏋滐細%@", [responseData yy_modelToJSONString]);
+ [hud hide:YES];
+ if (responseData.success) {
+ [UIView dd_showMessage:NSLocalizedString(@"api_mirror_flip_success", @"鐢婚潰缈昏浆鎴愬姛")];
+ } else {
+ [UIView dd_showMessage:responseData.message];
+ }
+ }];
+}
+
#pragma mark - Getter
- (UIButton *)deleteButton {
if (!_deleteButton) {
@@ -653,4 +811,29 @@
return _deleteButton;
}
+- (UIButton *)privacyMaskButton {
+ if (!_privacyMaskButton) {
+ _privacyMaskButton = [UIButton buttonWithType:UIButtonTypeCustom];
+ _privacyMaskButton.backgroundColor = [UIColor clearColor];
+ _privacyMaskButton.hidden = YES;
+ }
+ return _privacyMaskButton;
+}
+
+- (UIImageView *)actionRightArrow {
+ if (!_actionRightArrow) {
+ _actionRightArrow = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"hdl_ez_list_next"]];
+ _actionRightArrow.contentMode = UIViewContentModeScaleAspectFill;
+ _actionRightArrow.backgroundColor = UIColor.clearColor;
+ }
+ return _actionRightArrow;
+}
+
+- (HDLEZMirrorFlipView *)mirrorFlipView {
+ if (!_mirrorFlipView) {
+ _mirrorFlipView = [[HDLEZMirrorFlipView alloc] initWithFrame:CGRectMake(0, 0, HDLEZ_APP_SCREEN_WIDTH, 100)];
+ }
+ return _mirrorFlipView;
+}
+
@end
--
Gitblit v1.8.0