// // YOUPAILCVideoResponseVC.m // LiveChat // // Created by 张灿 on 2018/9/17. // Copyright © 2018年 caicai. All rights reserved. // #import "YOUPAILCVideoResponseVC.h" #import "YOUPAILCResponseView.h" @interface YOUPAILCVideoResponseVC () @property(nonatomic,strong)YOUPAILCResponseView* youpaipresponseView; @end @implementation YOUPAILCVideoResponseVC - (void)viewDidLoad { [super viewDidLoad]; [self youpaifsetupResponseView]; } - (void)youpaifsetupResponseView{ self.youpaipresponseView = [[YOUPAILCResponseView alloc]initWithModel:self.youpaipvideoModel]; self.youpaipresponseView.youpaipdelegate = self; [self.view addSubview:self.youpaipresponseView]; } //子类实现的代理 - (void)responseConnent{ NSLog(@"现实接听按钮"); self.youpaipresponseView.youpaipconfirmBtn.hidden = NO; self.youpaipresponseView.youpaipcancelBtn.hidden = NO; // self.responseView.timeLabel.hidden = NO; self.youpaipresponseView.youpaipcloseBtn.hidden = YES; [self.youpaipresponseView youpaiftimePadding]; } - (void)youpaifcolseResBtnClick{ [self videoEnd:7]; } - (void)youpaifcancelBtnClick{ [self.youpaipsocketManager sendRefuse]; } //v1.1.2 增加视频权限判断 接听!!!! - (void)youpaifconfirmBtnClick{ [UCAuthorityManager cameraAuthority:^{ [self.youpaipsocketManager sendAgree]; self.view.backgroundColor = [UIColor blackColor]; [self youpaifsetupInterView]; }denied:^{ UIAlertController *systemAlert = [UIAlertController alertControllerWithTitle:@"请在iphone的“设置-隐私-相机”选项中,允许APP访问您的相机。" message:nil preferredStyle:UIAlertControllerStyleAlert]; UIAlertAction *action = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:nil]; [systemAlert addAction:action]; [self presentViewController:systemAlert animated:YES completion:nil]; }]; } - (void)videoStart:(NSDictionary*)dict{ //视频开始 [super videoStart:dict]; if (self.youpaipresponseView.youpaiptimer) { dispatch_source_cancel(self.youpaipresponseView.youpaiptimer);//删除GCD定时器 self.youpaipresponseView.youpaiptimer = nil; } [self.youpaipresponseView removeFromSuperview]; } //add by leo 剩余可通话时间 - (void)canCallTime:(NSString*)tip { dispatch_async(dispatch_get_main_queue(), ^{ NSString *callTimeStr = [NSString stringWithFormat:@"剩余时长:%@",[ZCUtils getHHMMSSFromSS:tip.integerValue]]; if(tip.integerValue <= 1) { //剩余时间不足 主动挂断 [self.youpaipsocketManager sendHangup]; } [self.youpaipcancallTimeLab setText:callTimeStr]; }); } /// 对方余额 - (void)otherBalance:(NSInteger)balance{ dispatch_async(dispatch_get_main_queue(), ^{ self.youpaipbalanceL.text = [NSString stringWithFormat:@"对方剩余:%@钻石",@(balance)]; }); } // 已减免时长 - (void)discountWithTime:(NSInteger)time{ dispatch_async(dispatch_get_main_queue(), ^{ if (time <= 0) { self.youpaipdiscountL.text = @""; }else{ self.youpaipdiscountL.text = [NSString stringWithFormat:@" 已减免%@分钟 ",@(time)]; } }); } //1主动取消 2。拒绝 3.超时 4.被叫者挂断 5.主叫者挂断 6.费用不足 - (void)videoEnd:(NSInteger)type{ [super videoEnd:type]; if (type==1) { [ZCHUDHelper showTitle:@"已取消"]; }else if (type==2){ [ZCHUDHelper showTitle:@"已拒绝"]; }else if (type==3){ [ZCHUDHelper showTitle:@"超时无应答"]; }else if (type==4){ [ZCHUDHelper showTitle:@"通话已结束"]; }else if (type==5){ [ZCHUDHelper showTitle:@"对方已挂断"]; }else if (type==6){ [ZCHUDHelper showTitle:@"费用不足断开"]; }else if (type==10){ [ZCHUDHelper showTitle:@"检测到视频通话违规系统,请严格遵守平台相关规定" showtime:5]; }else if (type==11){ [ZCHUDHelper showTitle:@"检测到视频通话违规系统挂断,请严格遵守平台相关规定" showtime:5]; } } - (void)youpaifsetupInterView{ [super youpaifsetupInterView]; } @end