Create DataExtractionNotification

pull/362/head
Niels Andriesse 3 years ago
parent defb3a751b
commit b1cd34c9b4

@ -287,6 +287,7 @@
B8F5F54E25EC50A5003BF8D4 /* BlockListUIUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = B8F5F52725EC4F6A003BF8D4 /* BlockListUIUtils.h */; settings = {ATTRIBUTES = (Public, ); }; }; B8F5F54E25EC50A5003BF8D4 /* BlockListUIUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = B8F5F52725EC4F6A003BF8D4 /* BlockListUIUtils.h */; settings = {ATTRIBUTES = (Public, ); }; };
B8F5F56525EC8453003BF8D4 /* Notification+Contacts.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8F5F56425EC8453003BF8D4 /* Notification+Contacts.swift */; }; B8F5F56525EC8453003BF8D4 /* Notification+Contacts.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8F5F56425EC8453003BF8D4 /* Notification+Contacts.swift */; };
B8F5F58325EC94A6003BF8D4 /* Collection+Subscripting.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8F5F58225EC94A6003BF8D4 /* Collection+Subscripting.swift */; }; B8F5F58325EC94A6003BF8D4 /* Collection+Subscripting.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8F5F58225EC94A6003BF8D4 /* Collection+Subscripting.swift */; };
B8F5F60325EDE16F003BF8D4 /* DataExtractionNotification.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8F5F60225EDE16F003BF8D4 /* DataExtractionNotification.swift */; };
B8FF8DAE25C0D00F004D1F22 /* SessionMessagingKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3C2A6F025539DE700C340D1 /* SessionMessagingKit.framework */; }; B8FF8DAE25C0D00F004D1F22 /* SessionMessagingKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3C2A6F025539DE700C340D1 /* SessionMessagingKit.framework */; };
B8FF8DAF25C0D00F004D1F22 /* SessionUtilitiesKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3C2A679255388CC00C340D1 /* SessionUtilitiesKit.framework */; }; B8FF8DAF25C0D00F004D1F22 /* SessionUtilitiesKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3C2A679255388CC00C340D1 /* SessionUtilitiesKit.framework */; };
B8FF8E6225C10DA5004D1F22 /* GeoLite2-Country-Blocks-IPv4 in Resources */ = {isa = PBXBuildFile; fileRef = B8FF8E6125C10DA5004D1F22 /* GeoLite2-Country-Blocks-IPv4 */; }; B8FF8E6225C10DA5004D1F22 /* GeoLite2-Country-Blocks-IPv4 in Resources */ = {isa = PBXBuildFile; fileRef = B8FF8E6125C10DA5004D1F22 /* GeoLite2-Country-Blocks-IPv4 */; };
@ -1283,6 +1284,7 @@
B8F5F52825EC4F8A003BF8D4 /* BlockListUIUtils.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BlockListUIUtils.m; sourceTree = "<group>"; }; B8F5F52825EC4F8A003BF8D4 /* BlockListUIUtils.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BlockListUIUtils.m; sourceTree = "<group>"; };
B8F5F56425EC8453003BF8D4 /* Notification+Contacts.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Notification+Contacts.swift"; sourceTree = "<group>"; }; B8F5F56425EC8453003BF8D4 /* Notification+Contacts.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Notification+Contacts.swift"; sourceTree = "<group>"; };
B8F5F58225EC94A6003BF8D4 /* Collection+Subscripting.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Collection+Subscripting.swift"; sourceTree = "<group>"; }; B8F5F58225EC94A6003BF8D4 /* Collection+Subscripting.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Collection+Subscripting.swift"; sourceTree = "<group>"; };
B8F5F60225EDE16F003BF8D4 /* DataExtractionNotification.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DataExtractionNotification.swift; sourceTree = "<group>"; };
B8FF8E6125C10DA5004D1F22 /* GeoLite2-Country-Blocks-IPv4 */ = {isa = PBXFileReference; lastKnownFileType = file.bplist; name = "GeoLite2-Country-Blocks-IPv4"; path = "Countries/GeoLite2-Country-Blocks-IPv4"; sourceTree = "<group>"; }; B8FF8E6125C10DA5004D1F22 /* GeoLite2-Country-Blocks-IPv4 */ = {isa = PBXFileReference; lastKnownFileType = file.bplist; name = "GeoLite2-Country-Blocks-IPv4"; path = "Countries/GeoLite2-Country-Blocks-IPv4"; sourceTree = "<group>"; };
B8FF8E7325C10FC3004D1F22 /* GeoLite2-Country-Locations-English */ = {isa = PBXFileReference; lastKnownFileType = file.bplist; name = "GeoLite2-Country-Locations-English"; path = "Countries/GeoLite2-Country-Locations-English"; sourceTree = "<group>"; }; B8FF8E7325C10FC3004D1F22 /* GeoLite2-Country-Locations-English */ = {isa = PBXFileReference; lastKnownFileType = file.bplist; name = "GeoLite2-Country-Locations-English"; path = "Countries/GeoLite2-Country-Locations-English"; sourceTree = "<group>"; };
B8FF8EA525C11FEF004D1F22 /* IPv4.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IPv4.swift; sourceTree = "<group>"; }; B8FF8EA525C11FEF004D1F22 /* IPv4.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IPv4.swift; sourceTree = "<group>"; };
@ -2424,6 +2426,7 @@
C300A5BC2554B00D00555489 /* ReadReceipt.swift */, C300A5BC2554B00D00555489 /* ReadReceipt.swift */,
C300A5D22554B05A00555489 /* TypingIndicator.swift */, C300A5D22554B05A00555489 /* TypingIndicator.swift */,
C34A977325A3E34A00852C71 /* ClosedGroupControlMessage.swift */, C34A977325A3E34A00852C71 /* ClosedGroupControlMessage.swift */,
B8F5F60225EDE16F003BF8D4 /* DataExtractionNotification.swift */,
C300A5E62554B07300555489 /* ExpirationTimerUpdate.swift */, C300A5E62554B07300555489 /* ExpirationTimerUpdate.swift */,
C3DA9C0625AE7396008F7C7E /* ConfigurationMessage.swift */, C3DA9C0625AE7396008F7C7E /* ConfigurationMessage.swift */,
); );
@ -4761,6 +4764,7 @@
C3A3A171256E1D25004D228D /* SSKReachabilityManager.swift in Sources */, C3A3A171256E1D25004D228D /* SSKReachabilityManager.swift in Sources */,
C3A721392558BDFA0043A11F /* OpenGroupAPI.swift in Sources */, C3A721392558BDFA0043A11F /* OpenGroupAPI.swift in Sources */,
C3A71D0B2558989C0043A11F /* MessageWrapper.swift in Sources */, C3A71D0B2558989C0043A11F /* MessageWrapper.swift in Sources */,
B8F5F60325EDE16F003BF8D4 /* DataExtractionNotification.swift in Sources */,
C32C5D24256DD4C0003C73A2 /* MentionsManager.swift in Sources */, C32C5D24256DD4C0003C73A2 /* MentionsManager.swift in Sources */,
C3A71D1E25589AC30043A11F /* WebSocketProto.swift in Sources */, C3A71D1E25589AC30043A11F /* WebSocketProto.swift in Sources */,
C3A721382558BDFA0043A11F /* OpenGroupMessage.swift in Sources */, C3A721382558BDFA0043A11F /* OpenGroupMessage.swift in Sources */,

