From a67450d72c47f400e56525125318ff1d6ca0a2e8 Mon Sep 17 00:00:00 2001
From: Davin <591807572@qq.com>
Date: 星期三, 18 十二月 2024 10:39:33 +0800
Subject: [PATCH] feature 萤石活动检测&画面翻转调整

---
 EZSDK.IOS/EZSDK.IOS/Library/libEZSDK.a                                     |    0 
 EZSDK/EZSDK/EZ/UIViewControllers/EZSettingViewController.m                 |    3 
 EZSDK/EZSDK/EZ/TempPassword/Controllers/HDLEZDetectionTypeViewController.m |   54 +++++++++++++
 EZDemo/HDLEZDemo/HDLEZDemo/libEZSDK.a                                      |    0 
 EZSDK/EZSDK.xcodeproj/project.pbxproj                                      |    6 +
 EZSDK/EZSDK/EZ/TempPassword/Views/HDLESDetectionTypeHeaderView.m           |   90 ++++++++++++++++++++++
 EZDemo/HDLEZDemo/HDLEZDemo/AppDelegate.m                                   |    9 +
 EZSDK/EZSDK/EZ/TempPassword/Views/HDLESDetectionTypeHeaderView.h           |   20 +++++
 8 files changed, 178 insertions(+), 4 deletions(-)

diff --git a/EZDemo/HDLEZDemo/HDLEZDemo/AppDelegate.m b/EZDemo/HDLEZDemo/HDLEZDemo/AppDelegate.m
index 0d1a8c2..c6652c3 100644
--- a/EZDemo/HDLEZDemo/HDLEZDemo/AppDelegate.m
+++ b/EZDemo/HDLEZDemo/HDLEZDemo/AppDelegate.m
@@ -25,10 +25,10 @@
     // Override point for customization after application launch.
     [[EZSDK sharedInstance] initLibWithAppKey:@"1aa98a90489b4838b966b57018b4b04b" globalAppKey:@"1aa98a90489b4838b966b57018b4b04b"];
 //    [[EZSDK sharedInstance] initLibWithAppKey:@"941b1b72b6294998acfd36c14931b675" globalAppKey:@"941b1b72b6294998acfd36c14931b675"];
