From cb9232b3ab413fae7bcc2b94abd70f18ca02b263 Mon Sep 17 00:00:00 2001 From: wxr <wxr@hdlchina.com.cn> Date: 星期二, 03 十二月 2024 11:20:32 +0800 Subject: [PATCH] 增加铃声;增加TCP/UDP连接选择 --- HDLLinPhoneSDK/HDLLinPhoneSDK/HDLLPOnMonitorViewController.m | 50 ++++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 44 insertions(+), 6 deletions(-) diff --git a/HDLLinPhoneSDK/HDLLinPhoneSDK/HDLLPOnMonitorViewController.m b/HDLLinPhoneSDK/HDLLinPhoneSDK/HDLLPOnMonitorViewController.m index f11f591..dcf3093 100644 --- a/HDLLinPhoneSDK/HDLLinPhoneSDK/HDLLPOnMonitorViewController.m +++ b/HDLLinPhoneSDK/HDLLinPhoneSDK/HDLLPOnMonitorViewController.m @@ -59,6 +59,10 @@ NSString * LCSdkToken; NSString * LCHostApi; + + NSString * cancelStr; + NSString * tipMsgStr; + CGFloat Height66; bool isShowErrorAlert; // int _openDoorTimeout; @@ -85,9 +89,21 @@ if (self.titleName&&self.titleName.length!=0) { self.titleUILabel.text=self.titleName; } + + [NSNotificationCenter.defaultCenter addObserver:self + selector:@selector(registrationUpdate:) + name:@"LinphoneRegistrationUpdate" + object:nil]; } - +- (void)registrationUpdate:(NSNotification *)notif { + int state = [[notif.userInfo objectForKey:@"state"] intValue]; + if(state==11){//鎸傛柇浜� + NSLog(@"鎸傛柇鎴栧嚭閿欎簡"); + [self showUIAlertViewWithBack:@"鐩戣缁撴潫"]; + + } +} -(void)initLlanguage{ NSString *languageName = [[[NSUserDefaults standardUserDefaults] objectForKey:@"AppleLanguages"] objectAtIndex:0]; @@ -102,6 +118,8 @@ unlockStr = @"寮�閿�"; endOfMonitoringStr = @"鐩戣缁撴潫"; unlockSuccessfullyStr = @"寮�閿佹垚鍔�"; + cancelStr = @"鍙栨秷"; + tipMsgStr = @"纭畾寮�閿佸悧?"; }else{ tipStr = @"Prompt"; @@ -112,6 +130,8 @@ unlockStr = @"Unlock"; endOfMonitoringStr = @"End of monitoring"; unlockSuccessfullyStr = @"Unlock successfully"; + cancelStr = @"Cancel"; + tipMsgStr = @"Are you sure to unlock?"; } @@ -286,7 +306,26 @@ [_unlockTextBtn setTitleColor:TextColor forState:UIControlStateNormal]; //寮�閿� if(self.hdlLinphoneCallDelegate != NULL){ - [self.hdlLinphoneCallDelegate onUnlockAction]; + UIAlertController *alertController = [UIAlertController alertControllerWithTitle:tipStr message:tipMsgStr preferredStyle:UIAlertControllerStyleAlert]; + + // 娣诲姞鍙栨秷鎸夐挳 + UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:cancelStr style:UIAlertActionStyleCancel handler:nil]; + [alertController addAction:cancelAction]; + + // 娣诲姞纭鎸夐挳 + WEAKSELF_AT + UIAlertAction *confirmAction = [UIAlertAction actionWithTitle:okStr style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { + + [weakSelf_AT.hdlLinphoneCallDelegate onUnlockAction]; + }]; + [alertController addAction:confirmAction]; + + // 鑾峰彇褰撳墠瑙嗗浘鎺у埗鍣� + UIViewController *currentViewController = [UIApplication sharedApplication].keyWindow.rootViewController; + + // 鏄剧ず寮圭獥 + [currentViewController presentViewController:alertController animated:YES completion:nil]; + } } @@ -329,7 +368,7 @@ /** 寮�鍚�掕鏃� */ - (void)startOpenDoorCountdown { - if (_openDoorTimeout > 20) { + if (_openDoorTimeout > 10) { return; } @@ -344,7 +383,7 @@ dispatch_source_set_event_handler(_openDoorTimer, ^{ WEAKSELF_AT - if(weakSelf_AT.openDoorTimeout >= 20 ){// 璁℃椂缁撴潫 + if(weakSelf_AT.openDoorTimeout >= 10 ){// 璁℃椂缁撴潫 // 鍏抽棴瀹氭椂鍣� dispatch_source_cancel(weakSelf_AT.openDoorTimer); @@ -387,9 +426,8 @@ 鏆傚仠鎾斁 */ - (void)stopPlay { - [HDLLinphoneManager.instance endCall]; - + } - (void)startPlay { -- Gitblit v1.8.0