YOUPAILCVideoResponseVC.m 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. //
  2. // YOUPAILCVideoResponseVC.m
  3. // LiveChat
  4. //
  5. // Created by 张灿 on 2018/9/17.
  6. // Copyright © 2018年 caicai. All rights reserved.
  7. //
  8. #import "YOUPAILCVideoResponseVC.h"
  9. #import "YOUPAILCResponseView.h"
  10. @interface YOUPAILCVideoResponseVC ()<LCResponseViewDelegate>
  11. @property(nonatomic,strong)YOUPAILCResponseView* youpaipresponseView;
  12. @end
  13. @implementation YOUPAILCVideoResponseVC
  14. - (void)viewDidLoad {
  15. [super viewDidLoad];
  16. [self youpaifsetupResponseView];
  17. }
  18. - (void)youpaifsetupResponseView{
  19. self.youpaipresponseView = [[YOUPAILCResponseView alloc]initWithModel:self.youpaipvideoModel];
  20. self.youpaipresponseView.youpaipdelegate = self;
  21. [self.view addSubview:self.youpaipresponseView];
  22. }
  23. //子类实现的代理
  24. - (void)responseConnent{
  25. NSLog(@"现实接听按钮");
  26. self.youpaipresponseView.youpaipconfirmBtn.hidden = NO;
  27. self.youpaipresponseView.youpaipcancelBtn.hidden = NO;
  28. // self.responseView.timeLabel.hidden = NO;
  29. self.youpaipresponseView.youpaipcloseBtn.hidden = YES;
  30. [self.youpaipresponseView youpaiftimePadding];
  31. }
  32. - (void)youpaifcolseResBtnClick{
  33. [self videoEnd:7];
  34. }
  35. - (void)youpaifcancelBtnClick{
  36. [self.youpaipsocketManager sendRefuse];
  37. }
  38. //v1.1.2 增加视频权限判断 接听!!!!
  39. - (void)youpaifconfirmBtnClick{
  40. [UCAuthorityManager cameraAuthority:^{
  41. [self.youpaipsocketManager sendAgree];
  42. self.view.backgroundColor = [UIColor blackColor];
  43. [self youpaifsetupInterView];
  44. }denied:^{
  45. UIAlertController *systemAlert = [UIAlertController alertControllerWithTitle:@"请在iphone的“设置-隐私-相机”选项中,允许APP访问您的相机。" message:nil preferredStyle:UIAlertControllerStyleAlert];
  46. UIAlertAction *action = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:nil];
  47. [systemAlert addAction:action];
  48. [self presentViewController:systemAlert animated:YES completion:nil];
  49. }];
  50. }
  51. - (void)videoStart:(NSDictionary*)dict{ //视频开始
  52. [super videoStart:dict];
  53. if (self.youpaipresponseView.youpaiptimer) {
  54. dispatch_source_cancel(self.youpaipresponseView.youpaiptimer);//删除GCD定时器
  55. self.youpaipresponseView.youpaiptimer = nil;
  56. }
  57. [self.youpaipresponseView removeFromSuperview];
  58. }
  59. //add by leo 剩余可通话时间
  60. - (void)canCallTime:(NSString*)tip
  61. {
  62. dispatch_async(dispatch_get_main_queue(), ^{
  63. NSString *callTimeStr = [NSString stringWithFormat:@"剩余时长:%@",[ZCUtils getHHMMSSFromSS:tip.integerValue]];
  64. if(tip.integerValue <= 1)
  65. {
  66. //剩余时间不足 主动挂断
  67. [self.youpaipsocketManager sendHangup];
  68. }
  69. [self.youpaipcancallTimeLab setText:callTimeStr];
  70. });
  71. }
  72. /// 对方余额
  73. - (void)otherBalance:(NSInteger)balance{
  74. dispatch_async(dispatch_get_main_queue(), ^{
  75. self.youpaipbalanceL.text = [NSString stringWithFormat:@"对方剩余:%@钻石",@(balance)];
  76. });
  77. }
  78. // 已减免时长
  79. - (void)discountWithTime:(NSInteger)time{
  80. dispatch_async(dispatch_get_main_queue(), ^{
  81. if (time <= 0) {
  82. self.youpaipdiscountL.text = @"";
  83. }else{
  84. self.youpaipdiscountL.text = [NSString stringWithFormat:@" 已减免%@分钟 ",@(time)];
  85. }
  86. });
  87. }
  88. //1主动取消 2。拒绝 3.超时 4.被叫者挂断 5.主叫者挂断 6.费用不足
  89. - (void)videoEnd:(NSInteger)type{
  90. [super videoEnd:type];
  91. if (type==1) {
  92. [ZCHUDHelper showTitle:@"已取消"];
  93. }else if (type==2){
  94. [ZCHUDHelper showTitle:@"已拒绝"];
  95. }else if (type==3){
  96. [ZCHUDHelper showTitle:@"超时无应答"];
  97. }else if (type==4){
  98. [ZCHUDHelper showTitle:@"通话已结束"];
  99. }else if (type==5){
  100. [ZCHUDHelper showTitle:@"对方已挂断"];
  101. }else if (type==6){
  102. [ZCHUDHelper showTitle:@"费用不足断开"];
  103. }else if (type==10){
  104. [ZCHUDHelper showTitle:@"检测到视频通话违规系统,请严格遵守平台相关规定" showtime:5];
  105. }else if (type==11){
  106. [ZCHUDHelper showTitle:@"检测到视频通话违规系统挂断,请严格遵守平台相关规定" showtime:5];
  107. }
  108. }
  109. - (void)youpaifsetupInterView{
  110. [super youpaifsetupInterView];
  111. }
  112. @end