Skip to content

Commit

Permalink
Merge pull request #1686 from nextcloud/external-signaling-remove-ise…
Browse files Browse the repository at this point in the history
…nabled

Remove isEnabled from external signaling controller
  • Loading branch information
Ivansss authored Jun 25, 2024
2 parents 7bddfda + f28e02d commit 3851be7
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 27 deletions.
4 changes: 2 additions & 2 deletions NextcloudTalk/DiagnosticsTableViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class DiagnosticsTableViewController: UITableViewController {
// Build signaling sections based on external signaling server
signalingSections.append(AllSignalingSections.kSignalingSectionMode.rawValue)

if externalSignalingController?.isEnabled() ?? false {
if externalSignalingController != nil {
signalingSections.append(AllSignalingSections.kSignalingSectionVersion.rawValue)
}

Expand Down Expand Up @@ -589,7 +589,7 @@ class DiagnosticsTableViewController: UITableViewController {

switch allSectionsIndex {
case AllSignalingSections.kSignalingSectionMode.rawValue:
let externalSignalingServerUsed = externalSignalingController?.isEnabled() ?? false
let externalSignalingServerUsed = externalSignalingController != nil

cell.textLabel?.text = NSLocalizedString("Mode", comment: "The signaling mode used")

Expand Down
20 changes: 10 additions & 10 deletions NextcloudTalk/NCCallController.m
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ - (void)startCall

- (NSString *)signalingSessionId
{
if ([_externalSignalingController isEnabled]) {
if (_externalSignalingController) {
return [_externalSignalingController sessionId];
}
return _userSessionId;
Expand Down Expand Up @@ -203,7 +203,7 @@ - (void)joinCall
[self getPeersForCall];
[self startMonitoringMicrophoneAudioLevel];

if ([self->_externalSignalingController isEnabled]) {
if (self->_externalSignalingController) {
if ([self->_externalSignalingController hasMCU]) {
[self createPublisherPeerConnection];
}
Expand Down Expand Up @@ -332,7 +332,7 @@ - (void)forceReconnect
self->_disableAudioAtStart = ![self isAudioEnabled];
self->_disableVideoAtStart = ![self isVideoEnabled];

if ([self->_externalSignalingController isEnabled]) {
if (self->_externalSignalingController) {
[self->_externalSignalingController forceReconnect];
} else {
[self rejoinCallUsingInternalSignaling];
Expand Down Expand Up @@ -517,7 +517,7 @@ - (void)raiseHand:(BOOL)raised
roomType:peer.roomType
payload:payload];

if ([self->_externalSignalingController isEnabled]) {
if (self->_externalSignalingController) {
[self->_externalSignalingController sendCallMessage:message];
} else {
[self->_signalingController sendSignalingMessage:message];
Expand Down Expand Up @@ -559,7 +559,7 @@ - (void)sendReaction:(NSString *)reaction
roomType:peer.roomType
payload:payload];

if ([self->_externalSignalingController isEnabled]) {
if (self->_externalSignalingController) {
[self->_externalSignalingController sendCallMessage:message];
} else {
[self->_signalingController sendSignalingMessage:message];
Expand Down Expand Up @@ -989,7 +989,7 @@ - (void)sendMessageToAllOfType:(NSString *)type withPayload:(id)payload
}

// Send a signaling message only if we are using an external signaling server
if (![self->_externalSignalingController isEnabled]) {
if (!self->_externalSignalingController) {
return;
}

Expand Down Expand Up @@ -1586,7 +1586,7 @@ - (NSString *)getUserIdFromSessionId:(NSString *)sessionId
{
[[WebRTCCommon shared] assertQueue];

if ([_externalSignalingController isEnabled]) {
if (_externalSignalingController) {
return [_externalSignalingController getUserIdFromSessionId:sessionId];
}

Expand All @@ -1608,7 +1608,7 @@ - (NSString *)getDisplayNameFromSessionId:(NSString *)sessionId
{
[[WebRTCCommon shared] assertQueue];

if ([_externalSignalingController isEnabled]) {
if (_externalSignalingController) {
return [_externalSignalingController getDisplayNameFromSessionId:sessionId];
}
for (NSMutableDictionary *user in _peersInCall) {
Expand Down Expand Up @@ -1695,7 +1695,7 @@ - (void)peerConnection:(NCPeerConnection *)peerConnection didGenerateIceCandidat
roomType:peerConnection.roomType
broadcaster:peerConnection.isOwnScreensharePeer ? [self signalingSessionId] : nil];

if ([_externalSignalingController isEnabled]) {
if (_externalSignalingController) {
[_externalSignalingController sendCallMessage:message];
} else {
[_signalingController sendSignalingMessage:message];
Expand All @@ -1713,7 +1713,7 @@ - (void)peerConnection:(NCPeerConnection *)peerConnection needsToSendSessionDesc
broadcaster:peerConnection.isOwnScreensharePeer ? [self signalingSessionId] : nil
nick:_userDisplayName];

if ([_externalSignalingController isEnabled]) {
if (_externalSignalingController) {
[_externalSignalingController sendCallMessage:message];
} else {
[_signalingController sendSignalingMessage:message];
Expand Down
1 change: 0 additions & 1 deletion NextcloudTalk/NCExternalSignalingController.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ typedef void (^JoinRoomExternalSignalingCompletionBlock)(NSError *error);
@property (nonatomic, weak) id<NCExternalSignalingControllerDelegate> delegate;

- (instancetype)initWithAccount:(TalkAccount *)account server:(NSString *)serverUrl andTicket:(NSString *)ticket;
- (BOOL)isEnabled;
- (BOOL)hasMCU;
- (NSString *)sessionId;
- (void)joinRoom:(NSString *)roomId withSessionId:(NSString *)sessionId withCompletionBlock:(JoinRoomExternalSignalingCompletionBlock)block;
Expand Down
5 changes: 0 additions & 5 deletions NextcloudTalk/NCExternalSignalingController.m
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,6 @@ - (instancetype)initWithAccount:(TalkAccount *)account server:(NSString *)server
return self;
}

- (BOOL)isEnabled
{
return (_serverUrl) ? YES : NO;
}

- (BOOL)hasMCU
{
return _mcuSupport;
Expand Down
4 changes: 2 additions & 2 deletions NextcloudTalk/NCRoomsManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ - (void)startChatInRoom:(NCRoom *)room
// Workaround until external signaling supports multi-room
TalkAccount *activeAccount = [[NCDatabaseManager sharedInstance] activeAccount];
NCExternalSignalingController *extSignalingController = [[NCSettingsController sharedInstance] externalSignalingControllerForAccountId:activeAccount.accountId];
if ([extSignalingController isEnabled]) {
if (extSignalingController) {
NSString *currentRoom = extSignalingController.currentRoom;
if (![currentRoom isEqualToString:room.token]) {
// Since we are going to join another conversation, we don't need to leaveRoom() in extSignalingController.
Expand Down Expand Up @@ -448,7 +448,7 @@ - (void)startCall:(BOOL)video inRoom:(NCRoom *)room withVideoEnabled:(BOOL)enabl

// Workaround until external signaling supports multi-room
NCExternalSignalingController *extSignalingController = [[NCSettingsController sharedInstance] externalSignalingControllerForAccountId:activeAccount.accountId];
if ([extSignalingController isEnabled]) {
if (extSignalingController) {
NSString *extSignalingRoomToken = extSignalingController.currentRoom;

if (![extSignalingRoomToken isEqualToString:joiningRoomToken]) {
Expand Down
8 changes: 2 additions & 6 deletions NextcloudTalk/NCRoomsManagerExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,7 @@ import Foundation
roomController.inChat = true

if let extSignalingController = NCSettingsController.sharedInstance().externalSignalingController(forAccountId: activeAccount.accountId) {
if extSignalingController.isEnabled() {
extSignalingController.joinRoom(token, withSessionId: sessionId, withCompletionBlock: nil)
}
extSignalingController.joinRoom(token, withSessionId: sessionId, withCompletionBlock: nil)
}
} else {
print("Could not re-join room. Status code: \(statusCode). Error: \(error?.localizedDescription ?? "Unknown")")
Expand Down Expand Up @@ -206,9 +204,7 @@ import Foundation
print("Could not exit room. Error: \(error.localizedDescription)")
} else {
if let extSignalingController = NCSettingsController.sharedInstance().externalSignalingController(forAccountId: activeAccount.accountId) {
if extSignalingController.isEnabled() {
extSignalingController.leaveRoom(token)
}
extSignalingController.leaveRoom(token)
}
}

Expand Down
2 changes: 1 addition & 1 deletion NextcloudTalk/SettingsTableViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -886,7 +886,7 @@ extension SettingsTableViewController {
typingIndicatorSwitch.isOn = !serverCapabilities.typingPrivacy

let externalSignalingController = NCSettingsController.sharedInstance().externalSignalingController(forAccountId: activeAccount.accountId)
let externalSignalingServerUsed = externalSignalingController?.isEnabled() ?? false
let externalSignalingServerUsed = externalSignalingController != nil

if !externalSignalingServerUsed {
cell.detailTextLabel?.text = NSLocalizedString("Typing indicators are only available when using a high performance backend (HPB)", comment: "")
Expand Down

0 comments on commit 3851be7

Please sign in to comment.