From b897bf1e118e69764da20ef6668ef5d9ec1653e8 Mon Sep 17 00:00:00 2001
From: chenqiyang <1406175257@qq.com>
Date: 星期四, 25 五月 2023 09:33:38 +0800
Subject: [PATCH] 增加监视结束国际化

---
 HDLLinPhoneSDK(OC)/HDLLinPhoneSDK/HDLLinphoneIntercomVC.m |   58 ++++++++++++++++++++++++++++++++++++++--------------------
 1 files changed, 38 insertions(+), 20 deletions(-)

diff --git "a/HDLLinPhoneSDK\357\274\210OC\357\274\211/HDLLinPhoneSDK/HDLLinphoneIntercomVC.m" "b/HDLLinPhoneSDK\357\274\210OC\357\274\211/HDLLinPhoneSDK/HDLLinphoneIntercomVC.m"
index 1ea7374..90fba0f 100644
--- "a/HDLLinPhoneSDK\357\274\210OC\357\274\211/HDLLinPhoneSDK/HDLLinphoneIntercomVC.m"
+++ "b/HDLLinPhoneSDK\357\274\210OC\357\274\211/HDLLinPhoneSDK/HDLLinphoneIntercomVC.m"
@@ -35,6 +35,9 @@
 @property (nonatomic,strong) dispatch_source_t openDoorTimer;
 @property (nonatomic, assign) int openDoorTimeout;
 @property (nonatomic, assign) int callTimeout;
+
+@property (nonatomic, assign)  BOOL isHangUpByRemote;//鏄惁瀵规柟杩滅▼鎸傛柇
+
 @end
 
 @implementation HDLLinphoneIntercomVC{
@@ -90,11 +93,15 @@
 
 }
 
+
 - (void)linphoneCallUpdate:(NSNotification *)notif {
     int state = [[notif.userInfo objectForKey:@"state"] intValue];
-    if ((state == LinphoneCallEnd || state == LinphoneCallError)) {//鎸傛柇浜�
+    if ((state == LinphoneCallEnd || state == LinphoneCallError)) {//鎸傛柇浜�(铏界劧鑷繁鎸傛柇涔熶細璧癓inphoneCallUpdate閫氱煡锛屼絾鑷繁鎸傛柇鐨勮瘽椤甸潰宸查攢姣侊紝涓嶄細瑙﹀彂璇ユ柟娉�)
         NSLog(@"鎸傛柇鎴栧嚭閿欎簡");
+        [self stopPlaySystemSound];
+        self.isHangUpByRemote=YES;
         [self showUIAlertViewWithBack:@"閫氳瘽缁撴潫"];
+        
         
     }
 }
@@ -331,6 +338,7 @@
     }
     return _hangUpTextBtn;
 }
+
 //鎺ュ惉 鍥炬爣鎸夐挳
 - (UIButton *)answerImgBtn{
     if (_answerImgBtn == nil) {
@@ -349,7 +357,15 @@
     [self stopPlaySystemSound];
     
 //    [[HDLCallManager instance] acceptCallByCallID:self.CallId hasVideo:self.hasVideo];
-    [[HDLLinphoneManager instance] acceptCall];
+    [HDLLinphoneManager.instance enableMicro:true];
+    if (self.deviceType==HDLLPType_HDLSR) {
+        NSLog(@"鍙嶅懠");
+        [HDLLinphoneManager.instance startCall:self.userName];
+    }else{
+        NSLog(@"鎺ュ惉");
+        [[HDLLinphoneManager instance] acceptCall];
+        
+    }
     /// 寮�鍚璁�
 //    [self startTalk];
     
@@ -467,9 +483,9 @@
 /** 寮�鍚�掕鏃� */
 - (void)startCountdown {
     
-    if (_callTimeout > 100) {
-        return;
-    }
+//    if (_callTimeout > 100) {
+//        return;
+//    }
     _callTimeout = 0;
     // GCD瀹氭椂鍣�
     dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
@@ -480,24 +496,24 @@
     
     dispatch_source_set_event_handler(_countdownTimer, ^{
         WEAKSELF_AT
-        if(weakSelf_AT.callTimeout >= 100 ){// 璁℃椂缁撴潫
-            // 鍏抽棴瀹氭椂鍣�
-            dispatch_source_cancel(weakSelf_AT.countdownTimer);
-            
-            dispatch_async(dispatch_get_main_queue(), ^{
-                NSLog(@"瓒呮椂");
-                [weakSelf_AT backAction];
-                
-            });
-            
-        }else{// 璁℃椂涓�
+//        if(weakSelf_AT.callTimeout >= 100 ){// 璁℃椂缁撴潫
+//            // 鍏抽棴瀹氭椂鍣�
+//            dispatch_source_cancel(weakSelf_AT.countdownTimer);
+//
+//            dispatch_async(dispatch_get_main_queue(), ^{
+//                NSLog(@"瓒呮椂");
+//                [weakSelf_AT backAction];
+//
+//            });
+//
+//        }else{// 璁℃椂涓�
             weakSelf_AT.callTimeout++;
             dispatch_async(dispatch_get_main_queue(), ^{
                 [weakSelf_AT ShowTime:weakSelf_AT.callTimeout];
             });
             
             
-        }
+//        }
     });
     
     // 寮�鍚畾鏃跺櫒
@@ -653,7 +669,9 @@
     [self stopPlaySystemSound];
     //闃叉鐢ㄦ埛涓嶆寜鎸傛柇锛屾垨鑰呬笉绛夋敹鍒板鏂圭殑鎸傛柇锛岀偣鍑昏繑鍥炴寜閽��
     //1.鏆傚仠SDK鐩稿叧鎾斁
-    [self stopPlay];
+    if (!self.isHangUpByRemote) {
+        [self stopPlay];
+    }
     //2.Delegate閲婃斁
     self.hdlLinphoneCallDelegate = nil;
     //3.瀹氭椂鍣ㄩ噴鏀�
@@ -672,8 +690,8 @@
 }
 
 -(void)dealloc{
-    NSLog(@"==============dealloc  1");
-    [[NSNotificationCenter defaultCenter] removeObserver:self];
+    NSLog(@"==============dealloc 瀵硅薄閿�姣佷簡");
+//    [[NSNotificationCenter defaultCenter] removeObserver:self];
 }
 - (void)willEnterForeground:(NSNotification*)notification{
     NSLog(@"willEnterForeground");

--
Gitblit v1.8.0