diff --git a/.changes/options-init b/.changes/options-init new file mode 100644 index 000000000..c0c0d8e38 --- /dev/null +++ b/.changes/options-init @@ -0,0 +1 @@ +patch type="fixed" "RoomOptions init collision" \ No newline at end of file diff --git a/Sources/LiveKit/Types/Options/RoomOptions.swift b/Sources/LiveKit/Types/Options/RoomOptions.swift index f94b782a2..e20e93100 100644 --- a/Sources/LiveKit/Types/Options/RoomOptions.swift +++ b/Sources/LiveKit/Types/Options/RoomOptions.swift @@ -17,7 +17,7 @@ import Foundation @objc -public final class RoomOptions: NSObject, Sendable { +public final class RoomOptions: NSObject, Sendable, Loggable { // default options for capturing @objc public let defaultCameraCaptureOptions: CameraCaptureOptions @@ -101,34 +101,6 @@ public final class RoomOptions: NSObject, Sendable { stopLocalTrackOnUnpublish: Bool = true, suspendLocalVideoTracksInBackground: Bool = true, e2eeOptions: E2EEOptions? = nil, - reportRemoteTrackStatistics: Bool = false) - { - self.defaultCameraCaptureOptions = defaultCameraCaptureOptions - self.defaultScreenShareCaptureOptions = defaultScreenShareCaptureOptions - self.defaultAudioCaptureOptions = defaultAudioCaptureOptions - self.defaultVideoPublishOptions = defaultVideoPublishOptions - self.defaultAudioPublishOptions = defaultAudioPublishOptions - self.defaultDataPublishOptions = defaultDataPublishOptions - self.adaptiveStream = adaptiveStream - self.dynacast = dynacast - self.stopLocalTrackOnUnpublish = stopLocalTrackOnUnpublish - self.suspendLocalVideoTracksInBackground = suspendLocalVideoTracksInBackground - self.e2eeOptions = e2eeOptions - encryptionOptions = nil // don't pass both - self.reportRemoteTrackStatistics = reportRemoteTrackStatistics - } - - @objc - public init(defaultCameraCaptureOptions: CameraCaptureOptions = CameraCaptureOptions(), - defaultScreenShareCaptureOptions: ScreenShareCaptureOptions = ScreenShareCaptureOptions(), - defaultAudioCaptureOptions: AudioCaptureOptions = AudioCaptureOptions(), - defaultVideoPublishOptions: VideoPublishOptions = VideoPublishOptions(), - defaultAudioPublishOptions: AudioPublishOptions = AudioPublishOptions(), - defaultDataPublishOptions: DataPublishOptions = DataPublishOptions(), - adaptiveStream: Bool = false, - dynacast: Bool = false, - stopLocalTrackOnUnpublish: Bool = true, - suspendLocalVideoTracksInBackground: Bool = true, encryptionOptions: EncryptionOptions? = nil, reportRemoteTrackStatistics: Bool = false) { @@ -142,9 +114,15 @@ public final class RoomOptions: NSObject, Sendable { self.dynacast = dynacast self.stopLocalTrackOnUnpublish = stopLocalTrackOnUnpublish self.suspendLocalVideoTracksInBackground = suspendLocalVideoTracksInBackground - e2eeOptions = nil // don't pass both + self.e2eeOptions = e2eeOptions self.encryptionOptions = encryptionOptions self.reportRemoteTrackStatistics = reportRemoteTrackStatistics + + super.init() + + if e2eeOptions != nil, encryptionOptions != nil { + log("Specifying both 'e2eeOptions' and 'encryptionOptions' is not supported. Migrate to 'EncryptionOptions' to enable data channel encryption (requires support from all platforms).", .error) + } } // MARK: - Equal diff --git a/Tests/LiveKitTests/DataChannel/EncryptedDataChannelTests.swift b/Tests/LiveKitTests/DataChannel/EncryptedDataChannelTests.swift index 5a7dafb72..b86f64064 100644 --- a/Tests/LiveKitTests/DataChannel/EncryptedDataChannelTests.swift +++ b/Tests/LiveKitTests/DataChannel/EncryptedDataChannelTests.swift @@ -138,7 +138,7 @@ class EncryptedDataChannelTests: LKTestCase, @unchecked Sendable { await self.fulfillment(of: [self.decryptionErrorExpectation], timeout: 5) XCTAssertNotNil(self.lastDecryptionError, "Decryption error should have occurred") - XCTAssertNil(self.receivedData, "No data should be received when decryption fails") + XCTAssert(self.receivedData.isEmpty, "No data should be received when decryption fails") } } @@ -188,7 +188,7 @@ class EncryptedDataChannelTests: LKTestCase, @unchecked Sendable { await self.fulfillment(of: [self.decryptionErrorExpectation], timeout: 5) XCTAssertNotNil(self.lastDecryptionError, "Decryption error should have occurred with mismatched per-participant keys") - XCTAssertNil(self.receivedData, "No data should be received when per-participant key decryption fails") + XCTAssert(self.receivedData.isEmpty, "No data should be received when per-participant key decryption fails") } }