-    [[EZSDK sharedInstance] setHDlAccessToken:@"eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJqdGkiOiIxODZlNWIxOTlhMzI0NzdhOTg0MTc1NWFiZDgwNjhiYSIsImNvbXBhbnlJZCI6IjAiLCJyb2xlIjoiIiwiaGVhZGVyUHJlZml4IjoiQmVhcmVyICIsInRlbmFudElkIjoiMjAiLCJ1c2VyVHlwZSI6IlVTRVJfQyIsInRva2VuVHlwZSI6ImFjY2Vzc190b2tlbiIsInVzZXJOYW1lIjoi54eV5ZCbIiwidXNlckRhdGFSaWdodCI6IjEiLCJvcGVuQXBwbGljYXRpb25JZCI6IjAiLCJ1c2VySWQiOiIxNjU2OTE3NDUxMjgxNTM0OTc3IiwiZXhwIjoxNzMwODkxMzczLCJuYmYiOjE3MzA4ODQxNzN9.TYaCAGVQ1c427INqyRLTM9hEpBpIdxm6mj6P2e4DlrvQ-jNjfP7sEphx3Bj7ZH7_lUIenwnCrO_crxIwgvzW3xjCv0D3qzeCbzbf5ynT0sYHIT2hWTJl4tdUYAK-BsEhf7Sfj9se0LzSmDEs2Sbmrm6BoUsViIbS8uVXOpZnPyU" refreshToken:@"eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJqdGkiOiIzYTQ2MDgxZDI4YWY0MjlmYmUzNTAxOWFlZTgwYmM5MCIsImNvbXBhbnlJZCI6IjAiLCJoZWFkZXJQcmVmaXgiOiJCZWFyZXIgIiwidGVuYW50SWQiOiIyMCIsInRva2VuVHlwZSI6InJlZnJlc2hfdG9rZW4iLCJvcGVuQXBwbGljYXRpb25JZCI6IjAiLCJ1c2VySWQiOiIxNjU2OTE3NDUxMjgxNTM0OTc3IiwiZXhwIjoxNzMxNDg4OTczLCJuYmYiOjE3MzA4ODQxNzN9.RDohTRVczdpxb4Pj9kvbEwHd2AUbYK0jps2kQk-WiVUE1HePoq-HjoYdYTwOw9CLvMuIUdDTru4AwQNtYgT9gF5jJEb7ePXrA8tStNvTyxu5FHMxaPGXY74UGg2H29_N4PEctBjb5A7z4NwJ36RajXsNyJweFLpZxX6QKXtrsbY"];
-    [[EZSDK sharedInstance] setRequestHttpsHostAndPlatform:@"https://test-gz.hdlcontrol.com" platform:1 homeId:@"1719997413437546497"];
+    [[EZSDK sharedInstance] setHDlAccessToken:@"Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJqdGkiOiI3NTg3ZTRhNDI4YzA0NjZhOWI1MmE5ZjM0NzA1MWZkNSIsImNvbXBhbnlJZCI6IjAiLCJyb2xlIjoiIiwiaGVhZGVyUHJlZml4IjoiQmVhcmVyICIsInVzZXJBY2NvdW50IjoiMTU3NTc4NzA5OTciLCJ0ZW5hbnRJZCI6IjIwIiwidXNlclR5cGUiOiJVU0VSX0MiLCJ0b2tlblR5cGUiOiJhY2Nlc3NfdG9rZW4iLCJ1c2VyTmFtZSI6IuaMquWogeeahOajruael-S4jeaEv-aEj-mAj-mcsuWnk-WQjeeahOeUqOaItyIsInVzZXJEYXRhUmlnaHQiOiIxIiwib3BlbkFwcGxpY2F0aW9uSWQiOiIwIiwidXNlcklkIjoiMTQwODI0MzI3MTc0MjM4NjE3NyIsImV4cCI6MTczNDQ5NDg2MCwibmJmIjoxNzM0NDg3NjYwfQ.ZJgdJmRy3ZQPiyj26LI7gf-ggbWLnslmWyyeKd-Y8LK1jqNtzmRYTNJttmXYMeO5mPkHRI07XXiCGwR7Tk86myMs-EpxvcHhLPBVtjwGP4xzC97ccEUzplWFIjOCTH0wLE2nE6Zh33-vbdGbizLSabYMAjiZmT39ml9tVowjDTI" refreshToken:@"eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJqdGkiOiJmNmYxYzU1Y2VhNjg0YTgxYmViYzFkMzdiZTdkZTFiOSIsImNvbXBhbnlJZCI6IjAiLCJoZWFkZXJQcmVmaXgiOiJCZWFyZXIgIiwidGVuYW50SWQiOiIyMCIsInRva2VuVHlwZSI6InJlZnJlc2hfdG9rZW4iLCJvcGVuQXBwbGljYXRpb25JZCI6IjAiLCJ1c2VySWQiOiIxNDA4MjQzMjcxNzQyMzg2MTc3IiwiZXhwIjoxNzM1MDkyNDYwLCJuYmYiOjE3MzQ0ODc2NjB9.W_9dzh8Do8Oi38KpxrlM5B9EJlGHK8_AuJDeK_ES_Mtb0mFjqh4jl63rKtnAjMy9HX45g3xv0bx9FwLOHk4F5kVT1LmU3Wd2TcZEYl-DzLzdAHz7N9FRmoO9kCwTmXmohf7lWnR1-P7IHFVKqzAzvzVaDtUPUKngjxrTnDOvyRw"];
+    [[EZSDK sharedInstance] setRequestHttpsHostAndPlatform:@"https://test-gz.hdlcontrol.com" platform:1 homeId:@"1641265620778082306"];
 //    [[EZSDK sharedInstance] setRequestHttpsHostAndPlatform:@"https://nearest.hdlcontrol.com" platform:1 homeId:@"1546324800135176193"];
-    [[EZSDK sharedInstance] setEZAccessToken:@"ra.cej51msz2lc9bd85dcjjh6lo3a1nvhd7-64dvf8rolg-1brlg88-nrsym3uwr"];
+    [[EZSDK sharedInstance] setEZAccessToken:@"at.3q2ijwy72ne0d6nq0qwwxie5bvn4q3mh-83a3uo2h6v-010ytzk-9tezv7rzn"];
 //    [[EZSDK sharedInstance] setEZAccessToken:@"ra.3hkirwcadrpfmaa89wep99io3wto4yds-7zptb10d20-1wxg4f3-ygiojudee"];
 
     
