Implement provider did end call.

Signed-off-by: Ivan Sein <ivan@nextcloud.com>
This commit is contained in:
Ivan Sein 2019-02-01 10:58:57 +01:00
Родитель 70527f1f3e
Коммит 50318a586e
3 изменённых файлов: 19 добавлений и 1 удалений

Просмотреть файл

@ -9,6 +9,7 @@
#import <Foundation/Foundation.h>
extern NSString * const CallKitManagerDidAnswerCallNotification;
extern NSString * const CallKitManagerDidEndCallNotification;
@interface CallKitManager : NSObject

Просмотреть файл

@ -13,7 +13,8 @@
#import "NCAudioController.h"
#import "NCRoomsManager.h"
NSString * const CallKitManagerDidAnswerCallNotification = @"CallKitManagerDidAnswerCallNotification";
NSString * const CallKitManagerDidAnswerCallNotification = @"CallKitManagerDidAnswerCallNotification";
NSString * const CallKitManagerDidEndCallNotification = @"CallKitManagerDidEndCallNotification";
@interface CallKitManager () <CXProviderDelegate>
@ -116,6 +117,10 @@ NSString * const CallKitManagerDidAnswerCallNotification = @"CallKitManagerDidA
- (void)provider:(CXProvider *)provider performEndCallAction:(CXEndCallAction *)action
{
NSDictionary *userInfo = [NSDictionary dictionaryWithObject:_currentCallToken forKey:@"roomToken"];
[[NSNotificationCenter defaultCenter] postNotificationName:CallKitManagerDidEndCallNotification
object:self
userInfo:userInfo];
self.currentCallUUID = nil;
self.currentCallToken = nil;
[action fulfill];

Просмотреть файл

@ -25,6 +25,7 @@
#import "NCRoomsManager.h"
#import "NCSettingsController.h"
#import "UIImageView+AFNetworking.h"
#import "CallKitManager.h"
typedef NS_ENUM(NSInteger, CallState) {
CallStateJoining,
@ -84,6 +85,7 @@ typedef NS_ENUM(NSInteger, CallState) {
[AvatarBackgroundImageView setSharedImageDownloader:imageDownloader];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didJoinRoom:) name:NCRoomsManagerDidJoinRoomNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(providerDidEndCall:) name:CallKitManagerDidEndCallNotification object:nil];
return self;
}
@ -177,6 +179,16 @@ typedef NS_ENUM(NSInteger, CallState) {
}
}
- (void)providerDidEndCall:(NSNotification *)notification
{
NSString *roomToken = [notification.userInfo objectForKey:@"roomToken"];
if (![roomToken isEqualToString:_room.token]) {
return;
}
[self hangup];
}
#pragma mark - Local video
- (void)setLocalVideoRect