@ -0,0 +1,106 @@
import SessionUtilitiesKit
public final class DataExtractionNotification : ControlMessage {
public var kind: Kind?
// MARK: Kind
public enum Kind : CustomStringConvertible {
case screenshot
case mediaSaved(timestamp: UInt64)
public var description: String {
switch self {
case .screenshot: return "screenshot"
case .mediaSaved: return "mediaSaved"
}
}
}
// MARK: Initialization
public override init() { super.init() }
internal init(kind: Kind) {
super.init()
self.kind = kind
}
// MARK: Validation
public override var isValid: Bool {
guard super.isValid, let kind = kind else { return false }
switch kind {
case .screenshot: return true
case .mediaSaved(let timestamp): return timestamp > 0
}
}
// MARK: Coding
public required init?(coder: NSCoder) {
super.init(coder: coder)
guard let rawKind = coder.decodeObject(forKey: "kind") as? String else { return nil }
switch rawKind {
case "screenshot":
self.kind = .screenshot
case "mediaSaved":
guard let timestamp = coder.decodeObject(forKey: "timestamp") as? UInt64 else { return nil }
self.kind = .mediaSaved(timestamp: timestamp)
default: return nil
}
}
public override func encode(with coder: NSCoder) {
super.encode(with: coder)
guard let kind = kind else { return }
switch kind {
case .screenshot:
coder.encode("screenshot", forKey: "kind")
case .mediaSaved(let timestamp):
coder.encode("mediaSaved", forKey: "kind")
coder.encode(timestamp, forKey: "timestamp")
}
}
// MARK: Proto Conversion
public override class func fromProto(_ proto: SNProtoContent) -> DataExtractionNotification? {
guard let dataExtractionNotification = proto.dataExtractionNotification else { return nil }
let kind: Kind
switch dataExtractionNotification.type {
case .screenshot: kind = .screenshot
case .mediaSaved:
let timestamp = dataExtractionNotification.hasTimestamp ? dataExtractionNotification.timestamp : 0
kind = .mediaSaved(timestamp: timestamp)
}
return DataExtractionNotification(kind: kind)
}
public override func toProto(using transaction: YapDatabaseReadWriteTransaction) -> SNProtoContent? {
guard let kind = kind else {
SNLog("Couldn't construct data extraction notification proto from: \(self).")
return nil
}
do {
let dataExtractionNotification: SNProtoDataExtractionNotification.SNProtoDataExtractionNotificationBuilder
switch kind {
case .screenshot:
dataExtractionNotification = SNProtoDataExtractionNotification.builder(type: .screenshot)
case .mediaSaved(let timestamp):
dataExtractionNotification = SNProtoDataExtractionNotification.builder(type: .mediaSaved)
dataExtractionNotification.setTimestamp(timestamp)
}
let contentProto = SNProtoContent.builder()
contentProto.setDataExtractionNotification(try dataExtractionNotification.build())
return try contentProto.build()
} catch {
SNLog("Couldn't construct data extraction notification proto from: \(self).")
return nil
}
}
// MARK: Description
public override var description: String {
"""
DataExtractionNotification(
kind: \(kind?.description ?? "null")
)
"""
}
}

