diff --git a/Scripts/ProtoWrappers.py b/Scripts/ProtoWrappers.py index 35b24b2a9d..e593d53856 100755 --- a/Scripts/ProtoWrappers.py +++ b/Scripts/ProtoWrappers.py @@ -359,6 +359,13 @@ class BaseContext(object): return True return False + def is_field_a_proto_whose_init_throws(self, field): + matching_context = self.context_for_proto_type(field) + if matching_context is not None: + if type(matching_context) is MessageContext: + return matching_context.can_init_throw() + return False + def can_field_be_optional_objc(self, field): return self.can_field_be_optional(field) and not self.is_field_primitive(field) and not self.is_field_an_enum(field) @@ -488,6 +495,14 @@ class MessageContext(BaseContext): def children(self): return self.enums + self.messages + self.oneofs + def can_init_throw(self): + for field in self.fields(): + if self.is_field_a_proto_whose_init_throws(field): + return True + if field.is_required and proto_syntax == "proto2": + return True + return False + def prepare(self): self.swift_name = self.derive_swift_name() self.swift_builder_name = "%sBuilder" % self.swift_name @@ -830,16 +845,23 @@ public func serializedData() throws -> Data { writer.add('public init(serializedData: Data) throws {') writer.push_indent() writer.add('let proto = try %s(serializedData: serializedData)' % ( wrapped_swift_name, ) ) - writer.add('try self.init(proto)') + if self.can_init_throw(): + writer.add('try self.init(proto)') + else: + writer.add('self.init(proto)') writer.pop_indent() writer.add('}') writer.newline() # init(proto:) func + chunks = ["fileprivate"] if writer.needs_objc(): - writer.add('fileprivate convenience init(_ proto: %s) throws {' % ( wrapped_swift_name, ) ) - else: - writer.add('fileprivate init(_ proto: %s) throws {' % ( wrapped_swift_name, ) ) + chunks.append("convenience") + chunks.append(f"init(_ proto: {wrapped_swift_name})") + if self.can_init_throw(): + chunks.append("throws") + chunks.append("{") + writer.add(" ".join(chunks)) writer.push_indent() for field in explict_fields: @@ -856,8 +878,10 @@ public func serializedData() throws -> Data { # TODO: Assert that rules is empty. enum_context = self.context_for_proto_type(field) writer.add('let %s = %s(proto.%s)' % ( field.name_swift, enum_context.wrap_func_name(), field.name_swift, ) ) - elif self.is_field_a_proto(field): + elif self.is_field_a_proto_whose_init_throws(field): writer.add('let %s = try %s(proto.%s)' % (field.name_swift, self.base_swift_type_for_field(field), field.name_swift)), + elif self.is_field_a_proto(field): + writer.add('let %s = %s(proto.%s)' % (field.name_swift, self.base_swift_type_for_field(field), field.name_swift)), else: writer.add('let %s = proto.%s' % ( field.name_swift, field.name_swift, ) ) writer.newline() @@ -873,8 +897,10 @@ public func serializedData() throws -> Data { if self.is_field_an_enum(field): enum_context = self.context_for_proto_type(field) writer.add('%s = proto.%s.map { %s($0) }' % ( field.name_swift, field.name_swift, enum_context.wrap_func_name(), ) ) - elif self.is_field_a_proto(field): + elif self.is_field_a_proto_whose_init_throws(field): writer.add('%s = try proto.%s.map { try %s($0) }' % ( field.name_swift, field.name_swift, self.base_swift_type_for_field(field), ) ) + elif self.is_field_a_proto(field): + writer.add('%s = proto.%s.map { %s($0) }' % ( field.name_swift, field.name_swift, self.base_swift_type_for_field(field), ) ) else: writer.add('%s = proto.%s' % ( field.name_swift, field.name_swift, ) ) else: @@ -885,8 +911,10 @@ public func serializedData() throws -> Data { # TODO: Assert that rules is empty. enum_context = self.context_for_proto_type(field) writer.add('%s = %s(proto.%s)' % ( field.name_swift, enum_context.wrap_func_name(), field.name_swift, ) ) - elif self.is_field_a_proto(field): + elif self.is_field_a_proto_whose_init_throws(field): writer.add('%s = try %s(proto.%s)' % (field.name_swift, self.base_swift_type_for_field(field), field.name_swift)), + elif self.is_field_a_proto(field): + writer.add('%s = %s(proto.%s)' % (field.name_swift, self.base_swift_type_for_field(field), field.name_swift)), else: writer.add('%s = proto.%s' % ( field.name_swift, field.name_swift, ) ) @@ -894,19 +922,6 @@ public func serializedData() throws -> Data { writer.add('}') writer.newline() - writer.add('// MARK: - Begin Validation Logic for %s -' % self.swift_name) - writer.newline() - - # Preserve existing validation logic. - if self.swift_name in args.validation_map: - validation_block = args.validation_map[self.swift_name] - if validation_block: - writer.add_raw(validation_block) - writer.newline() - - writer.add('// MARK: - End Validation Logic for %s -' % self.swift_name) - writer.newline() - initializer_prefix = 'self.init(' initializer_arguments = [] initializer_arguments.append('proto: proto') @@ -1011,7 +1026,10 @@ public func serializedData() throws -> Data { with writer.braced('extension %s' % self.swift_builder_name ) as writer: writer.add_objc() with writer.braced('public func buildIgnoringErrors() -> %s?' % self.swift_name) as writer: - writer.add('return try! self.build()') + if self.can_init_throw(): + writer.add('return try! self.build()') + else: + writer.add('return self.buildInfallibly()') writer.newline() writer.add('#endif') @@ -1255,11 +1273,23 @@ public func serializedData() throws -> Data { writer.add_objc() writer.add('public func build() throws -> %s {' % self.swift_name) writer.push_indent() - writer.add('return try %s(proto)' % self.swift_name) + if self.can_init_throw(): + writer.add('return try %s(proto)' % self.swift_name) + else: + writer.add('return %s(proto)' % self.swift_name) writer.pop_indent() writer.add('}') writer.newline() + if not self.can_init_throw(): + writer.add_objc() + writer.add('public func buildInfallibly() -> %s {' % self.swift_name) + writer.push_indent() + writer.add('return %s(proto)' % self.swift_name) + writer.pop_indent() + writer.add('}') + writer.newline() + # buildSerializedData() func writer.add_objc() writer.add('public func buildSerializedData() throws -> Data {') @@ -1501,7 +1531,7 @@ class OneOfContext(BaseContext): return None - def case_pairs(self): + def case_tuples(self): result = [] for index in self.sorted_item_indices(): index_str = str(index) @@ -1509,9 +1539,11 @@ class OneOfContext(BaseContext): item_type = self.item_type_map[item_name] case_name = lower_camel_case(item_name) case_type = swift_type_for_proto_primitive_type(item_type) + case_throws = False if case_type is None: case_type = self.context_for_proto_type(item_type).swift_name - result.append( (case_name, case_type,) ) + case_throws = self.is_field_a_proto_whose_init_throws(item_type) + result.append( (case_name, case_type, case_throws) ) return result def generate(self, writer): @@ -1525,7 +1557,7 @@ class OneOfContext(BaseContext): writer.push_context(self.proto_name, self.swift_name) - for case_name, case_type in self.case_pairs(): + for case_name, case_type, _ in self.case_tuples(): writer.add('case %s(%s)' % ( case_name, case_type, ) ) @@ -1534,16 +1566,19 @@ class OneOfContext(BaseContext): writer.rstrip() writer.add('}') writer.newline() - + wrapped_swift_name = self.derive_wrapped_swift_name() + # TODO: Only mark this throws if one of the cases throws. writer.add('private func %sWrap(_ value: %s) throws -> %s {' % ( self.swift_name, wrapped_swift_name, self.swift_name, ) ) writer.push_indent() writer.add('switch value {') - for case_name, case_type in self.case_pairs(): + for case_name, case_type, case_throws in self.case_tuples(): if is_swift_primitive_type(case_type): writer.add('case .%s(let value): return .%s(value)' % (case_name, case_name, ) ) - else: + elif case_throws: writer.add('case .%s(let value): return .%s(try %s(value))' % (case_name, case_name, case_type, ) ) + else: + writer.add('case .%s(let value): return .%s(%s(value))' % (case_name, case_name, case_type, ) ) writer.add('}') writer.pop_indent() @@ -1553,7 +1588,7 @@ class OneOfContext(BaseContext): writer.add('private func %sUnwrap(_ value: %s) -> %s {' % ( self.swift_name, self.swift_name, wrapped_swift_name, ) ) writer.push_indent() writer.add('switch value {') - for case_name, case_type in self.case_pairs(): + for case_name, case_type, case_throws in self.case_tuples(): if is_swift_primitive_type(case_type): writer.add('case .%s(let value): return .%s(value)' % (case_name, case_name,)) else: @@ -1820,43 +1855,6 @@ def parse_message(args, proto_file_path, parser, parent_context, message_name): raise Exception('Invalid message syntax[%s]: %s' % (proto_file_path, line)) -def preserve_validation_logic(args, proto_file_path, dst_file_path): - args.validation_map = {} - if os.path.exists(dst_file_path): - with open(dst_file_path, 'rt') as f: - old_text = f.read() - for match in validation_start_regex.finditer(old_text): - # print 'match' - name = match.group(1) - # print '\t name:', name - start = match.end(0) - # print '\t start:', start - end_marker = '// MARK: - End Validation Logic for %s -' % name - end = old_text.find(end_marker) - # print '\t end:', end - if end < start: - raise Exception('Malformed validation: %s, %s' % ( proto_file_path, name, ) ) - validation_block = old_text[start:end] - # print '\t validation_block:', validation_block - - # Strip trailing whitespace. - validation_lines = validation_block.split('\n') - validation_lines = [line.rstrip() for line in validation_lines] - # Strip leading empty lines. - while len(validation_lines) > 0 and validation_lines[0] == '': - validation_lines = validation_lines[1:] - # Strip trailing empty lines. - while len(validation_lines) > 0 and validation_lines[-1] == '': - validation_lines = validation_lines[:-1] - validation_block = '\n'.join(validation_lines) - - if len(validation_block) > 0: - if args.verbose: - print('Preserving validation logic for:', name) - - args.validation_map[name] = validation_block - - def process_proto_file(args, proto_file_path, dst_file_path): with open(proto_file_path, 'rt') as f: text = f.read() @@ -1912,8 +1910,6 @@ def process_proto_file(args, proto_file_path, dst_file_path): raise Exception('Invalid syntax[%s]: %s' % (proto_file_path, line)) - preserve_validation_logic(args, proto_file_path, dst_file_path) - writer = LineWriter(args) context.prepare() context.generate(writer) diff --git a/SignalServiceKit/src/Devices/ConversationSync/OWSContactsOutputStream.m b/SignalServiceKit/src/Devices/ConversationSync/OWSContactsOutputStream.m index 00df7c19fc..398e686230 100644 --- a/SignalServiceKit/src/Devices/ConversationSync/OWSContactsOutputStream.m +++ b/SignalServiceKit/src/Devices/ConversationSync/OWSContactsOutputStream.m @@ -74,14 +74,7 @@ NS_ASSUME_NONNULL_BEGIN SSKProtoContactDetailsAvatarBuilder *avatarBuilder = [SSKProtoContactDetailsAvatar builder]; [avatarBuilder setContentType:OWSMimeTypeImageJpeg]; [avatarBuilder setLength:(uint32_t)avatarJpegData.length]; - - NSError *error; - SSKProtoContactDetailsAvatar *_Nullable avatar = [avatarBuilder buildAndReturnError:&error]; - if (error || !avatar) { - OWSLogError(@"could not build protobuf: %@", error); - return; - } - [contactBuilder setAvatar:avatar]; + [contactBuilder setAvatar:[avatarBuilder buildInfallibly]]; } if (profileKeyData) { diff --git a/SignalServiceKit/src/Messages/Interactions/TSOutgoingMessage.m b/SignalServiceKit/src/Messages/Interactions/TSOutgoingMessage.m index 4b86d94202..be33c69729 100644 --- a/SignalServiceKit/src/Messages/Interactions/TSOutgoingMessage.m +++ b/SignalServiceKit/src/Messages/Interactions/TSOutgoingMessage.m @@ -1107,13 +1107,7 @@ NSUInteger const TSOutgoingMessageSchemaVersion = 1; [storyContextBuilder setAuthorUuid:self.storyAuthorUuidString]; [storyContextBuilder setSentTimestamp:self.storyTimestamp.unsignedLongLongValue]; - NSError *error; - SSKProtoDataMessageStoryContext *_Nullable storyContext = [storyContextBuilder buildAndReturnError:&error]; - if (error || !storyContext) { - OWSFailDebug(@"Could not build storyContext protobuf: %@.", error); - } else { - [builder setStoryContext:storyContext]; - } + [builder setStoryContext:[storyContextBuilder buildInfallibly]]; } [builder setExpireTimer:self.expiresInSeconds]; diff --git a/SignalServiceKit/src/Protos/Generated/DeviceTransferProto.swift b/SignalServiceKit/src/Protos/Generated/DeviceTransferProto.swift index f5a01098ce..ddbc148c32 100644 --- a/SignalServiceKit/src/Protos/Generated/DeviceTransferProto.swift +++ b/SignalServiceKit/src/Protos/Generated/DeviceTransferProto.swift @@ -49,20 +49,16 @@ public struct DeviceTransferProtoFile: Codable, CustomDebugStringConvertible { public init(serializedData: Data) throws { let proto = try DeviceTransferProtos_File(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate init(_ proto: DeviceTransferProtos_File) throws { + fileprivate init(_ proto: DeviceTransferProtos_File) { let identifier = proto.identifier let relativePath = proto.relativePath let estimatedSize = proto.estimatedSize - // MARK: - Begin Validation Logic for DeviceTransferProtoFile - - - // MARK: - End Validation Logic for DeviceTransferProtoFile - - self.init(proto: proto, identifier: identifier, relativePath: relativePath, @@ -141,7 +137,11 @@ public struct DeviceTransferProtoFileBuilder { } public func build() throws -> DeviceTransferProtoFile { - return try DeviceTransferProtoFile(proto) + return DeviceTransferProtoFile(proto) + } + + public func buildInfallibly() -> DeviceTransferProtoFile { + return DeviceTransferProtoFile(proto) } public func buildSerializedData() throws -> Data { @@ -159,7 +159,7 @@ extension DeviceTransferProtoFile { extension DeviceTransferProtoFileBuilder { public func buildIgnoringErrors() -> DeviceTransferProtoFile? { - return try! self.build() + return self.buildInfallibly() } } @@ -197,18 +197,14 @@ public struct DeviceTransferProtoDefault: Codable, CustomDebugStringConvertible public init(serializedData: Data) throws { let proto = try DeviceTransferProtos_Default(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate init(_ proto: DeviceTransferProtos_Default) throws { + fileprivate init(_ proto: DeviceTransferProtos_Default) { let key = proto.key let encodedValue = proto.encodedValue - // MARK: - Begin Validation Logic for DeviceTransferProtoDefault - - - // MARK: - End Validation Logic for DeviceTransferProtoDefault - - self.init(proto: proto, key: key, encodedValue: encodedValue) @@ -281,7 +277,11 @@ public struct DeviceTransferProtoDefaultBuilder { } public func build() throws -> DeviceTransferProtoDefault { - return try DeviceTransferProtoDefault(proto) + return DeviceTransferProtoDefault(proto) + } + + public func buildInfallibly() -> DeviceTransferProtoDefault { + return DeviceTransferProtoDefault(proto) } public func buildSerializedData() throws -> Data { @@ -299,7 +299,7 @@ extension DeviceTransferProtoDefault { extension DeviceTransferProtoDefaultBuilder { public func buildIgnoringErrors() -> DeviceTransferProtoDefault? { - return try! self.build() + return self.buildInfallibly() } } @@ -341,19 +341,15 @@ public struct DeviceTransferProtoDatabase: Codable, CustomDebugStringConvertible public init(serializedData: Data) throws { let proto = try DeviceTransferProtos_Database(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate init(_ proto: DeviceTransferProtos_Database) throws { + fileprivate init(_ proto: DeviceTransferProtos_Database) { let key = proto.key - let database = try DeviceTransferProtoFile(proto.database) + let database = DeviceTransferProtoFile(proto.database) - let wal = try DeviceTransferProtoFile(proto.wal) - - // MARK: - Begin Validation Logic for DeviceTransferProtoDatabase - - - // MARK: - End Validation Logic for DeviceTransferProtoDatabase - + let wal = DeviceTransferProtoFile(proto.wal) self.init(proto: proto, key: key, @@ -439,7 +435,11 @@ public struct DeviceTransferProtoDatabaseBuilder { } public func build() throws -> DeviceTransferProtoDatabase { - return try DeviceTransferProtoDatabase(proto) + return DeviceTransferProtoDatabase(proto) + } + + public func buildInfallibly() -> DeviceTransferProtoDatabase { + return DeviceTransferProtoDatabase(proto) } public func buildSerializedData() throws -> Data { @@ -457,7 +457,7 @@ extension DeviceTransferProtoDatabase { extension DeviceTransferProtoDatabaseBuilder { public func buildIgnoringErrors() -> DeviceTransferProtoDatabase? { - return try! self.build() + return self.buildInfallibly() } } @@ -514,29 +514,25 @@ public struct DeviceTransferProtoManifest: Codable, CustomDebugStringConvertible public init(serializedData: Data) throws { let proto = try DeviceTransferProtos_Manifest(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate init(_ proto: DeviceTransferProtos_Manifest) throws { + fileprivate init(_ proto: DeviceTransferProtos_Manifest) { let grdbSchemaVersion = proto.grdbSchemaVersion var database: DeviceTransferProtoDatabase? if proto.hasDatabase { - database = try DeviceTransferProtoDatabase(proto.database) + database = DeviceTransferProtoDatabase(proto.database) } var appDefaults: [DeviceTransferProtoDefault] = [] - appDefaults = try proto.appDefaults.map { try DeviceTransferProtoDefault($0) } + appDefaults = proto.appDefaults.map { DeviceTransferProtoDefault($0) } var standardDefaults: [DeviceTransferProtoDefault] = [] - standardDefaults = try proto.standardDefaults.map { try DeviceTransferProtoDefault($0) } + standardDefaults = proto.standardDefaults.map { DeviceTransferProtoDefault($0) } var files: [DeviceTransferProtoFile] = [] - files = try proto.files.map { try DeviceTransferProtoFile($0) } - - // MARK: - Begin Validation Logic for DeviceTransferProtoManifest - - - // MARK: - End Validation Logic for DeviceTransferProtoManifest - + files = proto.files.map { DeviceTransferProtoFile($0) } self.init(proto: proto, grdbSchemaVersion: grdbSchemaVersion, @@ -643,7 +639,11 @@ public struct DeviceTransferProtoManifestBuilder { } public func build() throws -> DeviceTransferProtoManifest { - return try DeviceTransferProtoManifest(proto) + return DeviceTransferProtoManifest(proto) + } + + public func buildInfallibly() -> DeviceTransferProtoManifest { + return DeviceTransferProtoManifest(proto) } public func buildSerializedData() throws -> Data { @@ -661,7 +661,7 @@ extension DeviceTransferProtoManifest { extension DeviceTransferProtoManifestBuilder { public func buildIgnoringErrors() -> DeviceTransferProtoManifest? { - return try! self.build() + return self.buildInfallibly() } } diff --git a/SignalServiceKit/src/Protos/Generated/FingerprintProto.swift b/SignalServiceKit/src/Protos/Generated/FingerprintProto.swift index c1f273c995..6aeada18aa 100644 --- a/SignalServiceKit/src/Protos/Generated/FingerprintProto.swift +++ b/SignalServiceKit/src/Protos/Generated/FingerprintProto.swift @@ -54,10 +54,6 @@ public class FingerprintProtoLogicalFingerprint: NSObject, Codable, NSSecureCodi } let identityData = proto.identityData - // MARK: - Begin Validation Logic for FingerprintProtoLogicalFingerprint - - - // MARK: - End Validation Logic for FingerprintProtoLogicalFingerprint - - self.init(proto: proto, identityData: identityData) } @@ -235,10 +231,6 @@ public class FingerprintProtoLogicalFingerprints: NSObject, Codable, NSSecureCod } let remoteFingerprint = try FingerprintProtoLogicalFingerprint(proto.remoteFingerprint) - // MARK: - Begin Validation Logic for FingerprintProtoLogicalFingerprints - - - // MARK: - End Validation Logic for FingerprintProtoLogicalFingerprints - - self.init(proto: proto, version: version, localFingerprint: localFingerprint, diff --git a/SignalServiceKit/src/Protos/Generated/GroupsProto.swift b/SignalServiceKit/src/Protos/Generated/GroupsProto.swift index 305ff4b96b..71a710b325 100644 --- a/SignalServiceKit/src/Protos/Generated/GroupsProto.swift +++ b/SignalServiceKit/src/Protos/Generated/GroupsProto.swift @@ -107,14 +107,10 @@ public struct GroupsProtoAvatarUploadAttributes: Codable, CustomDebugStringConve public init(serializedData: Data) throws { let proto = try GroupsProtos_AvatarUploadAttributes(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate init(_ proto: GroupsProtos_AvatarUploadAttributes) throws { - // MARK: - Begin Validation Logic for GroupsProtoAvatarUploadAttributes - - - // MARK: - End Validation Logic for GroupsProtoAvatarUploadAttributes - - + fileprivate init(_ proto: GroupsProtos_AvatarUploadAttributes) { self.init(proto: proto) } @@ -250,7 +246,11 @@ public struct GroupsProtoAvatarUploadAttributesBuilder { } public func build() throws -> GroupsProtoAvatarUploadAttributes { - return try GroupsProtoAvatarUploadAttributes(proto) + return GroupsProtoAvatarUploadAttributes(proto) + } + + public func buildInfallibly() -> GroupsProtoAvatarUploadAttributes { + return GroupsProtoAvatarUploadAttributes(proto) } public func buildSerializedData() throws -> Data { @@ -268,7 +268,7 @@ extension GroupsProtoAvatarUploadAttributes { extension GroupsProtoAvatarUploadAttributesBuilder { public func buildIgnoringErrors() -> GroupsProtoAvatarUploadAttributes? { - return try! self.build() + return self.buildInfallibly() } } @@ -403,14 +403,10 @@ public struct GroupsProtoMember: Codable, CustomDebugStringConvertible { public init(serializedData: Data) throws { let proto = try GroupsProtos_Member(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate init(_ proto: GroupsProtos_Member) throws { - // MARK: - Begin Validation Logic for GroupsProtoMember - - - // MARK: - End Validation Logic for GroupsProtoMember - - + fileprivate init(_ proto: GroupsProtos_Member) { self.init(proto: proto) } @@ -508,7 +504,11 @@ public struct GroupsProtoMemberBuilder { } public func build() throws -> GroupsProtoMember { - return try GroupsProtoMember(proto) + return GroupsProtoMember(proto) + } + + public func buildInfallibly() -> GroupsProtoMember { + return GroupsProtoMember(proto) } public func buildSerializedData() throws -> Data { @@ -526,7 +526,7 @@ extension GroupsProtoMember { extension GroupsProtoMemberBuilder { public func buildIgnoringErrors() -> GroupsProtoMember? { - return try! self.build() + return self.buildInfallibly() } } @@ -577,19 +577,15 @@ public struct GroupsProtoPendingMember: Codable, CustomDebugStringConvertible { public init(serializedData: Data) throws { let proto = try GroupsProtos_PendingMember(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate init(_ proto: GroupsProtos_PendingMember) throws { + fileprivate init(_ proto: GroupsProtos_PendingMember) { var member: GroupsProtoMember? if proto.hasMember { - member = try GroupsProtoMember(proto.member) + member = GroupsProtoMember(proto.member) } - // MARK: - Begin Validation Logic for GroupsProtoPendingMember - - - // MARK: - End Validation Logic for GroupsProtoPendingMember - - self.init(proto: proto, member: member) } @@ -668,7 +664,11 @@ public struct GroupsProtoPendingMemberBuilder { } public func build() throws -> GroupsProtoPendingMember { - return try GroupsProtoPendingMember(proto) + return GroupsProtoPendingMember(proto) + } + + public func buildInfallibly() -> GroupsProtoPendingMember { + return GroupsProtoPendingMember(proto) } public func buildSerializedData() throws -> Data { @@ -686,7 +686,7 @@ extension GroupsProtoPendingMember { extension GroupsProtoPendingMemberBuilder { public func buildIgnoringErrors() -> GroupsProtoPendingMember? { - return try! self.build() + return self.buildInfallibly() } } @@ -753,14 +753,10 @@ public struct GroupsProtoRequestingMember: Codable, CustomDebugStringConvertible public init(serializedData: Data) throws { let proto = try GroupsProtos_RequestingMember(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate init(_ proto: GroupsProtos_RequestingMember) throws { - // MARK: - Begin Validation Logic for GroupsProtoRequestingMember - - - // MARK: - End Validation Logic for GroupsProtoRequestingMember - - + fileprivate init(_ proto: GroupsProtos_RequestingMember) { self.init(proto: proto) } @@ -851,7 +847,11 @@ public struct GroupsProtoRequestingMemberBuilder { } public func build() throws -> GroupsProtoRequestingMember { - return try GroupsProtoRequestingMember(proto) + return GroupsProtoRequestingMember(proto) + } + + public func buildInfallibly() -> GroupsProtoRequestingMember { + return GroupsProtoRequestingMember(proto) } public func buildSerializedData() throws -> Data { @@ -869,7 +869,7 @@ extension GroupsProtoRequestingMember { extension GroupsProtoRequestingMemberBuilder { public func buildIgnoringErrors() -> GroupsProtoRequestingMember? { - return try! self.build() + return self.buildInfallibly() } } @@ -916,14 +916,10 @@ public struct GroupsProtoBannedMember: Codable, CustomDebugStringConvertible { public init(serializedData: Data) throws { let proto = try GroupsProtos_BannedMember(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate init(_ proto: GroupsProtos_BannedMember) throws { - // MARK: - Begin Validation Logic for GroupsProtoBannedMember - - - // MARK: - End Validation Logic for GroupsProtoBannedMember - - + fileprivate init(_ proto: GroupsProtos_BannedMember) { self.init(proto: proto) } @@ -988,7 +984,11 @@ public struct GroupsProtoBannedMemberBuilder { } public func build() throws -> GroupsProtoBannedMember { - return try GroupsProtoBannedMember(proto) + return GroupsProtoBannedMember(proto) + } + + public func buildInfallibly() -> GroupsProtoBannedMember { + return GroupsProtoBannedMember(proto) } public func buildSerializedData() throws -> Data { @@ -1006,7 +1006,7 @@ extension GroupsProtoBannedMember { extension GroupsProtoBannedMemberBuilder { public func buildIgnoringErrors() -> GroupsProtoBannedMember? { - return try! self.build() + return self.buildInfallibly() } } @@ -1150,14 +1150,10 @@ public struct GroupsProtoAccessControl: Codable, CustomDebugStringConvertible { public init(serializedData: Data) throws { let proto = try GroupsProtos_AccessControl(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate init(_ proto: GroupsProtos_AccessControl) throws { - // MARK: - Begin Validation Logic for GroupsProtoAccessControl - - - // MARK: - End Validation Logic for GroupsProtoAccessControl - - + fileprivate init(_ proto: GroupsProtos_AccessControl) { self.init(proto: proto) } @@ -1223,7 +1219,11 @@ public struct GroupsProtoAccessControlBuilder { } public func build() throws -> GroupsProtoAccessControl { - return try GroupsProtoAccessControl(proto) + return GroupsProtoAccessControl(proto) + } + + public func buildInfallibly() -> GroupsProtoAccessControl { + return GroupsProtoAccessControl(proto) } public func buildSerializedData() throws -> Data { @@ -1241,7 +1241,7 @@ extension GroupsProtoAccessControl { extension GroupsProtoAccessControlBuilder { public func buildIgnoringErrors() -> GroupsProtoAccessControl? { - return try! self.build() + return self.buildInfallibly() } } @@ -1365,30 +1365,26 @@ public struct GroupsProtoGroup: Codable, CustomDebugStringConvertible { public init(serializedData: Data) throws { let proto = try GroupsProtos_Group(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate init(_ proto: GroupsProtos_Group) throws { + fileprivate init(_ proto: GroupsProtos_Group) { var accessControl: GroupsProtoAccessControl? if proto.hasAccessControl { - accessControl = try GroupsProtoAccessControl(proto.accessControl) + accessControl = GroupsProtoAccessControl(proto.accessControl) } var members: [GroupsProtoMember] = [] - members = try proto.members.map { try GroupsProtoMember($0) } + members = proto.members.map { GroupsProtoMember($0) } var pendingMembers: [GroupsProtoPendingMember] = [] - pendingMembers = try proto.pendingMembers.map { try GroupsProtoPendingMember($0) } + pendingMembers = proto.pendingMembers.map { GroupsProtoPendingMember($0) } var requestingMembers: [GroupsProtoRequestingMember] = [] - requestingMembers = try proto.requestingMembers.map { try GroupsProtoRequestingMember($0) } + requestingMembers = proto.requestingMembers.map { GroupsProtoRequestingMember($0) } var bannedMembers: [GroupsProtoBannedMember] = [] - bannedMembers = try proto.bannedMembers.map { try GroupsProtoBannedMember($0) } - - // MARK: - Begin Validation Logic for GroupsProtoGroup - - - // MARK: - End Validation Logic for GroupsProtoGroup - + bannedMembers = proto.bannedMembers.map { GroupsProtoBannedMember($0) } self.init(proto: proto, accessControl: accessControl, @@ -1580,7 +1576,11 @@ public struct GroupsProtoGroupBuilder { } public func build() throws -> GroupsProtoGroup { - return try GroupsProtoGroup(proto) + return GroupsProtoGroup(proto) + } + + public func buildInfallibly() -> GroupsProtoGroup { + return GroupsProtoGroup(proto) } public func buildSerializedData() throws -> Data { @@ -1598,7 +1598,7 @@ extension GroupsProtoGroup { extension GroupsProtoGroupBuilder { public func buildIgnoringErrors() -> GroupsProtoGroup? { - return try! self.build() + return self.buildInfallibly() } } @@ -1639,19 +1639,15 @@ public struct GroupsProtoGroupChangeActionsAddMemberAction: Codable, CustomDebug public init(serializedData: Data) throws { let proto = try GroupsProtos_GroupChange.Actions.AddMemberAction(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate init(_ proto: GroupsProtos_GroupChange.Actions.AddMemberAction) throws { + fileprivate init(_ proto: GroupsProtos_GroupChange.Actions.AddMemberAction) { var added: GroupsProtoMember? if proto.hasAdded { - added = try GroupsProtoMember(proto.added) + added = GroupsProtoMember(proto.added) } - // MARK: - Begin Validation Logic for GroupsProtoGroupChangeActionsAddMemberAction - - - // MARK: - End Validation Logic for GroupsProtoGroupChangeActionsAddMemberAction - - self.init(proto: proto, added: added) } @@ -1717,7 +1713,11 @@ public struct GroupsProtoGroupChangeActionsAddMemberActionBuilder { } public func build() throws -> GroupsProtoGroupChangeActionsAddMemberAction { - return try GroupsProtoGroupChangeActionsAddMemberAction(proto) + return GroupsProtoGroupChangeActionsAddMemberAction(proto) + } + + public func buildInfallibly() -> GroupsProtoGroupChangeActionsAddMemberAction { + return GroupsProtoGroupChangeActionsAddMemberAction(proto) } public func buildSerializedData() throws -> Data { @@ -1735,7 +1735,7 @@ extension GroupsProtoGroupChangeActionsAddMemberAction { extension GroupsProtoGroupChangeActionsAddMemberActionBuilder { public func buildIgnoringErrors() -> GroupsProtoGroupChangeActionsAddMemberAction? { - return try! self.build() + return self.buildInfallibly() } } @@ -1775,14 +1775,10 @@ public struct GroupsProtoGroupChangeActionsDeleteMemberAction: Codable, CustomDe public init(serializedData: Data) throws { let proto = try GroupsProtos_GroupChange.Actions.DeleteMemberAction(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate init(_ proto: GroupsProtos_GroupChange.Actions.DeleteMemberAction) throws { - // MARK: - Begin Validation Logic for GroupsProtoGroupChangeActionsDeleteMemberAction - - - // MARK: - End Validation Logic for GroupsProtoGroupChangeActionsDeleteMemberAction - - + fileprivate init(_ proto: GroupsProtos_GroupChange.Actions.DeleteMemberAction) { self.init(proto: proto) } @@ -1840,7 +1836,11 @@ public struct GroupsProtoGroupChangeActionsDeleteMemberActionBuilder { } public func build() throws -> GroupsProtoGroupChangeActionsDeleteMemberAction { - return try GroupsProtoGroupChangeActionsDeleteMemberAction(proto) + return GroupsProtoGroupChangeActionsDeleteMemberAction(proto) + } + + public func buildInfallibly() -> GroupsProtoGroupChangeActionsDeleteMemberAction { + return GroupsProtoGroupChangeActionsDeleteMemberAction(proto) } public func buildSerializedData() throws -> Data { @@ -1858,7 +1858,7 @@ extension GroupsProtoGroupChangeActionsDeleteMemberAction { extension GroupsProtoGroupChangeActionsDeleteMemberActionBuilder { public func buildIgnoringErrors() -> GroupsProtoGroupChangeActionsDeleteMemberAction? { - return try! self.build() + return self.buildInfallibly() } } @@ -1916,14 +1916,10 @@ public struct GroupsProtoGroupChangeActionsModifyMemberRoleAction: Codable, Cust public init(serializedData: Data) throws { let proto = try GroupsProtos_GroupChange.Actions.ModifyMemberRoleAction(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate init(_ proto: GroupsProtos_GroupChange.Actions.ModifyMemberRoleAction) throws { - // MARK: - Begin Validation Logic for GroupsProtoGroupChangeActionsModifyMemberRoleAction - - - // MARK: - End Validation Logic for GroupsProtoGroupChangeActionsModifyMemberRoleAction - - + fileprivate init(_ proto: GroupsProtos_GroupChange.Actions.ModifyMemberRoleAction) { self.init(proto: proto) } @@ -1988,7 +1984,11 @@ public struct GroupsProtoGroupChangeActionsModifyMemberRoleActionBuilder { } public func build() throws -> GroupsProtoGroupChangeActionsModifyMemberRoleAction { - return try GroupsProtoGroupChangeActionsModifyMemberRoleAction(proto) + return GroupsProtoGroupChangeActionsModifyMemberRoleAction(proto) + } + + public func buildInfallibly() -> GroupsProtoGroupChangeActionsModifyMemberRoleAction { + return GroupsProtoGroupChangeActionsModifyMemberRoleAction(proto) } public func buildSerializedData() throws -> Data { @@ -2006,7 +2006,7 @@ extension GroupsProtoGroupChangeActionsModifyMemberRoleAction { extension GroupsProtoGroupChangeActionsModifyMemberRoleActionBuilder { public func buildIgnoringErrors() -> GroupsProtoGroupChangeActionsModifyMemberRoleAction? { - return try! self.build() + return self.buildInfallibly() } } @@ -2066,14 +2066,10 @@ public struct GroupsProtoGroupChangeActionsModifyMemberProfileKeyAction: Codable public init(serializedData: Data) throws { let proto = try GroupsProtos_GroupChange.Actions.ModifyMemberProfileKeyAction(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate init(_ proto: GroupsProtos_GroupChange.Actions.ModifyMemberProfileKeyAction) throws { - // MARK: - Begin Validation Logic for GroupsProtoGroupChangeActionsModifyMemberProfileKeyAction - - - // MARK: - End Validation Logic for GroupsProtoGroupChangeActionsModifyMemberProfileKeyAction - - + fileprivate init(_ proto: GroupsProtos_GroupChange.Actions.ModifyMemberProfileKeyAction) { self.init(proto: proto) } @@ -2157,7 +2153,11 @@ public struct GroupsProtoGroupChangeActionsModifyMemberProfileKeyActionBuilder { } public func build() throws -> GroupsProtoGroupChangeActionsModifyMemberProfileKeyAction { - return try GroupsProtoGroupChangeActionsModifyMemberProfileKeyAction(proto) + return GroupsProtoGroupChangeActionsModifyMemberProfileKeyAction(proto) + } + + public func buildInfallibly() -> GroupsProtoGroupChangeActionsModifyMemberProfileKeyAction { + return GroupsProtoGroupChangeActionsModifyMemberProfileKeyAction(proto) } public func buildSerializedData() throws -> Data { @@ -2175,7 +2175,7 @@ extension GroupsProtoGroupChangeActionsModifyMemberProfileKeyAction { extension GroupsProtoGroupChangeActionsModifyMemberProfileKeyActionBuilder { public func buildIgnoringErrors() -> GroupsProtoGroupChangeActionsModifyMemberProfileKeyAction? { - return try! self.build() + return self.buildInfallibly() } } @@ -2209,19 +2209,15 @@ public struct GroupsProtoGroupChangeActionsAddPendingMemberAction: Codable, Cust public init(serializedData: Data) throws { let proto = try GroupsProtos_GroupChange.Actions.AddPendingMemberAction(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate init(_ proto: GroupsProtos_GroupChange.Actions.AddPendingMemberAction) throws { + fileprivate init(_ proto: GroupsProtos_GroupChange.Actions.AddPendingMemberAction) { var added: GroupsProtoPendingMember? if proto.hasAdded { - added = try GroupsProtoPendingMember(proto.added) + added = GroupsProtoPendingMember(proto.added) } - // MARK: - Begin Validation Logic for GroupsProtoGroupChangeActionsAddPendingMemberAction - - - // MARK: - End Validation Logic for GroupsProtoGroupChangeActionsAddPendingMemberAction - - self.init(proto: proto, added: added) } @@ -2280,7 +2276,11 @@ public struct GroupsProtoGroupChangeActionsAddPendingMemberActionBuilder { } public func build() throws -> GroupsProtoGroupChangeActionsAddPendingMemberAction { - return try GroupsProtoGroupChangeActionsAddPendingMemberAction(proto) + return GroupsProtoGroupChangeActionsAddPendingMemberAction(proto) + } + + public func buildInfallibly() -> GroupsProtoGroupChangeActionsAddPendingMemberAction { + return GroupsProtoGroupChangeActionsAddPendingMemberAction(proto) } public func buildSerializedData() throws -> Data { @@ -2298,7 +2298,7 @@ extension GroupsProtoGroupChangeActionsAddPendingMemberAction { extension GroupsProtoGroupChangeActionsAddPendingMemberActionBuilder { public func buildIgnoringErrors() -> GroupsProtoGroupChangeActionsAddPendingMemberAction? { - return try! self.build() + return self.buildInfallibly() } } @@ -2338,14 +2338,10 @@ public struct GroupsProtoGroupChangeActionsDeletePendingMemberAction: Codable, C public init(serializedData: Data) throws { let proto = try GroupsProtos_GroupChange.Actions.DeletePendingMemberAction(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate init(_ proto: GroupsProtos_GroupChange.Actions.DeletePendingMemberAction) throws { - // MARK: - Begin Validation Logic for GroupsProtoGroupChangeActionsDeletePendingMemberAction - - - // MARK: - End Validation Logic for GroupsProtoGroupChangeActionsDeletePendingMemberAction - - + fileprivate init(_ proto: GroupsProtos_GroupChange.Actions.DeletePendingMemberAction) { self.init(proto: proto) } @@ -2403,7 +2399,11 @@ public struct GroupsProtoGroupChangeActionsDeletePendingMemberActionBuilder { } public func build() throws -> GroupsProtoGroupChangeActionsDeletePendingMemberAction { - return try GroupsProtoGroupChangeActionsDeletePendingMemberAction(proto) + return GroupsProtoGroupChangeActionsDeletePendingMemberAction(proto) + } + + public func buildInfallibly() -> GroupsProtoGroupChangeActionsDeletePendingMemberAction { + return GroupsProtoGroupChangeActionsDeletePendingMemberAction(proto) } public func buildSerializedData() throws -> Data { @@ -2421,7 +2421,7 @@ extension GroupsProtoGroupChangeActionsDeletePendingMemberAction { extension GroupsProtoGroupChangeActionsDeletePendingMemberActionBuilder { public func buildIgnoringErrors() -> GroupsProtoGroupChangeActionsDeletePendingMemberAction? { - return try! self.build() + return self.buildInfallibly() } } @@ -2481,14 +2481,10 @@ public struct GroupsProtoGroupChangeActionsPromotePendingMemberAction: Codable, public init(serializedData: Data) throws { let proto = try GroupsProtos_GroupChange.Actions.PromotePendingMemberAction(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate init(_ proto: GroupsProtos_GroupChange.Actions.PromotePendingMemberAction) throws { - // MARK: - Begin Validation Logic for GroupsProtoGroupChangeActionsPromotePendingMemberAction - - - // MARK: - End Validation Logic for GroupsProtoGroupChangeActionsPromotePendingMemberAction - - + fileprivate init(_ proto: GroupsProtos_GroupChange.Actions.PromotePendingMemberAction) { self.init(proto: proto) } @@ -2572,7 +2568,11 @@ public struct GroupsProtoGroupChangeActionsPromotePendingMemberActionBuilder { } public func build() throws -> GroupsProtoGroupChangeActionsPromotePendingMemberAction { - return try GroupsProtoGroupChangeActionsPromotePendingMemberAction(proto) + return GroupsProtoGroupChangeActionsPromotePendingMemberAction(proto) + } + + public func buildInfallibly() -> GroupsProtoGroupChangeActionsPromotePendingMemberAction { + return GroupsProtoGroupChangeActionsPromotePendingMemberAction(proto) } public func buildSerializedData() throws -> Data { @@ -2590,7 +2590,7 @@ extension GroupsProtoGroupChangeActionsPromotePendingMemberAction { extension GroupsProtoGroupChangeActionsPromotePendingMemberActionBuilder { public func buildIgnoringErrors() -> GroupsProtoGroupChangeActionsPromotePendingMemberAction? { - return try! self.build() + return self.buildInfallibly() } } @@ -2624,19 +2624,15 @@ public struct GroupsProtoGroupChangeActionsAddRequestingMemberAction: Codable, C public init(serializedData: Data) throws { let proto = try GroupsProtos_GroupChange.Actions.AddRequestingMemberAction(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate init(_ proto: GroupsProtos_GroupChange.Actions.AddRequestingMemberAction) throws { + fileprivate init(_ proto: GroupsProtos_GroupChange.Actions.AddRequestingMemberAction) { var added: GroupsProtoRequestingMember? if proto.hasAdded { - added = try GroupsProtoRequestingMember(proto.added) + added = GroupsProtoRequestingMember(proto.added) } - // MARK: - Begin Validation Logic for GroupsProtoGroupChangeActionsAddRequestingMemberAction - - - // MARK: - End Validation Logic for GroupsProtoGroupChangeActionsAddRequestingMemberAction - - self.init(proto: proto, added: added) } @@ -2695,7 +2691,11 @@ public struct GroupsProtoGroupChangeActionsAddRequestingMemberActionBuilder { } public func build() throws -> GroupsProtoGroupChangeActionsAddRequestingMemberAction { - return try GroupsProtoGroupChangeActionsAddRequestingMemberAction(proto) + return GroupsProtoGroupChangeActionsAddRequestingMemberAction(proto) + } + + public func buildInfallibly() -> GroupsProtoGroupChangeActionsAddRequestingMemberAction { + return GroupsProtoGroupChangeActionsAddRequestingMemberAction(proto) } public func buildSerializedData() throws -> Data { @@ -2713,7 +2713,7 @@ extension GroupsProtoGroupChangeActionsAddRequestingMemberAction { extension GroupsProtoGroupChangeActionsAddRequestingMemberActionBuilder { public func buildIgnoringErrors() -> GroupsProtoGroupChangeActionsAddRequestingMemberAction? { - return try! self.build() + return self.buildInfallibly() } } @@ -2753,14 +2753,10 @@ public struct GroupsProtoGroupChangeActionsDeleteRequestingMemberAction: Codable public init(serializedData: Data) throws { let proto = try GroupsProtos_GroupChange.Actions.DeleteRequestingMemberAction(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate init(_ proto: GroupsProtos_GroupChange.Actions.DeleteRequestingMemberAction) throws { - // MARK: - Begin Validation Logic for GroupsProtoGroupChangeActionsDeleteRequestingMemberAction - - - // MARK: - End Validation Logic for GroupsProtoGroupChangeActionsDeleteRequestingMemberAction - - + fileprivate init(_ proto: GroupsProtos_GroupChange.Actions.DeleteRequestingMemberAction) { self.init(proto: proto) } @@ -2818,7 +2814,11 @@ public struct GroupsProtoGroupChangeActionsDeleteRequestingMemberActionBuilder { } public func build() throws -> GroupsProtoGroupChangeActionsDeleteRequestingMemberAction { - return try GroupsProtoGroupChangeActionsDeleteRequestingMemberAction(proto) + return GroupsProtoGroupChangeActionsDeleteRequestingMemberAction(proto) + } + + public func buildInfallibly() -> GroupsProtoGroupChangeActionsDeleteRequestingMemberAction { + return GroupsProtoGroupChangeActionsDeleteRequestingMemberAction(proto) } public func buildSerializedData() throws -> Data { @@ -2836,7 +2836,7 @@ extension GroupsProtoGroupChangeActionsDeleteRequestingMemberAction { extension GroupsProtoGroupChangeActionsDeleteRequestingMemberActionBuilder { public func buildIgnoringErrors() -> GroupsProtoGroupChangeActionsDeleteRequestingMemberAction? { - return try! self.build() + return self.buildInfallibly() } } @@ -2894,14 +2894,10 @@ public struct GroupsProtoGroupChangeActionsPromoteRequestingMemberAction: Codabl public init(serializedData: Data) throws { let proto = try GroupsProtos_GroupChange.Actions.PromoteRequestingMemberAction(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate init(_ proto: GroupsProtos_GroupChange.Actions.PromoteRequestingMemberAction) throws { - // MARK: - Begin Validation Logic for GroupsProtoGroupChangeActionsPromoteRequestingMemberAction - - - // MARK: - End Validation Logic for GroupsProtoGroupChangeActionsPromoteRequestingMemberAction - - + fileprivate init(_ proto: GroupsProtos_GroupChange.Actions.PromoteRequestingMemberAction) { self.init(proto: proto) } @@ -2966,7 +2962,11 @@ public struct GroupsProtoGroupChangeActionsPromoteRequestingMemberActionBuilder } public func build() throws -> GroupsProtoGroupChangeActionsPromoteRequestingMemberAction { - return try GroupsProtoGroupChangeActionsPromoteRequestingMemberAction(proto) + return GroupsProtoGroupChangeActionsPromoteRequestingMemberAction(proto) + } + + public func buildInfallibly() -> GroupsProtoGroupChangeActionsPromoteRequestingMemberAction { + return GroupsProtoGroupChangeActionsPromoteRequestingMemberAction(proto) } public func buildSerializedData() throws -> Data { @@ -2984,7 +2984,7 @@ extension GroupsProtoGroupChangeActionsPromoteRequestingMemberAction { extension GroupsProtoGroupChangeActionsPromoteRequestingMemberActionBuilder { public func buildIgnoringErrors() -> GroupsProtoGroupChangeActionsPromoteRequestingMemberAction? { - return try! self.build() + return self.buildInfallibly() } } @@ -3018,19 +3018,15 @@ public struct GroupsProtoGroupChangeActionsAddBannedMemberAction: Codable, Custo public init(serializedData: Data) throws { let proto = try GroupsProtos_GroupChange.Actions.AddBannedMemberAction(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate init(_ proto: GroupsProtos_GroupChange.Actions.AddBannedMemberAction) throws { + fileprivate init(_ proto: GroupsProtos_GroupChange.Actions.AddBannedMemberAction) { var added: GroupsProtoBannedMember? if proto.hasAdded { - added = try GroupsProtoBannedMember(proto.added) + added = GroupsProtoBannedMember(proto.added) } - // MARK: - Begin Validation Logic for GroupsProtoGroupChangeActionsAddBannedMemberAction - - - // MARK: - End Validation Logic for GroupsProtoGroupChangeActionsAddBannedMemberAction - - self.init(proto: proto, added: added) } @@ -3089,7 +3085,11 @@ public struct GroupsProtoGroupChangeActionsAddBannedMemberActionBuilder { } public func build() throws -> GroupsProtoGroupChangeActionsAddBannedMemberAction { - return try GroupsProtoGroupChangeActionsAddBannedMemberAction(proto) + return GroupsProtoGroupChangeActionsAddBannedMemberAction(proto) + } + + public func buildInfallibly() -> GroupsProtoGroupChangeActionsAddBannedMemberAction { + return GroupsProtoGroupChangeActionsAddBannedMemberAction(proto) } public func buildSerializedData() throws -> Data { @@ -3107,7 +3107,7 @@ extension GroupsProtoGroupChangeActionsAddBannedMemberAction { extension GroupsProtoGroupChangeActionsAddBannedMemberActionBuilder { public func buildIgnoringErrors() -> GroupsProtoGroupChangeActionsAddBannedMemberAction? { - return try! self.build() + return self.buildInfallibly() } } @@ -3147,14 +3147,10 @@ public struct GroupsProtoGroupChangeActionsDeleteBannedMemberAction: Codable, Cu public init(serializedData: Data) throws { let proto = try GroupsProtos_GroupChange.Actions.DeleteBannedMemberAction(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate init(_ proto: GroupsProtos_GroupChange.Actions.DeleteBannedMemberAction) throws { - // MARK: - Begin Validation Logic for GroupsProtoGroupChangeActionsDeleteBannedMemberAction - - - // MARK: - End Validation Logic for GroupsProtoGroupChangeActionsDeleteBannedMemberAction - - + fileprivate init(_ proto: GroupsProtos_GroupChange.Actions.DeleteBannedMemberAction) { self.init(proto: proto) } @@ -3212,7 +3208,11 @@ public struct GroupsProtoGroupChangeActionsDeleteBannedMemberActionBuilder { } public func build() throws -> GroupsProtoGroupChangeActionsDeleteBannedMemberAction { - return try GroupsProtoGroupChangeActionsDeleteBannedMemberAction(proto) + return GroupsProtoGroupChangeActionsDeleteBannedMemberAction(proto) + } + + public func buildInfallibly() -> GroupsProtoGroupChangeActionsDeleteBannedMemberAction { + return GroupsProtoGroupChangeActionsDeleteBannedMemberAction(proto) } public func buildSerializedData() throws -> Data { @@ -3230,7 +3230,7 @@ extension GroupsProtoGroupChangeActionsDeleteBannedMemberAction { extension GroupsProtoGroupChangeActionsDeleteBannedMemberActionBuilder { public func buildIgnoringErrors() -> GroupsProtoGroupChangeActionsDeleteBannedMemberAction? { - return try! self.build() + return self.buildInfallibly() } } @@ -3270,14 +3270,10 @@ public struct GroupsProtoGroupChangeActionsModifyTitleAction: Codable, CustomDeb public init(serializedData: Data) throws { let proto = try GroupsProtos_GroupChange.Actions.ModifyTitleAction(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate init(_ proto: GroupsProtos_GroupChange.Actions.ModifyTitleAction) throws { - // MARK: - Begin Validation Logic for GroupsProtoGroupChangeActionsModifyTitleAction - - - // MARK: - End Validation Logic for GroupsProtoGroupChangeActionsModifyTitleAction - - + fileprivate init(_ proto: GroupsProtos_GroupChange.Actions.ModifyTitleAction) { self.init(proto: proto) } @@ -3335,7 +3331,11 @@ public struct GroupsProtoGroupChangeActionsModifyTitleActionBuilder { } public func build() throws -> GroupsProtoGroupChangeActionsModifyTitleAction { - return try GroupsProtoGroupChangeActionsModifyTitleAction(proto) + return GroupsProtoGroupChangeActionsModifyTitleAction(proto) + } + + public func buildInfallibly() -> GroupsProtoGroupChangeActionsModifyTitleAction { + return GroupsProtoGroupChangeActionsModifyTitleAction(proto) } public func buildSerializedData() throws -> Data { @@ -3353,7 +3353,7 @@ extension GroupsProtoGroupChangeActionsModifyTitleAction { extension GroupsProtoGroupChangeActionsModifyTitleActionBuilder { public func buildIgnoringErrors() -> GroupsProtoGroupChangeActionsModifyTitleAction? { - return try! self.build() + return self.buildInfallibly() } } @@ -3393,14 +3393,10 @@ public struct GroupsProtoGroupChangeActionsModifyAvatarAction: Codable, CustomDe public init(serializedData: Data) throws { let proto = try GroupsProtos_GroupChange.Actions.ModifyAvatarAction(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate init(_ proto: GroupsProtos_GroupChange.Actions.ModifyAvatarAction) throws { - // MARK: - Begin Validation Logic for GroupsProtoGroupChangeActionsModifyAvatarAction - - - // MARK: - End Validation Logic for GroupsProtoGroupChangeActionsModifyAvatarAction - - + fileprivate init(_ proto: GroupsProtos_GroupChange.Actions.ModifyAvatarAction) { self.init(proto: proto) } @@ -3458,7 +3454,11 @@ public struct GroupsProtoGroupChangeActionsModifyAvatarActionBuilder { } public func build() throws -> GroupsProtoGroupChangeActionsModifyAvatarAction { - return try GroupsProtoGroupChangeActionsModifyAvatarAction(proto) + return GroupsProtoGroupChangeActionsModifyAvatarAction(proto) + } + + public func buildInfallibly() -> GroupsProtoGroupChangeActionsModifyAvatarAction { + return GroupsProtoGroupChangeActionsModifyAvatarAction(proto) } public func buildSerializedData() throws -> Data { @@ -3476,7 +3476,7 @@ extension GroupsProtoGroupChangeActionsModifyAvatarAction { extension GroupsProtoGroupChangeActionsModifyAvatarActionBuilder { public func buildIgnoringErrors() -> GroupsProtoGroupChangeActionsModifyAvatarAction? { - return try! self.build() + return self.buildInfallibly() } } @@ -3516,14 +3516,10 @@ public struct GroupsProtoGroupChangeActionsModifyDisappearingMessagesTimerAction public init(serializedData: Data) throws { let proto = try GroupsProtos_GroupChange.Actions.ModifyDisappearingMessagesTimerAction(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate init(_ proto: GroupsProtos_GroupChange.Actions.ModifyDisappearingMessagesTimerAction) throws { - // MARK: - Begin Validation Logic for GroupsProtoGroupChangeActionsModifyDisappearingMessagesTimerAction - - - // MARK: - End Validation Logic for GroupsProtoGroupChangeActionsModifyDisappearingMessagesTimerAction - - + fileprivate init(_ proto: GroupsProtos_GroupChange.Actions.ModifyDisappearingMessagesTimerAction) { self.init(proto: proto) } @@ -3581,7 +3577,11 @@ public struct GroupsProtoGroupChangeActionsModifyDisappearingMessagesTimerAction } public func build() throws -> GroupsProtoGroupChangeActionsModifyDisappearingMessagesTimerAction { - return try GroupsProtoGroupChangeActionsModifyDisappearingMessagesTimerAction(proto) + return GroupsProtoGroupChangeActionsModifyDisappearingMessagesTimerAction(proto) + } + + public func buildInfallibly() -> GroupsProtoGroupChangeActionsModifyDisappearingMessagesTimerAction { + return GroupsProtoGroupChangeActionsModifyDisappearingMessagesTimerAction(proto) } public func buildSerializedData() throws -> Data { @@ -3599,7 +3599,7 @@ extension GroupsProtoGroupChangeActionsModifyDisappearingMessagesTimerAction { extension GroupsProtoGroupChangeActionsModifyDisappearingMessagesTimerActionBuilder { public func buildIgnoringErrors() -> GroupsProtoGroupChangeActionsModifyDisappearingMessagesTimerAction? { - return try! self.build() + return self.buildInfallibly() } } @@ -3647,14 +3647,10 @@ public struct GroupsProtoGroupChangeActionsModifyAttributesAccessControlAction: public init(serializedData: Data) throws { let proto = try GroupsProtos_GroupChange.Actions.ModifyAttributesAccessControlAction(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate init(_ proto: GroupsProtos_GroupChange.Actions.ModifyAttributesAccessControlAction) throws { - // MARK: - Begin Validation Logic for GroupsProtoGroupChangeActionsModifyAttributesAccessControlAction - - - // MARK: - End Validation Logic for GroupsProtoGroupChangeActionsModifyAttributesAccessControlAction - - + fileprivate init(_ proto: GroupsProtos_GroupChange.Actions.ModifyAttributesAccessControlAction) { self.init(proto: proto) } @@ -3706,7 +3702,11 @@ public struct GroupsProtoGroupChangeActionsModifyAttributesAccessControlActionBu } public func build() throws -> GroupsProtoGroupChangeActionsModifyAttributesAccessControlAction { - return try GroupsProtoGroupChangeActionsModifyAttributesAccessControlAction(proto) + return GroupsProtoGroupChangeActionsModifyAttributesAccessControlAction(proto) + } + + public func buildInfallibly() -> GroupsProtoGroupChangeActionsModifyAttributesAccessControlAction { + return GroupsProtoGroupChangeActionsModifyAttributesAccessControlAction(proto) } public func buildSerializedData() throws -> Data { @@ -3724,7 +3724,7 @@ extension GroupsProtoGroupChangeActionsModifyAttributesAccessControlAction { extension GroupsProtoGroupChangeActionsModifyAttributesAccessControlActionBuilder { public func buildIgnoringErrors() -> GroupsProtoGroupChangeActionsModifyAttributesAccessControlAction? { - return try! self.build() + return self.buildInfallibly() } } @@ -3772,14 +3772,10 @@ public struct GroupsProtoGroupChangeActionsModifyAvatarAccessControlAction: Coda public init(serializedData: Data) throws { let proto = try GroupsProtos_GroupChange.Actions.ModifyAvatarAccessControlAction(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate init(_ proto: GroupsProtos_GroupChange.Actions.ModifyAvatarAccessControlAction) throws { - // MARK: - Begin Validation Logic for GroupsProtoGroupChangeActionsModifyAvatarAccessControlAction - - - // MARK: - End Validation Logic for GroupsProtoGroupChangeActionsModifyAvatarAccessControlAction - - + fileprivate init(_ proto: GroupsProtos_GroupChange.Actions.ModifyAvatarAccessControlAction) { self.init(proto: proto) } @@ -3831,7 +3827,11 @@ public struct GroupsProtoGroupChangeActionsModifyAvatarAccessControlActionBuilde } public func build() throws -> GroupsProtoGroupChangeActionsModifyAvatarAccessControlAction { - return try GroupsProtoGroupChangeActionsModifyAvatarAccessControlAction(proto) + return GroupsProtoGroupChangeActionsModifyAvatarAccessControlAction(proto) + } + + public func buildInfallibly() -> GroupsProtoGroupChangeActionsModifyAvatarAccessControlAction { + return GroupsProtoGroupChangeActionsModifyAvatarAccessControlAction(proto) } public func buildSerializedData() throws -> Data { @@ -3849,7 +3849,7 @@ extension GroupsProtoGroupChangeActionsModifyAvatarAccessControlAction { extension GroupsProtoGroupChangeActionsModifyAvatarAccessControlActionBuilder { public func buildIgnoringErrors() -> GroupsProtoGroupChangeActionsModifyAvatarAccessControlAction? { - return try! self.build() + return self.buildInfallibly() } } @@ -3897,14 +3897,10 @@ public struct GroupsProtoGroupChangeActionsModifyMembersAccessControlAction: Cod public init(serializedData: Data) throws { let proto = try GroupsProtos_GroupChange.Actions.ModifyMembersAccessControlAction(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate init(_ proto: GroupsProtos_GroupChange.Actions.ModifyMembersAccessControlAction) throws { - // MARK: - Begin Validation Logic for GroupsProtoGroupChangeActionsModifyMembersAccessControlAction - - - // MARK: - End Validation Logic for GroupsProtoGroupChangeActionsModifyMembersAccessControlAction - - + fileprivate init(_ proto: GroupsProtos_GroupChange.Actions.ModifyMembersAccessControlAction) { self.init(proto: proto) } @@ -3956,7 +3952,11 @@ public struct GroupsProtoGroupChangeActionsModifyMembersAccessControlActionBuild } public func build() throws -> GroupsProtoGroupChangeActionsModifyMembersAccessControlAction { - return try GroupsProtoGroupChangeActionsModifyMembersAccessControlAction(proto) + return GroupsProtoGroupChangeActionsModifyMembersAccessControlAction(proto) + } + + public func buildInfallibly() -> GroupsProtoGroupChangeActionsModifyMembersAccessControlAction { + return GroupsProtoGroupChangeActionsModifyMembersAccessControlAction(proto) } public func buildSerializedData() throws -> Data { @@ -3974,7 +3974,7 @@ extension GroupsProtoGroupChangeActionsModifyMembersAccessControlAction { extension GroupsProtoGroupChangeActionsModifyMembersAccessControlActionBuilder { public func buildIgnoringErrors() -> GroupsProtoGroupChangeActionsModifyMembersAccessControlAction? { - return try! self.build() + return self.buildInfallibly() } } @@ -4022,14 +4022,10 @@ public struct GroupsProtoGroupChangeActionsModifyAddFromInviteLinkAccessControlA public init(serializedData: Data) throws { let proto = try GroupsProtos_GroupChange.Actions.ModifyAddFromInviteLinkAccessControlAction(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate init(_ proto: GroupsProtos_GroupChange.Actions.ModifyAddFromInviteLinkAccessControlAction) throws { - // MARK: - Begin Validation Logic for GroupsProtoGroupChangeActionsModifyAddFromInviteLinkAccessControlAction - - - // MARK: - End Validation Logic for GroupsProtoGroupChangeActionsModifyAddFromInviteLinkAccessControlAction - - + fileprivate init(_ proto: GroupsProtos_GroupChange.Actions.ModifyAddFromInviteLinkAccessControlAction) { self.init(proto: proto) } @@ -4081,7 +4077,11 @@ public struct GroupsProtoGroupChangeActionsModifyAddFromInviteLinkAccessControlA } public func build() throws -> GroupsProtoGroupChangeActionsModifyAddFromInviteLinkAccessControlAction { - return try GroupsProtoGroupChangeActionsModifyAddFromInviteLinkAccessControlAction(proto) + return GroupsProtoGroupChangeActionsModifyAddFromInviteLinkAccessControlAction(proto) + } + + public func buildInfallibly() -> GroupsProtoGroupChangeActionsModifyAddFromInviteLinkAccessControlAction { + return GroupsProtoGroupChangeActionsModifyAddFromInviteLinkAccessControlAction(proto) } public func buildSerializedData() throws -> Data { @@ -4099,7 +4099,7 @@ extension GroupsProtoGroupChangeActionsModifyAddFromInviteLinkAccessControlActio extension GroupsProtoGroupChangeActionsModifyAddFromInviteLinkAccessControlActionBuilder { public func buildIgnoringErrors() -> GroupsProtoGroupChangeActionsModifyAddFromInviteLinkAccessControlAction? { - return try! self.build() + return self.buildInfallibly() } } @@ -4139,14 +4139,10 @@ public struct GroupsProtoGroupChangeActionsModifyInviteLinkPasswordAction: Codab public init(serializedData: Data) throws { let proto = try GroupsProtos_GroupChange.Actions.ModifyInviteLinkPasswordAction(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate init(_ proto: GroupsProtos_GroupChange.Actions.ModifyInviteLinkPasswordAction) throws { - // MARK: - Begin Validation Logic for GroupsProtoGroupChangeActionsModifyInviteLinkPasswordAction - - - // MARK: - End Validation Logic for GroupsProtoGroupChangeActionsModifyInviteLinkPasswordAction - - + fileprivate init(_ proto: GroupsProtos_GroupChange.Actions.ModifyInviteLinkPasswordAction) { self.init(proto: proto) } @@ -4204,7 +4200,11 @@ public struct GroupsProtoGroupChangeActionsModifyInviteLinkPasswordActionBuilder } public func build() throws -> GroupsProtoGroupChangeActionsModifyInviteLinkPasswordAction { - return try GroupsProtoGroupChangeActionsModifyInviteLinkPasswordAction(proto) + return GroupsProtoGroupChangeActionsModifyInviteLinkPasswordAction(proto) + } + + public func buildInfallibly() -> GroupsProtoGroupChangeActionsModifyInviteLinkPasswordAction { + return GroupsProtoGroupChangeActionsModifyInviteLinkPasswordAction(proto) } public func buildSerializedData() throws -> Data { @@ -4222,7 +4222,7 @@ extension GroupsProtoGroupChangeActionsModifyInviteLinkPasswordAction { extension GroupsProtoGroupChangeActionsModifyInviteLinkPasswordActionBuilder { public func buildIgnoringErrors() -> GroupsProtoGroupChangeActionsModifyInviteLinkPasswordAction? { - return try! self.build() + return self.buildInfallibly() } } @@ -4262,14 +4262,10 @@ public struct GroupsProtoGroupChangeActionsModifyDescriptionAction: Codable, Cus public init(serializedData: Data) throws { let proto = try GroupsProtos_GroupChange.Actions.ModifyDescriptionAction(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate init(_ proto: GroupsProtos_GroupChange.Actions.ModifyDescriptionAction) throws { - // MARK: - Begin Validation Logic for GroupsProtoGroupChangeActionsModifyDescriptionAction - - - // MARK: - End Validation Logic for GroupsProtoGroupChangeActionsModifyDescriptionAction - - + fileprivate init(_ proto: GroupsProtos_GroupChange.Actions.ModifyDescriptionAction) { self.init(proto: proto) } @@ -4327,7 +4323,11 @@ public struct GroupsProtoGroupChangeActionsModifyDescriptionActionBuilder { } public func build() throws -> GroupsProtoGroupChangeActionsModifyDescriptionAction { - return try GroupsProtoGroupChangeActionsModifyDescriptionAction(proto) + return GroupsProtoGroupChangeActionsModifyDescriptionAction(proto) + } + + public func buildInfallibly() -> GroupsProtoGroupChangeActionsModifyDescriptionAction { + return GroupsProtoGroupChangeActionsModifyDescriptionAction(proto) } public func buildSerializedData() throws -> Data { @@ -4345,7 +4345,7 @@ extension GroupsProtoGroupChangeActionsModifyDescriptionAction { extension GroupsProtoGroupChangeActionsModifyDescriptionActionBuilder { public func buildIgnoringErrors() -> GroupsProtoGroupChangeActionsModifyDescriptionAction? { - return try! self.build() + return self.buildInfallibly() } } @@ -4382,14 +4382,10 @@ public struct GroupsProtoGroupChangeActionsModifyAnnouncementsOnlyAction: Codabl public init(serializedData: Data) throws { let proto = try GroupsProtos_GroupChange.Actions.ModifyAnnouncementsOnlyAction(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate init(_ proto: GroupsProtos_GroupChange.Actions.ModifyAnnouncementsOnlyAction) throws { - // MARK: - Begin Validation Logic for GroupsProtoGroupChangeActionsModifyAnnouncementsOnlyAction - - - // MARK: - End Validation Logic for GroupsProtoGroupChangeActionsModifyAnnouncementsOnlyAction - - + fileprivate init(_ proto: GroupsProtos_GroupChange.Actions.ModifyAnnouncementsOnlyAction) { self.init(proto: proto) } @@ -4441,7 +4437,11 @@ public struct GroupsProtoGroupChangeActionsModifyAnnouncementsOnlyActionBuilder } public func build() throws -> GroupsProtoGroupChangeActionsModifyAnnouncementsOnlyAction { - return try GroupsProtoGroupChangeActionsModifyAnnouncementsOnlyAction(proto) + return GroupsProtoGroupChangeActionsModifyAnnouncementsOnlyAction(proto) + } + + public func buildInfallibly() -> GroupsProtoGroupChangeActionsModifyAnnouncementsOnlyAction { + return GroupsProtoGroupChangeActionsModifyAnnouncementsOnlyAction(proto) } public func buildSerializedData() throws -> Data { @@ -4459,7 +4459,7 @@ extension GroupsProtoGroupChangeActionsModifyAnnouncementsOnlyAction { extension GroupsProtoGroupChangeActionsModifyAnnouncementsOnlyActionBuilder { public func buildIgnoringErrors() -> GroupsProtoGroupChangeActionsModifyAnnouncementsOnlyAction? { - return try! self.build() + return self.buildInfallibly() } } @@ -4590,94 +4590,90 @@ public struct GroupsProtoGroupChangeActions: Codable, CustomDebugStringConvertib public init(serializedData: Data) throws { let proto = try GroupsProtos_GroupChange.Actions(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate init(_ proto: GroupsProtos_GroupChange.Actions) throws { + fileprivate init(_ proto: GroupsProtos_GroupChange.Actions) { var addMembers: [GroupsProtoGroupChangeActionsAddMemberAction] = [] - addMembers = try proto.addMembers.map { try GroupsProtoGroupChangeActionsAddMemberAction($0) } + addMembers = proto.addMembers.map { GroupsProtoGroupChangeActionsAddMemberAction($0) } var deleteMembers: [GroupsProtoGroupChangeActionsDeleteMemberAction] = [] - deleteMembers = try proto.deleteMembers.map { try GroupsProtoGroupChangeActionsDeleteMemberAction($0) } + deleteMembers = proto.deleteMembers.map { GroupsProtoGroupChangeActionsDeleteMemberAction($0) } var modifyMemberRoles: [GroupsProtoGroupChangeActionsModifyMemberRoleAction] = [] - modifyMemberRoles = try proto.modifyMemberRoles.map { try GroupsProtoGroupChangeActionsModifyMemberRoleAction($0) } + modifyMemberRoles = proto.modifyMemberRoles.map { GroupsProtoGroupChangeActionsModifyMemberRoleAction($0) } var modifyMemberProfileKeys: [GroupsProtoGroupChangeActionsModifyMemberProfileKeyAction] = [] - modifyMemberProfileKeys = try proto.modifyMemberProfileKeys.map { try GroupsProtoGroupChangeActionsModifyMemberProfileKeyAction($0) } + modifyMemberProfileKeys = proto.modifyMemberProfileKeys.map { GroupsProtoGroupChangeActionsModifyMemberProfileKeyAction($0) } var addPendingMembers: [GroupsProtoGroupChangeActionsAddPendingMemberAction] = [] - addPendingMembers = try proto.addPendingMembers.map { try GroupsProtoGroupChangeActionsAddPendingMemberAction($0) } + addPendingMembers = proto.addPendingMembers.map { GroupsProtoGroupChangeActionsAddPendingMemberAction($0) } var deletePendingMembers: [GroupsProtoGroupChangeActionsDeletePendingMemberAction] = [] - deletePendingMembers = try proto.deletePendingMembers.map { try GroupsProtoGroupChangeActionsDeletePendingMemberAction($0) } + deletePendingMembers = proto.deletePendingMembers.map { GroupsProtoGroupChangeActionsDeletePendingMemberAction($0) } var promotePendingMembers: [GroupsProtoGroupChangeActionsPromotePendingMemberAction] = [] - promotePendingMembers = try proto.promotePendingMembers.map { try GroupsProtoGroupChangeActionsPromotePendingMemberAction($0) } + promotePendingMembers = proto.promotePendingMembers.map { GroupsProtoGroupChangeActionsPromotePendingMemberAction($0) } var modifyTitle: GroupsProtoGroupChangeActionsModifyTitleAction? if proto.hasModifyTitle { - modifyTitle = try GroupsProtoGroupChangeActionsModifyTitleAction(proto.modifyTitle) + modifyTitle = GroupsProtoGroupChangeActionsModifyTitleAction(proto.modifyTitle) } var modifyAvatar: GroupsProtoGroupChangeActionsModifyAvatarAction? if proto.hasModifyAvatar { - modifyAvatar = try GroupsProtoGroupChangeActionsModifyAvatarAction(proto.modifyAvatar) + modifyAvatar = GroupsProtoGroupChangeActionsModifyAvatarAction(proto.modifyAvatar) } var modifyDisappearingMessagesTimer: GroupsProtoGroupChangeActionsModifyDisappearingMessagesTimerAction? if proto.hasModifyDisappearingMessagesTimer { - modifyDisappearingMessagesTimer = try GroupsProtoGroupChangeActionsModifyDisappearingMessagesTimerAction(proto.modifyDisappearingMessagesTimer) + modifyDisappearingMessagesTimer = GroupsProtoGroupChangeActionsModifyDisappearingMessagesTimerAction(proto.modifyDisappearingMessagesTimer) } var modifyAttributesAccess: GroupsProtoGroupChangeActionsModifyAttributesAccessControlAction? if proto.hasModifyAttributesAccess { - modifyAttributesAccess = try GroupsProtoGroupChangeActionsModifyAttributesAccessControlAction(proto.modifyAttributesAccess) + modifyAttributesAccess = GroupsProtoGroupChangeActionsModifyAttributesAccessControlAction(proto.modifyAttributesAccess) } var modifyMemberAccess: GroupsProtoGroupChangeActionsModifyMembersAccessControlAction? if proto.hasModifyMemberAccess { - modifyMemberAccess = try GroupsProtoGroupChangeActionsModifyMembersAccessControlAction(proto.modifyMemberAccess) + modifyMemberAccess = GroupsProtoGroupChangeActionsModifyMembersAccessControlAction(proto.modifyMemberAccess) } var modifyAddFromInviteLinkAccess: GroupsProtoGroupChangeActionsModifyAddFromInviteLinkAccessControlAction? if proto.hasModifyAddFromInviteLinkAccess { - modifyAddFromInviteLinkAccess = try GroupsProtoGroupChangeActionsModifyAddFromInviteLinkAccessControlAction(proto.modifyAddFromInviteLinkAccess) + modifyAddFromInviteLinkAccess = GroupsProtoGroupChangeActionsModifyAddFromInviteLinkAccessControlAction(proto.modifyAddFromInviteLinkAccess) } var addRequestingMembers: [GroupsProtoGroupChangeActionsAddRequestingMemberAction] = [] - addRequestingMembers = try proto.addRequestingMembers.map { try GroupsProtoGroupChangeActionsAddRequestingMemberAction($0) } + addRequestingMembers = proto.addRequestingMembers.map { GroupsProtoGroupChangeActionsAddRequestingMemberAction($0) } var deleteRequestingMembers: [GroupsProtoGroupChangeActionsDeleteRequestingMemberAction] = [] - deleteRequestingMembers = try proto.deleteRequestingMembers.map { try GroupsProtoGroupChangeActionsDeleteRequestingMemberAction($0) } + deleteRequestingMembers = proto.deleteRequestingMembers.map { GroupsProtoGroupChangeActionsDeleteRequestingMemberAction($0) } var promoteRequestingMembers: [GroupsProtoGroupChangeActionsPromoteRequestingMemberAction] = [] - promoteRequestingMembers = try proto.promoteRequestingMembers.map { try GroupsProtoGroupChangeActionsPromoteRequestingMemberAction($0) } + promoteRequestingMembers = proto.promoteRequestingMembers.map { GroupsProtoGroupChangeActionsPromoteRequestingMemberAction($0) } var modifyInviteLinkPassword: GroupsProtoGroupChangeActionsModifyInviteLinkPasswordAction? if proto.hasModifyInviteLinkPassword { - modifyInviteLinkPassword = try GroupsProtoGroupChangeActionsModifyInviteLinkPasswordAction(proto.modifyInviteLinkPassword) + modifyInviteLinkPassword = GroupsProtoGroupChangeActionsModifyInviteLinkPasswordAction(proto.modifyInviteLinkPassword) } var modifyDescription: GroupsProtoGroupChangeActionsModifyDescriptionAction? if proto.hasModifyDescription { - modifyDescription = try GroupsProtoGroupChangeActionsModifyDescriptionAction(proto.modifyDescription) + modifyDescription = GroupsProtoGroupChangeActionsModifyDescriptionAction(proto.modifyDescription) } var modifyAnnouncementsOnly: GroupsProtoGroupChangeActionsModifyAnnouncementsOnlyAction? if proto.hasModifyAnnouncementsOnly { - modifyAnnouncementsOnly = try GroupsProtoGroupChangeActionsModifyAnnouncementsOnlyAction(proto.modifyAnnouncementsOnly) + modifyAnnouncementsOnly = GroupsProtoGroupChangeActionsModifyAnnouncementsOnlyAction(proto.modifyAnnouncementsOnly) } var addBannedMembers: [GroupsProtoGroupChangeActionsAddBannedMemberAction] = [] - addBannedMembers = try proto.addBannedMembers.map { try GroupsProtoGroupChangeActionsAddBannedMemberAction($0) } + addBannedMembers = proto.addBannedMembers.map { GroupsProtoGroupChangeActionsAddBannedMemberAction($0) } var deleteBannedMembers: [GroupsProtoGroupChangeActionsDeleteBannedMemberAction] = [] - deleteBannedMembers = try proto.deleteBannedMembers.map { try GroupsProtoGroupChangeActionsDeleteBannedMemberAction($0) } - - // MARK: - Begin Validation Logic for GroupsProtoGroupChangeActions - - - // MARK: - End Validation Logic for GroupsProtoGroupChangeActions - + deleteBannedMembers = proto.deleteBannedMembers.map { GroupsProtoGroupChangeActionsDeleteBannedMemberAction($0) } self.init(proto: proto, addMembers: addMembers, @@ -4989,7 +4985,11 @@ public struct GroupsProtoGroupChangeActionsBuilder { } public func build() throws -> GroupsProtoGroupChangeActions { - return try GroupsProtoGroupChangeActions(proto) + return GroupsProtoGroupChangeActions(proto) + } + + public func buildInfallibly() -> GroupsProtoGroupChangeActions { + return GroupsProtoGroupChangeActions(proto) } public func buildSerializedData() throws -> Data { @@ -5007,7 +5007,7 @@ extension GroupsProtoGroupChangeActions { extension GroupsProtoGroupChangeActionsBuilder { public func buildIgnoringErrors() -> GroupsProtoGroupChangeActions? { - return try! self.build() + return self.buildInfallibly() } } @@ -5064,14 +5064,10 @@ public struct GroupsProtoGroupChange: Codable, CustomDebugStringConvertible { public init(serializedData: Data) throws { let proto = try GroupsProtos_GroupChange(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate init(_ proto: GroupsProtos_GroupChange) throws { - // MARK: - Begin Validation Logic for GroupsProtoGroupChange - - - // MARK: - End Validation Logic for GroupsProtoGroupChange - - + fileprivate init(_ proto: GroupsProtos_GroupChange) { self.init(proto: proto) } @@ -5149,7 +5145,11 @@ public struct GroupsProtoGroupChangeBuilder { } public func build() throws -> GroupsProtoGroupChange { - return try GroupsProtoGroupChange(proto) + return GroupsProtoGroupChange(proto) + } + + public func buildInfallibly() -> GroupsProtoGroupChange { + return GroupsProtoGroupChange(proto) } public func buildSerializedData() throws -> Data { @@ -5167,7 +5167,7 @@ extension GroupsProtoGroupChange { extension GroupsProtoGroupChangeBuilder { public func buildIgnoringErrors() -> GroupsProtoGroupChange? { - return try! self.build() + return self.buildInfallibly() } } @@ -5205,24 +5205,20 @@ public struct GroupsProtoGroupChangesGroupChangeState: Codable, CustomDebugStrin public init(serializedData: Data) throws { let proto = try GroupsProtos_GroupChanges.GroupChangeState(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate init(_ proto: GroupsProtos_GroupChanges.GroupChangeState) throws { + fileprivate init(_ proto: GroupsProtos_GroupChanges.GroupChangeState) { var groupChange: GroupsProtoGroupChange? if proto.hasGroupChange { - groupChange = try GroupsProtoGroupChange(proto.groupChange) + groupChange = GroupsProtoGroupChange(proto.groupChange) } var groupState: GroupsProtoGroup? if proto.hasGroupState { - groupState = try GroupsProtoGroup(proto.groupState) + groupState = GroupsProtoGroup(proto.groupState) } - // MARK: - Begin Validation Logic for GroupsProtoGroupChangesGroupChangeState - - - // MARK: - End Validation Logic for GroupsProtoGroupChangesGroupChangeState - - self.init(proto: proto, groupChange: groupChange, groupState: groupState) @@ -5295,7 +5291,11 @@ public struct GroupsProtoGroupChangesGroupChangeStateBuilder { } public func build() throws -> GroupsProtoGroupChangesGroupChangeState { - return try GroupsProtoGroupChangesGroupChangeState(proto) + return GroupsProtoGroupChangesGroupChangeState(proto) + } + + public func buildInfallibly() -> GroupsProtoGroupChangesGroupChangeState { + return GroupsProtoGroupChangesGroupChangeState(proto) } public func buildSerializedData() throws -> Data { @@ -5313,7 +5313,7 @@ extension GroupsProtoGroupChangesGroupChangeState { extension GroupsProtoGroupChangesGroupChangeStateBuilder { public func buildIgnoringErrors() -> GroupsProtoGroupChangesGroupChangeState? { - return try! self.build() + return self.buildInfallibly() } } @@ -5347,14 +5347,10 @@ public struct GroupsProtoGroupChanges: Codable, CustomDebugStringConvertible { public init(serializedData: Data) throws { let proto = try GroupsProtos_GroupChanges(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate init(_ proto: GroupsProtos_GroupChanges) throws { - // MARK: - Begin Validation Logic for GroupsProtoGroupChanges - - - // MARK: - End Validation Logic for GroupsProtoGroupChanges - - + fileprivate init(_ proto: GroupsProtos_GroupChanges) { self.init(proto: proto) } @@ -5408,7 +5404,11 @@ public struct GroupsProtoGroupChangesBuilder { } public func build() throws -> GroupsProtoGroupChanges { - return try GroupsProtoGroupChanges(proto) + return GroupsProtoGroupChanges(proto) + } + + public func buildInfallibly() -> GroupsProtoGroupChanges { + return GroupsProtoGroupChanges(proto) } public func buildSerializedData() throws -> Data { @@ -5426,7 +5426,7 @@ extension GroupsProtoGroupChanges { extension GroupsProtoGroupChangesBuilder { public func buildIgnoringErrors() -> GroupsProtoGroupChanges? { - return try! self.build() + return self.buildInfallibly() } } @@ -5501,14 +5501,10 @@ public struct GroupsProtoGroupAttributeBlob: Codable, CustomDebugStringConvertib public init(serializedData: Data) throws { let proto = try GroupsProtos_GroupAttributeBlob(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate init(_ proto: GroupsProtos_GroupAttributeBlob) throws { - // MARK: - Begin Validation Logic for GroupsProtoGroupAttributeBlob - - - // MARK: - End Validation Logic for GroupsProtoGroupAttributeBlob - - + fileprivate init(_ proto: GroupsProtos_GroupAttributeBlob) { self.init(proto: proto) } @@ -5566,7 +5562,11 @@ public struct GroupsProtoGroupAttributeBlobBuilder { } public func build() throws -> GroupsProtoGroupAttributeBlob { - return try GroupsProtoGroupAttributeBlob(proto) + return GroupsProtoGroupAttributeBlob(proto) + } + + public func buildInfallibly() -> GroupsProtoGroupAttributeBlob { + return GroupsProtoGroupAttributeBlob(proto) } public func buildSerializedData() throws -> Data { @@ -5584,7 +5584,7 @@ extension GroupsProtoGroupAttributeBlob { extension GroupsProtoGroupAttributeBlobBuilder { public func buildIgnoringErrors() -> GroupsProtoGroupAttributeBlob? { - return try! self.build() + return self.buildInfallibly() } } @@ -5634,14 +5634,10 @@ public struct GroupsProtoGroupInviteLinkGroupInviteLinkContentsV1: Codable, Cust public init(serializedData: Data) throws { let proto = try GroupsProtos_GroupInviteLink.GroupInviteLinkContentsV1(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate init(_ proto: GroupsProtos_GroupInviteLink.GroupInviteLinkContentsV1) throws { - // MARK: - Begin Validation Logic for GroupsProtoGroupInviteLinkGroupInviteLinkContentsV1 - - - // MARK: - End Validation Logic for GroupsProtoGroupInviteLinkGroupInviteLinkContentsV1 - - + fileprivate init(_ proto: GroupsProtos_GroupInviteLink.GroupInviteLinkContentsV1) { self.init(proto: proto) } @@ -5712,7 +5708,11 @@ public struct GroupsProtoGroupInviteLinkGroupInviteLinkContentsV1Builder { } public func build() throws -> GroupsProtoGroupInviteLinkGroupInviteLinkContentsV1 { - return try GroupsProtoGroupInviteLinkGroupInviteLinkContentsV1(proto) + return GroupsProtoGroupInviteLinkGroupInviteLinkContentsV1(proto) + } + + public func buildInfallibly() -> GroupsProtoGroupInviteLinkGroupInviteLinkContentsV1 { + return GroupsProtoGroupInviteLinkGroupInviteLinkContentsV1(proto) } public func buildSerializedData() throws -> Data { @@ -5730,7 +5730,7 @@ extension GroupsProtoGroupInviteLinkGroupInviteLinkContentsV1 { extension GroupsProtoGroupInviteLinkGroupInviteLinkContentsV1Builder { public func buildIgnoringErrors() -> GroupsProtoGroupInviteLinkGroupInviteLinkContentsV1? { - return try! self.build() + return self.buildInfallibly() } } @@ -5744,7 +5744,7 @@ public enum GroupsProtoGroupInviteLinkOneOfContents { private func GroupsProtoGroupInviteLinkOneOfContentsWrap(_ value: GroupsProtos_GroupInviteLink.OneOf_Contents) throws -> GroupsProtoGroupInviteLinkOneOfContents { switch value { - case .contentsV1(let value): return .contentsV1(try GroupsProtoGroupInviteLinkGroupInviteLinkContentsV1(value)) + case .contentsV1(let value): return .contentsV1(GroupsProtoGroupInviteLinkGroupInviteLinkContentsV1(value)) } } @@ -5796,14 +5796,10 @@ public struct GroupsProtoGroupInviteLink: Codable, CustomDebugStringConvertible public init(serializedData: Data) throws { let proto = try GroupsProtos_GroupInviteLink(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate init(_ proto: GroupsProtos_GroupInviteLink) throws { - // MARK: - Begin Validation Logic for GroupsProtoGroupInviteLink - - - // MARK: - End Validation Logic for GroupsProtoGroupInviteLink - - + fileprivate init(_ proto: GroupsProtos_GroupInviteLink) { self.init(proto: proto) } @@ -5861,7 +5857,11 @@ public struct GroupsProtoGroupInviteLinkBuilder { } public func build() throws -> GroupsProtoGroupInviteLink { - return try GroupsProtoGroupInviteLink(proto) + return GroupsProtoGroupInviteLink(proto) + } + + public func buildInfallibly() -> GroupsProtoGroupInviteLink { + return GroupsProtoGroupInviteLink(proto) } public func buildSerializedData() throws -> Data { @@ -5879,7 +5879,7 @@ extension GroupsProtoGroupInviteLink { extension GroupsProtoGroupInviteLinkBuilder { public func buildIgnoringErrors() -> GroupsProtoGroupInviteLink? { - return try! self.build() + return self.buildInfallibly() } } @@ -5988,14 +5988,10 @@ public struct GroupsProtoGroupJoinInfo: Codable, CustomDebugStringConvertible { public init(serializedData: Data) throws { let proto = try GroupsProtos_GroupJoinInfo(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate init(_ proto: GroupsProtos_GroupJoinInfo) throws { - // MARK: - Begin Validation Logic for GroupsProtoGroupJoinInfo - - - // MARK: - End Validation Logic for GroupsProtoGroupJoinInfo - - + fileprivate init(_ proto: GroupsProtos_GroupJoinInfo) { self.init(proto: proto) } @@ -6120,7 +6116,11 @@ public struct GroupsProtoGroupJoinInfoBuilder { } public func build() throws -> GroupsProtoGroupJoinInfo { - return try GroupsProtoGroupJoinInfo(proto) + return GroupsProtoGroupJoinInfo(proto) + } + + public func buildInfallibly() -> GroupsProtoGroupJoinInfo { + return GroupsProtoGroupJoinInfo(proto) } public func buildSerializedData() throws -> Data { @@ -6138,7 +6138,7 @@ extension GroupsProtoGroupJoinInfo { extension GroupsProtoGroupJoinInfoBuilder { public func buildIgnoringErrors() -> GroupsProtoGroupJoinInfo? { - return try! self.build() + return self.buildInfallibly() } } @@ -6178,14 +6178,10 @@ public struct GroupsProtoGroupExternalCredential: Codable, CustomDebugStringConv public init(serializedData: Data) throws { let proto = try GroupsProtos_GroupExternalCredential(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate init(_ proto: GroupsProtos_GroupExternalCredential) throws { - // MARK: - Begin Validation Logic for GroupsProtoGroupExternalCredential - - - // MARK: - End Validation Logic for GroupsProtoGroupExternalCredential - - + fileprivate init(_ proto: GroupsProtos_GroupExternalCredential) { self.init(proto: proto) } @@ -6243,7 +6239,11 @@ public struct GroupsProtoGroupExternalCredentialBuilder { } public func build() throws -> GroupsProtoGroupExternalCredential { - return try GroupsProtoGroupExternalCredential(proto) + return GroupsProtoGroupExternalCredential(proto) + } + + public func buildInfallibly() -> GroupsProtoGroupExternalCredential { + return GroupsProtoGroupExternalCredential(proto) } public func buildSerializedData() throws -> Data { @@ -6261,7 +6261,7 @@ extension GroupsProtoGroupExternalCredential { extension GroupsProtoGroupExternalCredentialBuilder { public func buildIgnoringErrors() -> GroupsProtoGroupExternalCredential? { - return try! self.build() + return self.buildInfallibly() } } diff --git a/SignalServiceKit/src/Protos/Generated/KeyBackupProto.swift b/SignalServiceKit/src/Protos/Generated/KeyBackupProto.swift index 9b54491dc6..06731a63aa 100644 --- a/SignalServiceKit/src/Protos/Generated/KeyBackupProto.swift +++ b/SignalServiceKit/src/Protos/Generated/KeyBackupProto.swift @@ -55,29 +55,25 @@ public class KeyBackupProtoRequest: NSObject, Codable, NSSecureCoding { @objc public convenience init(serializedData: Data) throws { let proto = try KeyBackupProtos_Request(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate convenience init(_ proto: KeyBackupProtos_Request) throws { + fileprivate convenience init(_ proto: KeyBackupProtos_Request) { var backup: KeyBackupProtoBackupRequest? if proto.hasBackup { - backup = try KeyBackupProtoBackupRequest(proto.backup) + backup = KeyBackupProtoBackupRequest(proto.backup) } var restore: KeyBackupProtoRestoreRequest? if proto.hasRestore { - restore = try KeyBackupProtoRestoreRequest(proto.restore) + restore = KeyBackupProtoRestoreRequest(proto.restore) } var delete: KeyBackupProtoDeleteRequest? if proto.hasDelete { - delete = try KeyBackupProtoDeleteRequest(proto.delete) + delete = KeyBackupProtoDeleteRequest(proto.delete) } - // MARK: - Begin Validation Logic for KeyBackupProtoRequest - - - // MARK: - End Validation Logic for KeyBackupProtoRequest - - self.init(proto: proto, backup: backup, restore: restore, @@ -193,7 +189,12 @@ public class KeyBackupProtoRequestBuilder: NSObject { @objc public func build() throws -> KeyBackupProtoRequest { - return try KeyBackupProtoRequest(proto) + return KeyBackupProtoRequest(proto) + } + + @objc + public func buildInfallibly() -> KeyBackupProtoRequest { + return KeyBackupProtoRequest(proto) } @objc @@ -214,7 +215,7 @@ extension KeyBackupProtoRequest { extension KeyBackupProtoRequestBuilder { @objc public func buildIgnoringErrors() -> KeyBackupProtoRequest? { - return try! self.build() + return self.buildInfallibly() } } @@ -262,29 +263,25 @@ public class KeyBackupProtoResponse: NSObject, Codable, NSSecureCoding { @objc public convenience init(serializedData: Data) throws { let proto = try KeyBackupProtos_Response(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate convenience init(_ proto: KeyBackupProtos_Response) throws { + fileprivate convenience init(_ proto: KeyBackupProtos_Response) { var backup: KeyBackupProtoBackupResponse? if proto.hasBackup { - backup = try KeyBackupProtoBackupResponse(proto.backup) + backup = KeyBackupProtoBackupResponse(proto.backup) } var restore: KeyBackupProtoRestoreResponse? if proto.hasRestore { - restore = try KeyBackupProtoRestoreResponse(proto.restore) + restore = KeyBackupProtoRestoreResponse(proto.restore) } var delete: KeyBackupProtoDeleteResponse? if proto.hasDelete { - delete = try KeyBackupProtoDeleteResponse(proto.delete) + delete = KeyBackupProtoDeleteResponse(proto.delete) } - // MARK: - Begin Validation Logic for KeyBackupProtoResponse - - - // MARK: - End Validation Logic for KeyBackupProtoResponse - - self.init(proto: proto, backup: backup, restore: restore, @@ -400,7 +397,12 @@ public class KeyBackupProtoResponseBuilder: NSObject { @objc public func build() throws -> KeyBackupProtoResponse { - return try KeyBackupProtoResponse(proto) + return KeyBackupProtoResponse(proto) + } + + @objc + public func buildInfallibly() -> KeyBackupProtoResponse { + return KeyBackupProtoResponse(proto) } @objc @@ -421,7 +423,7 @@ extension KeyBackupProtoResponse { extension KeyBackupProtoResponseBuilder { @objc public func buildIgnoringErrors() -> KeyBackupProtoResponse? { - return try! self.build() + return self.buildInfallibly() } } @@ -532,14 +534,10 @@ public class KeyBackupProtoBackupRequest: NSObject, Codable, NSSecureCoding { @objc public convenience init(serializedData: Data) throws { let proto = try KeyBackupProtos_BackupRequest(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate convenience init(_ proto: KeyBackupProtos_BackupRequest) throws { - // MARK: - Begin Validation Logic for KeyBackupProtoBackupRequest - - - // MARK: - End Validation Logic for KeyBackupProtoBackupRequest - - + fileprivate convenience init(_ proto: KeyBackupProtos_BackupRequest) { self.init(proto: proto) } @@ -696,7 +694,12 @@ public class KeyBackupProtoBackupRequestBuilder: NSObject { @objc public func build() throws -> KeyBackupProtoBackupRequest { - return try KeyBackupProtoBackupRequest(proto) + return KeyBackupProtoBackupRequest(proto) + } + + @objc + public func buildInfallibly() -> KeyBackupProtoBackupRequest { + return KeyBackupProtoBackupRequest(proto) } @objc @@ -717,7 +720,7 @@ extension KeyBackupProtoBackupRequest { extension KeyBackupProtoBackupRequestBuilder { @objc public func buildIgnoringErrors() -> KeyBackupProtoBackupRequest? { - return try! self.build() + return self.buildInfallibly() } } @@ -807,14 +810,10 @@ public class KeyBackupProtoBackupResponse: NSObject, Codable, NSSecureCoding { @objc public convenience init(serializedData: Data) throws { let proto = try KeyBackupProtos_BackupResponse(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate convenience init(_ proto: KeyBackupProtos_BackupResponse) throws { - // MARK: - Begin Validation Logic for KeyBackupProtoBackupResponse - - - // MARK: - End Validation Logic for KeyBackupProtoBackupResponse - - + fileprivate convenience init(_ proto: KeyBackupProtos_BackupResponse) { self.init(proto: proto) } @@ -907,7 +906,12 @@ public class KeyBackupProtoBackupResponseBuilder: NSObject { @objc public func build() throws -> KeyBackupProtoBackupResponse { - return try KeyBackupProtoBackupResponse(proto) + return KeyBackupProtoBackupResponse(proto) + } + + @objc + public func buildInfallibly() -> KeyBackupProtoBackupResponse { + return KeyBackupProtoBackupResponse(proto) } @objc @@ -928,7 +932,7 @@ extension KeyBackupProtoBackupResponse { extension KeyBackupProtoBackupResponseBuilder { @objc public func buildIgnoringErrors() -> KeyBackupProtoBackupResponse? { - return try! self.build() + return self.buildInfallibly() } } @@ -1018,14 +1022,10 @@ public class KeyBackupProtoRestoreRequest: NSObject, Codable, NSSecureCoding { @objc public convenience init(serializedData: Data) throws { let proto = try KeyBackupProtos_RestoreRequest(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate convenience init(_ proto: KeyBackupProtos_RestoreRequest) throws { - // MARK: - Begin Validation Logic for KeyBackupProtoRestoreRequest - - - // MARK: - End Validation Logic for KeyBackupProtoRestoreRequest - - + fileprivate convenience init(_ proto: KeyBackupProtos_RestoreRequest) { self.init(proto: proto) } @@ -1160,7 +1160,12 @@ public class KeyBackupProtoRestoreRequestBuilder: NSObject { @objc public func build() throws -> KeyBackupProtoRestoreRequest { - return try KeyBackupProtoRestoreRequest(proto) + return KeyBackupProtoRestoreRequest(proto) + } + + @objc + public func buildInfallibly() -> KeyBackupProtoRestoreRequest { + return KeyBackupProtoRestoreRequest(proto) } @objc @@ -1181,7 +1186,7 @@ extension KeyBackupProtoRestoreRequest { extension KeyBackupProtoRestoreRequestBuilder { @objc public func buildIgnoringErrors() -> KeyBackupProtoRestoreRequest? { - return try! self.build() + return self.buildInfallibly() } } @@ -1298,14 +1303,10 @@ public class KeyBackupProtoRestoreResponse: NSObject, Codable, NSSecureCoding { @objc public convenience init(serializedData: Data) throws { let proto = try KeyBackupProtos_RestoreResponse(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate convenience init(_ proto: KeyBackupProtos_RestoreResponse) throws { - // MARK: - Begin Validation Logic for KeyBackupProtoRestoreResponse - - - // MARK: - End Validation Logic for KeyBackupProtoRestoreResponse - - + fileprivate convenience init(_ proto: KeyBackupProtos_RestoreResponse) { self.init(proto: proto) } @@ -1420,7 +1421,12 @@ public class KeyBackupProtoRestoreResponseBuilder: NSObject { @objc public func build() throws -> KeyBackupProtoRestoreResponse { - return try KeyBackupProtoRestoreResponse(proto) + return KeyBackupProtoRestoreResponse(proto) + } + + @objc + public func buildInfallibly() -> KeyBackupProtoRestoreResponse { + return KeyBackupProtoRestoreResponse(proto) } @objc @@ -1441,7 +1447,7 @@ extension KeyBackupProtoRestoreResponse { extension KeyBackupProtoRestoreResponseBuilder { @objc public func buildIgnoringErrors() -> KeyBackupProtoRestoreResponse? { - return try! self.build() + return self.buildInfallibly() } } @@ -1498,14 +1504,10 @@ public class KeyBackupProtoDeleteRequest: NSObject, Codable, NSSecureCoding { @objc public convenience init(serializedData: Data) throws { let proto = try KeyBackupProtos_DeleteRequest(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate convenience init(_ proto: KeyBackupProtos_DeleteRequest) throws { - // MARK: - Begin Validation Logic for KeyBackupProtoDeleteRequest - - - // MARK: - End Validation Logic for KeyBackupProtoDeleteRequest - - + fileprivate convenience init(_ proto: KeyBackupProtos_DeleteRequest) { self.init(proto: proto) } @@ -1604,7 +1606,12 @@ public class KeyBackupProtoDeleteRequestBuilder: NSObject { @objc public func build() throws -> KeyBackupProtoDeleteRequest { - return try KeyBackupProtoDeleteRequest(proto) + return KeyBackupProtoDeleteRequest(proto) + } + + @objc + public func buildInfallibly() -> KeyBackupProtoDeleteRequest { + return KeyBackupProtoDeleteRequest(proto) } @objc @@ -1625,7 +1632,7 @@ extension KeyBackupProtoDeleteRequest { extension KeyBackupProtoDeleteRequestBuilder { @objc public func buildIgnoringErrors() -> KeyBackupProtoDeleteRequest? { - return try! self.build() + return self.buildInfallibly() } } @@ -1658,14 +1665,10 @@ public class KeyBackupProtoDeleteResponse: NSObject, Codable, NSSecureCoding { @objc public convenience init(serializedData: Data) throws { let proto = try KeyBackupProtos_DeleteResponse(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate convenience init(_ proto: KeyBackupProtos_DeleteResponse) throws { - // MARK: - Begin Validation Logic for KeyBackupProtoDeleteResponse - - - // MARK: - End Validation Logic for KeyBackupProtoDeleteResponse - - + fileprivate convenience init(_ proto: KeyBackupProtos_DeleteResponse) { self.init(proto: proto) } @@ -1736,7 +1739,12 @@ public class KeyBackupProtoDeleteResponseBuilder: NSObject { @objc public func build() throws -> KeyBackupProtoDeleteResponse { - return try KeyBackupProtoDeleteResponse(proto) + return KeyBackupProtoDeleteResponse(proto) + } + + @objc + public func buildInfallibly() -> KeyBackupProtoDeleteResponse { + return KeyBackupProtoDeleteResponse(proto) } @objc @@ -1757,7 +1765,7 @@ extension KeyBackupProtoDeleteResponse { extension KeyBackupProtoDeleteResponseBuilder { @objc public func buildIgnoringErrors() -> KeyBackupProtoDeleteResponse? { - return try! self.build() + return self.buildInfallibly() } } diff --git a/SignalServiceKit/src/Protos/Generated/ProvisioningProto.swift b/SignalServiceKit/src/Protos/Generated/ProvisioningProto.swift index de104d1b0e..0ad73f3c44 100644 --- a/SignalServiceKit/src/Protos/Generated/ProvisioningProto.swift +++ b/SignalServiceKit/src/Protos/Generated/ProvisioningProto.swift @@ -54,10 +54,6 @@ public class ProvisioningProtoProvisioningUuid: NSObject, Codable, NSSecureCodin } let uuid = proto.uuid - // MARK: - Begin Validation Logic for ProvisioningProtoProvisioningUuid - - - // MARK: - End Validation Logic for ProvisioningProtoProvisioningUuid - - self.init(proto: proto, uuid: uuid) } @@ -225,10 +221,6 @@ public class ProvisioningProtoProvisionEnvelope: NSObject, Codable, NSSecureCodi } let body = proto.body - // MARK: - Begin Validation Logic for ProvisioningProtoProvisionEnvelope - - - // MARK: - End Validation Logic for ProvisioningProtoProvisionEnvelope - - self.init(proto: proto, publicKey: publicKey, body: body) @@ -519,10 +511,6 @@ public class ProvisioningProtoProvisionMessage: NSObject, Codable, NSSecureCodin } let profileKey = proto.profileKey - // MARK: - Begin Validation Logic for ProvisioningProtoProvisionMessage - - - // MARK: - End Validation Logic for ProvisioningProtoProvisionMessage - - self.init(proto: proto, aciIdentityKeyPublic: aciIdentityKeyPublic, aciIdentityKeyPrivate: aciIdentityKeyPrivate, diff --git a/SignalServiceKit/src/Protos/Generated/SSKProto.swift b/SignalServiceKit/src/Protos/Generated/SSKProto.swift index ead129d163..0638b2ddef 100644 --- a/SignalServiceKit/src/Protos/Generated/SSKProto.swift +++ b/SignalServiceKit/src/Protos/Generated/SSKProto.swift @@ -247,10 +247,6 @@ public class SSKProtoEnvelope: NSObject, Codable, NSSecureCoding { } let timestamp = proto.timestamp - // MARK: - Begin Validation Logic for SSKProtoEnvelope - - - // MARK: - End Validation Logic for SSKProtoEnvelope - - self.init(proto: proto, timestamp: timestamp) } @@ -572,10 +568,6 @@ public class SSKProtoTypingMessage: NSObject, Codable, NSSecureCoding { } let timestamp = proto.timestamp - // MARK: - Begin Validation Logic for SSKProtoTypingMessage - - - // MARK: - End Validation Logic for SSKProtoTypingMessage - - self.init(proto: proto, timestamp: timestamp) } @@ -777,12 +769,12 @@ public class SSKProtoStoryMessage: NSObject, Codable, NSSecureCoding { fileprivate convenience init(_ proto: SignalServiceProtos_StoryMessage) throws { var group: SSKProtoGroupContextV2? if proto.hasGroup { - group = try SSKProtoGroupContextV2(proto.group) + group = SSKProtoGroupContextV2(proto.group) } var fileAttachment: SSKProtoAttachmentPointer? if proto.hasFileAttachment { - fileAttachment = try SSKProtoAttachmentPointer(proto.fileAttachment) + fileAttachment = SSKProtoAttachmentPointer(proto.fileAttachment) } var textAttachment: SSKProtoTextAttachment? @@ -790,10 +782,6 @@ public class SSKProtoStoryMessage: NSObject, Codable, NSSecureCoding { textAttachment = try SSKProtoTextAttachment(proto.textAttachment) } - // MARK: - Begin Validation Logic for SSKProtoStoryMessage - - - // MARK: - End Validation Logic for SSKProtoStoryMessage - - self.init(proto: proto, group: group, fileAttachment: fileAttachment, @@ -1039,13 +1027,9 @@ public class SSKProtoPreview: NSObject, Codable, NSSecureCoding { var image: SSKProtoAttachmentPointer? if proto.hasImage { - image = try SSKProtoAttachmentPointer(proto.image) + image = SSKProtoAttachmentPointer(proto.image) } - // MARK: - Begin Validation Logic for SSKProtoPreview - - - // MARK: - End Validation Logic for SSKProtoPreview - - self.init(proto: proto, url: url, image: image) @@ -1277,14 +1261,10 @@ public class SSKProtoTextAttachmentGradient: NSObject, Codable, NSSecureCoding { @objc public convenience init(serializedData: Data) throws { let proto = try SignalServiceProtos_TextAttachment.Gradient(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate convenience init(_ proto: SignalServiceProtos_TextAttachment.Gradient) throws { - // MARK: - Begin Validation Logic for SSKProtoTextAttachmentGradient - - - // MARK: - End Validation Logic for SSKProtoTextAttachmentGradient - - + fileprivate convenience init(_ proto: SignalServiceProtos_TextAttachment.Gradient) { self.init(proto: proto) } @@ -1401,7 +1381,12 @@ public class SSKProtoTextAttachmentGradientBuilder: NSObject { @objc public func build() throws -> SSKProtoTextAttachmentGradient { - return try SSKProtoTextAttachmentGradient(proto) + return SSKProtoTextAttachmentGradient(proto) + } + + @objc + public func buildInfallibly() -> SSKProtoTextAttachmentGradient { + return SSKProtoTextAttachmentGradient(proto) } @objc @@ -1422,7 +1407,7 @@ extension SSKProtoTextAttachmentGradient { extension SSKProtoTextAttachmentGradientBuilder { @objc public func buildIgnoringErrors() -> SSKProtoTextAttachmentGradient? { - return try! self.build() + return self.buildInfallibly() } } @@ -1569,13 +1554,9 @@ public class SSKProtoTextAttachment: NSObject, Codable, NSSecureCoding { var gradient: SSKProtoTextAttachmentGradient? if proto.hasGradient { - gradient = try SSKProtoTextAttachmentGradient(proto.gradient) + gradient = SSKProtoTextAttachmentGradient(proto.gradient) } - // MARK: - Begin Validation Logic for SSKProtoTextAttachment - - - // MARK: - End Validation Logic for SSKProtoTextAttachment - - self.init(proto: proto, preview: preview, gradient: gradient) @@ -1861,12 +1842,12 @@ public class SSKProtoContent: NSObject, Codable, NSSecureCoding { var nullMessage: SSKProtoNullMessage? if proto.hasNullMessage { - nullMessage = try SSKProtoNullMessage(proto.nullMessage) + nullMessage = SSKProtoNullMessage(proto.nullMessage) } var receiptMessage: SSKProtoReceiptMessage? if proto.hasReceiptMessage { - receiptMessage = try SSKProtoReceiptMessage(proto.receiptMessage) + receiptMessage = SSKProtoReceiptMessage(proto.receiptMessage) } var typingMessage: SSKProtoTypingMessage? @@ -1881,13 +1862,9 @@ public class SSKProtoContent: NSObject, Codable, NSSecureCoding { var pniSignatureMessage: SSKProtoPniSignatureMessage? if proto.hasPniSignatureMessage { - pniSignatureMessage = try SSKProtoPniSignatureMessage(proto.pniSignatureMessage) + pniSignatureMessage = SSKProtoPniSignatureMessage(proto.pniSignatureMessage) } - // MARK: - Begin Validation Logic for SSKProtoContent - - - // MARK: - End Validation Logic for SSKProtoContent - - self.init(proto: proto, dataMessage: dataMessage, syncMessage: syncMessage, @@ -2240,10 +2217,6 @@ public class SSKProtoCallMessageOffer: NSObject, Codable, NSSecureCoding { } let id = proto.id - // MARK: - Begin Validation Logic for SSKProtoCallMessageOffer - - - // MARK: - End Validation Logic for SSKProtoCallMessageOffer - - self.init(proto: proto, id: id) } @@ -2455,10 +2428,6 @@ public class SSKProtoCallMessageAnswer: NSObject, Codable, NSSecureCoding { } let id = proto.id - // MARK: - Begin Validation Logic for SSKProtoCallMessageAnswer - - - // MARK: - End Validation Logic for SSKProtoCallMessageAnswer - - self.init(proto: proto, id: id) } @@ -2683,10 +2652,6 @@ public class SSKProtoCallMessageIceUpdate: NSObject, Codable, NSSecureCoding { } let id = proto.id - // MARK: - Begin Validation Logic for SSKProtoCallMessageIceUpdate - - - // MARK: - End Validation Logic for SSKProtoCallMessageIceUpdate - - self.init(proto: proto, id: id) } @@ -2888,10 +2853,6 @@ public class SSKProtoCallMessageBusy: NSObject, Codable, NSSecureCoding { } let id = proto.id - // MARK: - Begin Validation Logic for SSKProtoCallMessageBusy - - - // MARK: - End Validation Logic for SSKProtoCallMessageBusy - - self.init(proto: proto, id: id) } @@ -3103,10 +3064,6 @@ public class SSKProtoCallMessageHangup: NSObject, Codable, NSSecureCoding { } let id = proto.id - // MARK: - Begin Validation Logic for SSKProtoCallMessageHangup - - - // MARK: - End Validation Logic for SSKProtoCallMessageHangup - - self.init(proto: proto, id: id) } @@ -3314,14 +3271,10 @@ public class SSKProtoCallMessageOpaque: NSObject, Codable, NSSecureCoding { @objc public convenience init(serializedData: Data) throws { let proto = try SignalServiceProtos_CallMessage.Opaque(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate convenience init(_ proto: SignalServiceProtos_CallMessage.Opaque) throws { - // MARK: - Begin Validation Logic for SSKProtoCallMessageOpaque - - - // MARK: - End Validation Logic for SSKProtoCallMessageOpaque - - + fileprivate convenience init(_ proto: SignalServiceProtos_CallMessage.Opaque) { self.init(proto: proto) } @@ -3414,7 +3367,12 @@ public class SSKProtoCallMessageOpaqueBuilder: NSObject { @objc public func build() throws -> SSKProtoCallMessageOpaque { - return try SSKProtoCallMessageOpaque(proto) + return SSKProtoCallMessageOpaque(proto) + } + + @objc + public func buildInfallibly() -> SSKProtoCallMessageOpaque { + return SSKProtoCallMessageOpaque(proto) } @objc @@ -3435,7 +3393,7 @@ extension SSKProtoCallMessageOpaque { extension SSKProtoCallMessageOpaqueBuilder { @objc public func buildIgnoringErrors() -> SSKProtoCallMessageOpaque? { - return try! self.build() + return self.buildInfallibly() } } @@ -3567,13 +3525,9 @@ public class SSKProtoCallMessage: NSObject, Codable, NSSecureCoding { var opaque: SSKProtoCallMessageOpaque? if proto.hasOpaque { - opaque = try SSKProtoCallMessageOpaque(proto.opaque) + opaque = SSKProtoCallMessageOpaque(proto.opaque) } - // MARK: - Begin Validation Logic for SSKProtoCallMessage - - - // MARK: - End Validation Logic for SSKProtoCallMessage - - self.init(proto: proto, offer: offer, answer: answer, @@ -3859,19 +3813,15 @@ public class SSKProtoDataMessageQuoteQuotedAttachment: NSObject, Codable, NSSecu @objc public convenience init(serializedData: Data) throws { let proto = try SignalServiceProtos_DataMessage.Quote.QuotedAttachment(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate convenience init(_ proto: SignalServiceProtos_DataMessage.Quote.QuotedAttachment) throws { + fileprivate convenience init(_ proto: SignalServiceProtos_DataMessage.Quote.QuotedAttachment) { var thumbnail: SSKProtoAttachmentPointer? if proto.hasThumbnail { - thumbnail = try SSKProtoAttachmentPointer(proto.thumbnail) + thumbnail = SSKProtoAttachmentPointer(proto.thumbnail) } - // MARK: - Begin Validation Logic for SSKProtoDataMessageQuoteQuotedAttachment - - - // MARK: - End Validation Logic for SSKProtoDataMessageQuoteQuotedAttachment - - self.init(proto: proto, thumbnail: thumbnail) } @@ -3985,7 +3935,12 @@ public class SSKProtoDataMessageQuoteQuotedAttachmentBuilder: NSObject { @objc public func build() throws -> SSKProtoDataMessageQuoteQuotedAttachment { - return try SSKProtoDataMessageQuoteQuotedAttachment(proto) + return SSKProtoDataMessageQuoteQuotedAttachment(proto) + } + + @objc + public func buildInfallibly() -> SSKProtoDataMessageQuoteQuotedAttachment { + return SSKProtoDataMessageQuoteQuotedAttachment(proto) } @objc @@ -4006,7 +3961,7 @@ extension SSKProtoDataMessageQuoteQuotedAttachment { extension SSKProtoDataMessageQuoteQuotedAttachmentBuilder { @objc public func buildIgnoringErrors() -> SSKProtoDataMessageQuoteQuotedAttachment? { - return try! self.build() + return self.buildInfallibly() } } @@ -4164,14 +4119,10 @@ public class SSKProtoDataMessageQuote: NSObject, Codable, NSSecureCoding { let id = proto.id var attachments: [SSKProtoDataMessageQuoteQuotedAttachment] = [] - attachments = try proto.attachments.map { try SSKProtoDataMessageQuoteQuotedAttachment($0) } + attachments = proto.attachments.map { SSKProtoDataMessageQuoteQuotedAttachment($0) } var bodyRanges: [SSKProtoDataMessageBodyRange] = [] - bodyRanges = try proto.bodyRanges.map { try SSKProtoDataMessageBodyRange($0) } - - // MARK: - Begin Validation Logic for SSKProtoDataMessageQuote - - - // MARK: - End Validation Logic for SSKProtoDataMessageQuote - + bodyRanges = proto.bodyRanges.map { SSKProtoDataMessageBodyRange($0) } self.init(proto: proto, id: id, @@ -4442,14 +4393,10 @@ public class SSKProtoDataMessageContactName: NSObject, Codable, NSSecureCoding { @objc public convenience init(serializedData: Data) throws { let proto = try SignalServiceProtos_DataMessage.Contact.Name(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate convenience init(_ proto: SignalServiceProtos_DataMessage.Contact.Name) throws { - // MARK: - Begin Validation Logic for SSKProtoDataMessageContactName - - - // MARK: - End Validation Logic for SSKProtoDataMessageContactName - - + fileprivate convenience init(_ proto: SignalServiceProtos_DataMessage.Contact.Name) { self.init(proto: proto) } @@ -4604,7 +4551,12 @@ public class SSKProtoDataMessageContactNameBuilder: NSObject { @objc public func build() throws -> SSKProtoDataMessageContactName { - return try SSKProtoDataMessageContactName(proto) + return SSKProtoDataMessageContactName(proto) + } + + @objc + public func buildInfallibly() -> SSKProtoDataMessageContactName { + return SSKProtoDataMessageContactName(proto) } @objc @@ -4625,7 +4577,7 @@ extension SSKProtoDataMessageContactName { extension SSKProtoDataMessageContactNameBuilder { @objc public func buildIgnoringErrors() -> SSKProtoDataMessageContactName? { - return try! self.build() + return self.buildInfallibly() } } @@ -4730,14 +4682,10 @@ public class SSKProtoDataMessageContactPhone: NSObject, Codable, NSSecureCoding @objc public convenience init(serializedData: Data) throws { let proto = try SignalServiceProtos_DataMessage.Contact.Phone(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate convenience init(_ proto: SignalServiceProtos_DataMessage.Contact.Phone) throws { - // MARK: - Begin Validation Logic for SSKProtoDataMessageContactPhone - - - // MARK: - End Validation Logic for SSKProtoDataMessageContactPhone - - + fileprivate convenience init(_ proto: SignalServiceProtos_DataMessage.Contact.Phone) { self.init(proto: proto) } @@ -4844,7 +4792,12 @@ public class SSKProtoDataMessageContactPhoneBuilder: NSObject { @objc public func build() throws -> SSKProtoDataMessageContactPhone { - return try SSKProtoDataMessageContactPhone(proto) + return SSKProtoDataMessageContactPhone(proto) + } + + @objc + public func buildInfallibly() -> SSKProtoDataMessageContactPhone { + return SSKProtoDataMessageContactPhone(proto) } @objc @@ -4865,7 +4818,7 @@ extension SSKProtoDataMessageContactPhone { extension SSKProtoDataMessageContactPhoneBuilder { @objc public func buildIgnoringErrors() -> SSKProtoDataMessageContactPhone? { - return try! self.build() + return self.buildInfallibly() } } @@ -4970,14 +4923,10 @@ public class SSKProtoDataMessageContactEmail: NSObject, Codable, NSSecureCoding @objc public convenience init(serializedData: Data) throws { let proto = try SignalServiceProtos_DataMessage.Contact.Email(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate convenience init(_ proto: SignalServiceProtos_DataMessage.Contact.Email) throws { - // MARK: - Begin Validation Logic for SSKProtoDataMessageContactEmail - - - // MARK: - End Validation Logic for SSKProtoDataMessageContactEmail - - + fileprivate convenience init(_ proto: SignalServiceProtos_DataMessage.Contact.Email) { self.init(proto: proto) } @@ -5084,7 +5033,12 @@ public class SSKProtoDataMessageContactEmailBuilder: NSObject { @objc public func build() throws -> SSKProtoDataMessageContactEmail { - return try SSKProtoDataMessageContactEmail(proto) + return SSKProtoDataMessageContactEmail(proto) + } + + @objc + public func buildInfallibly() -> SSKProtoDataMessageContactEmail { + return SSKProtoDataMessageContactEmail(proto) } @objc @@ -5105,7 +5059,7 @@ extension SSKProtoDataMessageContactEmail { extension SSKProtoDataMessageContactEmailBuilder { @objc public func buildIgnoringErrors() -> SSKProtoDataMessageContactEmail? { - return try! self.build() + return self.buildInfallibly() } } @@ -5279,14 +5233,10 @@ public class SSKProtoDataMessageContactPostalAddress: NSObject, Codable, NSSecur @objc public convenience init(serializedData: Data) throws { let proto = try SignalServiceProtos_DataMessage.Contact.PostalAddress(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate convenience init(_ proto: SignalServiceProtos_DataMessage.Contact.PostalAddress) throws { - // MARK: - Begin Validation Logic for SSKProtoDataMessageContactPostalAddress - - - // MARK: - End Validation Logic for SSKProtoDataMessageContactPostalAddress - - + fileprivate convenience init(_ proto: SignalServiceProtos_DataMessage.Contact.PostalAddress) { self.init(proto: proto) } @@ -5477,7 +5427,12 @@ public class SSKProtoDataMessageContactPostalAddressBuilder: NSObject { @objc public func build() throws -> SSKProtoDataMessageContactPostalAddress { - return try SSKProtoDataMessageContactPostalAddress(proto) + return SSKProtoDataMessageContactPostalAddress(proto) + } + + @objc + public func buildInfallibly() -> SSKProtoDataMessageContactPostalAddress { + return SSKProtoDataMessageContactPostalAddress(proto) } @objc @@ -5498,7 +5453,7 @@ extension SSKProtoDataMessageContactPostalAddress { extension SSKProtoDataMessageContactPostalAddressBuilder { @objc public func buildIgnoringErrors() -> SSKProtoDataMessageContactPostalAddress? { - return try! self.build() + return self.buildInfallibly() } } @@ -5545,19 +5500,15 @@ public class SSKProtoDataMessageContactAvatar: NSObject, Codable, NSSecureCoding @objc public convenience init(serializedData: Data) throws { let proto = try SignalServiceProtos_DataMessage.Contact.Avatar(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate convenience init(_ proto: SignalServiceProtos_DataMessage.Contact.Avatar) throws { + fileprivate convenience init(_ proto: SignalServiceProtos_DataMessage.Contact.Avatar) { var avatar: SSKProtoAttachmentPointer? if proto.hasAvatar { - avatar = try SSKProtoAttachmentPointer(proto.avatar) + avatar = SSKProtoAttachmentPointer(proto.avatar) } - // MARK: - Begin Validation Logic for SSKProtoDataMessageContactAvatar - - - // MARK: - End Validation Logic for SSKProtoDataMessageContactAvatar - - self.init(proto: proto, avatar: avatar) } @@ -5651,7 +5602,12 @@ public class SSKProtoDataMessageContactAvatarBuilder: NSObject { @objc public func build() throws -> SSKProtoDataMessageContactAvatar { - return try SSKProtoDataMessageContactAvatar(proto) + return SSKProtoDataMessageContactAvatar(proto) + } + + @objc + public func buildInfallibly() -> SSKProtoDataMessageContactAvatar { + return SSKProtoDataMessageContactAvatar(proto) } @objc @@ -5672,7 +5628,7 @@ extension SSKProtoDataMessageContactAvatar { extension SSKProtoDataMessageContactAvatarBuilder { @objc public func buildIgnoringErrors() -> SSKProtoDataMessageContactAvatar? { - return try! self.build() + return self.buildInfallibly() } } @@ -5742,33 +5698,29 @@ public class SSKProtoDataMessageContact: NSObject, Codable, NSSecureCoding { @objc public convenience init(serializedData: Data) throws { let proto = try SignalServiceProtos_DataMessage.Contact(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate convenience init(_ proto: SignalServiceProtos_DataMessage.Contact) throws { + fileprivate convenience init(_ proto: SignalServiceProtos_DataMessage.Contact) { var name: SSKProtoDataMessageContactName? if proto.hasName { - name = try SSKProtoDataMessageContactName(proto.name) + name = SSKProtoDataMessageContactName(proto.name) } var number: [SSKProtoDataMessageContactPhone] = [] - number = try proto.number.map { try SSKProtoDataMessageContactPhone($0) } + number = proto.number.map { SSKProtoDataMessageContactPhone($0) } var email: [SSKProtoDataMessageContactEmail] = [] - email = try proto.email.map { try SSKProtoDataMessageContactEmail($0) } + email = proto.email.map { SSKProtoDataMessageContactEmail($0) } var address: [SSKProtoDataMessageContactPostalAddress] = [] - address = try proto.address.map { try SSKProtoDataMessageContactPostalAddress($0) } + address = proto.address.map { SSKProtoDataMessageContactPostalAddress($0) } var avatar: SSKProtoDataMessageContactAvatar? if proto.hasAvatar { - avatar = try SSKProtoDataMessageContactAvatar(proto.avatar) + avatar = SSKProtoDataMessageContactAvatar(proto.avatar) } - // MARK: - Begin Validation Logic for SSKProtoDataMessageContact - - - // MARK: - End Validation Logic for SSKProtoDataMessageContact - - self.init(proto: proto, name: name, number: number, @@ -5919,7 +5871,12 @@ public class SSKProtoDataMessageContactBuilder: NSObject { @objc public func build() throws -> SSKProtoDataMessageContact { - return try SSKProtoDataMessageContact(proto) + return SSKProtoDataMessageContact(proto) + } + + @objc + public func buildInfallibly() -> SSKProtoDataMessageContact { + return SSKProtoDataMessageContact(proto) } @objc @@ -5940,7 +5897,7 @@ extension SSKProtoDataMessageContact { extension SSKProtoDataMessageContactBuilder { @objc public func buildIgnoringErrors() -> SSKProtoDataMessageContact? { - return try! self.build() + return self.buildInfallibly() } } @@ -6027,11 +5984,7 @@ public class SSKProtoDataMessageSticker: NSObject, Codable, NSSecureCoding { guard proto.hasData else { throw SSKProtoError.invalidProtobuf(description: "\(Self.logTag()) missing required field: data") } - let data = try SSKProtoAttachmentPointer(proto.data) - - // MARK: - Begin Validation Logic for SSKProtoDataMessageSticker - - - // MARK: - End Validation Logic for SSKProtoDataMessageSticker - + let data = SSKProtoAttachmentPointer(proto.data) self.init(proto: proto, packID: packID, @@ -6302,10 +6255,6 @@ public class SSKProtoDataMessageReaction: NSObject, Codable, NSSecureCoding { } let timestamp = proto.timestamp - // MARK: - Begin Validation Logic for SSKProtoDataMessageReaction - - - // MARK: - End Validation Logic for SSKProtoDataMessageReaction - - self.init(proto: proto, emoji: emoji, timestamp: timestamp) @@ -6492,10 +6441,6 @@ public class SSKProtoDataMessageDelete: NSObject, Codable, NSSecureCoding { } let targetSentTimestamp = proto.targetSentTimestamp - // MARK: - Begin Validation Logic for SSKProtoDataMessageDelete - - - // MARK: - End Validation Logic for SSKProtoDataMessageDelete - - self.init(proto: proto, targetSentTimestamp: targetSentTimestamp) } @@ -6697,14 +6642,10 @@ public class SSKProtoDataMessageBodyRange: NSObject, Codable, NSSecureCoding { @objc public convenience init(serializedData: Data) throws { let proto = try SignalServiceProtos_DataMessage.BodyRange(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate convenience init(_ proto: SignalServiceProtos_DataMessage.BodyRange) throws { - // MARK: - Begin Validation Logic for SSKProtoDataMessageBodyRange - - - // MARK: - End Validation Logic for SSKProtoDataMessageBodyRange - - + fileprivate convenience init(_ proto: SignalServiceProtos_DataMessage.BodyRange) { self.init(proto: proto) } @@ -6805,7 +6746,12 @@ public class SSKProtoDataMessageBodyRangeBuilder: NSObject { @objc public func build() throws -> SSKProtoDataMessageBodyRange { - return try SSKProtoDataMessageBodyRange(proto) + return SSKProtoDataMessageBodyRange(proto) + } + + @objc + public func buildInfallibly() -> SSKProtoDataMessageBodyRange { + return SSKProtoDataMessageBodyRange(proto) } @objc @@ -6826,7 +6772,7 @@ extension SSKProtoDataMessageBodyRange { extension SSKProtoDataMessageBodyRangeBuilder { @objc public func buildIgnoringErrors() -> SSKProtoDataMessageBodyRange? { - return try! self.build() + return self.buildInfallibly() } } @@ -6871,14 +6817,10 @@ public class SSKProtoDataMessageGroupCallUpdate: NSObject, Codable, NSSecureCodi @objc public convenience init(serializedData: Data) throws { let proto = try SignalServiceProtos_DataMessage.GroupCallUpdate(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate convenience init(_ proto: SignalServiceProtos_DataMessage.GroupCallUpdate) throws { - // MARK: - Begin Validation Logic for SSKProtoDataMessageGroupCallUpdate - - - // MARK: - End Validation Logic for SSKProtoDataMessageGroupCallUpdate - - + fileprivate convenience init(_ proto: SignalServiceProtos_DataMessage.GroupCallUpdate) { self.init(proto: proto) } @@ -6963,7 +6905,12 @@ public class SSKProtoDataMessageGroupCallUpdateBuilder: NSObject { @objc public func build() throws -> SSKProtoDataMessageGroupCallUpdate { - return try SSKProtoDataMessageGroupCallUpdate(proto) + return SSKProtoDataMessageGroupCallUpdate(proto) + } + + @objc + public func buildInfallibly() -> SSKProtoDataMessageGroupCallUpdate { + return SSKProtoDataMessageGroupCallUpdate(proto) } @objc @@ -6984,7 +6931,7 @@ extension SSKProtoDataMessageGroupCallUpdate { extension SSKProtoDataMessageGroupCallUpdateBuilder { @objc public func buildIgnoringErrors() -> SSKProtoDataMessageGroupCallUpdate? { - return try! self.build() + return self.buildInfallibly() } } @@ -7031,10 +6978,6 @@ public class SSKProtoDataMessagePaymentAmountMobileCoin: NSObject, Codable, NSSe } let picoMob = proto.picoMob - // MARK: - Begin Validation Logic for SSKProtoDataMessagePaymentAmountMobileCoin - - - // MARK: - End Validation Logic for SSKProtoDataMessagePaymentAmountMobileCoin - - self.init(proto: proto, picoMob: picoMob) } @@ -7186,10 +7129,6 @@ public class SSKProtoDataMessagePaymentAmount: NSObject, Codable, NSSecureCoding mobileCoin = try SSKProtoDataMessagePaymentAmountMobileCoin(proto.mobileCoin) } - // MARK: - Begin Validation Logic for SSKProtoDataMessagePaymentAmount - - - // MARK: - End Validation Logic for SSKProtoDataMessagePaymentAmount - - self.init(proto: proto, mobileCoin: mobileCoin) } @@ -7343,10 +7282,6 @@ public class SSKProtoDataMessagePaymentRequestId: NSObject, Codable, NSSecureCod } let uuid = proto.uuid - // MARK: - Begin Validation Logic for SSKProtoDataMessagePaymentRequestId - - - // MARK: - End Validation Logic for SSKProtoDataMessagePaymentRequestId - - self.init(proto: proto, uuid: uuid) } @@ -7526,10 +7461,6 @@ public class SSKProtoDataMessagePaymentRequest: NSObject, Codable, NSSecureCodin } let amount = try SSKProtoDataMessagePaymentAmount(proto.amount) - // MARK: - Begin Validation Logic for SSKProtoDataMessagePaymentRequest - - - // MARK: - End Validation Logic for SSKProtoDataMessagePaymentRequest - - self.init(proto: proto, requestID: requestID, amount: amount) @@ -7714,10 +7645,6 @@ public class SSKProtoDataMessagePaymentNotificationMobileCoin: NSObject, Codable } let receipt = proto.receipt - // MARK: - Begin Validation Logic for SSKProtoDataMessagePaymentNotificationMobileCoin - - - // MARK: - End Validation Logic for SSKProtoDataMessagePaymentNotificationMobileCoin - - self.init(proto: proto, receipt: receipt) } @@ -7897,10 +7824,6 @@ public class SSKProtoDataMessagePaymentNotification: NSObject, Codable, NSSecure requestID = try SSKProtoDataMessagePaymentRequestId(proto.requestID) } - // MARK: - Begin Validation Logic for SSKProtoDataMessagePaymentNotification - - - // MARK: - End Validation Logic for SSKProtoDataMessagePaymentNotification - - self.init(proto: proto, mobileCoin: mobileCoin, requestID: requestID) @@ -8083,10 +8006,6 @@ public class SSKProtoDataMessagePaymentCancellation: NSObject, Codable, NSSecure } let requestID = try SSKProtoDataMessagePaymentRequestId(proto.requestID) - // MARK: - Begin Validation Logic for SSKProtoDataMessagePaymentCancellation - - - // MARK: - End Validation Logic for SSKProtoDataMessagePaymentCancellation - - self.init(proto: proto, requestID: requestID) } @@ -8264,10 +8183,6 @@ public class SSKProtoDataMessagePayment: NSObject, Codable, NSSecureCoding { cancellation = try SSKProtoDataMessagePaymentCancellation(proto.cancellation) } - // MARK: - Begin Validation Logic for SSKProtoDataMessagePayment - - - // MARK: - End Validation Logic for SSKProtoDataMessagePayment - - self.init(proto: proto, notification: notification, request: request, @@ -8492,14 +8407,10 @@ public class SSKProtoDataMessageStoryContext: NSObject, Codable, NSSecureCoding @objc public convenience init(serializedData: Data) throws { let proto = try SignalServiceProtos_DataMessage.StoryContext(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate convenience init(_ proto: SignalServiceProtos_DataMessage.StoryContext) throws { - // MARK: - Begin Validation Logic for SSKProtoDataMessageStoryContext - - - // MARK: - End Validation Logic for SSKProtoDataMessageStoryContext - - + fileprivate convenience init(_ proto: SignalServiceProtos_DataMessage.StoryContext) { self.init(proto: proto) } @@ -8592,7 +8503,12 @@ public class SSKProtoDataMessageStoryContextBuilder: NSObject { @objc public func build() throws -> SSKProtoDataMessageStoryContext { - return try SSKProtoDataMessageStoryContext(proto) + return SSKProtoDataMessageStoryContext(proto) + } + + @objc + public func buildInfallibly() -> SSKProtoDataMessageStoryContext { + return SSKProtoDataMessageStoryContext(proto) } @objc @@ -8613,7 +8529,7 @@ extension SSKProtoDataMessageStoryContext { extension SSKProtoDataMessageStoryContextBuilder { @objc public func buildIgnoringErrors() -> SSKProtoDataMessageStoryContext? { - return try! self.build() + return self.buildInfallibly() } } @@ -8658,14 +8574,10 @@ public class SSKProtoDataMessageGiftBadge: NSObject, Codable, NSSecureCoding { @objc public convenience init(serializedData: Data) throws { let proto = try SignalServiceProtos_DataMessage.GiftBadge(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate convenience init(_ proto: SignalServiceProtos_DataMessage.GiftBadge) throws { - // MARK: - Begin Validation Logic for SSKProtoDataMessageGiftBadge - - - // MARK: - End Validation Logic for SSKProtoDataMessageGiftBadge - - + fileprivate convenience init(_ proto: SignalServiceProtos_DataMessage.GiftBadge) { self.init(proto: proto) } @@ -8750,7 +8662,12 @@ public class SSKProtoDataMessageGiftBadgeBuilder: NSObject { @objc public func build() throws -> SSKProtoDataMessageGiftBadge { - return try SSKProtoDataMessageGiftBadge(proto) + return SSKProtoDataMessageGiftBadge(proto) + } + + @objc + public func buildInfallibly() -> SSKProtoDataMessageGiftBadge { + return SSKProtoDataMessageGiftBadge(proto) } @objc @@ -8771,7 +8688,7 @@ extension SSKProtoDataMessageGiftBadge { extension SSKProtoDataMessageGiftBadgeBuilder { @objc public func buildIgnoringErrors() -> SSKProtoDataMessageGiftBadge? { - return try! self.build() + return self.buildInfallibly() } } @@ -9013,7 +8930,7 @@ public class SSKProtoDataMessage: NSObject, Codable, NSSecureCoding { fileprivate convenience init(_ proto: SignalServiceProtos_DataMessage) throws { var attachments: [SSKProtoAttachmentPointer] = [] - attachments = try proto.attachments.map { try SSKProtoAttachmentPointer($0) } + attachments = proto.attachments.map { SSKProtoAttachmentPointer($0) } var group: SSKProtoGroupContext? if proto.hasGroup { @@ -9022,7 +8939,7 @@ public class SSKProtoDataMessage: NSObject, Codable, NSSecureCoding { var groupV2: SSKProtoGroupContextV2? if proto.hasGroupV2 { - groupV2 = try SSKProtoGroupContextV2(proto.groupV2) + groupV2 = SSKProtoGroupContextV2(proto.groupV2) } var quote: SSKProtoDataMessageQuote? @@ -9031,7 +8948,7 @@ public class SSKProtoDataMessage: NSObject, Codable, NSSecureCoding { } var contact: [SSKProtoDataMessageContact] = [] - contact = try proto.contact.map { try SSKProtoDataMessageContact($0) } + contact = proto.contact.map { SSKProtoDataMessageContact($0) } var preview: [SSKProtoPreview] = [] preview = try proto.preview.map { try SSKProtoPreview($0) } @@ -9052,11 +8969,11 @@ public class SSKProtoDataMessage: NSObject, Codable, NSSecureCoding { } var bodyRanges: [SSKProtoDataMessageBodyRange] = [] - bodyRanges = try proto.bodyRanges.map { try SSKProtoDataMessageBodyRange($0) } + bodyRanges = proto.bodyRanges.map { SSKProtoDataMessageBodyRange($0) } var groupCallUpdate: SSKProtoDataMessageGroupCallUpdate? if proto.hasGroupCallUpdate { - groupCallUpdate = try SSKProtoDataMessageGroupCallUpdate(proto.groupCallUpdate) + groupCallUpdate = SSKProtoDataMessageGroupCallUpdate(proto.groupCallUpdate) } var payment: SSKProtoDataMessagePayment? @@ -9066,18 +8983,14 @@ public class SSKProtoDataMessage: NSObject, Codable, NSSecureCoding { var storyContext: SSKProtoDataMessageStoryContext? if proto.hasStoryContext { - storyContext = try SSKProtoDataMessageStoryContext(proto.storyContext) + storyContext = SSKProtoDataMessageStoryContext(proto.storyContext) } var giftBadge: SSKProtoDataMessageGiftBadge? if proto.hasGiftBadge { - giftBadge = try SSKProtoDataMessageGiftBadge(proto.giftBadge) + giftBadge = SSKProtoDataMessageGiftBadge(proto.giftBadge) } - // MARK: - Begin Validation Logic for SSKProtoDataMessage - - - // MARK: - End Validation Logic for SSKProtoDataMessage - - self.init(proto: proto, attachments: attachments, group: group, @@ -9480,14 +9393,10 @@ public class SSKProtoNullMessage: NSObject, Codable, NSSecureCoding { @objc public convenience init(serializedData: Data) throws { let proto = try SignalServiceProtos_NullMessage(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate convenience init(_ proto: SignalServiceProtos_NullMessage) throws { - // MARK: - Begin Validation Logic for SSKProtoNullMessage - - - // MARK: - End Validation Logic for SSKProtoNullMessage - - + fileprivate convenience init(_ proto: SignalServiceProtos_NullMessage) { self.init(proto: proto) } @@ -9572,7 +9481,12 @@ public class SSKProtoNullMessageBuilder: NSObject { @objc public func build() throws -> SSKProtoNullMessage { - return try SSKProtoNullMessage(proto) + return SSKProtoNullMessage(proto) + } + + @objc + public func buildInfallibly() -> SSKProtoNullMessage { + return SSKProtoNullMessage(proto) } @objc @@ -9593,7 +9507,7 @@ extension SSKProtoNullMessage { extension SSKProtoNullMessageBuilder { @objc public func buildIgnoringErrors() -> SSKProtoNullMessage? { - return try! self.build() + return self.buildInfallibly() } } @@ -9676,14 +9590,10 @@ public class SSKProtoReceiptMessage: NSObject, Codable, NSSecureCoding { @objc public convenience init(serializedData: Data) throws { let proto = try SignalServiceProtos_ReceiptMessage(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate convenience init(_ proto: SignalServiceProtos_ReceiptMessage) throws { - // MARK: - Begin Validation Logic for SSKProtoReceiptMessage - - - // MARK: - End Validation Logic for SSKProtoReceiptMessage - - + fileprivate convenience init(_ proto: SignalServiceProtos_ReceiptMessage) { self.init(proto: proto) } @@ -9773,7 +9683,12 @@ public class SSKProtoReceiptMessageBuilder: NSObject { @objc public func build() throws -> SSKProtoReceiptMessage { - return try SSKProtoReceiptMessage(proto) + return SSKProtoReceiptMessage(proto) + } + + @objc + public func buildInfallibly() -> SSKProtoReceiptMessage { + return SSKProtoReceiptMessage(proto) } @objc @@ -9794,7 +9709,7 @@ extension SSKProtoReceiptMessage { extension SSKProtoReceiptMessageBuilder { @objc public func buildIgnoringErrors() -> SSKProtoReceiptMessage? { - return try! self.build() + return self.buildInfallibly() } } @@ -9966,14 +9881,10 @@ public class SSKProtoVerified: NSObject, Codable, NSSecureCoding { @objc public convenience init(serializedData: Data) throws { let proto = try SignalServiceProtos_Verified(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate convenience init(_ proto: SignalServiceProtos_Verified) throws { - // MARK: - Begin Validation Logic for SSKProtoVerified - - - // MARK: - End Validation Logic for SSKProtoVerified - - + fileprivate convenience init(_ proto: SignalServiceProtos_Verified) { self.init(proto: proto) } @@ -10116,7 +10027,12 @@ public class SSKProtoVerifiedBuilder: NSObject { @objc public func build() throws -> SSKProtoVerified { - return try SSKProtoVerified(proto) + return SSKProtoVerified(proto) + } + + @objc + public func buildInfallibly() -> SSKProtoVerified { + return SSKProtoVerified(proto) } @objc @@ -10137,7 +10053,7 @@ extension SSKProtoVerified { extension SSKProtoVerifiedBuilder { @objc public func buildIgnoringErrors() -> SSKProtoVerified? { - return try! self.build() + return self.buildInfallibly() } } @@ -10249,14 +10165,10 @@ public class SSKProtoSyncMessageSentUnidentifiedDeliveryStatus: NSObject, Codabl @objc public convenience init(serializedData: Data) throws { let proto = try SignalServiceProtos_SyncMessage.Sent.UnidentifiedDeliveryStatus(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate convenience init(_ proto: SignalServiceProtos_SyncMessage.Sent.UnidentifiedDeliveryStatus) throws { - // MARK: - Begin Validation Logic for SSKProtoSyncMessageSentUnidentifiedDeliveryStatus - - - // MARK: - End Validation Logic for SSKProtoSyncMessageSentUnidentifiedDeliveryStatus - - + fileprivate convenience init(_ proto: SignalServiceProtos_SyncMessage.Sent.UnidentifiedDeliveryStatus) { self.init(proto: proto) } @@ -10371,7 +10283,12 @@ public class SSKProtoSyncMessageSentUnidentifiedDeliveryStatusBuilder: NSObject @objc public func build() throws -> SSKProtoSyncMessageSentUnidentifiedDeliveryStatus { - return try SSKProtoSyncMessageSentUnidentifiedDeliveryStatus(proto) + return SSKProtoSyncMessageSentUnidentifiedDeliveryStatus(proto) + } + + @objc + public func buildInfallibly() -> SSKProtoSyncMessageSentUnidentifiedDeliveryStatus { + return SSKProtoSyncMessageSentUnidentifiedDeliveryStatus(proto) } @objc @@ -10392,7 +10309,7 @@ extension SSKProtoSyncMessageSentUnidentifiedDeliveryStatus { extension SSKProtoSyncMessageSentUnidentifiedDeliveryStatusBuilder { @objc public func buildIgnoringErrors() -> SSKProtoSyncMessageSentUnidentifiedDeliveryStatus? { - return try! self.build() + return self.buildInfallibly() } } @@ -10485,14 +10402,10 @@ public class SSKProtoSyncMessageSentStoryMessageRecipient: NSObject, Codable, NS @objc public convenience init(serializedData: Data) throws { let proto = try SignalServiceProtos_SyncMessage.Sent.StoryMessageRecipient(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate convenience init(_ proto: SignalServiceProtos_SyncMessage.Sent.StoryMessageRecipient) throws { - // MARK: - Begin Validation Logic for SSKProtoSyncMessageSentStoryMessageRecipient - - - // MARK: - End Validation Logic for SSKProtoSyncMessageSentStoryMessageRecipient - - + fileprivate convenience init(_ proto: SignalServiceProtos_SyncMessage.Sent.StoryMessageRecipient) { self.init(proto: proto) } @@ -10596,7 +10509,12 @@ public class SSKProtoSyncMessageSentStoryMessageRecipientBuilder: NSObject { @objc public func build() throws -> SSKProtoSyncMessageSentStoryMessageRecipient { - return try SSKProtoSyncMessageSentStoryMessageRecipient(proto) + return SSKProtoSyncMessageSentStoryMessageRecipient(proto) + } + + @objc + public func buildInfallibly() -> SSKProtoSyncMessageSentStoryMessageRecipient { + return SSKProtoSyncMessageSentStoryMessageRecipient(proto) } @objc @@ -10617,7 +10535,7 @@ extension SSKProtoSyncMessageSentStoryMessageRecipient { extension SSKProtoSyncMessageSentStoryMessageRecipientBuilder { @objc public func buildIgnoringErrors() -> SSKProtoSyncMessageSentStoryMessageRecipient? { - return try! self.build() + return self.buildInfallibly() } } @@ -10777,7 +10695,7 @@ public class SSKProtoSyncMessageSent: NSObject, Codable, NSSecureCoding { } var unidentifiedStatus: [SSKProtoSyncMessageSentUnidentifiedDeliveryStatus] = [] - unidentifiedStatus = try proto.unidentifiedStatus.map { try SSKProtoSyncMessageSentUnidentifiedDeliveryStatus($0) } + unidentifiedStatus = proto.unidentifiedStatus.map { SSKProtoSyncMessageSentUnidentifiedDeliveryStatus($0) } var storyMessage: SSKProtoStoryMessage? if proto.hasStoryMessage { @@ -10785,11 +10703,7 @@ public class SSKProtoSyncMessageSent: NSObject, Codable, NSSecureCoding { } var storyMessageRecipients: [SSKProtoSyncMessageSentStoryMessageRecipient] = [] - storyMessageRecipients = try proto.storyMessageRecipients.map { try SSKProtoSyncMessageSentStoryMessageRecipient($0) } - - // MARK: - Begin Validation Logic for SSKProtoSyncMessageSent - - - // MARK: - End Validation Logic for SSKProtoSyncMessageSent - + storyMessageRecipients = proto.storyMessageRecipients.map { SSKProtoSyncMessageSentStoryMessageRecipient($0) } self.init(proto: proto, message: message, @@ -11050,11 +10964,7 @@ public class SSKProtoSyncMessageContacts: NSObject, Codable, NSSecureCoding { guard proto.hasBlob else { throw SSKProtoError.invalidProtobuf(description: "\(Self.logTag()) missing required field: blob") } - let blob = try SSKProtoAttachmentPointer(proto.blob) - - // MARK: - Begin Validation Logic for SSKProtoSyncMessageContacts - - - // MARK: - End Validation Logic for SSKProtoSyncMessageContacts - + let blob = SSKProtoAttachmentPointer(proto.blob) self.init(proto: proto, blob: blob) @@ -11212,19 +11122,15 @@ public class SSKProtoSyncMessageGroups: NSObject, Codable, NSSecureCoding { @objc public convenience init(serializedData: Data) throws { let proto = try SignalServiceProtos_SyncMessage.Groups(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate convenience init(_ proto: SignalServiceProtos_SyncMessage.Groups) throws { + fileprivate convenience init(_ proto: SignalServiceProtos_SyncMessage.Groups) { var blob: SSKProtoAttachmentPointer? if proto.hasBlob { - blob = try SSKProtoAttachmentPointer(proto.blob) + blob = SSKProtoAttachmentPointer(proto.blob) } - // MARK: - Begin Validation Logic for SSKProtoSyncMessageGroups - - - // MARK: - End Validation Logic for SSKProtoSyncMessageGroups - - self.init(proto: proto, blob: blob) } @@ -11310,7 +11216,12 @@ public class SSKProtoSyncMessageGroupsBuilder: NSObject { @objc public func build() throws -> SSKProtoSyncMessageGroups { - return try SSKProtoSyncMessageGroups(proto) + return SSKProtoSyncMessageGroups(proto) + } + + @objc + public func buildInfallibly() -> SSKProtoSyncMessageGroups { + return SSKProtoSyncMessageGroups(proto) } @objc @@ -11331,7 +11242,7 @@ extension SSKProtoSyncMessageGroups { extension SSKProtoSyncMessageGroupsBuilder { @objc public func buildIgnoringErrors() -> SSKProtoSyncMessageGroups? { - return try! self.build() + return self.buildInfallibly() } } @@ -11379,14 +11290,10 @@ public class SSKProtoSyncMessageBlocked: NSObject, Codable, NSSecureCoding { @objc public convenience init(serializedData: Data) throws { let proto = try SignalServiceProtos_SyncMessage.Blocked(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate convenience init(_ proto: SignalServiceProtos_SyncMessage.Blocked) throws { - // MARK: - Begin Validation Logic for SSKProtoSyncMessageBlocked - - - // MARK: - End Validation Logic for SSKProtoSyncMessageBlocked - - + fileprivate convenience init(_ proto: SignalServiceProtos_SyncMessage.Blocked) { self.init(proto: proto) } @@ -11490,7 +11397,12 @@ public class SSKProtoSyncMessageBlockedBuilder: NSObject { @objc public func build() throws -> SSKProtoSyncMessageBlocked { - return try SSKProtoSyncMessageBlocked(proto) + return SSKProtoSyncMessageBlocked(proto) + } + + @objc + public func buildInfallibly() -> SSKProtoSyncMessageBlocked { + return SSKProtoSyncMessageBlocked(proto) } @objc @@ -11511,7 +11423,7 @@ extension SSKProtoSyncMessageBlocked { extension SSKProtoSyncMessageBlockedBuilder { @objc public func buildIgnoringErrors() -> SSKProtoSyncMessageBlocked? { - return try! self.build() + return self.buildInfallibly() } } @@ -11601,14 +11513,10 @@ public class SSKProtoSyncMessageRequest: NSObject, Codable, NSSecureCoding { @objc public convenience init(serializedData: Data) throws { let proto = try SignalServiceProtos_SyncMessage.Request(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate convenience init(_ proto: SignalServiceProtos_SyncMessage.Request) throws { - // MARK: - Begin Validation Logic for SSKProtoSyncMessageRequest - - - // MARK: - End Validation Logic for SSKProtoSyncMessageRequest - - + fileprivate convenience init(_ proto: SignalServiceProtos_SyncMessage.Request) { self.init(proto: proto) } @@ -11687,7 +11595,12 @@ public class SSKProtoSyncMessageRequestBuilder: NSObject { @objc public func build() throws -> SSKProtoSyncMessageRequest { - return try SSKProtoSyncMessageRequest(proto) + return SSKProtoSyncMessageRequest(proto) + } + + @objc + public func buildInfallibly() -> SSKProtoSyncMessageRequest { + return SSKProtoSyncMessageRequest(proto) } @objc @@ -11708,7 +11621,7 @@ extension SSKProtoSyncMessageRequest { extension SSKProtoSyncMessageRequestBuilder { @objc public func buildIgnoringErrors() -> SSKProtoSyncMessageRequest? { - return try! self.build() + return self.buildInfallibly() } } @@ -11825,10 +11738,6 @@ public class SSKProtoSyncMessageRead: NSObject, Codable, NSSecureCoding { } let timestamp = proto.timestamp - // MARK: - Begin Validation Logic for SSKProtoSyncMessageRead - - - // MARK: - End Validation Logic for SSKProtoSyncMessageRead - - self.init(proto: proto, timestamp: timestamp) } @@ -12086,10 +11995,6 @@ public class SSKProtoSyncMessageViewed: NSObject, Codable, NSSecureCoding { } let timestamp = proto.timestamp - // MARK: - Begin Validation Logic for SSKProtoSyncMessageViewed - - - // MARK: - End Validation Logic for SSKProtoSyncMessageViewed - - self.init(proto: proto, timestamp: timestamp) } @@ -12308,14 +12213,10 @@ public class SSKProtoSyncMessageConfiguration: NSObject, Codable, NSSecureCoding @objc public convenience init(serializedData: Data) throws { let proto = try SignalServiceProtos_SyncMessage.Configuration(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate convenience init(_ proto: SignalServiceProtos_SyncMessage.Configuration) throws { - // MARK: - Begin Validation Logic for SSKProtoSyncMessageConfiguration - - - // MARK: - End Validation Logic for SSKProtoSyncMessageConfiguration - - + fileprivate convenience init(_ proto: SignalServiceProtos_SyncMessage.Configuration) { self.init(proto: proto) } @@ -12426,7 +12327,12 @@ public class SSKProtoSyncMessageConfigurationBuilder: NSObject { @objc public func build() throws -> SSKProtoSyncMessageConfiguration { - return try SSKProtoSyncMessageConfiguration(proto) + return SSKProtoSyncMessageConfiguration(proto) + } + + @objc + public func buildInfallibly() -> SSKProtoSyncMessageConfiguration { + return SSKProtoSyncMessageConfiguration(proto) } @objc @@ -12447,7 +12353,7 @@ extension SSKProtoSyncMessageConfiguration { extension SSKProtoSyncMessageConfigurationBuilder { @objc public func buildIgnoringErrors() -> SSKProtoSyncMessageConfiguration? { - return try! self.build() + return self.buildInfallibly() } } @@ -12546,10 +12452,6 @@ public class SSKProtoSyncMessageStickerPackOperation: NSObject, Codable, NSSecur } let packKey = proto.packKey - // MARK: - Begin Validation Logic for SSKProtoSyncMessageStickerPackOperation - - - // MARK: - End Validation Logic for SSKProtoSyncMessageStickerPackOperation - - self.init(proto: proto, packID: packID, packKey: packKey) @@ -12798,10 +12700,6 @@ public class SSKProtoSyncMessageViewOnceOpen: NSObject, Codable, NSSecureCoding } let timestamp = proto.timestamp - // MARK: - Begin Validation Logic for SSKProtoSyncMessageViewOnceOpen - - - // MARK: - End Validation Logic for SSKProtoSyncMessageViewOnceOpen - - self.init(proto: proto, timestamp: timestamp) } @@ -13023,14 +12921,10 @@ public class SSKProtoSyncMessageFetchLatest: NSObject, Codable, NSSecureCoding { @objc public convenience init(serializedData: Data) throws { let proto = try SignalServiceProtos_SyncMessage.FetchLatest(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate convenience init(_ proto: SignalServiceProtos_SyncMessage.FetchLatest) throws { - // MARK: - Begin Validation Logic for SSKProtoSyncMessageFetchLatest - - - // MARK: - End Validation Logic for SSKProtoSyncMessageFetchLatest - - + fileprivate convenience init(_ proto: SignalServiceProtos_SyncMessage.FetchLatest) { self.init(proto: proto) } @@ -13109,7 +13003,12 @@ public class SSKProtoSyncMessageFetchLatestBuilder: NSObject { @objc public func build() throws -> SSKProtoSyncMessageFetchLatest { - return try SSKProtoSyncMessageFetchLatest(proto) + return SSKProtoSyncMessageFetchLatest(proto) + } + + @objc + public func buildInfallibly() -> SSKProtoSyncMessageFetchLatest { + return SSKProtoSyncMessageFetchLatest(proto) } @objc @@ -13130,7 +13029,7 @@ extension SSKProtoSyncMessageFetchLatest { extension SSKProtoSyncMessageFetchLatestBuilder { @objc public func buildIgnoringErrors() -> SSKProtoSyncMessageFetchLatest? { - return try! self.build() + return self.buildInfallibly() } } @@ -13175,14 +13074,10 @@ public class SSKProtoSyncMessageKeys: NSObject, Codable, NSSecureCoding { @objc public convenience init(serializedData: Data) throws { let proto = try SignalServiceProtos_SyncMessage.Keys(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate convenience init(_ proto: SignalServiceProtos_SyncMessage.Keys) throws { - // MARK: - Begin Validation Logic for SSKProtoSyncMessageKeys - - - // MARK: - End Validation Logic for SSKProtoSyncMessageKeys - - + fileprivate convenience init(_ proto: SignalServiceProtos_SyncMessage.Keys) { self.init(proto: proto) } @@ -13267,7 +13162,12 @@ public class SSKProtoSyncMessageKeysBuilder: NSObject { @objc public func build() throws -> SSKProtoSyncMessageKeys { - return try SSKProtoSyncMessageKeys(proto) + return SSKProtoSyncMessageKeys(proto) + } + + @objc + public func buildInfallibly() -> SSKProtoSyncMessageKeys { + return SSKProtoSyncMessageKeys(proto) } @objc @@ -13288,7 +13188,7 @@ extension SSKProtoSyncMessageKeys { extension SSKProtoSyncMessageKeysBuilder { @objc public func buildIgnoringErrors() -> SSKProtoSyncMessageKeys? { - return try! self.build() + return self.buildInfallibly() } } @@ -13345,14 +13245,10 @@ public class SSKProtoSyncMessagePniIdentity: NSObject, Codable, NSSecureCoding { @objc public convenience init(serializedData: Data) throws { let proto = try SignalServiceProtos_SyncMessage.PniIdentity(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate convenience init(_ proto: SignalServiceProtos_SyncMessage.PniIdentity) throws { - // MARK: - Begin Validation Logic for SSKProtoSyncMessagePniIdentity - - - // MARK: - End Validation Logic for SSKProtoSyncMessagePniIdentity - - + fileprivate convenience init(_ proto: SignalServiceProtos_SyncMessage.PniIdentity) { self.init(proto: proto) } @@ -13451,7 +13347,12 @@ public class SSKProtoSyncMessagePniIdentityBuilder: NSObject { @objc public func build() throws -> SSKProtoSyncMessagePniIdentity { - return try SSKProtoSyncMessagePniIdentity(proto) + return SSKProtoSyncMessagePniIdentity(proto) + } + + @objc + public func buildInfallibly() -> SSKProtoSyncMessagePniIdentity { + return SSKProtoSyncMessagePniIdentity(proto) } @objc @@ -13472,7 +13373,7 @@ extension SSKProtoSyncMessagePniIdentity { extension SSKProtoSyncMessagePniIdentityBuilder { @objc public func buildIgnoringErrors() -> SSKProtoSyncMessagePniIdentity? { - return try! self.build() + return self.buildInfallibly() } } @@ -13638,14 +13539,10 @@ public class SSKProtoSyncMessageMessageRequestResponse: NSObject, Codable, NSSec @objc public convenience init(serializedData: Data) throws { let proto = try SignalServiceProtos_SyncMessage.MessageRequestResponse(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate convenience init(_ proto: SignalServiceProtos_SyncMessage.MessageRequestResponse) throws { - // MARK: - Begin Validation Logic for SSKProtoSyncMessageMessageRequestResponse - - - // MARK: - End Validation Logic for SSKProtoSyncMessageMessageRequestResponse - - + fileprivate convenience init(_ proto: SignalServiceProtos_SyncMessage.MessageRequestResponse) { self.init(proto: proto) } @@ -13774,7 +13671,12 @@ public class SSKProtoSyncMessageMessageRequestResponseBuilder: NSObject { @objc public func build() throws -> SSKProtoSyncMessageMessageRequestResponse { - return try SSKProtoSyncMessageMessageRequestResponse(proto) + return SSKProtoSyncMessageMessageRequestResponse(proto) + } + + @objc + public func buildInfallibly() -> SSKProtoSyncMessageMessageRequestResponse { + return SSKProtoSyncMessageMessageRequestResponse(proto) } @objc @@ -13795,7 +13697,7 @@ extension SSKProtoSyncMessageMessageRequestResponse { extension SSKProtoSyncMessageMessageRequestResponseBuilder { @objc public func buildIgnoringErrors() -> SSKProtoSyncMessageMessageRequestResponse? { - return try! self.build() + return self.buildInfallibly() } } @@ -13905,10 +13807,6 @@ public class SSKProtoSyncMessageOutgoingPaymentMobileCoin: NSObject, Codable, NS } let ledgerBlockIndex = proto.ledgerBlockIndex - // MARK: - Begin Validation Logic for SSKProtoSyncMessageOutgoingPaymentMobileCoin - - - // MARK: - End Validation Logic for SSKProtoSyncMessageOutgoingPaymentMobileCoin - - self.init(proto: proto, amountPicoMob: amountPicoMob, feePicoMob: feePicoMob, @@ -14190,10 +14088,6 @@ public class SSKProtoSyncMessageOutgoingPayment: NSObject, Codable, NSSecureCodi mobileCoin = try SSKProtoSyncMessageOutgoingPaymentMobileCoin(proto.mobileCoin) } - // MARK: - Begin Validation Logic for SSKProtoSyncMessageOutgoingPayment - - - // MARK: - End Validation Logic for SSKProtoSyncMessageOutgoingPayment - - self.init(proto: proto, mobileCoin: mobileCoin) } @@ -14526,14 +14420,10 @@ public class SSKProtoSyncMessageCallEvent: NSObject, Codable, NSSecureCoding { @objc public convenience init(serializedData: Data) throws { let proto = try SignalServiceProtos_SyncMessage.CallEvent(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate convenience init(_ proto: SignalServiceProtos_SyncMessage.CallEvent) throws { - // MARK: - Begin Validation Logic for SSKProtoSyncMessageCallEvent - - - // MARK: - End Validation Logic for SSKProtoSyncMessageCallEvent - - + fileprivate convenience init(_ proto: SignalServiceProtos_SyncMessage.CallEvent) { self.init(proto: proto) } @@ -14658,7 +14548,12 @@ public class SSKProtoSyncMessageCallEventBuilder: NSObject { @objc public func build() throws -> SSKProtoSyncMessageCallEvent { - return try SSKProtoSyncMessageCallEvent(proto) + return SSKProtoSyncMessageCallEvent(proto) + } + + @objc + public func buildInfallibly() -> SSKProtoSyncMessageCallEvent { + return SSKProtoSyncMessageCallEvent(proto) } @objc @@ -14679,7 +14574,7 @@ extension SSKProtoSyncMessageCallEvent { extension SSKProtoSyncMessageCallEventBuilder { @objc public func buildIgnoringErrors() -> SSKProtoSyncMessageCallEvent? { - return try! self.build() + return self.buildInfallibly() } } @@ -14825,12 +14720,12 @@ public class SSKProtoSyncMessage: NSObject, Codable, NSSecureCoding { var groups: SSKProtoSyncMessageGroups? if proto.hasGroups { - groups = try SSKProtoSyncMessageGroups(proto.groups) + groups = SSKProtoSyncMessageGroups(proto.groups) } var request: SSKProtoSyncMessageRequest? if proto.hasRequest { - request = try SSKProtoSyncMessageRequest(proto.request) + request = SSKProtoSyncMessageRequest(proto.request) } var read: [SSKProtoSyncMessageRead] = [] @@ -14838,17 +14733,17 @@ public class SSKProtoSyncMessage: NSObject, Codable, NSSecureCoding { var blocked: SSKProtoSyncMessageBlocked? if proto.hasBlocked { - blocked = try SSKProtoSyncMessageBlocked(proto.blocked) + blocked = SSKProtoSyncMessageBlocked(proto.blocked) } var verified: SSKProtoVerified? if proto.hasVerified { - verified = try SSKProtoVerified(proto.verified) + verified = SSKProtoVerified(proto.verified) } var configuration: SSKProtoSyncMessageConfiguration? if proto.hasConfiguration { - configuration = try SSKProtoSyncMessageConfiguration(proto.configuration) + configuration = SSKProtoSyncMessageConfiguration(proto.configuration) } var stickerPackOperation: [SSKProtoSyncMessageStickerPackOperation] = [] @@ -14861,17 +14756,17 @@ public class SSKProtoSyncMessage: NSObject, Codable, NSSecureCoding { var fetchLatest: SSKProtoSyncMessageFetchLatest? if proto.hasFetchLatest { - fetchLatest = try SSKProtoSyncMessageFetchLatest(proto.fetchLatest) + fetchLatest = SSKProtoSyncMessageFetchLatest(proto.fetchLatest) } var keys: SSKProtoSyncMessageKeys? if proto.hasKeys { - keys = try SSKProtoSyncMessageKeys(proto.keys) + keys = SSKProtoSyncMessageKeys(proto.keys) } var messageRequestResponse: SSKProtoSyncMessageMessageRequestResponse? if proto.hasMessageRequestResponse { - messageRequestResponse = try SSKProtoSyncMessageMessageRequestResponse(proto.messageRequestResponse) + messageRequestResponse = SSKProtoSyncMessageMessageRequestResponse(proto.messageRequestResponse) } var outgoingPayment: SSKProtoSyncMessageOutgoingPayment? @@ -14884,18 +14779,14 @@ public class SSKProtoSyncMessage: NSObject, Codable, NSSecureCoding { var pniIdentity: SSKProtoSyncMessagePniIdentity? if proto.hasPniIdentity { - pniIdentity = try SSKProtoSyncMessagePniIdentity(proto.pniIdentity) + pniIdentity = SSKProtoSyncMessagePniIdentity(proto.pniIdentity) } var callEvent: SSKProtoSyncMessageCallEvent? if proto.hasCallEvent { - callEvent = try SSKProtoSyncMessageCallEvent(proto.callEvent) + callEvent = SSKProtoSyncMessageCallEvent(proto.callEvent) } - // MARK: - Begin Validation Logic for SSKProtoSyncMessage - - - // MARK: - End Validation Logic for SSKProtoSyncMessage - - self.init(proto: proto, sent: sent, contacts: contacts, @@ -15464,14 +15355,10 @@ public class SSKProtoAttachmentPointer: NSObject, Codable, NSSecureCoding { @objc public convenience init(serializedData: Data) throws { let proto = try SignalServiceProtos_AttachmentPointer(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate convenience init(_ proto: SignalServiceProtos_AttachmentPointer) throws { - // MARK: - Begin Validation Logic for SSKProtoAttachmentPointer - - - // MARK: - End Validation Logic for SSKProtoAttachmentPointer - - + fileprivate convenience init(_ proto: SignalServiceProtos_AttachmentPointer) { self.init(proto: proto) } @@ -15710,7 +15597,12 @@ public class SSKProtoAttachmentPointerBuilder: NSObject { @objc public func build() throws -> SSKProtoAttachmentPointer { - return try SSKProtoAttachmentPointer(proto) + return SSKProtoAttachmentPointer(proto) + } + + @objc + public func buildInfallibly() -> SSKProtoAttachmentPointer { + return SSKProtoAttachmentPointer(proto) } @objc @@ -15731,7 +15623,7 @@ extension SSKProtoAttachmentPointer { extension SSKProtoAttachmentPointerBuilder { @objc public func buildIgnoringErrors() -> SSKProtoAttachmentPointer? { - return try! self.build() + return self.buildInfallibly() } } @@ -15776,14 +15668,10 @@ public class SSKProtoGroupContextMember: NSObject, Codable, NSSecureCoding { @objc public convenience init(serializedData: Data) throws { let proto = try SignalServiceProtos_GroupContext.Member(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate convenience init(_ proto: SignalServiceProtos_GroupContext.Member) throws { - // MARK: - Begin Validation Logic for SSKProtoGroupContextMember - - - // MARK: - End Validation Logic for SSKProtoGroupContextMember - - + fileprivate convenience init(_ proto: SignalServiceProtos_GroupContext.Member) { self.init(proto: proto) } @@ -15868,7 +15756,12 @@ public class SSKProtoGroupContextMemberBuilder: NSObject { @objc public func build() throws -> SSKProtoGroupContextMember { - return try SSKProtoGroupContextMember(proto) + return SSKProtoGroupContextMember(proto) + } + + @objc + public func buildInfallibly() -> SSKProtoGroupContextMember { + return SSKProtoGroupContextMember(proto) } @objc @@ -15889,7 +15782,7 @@ extension SSKProtoGroupContextMember { extension SSKProtoGroupContextMemberBuilder { @objc public func buildIgnoringErrors() -> SSKProtoGroupContextMember? { - return try! self.build() + return self.buildInfallibly() } } @@ -16016,15 +15909,11 @@ public class SSKProtoGroupContext: NSObject, Codable, NSSecureCoding { var avatar: SSKProtoAttachmentPointer? if proto.hasAvatar { - avatar = try SSKProtoAttachmentPointer(proto.avatar) + avatar = SSKProtoAttachmentPointer(proto.avatar) } var members: [SSKProtoGroupContextMember] = [] - members = try proto.members.map { try SSKProtoGroupContextMember($0) } - - // MARK: - Begin Validation Logic for SSKProtoGroupContext - - - // MARK: - End Validation Logic for SSKProtoGroupContext - + members = proto.members.map { SSKProtoGroupContextMember($0) } self.init(proto: proto, id: id, @@ -16262,14 +16151,10 @@ public class SSKProtoGroupContextV2: NSObject, Codable, NSSecureCoding { @objc public convenience init(serializedData: Data) throws { let proto = try SignalServiceProtos_GroupContextV2(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate convenience init(_ proto: SignalServiceProtos_GroupContextV2) throws { - // MARK: - Begin Validation Logic for SSKProtoGroupContextV2 - - - // MARK: - End Validation Logic for SSKProtoGroupContextV2 - - + fileprivate convenience init(_ proto: SignalServiceProtos_GroupContextV2) { self.init(proto: proto) } @@ -16376,7 +16261,12 @@ public class SSKProtoGroupContextV2Builder: NSObject { @objc public func build() throws -> SSKProtoGroupContextV2 { - return try SSKProtoGroupContextV2(proto) + return SSKProtoGroupContextV2(proto) + } + + @objc + public func buildInfallibly() -> SSKProtoGroupContextV2 { + return SSKProtoGroupContextV2(proto) } @objc @@ -16397,7 +16287,7 @@ extension SSKProtoGroupContextV2 { extension SSKProtoGroupContextV2Builder { @objc public func buildIgnoringErrors() -> SSKProtoGroupContextV2? { - return try! self.build() + return self.buildInfallibly() } } @@ -16451,14 +16341,10 @@ public class SSKProtoContactDetailsAvatar: NSObject, Codable, NSSecureCoding { @objc public convenience init(serializedData: Data) throws { let proto = try SignalServiceProtos_ContactDetails.Avatar(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate convenience init(_ proto: SignalServiceProtos_ContactDetails.Avatar) throws { - // MARK: - Begin Validation Logic for SSKProtoContactDetailsAvatar - - - // MARK: - End Validation Logic for SSKProtoContactDetailsAvatar - - + fileprivate convenience init(_ proto: SignalServiceProtos_ContactDetails.Avatar) { self.init(proto: proto) } @@ -16551,7 +16437,12 @@ public class SSKProtoContactDetailsAvatarBuilder: NSObject { @objc public func build() throws -> SSKProtoContactDetailsAvatar { - return try SSKProtoContactDetailsAvatar(proto) + return SSKProtoContactDetailsAvatar(proto) + } + + @objc + public func buildInfallibly() -> SSKProtoContactDetailsAvatar { + return SSKProtoContactDetailsAvatar(proto) } @objc @@ -16572,7 +16463,7 @@ extension SSKProtoContactDetailsAvatar { extension SSKProtoContactDetailsAvatarBuilder { @objc public func buildIgnoringErrors() -> SSKProtoContactDetailsAvatar? { - return try! self.build() + return self.buildInfallibly() } } @@ -16757,24 +16648,20 @@ public class SSKProtoContactDetails: NSObject, Codable, NSSecureCoding { @objc public convenience init(serializedData: Data) throws { let proto = try SignalServiceProtos_ContactDetails(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate convenience init(_ proto: SignalServiceProtos_ContactDetails) throws { + fileprivate convenience init(_ proto: SignalServiceProtos_ContactDetails) { var avatar: SSKProtoContactDetailsAvatar? if proto.hasAvatar { - avatar = try SSKProtoContactDetailsAvatar(proto.avatar) + avatar = SSKProtoContactDetailsAvatar(proto.avatar) } var verified: SSKProtoVerified? if proto.hasVerified { - verified = try SSKProtoVerified(proto.verified) + verified = SSKProtoVerified(proto.verified) } - // MARK: - Begin Validation Logic for SSKProtoContactDetails - - - // MARK: - End Validation Logic for SSKProtoContactDetails - - self.init(proto: proto, avatar: avatar, verified: verified) @@ -16985,7 +16872,12 @@ public class SSKProtoContactDetailsBuilder: NSObject { @objc public func build() throws -> SSKProtoContactDetails { - return try SSKProtoContactDetails(proto) + return SSKProtoContactDetails(proto) + } + + @objc + public func buildInfallibly() -> SSKProtoContactDetails { + return SSKProtoContactDetails(proto) } @objc @@ -17006,7 +16898,7 @@ extension SSKProtoContactDetails { extension SSKProtoContactDetailsBuilder { @objc public func buildIgnoringErrors() -> SSKProtoContactDetails? { - return try! self.build() + return self.buildInfallibly() } } @@ -17060,14 +16952,10 @@ public class SSKProtoGroupDetailsAvatar: NSObject, Codable, NSSecureCoding { @objc public convenience init(serializedData: Data) throws { let proto = try SignalServiceProtos_GroupDetails.Avatar(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate convenience init(_ proto: SignalServiceProtos_GroupDetails.Avatar) throws { - // MARK: - Begin Validation Logic for SSKProtoGroupDetailsAvatar - - - // MARK: - End Validation Logic for SSKProtoGroupDetailsAvatar - - + fileprivate convenience init(_ proto: SignalServiceProtos_GroupDetails.Avatar) { self.init(proto: proto) } @@ -17160,7 +17048,12 @@ public class SSKProtoGroupDetailsAvatarBuilder: NSObject { @objc public func build() throws -> SSKProtoGroupDetailsAvatar { - return try SSKProtoGroupDetailsAvatar(proto) + return SSKProtoGroupDetailsAvatar(proto) + } + + @objc + public func buildInfallibly() -> SSKProtoGroupDetailsAvatar { + return SSKProtoGroupDetailsAvatar(proto) } @objc @@ -17181,7 +17074,7 @@ extension SSKProtoGroupDetailsAvatar { extension SSKProtoGroupDetailsAvatarBuilder { @objc public func buildIgnoringErrors() -> SSKProtoGroupDetailsAvatar? { - return try! self.build() + return self.buildInfallibly() } } @@ -17226,14 +17119,10 @@ public class SSKProtoGroupDetailsMember: NSObject, Codable, NSSecureCoding { @objc public convenience init(serializedData: Data) throws { let proto = try SignalServiceProtos_GroupDetails.Member(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate convenience init(_ proto: SignalServiceProtos_GroupDetails.Member) throws { - // MARK: - Begin Validation Logic for SSKProtoGroupDetailsMember - - - // MARK: - End Validation Logic for SSKProtoGroupDetailsMember - - + fileprivate convenience init(_ proto: SignalServiceProtos_GroupDetails.Member) { self.init(proto: proto) } @@ -17318,7 +17207,12 @@ public class SSKProtoGroupDetailsMemberBuilder: NSObject { @objc public func build() throws -> SSKProtoGroupDetailsMember { - return try SSKProtoGroupDetailsMember(proto) + return SSKProtoGroupDetailsMember(proto) + } + + @objc + public func buildInfallibly() -> SSKProtoGroupDetailsMember { + return SSKProtoGroupDetailsMember(proto) } @objc @@ -17339,7 +17233,7 @@ extension SSKProtoGroupDetailsMember { extension SSKProtoGroupDetailsMemberBuilder { @objc public func buildIgnoringErrors() -> SSKProtoGroupDetailsMember? { - return try! self.build() + return self.buildInfallibly() } } @@ -17472,15 +17366,11 @@ public class SSKProtoGroupDetails: NSObject, Codable, NSSecureCoding { var avatar: SSKProtoGroupDetailsAvatar? if proto.hasAvatar { - avatar = try SSKProtoGroupDetailsAvatar(proto.avatar) + avatar = SSKProtoGroupDetailsAvatar(proto.avatar) } var members: [SSKProtoGroupDetailsMember] = [] - members = try proto.members.map { try SSKProtoGroupDetailsMember($0) } - - // MARK: - Begin Validation Logic for SSKProtoGroupDetails - - - // MARK: - End Validation Logic for SSKProtoGroupDetails - + members = proto.members.map { SSKProtoGroupDetailsMember($0) } self.init(proto: proto, id: id, @@ -17769,10 +17659,6 @@ public class SSKProtoPackSticker: NSObject, Codable, NSSecureCoding { } let id = proto.id - // MARK: - Begin Validation Logic for SSKProtoPackSticker - - - // MARK: - End Validation Logic for SSKProtoPackSticker - - self.init(proto: proto, id: id) } @@ -17984,10 +17870,6 @@ public class SSKProtoPack: NSObject, Codable, NSSecureCoding { var stickers: [SSKProtoPackSticker] = [] stickers = try proto.stickers.map { try SSKProtoPackSticker($0) } - // MARK: - Begin Validation Logic for SSKProtoPack - - - // MARK: - End Validation Logic for SSKProtoPack - - self.init(proto: proto, cover: cover, stickers: stickers) @@ -18191,10 +18073,6 @@ public class SSKProtoPaymentAddressMobileCoin: NSObject, Codable, NSSecureCoding } let signature = proto.signature - // MARK: - Begin Validation Logic for SSKProtoPaymentAddressMobileCoin - - - // MARK: - End Validation Logic for SSKProtoPaymentAddressMobileCoin - - self.init(proto: proto, publicAddress: publicAddress, signature: signature) @@ -18365,10 +18243,6 @@ public class SSKProtoPaymentAddress: NSObject, Codable, NSSecureCoding { mobileCoin = try SSKProtoPaymentAddressMobileCoin(proto.mobileCoin) } - // MARK: - Begin Validation Logic for SSKProtoPaymentAddress - - - // MARK: - End Validation Logic for SSKProtoPaymentAddress - - self.init(proto: proto, mobileCoin: mobileCoin) } @@ -18538,14 +18412,10 @@ public class SSKProtoDecryptionErrorMessage: NSObject, Codable, NSSecureCoding { @objc public convenience init(serializedData: Data) throws { let proto = try SignalServiceProtos_DecryptionErrorMessage(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate convenience init(_ proto: SignalServiceProtos_DecryptionErrorMessage) throws { - // MARK: - Begin Validation Logic for SSKProtoDecryptionErrorMessage - - - // MARK: - End Validation Logic for SSKProtoDecryptionErrorMessage - - + fileprivate convenience init(_ proto: SignalServiceProtos_DecryptionErrorMessage) { self.init(proto: proto) } @@ -18646,7 +18516,12 @@ public class SSKProtoDecryptionErrorMessageBuilder: NSObject { @objc public func build() throws -> SSKProtoDecryptionErrorMessage { - return try SSKProtoDecryptionErrorMessage(proto) + return SSKProtoDecryptionErrorMessage(proto) + } + + @objc + public func buildInfallibly() -> SSKProtoDecryptionErrorMessage { + return SSKProtoDecryptionErrorMessage(proto) } @objc @@ -18667,7 +18542,7 @@ extension SSKProtoDecryptionErrorMessage { extension SSKProtoDecryptionErrorMessageBuilder { @objc public func buildIgnoringErrors() -> SSKProtoDecryptionErrorMessage? { - return try! self.build() + return self.buildInfallibly() } } @@ -18724,14 +18599,10 @@ public class SSKProtoPniSignatureMessage: NSObject, Codable, NSSecureCoding { @objc public convenience init(serializedData: Data) throws { let proto = try SignalServiceProtos_PniSignatureMessage(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate convenience init(_ proto: SignalServiceProtos_PniSignatureMessage) throws { - // MARK: - Begin Validation Logic for SSKProtoPniSignatureMessage - - - // MARK: - End Validation Logic for SSKProtoPniSignatureMessage - - + fileprivate convenience init(_ proto: SignalServiceProtos_PniSignatureMessage) { self.init(proto: proto) } @@ -18830,7 +18701,12 @@ public class SSKProtoPniSignatureMessageBuilder: NSObject { @objc public func build() throws -> SSKProtoPniSignatureMessage { - return try SSKProtoPniSignatureMessage(proto) + return SSKProtoPniSignatureMessage(proto) + } + + @objc + public func buildInfallibly() -> SSKProtoPniSignatureMessage { + return SSKProtoPniSignatureMessage(proto) } @objc @@ -18851,7 +18727,7 @@ extension SSKProtoPniSignatureMessage { extension SSKProtoPniSignatureMessageBuilder { @objc public func buildIgnoringErrors() -> SSKProtoPniSignatureMessage? { - return try! self.build() + return self.buildInfallibly() } } diff --git a/SignalServiceKit/src/Protos/Generated/SignalIOSProto.swift b/SignalServiceKit/src/Protos/Generated/SignalIOSProto.swift index d440116d4f..10f0a24791 100644 --- a/SignalServiceKit/src/Protos/Generated/SignalIOSProto.swift +++ b/SignalServiceKit/src/Protos/Generated/SignalIOSProto.swift @@ -128,10 +128,6 @@ public class SignalIOSProtoBackupSnapshotBackupEntity: NSObject, Codable, NSSecu } let key = proto.key - // MARK: - Begin Validation Logic for SignalIOSProtoBackupSnapshotBackupEntity - - - // MARK: - End Validation Logic for SignalIOSProtoBackupSnapshotBackupEntity - - self.init(proto: proto, entityData: entityData, collection: collection, @@ -321,10 +317,6 @@ public class SignalIOSProtoBackupSnapshot: NSObject, Codable, NSSecureCoding { var entity: [SignalIOSProtoBackupSnapshotBackupEntity] = [] entity = try proto.entity.map { try SignalIOSProtoBackupSnapshotBackupEntity($0) } - // MARK: - Begin Validation Logic for SignalIOSProtoBackupSnapshot - - - // MARK: - End Validation Logic for SignalIOSProtoBackupSnapshot - - self.init(proto: proto, entity: entity) } @@ -495,10 +487,6 @@ public class SignalIOSProtoDeviceName: NSObject, Codable, NSSecureCoding { } let ciphertext = proto.ciphertext - // MARK: - Begin Validation Logic for SignalIOSProtoDeviceName - - - // MARK: - End Validation Logic for SignalIOSProtoDeviceName - - self.init(proto: proto, ephemeralPublic: ephemeralPublic, syntheticIv: syntheticIv, diff --git a/SignalServiceKit/src/Protos/Generated/StorageServiceProto.swift b/SignalServiceKit/src/Protos/Generated/StorageServiceProto.swift index 202e2ae2f1..08a21e7e64 100644 --- a/SignalServiceKit/src/Protos/Generated/StorageServiceProto.swift +++ b/SignalServiceKit/src/Protos/Generated/StorageServiceProto.swift @@ -95,18 +95,14 @@ public struct StorageServiceProtoStorageItem: Codable, CustomDebugStringConverti public init(serializedData: Data) throws { let proto = try StorageServiceProtos_StorageItem(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate init(_ proto: StorageServiceProtos_StorageItem) throws { + fileprivate init(_ proto: StorageServiceProtos_StorageItem) { let key = proto.key let value = proto.value - // MARK: - Begin Validation Logic for StorageServiceProtoStorageItem - - - // MARK: - End Validation Logic for StorageServiceProtoStorageItem - - self.init(proto: proto, key: key, value: value) @@ -179,7 +175,11 @@ public struct StorageServiceProtoStorageItemBuilder { } public func build() throws -> StorageServiceProtoStorageItem { - return try StorageServiceProtoStorageItem(proto) + return StorageServiceProtoStorageItem(proto) + } + + public func buildInfallibly() -> StorageServiceProtoStorageItem { + return StorageServiceProtoStorageItem(proto) } public func buildSerializedData() throws -> Data { @@ -197,7 +197,7 @@ extension StorageServiceProtoStorageItem { extension StorageServiceProtoStorageItemBuilder { public func buildIgnoringErrors() -> StorageServiceProtoStorageItem? { - return try! self.build() + return self.buildInfallibly() } } @@ -231,16 +231,12 @@ public struct StorageServiceProtoStorageItems: Codable, CustomDebugStringConvert public init(serializedData: Data) throws { let proto = try StorageServiceProtos_StorageItems(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate init(_ proto: StorageServiceProtos_StorageItems) throws { + fileprivate init(_ proto: StorageServiceProtos_StorageItems) { var items: [StorageServiceProtoStorageItem] = [] - items = try proto.items.map { try StorageServiceProtoStorageItem($0) } - - // MARK: - Begin Validation Logic for StorageServiceProtoStorageItems - - - // MARK: - End Validation Logic for StorageServiceProtoStorageItems - + items = proto.items.map { StorageServiceProtoStorageItem($0) } self.init(proto: proto, items: items) @@ -296,7 +292,11 @@ public struct StorageServiceProtoStorageItemsBuilder { } public func build() throws -> StorageServiceProtoStorageItems { - return try StorageServiceProtoStorageItems(proto) + return StorageServiceProtoStorageItems(proto) + } + + public func buildInfallibly() -> StorageServiceProtoStorageItems { + return StorageServiceProtoStorageItems(proto) } public func buildSerializedData() throws -> Data { @@ -314,7 +314,7 @@ extension StorageServiceProtoStorageItems { extension StorageServiceProtoStorageItemsBuilder { public func buildIgnoringErrors() -> StorageServiceProtoStorageItems? { - return try! self.build() + return self.buildInfallibly() } } @@ -352,18 +352,14 @@ public struct StorageServiceProtoStorageManifest: Codable, CustomDebugStringConv public init(serializedData: Data) throws { let proto = try StorageServiceProtos_StorageManifest(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate init(_ proto: StorageServiceProtos_StorageManifest) throws { + fileprivate init(_ proto: StorageServiceProtos_StorageManifest) { let version = proto.version let value = proto.value - // MARK: - Begin Validation Logic for StorageServiceProtoStorageManifest - - - // MARK: - End Validation Logic for StorageServiceProtoStorageManifest - - self.init(proto: proto, version: version, value: value) @@ -430,7 +426,11 @@ public struct StorageServiceProtoStorageManifestBuilder { } public func build() throws -> StorageServiceProtoStorageManifest { - return try StorageServiceProtoStorageManifest(proto) + return StorageServiceProtoStorageManifest(proto) + } + + public func buildInfallibly() -> StorageServiceProtoStorageManifest { + return StorageServiceProtoStorageManifest(proto) } public func buildSerializedData() throws -> Data { @@ -448,7 +448,7 @@ extension StorageServiceProtoStorageManifest { extension StorageServiceProtoStorageManifestBuilder { public func buildIgnoringErrors() -> StorageServiceProtoStorageManifest? { - return try! self.build() + return self.buildInfallibly() } } @@ -482,14 +482,10 @@ public struct StorageServiceProtoReadOperation: Codable, CustomDebugStringConver public init(serializedData: Data) throws { let proto = try StorageServiceProtos_ReadOperation(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate init(_ proto: StorageServiceProtos_ReadOperation) throws { - // MARK: - Begin Validation Logic for StorageServiceProtoReadOperation - - - // MARK: - End Validation Logic for StorageServiceProtoReadOperation - - + fileprivate init(_ proto: StorageServiceProtos_ReadOperation) { self.init(proto: proto) } @@ -543,7 +539,11 @@ public struct StorageServiceProtoReadOperationBuilder { } public func build() throws -> StorageServiceProtoReadOperation { - return try StorageServiceProtoReadOperation(proto) + return StorageServiceProtoReadOperation(proto) + } + + public func buildInfallibly() -> StorageServiceProtoReadOperation { + return StorageServiceProtoReadOperation(proto) } public func buildSerializedData() throws -> Data { @@ -561,7 +561,7 @@ extension StorageServiceProtoReadOperation { extension StorageServiceProtoReadOperationBuilder { public func buildIgnoringErrors() -> StorageServiceProtoReadOperation? { - return try! self.build() + return self.buildInfallibly() } } @@ -610,21 +610,17 @@ public struct StorageServiceProtoWriteOperation: Codable, CustomDebugStringConve public init(serializedData: Data) throws { let proto = try StorageServiceProtos_WriteOperation(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate init(_ proto: StorageServiceProtos_WriteOperation) throws { + fileprivate init(_ proto: StorageServiceProtos_WriteOperation) { var manifest: StorageServiceProtoStorageManifest? if proto.hasManifest { - manifest = try StorageServiceProtoStorageManifest(proto.manifest) + manifest = StorageServiceProtoStorageManifest(proto.manifest) } var insertItem: [StorageServiceProtoStorageItem] = [] - insertItem = try proto.insertItem.map { try StorageServiceProtoStorageItem($0) } - - // MARK: - Begin Validation Logic for StorageServiceProtoWriteOperation - - - // MARK: - End Validation Logic for StorageServiceProtoWriteOperation - + insertItem = proto.insertItem.map { StorageServiceProtoStorageItem($0) } self.init(proto: proto, manifest: manifest, @@ -710,7 +706,11 @@ public struct StorageServiceProtoWriteOperationBuilder { } public func build() throws -> StorageServiceProtoWriteOperation { - return try StorageServiceProtoWriteOperation(proto) + return StorageServiceProtoWriteOperation(proto) + } + + public func buildInfallibly() -> StorageServiceProtoWriteOperation { + return StorageServiceProtoWriteOperation(proto) } public func buildSerializedData() throws -> Data { @@ -728,7 +728,7 @@ extension StorageServiceProtoWriteOperation { extension StorageServiceProtoWriteOperationBuilder { public func buildIgnoringErrors() -> StorageServiceProtoWriteOperation? { - return try! self.build() + return self.buildInfallibly() } } @@ -831,18 +831,14 @@ public struct StorageServiceProtoManifestRecordKey: Codable, CustomDebugStringCo public init(serializedData: Data) throws { let proto = try StorageServiceProtos_ManifestRecord.Key(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate init(_ proto: StorageServiceProtos_ManifestRecord.Key) throws { + fileprivate init(_ proto: StorageServiceProtos_ManifestRecord.Key) { let data = proto.data let type = StorageServiceProtoManifestRecordKeyTypeWrap(proto.type) - // MARK: - Begin Validation Logic for StorageServiceProtoManifestRecordKey - - - // MARK: - End Validation Logic for StorageServiceProtoManifestRecordKey - - self.init(proto: proto, data: data, type: type) @@ -909,7 +905,11 @@ public struct StorageServiceProtoManifestRecordKeyBuilder { } public func build() throws -> StorageServiceProtoManifestRecordKey { - return try StorageServiceProtoManifestRecordKey(proto) + return StorageServiceProtoManifestRecordKey(proto) + } + + public func buildInfallibly() -> StorageServiceProtoManifestRecordKey { + return StorageServiceProtoManifestRecordKey(proto) } public func buildSerializedData() throws -> Data { @@ -927,7 +927,7 @@ extension StorageServiceProtoManifestRecordKey { extension StorageServiceProtoManifestRecordKeyBuilder { public func buildIgnoringErrors() -> StorageServiceProtoManifestRecordKey? { - return try! self.build() + return self.buildInfallibly() } } @@ -972,18 +972,14 @@ public struct StorageServiceProtoManifestRecord: Codable, CustomDebugStringConve public init(serializedData: Data) throws { let proto = try StorageServiceProtos_ManifestRecord(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate init(_ proto: StorageServiceProtos_ManifestRecord) throws { + fileprivate init(_ proto: StorageServiceProtos_ManifestRecord) { let version = proto.version var keys: [StorageServiceProtoManifestRecordKey] = [] - keys = try proto.keys.map { try StorageServiceProtoManifestRecordKey($0) } - - // MARK: - Begin Validation Logic for StorageServiceProtoManifestRecord - - - // MARK: - End Validation Logic for StorageServiceProtoManifestRecord - + keys = proto.keys.map { StorageServiceProtoManifestRecordKey($0) } self.init(proto: proto, version: version, @@ -1056,7 +1052,11 @@ public struct StorageServiceProtoManifestRecordBuilder { } public func build() throws -> StorageServiceProtoManifestRecord { - return try StorageServiceProtoManifestRecord(proto) + return StorageServiceProtoManifestRecord(proto) + } + + public func buildInfallibly() -> StorageServiceProtoManifestRecord { + return StorageServiceProtoManifestRecord(proto) } public func buildSerializedData() throws -> Data { @@ -1074,7 +1074,7 @@ extension StorageServiceProtoManifestRecord { extension StorageServiceProtoManifestRecordBuilder { public func buildIgnoringErrors() -> StorageServiceProtoManifestRecord? { - return try! self.build() + return self.buildInfallibly() } } @@ -1092,11 +1092,11 @@ public enum StorageServiceProtoStorageRecordOneOfRecord { private func StorageServiceProtoStorageRecordOneOfRecordWrap(_ value: StorageServiceProtos_StorageRecord.OneOf_Record) throws -> StorageServiceProtoStorageRecordOneOfRecord { switch value { - case .contact(let value): return .contact(try StorageServiceProtoContactRecord(value)) - case .groupV1(let value): return .groupV1(try StorageServiceProtoGroupV1Record(value)) - case .groupV2(let value): return .groupV2(try StorageServiceProtoGroupV2Record(value)) - case .account(let value): return .account(try StorageServiceProtoAccountRecord(value)) - case .storyDistributionList(let value): return .storyDistributionList(try StorageServiceProtoStoryDistributionListRecord(value)) + case .contact(let value): return .contact(StorageServiceProtoContactRecord(value)) + case .groupV1(let value): return .groupV1(StorageServiceProtoGroupV1Record(value)) + case .groupV2(let value): return .groupV2(StorageServiceProtoGroupV2Record(value)) + case .account(let value): return .account(StorageServiceProtoAccountRecord(value)) + case .storyDistributionList(let value): return .storyDistributionList(StorageServiceProtoStoryDistributionListRecord(value)) } } @@ -1152,14 +1152,10 @@ public struct StorageServiceProtoStorageRecord: Codable, CustomDebugStringConver public init(serializedData: Data) throws { let proto = try StorageServiceProtos_StorageRecord(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate init(_ proto: StorageServiceProtos_StorageRecord) throws { - // MARK: - Begin Validation Logic for StorageServiceProtoStorageRecord - - - // MARK: - End Validation Logic for StorageServiceProtoStorageRecord - - + fileprivate init(_ proto: StorageServiceProtos_StorageRecord) { self.init(proto: proto) } @@ -1217,7 +1213,11 @@ public struct StorageServiceProtoStorageRecordBuilder { } public func build() throws -> StorageServiceProtoStorageRecord { - return try StorageServiceProtoStorageRecord(proto) + return StorageServiceProtoStorageRecord(proto) + } + + public func buildInfallibly() -> StorageServiceProtoStorageRecord { + return StorageServiceProtoStorageRecord(proto) } public func buildSerializedData() throws -> Data { @@ -1235,7 +1235,7 @@ extension StorageServiceProtoStorageRecord { extension StorageServiceProtoStorageRecordBuilder { public func buildIgnoringErrors() -> StorageServiceProtoStorageRecord? { - return try! self.build() + return self.buildInfallibly() } } @@ -1526,14 +1526,10 @@ public struct StorageServiceProtoContactRecord: Codable, CustomDebugStringConver public init(serializedData: Data) throws { let proto = try StorageServiceProtos_ContactRecord(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate init(_ proto: StorageServiceProtos_ContactRecord) throws { - // MARK: - Begin Validation Logic for StorageServiceProtoContactRecord - - - // MARK: - End Validation Logic for StorageServiceProtoContactRecord - - + fileprivate init(_ proto: StorageServiceProtos_ContactRecord) { self.init(proto: proto) } @@ -1772,7 +1768,11 @@ public struct StorageServiceProtoContactRecordBuilder { } public func build() throws -> StorageServiceProtoContactRecord { - return try StorageServiceProtoContactRecord(proto) + return StorageServiceProtoContactRecord(proto) + } + + public func buildInfallibly() -> StorageServiceProtoContactRecord { + return StorageServiceProtoContactRecord(proto) } public func buildSerializedData() throws -> Data { @@ -1790,7 +1790,7 @@ extension StorageServiceProtoContactRecord { extension StorageServiceProtoContactRecordBuilder { public func buildIgnoringErrors() -> StorageServiceProtoContactRecord? { - return try! self.build() + return self.buildInfallibly() } } @@ -1859,16 +1859,12 @@ public struct StorageServiceProtoGroupV1Record: Codable, CustomDebugStringConver public init(serializedData: Data) throws { let proto = try StorageServiceProtos_GroupV1Record(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate init(_ proto: StorageServiceProtos_GroupV1Record) throws { + fileprivate init(_ proto: StorageServiceProtos_GroupV1Record) { let id = proto.id - // MARK: - Begin Validation Logic for StorageServiceProtoGroupV1Record - - - // MARK: - End Validation Logic for StorageServiceProtoGroupV1Record - - self.init(proto: proto, id: id) } @@ -1964,7 +1960,11 @@ public struct StorageServiceProtoGroupV1RecordBuilder { } public func build() throws -> StorageServiceProtoGroupV1Record { - return try StorageServiceProtoGroupV1Record(proto) + return StorageServiceProtoGroupV1Record(proto) + } + + public func buildInfallibly() -> StorageServiceProtoGroupV1Record { + return StorageServiceProtoGroupV1Record(proto) } public func buildSerializedData() throws -> Data { @@ -1982,7 +1982,7 @@ extension StorageServiceProtoGroupV1Record { extension StorageServiceProtoGroupV1RecordBuilder { public func buildIgnoringErrors() -> StorageServiceProtoGroupV1Record? { - return try! self.build() + return self.buildInfallibly() } } @@ -2126,16 +2126,12 @@ public struct StorageServiceProtoGroupV2Record: Codable, CustomDebugStringConver public init(serializedData: Data) throws { let proto = try StorageServiceProtos_GroupV2Record(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate init(_ proto: StorageServiceProtos_GroupV2Record) throws { + fileprivate init(_ proto: StorageServiceProtos_GroupV2Record) { let masterKey = proto.masterKey - // MARK: - Begin Validation Logic for StorageServiceProtoGroupV2Record - - - // MARK: - End Validation Logic for StorageServiceProtoGroupV2Record - - self.init(proto: proto, masterKey: masterKey) } @@ -2245,7 +2241,11 @@ public struct StorageServiceProtoGroupV2RecordBuilder { } public func build() throws -> StorageServiceProtoGroupV2Record { - return try StorageServiceProtoGroupV2Record(proto) + return StorageServiceProtoGroupV2Record(proto) + } + + public func buildInfallibly() -> StorageServiceProtoGroupV2Record { + return StorageServiceProtoGroupV2Record(proto) } public func buildSerializedData() throws -> Data { @@ -2263,7 +2263,7 @@ extension StorageServiceProtoGroupV2Record { extension StorageServiceProtoGroupV2RecordBuilder { public func buildIgnoringErrors() -> StorageServiceProtoGroupV2Record? { - return try! self.build() + return self.buildInfallibly() } } @@ -2313,14 +2313,10 @@ public struct StorageServiceProtoAccountRecordPinnedConversationContact: Codable public init(serializedData: Data) throws { let proto = try StorageServiceProtos_AccountRecord.PinnedConversation.Contact(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate init(_ proto: StorageServiceProtos_AccountRecord.PinnedConversation.Contact) throws { - // MARK: - Begin Validation Logic for StorageServiceProtoAccountRecordPinnedConversationContact - - - // MARK: - End Validation Logic for StorageServiceProtoAccountRecordPinnedConversationContact - - + fileprivate init(_ proto: StorageServiceProtos_AccountRecord.PinnedConversation.Contact) { self.init(proto: proto) } @@ -2391,7 +2387,11 @@ public struct StorageServiceProtoAccountRecordPinnedConversationContactBuilder { } public func build() throws -> StorageServiceProtoAccountRecordPinnedConversationContact { - return try StorageServiceProtoAccountRecordPinnedConversationContact(proto) + return StorageServiceProtoAccountRecordPinnedConversationContact(proto) + } + + public func buildInfallibly() -> StorageServiceProtoAccountRecordPinnedConversationContact { + return StorageServiceProtoAccountRecordPinnedConversationContact(proto) } public func buildSerializedData() throws -> Data { @@ -2409,7 +2409,7 @@ extension StorageServiceProtoAccountRecordPinnedConversationContact { extension StorageServiceProtoAccountRecordPinnedConversationContactBuilder { public func buildIgnoringErrors() -> StorageServiceProtoAccountRecordPinnedConversationContact? { - return try! self.build() + return self.buildInfallibly() } } @@ -2425,7 +2425,7 @@ public enum StorageServiceProtoAccountRecordPinnedConversationOneOfIdentifier { private func StorageServiceProtoAccountRecordPinnedConversationOneOfIdentifierWrap(_ value: StorageServiceProtos_AccountRecord.PinnedConversation.OneOf_Identifier) throws -> StorageServiceProtoAccountRecordPinnedConversationOneOfIdentifier { switch value { - case .contact(let value): return .contact(try StorageServiceProtoAccountRecordPinnedConversationContact(value)) + case .contact(let value): return .contact(StorageServiceProtoAccountRecordPinnedConversationContact(value)) case .legacyGroupID(let value): return .legacyGroupID(value) case .groupMasterKey(let value): return .groupMasterKey(value) } @@ -2481,14 +2481,10 @@ public struct StorageServiceProtoAccountRecordPinnedConversation: Codable, Custo public init(serializedData: Data) throws { let proto = try StorageServiceProtos_AccountRecord.PinnedConversation(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate init(_ proto: StorageServiceProtos_AccountRecord.PinnedConversation) throws { - // MARK: - Begin Validation Logic for StorageServiceProtoAccountRecordPinnedConversation - - - // MARK: - End Validation Logic for StorageServiceProtoAccountRecordPinnedConversation - - + fileprivate init(_ proto: StorageServiceProtos_AccountRecord.PinnedConversation) { self.init(proto: proto) } @@ -2546,7 +2542,11 @@ public struct StorageServiceProtoAccountRecordPinnedConversationBuilder { } public func build() throws -> StorageServiceProtoAccountRecordPinnedConversation { - return try StorageServiceProtoAccountRecordPinnedConversation(proto) + return StorageServiceProtoAccountRecordPinnedConversation(proto) + } + + public func buildInfallibly() -> StorageServiceProtoAccountRecordPinnedConversation { + return StorageServiceProtoAccountRecordPinnedConversation(proto) } public func buildSerializedData() throws -> Data { @@ -2564,7 +2564,7 @@ extension StorageServiceProtoAccountRecordPinnedConversation { extension StorageServiceProtoAccountRecordPinnedConversationBuilder { public func buildIgnoringErrors() -> StorageServiceProtoAccountRecordPinnedConversation? { - return try! self.build() + return self.buildInfallibly() } } @@ -2611,14 +2611,10 @@ public struct StorageServiceProtoAccountRecordPayments: Codable, CustomDebugStri public init(serializedData: Data) throws { let proto = try StorageServiceProtos_AccountRecord.Payments(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate init(_ proto: StorageServiceProtos_AccountRecord.Payments) throws { - // MARK: - Begin Validation Logic for StorageServiceProtoAccountRecordPayments - - - // MARK: - End Validation Logic for StorageServiceProtoAccountRecordPayments - - + fileprivate init(_ proto: StorageServiceProtos_AccountRecord.Payments) { self.init(proto: proto) } @@ -2683,7 +2679,11 @@ public struct StorageServiceProtoAccountRecordPaymentsBuilder { } public func build() throws -> StorageServiceProtoAccountRecordPayments { - return try StorageServiceProtoAccountRecordPayments(proto) + return StorageServiceProtoAccountRecordPayments(proto) + } + + public func buildInfallibly() -> StorageServiceProtoAccountRecordPayments { + return StorageServiceProtoAccountRecordPayments(proto) } public func buildSerializedData() throws -> Data { @@ -2701,7 +2701,7 @@ extension StorageServiceProtoAccountRecordPayments { extension StorageServiceProtoAccountRecordPaymentsBuilder { public func buildIgnoringErrors() -> StorageServiceProtoAccountRecordPayments? { - return try! self.build() + return self.buildInfallibly() } } @@ -3018,22 +3018,18 @@ public struct StorageServiceProtoAccountRecord: Codable, CustomDebugStringConver public init(serializedData: Data) throws { let proto = try StorageServiceProtos_AccountRecord(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate init(_ proto: StorageServiceProtos_AccountRecord) throws { + fileprivate init(_ proto: StorageServiceProtos_AccountRecord) { var pinnedConversations: [StorageServiceProtoAccountRecordPinnedConversation] = [] - pinnedConversations = try proto.pinnedConversations.map { try StorageServiceProtoAccountRecordPinnedConversation($0) } + pinnedConversations = proto.pinnedConversations.map { StorageServiceProtoAccountRecordPinnedConversation($0) } var payments: StorageServiceProtoAccountRecordPayments? if proto.hasPayments { - payments = try StorageServiceProtoAccountRecordPayments(proto.payments) + payments = StorageServiceProtoAccountRecordPayments(proto.payments) } - // MARK: - Begin Validation Logic for StorageServiceProtoAccountRecord - - - // MARK: - End Validation Logic for StorageServiceProtoAccountRecord - - self.init(proto: proto, pinnedConversations: pinnedConversations, payments: payments) @@ -3335,7 +3331,11 @@ public struct StorageServiceProtoAccountRecordBuilder { } public func build() throws -> StorageServiceProtoAccountRecord { - return try StorageServiceProtoAccountRecord(proto) + return StorageServiceProtoAccountRecord(proto) + } + + public func buildInfallibly() -> StorageServiceProtoAccountRecord { + return StorageServiceProtoAccountRecord(proto) } public func buildSerializedData() throws -> Data { @@ -3353,7 +3353,7 @@ extension StorageServiceProtoAccountRecord { extension StorageServiceProtoAccountRecordBuilder { public func buildIgnoringErrors() -> StorageServiceProtoAccountRecord? { - return try! self.build() + return self.buildInfallibly() } } @@ -3428,14 +3428,10 @@ public struct StorageServiceProtoStoryDistributionListRecord: Codable, CustomDeb public init(serializedData: Data) throws { let proto = try StorageServiceProtos_StoryDistributionListRecord(serializedData: serializedData) - try self.init(proto) + self.init(proto) } - fileprivate init(_ proto: StorageServiceProtos_StoryDistributionListRecord) throws { - // MARK: - Begin Validation Logic for StorageServiceProtoStoryDistributionListRecord - - - // MARK: - End Validation Logic for StorageServiceProtoStoryDistributionListRecord - - + fileprivate init(_ proto: StorageServiceProtos_StoryDistributionListRecord) { self.init(proto: proto) } @@ -3536,7 +3532,11 @@ public struct StorageServiceProtoStoryDistributionListRecordBuilder { } public func build() throws -> StorageServiceProtoStoryDistributionListRecord { - return try StorageServiceProtoStoryDistributionListRecord(proto) + return StorageServiceProtoStoryDistributionListRecord(proto) + } + + public func buildInfallibly() -> StorageServiceProtoStoryDistributionListRecord { + return StorageServiceProtoStoryDistributionListRecord(proto) } public func buildSerializedData() throws -> Data { @@ -3554,7 +3554,7 @@ extension StorageServiceProtoStoryDistributionListRecord { extension StorageServiceProtoStoryDistributionListRecordBuilder { public func buildIgnoringErrors() -> StorageServiceProtoStoryDistributionListRecord? { - return try! self.build() + return self.buildInfallibly() } } diff --git a/SignalServiceKit/src/Protos/Generated/WebSocketProto.swift b/SignalServiceKit/src/Protos/Generated/WebSocketProto.swift index 68360ae3ae..239c208e99 100644 --- a/SignalServiceKit/src/Protos/Generated/WebSocketProto.swift +++ b/SignalServiceKit/src/Protos/Generated/WebSocketProto.swift @@ -91,10 +91,6 @@ public class WebSocketProtoWebSocketRequestMessage: NSObject, Codable, NSSecureC } let requestID = proto.requestID - // MARK: - Begin Validation Logic for WebSocketProtoWebSocketRequestMessage - - - // MARK: - End Validation Logic for WebSocketProtoWebSocketRequestMessage - - self.init(proto: proto, verb: verb, path: path, @@ -336,10 +332,6 @@ public class WebSocketProtoWebSocketResponseMessage: NSObject, Codable, NSSecure } let status = proto.status - // MARK: - Begin Validation Logic for WebSocketProtoWebSocketResponseMessage - - - // MARK: - End Validation Logic for WebSocketProtoWebSocketResponseMessage - - self.init(proto: proto, requestID: requestID, status: status) @@ -592,10 +584,6 @@ public class WebSocketProtoWebSocketMessage: NSObject, Codable, NSSecureCoding { response = try WebSocketProtoWebSocketResponseMessage(proto.response) } - // MARK: - Begin Validation Logic for WebSocketProtoWebSocketMessage - - - // MARK: - End Validation Logic for WebSocketProtoWebSocketMessage - - self.init(proto: proto, request: request, response: response)