Skip to content

Commit

Permalink
Merge pull request #1758 from nextcloud/fix-federated-calling-check
Browse files Browse the repository at this point in the history
Check call enabled flag local and remote
  • Loading branch information
SystemKeeper authored Aug 12, 2024
2 parents c7676d3 + db9a3e0 commit 8ed1c80
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
16 changes: 11 additions & 5 deletions NextcloudTalk/NCRoom.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,23 @@ import Realm
return false
}

public var supportsFederationV2: Bool {
public var supportsFederatedCalling: Bool {
guard self.isFederated else { return false }

let remoteSupported = NCDatabaseManager.sharedInstance().roomHasTalkCapability(kCapabilityFederationV2, for: self)
let localSupported = NCDatabaseManager.sharedInstance().serverHasTalkCapability(kCapabilityFederationV2, forAccountId: self.accountId)
let remoteCapabilitySupported = NCDatabaseManager.sharedInstance().roomHasTalkCapability(kCapabilityFederationV2, for: self)
let localCapabilitySupported = NCDatabaseManager.sharedInstance().serverHasTalkCapability(kCapabilityFederationV2, forAccountId: self.accountId)

return remoteSupported && localSupported
let remoteCallingEnabled = NCDatabaseManager.sharedInstance().roomTalkCapabilities(for: self)?.callEnabled ?? false
let localCallingEnabled = NCDatabaseManager.sharedInstance().serverCapabilities(forAccountId: self.accountId)?.callEnabled ?? false

let capabilitySupported = remoteCapabilitySupported && localCapabilitySupported
let callingEnabled = remoteCallingEnabled && localCallingEnabled

return capabilitySupported && callingEnabled
}

public var supportsCalling: Bool {
if self.isFederated, !self.supportsFederationV2 {
if self.isFederated, !self.supportsFederatedCalling {
return false
}

Expand Down
2 changes: 1 addition & 1 deletion NextcloudTalk/NCRoomsManagerExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ import Foundation

private func getSignalingSettingsHelper(for account: TalkAccount, forRoom token: String, withCompletion completion: @escaping (SignalingSettings?) -> Void) {
// Currently we only need the signaling settings in case the room supports federation-v2
if let room = NCDatabaseManager.sharedInstance().room(withToken: token, forAccountId: account.accountId), room.supportsFederationV2 {
if let room = NCDatabaseManager.sharedInstance().room(withToken: token, forAccountId: account.accountId), room.supportsFederatedCalling {
NCAPIController.sharedInstance().getSignalingSettings(for: account, forRoom: token) { signalingSettings, _ in
completion(signalingSettings)
}
Expand Down

0 comments on commit 8ed1c80

Please sign in to comment.