diff --git a/Signal.xcodeproj/project.pbxproj b/Signal.xcodeproj/project.pbxproj index 247f5be56..92310bb8b 100644 --- a/Signal.xcodeproj/project.pbxproj +++ b/Signal.xcodeproj/project.pbxproj @@ -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 = ""; }; 34C42D641F4734ED0072EC04 /* TSUnreadIndicatorInteraction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TSUnreadIndicatorInteraction.h; sourceTree = ""; }; 34C42D651F4734ED0072EC04 /* TSUnreadIndicatorInteraction.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TSUnreadIndicatorInteraction.m; sourceTree = ""; }; + 34C4E2552118957600BEA353 /* OWSWebRTCDataProtos.pb.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OWSWebRTCDataProtos.pb.swift; sourceTree = ""; }; + 34C4E2562118957600BEA353 /* WebRTCProto.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WebRTCProto.swift; sourceTree = ""; }; 34C6B0A51FA0E46F00D35993 /* test-gif.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = "test-gif.gif"; sourceTree = ""; }; 34C6B0A71FA0E46F00D35993 /* test-mp3.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = "test-mp3.mp3"; sourceTree = ""; }; 34C6B0A81FA0E46F00D35993 /* test-mp4.mp4 */ = {isa = PBXFileReference; lastKnownFileType = file; path = "test-mp4.mp4"; sourceTree = ""; }; @@ -1000,7 +1002,6 @@ 4541B71A209D2DAE0008608F /* ContactShareViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContactShareViewModel.swift; sourceTree = ""; }; 4542DF51208B82E9007B4E76 /* ThreadViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThreadViewModel.swift; sourceTree = ""; }; 4542DF53208D40AC007B4E76 /* LoadingViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoadingViewController.swift; sourceTree = ""; }; - 45464DBB1DFA041F001D3FD6 /* DataChannelMessage.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DataChannelMessage.swift; sourceTree = ""; }; 454A84032059C787008B8C75 /* MediaTileViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MediaTileViewController.swift; sourceTree = ""; }; 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 = ""; }; @@ -1032,8 +1033,6 @@ 4589670F1DC117CC00E9DD21 /* SignalTests-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SignalTests-Bridging-Header.h"; sourceTree = ""; }; 458967101DC117CC00E9DD21 /* AccountManagerTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = AccountManagerTest.swift; path = Models/AccountManagerTest.swift; sourceTree = ""; }; 458DE9D51DEE3FD00071BB03 /* PeerConnectionClient.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PeerConnectionClient.swift; sourceTree = ""; }; - 458DE9D71DEE7B360071BB03 /* OWSWebRTCDataProtos.pb.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OWSWebRTCDataProtos.pb.h; sourceTree = ""; }; - 458DE9D81DEE7B360071BB03 /* OWSWebRTCDataProtos.pb.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OWSWebRTCDataProtos.pb.m; sourceTree = ""; }; 458E38351D668EBF0094BD24 /* OWSDeviceProvisioningURLParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OWSDeviceProvisioningURLParser.h; sourceTree = ""; }; 458E38361D668EBF0094BD24 /* OWSDeviceProvisioningURLParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OWSDeviceProvisioningURLParser.m; sourceTree = ""; }; 458E38391D6699FA0094BD24 /* OWSDeviceProvisioningURLParserTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OWSDeviceProvisioningURLParserTest.m; path = Models/OWSDeviceProvisioningURLParserTest.m; sourceTree = ""; }; @@ -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 = ""; + }; 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 = ""; @@ -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 */, diff --git a/Signal/SignalUBSan.supp b/Signal/SignalUBSan.supp index dd9c27f84..24a5e07fa 100644 --- a/Signal/SignalUBSan.supp +++ b/Signal/SignalUBSan.supp @@ -5,7 +5,6 @@ shift-base:CodedInputStream.m # generated protos bool:WhisperTextProtocol.pb.m -bool:OWSWebRTCDataProtos.pb.m # YapDatabase bool:YapDatabaseAutoViewTransaction.m diff --git a/Signal/src/Generated/OWSWebRTCDataProtos.pb.swift b/Signal/src/Generated/OWSWebRTCDataProtos.pb.swift new file mode 100644 index 000000000..f550ca680 --- /dev/null +++ b/Signal/src/Generated/OWSWebRTCDataProtos.pb.swift @@ -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(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularUInt64Field(value: &self._id) + default: break + } + } + } + + func traverse(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(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularUInt64Field(value: &self._id) + default: break + } + } + } + + func traverse(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(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(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(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(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 + } +} diff --git a/Signal/src/Generated/WebRTCProto.swift b/Signal/src/Generated/WebRTCProto.swift new file mode 100644 index 000000000..84fb4a06e --- /dev/null +++ b/Signal/src/Generated/WebRTCProto.swift @@ -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 + } +} diff --git a/Signal/src/Signal-Bridging-Header.h b/Signal/src/Signal-Bridging-Header.h index 51adce28b..e4323e894 100644 --- a/Signal/src/Signal-Bridging-Header.h +++ b/Signal/src/Signal-Bridging-Header.h @@ -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" diff --git a/Signal/src/call/CallService.swift b/Signal/src/call/CallService.swift index 90ab4d0b3..cadbcc4d7 100644 --- a/Signal/src/call/CallService.swift +++ b/Signal/src/call/CallService.swift @@ -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 diff --git a/Signal/src/call/DataChannelMessage.swift b/Signal/src/call/DataChannelMessage.swift deleted file mode 100644 index 4dd1c0961..000000000 --- a/Signal/src/call/DataChannelMessage.swift +++ /dev/null @@ -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() - } -} diff --git a/Signal/src/call/OWSWebRTCDataProtos.pb.h b/Signal/src/call/OWSWebRTCDataProtos.pb.h deleted file mode 100644 index e09e560d4..000000000 --- a/Signal/src/call/OWSWebRTCDataProtos.pb.h +++ /dev/null @@ -1,305 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! - -#import - -// @@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 { -@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 { -@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 { -@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 { -@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) diff --git a/Signal/src/call/OWSWebRTCDataProtos.pb.m b/Signal/src/call/OWSWebRTCDataProtos.pb.m deleted file mode 100644 index 020a30d46..000000000 --- a/Signal/src/call/OWSWebRTCDataProtos.pb.m +++ /dev/null @@ -1,1073 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! - -#import "OWSWebRTCDataProtos.pb.h" -// @@protoc_insertion_point(imports) - -@implementation OWSWebRTCProtosOwswebRtcdataProtosRoot -static PBExtensionRegistry* extensionRegistry = nil; -+ (PBExtensionRegistry*) extensionRegistry { - return extensionRegistry; -} - -+ (void) initialize { - if (self == [OWSWebRTCProtosOwswebRtcdataProtosRoot class]) { - PBMutableExtensionRegistry* registry = [PBMutableExtensionRegistry registry]; - [self registerAllExtensions:registry]; - [ObjectivecDescriptorRoot registerAllExtensions:registry]; - extensionRegistry = registry; - } -} -+ (void) registerAllExtensions:(PBMutableExtensionRegistry*) registry { -} -@end - -@interface OWSWebRTCProtosConnected () -@property UInt64 id; -@end - -@implementation OWSWebRTCProtosConnected - -- (BOOL) hasId { - return !!hasId_; -} -- (void) setHasId:(BOOL) _value_ { - hasId_ = !!_value_; -} -@synthesize id; -- (instancetype) init { - if ((self = [super init])) { - self.id = 0L; - } - return self; -} -static OWSWebRTCProtosConnected* defaultOWSWebRTCProtosConnectedInstance = nil; -+ (void) initialize { - if (self == [OWSWebRTCProtosConnected class]) { - defaultOWSWebRTCProtosConnectedInstance = [[OWSWebRTCProtosConnected alloc] init]; - } -} -+ (instancetype) defaultInstance { - return defaultOWSWebRTCProtosConnectedInstance; -} -- (instancetype) defaultInstance { - return defaultOWSWebRTCProtosConnectedInstance; -} -- (BOOL) isInitialized { - return YES; -} -- (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { - if (self.hasId) { - [output writeUInt64:1 value:self.id]; - } - [self.unknownFields writeToCodedOutputStream:output]; -} -- (SInt32) serializedSize { - __block SInt32 size_ = memoizedSerializedSize; - if (size_ != -1) { - return size_; - } - - size_ = 0; - if (self.hasId) { - size_ += computeUInt64Size(1, self.id); - } - size_ += self.unknownFields.serializedSize; - memoizedSerializedSize = size_; - return size_; -} -+ (OWSWebRTCProtosConnected*) parseFromData:(NSData*) data { - return (OWSWebRTCProtosConnected*)[[[OWSWebRTCProtosConnected builder] mergeFromData:data] build]; -} -+ (OWSWebRTCProtosConnected*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { - return (OWSWebRTCProtosConnected*)[[[OWSWebRTCProtosConnected builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; -} -+ (OWSWebRTCProtosConnected*) parseFromInputStream:(NSInputStream*) input { - return (OWSWebRTCProtosConnected*)[[[OWSWebRTCProtosConnected builder] mergeFromInputStream:input] build]; -} -+ (OWSWebRTCProtosConnected*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { - return (OWSWebRTCProtosConnected*)[[[OWSWebRTCProtosConnected builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; -} -+ (OWSWebRTCProtosConnected*) parseFromCodedInputStream:(PBCodedInputStream*) input { - return (OWSWebRTCProtosConnected*)[[[OWSWebRTCProtosConnected builder] mergeFromCodedInputStream:input] build]; -} -+ (OWSWebRTCProtosConnected*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { - return (OWSWebRTCProtosConnected*)[[[OWSWebRTCProtosConnected builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; -} -+ (OWSWebRTCProtosConnectedBuilder*) builder { - return [[OWSWebRTCProtosConnectedBuilder alloc] init]; -} -+ (OWSWebRTCProtosConnectedBuilder*) builderWithPrototype:(OWSWebRTCProtosConnected*) prototype { - return [[OWSWebRTCProtosConnected builder] mergeFrom:prototype]; -} -- (OWSWebRTCProtosConnectedBuilder*) builder { - return [OWSWebRTCProtosConnected builder]; -} -- (OWSWebRTCProtosConnectedBuilder*) toBuilder { - return [OWSWebRTCProtosConnected builderWithPrototype:self]; -} -- (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { - if (self.hasId) { - [output appendFormat:@"%@%@: %@\n", indent, @"id", [NSNumber numberWithLongLong:self.id]]; - } - [self.unknownFields writeDescriptionTo:output withIndent:indent]; -} -- (void) storeInDictionary:(NSMutableDictionary *)dictionary { - if (self.hasId) { - [dictionary setObject: [NSNumber numberWithLongLong:self.id] forKey: @"id"]; - } - [self.unknownFields storeInDictionary:dictionary]; -} -- (BOOL) isEqual:(id)other { - if (other == self) { - return YES; - } - if (![other isKindOfClass:[OWSWebRTCProtosConnected class]]) { - return NO; - } - OWSWebRTCProtosConnected *otherMessage = other; - return - self.hasId == otherMessage.hasId && - (!self.hasId || self.id == otherMessage.id) && - (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); -} -- (NSUInteger) hash { - __block NSUInteger hashCode = 7; - if (self.hasId) { - hashCode = hashCode * 31 + [[NSNumber numberWithLongLong:self.id] hash]; - } - hashCode = hashCode * 31 + [self.unknownFields hash]; - return hashCode; -} -@end - -@interface OWSWebRTCProtosConnectedBuilder() -@property (strong) OWSWebRTCProtosConnected* resultConnected; -@end - -@implementation OWSWebRTCProtosConnectedBuilder -@synthesize resultConnected; -- (instancetype) init { - if ((self = [super init])) { - self.resultConnected = [[OWSWebRTCProtosConnected alloc] init]; - } - return self; -} -- (PBGeneratedMessage*) internalGetResult { - return resultConnected; -} -- (OWSWebRTCProtosConnectedBuilder*) clear { - self.resultConnected = [[OWSWebRTCProtosConnected alloc] init]; - return self; -} -- (OWSWebRTCProtosConnectedBuilder*) clone { - return [OWSWebRTCProtosConnected builderWithPrototype:resultConnected]; -} -- (OWSWebRTCProtosConnected*) defaultInstance { - return [OWSWebRTCProtosConnected defaultInstance]; -} -- (OWSWebRTCProtosConnected*) build { - [self checkInitialized]; - return [self buildPartial]; -} -- (OWSWebRTCProtosConnected*) buildPartial { - OWSWebRTCProtosConnected* returnMe = resultConnected; - self.resultConnected = nil; - return returnMe; -} -- (OWSWebRTCProtosConnectedBuilder*) mergeFrom:(OWSWebRTCProtosConnected*) other { - if (other == [OWSWebRTCProtosConnected defaultInstance]) { - return self; - } - if (other.hasId) { - [self setId:other.id]; - } - [self mergeUnknownFields:other.unknownFields]; - return self; -} -- (OWSWebRTCProtosConnectedBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { - return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; -} -- (OWSWebRTCProtosConnectedBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { - PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; - while (YES) { - SInt32 tag = [input readTag]; - switch (tag) { - case 0: - [self setUnknownFields:[unknownFields build]]; - return self; - default: { - if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { - [self setUnknownFields:[unknownFields build]]; - return self; - } - break; - } - case 8: { - [self setId:[input readUInt64]]; - break; - } - } - } -} -- (BOOL) hasId { - return resultConnected.hasId; -} -- (UInt64) id { - return resultConnected.id; -} -- (OWSWebRTCProtosConnectedBuilder*) setId:(UInt64) value { - resultConnected.hasId = YES; - resultConnected.id = value; - return self; -} -- (OWSWebRTCProtosConnectedBuilder*) clearId { - resultConnected.hasId = NO; - resultConnected.id = 0L; - return self; -} -@end - -@interface OWSWebRTCProtosHangup () -@property UInt64 id; -@end - -@implementation OWSWebRTCProtosHangup - -- (BOOL) hasId { - return !!hasId_; -} -- (void) setHasId:(BOOL) _value_ { - hasId_ = !!_value_; -} -@synthesize id; -- (instancetype) init { - if ((self = [super init])) { - self.id = 0L; - } - return self; -} -static OWSWebRTCProtosHangup* defaultOWSWebRTCProtosHangupInstance = nil; -+ (void) initialize { - if (self == [OWSWebRTCProtosHangup class]) { - defaultOWSWebRTCProtosHangupInstance = [[OWSWebRTCProtosHangup alloc] init]; - } -} -+ (instancetype) defaultInstance { - return defaultOWSWebRTCProtosHangupInstance; -} -- (instancetype) defaultInstance { - return defaultOWSWebRTCProtosHangupInstance; -} -- (BOOL) isInitialized { - return YES; -} -- (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { - if (self.hasId) { - [output writeUInt64:1 value:self.id]; - } - [self.unknownFields writeToCodedOutputStream:output]; -} -- (SInt32) serializedSize { - __block SInt32 size_ = memoizedSerializedSize; - if (size_ != -1) { - return size_; - } - - size_ = 0; - if (self.hasId) { - size_ += computeUInt64Size(1, self.id); - } - size_ += self.unknownFields.serializedSize; - memoizedSerializedSize = size_; - return size_; -} -+ (OWSWebRTCProtosHangup*) parseFromData:(NSData*) data { - return (OWSWebRTCProtosHangup*)[[[OWSWebRTCProtosHangup builder] mergeFromData:data] build]; -} -+ (OWSWebRTCProtosHangup*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { - return (OWSWebRTCProtosHangup*)[[[OWSWebRTCProtosHangup builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; -} -+ (OWSWebRTCProtosHangup*) parseFromInputStream:(NSInputStream*) input { - return (OWSWebRTCProtosHangup*)[[[OWSWebRTCProtosHangup builder] mergeFromInputStream:input] build]; -} -+ (OWSWebRTCProtosHangup*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { - return (OWSWebRTCProtosHangup*)[[[OWSWebRTCProtosHangup builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; -} -+ (OWSWebRTCProtosHangup*) parseFromCodedInputStream:(PBCodedInputStream*) input { - return (OWSWebRTCProtosHangup*)[[[OWSWebRTCProtosHangup builder] mergeFromCodedInputStream:input] build]; -} -+ (OWSWebRTCProtosHangup*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { - return (OWSWebRTCProtosHangup*)[[[OWSWebRTCProtosHangup builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; -} -+ (OWSWebRTCProtosHangupBuilder*) builder { - return [[OWSWebRTCProtosHangupBuilder alloc] init]; -} -+ (OWSWebRTCProtosHangupBuilder*) builderWithPrototype:(OWSWebRTCProtosHangup*) prototype { - return [[OWSWebRTCProtosHangup builder] mergeFrom:prototype]; -} -- (OWSWebRTCProtosHangupBuilder*) builder { - return [OWSWebRTCProtosHangup builder]; -} -- (OWSWebRTCProtosHangupBuilder*) toBuilder { - return [OWSWebRTCProtosHangup builderWithPrototype:self]; -} -- (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { - if (self.hasId) { - [output appendFormat:@"%@%@: %@\n", indent, @"id", [NSNumber numberWithLongLong:self.id]]; - } - [self.unknownFields writeDescriptionTo:output withIndent:indent]; -} -- (void) storeInDictionary:(NSMutableDictionary *)dictionary { - if (self.hasId) { - [dictionary setObject: [NSNumber numberWithLongLong:self.id] forKey: @"id"]; - } - [self.unknownFields storeInDictionary:dictionary]; -} -- (BOOL) isEqual:(id)other { - if (other == self) { - return YES; - } - if (![other isKindOfClass:[OWSWebRTCProtosHangup class]]) { - return NO; - } - OWSWebRTCProtosHangup *otherMessage = other; - return - self.hasId == otherMessage.hasId && - (!self.hasId || self.id == otherMessage.id) && - (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); -} -- (NSUInteger) hash { - __block NSUInteger hashCode = 7; - if (self.hasId) { - hashCode = hashCode * 31 + [[NSNumber numberWithLongLong:self.id] hash]; - } - hashCode = hashCode * 31 + [self.unknownFields hash]; - return hashCode; -} -@end - -@interface OWSWebRTCProtosHangupBuilder() -@property (strong) OWSWebRTCProtosHangup* resultHangup; -@end - -@implementation OWSWebRTCProtosHangupBuilder -@synthesize resultHangup; -- (instancetype) init { - if ((self = [super init])) { - self.resultHangup = [[OWSWebRTCProtosHangup alloc] init]; - } - return self; -} -- (PBGeneratedMessage*) internalGetResult { - return resultHangup; -} -- (OWSWebRTCProtosHangupBuilder*) clear { - self.resultHangup = [[OWSWebRTCProtosHangup alloc] init]; - return self; -} -- (OWSWebRTCProtosHangupBuilder*) clone { - return [OWSWebRTCProtosHangup builderWithPrototype:resultHangup]; -} -- (OWSWebRTCProtosHangup*) defaultInstance { - return [OWSWebRTCProtosHangup defaultInstance]; -} -- (OWSWebRTCProtosHangup*) build { - [self checkInitialized]; - return [self buildPartial]; -} -- (OWSWebRTCProtosHangup*) buildPartial { - OWSWebRTCProtosHangup* returnMe = resultHangup; - self.resultHangup = nil; - return returnMe; -} -- (OWSWebRTCProtosHangupBuilder*) mergeFrom:(OWSWebRTCProtosHangup*) other { - if (other == [OWSWebRTCProtosHangup defaultInstance]) { - return self; - } - if (other.hasId) { - [self setId:other.id]; - } - [self mergeUnknownFields:other.unknownFields]; - return self; -} -- (OWSWebRTCProtosHangupBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { - return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; -} -- (OWSWebRTCProtosHangupBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { - PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; - while (YES) { - SInt32 tag = [input readTag]; - switch (tag) { - case 0: - [self setUnknownFields:[unknownFields build]]; - return self; - default: { - if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { - [self setUnknownFields:[unknownFields build]]; - return self; - } - break; - } - case 8: { - [self setId:[input readUInt64]]; - break; - } - } - } -} -- (BOOL) hasId { - return resultHangup.hasId; -} -- (UInt64) id { - return resultHangup.id; -} -- (OWSWebRTCProtosHangupBuilder*) setId:(UInt64) value { - resultHangup.hasId = YES; - resultHangup.id = value; - return self; -} -- (OWSWebRTCProtosHangupBuilder*) clearId { - resultHangup.hasId = NO; - resultHangup.id = 0L; - return self; -} -@end - -@interface OWSWebRTCProtosVideoStreamingStatus () -@property UInt64 id; -@property BOOL enabled; -@end - -@implementation OWSWebRTCProtosVideoStreamingStatus - -- (BOOL) hasId { - return !!hasId_; -} -- (void) setHasId:(BOOL) _value_ { - hasId_ = !!_value_; -} -@synthesize id; -- (BOOL) hasEnabled { - return !!hasEnabled_; -} -- (void) setHasEnabled:(BOOL) _value_ { - hasEnabled_ = !!_value_; -} -- (BOOL) enabled { - return !!enabled_; -} -- (void) setEnabled:(BOOL) _value_ { - enabled_ = !!_value_; -} -- (instancetype) init { - if ((self = [super init])) { - self.id = 0L; - self.enabled = NO; - } - return self; -} -static OWSWebRTCProtosVideoStreamingStatus* defaultOWSWebRTCProtosVideoStreamingStatusInstance = nil; -+ (void) initialize { - if (self == [OWSWebRTCProtosVideoStreamingStatus class]) { - defaultOWSWebRTCProtosVideoStreamingStatusInstance = [[OWSWebRTCProtosVideoStreamingStatus alloc] init]; - } -} -+ (instancetype) defaultInstance { - return defaultOWSWebRTCProtosVideoStreamingStatusInstance; -} -- (instancetype) defaultInstance { - return defaultOWSWebRTCProtosVideoStreamingStatusInstance; -} -- (BOOL) isInitialized { - return YES; -} -- (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { - if (self.hasId) { - [output writeUInt64:1 value:self.id]; - } - if (self.hasEnabled) { - [output writeBool:2 value:self.enabled]; - } - [self.unknownFields writeToCodedOutputStream:output]; -} -- (SInt32) serializedSize { - __block SInt32 size_ = memoizedSerializedSize; - if (size_ != -1) { - return size_; - } - - size_ = 0; - if (self.hasId) { - size_ += computeUInt64Size(1, self.id); - } - if (self.hasEnabled) { - size_ += computeBoolSize(2, self.enabled); - } - size_ += self.unknownFields.serializedSize; - memoizedSerializedSize = size_; - return size_; -} -+ (OWSWebRTCProtosVideoStreamingStatus*) parseFromData:(NSData*) data { - return (OWSWebRTCProtosVideoStreamingStatus*)[[[OWSWebRTCProtosVideoStreamingStatus builder] mergeFromData:data] build]; -} -+ (OWSWebRTCProtosVideoStreamingStatus*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { - return (OWSWebRTCProtosVideoStreamingStatus*)[[[OWSWebRTCProtosVideoStreamingStatus builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; -} -+ (OWSWebRTCProtosVideoStreamingStatus*) parseFromInputStream:(NSInputStream*) input { - return (OWSWebRTCProtosVideoStreamingStatus*)[[[OWSWebRTCProtosVideoStreamingStatus builder] mergeFromInputStream:input] build]; -} -+ (OWSWebRTCProtosVideoStreamingStatus*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { - return (OWSWebRTCProtosVideoStreamingStatus*)[[[OWSWebRTCProtosVideoStreamingStatus builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; -} -+ (OWSWebRTCProtosVideoStreamingStatus*) parseFromCodedInputStream:(PBCodedInputStream*) input { - return (OWSWebRTCProtosVideoStreamingStatus*)[[[OWSWebRTCProtosVideoStreamingStatus builder] mergeFromCodedInputStream:input] build]; -} -+ (OWSWebRTCProtosVideoStreamingStatus*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { - return (OWSWebRTCProtosVideoStreamingStatus*)[[[OWSWebRTCProtosVideoStreamingStatus builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; -} -+ (OWSWebRTCProtosVideoStreamingStatusBuilder*) builder { - return [[OWSWebRTCProtosVideoStreamingStatusBuilder alloc] init]; -} -+ (OWSWebRTCProtosVideoStreamingStatusBuilder*) builderWithPrototype:(OWSWebRTCProtosVideoStreamingStatus*) prototype { - return [[OWSWebRTCProtosVideoStreamingStatus builder] mergeFrom:prototype]; -} -- (OWSWebRTCProtosVideoStreamingStatusBuilder*) builder { - return [OWSWebRTCProtosVideoStreamingStatus builder]; -} -- (OWSWebRTCProtosVideoStreamingStatusBuilder*) toBuilder { - return [OWSWebRTCProtosVideoStreamingStatus builderWithPrototype:self]; -} -- (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { - if (self.hasId) { - [output appendFormat:@"%@%@: %@\n", indent, @"id", [NSNumber numberWithLongLong:self.id]]; - } - if (self.hasEnabled) { - [output appendFormat:@"%@%@: %@\n", indent, @"enabled", [NSNumber numberWithBool:self.enabled]]; - } - [self.unknownFields writeDescriptionTo:output withIndent:indent]; -} -- (void) storeInDictionary:(NSMutableDictionary *)dictionary { - if (self.hasId) { - [dictionary setObject: [NSNumber numberWithLongLong:self.id] forKey: @"id"]; - } - if (self.hasEnabled) { - [dictionary setObject: [NSNumber numberWithBool:self.enabled] forKey: @"enabled"]; - } - [self.unknownFields storeInDictionary:dictionary]; -} -- (BOOL) isEqual:(id)other { - if (other == self) { - return YES; - } - if (![other isKindOfClass:[OWSWebRTCProtosVideoStreamingStatus class]]) { - return NO; - } - OWSWebRTCProtosVideoStreamingStatus *otherMessage = other; - return - self.hasId == otherMessage.hasId && - (!self.hasId || self.id == otherMessage.id) && - self.hasEnabled == otherMessage.hasEnabled && - (!self.hasEnabled || self.enabled == otherMessage.enabled) && - (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); -} -- (NSUInteger) hash { - __block NSUInteger hashCode = 7; - if (self.hasId) { - hashCode = hashCode * 31 + [[NSNumber numberWithLongLong:self.id] hash]; - } - if (self.hasEnabled) { - hashCode = hashCode * 31 + [[NSNumber numberWithBool:self.enabled] hash]; - } - hashCode = hashCode * 31 + [self.unknownFields hash]; - return hashCode; -} -@end - -@interface OWSWebRTCProtosVideoStreamingStatusBuilder() -@property (strong) OWSWebRTCProtosVideoStreamingStatus* resultVideoStreamingStatus; -@end - -@implementation OWSWebRTCProtosVideoStreamingStatusBuilder -@synthesize resultVideoStreamingStatus; -- (instancetype) init { - if ((self = [super init])) { - self.resultVideoStreamingStatus = [[OWSWebRTCProtosVideoStreamingStatus alloc] init]; - } - return self; -} -- (PBGeneratedMessage*) internalGetResult { - return resultVideoStreamingStatus; -} -- (OWSWebRTCProtosVideoStreamingStatusBuilder*) clear { - self.resultVideoStreamingStatus = [[OWSWebRTCProtosVideoStreamingStatus alloc] init]; - return self; -} -- (OWSWebRTCProtosVideoStreamingStatusBuilder*) clone { - return [OWSWebRTCProtosVideoStreamingStatus builderWithPrototype:resultVideoStreamingStatus]; -} -- (OWSWebRTCProtosVideoStreamingStatus*) defaultInstance { - return [OWSWebRTCProtosVideoStreamingStatus defaultInstance]; -} -- (OWSWebRTCProtosVideoStreamingStatus*) build { - [self checkInitialized]; - return [self buildPartial]; -} -- (OWSWebRTCProtosVideoStreamingStatus*) buildPartial { - OWSWebRTCProtosVideoStreamingStatus* returnMe = resultVideoStreamingStatus; - self.resultVideoStreamingStatus = nil; - return returnMe; -} -- (OWSWebRTCProtosVideoStreamingStatusBuilder*) mergeFrom:(OWSWebRTCProtosVideoStreamingStatus*) other { - if (other == [OWSWebRTCProtosVideoStreamingStatus defaultInstance]) { - return self; - } - if (other.hasId) { - [self setId:other.id]; - } - if (other.hasEnabled) { - [self setEnabled:other.enabled]; - } - [self mergeUnknownFields:other.unknownFields]; - return self; -} -- (OWSWebRTCProtosVideoStreamingStatusBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { - return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; -} -- (OWSWebRTCProtosVideoStreamingStatusBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { - PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; - while (YES) { - SInt32 tag = [input readTag]; - switch (tag) { - case 0: - [self setUnknownFields:[unknownFields build]]; - return self; - default: { - if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { - [self setUnknownFields:[unknownFields build]]; - return self; - } - break; - } - case 8: { - [self setId:[input readUInt64]]; - break; - } - case 16: { - [self setEnabled:[input readBool]]; - break; - } - } - } -} -- (BOOL) hasId { - return resultVideoStreamingStatus.hasId; -} -- (UInt64) id { - return resultVideoStreamingStatus.id; -} -- (OWSWebRTCProtosVideoStreamingStatusBuilder*) setId:(UInt64) value { - resultVideoStreamingStatus.hasId = YES; - resultVideoStreamingStatus.id = value; - return self; -} -- (OWSWebRTCProtosVideoStreamingStatusBuilder*) clearId { - resultVideoStreamingStatus.hasId = NO; - resultVideoStreamingStatus.id = 0L; - return self; -} -- (BOOL) hasEnabled { - return resultVideoStreamingStatus.hasEnabled; -} -- (BOOL) enabled { - return resultVideoStreamingStatus.enabled; -} -- (OWSWebRTCProtosVideoStreamingStatusBuilder*) setEnabled:(BOOL) value { - resultVideoStreamingStatus.hasEnabled = YES; - resultVideoStreamingStatus.enabled = value; - return self; -} -- (OWSWebRTCProtosVideoStreamingStatusBuilder*) clearEnabled { - resultVideoStreamingStatus.hasEnabled = NO; - resultVideoStreamingStatus.enabled = NO; - return self; -} -@end - -@interface OWSWebRTCProtosData () -@property (strong) OWSWebRTCProtosConnected* connected; -@property (strong) OWSWebRTCProtosHangup* hangup; -@property (strong) OWSWebRTCProtosVideoStreamingStatus* videoStreamingStatus; -@end - -@implementation OWSWebRTCProtosData - -- (BOOL) hasConnected { - return !!hasConnected_; -} -- (void) setHasConnected:(BOOL) _value_ { - hasConnected_ = !!_value_; -} -@synthesize connected; -- (BOOL) hasHangup { - return !!hasHangup_; -} -- (void) setHasHangup:(BOOL) _value_ { - hasHangup_ = !!_value_; -} -@synthesize hangup; -- (BOOL) hasVideoStreamingStatus { - return !!hasVideoStreamingStatus_; -} -- (void) setHasVideoStreamingStatus:(BOOL) _value_ { - hasVideoStreamingStatus_ = !!_value_; -} -@synthesize videoStreamingStatus; -- (instancetype) init { - if ((self = [super init])) { - self.connected = [OWSWebRTCProtosConnected defaultInstance]; - self.hangup = [OWSWebRTCProtosHangup defaultInstance]; - self.videoStreamingStatus = [OWSWebRTCProtosVideoStreamingStatus defaultInstance]; - } - return self; -} -static OWSWebRTCProtosData* defaultOWSWebRTCProtosDataInstance = nil; -+ (void) initialize { - if (self == [OWSWebRTCProtosData class]) { - defaultOWSWebRTCProtosDataInstance = [[OWSWebRTCProtosData alloc] init]; - } -} -+ (instancetype) defaultInstance { - return defaultOWSWebRTCProtosDataInstance; -} -- (instancetype) defaultInstance { - return defaultOWSWebRTCProtosDataInstance; -} -- (BOOL) isInitialized { - return YES; -} -- (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { - if (self.hasConnected) { - [output writeMessage:1 value:self.connected]; - } - if (self.hasHangup) { - [output writeMessage:2 value:self.hangup]; - } - if (self.hasVideoStreamingStatus) { - [output writeMessage:3 value:self.videoStreamingStatus]; - } - [self.unknownFields writeToCodedOutputStream:output]; -} -- (SInt32) serializedSize { - __block SInt32 size_ = memoizedSerializedSize; - if (size_ != -1) { - return size_; - } - - size_ = 0; - if (self.hasConnected) { - size_ += computeMessageSize(1, self.connected); - } - if (self.hasHangup) { - size_ += computeMessageSize(2, self.hangup); - } - if (self.hasVideoStreamingStatus) { - size_ += computeMessageSize(3, self.videoStreamingStatus); - } - size_ += self.unknownFields.serializedSize; - memoizedSerializedSize = size_; - return size_; -} -+ (OWSWebRTCProtosData*) parseFromData:(NSData*) data { - return (OWSWebRTCProtosData*)[[[OWSWebRTCProtosData builder] mergeFromData:data] build]; -} -+ (OWSWebRTCProtosData*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { - return (OWSWebRTCProtosData*)[[[OWSWebRTCProtosData builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; -} -+ (OWSWebRTCProtosData*) parseFromInputStream:(NSInputStream*) input { - return (OWSWebRTCProtosData*)[[[OWSWebRTCProtosData builder] mergeFromInputStream:input] build]; -} -+ (OWSWebRTCProtosData*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { - return (OWSWebRTCProtosData*)[[[OWSWebRTCProtosData builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; -} -+ (OWSWebRTCProtosData*) parseFromCodedInputStream:(PBCodedInputStream*) input { - return (OWSWebRTCProtosData*)[[[OWSWebRTCProtosData builder] mergeFromCodedInputStream:input] build]; -} -+ (OWSWebRTCProtosData*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { - return (OWSWebRTCProtosData*)[[[OWSWebRTCProtosData builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; -} -+ (OWSWebRTCProtosDataBuilder*) builder { - return [[OWSWebRTCProtosDataBuilder alloc] init]; -} -+ (OWSWebRTCProtosDataBuilder*) builderWithPrototype:(OWSWebRTCProtosData*) prototype { - return [[OWSWebRTCProtosData builder] mergeFrom:prototype]; -} -- (OWSWebRTCProtosDataBuilder*) builder { - return [OWSWebRTCProtosData builder]; -} -- (OWSWebRTCProtosDataBuilder*) toBuilder { - return [OWSWebRTCProtosData builderWithPrototype:self]; -} -- (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { - if (self.hasConnected) { - [output appendFormat:@"%@%@ {\n", indent, @"connected"]; - [self.connected writeDescriptionTo:output - withIndent:[NSString stringWithFormat:@"%@ ", indent]]; - [output appendFormat:@"%@}\n", indent]; - } - if (self.hasHangup) { - [output appendFormat:@"%@%@ {\n", indent, @"hangup"]; - [self.hangup writeDescriptionTo:output - withIndent:[NSString stringWithFormat:@"%@ ", indent]]; - [output appendFormat:@"%@}\n", indent]; - } - if (self.hasVideoStreamingStatus) { - [output appendFormat:@"%@%@ {\n", indent, @"videoStreamingStatus"]; - [self.videoStreamingStatus writeDescriptionTo:output - withIndent:[NSString stringWithFormat:@"%@ ", indent]]; - [output appendFormat:@"%@}\n", indent]; - } - [self.unknownFields writeDescriptionTo:output withIndent:indent]; -} -- (void) storeInDictionary:(NSMutableDictionary *)dictionary { - if (self.hasConnected) { - NSMutableDictionary *messageDictionary = [NSMutableDictionary dictionary]; - [self.connected storeInDictionary:messageDictionary]; - [dictionary setObject:[NSDictionary dictionaryWithDictionary:messageDictionary] forKey:@"connected"]; - } - if (self.hasHangup) { - NSMutableDictionary *messageDictionary = [NSMutableDictionary dictionary]; - [self.hangup storeInDictionary:messageDictionary]; - [dictionary setObject:[NSDictionary dictionaryWithDictionary:messageDictionary] forKey:@"hangup"]; - } - if (self.hasVideoStreamingStatus) { - NSMutableDictionary *messageDictionary = [NSMutableDictionary dictionary]; - [self.videoStreamingStatus storeInDictionary:messageDictionary]; - [dictionary setObject:[NSDictionary dictionaryWithDictionary:messageDictionary] forKey:@"videoStreamingStatus"]; - } - [self.unknownFields storeInDictionary:dictionary]; -} -- (BOOL) isEqual:(id)other { - if (other == self) { - return YES; - } - if (![other isKindOfClass:[OWSWebRTCProtosData class]]) { - return NO; - } - OWSWebRTCProtosData *otherMessage = other; - return - self.hasConnected == otherMessage.hasConnected && - (!self.hasConnected || [self.connected isEqual:otherMessage.connected]) && - self.hasHangup == otherMessage.hasHangup && - (!self.hasHangup || [self.hangup isEqual:otherMessage.hangup]) && - self.hasVideoStreamingStatus == otherMessage.hasVideoStreamingStatus && - (!self.hasVideoStreamingStatus || [self.videoStreamingStatus isEqual:otherMessage.videoStreamingStatus]) && - (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); -} -- (NSUInteger) hash { - __block NSUInteger hashCode = 7; - if (self.hasConnected) { - hashCode = hashCode * 31 + [self.connected hash]; - } - if (self.hasHangup) { - hashCode = hashCode * 31 + [self.hangup hash]; - } - if (self.hasVideoStreamingStatus) { - hashCode = hashCode * 31 + [self.videoStreamingStatus hash]; - } - hashCode = hashCode * 31 + [self.unknownFields hash]; - return hashCode; -} -@end - -@interface OWSWebRTCProtosDataBuilder() -@property (strong) OWSWebRTCProtosData* resultData; -@end - -@implementation OWSWebRTCProtosDataBuilder -@synthesize resultData; -- (instancetype) init { - if ((self = [super init])) { - self.resultData = [[OWSWebRTCProtosData alloc] init]; - } - return self; -} -- (PBGeneratedMessage*) internalGetResult { - return resultData; -} -- (OWSWebRTCProtosDataBuilder*) clear { - self.resultData = [[OWSWebRTCProtosData alloc] init]; - return self; -} -- (OWSWebRTCProtosDataBuilder*) clone { - return [OWSWebRTCProtosData builderWithPrototype:resultData]; -} -- (OWSWebRTCProtosData*) defaultInstance { - return [OWSWebRTCProtosData defaultInstance]; -} -- (OWSWebRTCProtosData*) build { - [self checkInitialized]; - return [self buildPartial]; -} -- (OWSWebRTCProtosData*) buildPartial { - OWSWebRTCProtosData* returnMe = resultData; - self.resultData = nil; - return returnMe; -} -- (OWSWebRTCProtosDataBuilder*) mergeFrom:(OWSWebRTCProtosData*) other { - if (other == [OWSWebRTCProtosData defaultInstance]) { - return self; - } - if (other.hasConnected) { - [self mergeConnected:other.connected]; - } - if (other.hasHangup) { - [self mergeHangup:other.hangup]; - } - if (other.hasVideoStreamingStatus) { - [self mergeVideoStreamingStatus:other.videoStreamingStatus]; - } - [self mergeUnknownFields:other.unknownFields]; - return self; -} -- (OWSWebRTCProtosDataBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { - return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; -} -- (OWSWebRTCProtosDataBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { - PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; - while (YES) { - SInt32 tag = [input readTag]; - switch (tag) { - case 0: - [self setUnknownFields:[unknownFields build]]; - return self; - default: { - if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { - [self setUnknownFields:[unknownFields build]]; - return self; - } - break; - } - case 10: { - OWSWebRTCProtosConnectedBuilder* subBuilder = [OWSWebRTCProtosConnected builder]; - if (self.hasConnected) { - [subBuilder mergeFrom:self.connected]; - } - [input readMessage:subBuilder extensionRegistry:extensionRegistry]; - [self setConnected:[subBuilder buildPartial]]; - break; - } - case 18: { - OWSWebRTCProtosHangupBuilder* subBuilder = [OWSWebRTCProtosHangup builder]; - if (self.hasHangup) { - [subBuilder mergeFrom:self.hangup]; - } - [input readMessage:subBuilder extensionRegistry:extensionRegistry]; - [self setHangup:[subBuilder buildPartial]]; - break; - } - case 26: { - OWSWebRTCProtosVideoStreamingStatusBuilder* subBuilder = [OWSWebRTCProtosVideoStreamingStatus builder]; - if (self.hasVideoStreamingStatus) { - [subBuilder mergeFrom:self.videoStreamingStatus]; - } - [input readMessage:subBuilder extensionRegistry:extensionRegistry]; - [self setVideoStreamingStatus:[subBuilder buildPartial]]; - break; - } - } - } -} -- (BOOL) hasConnected { - return resultData.hasConnected; -} -- (OWSWebRTCProtosConnected*) connected { - return resultData.connected; -} -- (OWSWebRTCProtosDataBuilder*) setConnected:(OWSWebRTCProtosConnected*) value { - resultData.hasConnected = YES; - resultData.connected = value; - return self; -} -- (OWSWebRTCProtosDataBuilder*) setConnectedBuilder:(OWSWebRTCProtosConnectedBuilder*) builderForValue { - return [self setConnected:[builderForValue build]]; -} -- (OWSWebRTCProtosDataBuilder*) mergeConnected:(OWSWebRTCProtosConnected*) value { - if (resultData.hasConnected && - resultData.connected != [OWSWebRTCProtosConnected defaultInstance]) { - resultData.connected = - [[[OWSWebRTCProtosConnected builderWithPrototype:resultData.connected] mergeFrom:value] buildPartial]; - } else { - resultData.connected = value; - } - resultData.hasConnected = YES; - return self; -} -- (OWSWebRTCProtosDataBuilder*) clearConnected { - resultData.hasConnected = NO; - resultData.connected = [OWSWebRTCProtosConnected defaultInstance]; - return self; -} -- (BOOL) hasHangup { - return resultData.hasHangup; -} -- (OWSWebRTCProtosHangup*) hangup { - return resultData.hangup; -} -- (OWSWebRTCProtosDataBuilder*) setHangup:(OWSWebRTCProtosHangup*) value { - resultData.hasHangup = YES; - resultData.hangup = value; - return self; -} -- (OWSWebRTCProtosDataBuilder*) setHangupBuilder:(OWSWebRTCProtosHangupBuilder*) builderForValue { - return [self setHangup:[builderForValue build]]; -} -- (OWSWebRTCProtosDataBuilder*) mergeHangup:(OWSWebRTCProtosHangup*) value { - if (resultData.hasHangup && - resultData.hangup != [OWSWebRTCProtosHangup defaultInstance]) { - resultData.hangup = - [[[OWSWebRTCProtosHangup builderWithPrototype:resultData.hangup] mergeFrom:value] buildPartial]; - } else { - resultData.hangup = value; - } - resultData.hasHangup = YES; - return self; -} -- (OWSWebRTCProtosDataBuilder*) clearHangup { - resultData.hasHangup = NO; - resultData.hangup = [OWSWebRTCProtosHangup defaultInstance]; - return self; -} -- (BOOL) hasVideoStreamingStatus { - return resultData.hasVideoStreamingStatus; -} -- (OWSWebRTCProtosVideoStreamingStatus*) videoStreamingStatus { - return resultData.videoStreamingStatus; -} -- (OWSWebRTCProtosDataBuilder*) setVideoStreamingStatus:(OWSWebRTCProtosVideoStreamingStatus*) value { - resultData.hasVideoStreamingStatus = YES; - resultData.videoStreamingStatus = value; - return self; -} -- (OWSWebRTCProtosDataBuilder*) setVideoStreamingStatusBuilder:(OWSWebRTCProtosVideoStreamingStatusBuilder*) builderForValue { - return [self setVideoStreamingStatus:[builderForValue build]]; -} -- (OWSWebRTCProtosDataBuilder*) mergeVideoStreamingStatus:(OWSWebRTCProtosVideoStreamingStatus*) value { - if (resultData.hasVideoStreamingStatus && - resultData.videoStreamingStatus != [OWSWebRTCProtosVideoStreamingStatus defaultInstance]) { - resultData.videoStreamingStatus = - [[[OWSWebRTCProtosVideoStreamingStatus builderWithPrototype:resultData.videoStreamingStatus] mergeFrom:value] buildPartial]; - } else { - resultData.videoStreamingStatus = value; - } - resultData.hasVideoStreamingStatus = YES; - return self; -} -- (OWSWebRTCProtosDataBuilder*) clearVideoStreamingStatus { - resultData.hasVideoStreamingStatus = NO; - resultData.videoStreamingStatus = [OWSWebRTCProtosVideoStreamingStatus defaultInstance]; - return self; -} -@end - - -// @@protoc_insertion_point(global_scope) diff --git a/Signal/src/call/PeerConnectionClient.swift b/Signal/src/call/PeerConnectionClient.swift index ff2960ea3..e696b1b7f 100644 --- a/Signal/src/call/PeerConnectionClient.swift +++ b/Signal/src/call/PeerConnectionClient.swift @@ -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 { diff --git a/Signal/test/call/PeerConnectionClientTest.swift b/Signal/test/call/PeerConnectionClientTest.swift index 4dfe219d6..a2f5d44ff 100644 --- a/Signal/test/call/PeerConnectionClientTest.swift +++ b/Signal/test/call/PeerConnectionClientTest.swift @@ -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) } diff --git a/protobuf/Makefile b/protobuf/Makefile index 539571080..0c84e8249 100644 --- a/protobuf/Makefile +++ b/protobuf/Makefile @@ -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 diff --git a/protobuf/OWSWebRtcDataProtos.proto b/protobuf/OWSWebRtcDataProtos.proto index e057fbc25..36664807f 100644 --- a/protobuf/OWSWebRtcDataProtos.proto +++ b/protobuf/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; }