@@ -37,6 +37,9 @@
     _locationmanager.delegate = self;
     [_locationmanager requestWhenInUseAuthorization];
     [_locationmanager startUpdatingLocation];
+    
+    NSLog(@"#######-EZhdlAccessToken:%@", [[NSUserDefaults standardUserDefaults] objectForKey:@"EZhdlAccessToken"]);
+    NSLog(@"#######-EZhdlRefreshToken:%@", [[NSUserDefaults standardUserDefaults] objectForKey:@"EZhdlRefreshToken"]);
 
     return YES;
 }
diff --git a/EZDemo/HDLEZDemo/HDLEZDemo/libEZSDK.a b/EZDemo/HDLEZDemo/HDLEZDemo/libEZSDK.a
index 6c21576..9e38c42 100644
--- a/EZDemo/HDLEZDemo/HDLEZDemo/libEZSDK.a
+++ b/EZDemo/HDLEZDemo/HDLEZDemo/libEZSDK.a
Binary files differ
diff --git a/EZSDK.IOS/EZSDK.IOS/Library/libEZSDK.a b/EZSDK.IOS/EZSDK.IOS/Library/libEZSDK.a
index 5a8da80..169df6d 100644
--- a/EZSDK.IOS/EZSDK.IOS/Library/libEZSDK.a
+++ b/EZSDK.IOS/EZSDK.IOS/Library/libEZSDK.a
Binary files differ
diff --git a/EZSDK/EZSDK.xcodeproj/project.pbxproj b/EZSDK/EZSDK.xcodeproj/project.pbxproj
index aa143ad..f5e0a93 100644
--- a/EZSDK/EZSDK.xcodeproj/project.pbxproj
+++ b/EZSDK/EZSDK.xcodeproj/project.pbxproj
@@ -9,6 +9,7 @@
 /* Begin PBXBuildFile section */
 		830957C32A3AE3E1002B68AA /* HDLEZVideoDoorMsgCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 830957C22A3AE3E1002B68AA /* HDLEZVideoDoorMsgCell.m */; };
 		8318A0DA2A8A591D0012B894 /* FCFileManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 8318A0D92A8A591D0012B894 /* FCFileManager.m */; };
+		83336F022D1199E2000FE662 /* HDLESDetectionTypeHeaderView.m in Sources */ = {isa = PBXBuildFile; fileRef = 83336F012D1199E2000FE662 /* HDLESDetectionTypeHeaderView.m */; };
 		8357F1DE2A42DEC000936D2E /* HDLEZVideoDoorToolView.m in Sources */ = {isa = PBXBuildFile; fileRef = 8357F1DD2A42DEC000936D2E /* HDLEZVideoDoorToolView.m */; };
 		83879A852A7DE42900E10A81 /* HDLEZDetectionTypeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 83879A842A7DE42900E10A81 /* HDLEZDetectionTypeViewController.m */; };
 		83879A882A7DE49900E10A81 /* HDLEZDetectionTypeView.m in Sources */ = {isa = PBXBuildFile; fileRef = 83879A872A7DE49900E10A81 /* HDLEZDetectionTypeView.m */; };
@@ -198,6 +199,8 @@
 		830957C22A3AE3E1002B68AA /* HDLEZVideoDoorMsgCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = HDLEZVideoDoorMsgCell.m; sourceTree = "<group>"; };
 		8318A0D82A8A591D0012B894 /* FCFileManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FCFileManager.h; sourceTree = "<group>"; };
 		8318A0D92A8A591D0012B894 /* FCFileManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FCFileManager.m; sourceTree = "<group>"; };
+		83336F002D1199E2000FE662 /* HDLESDetectionTypeHeaderView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HDLESDetectionTypeHeaderView.h; sourceTree = "<group>"; };
+		83336F012D1199E2000FE662 /* HDLESDetectionTypeHeaderView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = HDLESDetectionTypeHeaderView.m; sourceTree = "<group>"; };
 		8357F1DC2A42DEC000936D2E /* HDLEZVideoDoorToolView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HDLEZVideoDoorToolView.h; sourceTree = "<group>"; };
 		8357F1DD2A42DEC000936D2E /* HDLEZVideoDoorToolView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = HDLEZVideoDoorToolView.m; sourceTree = "<group>"; };
 		83879A832A7DE42900E10A81 /* HDLEZDetectionTypeViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HDLEZDetectionTypeViewController.h; sourceTree = "<group>"; };
@@ -710,6 +713,8 @@
 				83D69FF92A47D32A00871258 /* HDLEZVideoQualityBoxView.m */,
 				83879A862A7DE49900E10A81 /* HDLEZDetectionTypeView.h */,
 				83879A872A7DE49900E10A81 /* HDLEZDetectionTypeView.m */,
