session-ios/SessionMessagingKit/Calls/WebRTCSession+MessageHandling.swift
Morgan Pretty 6970ff22cc Refactored the remaining references to PromiseKit
# Conflicts:
#	Session.xcodeproj/project.pbxproj
#	Session/Media Viewing & Editing/PhotoCapture.swift
#	SessionMessagingKit/Jobs/Types/GarbageCollectionJob.swift
#	SessionMessagingKit/Sending & Receiving/MessageSender+Convenience.swift
#	SessionMessagingKit/Utilities/Promise+Utilities.swift
#	SessionShareExtension/ShareVC.swift
#	SessionShareExtension/ThreadPickerVC.swift
#	SessionSnodeKit/OnionRequestAPI+Encryption.swift
#	SessionSnodeKit/OnionRequestAPI.swift
#	SessionUtilitiesKit/Database/Storage.swift
#	SessionUtilitiesKit/Networking/HTTP.swift
2022-12-07 15:58:53 +11:00

30 lines
955 B
Swift

// Copyright © 2022 Rangeproof Pty Ltd. All rights reserved.
import Foundation
import Combine
import WebRTC
import SessionUtilitiesKit
extension WebRTCSession {
public func handleICECandidates(_ candidate: [RTCIceCandidate]) {
SNLog("[Calls] Received ICE candidate message.")
candidate.forEach { peerConnection?.add($0, completionHandler: { _ in }) }
}
public func handleRemoteSDP(_ sdp: RTCSessionDescription, from sessionId: String) {
SNLog("[Calls] Received remote SDP: \(sdp.sdp).")
peerConnection?.setRemoteDescription(sdp, completionHandler: { [weak self] error in
if let error = error {
SNLog("[Calls] Couldn't set SDP due to error: \(error).")
}
else {
guard sdp.type == .offer else { return }
self?.sendAnswer(to: sessionId).sinkUntilComplete()
}
})
}
}