Added PublicChatInfo field to DataMessage.

pull/43/head
Mikunj 6 years ago
parent 9854c4f05d
commit 17596d8bd3

@ -253,6 +253,7 @@ message DataMessage {
repeated Contact contact = 9;
repeated Preview preview = 10;
optional LokiProfile profile = 101; // Loki: The current user's profile
optional PublicChatInfo publicChatInfo = 900; // Loki: Internal public chat info
}
message NullMessage {
@ -421,3 +422,8 @@ message GroupDetails {
optional string color = 7;
optional bool blocked = 8;
}
// Internal type - DO NOT SEND
message PublicChatInfo {
optional uint64 serverId = 1;
}

@ -3308,6 +3308,9 @@ extension SSKProtoDataMessageLokiProfile.SSKProtoDataMessageLokiProfileBuilder {
if let _value = profile {
builder.setProfile(_value)
}
if let _value = publicChatInfo {
builder.setPublicChatInfo(_value)
}
return builder
}
@ -3379,6 +3382,10 @@ extension SSKProtoDataMessageLokiProfile.SSKProtoDataMessageLokiProfileBuilder {
proto.profile = valueParam.proto
}
@objc public func setPublicChatInfo(_ valueParam: SSKProtoPublicChatInfo) {
proto.publicChatInfo = valueParam.proto
}
@objc public func build() throws -> SSKProtoDataMessage {
return try SSKProtoDataMessage.parseProto(proto)
}
@ -3402,6 +3409,8 @@ extension SSKProtoDataMessageLokiProfile.SSKProtoDataMessageLokiProfileBuilder {
@objc public let profile: SSKProtoDataMessageLokiProfile?
@objc public let publicChatInfo: SSKProtoPublicChatInfo?
@objc public var body: String? {
guard proto.hasBody else {
return nil
@ -3449,7 +3458,8 @@ extension SSKProtoDataMessageLokiProfile.SSKProtoDataMessageLokiProfileBuilder {
quote: SSKProtoDataMessageQuote?,
contact: [SSKProtoDataMessageContact],
preview: [SSKProtoDataMessagePreview],
profile: SSKProtoDataMessageLokiProfile?) {
profile: SSKProtoDataMessageLokiProfile?,
publicChatInfo: SSKProtoPublicChatInfo?) {
self.proto = proto
self.attachments = attachments
self.group = group
@ -3457,6 +3467,7 @@ extension SSKProtoDataMessageLokiProfile.SSKProtoDataMessageLokiProfileBuilder {
self.contact = contact
self.preview = preview
self.profile = profile
self.publicChatInfo = publicChatInfo
}
@objc
@ -3494,6 +3505,11 @@ extension SSKProtoDataMessageLokiProfile.SSKProtoDataMessageLokiProfileBuilder {
profile = try SSKProtoDataMessageLokiProfile.parseProto(proto.profile)
}
var publicChatInfo: SSKProtoPublicChatInfo? = nil
if proto.hasPublicChatInfo {
publicChatInfo = try SSKProtoPublicChatInfo.parseProto(proto.publicChatInfo)
}
// MARK: - Begin Validation Logic for SSKProtoDataMessage -
// MARK: - End Validation Logic for SSKProtoDataMessage -
@ -3504,7 +3520,8 @@ extension SSKProtoDataMessageLokiProfile.SSKProtoDataMessageLokiProfileBuilder {
quote: quote,
contact: contact,
preview: preview,
profile: profile)
profile: profile,
publicChatInfo: publicChatInfo)
return result
}
@ -6215,3 +6232,94 @@ extension SSKProtoGroupDetails.SSKProtoGroupDetailsBuilder {
}
#endif
// MARK: - SSKProtoPublicChatInfo
@objc public class SSKProtoPublicChatInfo: NSObject {
// MARK: - SSKProtoPublicChatInfoBuilder
@objc public class func builder() -> SSKProtoPublicChatInfoBuilder {
return SSKProtoPublicChatInfoBuilder()
}
// asBuilder() constructs a builder that reflects the proto's contents.
@objc public func asBuilder() -> SSKProtoPublicChatInfoBuilder {
let builder = SSKProtoPublicChatInfoBuilder()
if hasServerID {
builder.setServerID(serverID)
}
return builder
}
@objc public class SSKProtoPublicChatInfoBuilder: NSObject {
private var proto = SignalServiceProtos_PublicChatInfo()
@objc fileprivate override init() {}
@objc public func setServerID(_ valueParam: UInt64) {
proto.serverID = valueParam
}
@objc public func build() throws -> SSKProtoPublicChatInfo {
return try SSKProtoPublicChatInfo.parseProto(proto)
}
@objc public func buildSerializedData() throws -> Data {
return try SSKProtoPublicChatInfo.parseProto(proto).serializedData()
}
}
fileprivate let proto: SignalServiceProtos_PublicChatInfo
@objc public var serverID: UInt64 {
return proto.serverID
}
@objc public var hasServerID: Bool {
return proto.hasServerID
}
private init(proto: SignalServiceProtos_PublicChatInfo) {
self.proto = proto
}
@objc
public func serializedData() throws -> Data {
return try self.proto.serializedData()
}
@objc public class func parseData(_ serializedData: Data) throws -> SSKProtoPublicChatInfo {
let proto = try SignalServiceProtos_PublicChatInfo(serializedData: serializedData)
return try parseProto(proto)
}
fileprivate class func parseProto(_ proto: SignalServiceProtos_PublicChatInfo) throws -> SSKProtoPublicChatInfo {
// MARK: - Begin Validation Logic for SSKProtoPublicChatInfo -
// MARK: - End Validation Logic for SSKProtoPublicChatInfo -
let result = SSKProtoPublicChatInfo(proto: proto)
return result
}
@objc public override var debugDescription: String {
return "\(proto)"
}
}
#if DEBUG
extension SSKProtoPublicChatInfo {
@objc public func serializedDataIgnoringErrors() -> Data? {
return try! self.serializedData()
}
}
extension SSKProtoPublicChatInfo.SSKProtoPublicChatInfoBuilder {
@objc public func buildIgnoringErrors() -> SSKProtoPublicChatInfo? {
return try! self.build()
}
}
#endif

@ -802,6 +802,16 @@ struct SignalServiceProtos_DataMessage {
/// Clears the value of `profile`. Subsequent reads from it will return its default value.
mutating func clearProfile() {_uniqueStorage()._profile = nil}
/// Loki: Internal public chat info
var publicChatInfo: SignalServiceProtos_PublicChatInfo {
get {return _storage._publicChatInfo ?? SignalServiceProtos_PublicChatInfo()}
set {_uniqueStorage()._publicChatInfo = newValue}
}
/// Returns true if `publicChatInfo` has been explicitly set.
var hasPublicChatInfo: Bool {return _storage._publicChatInfo != nil}
/// Clears the value of `publicChatInfo`. Subsequent reads from it will return its default value.
mutating func clearPublicChatInfo() {_uniqueStorage()._publicChatInfo = nil}
var unknownFields = SwiftProtobuf.UnknownStorage()
enum Flags: SwiftProtobuf.Enum {
@ -2492,6 +2502,28 @@ struct SignalServiceProtos_GroupDetails {
fileprivate var _storage = _StorageClass.defaultInstance
}
/// Internal type - DO NOT SEND
struct SignalServiceProtos_PublicChatInfo {
// 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 serverID: UInt64 {
get {return _serverID ?? 0}
set {_serverID = newValue}
}
/// Returns true if `serverID` has been explicitly set.
var hasServerID: Bool {return self._serverID != nil}
/// Clears the value of `serverID`. Subsequent reads from it will return its default value.
mutating func clearServerID() {self._serverID = nil}
var unknownFields = SwiftProtobuf.UnknownStorage()
init() {}
fileprivate var _serverID: UInt64? = nil
}
// MARK: - Code below here is support for the SwiftProtobuf runtime.
fileprivate let _protobuf_package = "SignalServiceProtos"
@ -3146,6 +3178,7 @@ extension SignalServiceProtos_DataMessage: SwiftProtobuf.Message, SwiftProtobuf.
9: .same(proto: "contact"),
10: .same(proto: "preview"),
101: .same(proto: "profile"),
900: .same(proto: "publicChatInfo"),
]
fileprivate class _StorageClass {
@ -3160,6 +3193,7 @@ extension SignalServiceProtos_DataMessage: SwiftProtobuf.Message, SwiftProtobuf.
var _contact: [SignalServiceProtos_DataMessage.Contact] = []
var _preview: [SignalServiceProtos_DataMessage.Preview] = []
var _profile: SignalServiceProtos_DataMessage.LokiProfile? = nil
var _publicChatInfo: SignalServiceProtos_PublicChatInfo? = nil
static let defaultInstance = _StorageClass()
@ -3177,6 +3211,7 @@ extension SignalServiceProtos_DataMessage: SwiftProtobuf.Message, SwiftProtobuf.
_contact = source._contact
_preview = source._preview
_profile = source._profile
_publicChatInfo = source._publicChatInfo
}
}
@ -3203,6 +3238,7 @@ extension SignalServiceProtos_DataMessage: SwiftProtobuf.Message, SwiftProtobuf.
case 9: try decoder.decodeRepeatedMessageField(value: &_storage._contact)
case 10: try decoder.decodeRepeatedMessageField(value: &_storage._preview)
case 101: try decoder.decodeSingularMessageField(value: &_storage._profile)
case 900: try decoder.decodeSingularMessageField(value: &_storage._publicChatInfo)
default: break
}
}
@ -3244,6 +3280,9 @@ extension SignalServiceProtos_DataMessage: SwiftProtobuf.Message, SwiftProtobuf.
if let v = _storage._profile {
try visitor.visitSingularMessageField(value: v, fieldNumber: 101)
}
if let v = _storage._publicChatInfo {
try visitor.visitSingularMessageField(value: v, fieldNumber: 900)
}
}
try unknownFields.traverse(visitor: &visitor)
}
@ -3264,6 +3303,7 @@ extension SignalServiceProtos_DataMessage: SwiftProtobuf.Message, SwiftProtobuf.
if _storage._contact != rhs_storage._contact {return false}
if _storage._preview != rhs_storage._preview {return false}
if _storage._profile != rhs_storage._profile {return false}
if _storage._publicChatInfo != rhs_storage._publicChatInfo {return false}
return true
}
if !storagesAreEqual {return false}
@ -5113,3 +5153,32 @@ extension SignalServiceProtos_GroupDetails.Avatar: SwiftProtobuf.Message, SwiftP
return true
}
}
extension SignalServiceProtos_PublicChatInfo: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
static let protoMessageName: String = _protobuf_package + ".PublicChatInfo"
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
1: .same(proto: "serverId"),
]
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
while let fieldNumber = try decoder.nextFieldNumber() {
switch fieldNumber {
case 1: try decoder.decodeSingularUInt64Field(value: &self._serverID)
default: break
}
}
}
func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
if let v = self._serverID {
try visitor.visitSingularUInt64Field(value: v, fieldNumber: 1)
}
try unknownFields.traverse(visitor: &visitor)
}
static func ==(lhs: SignalServiceProtos_PublicChatInfo, rhs: SignalServiceProtos_PublicChatInfo) -> Bool {
if lhs._serverID != rhs._serverID {return false}
if lhs.unknownFields != rhs.unknownFields {return false}
return true
}
}

Loading…
Cancel
Save