From 2265a8478325a04871aab6a86d49c28d7d65443a Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期一, 29 五月 2023 15:17:01 +0800 Subject: [PATCH] 增加开锁二次确认弹窗 --- HDLLinPhoneSDK(OC)/HDLLinPhoneSDK/HDLLPOnMonitorViewController.m | 47 ++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 38 insertions(+), 9 deletions(-) diff --git "a/HDLLinPhoneSDK\357\274\210OC\357\274\211/HDLLinPhoneSDK/HDLLPOnMonitorViewController.m" "b/HDLLinPhoneSDK\357\274\210OC\357\274\211/HDLLinPhoneSDK/HDLLPOnMonitorViewController.m" index 0be0912..63e68f9 100644 --- "a/HDLLinPhoneSDK\357\274\210OC\357\274\211/HDLLinPhoneSDK/HDLLPOnMonitorViewController.m" +++ "b/HDLLinPhoneSDK\357\274\210OC\357\274\211/HDLLinPhoneSDK/HDLLPOnMonitorViewController.m" @@ -10,7 +10,7 @@ #import <Photos/Photos.h> #import "HDLLinphoneUtlis.h" #import "HDLLinphoneManager.h" - +#import "HDLLinPhoneCommon.h" //#import "HDLLinPhoneSDK-Swift.h" //#import "LCUtlis.h" //#import "LCApiKit.h" @@ -37,7 +37,7 @@ @property (nonatomic,strong) dispatch_source_t openDoorTimer; @property (nonatomic, assign) int openDoorTimeout; - +@property (nonatomic, assign) BOOL isHangUpByRemote;//鏄惁瀵规柟杩滅▼鎸傛柇 /// 鎾斁鍣� //@property (nonatomic, strong) LCOpenSDK_PlayWindow *playWindow; @@ -58,6 +58,8 @@ NSString * LCSdkToken; NSString * LCHostApi; + NSString * cancelStr; + NSString * tipMsgStr; CGFloat Height66; bool isShowErrorAlert; @@ -75,7 +77,7 @@ [self initData]; [self initESVideo]; [self StartMonitoring]; -// [HDLLinphoneManager.instance enableMicro:false]; + [HDLLinphoneManager.instance enableMicro:false]; // //鏆傛椂涓嶆敮鎸佸紑閿佸姛鑳� // [self setUnlock:NO]; @@ -101,7 +103,8 @@ int state = [[notif.userInfo objectForKey:@"state"] intValue]; if ((state == LinphoneCallEnd || state == LinphoneCallError)){//鎸傛柇浜� NSLog(@"鎸傛柇鎴栧嚭閿欎簡"); - [self showUIAlertViewWithBack:@"鐩戣缁撴潫"]; + self.isHangUpByRemote=YES; + [self showUIAlertViewWithBack:endOfMonitoringStr]; } } @@ -119,6 +122,8 @@ unlockStr = @"寮�閿�"; endOfMonitoringStr = @"鐩戣缁撴潫"; unlockSuccessfullyStr = @"寮�閿佹垚鍔�"; + cancelStr = @"鍙栨秷"; + tipMsgStr = @"纭畾寮�閿佸悧?"; }else{ tipStr = @"Prompt"; @@ -129,6 +134,8 @@ unlockStr = @"Unlock"; endOfMonitoringStr = @"End of monitoring"; unlockSuccessfullyStr = @"Unlock successfully"; + cancelStr = @"Cancel"; + tipMsgStr = @"Are you sure to unlock?"; } @@ -303,7 +310,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; + + // 鏄剧ず寮圭獥 + [self presentViewController:alertController animated:YES completion:nil]; } } @@ -422,7 +448,7 @@ 寮�濮嬬洃鎺� */ -(void)StartMonitoring{ - NSLog(@"寮�濮嬪懠鍙細@%@",self.userName); + NSLog(@"寮�濮嬪懠鍙細%@",self.userName); [HDLLinphoneManager.instance startCall:self.userName]; } @@ -450,8 +476,9 @@ [alertController addAction:[UIAlertAction actionWithTitle:okStr style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { [self backAction]; }]]; - [self presentViewController:alertController animated:YES completion:nil]; +// [[HDLLinPhoneCommon rootController] presentViewController:alertController animated:YES completion:nil]; + } @@ -469,14 +496,16 @@ - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; - + } -(void)viewWillDisappear:(BOOL)animated{ [super viewWillDisappear:animated]; //1.鏆傚仠SDK鐩稿叧鎾斁 - [self stopPlay]; + if (!self.isHangUpByRemote) { + [self stopPlay]; + } //2.Delegate閲婃斁 // self.mLCCallDelegate = nil; //3.瀹氭椂鍣ㄩ噴鏀� -- Gitblit v1.8.0