Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Message sent to recall previously sent message, can be only sent by original aut

### MessageEdit
If the content of a previously sent message should be edited, a generic message of type `MessageEdit` has to be sent.
It should reference the new content (for now only type `Text` can be edited) as well as the nonce of the message it is replacing. If an edit message is received which is referencing a non existent nonce it should be discarded.
It should reference the new content (for now only type `Text` and `Multipart` can be edited) as well as the nonce of the message it is replacing. If an edit message is received which is referencing a non existent nonce it should be discarded.

### Confirmation
If the reception of a previously sent message should be confirmed, a generic message of type `Confirmation` has to be sent. It should reference the message to be confirmed. Currently the confirmation comes in two flavours: `Read` and `Delivered`.
Expand Down
32 changes: 31 additions & 1 deletion ios/messages.pb.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1362,11 +1362,20 @@ public struct MessageEdit: Sendable {
set {content = .composite(newValue)}
}

public var multipart: Multipart {
get {
if case .multipart(let v)? = content {return v}
return Multipart()
}
set {content = .multipart(newValue)}
}

public var unknownFields = SwiftProtobuf.UnknownStorage()

public enum OneOf_Content: Equatable, Sendable {
case text(Text)
case composite(Composite)
case multipart(Multipart)

fileprivate var isInitialized: Bool {
// The use of inline closures is to circumvent an issue where the compiler
Expand All @@ -1381,6 +1390,10 @@ public struct MessageEdit: Sendable {
guard case .composite(let v) = self else { preconditionFailure() }
return v.isInitialized
}()
case .multipart: return {
guard case .multipart(let v) = self else { preconditionFailure() }
return v.isInitialized
}()
}
}

Expand Down Expand Up @@ -4152,7 +4165,7 @@ extension MessageDelete: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementa

extension MessageEdit: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
public static let protoMessageName: String = "MessageEdit"
public static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{3}replacing_message_id\0\u{1}text\0\u{1}composite\0")
public static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{3}replacing_message_id\0\u{1}text\0\u{1}composite\0\u{1}multipart\0")

public var isInitialized: Bool {
if self._replacingMessageID == nil {return false}
Expand Down Expand Up @@ -4193,6 +4206,19 @@ extension MessageEdit: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementati
self.content = .composite(v)
}
}()
case 4: try {
var v: Multipart?
var hadOneofValue = false
if let current = self.content {
hadOneofValue = true
if case .multipart(let m) = current {v = m}
}
try decoder.decodeSingularMessageField(value: &v)
if let v = v {
if hadOneofValue {try decoder.handleConflictingOneOf()}
self.content = .multipart(v)
}
}()
default: break
}
}
Expand All @@ -4215,6 +4241,10 @@ extension MessageEdit: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementati
guard case .composite(let v)? = self.content else { preconditionFailure() }
try visitor.visitSingularMessageField(value: v, fieldNumber: 3)
}()
case .multipart?: try {
guard case .multipart(let v)? = self.content else { preconditionFailure() }
try visitor.visitSingularMessageField(value: v, fieldNumber: 4)
}()
case nil: break
}
try unknownFields.traverse(visitor: &visitor)
Expand Down
1 change: 1 addition & 0 deletions proto/messages.proto
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ message MessageEdit {
oneof content {
Text text = 2;
Composite composite = 3;
Multipart multipart = 4;
}
}

Expand Down