mirror of
https://github.com/signalapp/Signal-iOS.git
synced 2025-12-05 01:10:41 +00:00
Move E164/UUID handling in protobufs to callers
This commit is contained in:
@@ -783,19 +783,7 @@ class MessageContext(BaseContext):
|
||||
if proto_syntax == "proto3":
|
||||
writer.add("return !proto.%s.isEmpty" % field.name_swift)
|
||||
else:
|
||||
is_uuid_or_e164 = field.name.endswith(
|
||||
"Uuid"
|
||||
) or field.name.endswith("E164")
|
||||
if is_uuid_or_e164:
|
||||
writer.add(
|
||||
"return proto.%s && !proto.%s.isEmpty"
|
||||
% (
|
||||
field.has_accessor_name(),
|
||||
field.name_swift,
|
||||
)
|
||||
)
|
||||
else:
|
||||
writer.add("return proto.%s" % field.has_accessor_name())
|
||||
writer.add("return proto.%s" % field.has_accessor_name())
|
||||
writer.pop_indent()
|
||||
writer.add("}")
|
||||
writer.newline()
|
||||
@@ -1474,16 +1462,6 @@ public func serializedData() throws -> Data {
|
||||
elif self.is_field_a_proto(field):
|
||||
writer.add("proto.%s = valueParam.proto" % (field.name_swift,))
|
||||
else:
|
||||
if field.name.endswith("E164") and field.proto_type == "string":
|
||||
writer.add("if let valueParam = valueParam.nilIfEmpty {")
|
||||
writer.push_indent()
|
||||
writer.add(
|
||||
"owsAssertDebug(valueParam.isStructurallyValidE164)"
|
||||
)
|
||||
writer.pop_indent()
|
||||
writer.add("}")
|
||||
writer.newline()
|
||||
|
||||
writer.add("proto.%s = valueParam" % (field.name_swift,))
|
||||
|
||||
writer.pop_indent()
|
||||
@@ -1526,13 +1504,6 @@ public func serializedData() throws -> Data {
|
||||
elif self.is_field_a_proto(field):
|
||||
writer.add("proto.%s = valueParam.proto" % (field.name_swift,))
|
||||
else:
|
||||
if field.name.endswith("E164") and field.proto_type == "string":
|
||||
writer.add("if let valueParam = valueParam.nilIfEmpty {")
|
||||
writer.push_indent()
|
||||
writer.add("owsAssertDebug(valueParam.isStructurallyValidE164)")
|
||||
writer.pop_indent()
|
||||
writer.add("}")
|
||||
writer.newline()
|
||||
writer.add("proto.%s = valueParam" % (field.name_swift,))
|
||||
|
||||
writer.pop_indent()
|
||||
|
||||
Reference in New Issue
Block a user