@ -363,8 +363,8 @@ extension SNProtoTypingMessage.SNProtoTypingMessageBuilder {
if let _value = configurationMessage { if let _value = configurationMessage {
builder.setConfigurationMessage(_value) builder.setConfigurationMessage(_value)
} }
if let _value = infoMessage { if let _value = dataExtractionNotification {
builder.setInfoMessage(_value) builder.setDataExtractionNotification(_value)
} }
return builder return builder
} }
@ -391,8 +391,8 @@ extension SNProtoTypingMessage.SNProtoTypingMessageBuilder {
proto.configurationMessage = valueParam.proto proto.configurationMessage = valueParam.proto
} }
@objc public func setInfoMessage(_ valueParam: SNProtoInfoMessage) { @objc public func setDataExtractionNotification(_ valueParam: SNProtoDataExtractionNotification) {
proto.infoMessage = valueParam.proto proto.dataExtractionNotification = valueParam.proto
} }
@objc public func build() throws -> SNProtoContent { @objc public func build() throws -> SNProtoContent {
@ -414,20 +414,20 @@ extension SNProtoTypingMessage.SNProtoTypingMessageBuilder {
@objc public let configurationMessage: SNProtoConfigurationMessage? @objc public let configurationMessage: SNProtoConfigurationMessage?
@objc public let infoMessage: SNProtoInfoMessage? @objc public let dataExtractionNotification: SNProtoDataExtractionNotification?
private init(proto: SessionProtos_Content, private init(proto: SessionProtos_Content,
dataMessage: SNProtoDataMessage?, dataMessage: SNProtoDataMessage?,
receiptMessage: SNProtoReceiptMessage?, receiptMessage: SNProtoReceiptMessage?,
typingMessage: SNProtoTypingMessage?, typingMessage: SNProtoTypingMessage?,
configurationMessage: SNProtoConfigurationMessage?, configurationMessage: SNProtoConfigurationMessage?,
infoMessage: SNProtoInfoMessage?) { dataExtractionNotification: SNProtoDataExtractionNotification?) {
self.proto = proto self.proto = proto
self.dataMessage = dataMessage self.dataMessage = dataMessage
self.receiptMessage = receiptMessage self.receiptMessage = receiptMessage
self.typingMessage = typingMessage self.typingMessage = typingMessage
self.configurationMessage = configurationMessage self.configurationMessage = configurationMessage
self.infoMessage = infoMessage self.dataExtractionNotification = dataExtractionNotification
} }
@objc @objc
@ -461,9 +461,9 @@ extension SNProtoTypingMessage.SNProtoTypingMessageBuilder {
configurationMessage = try SNProtoConfigurationMessage.parseProto(proto.configurationMessage) configurationMessage = try SNProtoConfigurationMessage.parseProto(proto.configurationMessage)
} }
var infoMessage: SNProtoInfoMessage? = nil var dataExtractionNotification: SNProtoDataExtractionNotification? = nil
if proto.hasInfoMessage { if proto.hasDataExtractionNotification {
infoMessage = try SNProtoInfoMessage.parseProto(proto.infoMessage) dataExtractionNotification = try SNProtoDataExtractionNotification.parseProto(proto.dataExtractionNotification)
} }
// MARK: - Begin Validation Logic for SNProtoContent - // MARK: - Begin Validation Logic for SNProtoContent -
@ -475,7 +475,7 @@ extension SNProtoTypingMessage.SNProtoTypingMessageBuilder {
receiptMessage: receiptMessage, receiptMessage: receiptMessage,
typingMessage: typingMessage, typingMessage: typingMessage,
configurationMessage: configurationMessage, configurationMessage: configurationMessage,
infoMessage: infoMessage) dataExtractionNotification: dataExtractionNotification)
return result return result
} }
@ -612,78 +612,78 @@ extension SNProtoKeyPair.SNProtoKeyPairBuilder {
#endif #endif
// MARK: - SNProtoInfoMessage // MARK: - SNProtoDataExtractionNotification
@objc public class SNProtoInfoMessage: NSObject { @objc public class SNProtoDataExtractionNotification: NSObject {
// MARK: - SNProtoInfoMessageType // MARK: - SNProtoDataExtractionNotificationType
@objc public enum SNProtoInfoMessageType: Int32 { @objc public enum SNProtoDataExtractionNotificationType: Int32 {
case screenshot = 1 case screenshot = 1
case mediaSaved = 2 case mediaSaved = 2
} }
private class func SNProtoInfoMessageTypeWrap(_ value: SessionProtos_InfoMessage.TypeEnum) -> SNProtoInfoMessageType { private class func SNProtoDataExtractionNotificationTypeWrap(_ value: SessionProtos_DataExtractionNotification.TypeEnum) -> SNProtoDataExtractionNotificationType {
switch value { switch value {
case .screenshot: return .screenshot case .screenshot: return .screenshot
case .mediaSaved: return .mediaSaved case .mediaSaved: return .mediaSaved
} }
} }
private class func SNProtoInfoMessageTypeUnwrap(_ value: SNProtoInfoMessageType) -> SessionProtos_InfoMessage.TypeEnum { private class func SNProtoDataExtractionNotificationTypeUnwrap(_ value: SNProtoDataExtractionNotificationType) -> SessionProtos_DataExtractionNotification.TypeEnum {
switch value { switch value {
case .screenshot: return .screenshot case .screenshot: return .screenshot
case .mediaSaved: return .mediaSaved case .mediaSaved: return .mediaSaved
} }
} }
// MARK: - SNProtoInfoMessageBuilder // MARK: - SNProtoDataExtractionNotificationBuilder
@objc public class func builder(type: SNProtoInfoMessageType) -> SNProtoInfoMessageBuilder { @objc public class func builder(type: SNProtoDataExtractionNotificationType) -> SNProtoDataExtractionNotificationBuilder {
return SNProtoInfoMessageBuilder(type: type) return SNProtoDataExtractionNotificationBuilder(type: type)
} }
// asBuilder() constructs a builder that reflects the proto's contents. // asBuilder() constructs a builder that reflects the proto's contents.
@objc public func asBuilder() -> SNProtoInfoMessageBuilder { @objc public func asBuilder() -> SNProtoDataExtractionNotificationBuilder {
let builder = SNProtoInfoMessageBuilder(type: type) let builder = SNProtoDataExtractionNotificationBuilder(type: type)
if hasTimestamp { if hasTimestamp {
builder.setTimestamp(timestamp) builder.setTimestamp(timestamp)
} }
return builder return builder
} }
@objc public class SNProtoInfoMessageBuilder: NSObject { @objc public class SNProtoDataExtractionNotificationBuilder: NSObject {
private var proto = SessionProtos_InfoMessage() private var proto = SessionProtos_DataExtractionNotification()
@objc fileprivate override init() {} @objc fileprivate override init() {}
@objc fileprivate init(type: SNProtoInfoMessageType) { @objc fileprivate init(type: SNProtoDataExtractionNotificationType) {
super.init() super.init()
setType(type) setType(type)
} }
@objc public func setType(_ valueParam: SNProtoInfoMessageType) { @objc public func setType(_ valueParam: SNProtoDataExtractionNotificationType) {
proto.type = SNProtoInfoMessageTypeUnwrap(valueParam) proto.type = SNProtoDataExtractionNotificationTypeUnwrap(valueParam)
} }
@objc public func setTimestamp(_ valueParam: UInt64) { @objc public func setTimestamp(_ valueParam: UInt64) {
proto.timestamp = valueParam proto.timestamp = valueParam
} }
@objc public func build() throws -> SNProtoInfoMessage { @objc public func build() throws -> SNProtoDataExtractionNotification {
return try SNProtoInfoMessage.parseProto(proto) return try SNProtoDataExtractionNotification.parseProto(proto)
} }
@objc public func buildSerializedData() throws -> Data { @objc public func buildSerializedData() throws -> Data {
return try SNProtoInfoMessage.parseProto(proto).serializedData() return try SNProtoDataExtractionNotification.parseProto(proto).serializedData()
} }
} }
fileprivate let proto: SessionProtos_InfoMessage fileprivate let proto: SessionProtos_DataExtractionNotification
@objc public let type: SNProtoInfoMessageType @objc public let type: SNProtoDataExtractionNotificationType
@objc public var timestamp: UInt64 { @objc public var timestamp: UInt64 {
return proto.timestamp return proto.timestamp
@ -692,8 +692,8 @@ extension SNProtoKeyPair.SNProtoKeyPairBuilder {
return proto.hasTimestamp return proto.hasTimestamp
} }
private init(proto: SessionProtos_InfoMessage, private init(proto: SessionProtos_DataExtractionNotification,
type: SNProtoInfoMessageType) { type: SNProtoDataExtractionNotificationType) {
self.proto = proto self.proto = proto
self.type = type self.type = type
} }
@ -703,23 +703,23 @@ extension SNProtoKeyPair.SNProtoKeyPairBuilder {
return try self.proto.serializedData() return try self.proto.serializedData()
} }
@objc public class func parseData(_ serializedData: Data) throws -> SNProtoInfoMessage { @objc public class func parseData(_ serializedData: Data) throws -> SNProtoDataExtractionNotification {
let proto = try SessionProtos_InfoMessage(serializedData: serializedData) let proto = try SessionProtos_DataExtractionNotification(serializedData: serializedData)
return try parseProto(proto) return try parseProto(proto)
} }
fileprivate class func parseProto(_ proto: SessionProtos_InfoMessage) throws -> SNProtoInfoMessage { fileprivate class func parseProto(_ proto: SessionProtos_DataExtractionNotification) throws -> SNProtoDataExtractionNotification {
guard proto.hasType else { guard proto.hasType else {
throw SNProtoError.invalidProtobuf(description: "\(logTag) missing required field: type") throw SNProtoError.invalidProtobuf(description: "\(logTag) missing required field: type")
} }
let type = SNProtoInfoMessageTypeWrap(proto.type) let type = SNProtoDataExtractionNotificationTypeWrap(proto.type)
// MARK: - Begin Validation Logic for SNProtoInfoMessage - // MARK: - Begin Validation Logic for SNProtoDataExtractionNotification -
// MARK: - End Validation Logic for SNProtoInfoMessage - // MARK: - End Validation Logic for SNProtoDataExtractionNotification -
let result = SNProtoInfoMessage(proto: proto, let result = SNProtoDataExtractionNotification(proto: proto,
type: type) type: type)
return result return result
} }
@ -730,14 +730,14 @@ extension SNProtoKeyPair.SNProtoKeyPairBuilder {
#if DEBUG #if DEBUG
extension SNProtoInfoMessage { extension SNProtoDataExtractionNotification {
@objc public func serializedDataIgnoringErrors() -> Data? { @objc public func serializedDataIgnoringErrors() -> Data? {
return try! self.serializedData() return try! self.serializedData()
} }
} }
extension SNProtoInfoMessage.SNProtoInfoMessageBuilder { extension SNProtoDataExtractionNotification.SNProtoDataExtractionNotificationBuilder {
@objc public func buildIgnoringErrors() -> SNProtoInfoMessage? { @objc public func buildIgnoringErrors() -> SNProtoDataExtractionNotification? {
return try! self.build() return try! self.build()
} }
} }

@ -236,14 +236,14 @@ struct SessionProtos_Content {
/// Clears the value of `configurationMessage`. Subsequent reads from it will return its default value. /// Clears the value of `configurationMessage`. Subsequent reads from it will return its default value.
mutating func clearConfigurationMessage() {_uniqueStorage()._configurationMessage = nil} mutating func clearConfigurationMessage() {_uniqueStorage()._configurationMessage = nil}
var infoMessage: SessionProtos_InfoMessage { var dataExtractionNotification: SessionProtos_DataExtractionNotification {
get {return _storage._infoMessage ?? SessionProtos_InfoMessage()} get {return _storage._dataExtractionNotification ?? SessionProtos_DataExtractionNotification()}
set {_uniqueStorage()._infoMessage = newValue} set {_uniqueStorage()._dataExtractionNotification = newValue}
} }
/// Returns true if `infoMessage` has been explicitly set. /// Returns true if `dataExtractionNotification` has been explicitly set.
var hasInfoMessage: Bool {return _storage._infoMessage != nil} var hasDataExtractionNotification: Bool {return _storage._dataExtractionNotification != nil}
/// Clears the value of `infoMessage`. Subsequent reads from it will return its default value. /// Clears the value of `dataExtractionNotification`. Subsequent reads from it will return its default value.
mutating func clearInfoMessage() {_uniqueStorage()._infoMessage = nil} mutating func clearDataExtractionNotification() {_uniqueStorage()._dataExtractionNotification = nil}
var unknownFields = SwiftProtobuf.UnknownStorage() var unknownFields = SwiftProtobuf.UnknownStorage()
@ -285,13 +285,13 @@ struct SessionProtos_KeyPair {
fileprivate var _privateKey: Data? = nil fileprivate var _privateKey: Data? = nil
} }
struct SessionProtos_InfoMessage { struct SessionProtos_DataExtractionNotification {
// SwiftProtobuf.Message conformance is added in an extension below. See the // SwiftProtobuf.Message conformance is added in an extension below. See the
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
// methods supported on all messages. // methods supported on all messages.
/// @required /// @required
var type: SessionProtos_InfoMessage.TypeEnum { var type: SessionProtos_DataExtractionNotification.TypeEnum {
get {return _type ?? .screenshot} get {return _type ?? .screenshot}
set {_type = newValue} set {_type = newValue}
} }
@ -341,13 +341,13 @@ struct SessionProtos_InfoMessage {
init() {} init() {}
fileprivate var _type: SessionProtos_InfoMessage.TypeEnum? = nil fileprivate var _type: SessionProtos_DataExtractionNotification.TypeEnum? = nil
fileprivate var _timestamp: UInt64? = nil fileprivate var _timestamp: UInt64? = nil
} }
#if swift(>=4.2) #if swift(>=4.2)
extension SessionProtos_InfoMessage.TypeEnum: CaseIterable { extension SessionProtos_DataExtractionNotification.TypeEnum: CaseIterable {
// Support synthesized by the compiler. // Support synthesized by the compiler.
} }
@ -1435,7 +1435,7 @@ extension SessionProtos_Content: SwiftProtobuf.Message, SwiftProtobuf._MessageIm
5: .same(proto: "receiptMessage"), 5: .same(proto: "receiptMessage"),
6: .same(proto: "typingMessage"), 6: .same(proto: "typingMessage"),
7: .same(proto: "configurationMessage"), 7: .same(proto: "configurationMessage"),
82: .same(proto: "infoMessage"), 82: .same(proto: "dataExtractionNotification"),
] ]
fileprivate class _StorageClass { fileprivate class _StorageClass {
@ -1443,7 +1443,7 @@ extension SessionProtos_Content: SwiftProtobuf.Message, SwiftProtobuf._MessageIm
var _receiptMessage: SessionProtos_ReceiptMessage? = nil var _receiptMessage: SessionProtos_ReceiptMessage? = nil
var _typingMessage: SessionProtos_TypingMessage? = nil var _typingMessage: SessionProtos_TypingMessage? = nil
var _configurationMessage: SessionProtos_ConfigurationMessage? = nil var _configurationMessage: SessionProtos_ConfigurationMessage? = nil
var _infoMessage: SessionProtos_InfoMessage? = nil var _dataExtractionNotification: SessionProtos_DataExtractionNotification? = nil
static let defaultInstance = _StorageClass() static let defaultInstance = _StorageClass()
@ -1454,7 +1454,7 @@ extension SessionProtos_Content: SwiftProtobuf.Message, SwiftProtobuf._MessageIm
_receiptMessage = source._receiptMessage _receiptMessage = source._receiptMessage
_typingMessage = source._typingMessage _typingMessage = source._typingMessage
_configurationMessage = source._configurationMessage _configurationMessage = source._configurationMessage
_infoMessage = source._infoMessage _dataExtractionNotification = source._dataExtractionNotification
} }
} }
@ -1471,7 +1471,7 @@ extension SessionProtos_Content: SwiftProtobuf.Message, SwiftProtobuf._MessageIm
if let v = _storage._receiptMessage, !v.isInitialized {return false} if let v = _storage._receiptMessage, !v.isInitialized {return false}
if let v = _storage._typingMessage, !v.isInitialized {return false} if let v = _storage._typingMessage, !v.isInitialized {return false}
if let v = _storage._configurationMessage, !v.isInitialized {return false} if let v = _storage._configurationMessage, !v.isInitialized {return false}
if let v = _storage._infoMessage, !v.isInitialized {return false} if let v = _storage._dataExtractionNotification, !v.isInitialized {return false}
return true return true
} }
} }
@ -1485,7 +1485,7 @@ extension SessionProtos_Content: SwiftProtobuf.Message, SwiftProtobuf._MessageIm
case 5: try decoder.decodeSingularMessageField(value: &_storage._receiptMessage) case 5: try decoder.decodeSingularMessageField(value: &_storage._receiptMessage)
case 6: try decoder.decodeSingularMessageField(value: &_storage._typingMessage) case 6: try decoder.decodeSingularMessageField(value: &_storage._typingMessage)
case 7: try decoder.decodeSingularMessageField(value: &_storage._configurationMessage) case 7: try decoder.decodeSingularMessageField(value: &_storage._configurationMessage)
case 82: try decoder.decodeSingularMessageField(value: &_storage._infoMessage) case 82: try decoder.decodeSingularMessageField(value: &_storage._dataExtractionNotification)
default: break default: break
} }
} }
@ -1506,7 +1506,7 @@ extension SessionProtos_Content: SwiftProtobuf.Message, SwiftProtobuf._MessageIm
if let v = _storage._configurationMessage { if let v = _storage._configurationMessage {
try visitor.visitSingularMessageField(value: v, fieldNumber: 7) try visitor.visitSingularMessageField(value: v, fieldNumber: 7)
} }
if let v = _storage._infoMessage { if let v = _storage._dataExtractionNotification {
try visitor.visitSingularMessageField(value: v, fieldNumber: 82) try visitor.visitSingularMessageField(value: v, fieldNumber: 82)
} }
} }
@ -1522,7 +1522,7 @@ extension SessionProtos_Content: SwiftProtobuf.Message, SwiftProtobuf._MessageIm
if _storage._receiptMessage != rhs_storage._receiptMessage {return false} if _storage._receiptMessage != rhs_storage._receiptMessage {return false}
if _storage._typingMessage != rhs_storage._typingMessage {return false} if _storage._typingMessage != rhs_storage._typingMessage {return false}
if _storage._configurationMessage != rhs_storage._configurationMessage {return false} if _storage._configurationMessage != rhs_storage._configurationMessage {return false}
if _storage._infoMessage != rhs_storage._infoMessage {return false} if _storage._dataExtractionNotification != rhs_storage._dataExtractionNotification {return false}
return true return true
} }
if !storagesAreEqual {return false} if !storagesAreEqual {return false}
@ -1573,8 +1573,8 @@ extension SessionProtos_KeyPair: SwiftProtobuf.Message, SwiftProtobuf._MessageIm
} }
} }
extension SessionProtos_InfoMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { extension SessionProtos_DataExtractionNotification: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
static let protoMessageName: String = _protobuf_package + ".InfoMessage" static let protoMessageName: String = _protobuf_package + ".DataExtractionNotification"
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
1: .same(proto: "type"), 1: .same(proto: "type"),
2: .same(proto: "timestamp"), 2: .same(proto: "timestamp"),
@ -1605,7 +1605,7 @@ extension SessionProtos_InfoMessage: SwiftProtobuf.Message, SwiftProtobuf._Messa
try unknownFields.traverse(visitor: &visitor) try unknownFields.traverse(visitor: &visitor)
} }
static func ==(lhs: SessionProtos_InfoMessage, rhs: SessionProtos_InfoMessage) -> Bool { static func ==(lhs: SessionProtos_DataExtractionNotification, rhs: SessionProtos_DataExtractionNotification) -> Bool {
if lhs._type != rhs._type {return false} if lhs._type != rhs._type {return false}
if lhs._timestamp != rhs._timestamp {return false} if lhs._timestamp != rhs._timestamp {return false}
if lhs.unknownFields != rhs.unknownFields {return false} if lhs.unknownFields != rhs.unknownFields {return false}
@ -1613,7 +1613,7 @@ extension SessionProtos_InfoMessage: SwiftProtobuf.Message, SwiftProtobuf._Messa
} }
} }
extension SessionProtos_InfoMessage.TypeEnum: SwiftProtobuf._ProtoNameProviding { extension SessionProtos_DataExtractionNotification.TypeEnum: SwiftProtobuf._ProtoNameProviding {
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
1: .same(proto: "SCREENSHOT"), 1: .same(proto: "SCREENSHOT"),
2: .same(proto: "MEDIA_SAVED"), 2: .same(proto: "MEDIA_SAVED"),

@ -35,11 +35,11 @@ message TypingMessage {
} }
message Content { message Content {
optional DataMessage dataMessage = 1; optional DataMessage dataMessage = 1;
optional ReceiptMessage receiptMessage = 5; optional ReceiptMessage receiptMessage = 5;
optional TypingMessage typingMessage = 6; optional TypingMessage typingMessage = 6;
optional ConfigurationMessage configurationMessage = 7; optional ConfigurationMessage configurationMessage = 7;
optional InfoMessage infoMessage = 82; optional DataExtractionNotification dataExtractionNotification = 82;
} }
message KeyPair { message KeyPair {
@ -49,7 +49,7 @@ message KeyPair {
required bytes privateKey = 2; required bytes privateKey = 2;
} }
message InfoMessage { message DataExtractionNotification {
enum Type { enum Type {
SCREENSHOT = 1; SCREENSHOT = 1;

Loading…
Cancel
Save