diff --git a/NextcloudTalk/NCCallController.m b/NextcloudTalk/NCCallController.m index b5caa9cb..e84624ff 100644 --- a/NextcloudTalk/NCCallController.m +++ b/NextcloudTalk/NCCallController.m @@ -854,6 +854,11 @@ static NSString * const kNCVideoTrackKind = @"video"; }]; } +- (void)externalSignalingController:(NCExternalSignalingController *)externalSignalingController shouldSwitchToCall:(NSString *)roomToken +{ + [self willSwitchToCall:roomToken]; +} + #pragma mark - Signaling Controller Delegate - (void)signalingController:(NCSignalingController *)signalingController didReceiveSignalingMessage:(NSDictionary *)message diff --git a/NextcloudTalk/NCExternalSignalingController.h b/NextcloudTalk/NCExternalSignalingController.h index 7944ad7d..d0940272 100644 --- a/NextcloudTalk/NCExternalSignalingController.h +++ b/NextcloudTalk/NCExternalSignalingController.h @@ -39,6 +39,7 @@ typedef enum NCExternalSignalingSendMessageStatus { - (void)externalSignalingController:(NCExternalSignalingController *)externalSignalingController didReceivedParticipantListMessage:(NSDictionary *)participantListMessageDict; - (void)externalSignalingControllerShouldRejoinCall:(NCExternalSignalingController *)externalSignalingController; - (void)externalSignalingControllerWillRejoinCall:(NCExternalSignalingController *)externalSignalingController; +- (void)externalSignalingController:(NCExternalSignalingController *)externalSignalingController shouldSwitchToCall:(NSString *)roomToken; @end diff --git a/NextcloudTalk/NCExternalSignalingController.m b/NextcloudTalk/NCExternalSignalingController.m index 71209f28..9666e935 100644 --- a/NextcloudTalk/NCExternalSignalingController.m +++ b/NextcloudTalk/NCExternalSignalingController.m @@ -479,6 +479,8 @@ static NSTimeInterval kWebSocketTimeoutInterval = 15; NSLog(@"Participant left room."); } else if ([eventType isEqualToString:@"message"]) { [self processRoomMessageEvent:[eventDict objectForKey:@"message"]]; + } else if ([eventType isEqualToString:@"switchto"]) { + [self processSwitchToMessageEvent:[eventDict objectForKey:@"switchto"]]; } else { NSLog(@"Unknown room event: %@", eventDict); } @@ -496,6 +498,16 @@ static NSTimeInterval kWebSocketTimeoutInterval = 15; } } +- (void)processSwitchToMessageEvent:(NSDictionary *)messageDict +{ + NSString *roomToken = [messageDict objectForKey:@"roomId"]; + if (roomToken.length > 0) { + [self.delegate externalSignalingController:self shouldSwitchToCall:roomToken]; + } else { + NSLog(@"Unknown switchTo message: %@", messageDict); + } +} + - (void)processRoomListEvent:(NSDictionary *)eventDict { NSLog(@"Refresh room list.");