Use federation information to join ext. signaling server

Signed-off-by: Marcel Müller <marcel-mueller@gmx.de>
This commit is contained in:
Marcel Müller 2024-07-24 23:00:56 +02:00
Родитель 39f441b6c9
Коммит a27c8ded4b
1 изменённых файлов: 25 добавлений и 20 удалений

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

@ -162,7 +162,11 @@ import Foundation
// Remember the latest sessionId we're using to join a room, to be able to check when joining the external signaling server // Remember the latest sessionId we're using to join a room, to be able to check when joining the external signaling server
self.joiningSessionId = sessionId self.joiningSessionId = sessionId
extSignalingController.joinRoom(token, withSessionId: sessionId) { error in // TODO: For non-federated rooms, we could skip getting the settings for now
NCAPIController.sharedInstance().getSignalingSettings(for: activeAccount, forRoom: token) { signalingSettings, error in
let federation = signalingSettings?.getFederationJoinDictionary()
extSignalingController.joinRoom(token, withSessionId: sessionId, withFederation: federation) { error in
// If the sessionId is not the same anymore we tried to join with, we either already left again before // If the sessionId is not the same anymore we tried to join with, we either already left again before
// joining the external signaling server succeeded, or we already have another join in process // joining the external signaling server succeeded, or we already have another join in process
if !self.isJoiningRoom(withToken: token) { if !self.isJoiningRoom(withToken: token) {
@ -185,6 +189,7 @@ import Foundation
completionBlock(nil, nil, error, statusCode, statusReason) completionBlock(nil, nil, error, statusCode, statusReason)
} }
} }
}
}) })
} }
@ -200,7 +205,7 @@ import Foundation
roomController.inChat = true roomController.inChat = true
if let extSignalingController = NCSettingsController.sharedInstance().externalSignalingController(forAccountId: activeAccount.accountId) { if let extSignalingController = NCSettingsController.sharedInstance().externalSignalingController(forAccountId: activeAccount.accountId) {
extSignalingController.joinRoom(token, withSessionId: sessionId, withCompletionBlock: nil) extSignalingController.joinRoom(token, withSessionId: sessionId, withFederation: nil, withCompletionBlock: nil)
} }
} else { } else {
print("Could not re-join room. Status code: \(statusCode). Error: \(error?.localizedDescription ?? "Unknown")") print("Could not re-join room. Status code: \(statusCode). Error: \(error?.localizedDescription ?? "Unknown")")