From 8227d1cefb20e357250a4a7fe8da32141b6cfc1e Mon Sep 17 00:00:00 2001
From: chenqiyang <1406175257@qq.com>
Date: 星期二, 24 八月 2021 17:29:10 +0800
Subject: [PATCH] 提交原生sdk工程

---
 HDLLinPhoneSDK/HDLLinPhoneSDK/HDLLinPhoneSDK.m |   56 +++++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 53 insertions(+), 3 deletions(-)

diff --git a/HDLLinPhoneSDK/HDLLinPhoneSDK/HDLLinPhoneSDK.m b/HDLLinPhoneSDK/HDLLinPhoneSDK/HDLLinPhoneSDK.m
index fd8e33c..acb16e1 100644
--- a/HDLLinPhoneSDK/HDLLinPhoneSDK/HDLLinPhoneSDK.m
+++ b/HDLLinPhoneSDK/HDLLinPhoneSDK/HDLLinPhoneSDK.m
@@ -11,6 +11,12 @@
 #import "HDLLinphoneIntercomVC.h"
 #import "HDLLinPhoneCommon.h"
 #import "HDLLPOnMonitorViewController.h"
+
+@interface HDLLinPhoneSDK()
+//@property (nonatomic, strong) HDLLinphoneIntercomVC *IntercomVC;
+//@property (nonatomic, strong) HDLLPOnMonitorViewController *CallVC;
+@end
+
 @implementation HDLLinPhoneSDK
 
 + (instancetype)instance{
@@ -23,6 +29,8 @@
                                                 selector:@selector(registrationUpdate:)
                                                     name:@"LinphoneRegistrationUpdate"
                                                   object:nil];
+//         service.CallVC=nil;
+//         service.IntercomVC=nil;
          
      });
      return service;
@@ -39,7 +47,9 @@
 - (void)registrationUpdate:(NSNotification *)notif {
     LinphoneRegistrationState state = [[notif.userInfo objectForKey:@"state"] intValue];
     if (state == LinphoneRegistrationFailed){
-        
+        NSLog(@"鐧诲け璐�");
+    }else if (state == LinphoneRegistrationCleared){
+        NSLog(@"鐧诲綍娓呯┖");
     } else if (state == LinphoneRegistrationOk) {
         
 //        HDLLinphoneIntercomVC *vc=[[HDLLinphoneIntercomVC alloc]init];
@@ -48,7 +58,10 @@
 //        }];
         NSLog(@"鐧诲綍鎴愬姛鍟�");
     }else if (state==10){//鎺ユ敹鍒板懠鍙�氱煡
-        self.IsAutoJumpCallView=YES;
+//        self.IsAutoJumpCallView=YES;
+        NSString *userName=[NSString stringWithFormat:@"%@",[notif.userInfo objectForKey:@"userName"]];
+        [self.hdlLinphoneCallDelegate onIncomingCall:userName];
+        
         if(self.IsAutoJumpCallView){
                     NSString *callId=[NSString stringWithFormat:@"%@",[notif.userInfo objectForKey:@"callID"]];
                     BOOL hasVideo=(BOOL)[notif.userInfo objectForKey:@"hasVideo"];
@@ -57,12 +70,35 @@
                     vc.CallId=callId;
                     vc.hasVideo=hasVideo;
                     vc.hdlLinphoneCallDelegate=self.hdlLinphoneCallDelegate;
+                    vc.modalPresentationStyle = UIModalPresentationFullScreen;
+//                    self.IntercomVC=vc;
                     [[HDLLinPhoneCommon topMostController] presentViewController:vc animated:YES completion:^{
             
                     }];
         }
 
         
+    }else if(state==11){//鎸傛柇浜�
+//        NSLog(@"鎸傛柇鎴栧嚭閿欎簡");
+//        if (self.IntercomVC) {
+//            __weak typeof(self) weakSelf = self;
+//            [self.IntercomVC dismissViewControllerAnimated:YES completion:^{
+//                weakSelf.IntercomVC=nil;
+//            }];
+//        }
+//
+//        if (self.CallVC) {
+//            __weak typeof(self) weakSelf = self;
+//            [self.CallVC dismissViewControllerAnimated:YES completion:^{
+//                weakSelf.CallVC=nil;
+//            }];
+//        }
+        
+    }else if(state==12){//鍗犵嚎浜�
+//        NSLog(@"鍗犵嚎浜�");
+//        if (self.CallVC) {
+//            [self.CallVC showUIAlertViewWithBack:@"鐩戣缁撴潫"];
+//        }
     }
 }
 
@@ -79,6 +115,7 @@
     vc.modalPresentationStyle = UIModalPresentationFullScreen;
     vc.userName=username;
     vc.titleName=title;
+//    self.CallVC=vc;
     [[HDLLinPhoneCommon topMostController] presentViewController:vc animated:YES completion:^{
         
     }];
@@ -100,16 +137,29 @@
     vc.hdlLinphoneCallDelegate=self.hdlLinphoneCallDelegate;
     vc.titleName=titleName;
     vc.modalPresentationStyle = UIModalPresentationFullScreen;
+//    self.IntercomVC=vc;
     [[HDLLinPhoneCommon topMostController] presentViewController:vc animated:YES completion:^{
         
     }];
 }
 
 -(void)logoutAllLinphoneUser{
-    
+    [HDLLinphoneManager.instance removeAllAccounts];
 }
 
 -(void)clearAllConfigs{
     
 }
+
+-(void)enterBackground{
+    [HDLLinphoneManager.instance enterBackgroundMode];
+}
+
+-(void)becomactive{
+    [HDLLinphoneManager.instance becomeActive];
+}
+
+-(void)willResignActive{
+    [HDLLinphoneManager.instance willResignActive];
+}
 @end

--
Gitblit v1.8.0