Fix open group message syncing
This commit is contained in:
parent
585fabca03
commit
afd7a5a3dc
|
@ -31,10 +31,7 @@ extension Storage {
|
|||
let thread = TSThread.fetch(uniqueId: threadID, transaction: transaction) else { return nil }
|
||||
let tsMessage: TSMessage
|
||||
if message.sender == getUserPublicKey() {
|
||||
guard let syncTarget = message.syncTarget else { return nil }
|
||||
let tsOutgoingMessage = TSOutgoingMessage.from(message, associatedWith: thread, using: transaction)
|
||||
tsOutgoingMessage.update(withSentRecipient: syncTarget, wasSentByUD: true, transaction: transaction)
|
||||
tsMessage = tsOutgoingMessage
|
||||
tsMessage = TSOutgoingMessage.from(message, associatedWith: thread, using: transaction)
|
||||
} else {
|
||||
tsMessage = TSIncomingMessage.from(message, quotedMessage: quotedMessage, linkPreview: linkPreview, associatedWith: thread)
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ public final class VisibleMessage : Message {
|
|||
@objc public var contact: Contact?
|
||||
@objc public var profile: Profile?
|
||||
|
||||
public override var isSelfSendValid: Bool { syncTarget != nil }
|
||||
public override var isSelfSendValid: Bool { true }
|
||||
|
||||
// MARK: Initialization
|
||||
public override init() { super.init() }
|
||||
|
|
|
@ -354,9 +354,6 @@ extension SNProtoTypingMessage.SNProtoTypingMessageBuilder {
|
|||
if let _value = dataMessage {
|
||||
builder.setDataMessage(_value)
|
||||
}
|
||||
if let _value = syncMessage {
|
||||
builder.setSyncMessage(_value)
|
||||
}
|
||||
if let _value = receiptMessage {
|
||||
builder.setReceiptMessage(_value)
|
||||
}
|
||||
|
@ -379,10 +376,6 @@ extension SNProtoTypingMessage.SNProtoTypingMessageBuilder {
|
|||
proto.dataMessage = valueParam.proto
|
||||
}
|
||||
|
||||
@objc public func setSyncMessage(_ valueParam: SNProtoSyncMessage) {
|
||||
proto.syncMessage = valueParam.proto
|
||||
}
|
||||
|
||||
@objc public func setReceiptMessage(_ valueParam: SNProtoReceiptMessage) {
|
||||
proto.receiptMessage = valueParam.proto
|
||||
}
|
||||
|
@ -408,8 +401,6 @@ extension SNProtoTypingMessage.SNProtoTypingMessageBuilder {
|
|||
|
||||
@objc public let dataMessage: SNProtoDataMessage?
|
||||
|
||||
@objc public let syncMessage: SNProtoSyncMessage?
|
||||
|
||||
@objc public let receiptMessage: SNProtoReceiptMessage?
|
||||
|
||||
@objc public let typingMessage: SNProtoTypingMessage?
|
||||
|
@ -418,13 +409,11 @@ extension SNProtoTypingMessage.SNProtoTypingMessageBuilder {
|
|||
|
||||
private init(proto: SessionProtos_Content,
|
||||
dataMessage: SNProtoDataMessage?,
|
||||
syncMessage: SNProtoSyncMessage?,
|
||||
receiptMessage: SNProtoReceiptMessage?,
|
||||
typingMessage: SNProtoTypingMessage?,
|
||||
configurationMessage: SNProtoConfigurationMessage?) {
|
||||
self.proto = proto
|
||||
self.dataMessage = dataMessage
|
||||
self.syncMessage = syncMessage
|
||||
self.receiptMessage = receiptMessage
|
||||
self.typingMessage = typingMessage
|
||||
self.configurationMessage = configurationMessage
|
||||
|
@ -446,11 +435,6 @@ extension SNProtoTypingMessage.SNProtoTypingMessageBuilder {
|
|||
dataMessage = try SNProtoDataMessage.parseProto(proto.dataMessage)
|
||||
}
|
||||
|
||||
var syncMessage: SNProtoSyncMessage? = nil
|
||||
if proto.hasSyncMessage {
|
||||
syncMessage = try SNProtoSyncMessage.parseProto(proto.syncMessage)
|
||||
}
|
||||
|
||||
var receiptMessage: SNProtoReceiptMessage? = nil
|
||||
if proto.hasReceiptMessage {
|
||||
receiptMessage = try SNProtoReceiptMessage.parseProto(proto.receiptMessage)
|
||||
|
@ -472,7 +456,6 @@ extension SNProtoTypingMessage.SNProtoTypingMessageBuilder {
|
|||
|
||||
let result = SNProtoContent(proto: proto,
|
||||
dataMessage: dataMessage,
|
||||
syncMessage: syncMessage,
|
||||
receiptMessage: receiptMessage,
|
||||
typingMessage: typingMessage,
|
||||
configurationMessage: configurationMessage)
|
||||
|
@ -3378,270 +3361,6 @@ extension SNProtoReceiptMessage.SNProtoReceiptMessageBuilder {
|
|||
|
||||
#endif
|
||||
|
||||
// MARK: - SNProtoSyncMessageSent
|
||||
|
||||
@objc public class SNProtoSyncMessageSent: NSObject {
|
||||
|
||||
// MARK: - SNProtoSyncMessageSentBuilder
|
||||
|
||||
@objc public class func builder() -> SNProtoSyncMessageSentBuilder {
|
||||
return SNProtoSyncMessageSentBuilder()
|
||||
}
|
||||
|
||||
// asBuilder() constructs a builder that reflects the proto's contents.
|
||||
@objc public func asBuilder() -> SNProtoSyncMessageSentBuilder {
|
||||
let builder = SNProtoSyncMessageSentBuilder()
|
||||
if let _value = destination {
|
||||
builder.setDestination(_value)
|
||||
}
|
||||
if hasTimestamp {
|
||||
builder.setTimestamp(timestamp)
|
||||
}
|
||||
if let _value = message {
|
||||
builder.setMessage(_value)
|
||||
}
|
||||
if hasExpirationStartTimestamp {
|
||||
builder.setExpirationStartTimestamp(expirationStartTimestamp)
|
||||
}
|
||||
if hasIsRecipientUpdate {
|
||||
builder.setIsRecipientUpdate(isRecipientUpdate)
|
||||
}
|
||||
return builder
|
||||
}
|
||||
|
||||
@objc public class SNProtoSyncMessageSentBuilder: NSObject {
|
||||
|
||||
private var proto = SessionProtos_SyncMessage.Sent()
|
||||
|
||||
@objc fileprivate override init() {}
|
||||
|
||||
@objc public func setDestination(_ valueParam: String) {
|
||||
proto.destination = valueParam
|
||||
}
|
||||
|
||||
@objc public func setTimestamp(_ valueParam: UInt64) {
|
||||
proto.timestamp = valueParam
|
||||
}
|
||||
|
||||
@objc public func setMessage(_ valueParam: SNProtoDataMessage) {
|
||||
proto.message = valueParam.proto
|
||||
}
|
||||
|
||||
@objc public func setExpirationStartTimestamp(_ valueParam: UInt64) {
|
||||
proto.expirationStartTimestamp = valueParam
|
||||
}
|
||||
|
||||
@objc public func setIsRecipientUpdate(_ valueParam: Bool) {
|
||||
proto.isRecipientUpdate = valueParam
|
||||
}
|
||||
|
||||
@objc public func build() throws -> SNProtoSyncMessageSent {
|
||||
return try SNProtoSyncMessageSent.parseProto(proto)
|
||||
}
|
||||
|
||||
@objc public func buildSerializedData() throws -> Data {
|
||||
return try SNProtoSyncMessageSent.parseProto(proto).serializedData()
|
||||
}
|
||||
}
|
||||
|
||||
fileprivate let proto: SessionProtos_SyncMessage.Sent
|
||||
|
||||
@objc public let message: SNProtoDataMessage?
|
||||
|
||||
@objc public var destination: String? {
|
||||
guard proto.hasDestination else {
|
||||
return nil
|
||||
}
|
||||
return proto.destination
|
||||
}
|
||||
@objc public var hasDestination: Bool {
|
||||
return proto.hasDestination
|
||||
}
|
||||
|
||||
@objc public var timestamp: UInt64 {
|
||||
return proto.timestamp
|
||||
}
|
||||
@objc public var hasTimestamp: Bool {
|
||||
return proto.hasTimestamp
|
||||
}
|
||||
|
||||
@objc public var expirationStartTimestamp: UInt64 {
|
||||
return proto.expirationStartTimestamp
|
||||
}
|
||||
@objc public var hasExpirationStartTimestamp: Bool {
|
||||
return proto.hasExpirationStartTimestamp
|
||||
}
|
||||
|
||||
@objc public var isRecipientUpdate: Bool {
|
||||
return proto.isRecipientUpdate
|
||||
}
|
||||
@objc public var hasIsRecipientUpdate: Bool {
|
||||
return proto.hasIsRecipientUpdate
|
||||
}
|
||||
|
||||
private init(proto: SessionProtos_SyncMessage.Sent,
|
||||
message: SNProtoDataMessage?) {
|
||||
self.proto = proto
|
||||
self.message = message
|
||||
}
|
||||
|
||||
@objc
|
||||
public func serializedData() throws -> Data {
|
||||
return try self.proto.serializedData()
|
||||
}
|
||||
|
||||
@objc public class func parseData(_ serializedData: Data) throws -> SNProtoSyncMessageSent {
|
||||
let proto = try SessionProtos_SyncMessage.Sent(serializedData: serializedData)
|
||||
return try parseProto(proto)
|
||||
}
|
||||
|
||||
fileprivate class func parseProto(_ proto: SessionProtos_SyncMessage.Sent) throws -> SNProtoSyncMessageSent {
|
||||
var message: SNProtoDataMessage? = nil
|
||||
if proto.hasMessage {
|
||||
message = try SNProtoDataMessage.parseProto(proto.message)
|
||||
}
|
||||
|
||||
// MARK: - Begin Validation Logic for SNProtoSyncMessageSent -
|
||||
|
||||
// MARK: - End Validation Logic for SNProtoSyncMessageSent -
|
||||
|
||||
let result = SNProtoSyncMessageSent(proto: proto,
|
||||
message: message)
|
||||
return result
|
||||
}
|
||||
|
||||
@objc public override var debugDescription: String {
|
||||
return "\(proto)"
|
||||
}
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
|
||||
extension SNProtoSyncMessageSent {
|
||||
@objc public func serializedDataIgnoringErrors() -> Data? {
|
||||
return try! self.serializedData()
|
||||
}
|
||||
}
|
||||
|
||||
extension SNProtoSyncMessageSent.SNProtoSyncMessageSentBuilder {
|
||||
@objc public func buildIgnoringErrors() -> SNProtoSyncMessageSent? {
|
||||
return try! self.build()
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// MARK: - SNProtoSyncMessage
|
||||
|
||||
@objc public class SNProtoSyncMessage: NSObject {
|
||||
|
||||
// MARK: - SNProtoSyncMessageBuilder
|
||||
|
||||
@objc public class func builder() -> SNProtoSyncMessageBuilder {
|
||||
return SNProtoSyncMessageBuilder()
|
||||
}
|
||||
|
||||
// asBuilder() constructs a builder that reflects the proto's contents.
|
||||
@objc public func asBuilder() -> SNProtoSyncMessageBuilder {
|
||||
let builder = SNProtoSyncMessageBuilder()
|
||||
if let _value = sent {
|
||||
builder.setSent(_value)
|
||||
}
|
||||
if let _value = padding {
|
||||
builder.setPadding(_value)
|
||||
}
|
||||
return builder
|
||||
}
|
||||
|
||||
@objc public class SNProtoSyncMessageBuilder: NSObject {
|
||||
|
||||
private var proto = SessionProtos_SyncMessage()
|
||||
|
||||
@objc fileprivate override init() {}
|
||||
|
||||
@objc public func setSent(_ valueParam: SNProtoSyncMessageSent) {
|
||||
proto.sent = valueParam.proto
|
||||
}
|
||||
|
||||
@objc public func setPadding(_ valueParam: Data) {
|
||||
proto.padding = valueParam
|
||||
}
|
||||
|
||||
@objc public func build() throws -> SNProtoSyncMessage {
|
||||
return try SNProtoSyncMessage.parseProto(proto)
|
||||
}
|
||||
|
||||
@objc public func buildSerializedData() throws -> Data {
|
||||
return try SNProtoSyncMessage.parseProto(proto).serializedData()
|
||||
}
|
||||
}
|
||||
|
||||
fileprivate let proto: SessionProtos_SyncMessage
|
||||
|
||||
@objc public let sent: SNProtoSyncMessageSent?
|
||||
|
||||
@objc public var padding: Data? {
|
||||
guard proto.hasPadding else {
|
||||
return nil
|
||||
}
|
||||
return proto.padding
|
||||
}
|
||||
@objc public var hasPadding: Bool {
|
||||
return proto.hasPadding
|
||||
}
|
||||
|
||||
private init(proto: SessionProtos_SyncMessage,
|
||||
sent: SNProtoSyncMessageSent?) {
|
||||
self.proto = proto
|
||||
self.sent = sent
|
||||
}
|
||||
|
||||
@objc
|
||||
public func serializedData() throws -> Data {
|
||||
return try self.proto.serializedData()
|
||||
}
|
||||
|
||||
@objc public class func parseData(_ serializedData: Data) throws -> SNProtoSyncMessage {
|
||||
let proto = try SessionProtos_SyncMessage(serializedData: serializedData)
|
||||
return try parseProto(proto)
|
||||
}
|
||||
|
||||
fileprivate class func parseProto(_ proto: SessionProtos_SyncMessage) throws -> SNProtoSyncMessage {
|
||||
var sent: SNProtoSyncMessageSent? = nil
|
||||
if proto.hasSent {
|
||||
sent = try SNProtoSyncMessageSent.parseProto(proto.sent)
|
||||
}
|
||||
|
||||
// MARK: - Begin Validation Logic for SNProtoSyncMessage -
|
||||
|
||||
// MARK: - End Validation Logic for SNProtoSyncMessage -
|
||||
|
||||
let result = SNProtoSyncMessage(proto: proto,
|
||||
sent: sent)
|
||||
return result
|
||||
}
|
||||
|
||||
@objc public override var debugDescription: String {
|
||||
return "\(proto)"
|
||||
}
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
|
||||
extension SNProtoSyncMessage {
|
||||
@objc public func serializedDataIgnoringErrors() -> Data? {
|
||||
return try! self.serializedData()
|
||||
}
|
||||
}
|
||||
|
||||
extension SNProtoSyncMessage.SNProtoSyncMessageBuilder {
|
||||
@objc public func buildIgnoringErrors() -> SNProtoSyncMessage? {
|
||||
return try! self.build()
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// MARK: - SNProtoAttachmentPointer
|
||||
|
||||
@objc public class SNProtoAttachmentPointer: NSObject {
|
||||
|
|
|
@ -209,15 +209,6 @@ struct SessionProtos_Content {
|
|||
/// Clears the value of `dataMessage`. Subsequent reads from it will return its default value.
|
||||
mutating func clearDataMessage() {_uniqueStorage()._dataMessage = nil}
|
||||
|
||||
var syncMessage: SessionProtos_SyncMessage {
|
||||
get {return _storage._syncMessage ?? SessionProtos_SyncMessage()}
|
||||
set {_uniqueStorage()._syncMessage = newValue}
|
||||
}
|
||||
/// Returns true if `syncMessage` has been explicitly set.
|
||||
var hasSyncMessage: Bool {return _storage._syncMessage != nil}
|
||||
/// Clears the value of `syncMessage`. Subsequent reads from it will return its default value.
|
||||
mutating func clearSyncMessage() {_uniqueStorage()._syncMessage = nil}
|
||||
|
||||
var receiptMessage: SessionProtos_ReceiptMessage {
|
||||
get {return _storage._receiptMessage ?? SessionProtos_ReceiptMessage()}
|
||||
set {_uniqueStorage()._receiptMessage = newValue}
|
||||
|
@ -1364,93 +1355,6 @@ extension SessionProtos_ReceiptMessage.TypeEnum: CaseIterable {
|
|||
|
||||
#endif // swift(>=4.2)
|
||||
|
||||
struct SessionProtos_SyncMessage {
|
||||
// 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 sent: SessionProtos_SyncMessage.Sent {
|
||||
get {return _storage._sent ?? SessionProtos_SyncMessage.Sent()}
|
||||
set {_uniqueStorage()._sent = newValue}
|
||||
}
|
||||
/// Returns true if `sent` has been explicitly set.
|
||||
var hasSent: Bool {return _storage._sent != nil}
|
||||
/// Clears the value of `sent`. Subsequent reads from it will return its default value.
|
||||
mutating func clearSent() {_uniqueStorage()._sent = nil}
|
||||
|
||||
var padding: Data {
|
||||
get {return _storage._padding ?? SwiftProtobuf.Internal.emptyData}
|
||||
set {_uniqueStorage()._padding = newValue}
|
||||
}
|
||||
/// Returns true if `padding` has been explicitly set.
|
||||
var hasPadding: Bool {return _storage._padding != nil}
|
||||
/// Clears the value of `padding`. Subsequent reads from it will return its default value.
|
||||
mutating func clearPadding() {_uniqueStorage()._padding = nil}
|
||||
|
||||
var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
struct Sent {
|
||||
// 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 destination: String {
|
||||
get {return _storage._destination ?? String()}
|
||||
set {_uniqueStorage()._destination = newValue}
|
||||
}
|
||||
/// Returns true if `destination` has been explicitly set.
|
||||
var hasDestination: Bool {return _storage._destination != nil}
|
||||
/// Clears the value of `destination`. Subsequent reads from it will return its default value.
|
||||
mutating func clearDestination() {_uniqueStorage()._destination = nil}
|
||||
|
||||
var timestamp: UInt64 {
|
||||
get {return _storage._timestamp ?? 0}
|
||||
set {_uniqueStorage()._timestamp = newValue}
|
||||
}
|
||||
/// Returns true if `timestamp` has been explicitly set.
|
||||
var hasTimestamp: Bool {return _storage._timestamp != nil}
|
||||
/// Clears the value of `timestamp`. Subsequent reads from it will return its default value.
|
||||
mutating func clearTimestamp() {_uniqueStorage()._timestamp = nil}
|
||||
|
||||
var message: SessionProtos_DataMessage {
|
||||
get {return _storage._message ?? SessionProtos_DataMessage()}
|
||||
set {_uniqueStorage()._message = newValue}
|
||||
}
|
||||
/// Returns true if `message` has been explicitly set.
|
||||
var hasMessage: Bool {return _storage._message != nil}
|
||||
/// Clears the value of `message`. Subsequent reads from it will return its default value.
|
||||
mutating func clearMessage() {_uniqueStorage()._message = nil}
|
||||
|
||||
var expirationStartTimestamp: UInt64 {
|
||||
get {return _storage._expirationStartTimestamp ?? 0}
|
||||
set {_uniqueStorage()._expirationStartTimestamp = newValue}
|
||||
}
|
||||
/// Returns true if `expirationStartTimestamp` has been explicitly set.
|
||||
var hasExpirationStartTimestamp: Bool {return _storage._expirationStartTimestamp != nil}
|
||||
/// Clears the value of `expirationStartTimestamp`. Subsequent reads from it will return its default value.
|
||||
mutating func clearExpirationStartTimestamp() {_uniqueStorage()._expirationStartTimestamp = nil}
|
||||
|
||||
var isRecipientUpdate: Bool {
|
||||
get {return _storage._isRecipientUpdate ?? false}
|
||||
set {_uniqueStorage()._isRecipientUpdate = newValue}
|
||||
}
|
||||
/// Returns true if `isRecipientUpdate` has been explicitly set.
|
||||
var hasIsRecipientUpdate: Bool {return _storage._isRecipientUpdate != nil}
|
||||
/// Clears the value of `isRecipientUpdate`. Subsequent reads from it will return its default value.
|
||||
mutating func clearIsRecipientUpdate() {_uniqueStorage()._isRecipientUpdate = nil}
|
||||
|
||||
var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
init() {}
|
||||
|
||||
fileprivate var _storage = _StorageClass.defaultInstance
|
||||
}
|
||||
|
||||
init() {}
|
||||
|
||||
fileprivate var _storage = _StorageClass.defaultInstance
|
||||
}
|
||||
|
||||
struct SessionProtos_AttachmentPointer {
|
||||
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
|
@ -2093,7 +1997,6 @@ extension SessionProtos_Content: SwiftProtobuf.Message, SwiftProtobuf._MessageIm
|
|||
static let protoMessageName: String = _protobuf_package + ".Content"
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "dataMessage"),
|
||||
2: .same(proto: "syncMessage"),
|
||||
5: .same(proto: "receiptMessage"),
|
||||
6: .same(proto: "typingMessage"),
|
||||
7: .same(proto: "configurationMessage"),
|
||||
|
@ -2101,7 +2004,6 @@ extension SessionProtos_Content: SwiftProtobuf.Message, SwiftProtobuf._MessageIm
|
|||
|
||||
fileprivate class _StorageClass {
|
||||
var _dataMessage: SessionProtos_DataMessage? = nil
|
||||
var _syncMessage: SessionProtos_SyncMessage? = nil
|
||||
var _receiptMessage: SessionProtos_ReceiptMessage? = nil
|
||||
var _typingMessage: SessionProtos_TypingMessage? = nil
|
||||
var _configurationMessage: SessionProtos_ConfigurationMessage? = nil
|
||||
|
@ -2112,7 +2014,6 @@ extension SessionProtos_Content: SwiftProtobuf.Message, SwiftProtobuf._MessageIm
|
|||
|
||||
init(copying source: _StorageClass) {
|
||||
_dataMessage = source._dataMessage
|
||||
_syncMessage = source._syncMessage
|
||||
_receiptMessage = source._receiptMessage
|
||||
_typingMessage = source._typingMessage
|
||||
_configurationMessage = source._configurationMessage
|
||||
|
@ -2129,7 +2030,6 @@ extension SessionProtos_Content: SwiftProtobuf.Message, SwiftProtobuf._MessageIm
|
|||
public var isInitialized: Bool {
|
||||
return withExtendedLifetime(_storage) { (_storage: _StorageClass) in
|
||||
if let v = _storage._dataMessage, !v.isInitialized {return false}
|
||||
if let v = _storage._syncMessage, !v.isInitialized {return false}
|
||||
if let v = _storage._configurationMessage, !v.isInitialized {return false}
|
||||
return true
|
||||
}
|
||||
|
@ -2141,7 +2041,6 @@ extension SessionProtos_Content: SwiftProtobuf.Message, SwiftProtobuf._MessageIm
|
|||
while let fieldNumber = try decoder.nextFieldNumber() {
|
||||
switch fieldNumber {
|
||||
case 1: try decoder.decodeSingularMessageField(value: &_storage._dataMessage)
|
||||
case 2: try decoder.decodeSingularMessageField(value: &_storage._syncMessage)
|
||||
case 5: try decoder.decodeSingularMessageField(value: &_storage._receiptMessage)
|
||||
case 6: try decoder.decodeSingularMessageField(value: &_storage._typingMessage)
|
||||
case 7: try decoder.decodeSingularMessageField(value: &_storage._configurationMessage)
|
||||
|
@ -2156,9 +2055,6 @@ extension SessionProtos_Content: SwiftProtobuf.Message, SwiftProtobuf._MessageIm
|
|||
if let v = _storage._dataMessage {
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
|
||||
}
|
||||
if let v = _storage._syncMessage {
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 2)
|
||||
}
|
||||
if let v = _storage._receiptMessage {
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 5)
|
||||
}
|
||||
|
@ -2178,7 +2074,6 @@ extension SessionProtos_Content: SwiftProtobuf.Message, SwiftProtobuf._MessageIm
|
|||
let _storage = _args.0
|
||||
let rhs_storage = _args.1
|
||||
if _storage._dataMessage != rhs_storage._dataMessage {return false}
|
||||
if _storage._syncMessage != rhs_storage._syncMessage {return false}
|
||||
if _storage._receiptMessage != rhs_storage._receiptMessage {return false}
|
||||
if _storage._typingMessage != rhs_storage._typingMessage {return false}
|
||||
if _storage._configurationMessage != rhs_storage._configurationMessage {return false}
|
||||
|
@ -3462,182 +3357,6 @@ extension SessionProtos_ReceiptMessage.TypeEnum: SwiftProtobuf._ProtoNameProvidi
|
|||
]
|
||||
}
|
||||
|
||||
extension SessionProtos_SyncMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
static let protoMessageName: String = _protobuf_package + ".SyncMessage"
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "sent"),
|
||||
8: .same(proto: "padding"),
|
||||
]
|
||||
|
||||
fileprivate class _StorageClass {
|
||||
var _sent: SessionProtos_SyncMessage.Sent? = nil
|
||||
var _padding: Data? = nil
|
||||
|
||||
static let defaultInstance = _StorageClass()
|
||||
|
||||
private init() {}
|
||||
|
||||
init(copying source: _StorageClass) {
|
||||
_sent = source._sent
|
||||
_padding = source._padding
|
||||
}
|
||||
}
|
||||
|
||||
fileprivate mutating func _uniqueStorage() -> _StorageClass {
|
||||
if !isKnownUniquelyReferenced(&_storage) {
|
||||
_storage = _StorageClass(copying: _storage)
|
||||
}
|
||||
return _storage
|
||||
}
|
||||
|
||||
public var isInitialized: Bool {
|
||||
return withExtendedLifetime(_storage) { (_storage: _StorageClass) in
|
||||
if let v = _storage._sent, !v.isInitialized {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
_ = _uniqueStorage()
|
||||
try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
|
||||
while let fieldNumber = try decoder.nextFieldNumber() {
|
||||
switch fieldNumber {
|
||||
case 1: try decoder.decodeSingularMessageField(value: &_storage._sent)
|
||||
case 8: try decoder.decodeSingularBytesField(value: &_storage._padding)
|
||||
default: break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
|
||||
if let v = _storage._sent {
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
|
||||
}
|
||||
if let v = _storage._padding {
|
||||
try visitor.visitSingularBytesField(value: v, fieldNumber: 8)
|
||||
}
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
static func ==(lhs: SessionProtos_SyncMessage, rhs: SessionProtos_SyncMessage) -> Bool {
|
||||
if lhs._storage !== rhs._storage {
|
||||
let storagesAreEqual: Bool = withExtendedLifetime((lhs._storage, rhs._storage)) { (_args: (_StorageClass, _StorageClass)) in
|
||||
let _storage = _args.0
|
||||
let rhs_storage = _args.1
|
||||
if _storage._sent != rhs_storage._sent {return false}
|
||||
if _storage._padding != rhs_storage._padding {return false}
|
||||
return true
|
||||
}
|
||||
if !storagesAreEqual {return false}
|
||||
}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
extension SessionProtos_SyncMessage.Sent: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
static let protoMessageName: String = SessionProtos_SyncMessage.protoMessageName + ".Sent"
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "destination"),
|
||||
2: .same(proto: "timestamp"),
|
||||
3: .same(proto: "message"),
|
||||
4: .same(proto: "expirationStartTimestamp"),
|
||||
6: .same(proto: "isRecipientUpdate"),
|
||||
]
|
||||
|
||||
fileprivate class _StorageClass {
|
||||
var _destination: String? = nil
|
||||
var _timestamp: UInt64? = nil
|
||||
var _message: SessionProtos_DataMessage? = nil
|
||||
var _expirationStartTimestamp: UInt64? = nil
|
||||
var _isRecipientUpdate: Bool? = nil
|
||||
|
||||
static let defaultInstance = _StorageClass()
|
||||
|
||||
private init() {}
|
||||
|
||||
init(copying source: _StorageClass) {
|
||||
_destination = source._destination
|
||||
_timestamp = source._timestamp
|
||||
_message = source._message
|
||||
_expirationStartTimestamp = source._expirationStartTimestamp
|
||||
_isRecipientUpdate = source._isRecipientUpdate
|
||||
}
|
||||
}
|
||||
|
||||
fileprivate mutating func _uniqueStorage() -> _StorageClass {
|
||||
if !isKnownUniquelyReferenced(&_storage) {
|
||||
_storage = _StorageClass(copying: _storage)
|
||||
}
|
||||
return _storage
|
||||
}
|
||||
|
||||
public var isInitialized: Bool {
|
||||
return withExtendedLifetime(_storage) { (_storage: _StorageClass) in
|
||||
if let v = _storage._message, !v.isInitialized {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
_ = _uniqueStorage()
|
||||
try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
|
||||
while let fieldNumber = try decoder.nextFieldNumber() {
|
||||
switch fieldNumber {
|
||||
case 1: try decoder.decodeSingularStringField(value: &_storage._destination)
|
||||
case 2: try decoder.decodeSingularUInt64Field(value: &_storage._timestamp)
|
||||
case 3: try decoder.decodeSingularMessageField(value: &_storage._message)
|
||||
case 4: try decoder.decodeSingularUInt64Field(value: &_storage._expirationStartTimestamp)
|
||||
case 6: try decoder.decodeSingularBoolField(value: &_storage._isRecipientUpdate)
|
||||
default: break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
|
||||
if let v = _storage._destination {
|
||||
try visitor.visitSingularStringField(value: v, fieldNumber: 1)
|
||||
}
|
||||
if let v = _storage._timestamp {
|
||||
try visitor.visitSingularUInt64Field(value: v, fieldNumber: 2)
|
||||
}
|
||||
if let v = _storage._message {
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 3)
|
||||
}
|
||||
if let v = _storage._expirationStartTimestamp {
|
||||
try visitor.visitSingularUInt64Field(value: v, fieldNumber: 4)
|
||||
}
|
||||
if let v = _storage._isRecipientUpdate {
|
||||
try visitor.visitSingularBoolField(value: v, fieldNumber: 6)
|
||||
}
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
static func ==(lhs: SessionProtos_SyncMessage.Sent, rhs: SessionProtos_SyncMessage.Sent) -> Bool {
|
||||
if lhs._storage !== rhs._storage {
|
||||
let storagesAreEqual: Bool = withExtendedLifetime((lhs._storage, rhs._storage)) { (_args: (_StorageClass, _StorageClass)) in
|
||||
let _storage = _args.0
|
||||
let rhs_storage = _args.1
|
||||
if _storage._destination != rhs_storage._destination {return false}
|
||||
if _storage._timestamp != rhs_storage._timestamp {return false}
|
||||
if _storage._message != rhs_storage._message {return false}
|
||||
if _storage._expirationStartTimestamp != rhs_storage._expirationStartTimestamp {return false}
|
||||
if _storage._isRecipientUpdate != rhs_storage._isRecipientUpdate {return false}
|
||||
return true
|
||||
}
|
||||
if !storagesAreEqual {return false}
|
||||
}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
extension SessionProtos_AttachmentPointer: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
static let protoMessageName: String = _protobuf_package + ".AttachmentPointer"
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
|
|
|
@ -36,7 +36,6 @@ message TypingMessage {
|
|||
|
||||
message Content {
|
||||
optional DataMessage dataMessage = 1;
|
||||
optional SyncMessage syncMessage = 2;
|
||||
optional ReceiptMessage receiptMessage = 5;
|
||||
optional TypingMessage typingMessage = 6;
|
||||
optional ConfigurationMessage configurationMessage = 7;
|
||||
|
@ -238,20 +237,6 @@ message ReceiptMessage {
|
|||
repeated uint64 timestamp = 2;
|
||||
}
|
||||
|
||||
message SyncMessage {
|
||||
|
||||
message Sent {
|
||||
optional string destination = 1;
|
||||
optional uint64 timestamp = 2;
|
||||
optional DataMessage message = 3;
|
||||
optional uint64 expirationStartTimestamp = 4;
|
||||
optional bool isRecipientUpdate = 6 [default = false];
|
||||
}
|
||||
|
||||
optional Sent sent = 1;
|
||||
optional bytes padding = 8;
|
||||
}
|
||||
|
||||
message AttachmentPointer {
|
||||
|
||||
enum Flags {
|
||||
|
|
|
@ -146,21 +146,13 @@ public final class OpenGroupPoller : NSObject {
|
|||
let groupProto = SNProtoGroupContext.builder(id: id, type: .deliver)
|
||||
groupProto.setName(openGroup.displayName)
|
||||
dataMessageProto.setGroup(try! groupProto.build())
|
||||
// Sync target
|
||||
if wasSentByCurrentUser {
|
||||
dataMessageProto.setSyncTarget(openGroup.id)
|
||||
}
|
||||
// Content
|
||||
let content = SNProtoContent.builder()
|
||||
if !wasSentByCurrentUser { // Incoming message
|
||||
content.setDataMessage(try! dataMessageProto.build())
|
||||
} else { // Outgoing message
|
||||
// FIXME: This needs to be updated as we removed sync message handling
|
||||
let syncMessageSentBuilder = SNProtoSyncMessageSent.builder()
|
||||
syncMessageSentBuilder.setMessage(try! dataMessageProto.build())
|
||||
syncMessageSentBuilder.setDestination(userPublicKey)
|
||||
syncMessageSentBuilder.setTimestamp(message.timestamp)
|
||||
let syncMessageSent = try! syncMessageSentBuilder.build()
|
||||
let syncMessageBuilder = SNProtoSyncMessage.builder()
|
||||
syncMessageBuilder.setSent(syncMessageSent)
|
||||
content.setSyncMessage(try! syncMessageBuilder.build())
|
||||
}
|
||||
content.setDataMessage(try! dataMessageProto.build())
|
||||
// Envelope
|
||||
let envelope = SNProtoEnvelope.builder(type: .unidentifiedSender, timestamp: message.timestamp)
|
||||
envelope.setSource(senderPublicKey)
|
||||
|
|
Loading…
Reference in New Issue