+				83336F002D1199E2000FE662 /* HDLESDetectionTypeHeaderView.h */,
+				83336F012D1199E2000FE662 /* HDLESDetectionTypeHeaderView.m */,
 				83879A892A7DE7FC00E10A81 /* HDLEZDetectionTypeCell.h */,
 				83879A8A2A7DE7FC00E10A81 /* HDLEZDetectionTypeCell.m */,
 				83DC3D932CDB5AEB00F9DDF7 /* HDLEZMirrorFlipView.h */,
@@ -1507,6 +1512,7 @@
 				B9BC99F825C0FFBD00C024FE /* EZCustomTableView.m in Sources */,
 				B9BC9A2625C0FFBD00C024FE /* EZEditViewController.m in Sources */,
 				AEC306D529B9F2DB000B3861 /* HDLEZVisitorRecordCell.m in Sources */,
+				83336F022D1199E2000FE662 /* HDLESDetectionTypeHeaderView.m in Sources */,
 				AEDBFBA529C3072D005F6512 /* HDLEZDeviceMsgCell.m in Sources */,
 				B9BC9A2525C0FFBD00C024FE /* EZOnlineCameraCell.m in Sources */,
 				B9BC999B25C0FFBD00C024FE /* UITableView+FDTemplateLayoutCell.m in Sources */,
diff --git a/EZSDK/EZSDK/EZ/TempPassword/Controllers/HDLEZDetectionTypeViewController.m b/EZSDK/EZSDK/EZ/TempPassword/Controllers/HDLEZDetectionTypeViewController.m
index 37b2a3a..5b5c5ea 100644
--- a/EZSDK/EZSDK/EZ/TempPassword/Controllers/HDLEZDetectionTypeViewController.m
+++ b/EZSDK/EZSDK/EZ/TempPassword/Controllers/HDLEZDetectionTypeViewController.m
@@ -6,10 +6,13 @@
 //
 
 #import "HDLEZDetectionTypeViewController.h"
+#import "HDLESDetectionTypeHeaderView.h"
 #import "HDLEZDetectionTypeView.h"
 #import "MJRefreshNormalHeader.h"
 
 @interface HDLEZDetectionTypeViewController ()
+
+@property (nonatomic, strong) HDLESDetectionTypeHeaderView *detectionTypeHeaderView;
 
 @property (nonatomic, strong) HDLEZDetectionTypeView *detectionTypeView;
 
@@ -43,11 +46,18 @@
     self.view.backgroundColor = HDLEZHEXCOLOR(0xF2F3F7, 1.);
     
     self.selectedCode = @"";
+    [self.view addSubview:self.detectionTypeHeaderView];
     [self.view addSubview:self.detectionTypeView];
     [self.view addSubview:self.sureButton];
     
