Migrate to WebRTC proto wrappers.
This commit is contained in:
parent
67110d0def
commit
379104c532
|
@ -201,6 +201,8 @@
|
|||
34C3C78F2040A4F70000134C /* sonarping.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = 34C3C78E2040A4F70000134C /* sonarping.mp3 */; };
|
||||
34C3C7922040B0DD0000134C /* OWSAudioPlayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 34C3C7902040B0DC0000134C /* OWSAudioPlayer.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
34C3C7932040B0DD0000134C /* OWSAudioPlayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 34C3C7912040B0DC0000134C /* OWSAudioPlayer.m */; };
|
||||
34C4E2572118957600BEA353 /* OWSWebRTCDataProtos.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34C4E2552118957600BEA353 /* OWSWebRTCDataProtos.pb.swift */; };
|
||||
34C4E2582118957600BEA353 /* WebRTCProto.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34C4E2562118957600BEA353 /* WebRTCProto.swift */; };
|
||||
34C6B0A91FA0E46F00D35993 /* test-gif.gif in Resources */ = {isa = PBXBuildFile; fileRef = 34C6B0A51FA0E46F00D35993 /* test-gif.gif */; };
|
||||
34C6B0AB1FA0E46F00D35993 /* test-mp3.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = 34C6B0A71FA0E46F00D35993 /* test-mp3.mp3 */; };
|
||||
34C6B0AC1FA0E46F00D35993 /* test-mp4.mp4 in Resources */ = {isa = PBXBuildFile; fileRef = 34C6B0A81FA0E46F00D35993 /* test-mp4.mp4 */; };
|
||||
|
@ -336,7 +338,6 @@
|
|||
4539B5861F79348F007141FF /* PushRegistrationManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4539B5851F79348F007141FF /* PushRegistrationManager.swift */; };
|
||||
4541B71D209D3B7A0008608F /* ContactShareViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4541B71A209D2DAE0008608F /* ContactShareViewModel.swift */; };
|
||||
4542DF54208D40AC007B4E76 /* LoadingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4542DF53208D40AC007B4E76 /* LoadingViewController.swift */; };
|
||||
45464DBC1DFA041F001D3FD6 /* DataChannelMessage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 45464DBB1DFA041F001D3FD6 /* DataChannelMessage.swift */; };
|
||||
454A84042059C787008B8C75 /* MediaTileViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 454A84032059C787008B8C75 /* MediaTileViewController.swift */; };
|
||||
454A965A1FD6017E008D2A0E /* SignalAttachment.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34D913491F62D4A500722898 /* SignalAttachment.swift */; };
|
||||
454A965B1FD601BF008D2A0E /* MediaMessageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34CA1C281F7164F700E51C51 /* MediaMessageView.swift */; };
|
||||
|
@ -362,7 +363,6 @@
|
|||
4585C4681ED8F8D200896AEA /* SafetyNumberConfirmationAlert.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4585C4671ED8F8D200896AEA /* SafetyNumberConfirmationAlert.swift */; };
|
||||
458967111DC117CC00E9DD21 /* AccountManagerTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 458967101DC117CC00E9DD21 /* AccountManagerTest.swift */; };
|
||||
458DE9D61DEE3FD00071BB03 /* PeerConnectionClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = 458DE9D51DEE3FD00071BB03 /* PeerConnectionClient.swift */; };
|
||||
458DE9D91DEE7B360071BB03 /* OWSWebRTCDataProtos.pb.m in Sources */ = {isa = PBXBuildFile; fileRef = 458DE9D81DEE7B360071BB03 /* OWSWebRTCDataProtos.pb.m */; };
|
||||
458E38371D668EBF0094BD24 /* OWSDeviceProvisioningURLParser.m in Sources */ = {isa = PBXBuildFile; fileRef = 458E38361D668EBF0094BD24 /* OWSDeviceProvisioningURLParser.m */; };
|
||||
458E383A1D6699FA0094BD24 /* OWSDeviceProvisioningURLParserTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 458E38391D6699FA0094BD24 /* OWSDeviceProvisioningURLParserTest.m */; };
|
||||
459311FC1D75C948008DD4F0 /* OWSDeviceTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 459311FB1D75C948008DD4F0 /* OWSDeviceTableViewCell.m */; };
|
||||
|
@ -860,6 +860,8 @@
|
|||
34C42D631F4734ED0072EC04 /* OWSContactOffersInteraction.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OWSContactOffersInteraction.m; sourceTree = "<group>"; };
|
||||
34C42D641F4734ED0072EC04 /* TSUnreadIndicatorInteraction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TSUnreadIndicatorInteraction.h; sourceTree = "<group>"; };
|
||||
34C42D651F4734ED0072EC04 /* TSUnreadIndicatorInteraction.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TSUnreadIndicatorInteraction.m; sourceTree = "<group>"; };
|
||||
34C4E2552118957600BEA353 /* OWSWebRTCDataProtos.pb.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OWSWebRTCDataProtos.pb.swift; sourceTree = "<group>"; };
|
||||
34C4E2562118957600BEA353 /* WebRTCProto.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WebRTCProto.swift; sourceTree = "<group>"; };
|
||||
34C6B0A51FA0E46F00D35993 /* test-gif.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = "test-gif.gif"; sourceTree = "<group>"; };
|
||||
34C6B0A71FA0E46F00D35993 /* test-mp3.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = "test-mp3.mp3"; sourceTree = "<group>"; };
|
||||
34C6B0A81FA0E46F00D35993 /* test-mp4.mp4 */ = {isa = PBXFileReference; lastKnownFileType = file; path = "test-mp4.mp4"; sourceTree = "<group>"; };
|
||||
|
@ -1000,7 +1002,6 @@
|
|||
4541B71A209D2DAE0008608F /* ContactShareViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContactShareViewModel.swift; sourceTree = "<group>"; };
|
||||
4542DF51208B82E9007B4E76 /* ThreadViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThreadViewModel.swift; sourceTree = "<group>"; };
|
||||
4542DF53208D40AC007B4E76 /* LoadingViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoadingViewController.swift; sourceTree = "<group>"; };
|
||||
45464DBB1DFA041F001D3FD6 /* DataChannelMessage.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DataChannelMessage.swift; sourceTree = "<group>"; };
|
||||
454A84032059C787008B8C75 /* MediaTileViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MediaTileViewController.swift; sourceTree = "<group>"; };
|
||||
454A965E1FD60EA2008D2A0E /* OWSFlatButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = OWSFlatButton.swift; path = SignalMessaging/Views/OWSFlatButton.swift; sourceTree = SOURCE_ROOT; };
|
||||
454B35071D08EED80026D658 /* mk */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = mk; path = translations/mk.lproj/Localizable.strings; sourceTree = "<group>"; };
|
||||
|
@ -1032,8 +1033,6 @@
|
|||
4589670F1DC117CC00E9DD21 /* SignalTests-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SignalTests-Bridging-Header.h"; sourceTree = "<group>"; };
|
||||
458967101DC117CC00E9DD21 /* AccountManagerTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = AccountManagerTest.swift; path = Models/AccountManagerTest.swift; sourceTree = "<group>"; };
|
||||
458DE9D51DEE3FD00071BB03 /* PeerConnectionClient.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PeerConnectionClient.swift; sourceTree = "<group>"; };
|
||||
458DE9D71DEE7B360071BB03 /* OWSWebRTCDataProtos.pb.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OWSWebRTCDataProtos.pb.h; sourceTree = "<group>"; };
|
||||
458DE9D81DEE7B360071BB03 /* OWSWebRTCDataProtos.pb.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OWSWebRTCDataProtos.pb.m; sourceTree = "<group>"; };
|
||||
458E38351D668EBF0094BD24 /* OWSDeviceProvisioningURLParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OWSDeviceProvisioningURLParser.h; sourceTree = "<group>"; };
|
||||
458E38361D668EBF0094BD24 /* OWSDeviceProvisioningURLParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OWSDeviceProvisioningURLParser.m; sourceTree = "<group>"; };
|
||||
458E38391D6699FA0094BD24 /* OWSDeviceProvisioningURLParserTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OWSDeviceProvisioningURLParserTest.m; path = Models/OWSDeviceProvisioningURLParserTest.m; sourceTree = "<group>"; };
|
||||
|
@ -1822,6 +1821,15 @@
|
|||
path = Signal/AudioFiles/ringtoneSounds;
|
||||
sourceTree = SOURCE_ROOT;
|
||||
};
|
||||
34C4E2542118957600BEA353 /* Generated */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
34C4E2552118957600BEA353 /* OWSWebRTCDataProtos.pb.swift */,
|
||||
34C4E2562118957600BEA353 /* WebRTCProto.swift */,
|
||||
);
|
||||
path = Generated;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
34C6B0A41FA0E46F00D35993 /* Assets */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
|
@ -2029,9 +2037,6 @@
|
|||
children = (
|
||||
45C9DEB71DF4E35A0065CA84 /* WebRTCCallMessageHandler.swift */,
|
||||
45AE48501E0732D6004D96C2 /* TurnServerInfo.swift */,
|
||||
458DE9D71DEE7B360071BB03 /* OWSWebRTCDataProtos.pb.h */,
|
||||
458DE9D81DEE7B360071BB03 /* OWSWebRTCDataProtos.pb.m */,
|
||||
45464DBB1DFA041F001D3FD6 /* DataChannelMessage.swift */,
|
||||
);
|
||||
name = Signaling;
|
||||
sourceTree = "<group>";
|
||||
|
@ -2131,6 +2136,7 @@
|
|||
76EB03C318170B33006006FC /* AppDelegate.m */,
|
||||
76EB03FE18170B33006006FC /* call */,
|
||||
76EB041118170B33006006FC /* environment */,
|
||||
34C4E2542118957600BEA353 /* Generated */,
|
||||
45D231751DC7E8C50034FA89 /* Jobs */,
|
||||
457F3AC01D14A0F700C51351 /* Models */,
|
||||
76EB041D18170B33006006FC /* network */,
|
||||
|
@ -3276,6 +3282,7 @@
|
|||
files = (
|
||||
4CC0B59C20EC5F2E00CF6EE0 /* ConversationConfigurationSyncOperation.swift in Sources */,
|
||||
3461293E1FD1D72B00532771 /* ExperienceUpgradeFinder.swift in Sources */,
|
||||
34C4E2582118957600BEA353 /* WebRTCProto.swift in Sources */,
|
||||
34D1F0BD1F8D108C0066283D /* AttachmentUploadView.m in Sources */,
|
||||
452EC6DF205E9E30000E787C /* MediaGalleryViewController.swift in Sources */,
|
||||
34386A52207D0C01009F5D9C /* HomeViewCell.m in Sources */,
|
||||
|
@ -3314,7 +3321,6 @@
|
|||
B6B9ECFC198B31BA00C620D3 /* PushManager.m in Sources */,
|
||||
34386A54207D271D009F5D9C /* NeverClearView.swift in Sources */,
|
||||
45DF5DF21DDB843F00C936C7 /* CompareSafetyNumbersActivity.swift in Sources */,
|
||||
458DE9D91DEE7B360071BB03 /* OWSWebRTCDataProtos.pb.m in Sources */,
|
||||
451166C01FD86B98000739BA /* AccountManager.swift in Sources */,
|
||||
34D2CCD220618B3000CB1A14 /* OWSBackupLazyRestoreJob.swift in Sources */,
|
||||
3430FE181F7751D4000EC51B /* GiphyAPI.swift in Sources */,
|
||||
|
@ -3345,7 +3351,6 @@
|
|||
34E5DC8220D8050D00C08145 /* RegistrationUtils.m in Sources */,
|
||||
452EA09E1EA7ABE00078744B /* AttachmentPointerView.swift in Sources */,
|
||||
45638BDC1F3DD0D400128435 /* DebugUICalling.swift in Sources */,
|
||||
45464DBC1DFA041F001D3FD6 /* DataChannelMessage.swift in Sources */,
|
||||
34E3E5681EC4B19400495BAC /* AudioProgressView.swift in Sources */,
|
||||
34D1F0521F7E8EA30066283D /* GiphyDownloader.swift in Sources */,
|
||||
340FC8BC204DAC8D007AEB0F /* FingerprintViewController.m in Sources */,
|
||||
|
@ -3438,6 +3443,7 @@
|
|||
4579431E1E7C8CE9008ED0C0 /* Pastelog.m in Sources */,
|
||||
340FC8B0204DAC8D007AEB0F /* AddToBlockListViewController.m in Sources */,
|
||||
340FC8B3204DAC8D007AEB0F /* AppSettingsViewController.m in Sources */,
|
||||
34C4E2572118957600BEA353 /* OWSWebRTCDataProtos.pb.swift in Sources */,
|
||||
346B66311F4E29B200E5122F /* CropScaleImageViewController.swift in Sources */,
|
||||
45E5A6991F61E6DE001E4A8A /* MarqueeLabel.swift in Sources */,
|
||||
34A910601FFEB114000C4745 /* OWSBackup.m in Sources */,
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
shift-base:CodedInputStream.m
|
||||
# generated protos
|
||||
bool:WhisperTextProtocol.pb.m
|
||||
bool:OWSWebRTCDataProtos.pb.m
|
||||
|
||||
# YapDatabase
|
||||
bool:YapDatabaseAutoViewTransaction.m
|
||||
|
|
|
@ -0,0 +1,313 @@
|
|||
//
|
||||
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
//*
|
||||
// Copyright (C) 2014-2016 Open Whisper Systems
|
||||
//
|
||||
// Licensed according to the LICENSE file in this repository.
|
||||
|
||||
/// iOS - since we use a modern proto-compiler, we must specify
|
||||
/// the legacy proto format.
|
||||
|
||||
import Foundation
|
||||
import SwiftProtobuf
|
||||
|
||||
// If the compiler emits an error on this type, it is because this file
|
||||
// was generated by a version of the `protoc` Swift plug-in that is
|
||||
// incompatible with the version of SwiftProtobuf to which you are linking.
|
||||
// Please ensure that your are building against the same version of the API
|
||||
// that was used to generate this file.
|
||||
private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
|
||||
struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {}
|
||||
typealias Version = _2
|
||||
}
|
||||
|
||||
struct WebRTCProtos_Connected {
|
||||
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
// methods supported on all messages.
|
||||
|
||||
/// @required
|
||||
var id: UInt64 {
|
||||
get {return _id ?? 0}
|
||||
set {_id = newValue}
|
||||
}
|
||||
/// Returns true if `id` has been explicitly set.
|
||||
var hasID: Bool {return self._id != nil}
|
||||
/// Clears the value of `id`. Subsequent reads from it will return its default value.
|
||||
mutating func clearID() {self._id = nil}
|
||||
|
||||
var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
init() {}
|
||||
|
||||
fileprivate var _id: UInt64?
|
||||
}
|
||||
|
||||
struct WebRTCProtos_Hangup {
|
||||
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
// methods supported on all messages.
|
||||
|
||||
/// @required
|
||||
var id: UInt64 {
|
||||
get {return _id ?? 0}
|
||||
set {_id = newValue}
|
||||
}
|
||||
/// Returns true if `id` has been explicitly set.
|
||||
var hasID: Bool {return self._id != nil}
|
||||
/// Clears the value of `id`. Subsequent reads from it will return its default value.
|
||||
mutating func clearID() {self._id = nil}
|
||||
|
||||
var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
init() {}
|
||||
|
||||
fileprivate var _id: UInt64?
|
||||
}
|
||||
|
||||
struct WebRTCProtos_VideoStreamingStatus {
|
||||
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
// methods supported on all messages.
|
||||
|
||||
/// @required
|
||||
var id: UInt64 {
|
||||
get {return _id ?? 0}
|
||||
set {_id = newValue}
|
||||
}
|
||||
/// Returns true if `id` has been explicitly set.
|
||||
var hasID: Bool {return self._id != nil}
|
||||
/// Clears the value of `id`. Subsequent reads from it will return its default value.
|
||||
mutating func clearID() {self._id = nil}
|
||||
|
||||
var enabled: Bool {
|
||||
get {return _enabled ?? false}
|
||||
set {_enabled = newValue}
|
||||
}
|
||||
/// Returns true if `enabled` has been explicitly set.
|
||||
var hasEnabled: Bool {return self._enabled != nil}
|
||||
/// Clears the value of `enabled`. Subsequent reads from it will return its default value.
|
||||
mutating func clearEnabled() {self._enabled = nil}
|
||||
|
||||
var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
init() {}
|
||||
|
||||
fileprivate var _id: UInt64?
|
||||
fileprivate var _enabled: Bool?
|
||||
}
|
||||
|
||||
struct WebRTCProtos_Data {
|
||||
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
// methods supported on all messages.
|
||||
|
||||
var connected: WebRTCProtos_Connected {
|
||||
get {return _storage._connected ?? WebRTCProtos_Connected()}
|
||||
set {_uniqueStorage()._connected = newValue}
|
||||
}
|
||||
/// Returns true if `connected` has been explicitly set.
|
||||
var hasConnected: Bool {return _storage._connected != nil}
|
||||
/// Clears the value of `connected`. Subsequent reads from it will return its default value.
|
||||
mutating func clearConnected() {_storage._connected = nil}
|
||||
|
||||
var hangup: WebRTCProtos_Hangup {
|
||||
get {return _storage._hangup ?? WebRTCProtos_Hangup()}
|
||||
set {_uniqueStorage()._hangup = newValue}
|
||||
}
|
||||
/// Returns true if `hangup` has been explicitly set.
|
||||
var hasHangup: Bool {return _storage._hangup != nil}
|
||||
/// Clears the value of `hangup`. Subsequent reads from it will return its default value.
|
||||
mutating func clearHangup() {_storage._hangup = nil}
|
||||
|
||||
var videoStreamingStatus: WebRTCProtos_VideoStreamingStatus {
|
||||
get {return _storage._videoStreamingStatus ?? WebRTCProtos_VideoStreamingStatus()}
|
||||
set {_uniqueStorage()._videoStreamingStatus = newValue}
|
||||
}
|
||||
/// Returns true if `videoStreamingStatus` has been explicitly set.
|
||||
var hasVideoStreamingStatus: Bool {return _storage._videoStreamingStatus != nil}
|
||||
/// Clears the value of `videoStreamingStatus`. Subsequent reads from it will return its default value.
|
||||
mutating func clearVideoStreamingStatus() {_storage._videoStreamingStatus = nil}
|
||||
|
||||
var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
init() {}
|
||||
|
||||
fileprivate var _storage = _StorageClass.defaultInstance
|
||||
}
|
||||
|
||||
// MARK: - Code below here is support for the SwiftProtobuf runtime.
|
||||
|
||||
private let _protobuf_package = "WebRTCProtos"
|
||||
|
||||
extension WebRTCProtos_Connected: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
static let protoMessageName: String = _protobuf_package + ".Connected"
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "id")
|
||||
]
|
||||
|
||||
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
while let fieldNumber = try decoder.nextFieldNumber() {
|
||||
switch fieldNumber {
|
||||
case 1: try decoder.decodeSingularUInt64Field(value: &self._id)
|
||||
default: break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
if let v = self._id {
|
||||
try visitor.visitSingularUInt64Field(value: v, fieldNumber: 1)
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
func _protobuf_generated_isEqualTo(other: WebRTCProtos_Connected) -> Bool {
|
||||
if self._id != other._id {return false}
|
||||
if unknownFields != other.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
extension WebRTCProtos_Hangup: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
static let protoMessageName: String = _protobuf_package + ".Hangup"
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "id")
|
||||
]
|
||||
|
||||
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
while let fieldNumber = try decoder.nextFieldNumber() {
|
||||
switch fieldNumber {
|
||||
case 1: try decoder.decodeSingularUInt64Field(value: &self._id)
|
||||
default: break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
if let v = self._id {
|
||||
try visitor.visitSingularUInt64Field(value: v, fieldNumber: 1)
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
func _protobuf_generated_isEqualTo(other: WebRTCProtos_Hangup) -> Bool {
|
||||
if self._id != other._id {return false}
|
||||
if unknownFields != other.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
extension WebRTCProtos_VideoStreamingStatus: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
static let protoMessageName: String = _protobuf_package + ".VideoStreamingStatus"
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "id"),
|
||||
2: .same(proto: "enabled")
|
||||
]
|
||||
|
||||
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
while let fieldNumber = try decoder.nextFieldNumber() {
|
||||
switch fieldNumber {
|
||||
case 1: try decoder.decodeSingularUInt64Field(value: &self._id)
|
||||
case 2: try decoder.decodeSingularBoolField(value: &self._enabled)
|
||||
default: break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
if let v = self._id {
|
||||
try visitor.visitSingularUInt64Field(value: v, fieldNumber: 1)
|
||||
}
|
||||
if let v = self._enabled {
|
||||
try visitor.visitSingularBoolField(value: v, fieldNumber: 2)
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
func _protobuf_generated_isEqualTo(other: WebRTCProtos_VideoStreamingStatus) -> Bool {
|
||||
if self._id != other._id {return false}
|
||||
if self._enabled != other._enabled {return false}
|
||||
if unknownFields != other.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
extension WebRTCProtos_Data: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
static let protoMessageName: String = _protobuf_package + ".Data"
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "connected"),
|
||||
2: .same(proto: "hangup"),
|
||||
3: .same(proto: "videoStreamingStatus")
|
||||
]
|
||||
|
||||
fileprivate class _StorageClass {
|
||||
var _connected: WebRTCProtos_Connected?
|
||||
var _hangup: WebRTCProtos_Hangup?
|
||||
var _videoStreamingStatus: WebRTCProtos_VideoStreamingStatus?
|
||||
|
||||
static let defaultInstance = _StorageClass()
|
||||
|
||||
private init() {}
|
||||
|
||||
init(copying source: _StorageClass) {
|
||||
_connected = source._connected
|
||||
_hangup = source._hangup
|
||||
_videoStreamingStatus = source._videoStreamingStatus
|
||||
}
|
||||
}
|
||||
|
||||
fileprivate mutating func _uniqueStorage() -> _StorageClass {
|
||||
if !isKnownUniquelyReferenced(&_storage) {
|
||||
_storage = _StorageClass(copying: _storage)
|
||||
}
|
||||
return _storage
|
||||
}
|
||||
|
||||
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
_ = _uniqueStorage()
|
||||
try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
|
||||
while let fieldNumber = try decoder.nextFieldNumber() {
|
||||
switch fieldNumber {
|
||||
case 1: try decoder.decodeSingularMessageField(value: &_storage._connected)
|
||||
case 2: try decoder.decodeSingularMessageField(value: &_storage._hangup)
|
||||
case 3: try decoder.decodeSingularMessageField(value: &_storage._videoStreamingStatus)
|
||||
default: break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
|
||||
if let v = _storage._connected {
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
|
||||
}
|
||||
if let v = _storage._hangup {
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 2)
|
||||
}
|
||||
if let v = _storage._videoStreamingStatus {
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 3)
|
||||
}
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
func _protobuf_generated_isEqualTo(other: WebRTCProtos_Data) -> Bool {
|
||||
if _storage !== other._storage {
|
||||
let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_args: (_StorageClass, _StorageClass)) in
|
||||
let _storage = _args.0
|
||||
let other_storage = _args.1
|
||||
if _storage._connected != other_storage._connected {return false}
|
||||
if _storage._hangup != other_storage._hangup {return false}
|
||||
if _storage._videoStreamingStatus != other_storage._videoStreamingStatus {return false}
|
||||
return true
|
||||
}
|
||||
if !storagesAreEqual {return false}
|
||||
}
|
||||
if unknownFields != other.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
|
@ -0,0 +1,376 @@
|
|||
//
|
||||
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
// WARNING: This code is generated. Only edit within the markers.
|
||||
|
||||
public enum WebRTCProtoError: Error {
|
||||
case invalidProtobuf(description: String)
|
||||
case unsafeProtobuf(description: String)
|
||||
}
|
||||
|
||||
// MARK: - WebRTCProtoConnected
|
||||
|
||||
@objc public class WebRTCProtoConnected: NSObject {
|
||||
|
||||
// MARK: - WebRTCProtoConnectedBuilder
|
||||
|
||||
@objc public class WebRTCProtoConnectedBuilder: NSObject {
|
||||
|
||||
private var proto = WebRTCProtos_Connected()
|
||||
|
||||
@objc public override init() {}
|
||||
|
||||
@objc public func setId(_ valueParam: UInt64) {
|
||||
proto.id = valueParam
|
||||
}
|
||||
|
||||
// NOTE: This method is intended for debugging purposes only.
|
||||
@objc public func buildIgnoringErrors() -> WebRTCProtoConnected? {
|
||||
guard _isDebugAssertConfiguration() else {
|
||||
return nil
|
||||
}
|
||||
|
||||
return try! self.build()
|
||||
}
|
||||
|
||||
@objc public func build() throws -> WebRTCProtoConnected {
|
||||
return try WebRTCProtoConnected.parseProto(proto)
|
||||
}
|
||||
|
||||
@objc public func buildSerializedData() throws -> Data {
|
||||
return try WebRTCProtoConnected.parseProto(proto).serializedData()
|
||||
}
|
||||
}
|
||||
|
||||
fileprivate let proto: WebRTCProtos_Connected
|
||||
|
||||
@objc public let id: UInt64
|
||||
|
||||
private init(proto: WebRTCProtos_Connected,
|
||||
id: UInt64) {
|
||||
self.proto = proto
|
||||
self.id = id
|
||||
}
|
||||
|
||||
// NOTE: This method is intended for debugging purposes only.
|
||||
@objc public func serializedDataIgnoringErrors() -> Data? {
|
||||
guard _isDebugAssertConfiguration() else {
|
||||
return nil
|
||||
}
|
||||
|
||||
return try! self.serializedData()
|
||||
}
|
||||
|
||||
@objc
|
||||
public func serializedData() throws -> Data {
|
||||
return try self.proto.serializedData()
|
||||
}
|
||||
|
||||
@objc public class func parseData(_ serializedData: Data) throws -> WebRTCProtoConnected {
|
||||
let proto = try WebRTCProtos_Connected(serializedData: serializedData)
|
||||
return try parseProto(proto)
|
||||
}
|
||||
|
||||
fileprivate class func parseProto(_ proto: WebRTCProtos_Connected) throws -> WebRTCProtoConnected {
|
||||
guard proto.hasID else {
|
||||
throw WebRTCProtoError.invalidProtobuf(description: "\(logTag) missing required field: id")
|
||||
}
|
||||
let id = proto.id
|
||||
|
||||
// MARK: - Begin Validation Logic for WebRTCProtoConnected -
|
||||
|
||||
// MARK: - End Validation Logic for WebRTCProtoConnected -
|
||||
|
||||
let result = WebRTCProtoConnected(proto: proto,
|
||||
id: id)
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - WebRTCProtoHangup
|
||||
|
||||
@objc public class WebRTCProtoHangup: NSObject {
|
||||
|
||||
// MARK: - WebRTCProtoHangupBuilder
|
||||
|
||||
@objc public class WebRTCProtoHangupBuilder: NSObject {
|
||||
|
||||
private var proto = WebRTCProtos_Hangup()
|
||||
|
||||
@objc public override init() {}
|
||||
|
||||
@objc public func setId(_ valueParam: UInt64) {
|
||||
proto.id = valueParam
|
||||
}
|
||||
|
||||
// NOTE: This method is intended for debugging purposes only.
|
||||
@objc public func buildIgnoringErrors() -> WebRTCProtoHangup? {
|
||||
guard _isDebugAssertConfiguration() else {
|
||||
return nil
|
||||
}
|
||||
|
||||
return try! self.build()
|
||||
}
|
||||
|
||||
@objc public func build() throws -> WebRTCProtoHangup {
|
||||
return try WebRTCProtoHangup.parseProto(proto)
|
||||
}
|
||||
|
||||
@objc public func buildSerializedData() throws -> Data {
|
||||
return try WebRTCProtoHangup.parseProto(proto).serializedData()
|
||||
}
|
||||
}
|
||||
|
||||
fileprivate let proto: WebRTCProtos_Hangup
|
||||
|
||||
@objc public let id: UInt64
|
||||
|
||||
private init(proto: WebRTCProtos_Hangup,
|
||||
id: UInt64) {
|
||||
self.proto = proto
|
||||
self.id = id
|
||||
}
|
||||
|
||||
// NOTE: This method is intended for debugging purposes only.
|
||||
@objc public func serializedDataIgnoringErrors() -> Data? {
|
||||
guard _isDebugAssertConfiguration() else {
|
||||
return nil
|
||||
}
|
||||
|
||||
return try! self.serializedData()
|
||||
}
|
||||
|
||||
@objc
|
||||
public func serializedData() throws -> Data {
|
||||
return try self.proto.serializedData()
|
||||
}
|
||||
|
||||
@objc public class func parseData(_ serializedData: Data) throws -> WebRTCProtoHangup {
|
||||
let proto = try WebRTCProtos_Hangup(serializedData: serializedData)
|
||||
return try parseProto(proto)
|
||||
}
|
||||
|
||||
fileprivate class func parseProto(_ proto: WebRTCProtos_Hangup) throws -> WebRTCProtoHangup {
|
||||
guard proto.hasID else {
|
||||
throw WebRTCProtoError.invalidProtobuf(description: "\(logTag) missing required field: id")
|
||||
}
|
||||
let id = proto.id
|
||||
|
||||
// MARK: - Begin Validation Logic for WebRTCProtoHangup -
|
||||
|
||||
// MARK: - End Validation Logic for WebRTCProtoHangup -
|
||||
|
||||
let result = WebRTCProtoHangup(proto: proto,
|
||||
id: id)
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - WebRTCProtoVideoStreamingStatus
|
||||
|
||||
@objc public class WebRTCProtoVideoStreamingStatus: NSObject {
|
||||
|
||||
// MARK: - WebRTCProtoVideoStreamingStatusBuilder
|
||||
|
||||
@objc public class WebRTCProtoVideoStreamingStatusBuilder: NSObject {
|
||||
|
||||
private var proto = WebRTCProtos_VideoStreamingStatus()
|
||||
|
||||
@objc public override init() {}
|
||||
|
||||
@objc public func setId(_ valueParam: UInt64) {
|
||||
proto.id = valueParam
|
||||
}
|
||||
|
||||
@objc public func setEnabled(_ valueParam: Bool) {
|
||||
proto.enabled = valueParam
|
||||
}
|
||||
|
||||
// NOTE: This method is intended for debugging purposes only.
|
||||
@objc public func buildIgnoringErrors() -> WebRTCProtoVideoStreamingStatus? {
|
||||
guard _isDebugAssertConfiguration() else {
|
||||
return nil
|
||||
}
|
||||
|
||||
return try! self.build()
|
||||
}
|
||||
|
||||
@objc public func build() throws -> WebRTCProtoVideoStreamingStatus {
|
||||
return try WebRTCProtoVideoStreamingStatus.parseProto(proto)
|
||||
}
|
||||
|
||||
@objc public func buildSerializedData() throws -> Data {
|
||||
return try WebRTCProtoVideoStreamingStatus.parseProto(proto).serializedData()
|
||||
}
|
||||
}
|
||||
|
||||
fileprivate let proto: WebRTCProtos_VideoStreamingStatus
|
||||
|
||||
@objc public let id: UInt64
|
||||
|
||||
@objc public var enabled: Bool {
|
||||
return proto.enabled
|
||||
}
|
||||
@objc public var hasEnabled: Bool {
|
||||
return proto.hasEnabled
|
||||
}
|
||||
|
||||
private init(proto: WebRTCProtos_VideoStreamingStatus,
|
||||
id: UInt64) {
|
||||
self.proto = proto
|
||||
self.id = id
|
||||
}
|
||||
|
||||
// NOTE: This method is intended for debugging purposes only.
|
||||
@objc public func serializedDataIgnoringErrors() -> Data? {
|
||||
guard _isDebugAssertConfiguration() else {
|
||||
return nil
|
||||
}
|
||||
|
||||
return try! self.serializedData()
|
||||
}
|
||||
|
||||
@objc
|
||||
public func serializedData() throws -> Data {
|
||||
return try self.proto.serializedData()
|
||||
}
|
||||
|
||||
@objc public class func parseData(_ serializedData: Data) throws -> WebRTCProtoVideoStreamingStatus {
|
||||
let proto = try WebRTCProtos_VideoStreamingStatus(serializedData: serializedData)
|
||||
return try parseProto(proto)
|
||||
}
|
||||
|
||||
fileprivate class func parseProto(_ proto: WebRTCProtos_VideoStreamingStatus) throws -> WebRTCProtoVideoStreamingStatus {
|
||||
guard proto.hasID else {
|
||||
throw WebRTCProtoError.invalidProtobuf(description: "\(logTag) missing required field: id")
|
||||
}
|
||||
let id = proto.id
|
||||
|
||||
// MARK: - Begin Validation Logic for WebRTCProtoVideoStreamingStatus -
|
||||
|
||||
// MARK: - End Validation Logic for WebRTCProtoVideoStreamingStatus -
|
||||
|
||||
let result = WebRTCProtoVideoStreamingStatus(proto: proto,
|
||||
id: id)
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - WebRTCProtoData
|
||||
|
||||
@objc public class WebRTCProtoData: NSObject {
|
||||
|
||||
// MARK: - WebRTCProtoDataBuilder
|
||||
|
||||
@objc public class WebRTCProtoDataBuilder: NSObject {
|
||||
|
||||
private var proto = WebRTCProtos_Data()
|
||||
|
||||
@objc public override init() {}
|
||||
|
||||
@objc public func setConnected(_ valueParam: WebRTCProtoConnected) {
|
||||
proto.connected = valueParam.proto
|
||||
}
|
||||
|
||||
@objc public func setHangup(_ valueParam: WebRTCProtoHangup) {
|
||||
proto.hangup = valueParam.proto
|
||||
}
|
||||
|
||||
@objc public func setVideoStreamingStatus(_ valueParam: WebRTCProtoVideoStreamingStatus) {
|
||||
proto.videoStreamingStatus = valueParam.proto
|
||||
}
|
||||
|
||||
// NOTE: This method is intended for debugging purposes only.
|
||||
@objc public func buildIgnoringErrors() -> WebRTCProtoData? {
|
||||
guard _isDebugAssertConfiguration() else {
|
||||
return nil
|
||||
}
|
||||
|
||||
return try! self.build()
|
||||
}
|
||||
|
||||
@objc public func build() throws -> WebRTCProtoData {
|
||||
return try WebRTCProtoData.parseProto(proto)
|
||||
}
|
||||
|
||||
@objc public func buildSerializedData() throws -> Data {
|
||||
return try WebRTCProtoData.parseProto(proto).serializedData()
|
||||
}
|
||||
}
|
||||
|
||||
fileprivate let proto: WebRTCProtos_Data
|
||||
|
||||
@objc public let connected: WebRTCProtoConnected?
|
||||
@objc public var hasConnected: Bool {
|
||||
return proto.hasConnected
|
||||
}
|
||||
|
||||
@objc public let hangup: WebRTCProtoHangup?
|
||||
@objc public var hasHangup: Bool {
|
||||
return proto.hasHangup
|
||||
}
|
||||
|
||||
@objc public let videoStreamingStatus: WebRTCProtoVideoStreamingStatus?
|
||||
@objc public var hasVideoStreamingStatus: Bool {
|
||||
return proto.hasVideoStreamingStatus
|
||||
}
|
||||
|
||||
private init(proto: WebRTCProtos_Data,
|
||||
connected: WebRTCProtoConnected?,
|
||||
hangup: WebRTCProtoHangup?,
|
||||
videoStreamingStatus: WebRTCProtoVideoStreamingStatus?) {
|
||||
self.proto = proto
|
||||
self.connected = connected
|
||||
self.hangup = hangup
|
||||
self.videoStreamingStatus = videoStreamingStatus
|
||||
}
|
||||
|
||||
// NOTE: This method is intended for debugging purposes only.
|
||||
@objc public func serializedDataIgnoringErrors() -> Data? {
|
||||
guard _isDebugAssertConfiguration() else {
|
||||
return nil
|
||||
}
|
||||
|
||||
return try! self.serializedData()
|
||||
}
|
||||
|
||||
@objc
|
||||
public func serializedData() throws -> Data {
|
||||
return try self.proto.serializedData()
|
||||
}
|
||||
|
||||
@objc public class func parseData(_ serializedData: Data) throws -> WebRTCProtoData {
|
||||
let proto = try WebRTCProtos_Data(serializedData: serializedData)
|
||||
return try parseProto(proto)
|
||||
}
|
||||
|
||||
fileprivate class func parseProto(_ proto: WebRTCProtos_Data) throws -> WebRTCProtoData {
|
||||
var connected: WebRTCProtoConnected? = nil
|
||||
if proto.hasConnected {
|
||||
connected = try WebRTCProtoConnected.parseProto(proto.connected)
|
||||
}
|
||||
|
||||
var hangup: WebRTCProtoHangup? = nil
|
||||
if proto.hasHangup {
|
||||
hangup = try WebRTCProtoHangup.parseProto(proto.hangup)
|
||||
}
|
||||
|
||||
var videoStreamingStatus: WebRTCProtoVideoStreamingStatus? = nil
|
||||
if proto.hasVideoStreamingStatus {
|
||||
videoStreamingStatus = try WebRTCProtoVideoStreamingStatus.parseProto(proto.videoStreamingStatus)
|
||||
}
|
||||
|
||||
// MARK: - Begin Validation Logic for WebRTCProtoData -
|
||||
|
||||
// MARK: - End Validation Logic for WebRTCProtoData -
|
||||
|
||||
let result = WebRTCProtoData(proto: proto,
|
||||
connected: connected,
|
||||
hangup: hangup,
|
||||
videoStreamingStatus: videoStreamingStatus)
|
||||
return result
|
||||
}
|
||||
}
|
|
@ -33,7 +33,6 @@
|
|||
#import "OWSNavigationController.h"
|
||||
#import "OWSProgressView.h"
|
||||
#import "OWSQuotedMessageView.h"
|
||||
#import "OWSWebRTCDataProtos.pb.h"
|
||||
#import "OWSWindowManager.h"
|
||||
#import "PinEntryView.h"
|
||||
#import "PrivacySettingsTableViewController.h"
|
||||
|
|
|
@ -997,8 +997,21 @@ private class SignalCallData: NSObject {
|
|||
callRecord.save()
|
||||
call.callRecord = callRecord
|
||||
|
||||
let message = DataChannelMessage.forConnected(callId: call.signalingId)
|
||||
peerConnectionClient.sendDataChannelMessage(data: message.asData(), description: "connected", isCritical: true)
|
||||
var messageData: Data
|
||||
do {
|
||||
let connectedBuilder = WebRTCProtoConnected.WebRTCProtoConnectedBuilder()
|
||||
connectedBuilder.setId(call.signalingId)
|
||||
let connectedProto = try connectedBuilder.build()
|
||||
|
||||
let dataBuilder = WebRTCProtoData.WebRTCProtoDataBuilder()
|
||||
dataBuilder.setConnected(connectedProto)
|
||||
messageData = try dataBuilder.buildSerializedData()
|
||||
} catch {
|
||||
handleFailedCall(failedCall: call, error: CallError.assertionError(description: "\(self.logTag) couldn't build proto in \(#function)"))
|
||||
return
|
||||
}
|
||||
|
||||
peerConnectionClient.sendDataChannelMessage(data: messageData, description: "connected", isCritical: true)
|
||||
|
||||
handleConnectedCall(currentCallData)
|
||||
}
|
||||
|
@ -1124,8 +1137,22 @@ private class SignalCallData: NSObject {
|
|||
ensureAudioState(call: call, peerConnectionClient: peerConnectionClient)
|
||||
|
||||
// If the call is connected, we can send the hangup via the data channel for faster hangup.
|
||||
let message = DataChannelMessage.forHangup(callId: call.signalingId)
|
||||
peerConnectionClient.sendDataChannelMessage(data: message.asData(), description: "hangup", isCritical: true)
|
||||
|
||||
var messageData: Data
|
||||
do {
|
||||
let hangupBuilder = WebRTCProtoHangup.WebRTCProtoHangupBuilder()
|
||||
hangupBuilder.setId(call.signalingId)
|
||||
let hangupProto = try hangupBuilder.build()
|
||||
|
||||
let dataBuilder = WebRTCProtoData.WebRTCProtoDataBuilder()
|
||||
dataBuilder.setHangup(hangupProto)
|
||||
messageData = try dataBuilder.buildSerializedData()
|
||||
} catch {
|
||||
handleFailedCall(failedCall: call, error: CallError.assertionError(description: "\(self.logTag) couldn't build proto in \(#function)"))
|
||||
return
|
||||
}
|
||||
|
||||
peerConnectionClient.sendDataChannelMessage(data: messageData, description: "hangup", isCritical: true)
|
||||
} else {
|
||||
Logger.info("\(self.logTag) ending call before peer connection created. Device offline or quick hangup.")
|
||||
}
|
||||
|
@ -1289,7 +1316,7 @@ private class SignalCallData: NSObject {
|
|||
*
|
||||
* Used by both Incoming and Outgoing calls.
|
||||
*/
|
||||
private func handleDataChannelMessage(_ message: OWSWebRTCProtosData) {
|
||||
private func handleDataChannelMessage(_ message: WebRTCProtoData) {
|
||||
SwiftAssertIsOnMainThread(#function)
|
||||
|
||||
guard let callData = self.callData else {
|
||||
|
@ -1301,7 +1328,7 @@ private class SignalCallData: NSObject {
|
|||
}
|
||||
let call = callData.call
|
||||
|
||||
if message.hasConnected() {
|
||||
if message.hasConnected {
|
||||
Logger.debug("\(self.logTag) remote participant sent Connected via data channel: \(call.identifiersForLogs).")
|
||||
|
||||
let connected = message.connected!
|
||||
|
@ -1317,7 +1344,7 @@ private class SignalCallData: NSObject {
|
|||
self.callUIAdapter.recipientAcceptedCall(call)
|
||||
handleConnectedCall(callData)
|
||||
|
||||
} else if message.hasHangup() {
|
||||
} else if message.hasHangup {
|
||||
Logger.debug("\(self.logTag) remote participant sent Hangup via data channel: \(call.identifiersForLogs).")
|
||||
|
||||
let hangup = message.hangup!
|
||||
|
@ -1331,10 +1358,15 @@ private class SignalCallData: NSObject {
|
|||
}
|
||||
|
||||
handleRemoteHangup(thread: call.thread, callId: hangup.id)
|
||||
} else if message.hasVideoStreamingStatus() {
|
||||
} else if message.hasVideoStreamingStatus {
|
||||
Logger.debug("\(self.logTag) remote participant sent VideoStreamingStatus via data channel: \(call.identifiersForLogs).")
|
||||
|
||||
callData.isRemoteVideoEnabled = message.videoStreamingStatus.enabled()
|
||||
guard let videoStreamingStatus = message.videoStreamingStatus else {
|
||||
owsFail("\(logTag) missing videoStreamingStatus")
|
||||
return
|
||||
}
|
||||
|
||||
callData.isRemoteVideoEnabled = videoStreamingStatus.enabled
|
||||
self.fireDidUpdateVideoTracks()
|
||||
} else {
|
||||
Logger.info("\(self.logTag) received unknown or empty DataChannelMessage: \(call.identifiersForLogs).")
|
||||
|
@ -1402,7 +1434,7 @@ private class SignalCallData: NSObject {
|
|||
/**
|
||||
* Once the peerconnection is established, we can receive messages via the data channel, and notify the delegate.
|
||||
*/
|
||||
internal func peerConnectionClient(_ peerConnectionClient: PeerConnectionClient, received dataChannelMessage: OWSWebRTCProtosData) {
|
||||
internal func peerConnectionClient(_ peerConnectionClient: PeerConnectionClient, received dataChannelMessage: WebRTCProtoData) {
|
||||
SwiftAssertIsOnMainThread(#function)
|
||||
|
||||
guard peerConnectionClient == self.peerConnectionClient else {
|
||||
|
@ -1613,8 +1645,22 @@ private class SignalCallData: NSObject {
|
|||
|
||||
self.peerConnectionClient?.setLocalVideoEnabled(enabled: shouldHaveLocalVideoTrack)
|
||||
|
||||
let message = DataChannelMessage.forVideoStreamingStatus(callId: call.signalingId, enabled: shouldHaveLocalVideoTrack)
|
||||
peerConnectionClient.sendDataChannelMessage(data: message.asData(), description: "videoStreamingStatus", isCritical: false)
|
||||
var messageData: Data
|
||||
do {
|
||||
let videoStreamingStatusBuilder = WebRTCProtoVideoStreamingStatus.WebRTCProtoVideoStreamingStatusBuilder()
|
||||
videoStreamingStatusBuilder.setId(call.signalingId)
|
||||
videoStreamingStatusBuilder.setEnabled(shouldHaveLocalVideoTrack)
|
||||
let videoStreamingStatusProto = try videoStreamingStatusBuilder.build()
|
||||
|
||||
let dataBuilder = WebRTCProtoData.WebRTCProtoDataBuilder()
|
||||
dataBuilder.setVideoStreamingStatus(videoStreamingStatusProto)
|
||||
messageData = try dataBuilder.buildSerializedData()
|
||||
} catch {
|
||||
Logger.error("\(self.logTag) couldn't build proto in \(#function)")
|
||||
return
|
||||
}
|
||||
|
||||
peerConnectionClient.sendDataChannelMessage(data: messageData, description: "videoStreamingStatus", isCritical: false)
|
||||
}
|
||||
|
||||
// MARK: - Observers
|
||||
|
|
|
@ -1,113 +0,0 @@
|
|||
// Created by Michael Kirk on 12/8/16.
|
||||
// Copyright © 2016 Open Whisper Systems. All rights reserved.
|
||||
|
||||
import Foundation
|
||||
|
||||
class DataChannelMessage {
|
||||
|
||||
private let connected: Connected?
|
||||
private let hangup: Hangup?
|
||||
private let videoStreamingStatus: VideoStreamingStatus?
|
||||
|
||||
private class Connected {
|
||||
let callId: UInt64
|
||||
|
||||
init(callId: UInt64) {
|
||||
self.callId = callId
|
||||
}
|
||||
|
||||
func asProtobuf() -> OWSWebRTCProtosConnected {
|
||||
let builder = OWSWebRTCProtosConnectedBuilder()
|
||||
builder.setId(callId)
|
||||
return builder.build()
|
||||
}
|
||||
}
|
||||
|
||||
private class Hangup {
|
||||
let callId: UInt64
|
||||
|
||||
init(callId: UInt64) {
|
||||
self.callId = callId
|
||||
}
|
||||
|
||||
func asProtobuf() -> OWSWebRTCProtosHangup {
|
||||
let builder = OWSWebRTCProtosHangupBuilder()
|
||||
builder.setId(callId)
|
||||
return builder.build()
|
||||
}
|
||||
}
|
||||
|
||||
private class VideoStreamingStatus {
|
||||
private let callId: UInt64
|
||||
private let enabled: Bool
|
||||
|
||||
init(callId: UInt64, enabled: Bool) {
|
||||
self.callId = callId
|
||||
self.enabled = enabled
|
||||
}
|
||||
|
||||
func asProtobuf() -> OWSWebRTCProtosVideoStreamingStatus {
|
||||
let builder = OWSWebRTCProtosVideoStreamingStatusBuilder()
|
||||
builder.setId(callId)
|
||||
builder.setEnabled(enabled)
|
||||
return builder.build()
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: Init
|
||||
|
||||
private init(connected: Connected) {
|
||||
self.connected = connected
|
||||
self.hangup = nil
|
||||
self.videoStreamingStatus = nil
|
||||
}
|
||||
|
||||
private init(hangup: Hangup) {
|
||||
self.connected = nil
|
||||
self.hangup = hangup
|
||||
self.videoStreamingStatus = nil
|
||||
}
|
||||
|
||||
private init(videoStreamingStatus: VideoStreamingStatus) {
|
||||
self.connected = nil
|
||||
self.hangup = nil
|
||||
self.videoStreamingStatus = videoStreamingStatus
|
||||
}
|
||||
|
||||
// MARK: Factory
|
||||
|
||||
class func forConnected(callId: UInt64) -> DataChannelMessage {
|
||||
return DataChannelMessage(connected:Connected(callId: callId))
|
||||
}
|
||||
|
||||
class func forHangup(callId: UInt64) -> DataChannelMessage {
|
||||
return DataChannelMessage(hangup: Hangup(callId: callId))
|
||||
}
|
||||
|
||||
class func forVideoStreamingStatus(callId: UInt64, enabled: Bool) -> DataChannelMessage {
|
||||
return DataChannelMessage(videoStreamingStatus: VideoStreamingStatus(callId: callId, enabled: enabled))
|
||||
}
|
||||
|
||||
// MARK: Serialization
|
||||
|
||||
func asProtobuf() -> PBGeneratedMessage {
|
||||
let builder = OWSWebRTCProtosDataBuilder()
|
||||
if connected != nil {
|
||||
builder.setConnected(connected!.asProtobuf())
|
||||
}
|
||||
|
||||
if hangup != nil {
|
||||
builder.setHangup(hangup!.asProtobuf())
|
||||
}
|
||||
|
||||
if videoStreamingStatus != nil {
|
||||
builder.setVideoStreamingStatus(videoStreamingStatus!.asProtobuf())
|
||||
}
|
||||
|
||||
return builder.build()
|
||||
}
|
||||
|
||||
func asData() -> Data {
|
||||
return self.asProtobuf().data()
|
||||
}
|
||||
}
|
|
@ -1,305 +0,0 @@
|
|||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
|
||||
#import <ProtocolBuffers/ProtocolBuffers.h>
|
||||
|
||||
// @@protoc_insertion_point(imports)
|
||||
|
||||
@class OWSWebRTCProtosConnected;
|
||||
@class OWSWebRTCProtosConnectedBuilder;
|
||||
@class OWSWebRTCProtosData;
|
||||
@class OWSWebRTCProtosDataBuilder;
|
||||
@class OWSWebRTCProtosHangup;
|
||||
@class OWSWebRTCProtosHangupBuilder;
|
||||
@class OWSWebRTCProtosVideoStreamingStatus;
|
||||
@class OWSWebRTCProtosVideoStreamingStatusBuilder;
|
||||
@class ObjectiveCFileOptions;
|
||||
@class ObjectiveCFileOptionsBuilder;
|
||||
@class PBDescriptorProto;
|
||||
@class PBDescriptorProtoBuilder;
|
||||
@class PBDescriptorProtoExtensionRange;
|
||||
@class PBDescriptorProtoExtensionRangeBuilder;
|
||||
@class PBEnumDescriptorProto;
|
||||
@class PBEnumDescriptorProtoBuilder;
|
||||
@class PBEnumOptions;
|
||||
@class PBEnumOptionsBuilder;
|
||||
@class PBEnumValueDescriptorProto;
|
||||
@class PBEnumValueDescriptorProtoBuilder;
|
||||
@class PBEnumValueOptions;
|
||||
@class PBEnumValueOptionsBuilder;
|
||||
@class PBFieldDescriptorProto;
|
||||
@class PBFieldDescriptorProtoBuilder;
|
||||
@class PBFieldOptions;
|
||||
@class PBFieldOptionsBuilder;
|
||||
@class PBFileDescriptorProto;
|
||||
@class PBFileDescriptorProtoBuilder;
|
||||
@class PBFileDescriptorSet;
|
||||
@class PBFileDescriptorSetBuilder;
|
||||
@class PBFileOptions;
|
||||
@class PBFileOptionsBuilder;
|
||||
@class PBMessageOptions;
|
||||
@class PBMessageOptionsBuilder;
|
||||
@class PBMethodDescriptorProto;
|
||||
@class PBMethodDescriptorProtoBuilder;
|
||||
@class PBMethodOptions;
|
||||
@class PBMethodOptionsBuilder;
|
||||
@class PBOneofDescriptorProto;
|
||||
@class PBOneofDescriptorProtoBuilder;
|
||||
@class PBServiceDescriptorProto;
|
||||
@class PBServiceDescriptorProtoBuilder;
|
||||
@class PBServiceOptions;
|
||||
@class PBServiceOptionsBuilder;
|
||||
@class PBSourceCodeInfo;
|
||||
@class PBSourceCodeInfoBuilder;
|
||||
@class PBSourceCodeInfoLocation;
|
||||
@class PBSourceCodeInfoLocationBuilder;
|
||||
@class PBUninterpretedOption;
|
||||
@class PBUninterpretedOptionBuilder;
|
||||
@class PBUninterpretedOptionNamePart;
|
||||
@class PBUninterpretedOptionNamePartBuilder;
|
||||
|
||||
|
||||
|
||||
@interface OWSWebRTCProtosOwswebRtcdataProtosRoot : NSObject {
|
||||
}
|
||||
+ (PBExtensionRegistry*) extensionRegistry;
|
||||
+ (void) registerAllExtensions:(PBMutableExtensionRegistry*) registry;
|
||||
@end
|
||||
|
||||
#define Connected_id @"id"
|
||||
@interface OWSWebRTCProtosConnected : PBGeneratedMessage<GeneratedMessageProtocol> {
|
||||
@private
|
||||
BOOL hasId_:1;
|
||||
UInt64 id;
|
||||
}
|
||||
- (BOOL) hasId;
|
||||
@property (readonly) UInt64 id;
|
||||
|
||||
+ (instancetype) defaultInstance;
|
||||
- (instancetype) defaultInstance;
|
||||
|
||||
- (BOOL) isInitialized;
|
||||
- (void) writeToCodedOutputStream:(PBCodedOutputStream*) output;
|
||||
- (OWSWebRTCProtosConnectedBuilder*) builder;
|
||||
+ (OWSWebRTCProtosConnectedBuilder*) builder;
|
||||
+ (OWSWebRTCProtosConnectedBuilder*) builderWithPrototype:(OWSWebRTCProtosConnected*) prototype;
|
||||
- (OWSWebRTCProtosConnectedBuilder*) toBuilder;
|
||||
|
||||
+ (OWSWebRTCProtosConnected*) parseFromData:(NSData*) data;
|
||||
+ (OWSWebRTCProtosConnected*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
|
||||
+ (OWSWebRTCProtosConnected*) parseFromInputStream:(NSInputStream*) input;
|
||||
+ (OWSWebRTCProtosConnected*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
|
||||
+ (OWSWebRTCProtosConnected*) parseFromCodedInputStream:(PBCodedInputStream*) input;
|
||||
+ (OWSWebRTCProtosConnected*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
|
||||
@end
|
||||
|
||||
@interface OWSWebRTCProtosConnectedBuilder : PBGeneratedMessageBuilder {
|
||||
@private
|
||||
OWSWebRTCProtosConnected* resultConnected;
|
||||
}
|
||||
|
||||
- (OWSWebRTCProtosConnected*) defaultInstance;
|
||||
|
||||
- (OWSWebRTCProtosConnectedBuilder*) clear;
|
||||
- (OWSWebRTCProtosConnectedBuilder*) clone;
|
||||
|
||||
- (OWSWebRTCProtosConnected*) build;
|
||||
- (OWSWebRTCProtosConnected*) buildPartial;
|
||||
|
||||
- (OWSWebRTCProtosConnectedBuilder*) mergeFrom:(OWSWebRTCProtosConnected*) other;
|
||||
- (OWSWebRTCProtosConnectedBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input;
|
||||
- (OWSWebRTCProtosConnectedBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
|
||||
|
||||
- (BOOL) hasId;
|
||||
- (UInt64) id;
|
||||
- (OWSWebRTCProtosConnectedBuilder*) setId:(UInt64) value;
|
||||
- (OWSWebRTCProtosConnectedBuilder*) clearId;
|
||||
@end
|
||||
|
||||
#define Hangup_id @"id"
|
||||
@interface OWSWebRTCProtosHangup : PBGeneratedMessage<GeneratedMessageProtocol> {
|
||||
@private
|
||||
BOOL hasId_:1;
|
||||
UInt64 id;
|
||||
}
|
||||
- (BOOL) hasId;
|
||||
@property (readonly) UInt64 id;
|
||||
|
||||
+ (instancetype) defaultInstance;
|
||||
- (instancetype) defaultInstance;
|
||||
|
||||
- (BOOL) isInitialized;
|
||||
- (void) writeToCodedOutputStream:(PBCodedOutputStream*) output;
|
||||
- (OWSWebRTCProtosHangupBuilder*) builder;
|
||||
+ (OWSWebRTCProtosHangupBuilder*) builder;
|
||||
+ (OWSWebRTCProtosHangupBuilder*) builderWithPrototype:(OWSWebRTCProtosHangup*) prototype;
|
||||
- (OWSWebRTCProtosHangupBuilder*) toBuilder;
|
||||
|
||||
+ (OWSWebRTCProtosHangup*) parseFromData:(NSData*) data;
|
||||
+ (OWSWebRTCProtosHangup*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
|
||||
+ (OWSWebRTCProtosHangup*) parseFromInputStream:(NSInputStream*) input;
|
||||
+ (OWSWebRTCProtosHangup*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
|
||||
+ (OWSWebRTCProtosHangup*) parseFromCodedInputStream:(PBCodedInputStream*) input;
|
||||
+ (OWSWebRTCProtosHangup*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
|
||||
@end
|
||||
|
||||
@interface OWSWebRTCProtosHangupBuilder : PBGeneratedMessageBuilder {
|
||||
@private
|
||||
OWSWebRTCProtosHangup* resultHangup;
|
||||
}
|
||||
|
||||
- (OWSWebRTCProtosHangup*) defaultInstance;
|
||||
|
||||
- (OWSWebRTCProtosHangupBuilder*) clear;
|
||||
- (OWSWebRTCProtosHangupBuilder*) clone;
|
||||
|
||||
- (OWSWebRTCProtosHangup*) build;
|
||||
- (OWSWebRTCProtosHangup*) buildPartial;
|
||||
|
||||
- (OWSWebRTCProtosHangupBuilder*) mergeFrom:(OWSWebRTCProtosHangup*) other;
|
||||
- (OWSWebRTCProtosHangupBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input;
|
||||
- (OWSWebRTCProtosHangupBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
|
||||
|
||||
- (BOOL) hasId;
|
||||
- (UInt64) id;
|
||||
- (OWSWebRTCProtosHangupBuilder*) setId:(UInt64) value;
|
||||
- (OWSWebRTCProtosHangupBuilder*) clearId;
|
||||
@end
|
||||
|
||||
#define VideoStreamingStatus_id @"id"
|
||||
#define VideoStreamingStatus_enabled @"enabled"
|
||||
@interface OWSWebRTCProtosVideoStreamingStatus : PBGeneratedMessage<GeneratedMessageProtocol> {
|
||||
@private
|
||||
BOOL hasEnabled_:1;
|
||||
BOOL hasId_:1;
|
||||
BOOL enabled_:1;
|
||||
UInt64 id;
|
||||
}
|
||||
- (BOOL) hasId;
|
||||
- (BOOL) hasEnabled;
|
||||
@property (readonly) UInt64 id;
|
||||
- (BOOL) enabled;
|
||||
|
||||
+ (instancetype) defaultInstance;
|
||||
- (instancetype) defaultInstance;
|
||||
|
||||
- (BOOL) isInitialized;
|
||||
- (void) writeToCodedOutputStream:(PBCodedOutputStream*) output;
|
||||
- (OWSWebRTCProtosVideoStreamingStatusBuilder*) builder;
|
||||
+ (OWSWebRTCProtosVideoStreamingStatusBuilder*) builder;
|
||||
+ (OWSWebRTCProtosVideoStreamingStatusBuilder*) builderWithPrototype:(OWSWebRTCProtosVideoStreamingStatus*) prototype;
|
||||
- (OWSWebRTCProtosVideoStreamingStatusBuilder*) toBuilder;
|
||||
|
||||
+ (OWSWebRTCProtosVideoStreamingStatus*) parseFromData:(NSData*) data;
|
||||
+ (OWSWebRTCProtosVideoStreamingStatus*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
|
||||
+ (OWSWebRTCProtosVideoStreamingStatus*) parseFromInputStream:(NSInputStream*) input;
|
||||
+ (OWSWebRTCProtosVideoStreamingStatus*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
|
||||
+ (OWSWebRTCProtosVideoStreamingStatus*) parseFromCodedInputStream:(PBCodedInputStream*) input;
|
||||
+ (OWSWebRTCProtosVideoStreamingStatus*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
|
||||
@end
|
||||
|
||||
@interface OWSWebRTCProtosVideoStreamingStatusBuilder : PBGeneratedMessageBuilder {
|
||||
@private
|
||||
OWSWebRTCProtosVideoStreamingStatus* resultVideoStreamingStatus;
|
||||
}
|
||||
|
||||
- (OWSWebRTCProtosVideoStreamingStatus*) defaultInstance;
|
||||
|
||||
- (OWSWebRTCProtosVideoStreamingStatusBuilder*) clear;
|
||||
- (OWSWebRTCProtosVideoStreamingStatusBuilder*) clone;
|
||||
|
||||
- (OWSWebRTCProtosVideoStreamingStatus*) build;
|
||||
- (OWSWebRTCProtosVideoStreamingStatus*) buildPartial;
|
||||
|
||||
- (OWSWebRTCProtosVideoStreamingStatusBuilder*) mergeFrom:(OWSWebRTCProtosVideoStreamingStatus*) other;
|
||||
- (OWSWebRTCProtosVideoStreamingStatusBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input;
|
||||
- (OWSWebRTCProtosVideoStreamingStatusBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
|
||||
|
||||
- (BOOL) hasId;
|
||||
- (UInt64) id;
|
||||
- (OWSWebRTCProtosVideoStreamingStatusBuilder*) setId:(UInt64) value;
|
||||
- (OWSWebRTCProtosVideoStreamingStatusBuilder*) clearId;
|
||||
|
||||
- (BOOL) hasEnabled;
|
||||
- (BOOL) enabled;
|
||||
- (OWSWebRTCProtosVideoStreamingStatusBuilder*) setEnabled:(BOOL) value;
|
||||
- (OWSWebRTCProtosVideoStreamingStatusBuilder*) clearEnabled;
|
||||
@end
|
||||
|
||||
#define Data_connected @"connected"
|
||||
#define Data_hangup @"hangup"
|
||||
#define Data_videoStreamingStatus @"videoStreamingStatus"
|
||||
@interface OWSWebRTCProtosData : PBGeneratedMessage<GeneratedMessageProtocol> {
|
||||
@private
|
||||
BOOL hasConnected_:1;
|
||||
BOOL hasHangup_:1;
|
||||
BOOL hasVideoStreamingStatus_:1;
|
||||
OWSWebRTCProtosConnected* connected;
|
||||
OWSWebRTCProtosHangup* hangup;
|
||||
OWSWebRTCProtosVideoStreamingStatus* videoStreamingStatus;
|
||||
}
|
||||
- (BOOL) hasConnected;
|
||||
- (BOOL) hasHangup;
|
||||
- (BOOL) hasVideoStreamingStatus;
|
||||
@property (readonly, strong) OWSWebRTCProtosConnected* connected;
|
||||
@property (readonly, strong) OWSWebRTCProtosHangup* hangup;
|
||||
@property (readonly, strong) OWSWebRTCProtosVideoStreamingStatus* videoStreamingStatus;
|
||||
|
||||
+ (instancetype) defaultInstance;
|
||||
- (instancetype) defaultInstance;
|
||||
|
||||
- (BOOL) isInitialized;
|
||||
- (void) writeToCodedOutputStream:(PBCodedOutputStream*) output;
|
||||
- (OWSWebRTCProtosDataBuilder*) builder;
|
||||
+ (OWSWebRTCProtosDataBuilder*) builder;
|
||||
+ (OWSWebRTCProtosDataBuilder*) builderWithPrototype:(OWSWebRTCProtosData*) prototype;
|
||||
- (OWSWebRTCProtosDataBuilder*) toBuilder;
|
||||
|
||||
+ (OWSWebRTCProtosData*) parseFromData:(NSData*) data;
|
||||
+ (OWSWebRTCProtosData*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
|
||||
+ (OWSWebRTCProtosData*) parseFromInputStream:(NSInputStream*) input;
|
||||
+ (OWSWebRTCProtosData*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
|
||||
+ (OWSWebRTCProtosData*) parseFromCodedInputStream:(PBCodedInputStream*) input;
|
||||
+ (OWSWebRTCProtosData*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
|
||||
@end
|
||||
|
||||
@interface OWSWebRTCProtosDataBuilder : PBGeneratedMessageBuilder {
|
||||
@private
|
||||
OWSWebRTCProtosData* resultData;
|
||||
}
|
||||
|
||||
- (OWSWebRTCProtosData*) defaultInstance;
|
||||
|
||||
- (OWSWebRTCProtosDataBuilder*) clear;
|
||||
- (OWSWebRTCProtosDataBuilder*) clone;
|
||||
|
||||
- (OWSWebRTCProtosData*) build;
|
||||
- (OWSWebRTCProtosData*) buildPartial;
|
||||
|
||||
- (OWSWebRTCProtosDataBuilder*) mergeFrom:(OWSWebRTCProtosData*) other;
|
||||
- (OWSWebRTCProtosDataBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input;
|
||||
- (OWSWebRTCProtosDataBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
|
||||
|
||||
- (BOOL) hasConnected;
|
||||
- (OWSWebRTCProtosConnected*) connected;
|
||||
- (OWSWebRTCProtosDataBuilder*) setConnected:(OWSWebRTCProtosConnected*) value;
|
||||
- (OWSWebRTCProtosDataBuilder*) setConnectedBuilder:(OWSWebRTCProtosConnectedBuilder*) builderForValue;
|
||||
- (OWSWebRTCProtosDataBuilder*) mergeConnected:(OWSWebRTCProtosConnected*) value;
|
||||
- (OWSWebRTCProtosDataBuilder*) clearConnected;
|
||||
|
||||
- (BOOL) hasHangup;
|
||||
- (OWSWebRTCProtosHangup*) hangup;
|
||||
- (OWSWebRTCProtosDataBuilder*) setHangup:(OWSWebRTCProtosHangup*) value;
|
||||
- (OWSWebRTCProtosDataBuilder*) setHangupBuilder:(OWSWebRTCProtosHangupBuilder*) builderForValue;
|
||||
- (OWSWebRTCProtosDataBuilder*) mergeHangup:(OWSWebRTCProtosHangup*) value;
|
||||
- (OWSWebRTCProtosDataBuilder*) clearHangup;
|
||||
|
||||
- (BOOL) hasVideoStreamingStatus;
|
||||
- (OWSWebRTCProtosVideoStreamingStatus*) videoStreamingStatus;
|
||||
- (OWSWebRTCProtosDataBuilder*) setVideoStreamingStatus:(OWSWebRTCProtosVideoStreamingStatus*) value;
|
||||
- (OWSWebRTCProtosDataBuilder*) setVideoStreamingStatusBuilder:(OWSWebRTCProtosVideoStreamingStatusBuilder*) builderForValue;
|
||||
- (OWSWebRTCProtosDataBuilder*) mergeVideoStreamingStatus:(OWSWebRTCProtosVideoStreamingStatus*) value;
|
||||
- (OWSWebRTCProtosDataBuilder*) clearVideoStreamingStatus;
|
||||
@end
|
||||
|
||||
|
||||
// @@protoc_insertion_point(global_scope)
|
File diff suppressed because it is too large
Load Diff
|
@ -53,7 +53,7 @@ protocol PeerConnectionClientDelegate: class {
|
|||
/**
|
||||
* Once the peerconnection is established, we can receive messages via the data channel, and notify the delegate.
|
||||
*/
|
||||
func peerConnectionClient(_ peerconnectionClient: PeerConnectionClient, received dataChannelMessage: OWSWebRTCProtosData)
|
||||
func peerConnectionClient(_ peerconnectionClient: PeerConnectionClient, received dataChannelMessage: WebRTCProtoData)
|
||||
|
||||
/**
|
||||
* Fired whenever the local video track become active or inactive.
|
||||
|
@ -828,7 +828,7 @@ class PeerConnectionClient: NSObject, RTCPeerConnectionDelegate, RTCDataChannelD
|
|||
/** The data channel successfully received a data buffer. */
|
||||
internal func dataChannel(_ dataChannel: RTCDataChannel, didReceiveMessageWith buffer: RTCDataBuffer) {
|
||||
let proxyCopy = self.proxy
|
||||
let completion: (OWSWebRTCProtosData) -> Void = { (dataChannelMessage) in
|
||||
let completion: (WebRTCProtoData) -> Void = { (dataChannelMessage) in
|
||||
SwiftAssertIsOnMainThread(#function)
|
||||
guard let strongSelf = proxyCopy.get() else { return }
|
||||
guard let strongDelegate = strongSelf.delegate else { return }
|
||||
|
@ -843,8 +843,10 @@ class PeerConnectionClient: NSObject, RTCPeerConnectionDelegate, RTCDataChannelD
|
|||
}
|
||||
Logger.debug("\(strongSelf.logTag) dataChannel didReceiveMessageWith buffer:\(buffer)")
|
||||
|
||||
guard let dataChannelMessage = OWSWebRTCProtosData.parse(from: buffer.data) else {
|
||||
// TODO can't proto parsings throw an exception? Is it just being lost in the Objc->Swift?
|
||||
var dataChannelMessage: WebRTCProtoData
|
||||
do {
|
||||
dataChannelMessage = try WebRTCProtoData.parseData(buffer.data)
|
||||
} catch {
|
||||
Logger.error("\(strongSelf.logTag) failed to parse dataProto")
|
||||
return
|
||||
}
|
||||
|
@ -1232,7 +1234,7 @@ class VideoCaptureController {
|
|||
}
|
||||
}
|
||||
|
||||
// Mark: Pretty Print Objc enums.
|
||||
// MARK: Pretty Print Objc enums.
|
||||
|
||||
fileprivate extension RTCSignalingState {
|
||||
var debugDescription: String {
|
||||
|
|
|
@ -17,7 +17,7 @@ class FakePeerConnectionClientDelegate: PeerConnectionClientDelegate {
|
|||
|
||||
var connectionState: ConnectionState?
|
||||
var localIceCandidates = [RTCIceCandidate]()
|
||||
var dataChannelMessages = [OWSWebRTCProtosData]()
|
||||
var dataChannelMessages = [WebRTCProtoData]()
|
||||
|
||||
func peerConnectionClientIceConnected(_ peerconnectionClient: PeerConnectionClient) {
|
||||
connectionState = .connected
|
||||
|
@ -35,7 +35,7 @@ class FakePeerConnectionClientDelegate: PeerConnectionClientDelegate {
|
|||
localIceCandidates.append(iceCandidate)
|
||||
}
|
||||
|
||||
func peerConnectionClient(_ peerconnectionClient: PeerConnectionClient, received dataChannelMessage: OWSWebRTCProtosData) {
|
||||
func peerConnectionClient(_ peerconnectionClient: PeerConnectionClient, received dataChannelMessage: WebRTCProtoData) {
|
||||
dataChannelMessages.append(dataChannelMessage)
|
||||
}
|
||||
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
# Assumes you've installed protobuf-objc
|
||||
# see: https://github.com/alexeyxo/protobuf-objc
|
||||
|
||||
PROTOC=protoc \
|
||||
--plugin=/usr/local/bin/proto-gen-objc \
|
||||
--proto_path="${HOME}/src/Signal/protobuf-objc/src/compiler/" \
|
||||
--proto_path="${HOME}/src/Signal/protobuf-objc/src/compiler/google/protobuf/" \
|
||||
--proto_path='./'
|
||||
WRAPPER_SCRIPT=../Scripts/ProtoWrappers.py \
|
||||
--proto-dir='./' --verbose
|
||||
|
||||
all: webrtc_data_proto
|
||||
|
||||
webrtc_data_proto: OWSWebRTCDataProtos.proto
|
||||
$(PROTOC) --objc_out=../Signal/src/call/ \
|
||||
OWSWebRTCDataProtos.proto
|
||||
# webrtc_data_proto: OWSWebRTCDataProtos.proto
|
||||
# $(PROTOC) --objc_out=../Signal/src/call/ \
|
||||
# OWSWebRTCDataProtos.proto
|
||||
|
||||
webrtc_data_proto: OWSWebRTCDataProtos.proto
|
||||
$(PROTOC) --swift_out=../Signal/src/Generated \
|
||||
OWSWebRTCDataProtos.proto
|
||||
$(WRAPPER_SCRIPT) --dst-dir=../Signal/src/Generated \
|
||||
--wrapper-prefix=WebRTCProto --proto-prefix=WebRTCProtos --proto-file=OWSWebRTCDataProtos.proto
|
||||
|
|
|
@ -4,36 +4,34 @@
|
|||
* Licensed according to the LICENSE file in this repository.
|
||||
*/
|
||||
|
||||
package signal;
|
||||
// iOS - since we use a modern proto-compiler, we must specify
|
||||
// the legacy proto format.
|
||||
syntax = "proto2";
|
||||
|
||||
// iOS - package name determines class prefix
|
||||
package WebRTCProtos;
|
||||
|
||||
option java_package = "org.thoughtcrime.securesms.webrtc";
|
||||
option java_outer_classname = "WebRtcDataProtos";
|
||||
|
||||
// These options require the objc protobuf tools and may need to be commented
|
||||
// out if using them for a different platform.
|
||||
import "objectivec-descriptor.proto";
|
||||
option (google.protobuf.objectivec_file_options).class_prefix = "OWSWebRTCProtos";
|
||||
|
||||
message Connected
|
||||
{
|
||||
optional uint64 id = 1;
|
||||
message Connected {
|
||||
// @required
|
||||
optional uint64 id = 1;
|
||||
}
|
||||
|
||||
message Hangup
|
||||
{
|
||||
optional uint64 id = 1;
|
||||
message Hangup {
|
||||
// @required
|
||||
optional uint64 id = 1;
|
||||
}
|
||||
|
||||
message VideoStreamingStatus
|
||||
{
|
||||
optional uint64 id = 1;
|
||||
optional bool enabled = 2;
|
||||
message VideoStreamingStatus {
|
||||
// @required
|
||||
optional uint64 id = 1;
|
||||
optional bool enabled = 2;
|
||||
}
|
||||
|
||||
message Data
|
||||
{
|
||||
|
||||
optional Connected connected = 1;
|
||||
optional Hangup hangup = 2;
|
||||
optional VideoStreamingStatus videoStreamingStatus = 3;
|
||||
message Data {
|
||||
optional Connected connected = 1;
|
||||
optional Hangup hangup = 2;
|
||||
optional VideoStreamingStatus videoStreamingStatus = 3;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue