From 48c5a2c66c549d26fecadc6d2dad1924fdd1cc8b Mon Sep 17 00:00:00 2001
From: Davin <591807572@qq.com>
Date: 星期四, 27 七月 2023 13:52:08 +0800
Subject: [PATCH] bugfix 猫眼呼叫问题修复

---
 EZSDK/EZSDK/EZ/UIViewControllers/EZLivePlayViewController.m |   76 ++++++++++++++++++++++++++++++++++----
 1 files changed, 68 insertions(+), 8 deletions(-)

diff --git a/EZSDK/EZSDK/EZ/UIViewControllers/EZLivePlayViewController.m b/EZSDK/EZSDK/EZ/UIViewControllers/EZLivePlayViewController.m
index 9db3569..d8cfecf 100644
--- a/EZSDK/EZSDK/EZ/UIViewControllers/EZLivePlayViewController.m
+++ b/EZSDK/EZSDK/EZ/UIViewControllers/EZLivePlayViewController.m
@@ -149,6 +149,7 @@
     
     //鍒濆鍖栫浉鍏虫暟鎹�
     [self initialData];
+    [self.navigationController.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName:HDLEZHEXCOLOR(0x1B2D4D, 1.),NSFontAttributeName:[UIFont systemFontOfSize:18]}];
     
 //    self.talkButton.enabled = self.deviceInfo.isSupportTalk;
 //    self.controlButton.enabled = self.deviceInfo.isSupportPTZ;
@@ -281,6 +282,14 @@
         }];
     }
     return _doorPlayerView;