-    [self.detectionTypeView mas_makeConstraints:^(MASConstraintMaker *make) {
+    [self.detectionTypeHeaderView mas_makeConstraints:^(MASConstraintMaker *make) {
         make.top.equalTo(self.view).offset(HDLEZ_APP_TOP_BAR_HEIGHT);
+        make.left.right.equalTo(self.view);
+        make.height.mas_equalTo(60);
+    }];
+    
+    [self.detectionTypeView mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.top.equalTo(self.view).offset(HDLEZ_APP_TOP_BAR_HEIGHT + 70);
         make.left.right.equalTo(self.view);
     }];
     
@@ -89,6 +99,32 @@
 //    self.detectionTypeView.detectionTypeList = mArray;
     
     __weak __typeof(self)weakSelf = self;
+    BOOL isDefence = (self.deviceInfo.defence != 0);
+    [self updateDetectionView:isDefence];
+    
+    [self.detectionTypeHeaderView configSelected:isDefence switchResult:^(BOOL isSelected) {
+        __weak MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
+        hud.labelText = NSLocalizedString(@"setting_switching", @"姝e湪鍒囨崲锛岃绋嶅��...");
+        /**
+         *  娉ㄦ剰锛涜demo鍙鐞嗕簡IPC璁惧鐨勫竷鎾ら槻锛屾墍鏈夊彧鏈塝ES/NO锛屽叧浜嶢绯诲垪璁惧璇峰垽鏂澶囧悗淇敼鏋氫妇鍊煎啀澶勭悊
+         */
+        [EZOPENSDK setDefence:isSelected
+                 deviceSerial:weakSelf.deviceInfo.deviceSerial
+                   completion:^(NSError *error) {
+            
+            [hud hide:YES];
+            if (error) {
+                [weakSelf.view makeToast:NSLocalizedString(@"setting_opration_fail", @"鎿嶄綔澶辫触") duration:2.0 position:@"center"];
+                [weakSelf.detectionTypeHeaderView configSelected:!isSelected];
+            }
+            else{
+                weakSelf.deviceInfo.defence = isSelected;
+            }
+            BOOL isDefence = (weakSelf.deviceInfo.defence != 0);
+            [weakSelf updateDetectionView:isDefence];
+        }];
+    }];
+    
     [self.detectionTypeView didSelectedDetectionType:^(NSString * _Nonnull code) {
         weakSelf.selectedCode = code;
     }];
@@ -108,6 +144,11 @@
     [_header beginRefreshing];
     
     [self.sureButton addTarget:self action:@selector(sureAction) forControlEvents:UIControlEventTouchUpInside];
+}
+
+- (void)updateDetectionView:(BOOL)isDefence {
+    self.detectionTypeView.hidden = !isDefence;
+    self.sureButton.hidden = !isDefence;
 }
 
 
