Respond to CR.

pull/1/head
Matthew Chen 7 years ago
parent a477e01a4a
commit 45b93cc4b4

@ -1 +1 @@
Subproject commit b46f53105951613fedd8117b83931f43f6ab12f1 Subproject commit ea60f60ea01bc51fc2434248890b494e37da98a5

@ -483,7 +483,7 @@ private class MockOutgoingMessage: TSOutgoingMessage {
groupMetaMessage: .unspecified, groupMetaMessage: .unspecified,
quotedMessage: nil, quotedMessage: nil,
contactShare: nil, contactShare: nil,
linkPreview: nil) linkPreview: nil)
} }
required init?(coder: NSCoder) { required init?(coder: NSCoder) {

@ -45,7 +45,8 @@ NS_ASSUME_NONNULL_BEGIN
_quotedMessage = [TSQuotedMessage quotedMessageForDataMessage:_dataMessage thread:_thread transaction:transaction]; _quotedMessage = [TSQuotedMessage quotedMessageForDataMessage:_dataMessage thread:_thread transaction:transaction];
_contact = [OWSContacts contactForDataMessage:_dataMessage transaction:transaction]; _contact = [OWSContacts contactForDataMessage:_dataMessage transaction:transaction];
_linkPreview = [[OWSLinkPreview alloc] initWithDataMessage:_dataMessage body:_body transaction:transaction]; _linkPreview =
[OWSLinkPreview buildValidatedLinkPreviewWithDataMessage:_dataMessage body:_body transaction:transaction];
if (sentProto.unidentifiedStatus.count > 0) { if (sentProto.unidentifiedStatus.count > 0) {
NSMutableArray<NSString *> *nonUdRecipientIds = [NSMutableArray new]; NSMutableArray<NSString *> *nonUdRecipientIds = [NSMutableArray new];

@ -35,9 +35,9 @@ public class OWSLinkPreview: MTLModel {
} }
@objc @objc
public required init?(dataMessage: SSKProtoDataMessage, public class func buildValidatedLinkPreview(dataMessage: SSKProtoDataMessage,
body: String?, body: String?,
transaction: YapDatabaseReadWriteTransaction) { transaction: YapDatabaseReadWriteTransaction) -> OWSLinkPreview? {
guard let previewProto = dataMessage.preview else { guard let previewProto = dataMessage.preview else {
return nil return nil
} }
@ -82,11 +82,7 @@ public class OWSLinkPreview: MTLModel {
return nil return nil
} }
self.urlString = urlString return OWSLinkPreview(urlString: urlString, title: title, attachmentId: imageAttachmentId)
self.title = title
self.attachmentId = imageAttachmentId
super.init()
} }
@objc @objc

@ -1288,7 +1288,9 @@ NS_ASSUME_NONNULL_BEGIN
transaction:transaction]; transaction:transaction];
OWSLinkPreview *_Nullable linkPreview = OWSLinkPreview *_Nullable linkPreview =
[[OWSLinkPreview alloc] initWithDataMessage:dataMessage body:body transaction:transaction]; [OWSLinkPreview buildValidatedLinkPreviewWithDataMessage:dataMessage
body:body
transaction:transaction];
OWSLogDebug(@"incoming message from: %@ for group: %@ with timestamp: %lu", OWSLogDebug(@"incoming message from: %@ for group: %@ with timestamp: %lu",
envelopeAddress(envelope), envelopeAddress(envelope),
@ -1354,7 +1356,7 @@ NS_ASSUME_NONNULL_BEGIN
transaction:transaction]; transaction:transaction];
OWSLinkPreview *_Nullable linkPreview = OWSLinkPreview *_Nullable linkPreview =
[[OWSLinkPreview alloc] initWithDataMessage:dataMessage body:body transaction:transaction]; [OWSLinkPreview buildValidatedLinkPreviewWithDataMessage:dataMessage body:body transaction:transaction];
// Legit usage of senderTimestamp when creating incoming message from received envelope // Legit usage of senderTimestamp when creating incoming message from received envelope
TSIncomingMessage *incomingMessage = TSIncomingMessage *incomingMessage =

Loading…
Cancel
Save