+}
+
+- (void)viewWillAppear:(BOOL)animated {
+    [super viewWillAppear:animated];
+    if (self.navigationController) {
+        self.navigationController.navigationBar.hidden = NO;
+        [self.navigationController setNavigationBarHidden:NO];
+    }
 }
 
 - (void)viewDidAppear:(BOOL)animated {
@@ -500,7 +509,7 @@
     [self.ignoreButton setTitle:HDLEZLocallizedString(@"device_callout_ignore") forState:UIControlStateNormal];
     self.ignoreButton.imagePosition = HDLEZOPButtonImagePositionTop;
     self.ignoreButton.spacingBetweenImageAndTitle = 12.;
-    [self.answerButton setTitle:HDLEZLocallizedString(@"device_callout_answer") forState:UIControlStateNormal];
+    [self.answerButton setTitle:HDLEZLocallizedString(@"device_callout_answered") forState:UIControlStateNormal];
     self.answerButton.imagePosition = HDLEZOPButtonImagePositionTop;
     self.answerButton.spacingBetweenImageAndTitle = 12.;
     
@@ -511,11 +520,22 @@
     [self.fullSceneToolView configPlayStatus:YES soundOn:YES videoLevel:_cameraInfo.videoLevel toolOperation:^(HDLEZVideoFullSceneOperation operationType) {
         [weakSelf doorLockFullSceneOperation:operationType];
     }];
+    
+    // 鎸傛柇寮规
+    if (_isShowAlert) {
+        [self showCallOutAlertView];
+    } else {
+        [self hiddenCallOutAlertView];
+    }
 }
 
 /*寮�閿�
  */
 -(void)unlockDoor{
+    if (![self isSupportOneKeyUnlockDoor]) {    // 涓嶆敮鎸佷竴閿紑閿�
+        [UIView dd_showMessage:@"璇ヨ澶囦笉鏀寔涓�閿紑閿�"];
+        return;
+    }
     [HDLEZAlertInputView showInputAlertWithtitle:HDLEZLocallizedString(@"device_please_input_door_password") cancleTitle:HDLEZLocallizedString(@"device_temp_cancle") sureTitle:HDLEZLocallizedString(@"device_temp_sure") keyboardType:UIKeyboardTypeASCIICapableNumberPad cancleBlock:^{
         
     } sureBlock:^(NSString * _Nonnull content) {
@@ -863,7 +883,11 @@
     self.streamToken=tokenInfo.token;
     
     if (!_unlockButton.isEnabled) {
-        [_unlockButton setImage:[UIImage imageNamed:@"hdl_ez_ic_unlock"] forState:UIControlStateNormal];
+        if ([self isSupportOneKeyUnlockDoor]) {    // 鏀寔涓�閿紑閿�
+            [_unlockButton setImage:[UIImage imageNamed:@"hdl_ez_ic_unlock"] forState:UIControlStateNormal];
+        } else {
+            [_unlockButton setImage:[UIImage imageNamed:@"hdl_ez_ic_unlock_disable"] forState:UIControlStateNormal];
+        }
         _unlockButton.enabled=YES;
     }
 }
@@ -946,7 +970,7 @@
         [self.scrollView setTranslatesAutoresizingMaskIntoConstraints:NO];
         [self.playerView setTranslatesAutoresizingMaskIntoConstraints:NO];
         [NSLayoutConstraint deactivateConstraints:@[self.scrollViewTopMargin, self.scrollViewWHRatio, self.playerViewWHRatio, self.playerViewBottomMargin]];
-        self.scrollViewTopMargin = [NSLayoutConstraint constraintWithItem:self.scrollView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.topLayoutGuide attribute:NSLayoutAttributeBottom multiplier:1.0 constant:-HDLEZ_APP_STATUS_BAR_HEIGHT];
+        self.scrollViewTopMargin = [NSLayoutConstraint constraintWithItem:self.scrollView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.topLayoutGuide attribute:NSLayoutAttributeBottom multiplier:1.0 constant:-[self hdlEZStatusBarHeight]];
         self.scrollViewWHRatio = [NSLayoutConstraint constraintWithItem:self.scrollView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:self.scrollView attribute:NSLayoutAttributeHeight multiplier:HDLEZ_APP_SCREEN_WIDTH/HDLEZ_APP_SCREEN_HEIGHT constant:0];
         
         self.playerViewWHRatio = [NSLayoutConstraint constraintWithItem:self.playerView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:self.playerView attribute:NSLayoutAttributeHeight multiplier:self.doorPlayerAspectRatio constant:0];
@@ -1428,6 +1452,12 @@
 - (IBAction)clickCalloutHangupAction:(id)sender {
     self.isShowAlert = NO;
     [self closeTalkView:self.talkCloseButton];
+    if (self.msgId && self.msgId.length > 0) {
+        [[EZHttpUtil sharedManager] updateAnswerStatusWithMsgId:self.msgId answerStatus:@"no_answer" completion:^(ResponseData * _Nonnull responseData) {
+            HDLEZLog(@"###########鎸傛柇####锛�%@", [responseData yy_modelToJSONString]);
+        }];
+    }
+    [self.navigationController popViewControllerAnimated:YES];
 }
 
 - (IBAction)clickCalloutIgnoreAction:(id)sender {
@@ -1440,6 +1470,12 @@
     self.isShowAlert = NO;
     self.isAnswering = YES;
     [self talkButtonClicked:self.talkButton];
+    if (self.msgId && self.msgId.length > 0) {
+        [[EZHttpUtil sharedManager] updateAnswerStatusWithMsgId:self.msgId answerStatus:@"answer" completion:^(ResponseData * _Nonnull responseData) {
+            HDLEZLog(@"###########鎺ュ惉####锛�%@", [responseData yy_modelToJSONString]);
+        }];
+    }
+    [self.navigationController popViewControllerAnimated:YES];
 }
 
 
@@ -1728,13 +1764,11 @@
         }
             break;
         case HDLEZVideoFullSceneOperationOfSound: { // 寮�鍚煶閲�
-            [_player openSound];
-            NSLog(@"#######寮�鍚煶閲�");
+            [self voiceButtonClicked:self.voiceButton];
         }
             break;
         case HDLEZVideoFullSceneOperationOfSoundOff: {  // 闈欓煶
-            [_player closeSound];
-            NSLog(@"#######闈欓煶");
+            [self voiceButtonClicked:self.voiceButton];
         }
             break;
         case HDLEZVideoFullSceneOperationOfSmooth: {    // 娴佺晠
@@ -1758,10 +1792,16 @@
     }
 }
 
+- (void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
+    if (!self.fullSceneToolView.hidden) {
+        [self.fullSceneToolView qualityStatusChanged:YES];
+    }
+}
+
 #pragma Setter
 - (void)setIsShowAlert:(BOOL)isShowAlert {
     _isShowAlert = isShowAlert;
-    if (isShowAlert) {
+    if (_isShowAlert) {
         [self showCallOutAlertView];
     } else {
         [self hiddenCallOutAlertView];
@@ -1781,4 +1821,24 @@
     return YES;
 }
 
+- (CGFloat)hdlEZStatusBarHeight {
+    if (@available(iOS 13.0, *)) {
+        NSSet *set = [UIApplication sharedApplication].connectedScenes;
+        UIWindowScene *windowScene = [set anyObject];
+        UIStatusBarManager *statusBarManager = windowScene.statusBarManager;
+        return statusBarManager.statusBarFrame.size.height;
+    } else {
+        return [UIApplication sharedApplication].statusBarFrame.size.height;
+    }
+}
+
+/// 鏄惁鏀寔涓�閿紑閿�
+- (BOOL)isSupportOneKeyUnlockDoor {
+    BOOL isSupport = YES;
+    if (self.deviceInfo && self.deviceInfo.deviceType && ([self.deviceInfo.deviceType containsString:@"LT20VC"] || [self.deviceInfo.deviceType containsString:@"LT20VC"])) {
+        isSupport = NO;
+    }
+    return isSupport;
+}
+
 @end

--
Gitblit v1.8.0