@@ -150,7 +191,10 @@
 - (void)sureAction {
     if (self.selectedCode && self.selectedCode.length > 0) {
         __weak __typeof(self)weakSelf = self;
+        __weak MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
+        hud.labelText = NSLocalizedString(@"setting_switching", @"姝e湪鍒囨崲锛岃绋嶅��...");
         [[EZHttpUtil sharedManager] setAiSupportDetection:self.deviceInfo.deviceSerial code:self.selectedCode completion:^(ResponseData * _Nonnull responseData) {
+            [hud hide:YES];
             if (responseData.success) {
                 [weakSelf.view makeToast:HDLEZLocallizedString(@"setting_opration_success")
                                 duration:1.5
@@ -166,6 +210,14 @@
 }
 
 #pragma mark - Getter
+- (HDLESDetectionTypeHeaderView *)detectionTypeHeaderView {
+    if (!_detectionTypeHeaderView) {
+        _detectionTypeHeaderView = [[HDLESDetectionTypeHeaderView alloc] init];
+        _detectionTypeHeaderView.backgroundColor = [UIColor whiteColor];
+    }
+    return _detectionTypeHeaderView;
+}
+
 - (HDLEZDetectionTypeView *)detectionTypeView {
     if (!_detectionTypeView) {
         _detectionTypeView = [[HDLEZDetectionTypeView alloc] init];
diff --git a/EZSDK/EZSDK/EZ/TempPassword/Views/HDLESDetectionTypeHeaderView.h b/EZSDK/EZSDK/EZ/TempPassword/Views/HDLESDetectionTypeHeaderView.h
new file mode 100644
index 0000000..f0b2bfb
--- /dev/null
+++ b/EZSDK/EZSDK/EZ/TempPassword/Views/HDLESDetectionTypeHeaderView.h
@@ -0,0 +1,20 @@
+//
+//  HDLESDetectionTypeHeaderView.h
+//  EZSDK
+//
+//  Created by Davin on 2024/12/17.
+//
+
+#import <UIKit/UIKit.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface HDLESDetectionTypeHeaderView : UIView
+
+- (void)configSelected:(BOOL)isSelected;
+
+- (void)configSelected:(BOOL)isSelected switchResult:(void(^)(BOOL isSelected))result;
+
+@end
+
+NS_ASSUME_NONNULL_END
diff --git a/EZSDK/EZSDK/EZ/TempPassword/Views/HDLESDetectionTypeHeaderView.m b/EZSDK/EZSDK/EZ/TempPassword/Views/HDLESDetectionTypeHeaderView.m
new file mode 100644
index 0000000..b577ff7
--- /dev/null
+++ b/EZSDK/EZSDK/EZ/TempPassword/Views/HDLESDetectionTypeHeaderView.m
@@ -0,0 +1,90 @@
+//
+//  HDLESDetectionTypeHeaderView.m
+//  EZSDK
+//
+//  Created by Davin on 2024/12/17.
+//
+
+#import "HDLESDetectionTypeHeaderView.h"
+
+@interface HDLESDetectionTypeHeaderView ()
+
+@property (nonatomic, strong) UILabel *titleLabel;
+@property (nonatomic, strong) UISwitch *detectionSwitch;
+
+@property (nonatomic, copy)void(^switchBlock)(BOOL isSelected);
+
+@end
+
+@implementation HDLESDetectionTypeHeaderView
+
+- (instancetype)initWithFrame:(CGRect)frame {
+    if (self = [super initWithFrame:frame]) {
+        [self createSubviews];
+    }
+    return self;
+}
+
+- (void)createSubviews {
+    [self addSubview:self.titleLabel];
+    [self addSubview:self.detectionSwitch];
+    
+    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.left.mas_equalTo(self.mas_left).offset(16);
+        make.centerY.mas_equalTo(self.mas_centerY);
+    }];
+    
+    [self.detectionSwitch mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.left.mas_greaterThanOrEqualTo(self.titleLabel.mas_right).offset(16);
+        make.right.mas_equalTo(self.mas_right);
+        make.centerY.mas_equalTo(self.titleLabel.mas_centerY);
+        make.width.mas_equalTo(70);
+        make.height.mas_equalTo(28);
+    }];
+    
+    [self.detectionSwitch addTarget:self action:@selector(detectionSwitchAction:) forControlEvents:UIControlEventValueChanged];
+}
+
+#pragma mark - PublishMethod
+- (void)configSelected:(BOOL)isSelected {
+    [self.detectionSwitch setOn:isSelected];
+}
+
+/// 妫�娴嬩俊鎭缃�
+/// - Parameters:
+///   - detectionType: 妫�娴嬬被鍨�
+///   - isSelected: 鏄惁閫変腑
+- (void)configSelected:(BOOL)isSelected switchResult:(void(^)(BOOL isSelected))result {
+    self.switchBlock = result;
+    [self.detectionSwitch setOn:isSelected];
+}
+
+
+#pragma mark - PrivateMethod
+- (void)detectionSwitchAction:(UISwitch *)sender {
+    if (self.switchBlock) {
+        self.switchBlock(sender.isOn);
+    }
+}
+
+#pragma mark - Getter
+- (UILabel *)titleLabel {
+    if (!_titleLabel) {
+        _titleLabel=[[UILabel alloc] init];
+        _titleLabel.font = HDLEZ_Get_FontRegularWithSize(HDLEZ_FontSize_14);
+        _titleLabel.textColor=HDLEZ_COLOR_TITLE_BLACK;
+        _titleLabel.text = NSLocalizedString(@"setting_action_detect", @"娲诲姩妫�娴嬫彁閱�");
+    }
+    return _titleLabel;
+}
+
+- (UISwitch *)detectionSwitch {
+    if (!_detectionSwitch) {
+        _detectionSwitch = [[UISwitch alloc] initWithFrame:CGRectZero];
+        _detectionSwitch.on = NO;
+        
+    }
+    return _detectionSwitch;
+}
+
+@end
diff --git a/EZSDK/EZSDK/EZ/UIViewControllers/EZSettingViewController.m b/EZSDK/EZSDK/EZ/UIViewControllers/EZSettingViewController.m
index fd80138..29fae09 100644
--- a/EZSDK/EZSDK/EZ/UIViewControllers/EZSettingViewController.m
+++ b/EZSDK/EZSDK/EZ/UIViewControllers/EZSettingViewController.m
@@ -784,8 +784,11 @@
 }
 
 - (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 {

--
Gitblit v1.8.0