Updated protobuf.

pull/26/head
Mikunj 6 years ago
parent ac97f47a6a
commit ea0134ad61

@ -237,6 +237,11 @@ message DataMessage {
optional AttachmentPointer image = 3;
}
// Loki: A custom message for our profile
message LokiProfile {
optional string displayName = 1;
}
optional string body = 1;
repeated AttachmentPointer attachments = 2;
optional GroupContext group = 3;
@ -247,7 +252,7 @@ message DataMessage {
optional Quote quote = 8;
repeated Contact contact = 9;
repeated Preview preview = 10;
optional Contact profile = 101; // Loki: The current user's profile
optional LokiProfile profile = 101; // Loki: The current user's profile
}
message NullMessage {

@ -3150,6 +3150,100 @@ extension SSKProtoDataMessagePreview.SSKProtoDataMessagePreviewBuilder {
#endif
// MARK: - SSKProtoDataMessageLokiProfile
@objc public class SSKProtoDataMessageLokiProfile: NSObject {
// MARK: - SSKProtoDataMessageLokiProfileBuilder
@objc public class func builder() -> SSKProtoDataMessageLokiProfileBuilder {
return SSKProtoDataMessageLokiProfileBuilder()
}
// asBuilder() constructs a builder that reflects the proto's contents.
@objc public func asBuilder() -> SSKProtoDataMessageLokiProfileBuilder {
let builder = SSKProtoDataMessageLokiProfileBuilder()
if let _value = displayName {
builder.setDisplayName(_value)
}
return builder
}
@objc public class SSKProtoDataMessageLokiProfileBuilder: NSObject {
private var proto = SignalServiceProtos_DataMessage.LokiProfile()
@objc fileprivate override init() {}
@objc public func setDisplayName(_ valueParam: String) {
proto.displayName = valueParam
}
@objc public func build() throws -> SSKProtoDataMessageLokiProfile {
return try SSKProtoDataMessageLokiProfile.parseProto(proto)
}
@objc public func buildSerializedData() throws -> Data {
return try SSKProtoDataMessageLokiProfile.parseProto(proto).serializedData()
}
}
fileprivate let proto: SignalServiceProtos_DataMessage.LokiProfile
@objc public var displayName: String? {
guard proto.hasDisplayName else {
return nil
}
return proto.displayName
}
@objc public var hasDisplayName: Bool {
return proto.hasDisplayName
}
private init(proto: SignalServiceProtos_DataMessage.LokiProfile) {
self.proto = proto
}
@objc
public func serializedData() throws -> Data {
return try self.proto.serializedData()
}
@objc public class func parseData(_ serializedData: Data) throws -> SSKProtoDataMessageLokiProfile {
let proto = try SignalServiceProtos_DataMessage.LokiProfile(serializedData: serializedData)
return try parseProto(proto)
}
fileprivate class func parseProto(_ proto: SignalServiceProtos_DataMessage.LokiProfile) throws -> SSKProtoDataMessageLokiProfile {
// MARK: - Begin Validation Logic for SSKProtoDataMessageLokiProfile -
// MARK: - End Validation Logic for SSKProtoDataMessageLokiProfile -
let result = SSKProtoDataMessageLokiProfile(proto: proto)
return result
}
@objc public override var debugDescription: String {
return "\(proto)"
}
}
#if DEBUG
extension SSKProtoDataMessageLokiProfile {
@objc public func serializedDataIgnoringErrors() -> Data? {
return try! self.serializedData()
}
}
extension SSKProtoDataMessageLokiProfile.SSKProtoDataMessageLokiProfileBuilder {
@objc public func buildIgnoringErrors() -> SSKProtoDataMessageLokiProfile? {
return try! self.build()
}
}
#endif
// MARK: - SSKProtoDataMessage
@objc public class SSKProtoDataMessage: NSObject {
@ -3281,7 +3375,7 @@ extension SSKProtoDataMessagePreview.SSKProtoDataMessagePreviewBuilder {
proto.preview = wrappedItems.map { $0.proto }
}
@objc public func setProfile(_ valueParam: SSKProtoDataMessageContact) {
@objc public func setProfile(_ valueParam: SSKProtoDataMessageLokiProfile) {
proto.profile = valueParam.proto
}
@ -3306,7 +3400,7 @@ extension SSKProtoDataMessagePreview.SSKProtoDataMessagePreviewBuilder {
@objc public let preview: [SSKProtoDataMessagePreview]
@objc public let profile: SSKProtoDataMessageContact?
@objc public let profile: SSKProtoDataMessageLokiProfile?
@objc public var body: String? {
guard proto.hasBody else {
@ -3355,7 +3449,7 @@ extension SSKProtoDataMessagePreview.SSKProtoDataMessagePreviewBuilder {
quote: SSKProtoDataMessageQuote?,
contact: [SSKProtoDataMessageContact],
preview: [SSKProtoDataMessagePreview],
profile: SSKProtoDataMessageContact?) {
profile: SSKProtoDataMessageLokiProfile?) {
self.proto = proto
self.attachments = attachments
self.group = group
@ -3395,9 +3489,9 @@ extension SSKProtoDataMessagePreview.SSKProtoDataMessagePreviewBuilder {
var preview: [SSKProtoDataMessagePreview] = []
preview = try proto.preview.map { try SSKProtoDataMessagePreview.parseProto($0) }
var profile: SSKProtoDataMessageContact? = nil
var profile: SSKProtoDataMessageLokiProfile? = nil
if proto.hasProfile {
profile = try SSKProtoDataMessageContact.parseProto(proto.profile)
profile = try SSKProtoDataMessageLokiProfile.parseProto(proto.profile)
}
// MARK: - Begin Validation Logic for SSKProtoDataMessage -

@ -793,8 +793,8 @@ struct SignalServiceProtos_DataMessage {
}
/// Loki: The current user's profile
var profile: SignalServiceProtos_DataMessage.Contact {
get {return _storage._profile ?? SignalServiceProtos_DataMessage.Contact()}
var profile: SignalServiceProtos_DataMessage.LokiProfile {
get {return _storage._profile ?? SignalServiceProtos_DataMessage.LokiProfile()}
set {_uniqueStorage()._profile = newValue}
}
/// Returns true if `profile` has been explicitly set.
@ -1420,6 +1420,28 @@ struct SignalServiceProtos_DataMessage {
fileprivate var _storage = _StorageClass.defaultInstance
}
/// Loki: A custom message for our profile
struct LokiProfile {
// 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 displayName: String {
get {return _displayName ?? String()}
set {_displayName = newValue}
}
/// Returns true if `displayName` has been explicitly set.
var hasDisplayName: Bool {return self._displayName != nil}
/// Clears the value of `displayName`. Subsequent reads from it will return its default value.
mutating func clearDisplayName() {self._displayName = nil}
var unknownFields = SwiftProtobuf.UnknownStorage()
init() {}
fileprivate var _displayName: String? = nil
}
init() {}
fileprivate var _storage = _StorageClass.defaultInstance
@ -3137,7 +3159,7 @@ extension SignalServiceProtos_DataMessage: SwiftProtobuf.Message, SwiftProtobuf.
var _quote: SignalServiceProtos_DataMessage.Quote? = nil
var _contact: [SignalServiceProtos_DataMessage.Contact] = []
var _preview: [SignalServiceProtos_DataMessage.Preview] = []
var _profile: SignalServiceProtos_DataMessage.Contact? = nil
var _profile: SignalServiceProtos_DataMessage.LokiProfile? = nil
static let defaultInstance = _StorageClass()
@ -3888,6 +3910,35 @@ extension SignalServiceProtos_DataMessage.Preview: SwiftProtobuf.Message, SwiftP
}
}
extension SignalServiceProtos_DataMessage.LokiProfile: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
static let protoMessageName: String = SignalServiceProtos_DataMessage.protoMessageName + ".LokiProfile"
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
1: .same(proto: "displayName"),
]
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
while let fieldNumber = try decoder.nextFieldNumber() {
switch fieldNumber {
case 1: try decoder.decodeSingularStringField(value: &self._displayName)
default: break
}
}
}
func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
if let v = self._displayName {
try visitor.visitSingularStringField(value: v, fieldNumber: 1)
}
try unknownFields.traverse(visitor: &visitor)
}
static func ==(lhs: SignalServiceProtos_DataMessage.LokiProfile, rhs: SignalServiceProtos_DataMessage.LokiProfile) -> Bool {
if lhs._displayName != rhs._displayName {return false}
if lhs.unknownFields != rhs.unknownFields {return false}
return true
}
}
extension SignalServiceProtos_NullMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
static let protoMessageName: String = _protobuf_package + ".NullMessage"
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [

Loading…
Cancel
Save