fixup plumbing for incoming messages/synced transcripts

pull/1/head
Michael Kirk 7 years ago
parent e096406e56
commit 42bf267607

@ -1647,16 +1647,18 @@ typedef enum : NSUInteger {
attachmentPointer:(TSAttachmentPointer *)attachmentPointer attachmentPointer:(TSAttachmentPointer *)attachmentPointer
{ {
OWSAttachmentsProcessor *processor = OWSAttachmentsProcessor *processor =
[[OWSAttachmentsProcessor alloc] initWithAttachmentPointer:attachmentPointer [[OWSAttachmentsProcessor alloc] initWithAttachmentPointers:@[ attachmentPointer ]];
networkManager:self.networkManager];
[processor fetchAttachmentsForMessage:message [self.editingDatabaseConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *_Nonnull transaction) {
primaryStorage:self.primaryStorage [processor fetchAttachmentsForMessage:message
success:^(NSArray<TSAttachmentStream *> *attachmentStreams) { transaction:transaction
OWSLogInfo(@"Successfully redownloaded attachment in thread: %@", message.thread); success:^(NSArray<TSAttachmentStream *> *attachmentStreams) {
} OWSLogInfo(@"Successfully redownloaded attachment in thread: %@", message.thread);
failure:^(NSError *error) { }
OWSLogWarn(@"Failed to redownload message with error: %@", error); failure:^(NSError *error) {
}]; OWSLogWarn(@"Failed to redownload message with error: %@", error);
}];
}];
} }
- (void)handleUnsentMessageTap:(TSOutgoingMessage *)message - (void)handleUnsentMessageTap:(TSOutgoingMessage *)message
@ -2191,8 +2193,7 @@ typedef enum : NSUInteger {
} }
OWSAttachmentsProcessor *processor = OWSAttachmentsProcessor *processor =
[[OWSAttachmentsProcessor alloc] initWithAttachmentPointer:attachmentPointer [[OWSAttachmentsProcessor alloc] initWithAttachmentPointers:@[ attachmentPointer ]];
networkManager:self.networkManager];
[self.editingDatabaseConnection asyncReadWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) { [self.editingDatabaseConnection asyncReadWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
[processor fetchAttachmentsForMessage:nil [processor fetchAttachmentsForMessage:nil

@ -241,7 +241,7 @@ public class SignalAttachment: NSObject {
@objc @objc
public func buildOutgoingAttachmentInfo(message: TSMessage) -> OutgoingAttachmentInfo { public func buildOutgoingAttachmentInfo(message: TSMessage) -> OutgoingAttachmentInfo {
OWSAssertDebug(message.uniqueId) assert(message.uniqueId != nil)
return OutgoingAttachmentInfo(dataSource: dataSource, return OutgoingAttachmentInfo(dataSource: dataSource,
contentType: mimeType, contentType: mimeType,
sourceFilename: filenameOrDefault, sourceFilename: filenameOrDefault,

@ -78,18 +78,12 @@ NS_ASSUME_NONNULL_BEGIN
return; return;
} }
OWSAttachmentsProcessor *attachmentsProcessor =
[[OWSAttachmentsProcessor alloc] initWithAttachmentProtos:transcript.attachmentPointerProtos
networkManager:self.networkManager
transaction:transaction];
// TODO group updates. Currently desktop doesn't support group updates, so not a problem yet. // TODO group updates. Currently desktop doesn't support group updates, so not a problem yet.
TSOutgoingMessage *outgoingMessage = TSOutgoingMessage *outgoingMessage =
[[TSOutgoingMessage alloc] initOutgoingMessageWithTimestamp:transcript.timestamp [[TSOutgoingMessage alloc] initOutgoingMessageWithTimestamp:transcript.timestamp
inThread:transcript.thread inThread:transcript.thread
messageBody:transcript.body messageBody:transcript.body
attachmentIds:[attachmentsProcessor.attachmentIds mutableCopy] attachmentIds:[NSMutableArray new]
expiresInSeconds:transcript.expirationDuration expiresInSeconds:transcript.expirationDuration
expireStartedAt:transcript.expirationStartedAt expireStartedAt:transcript.expirationStartedAt
isVoiceMessage:NO isVoiceMessage:NO
@ -97,6 +91,14 @@ NS_ASSUME_NONNULL_BEGIN
quotedMessage:transcript.quotedMessage quotedMessage:transcript.quotedMessage
contactShare:transcript.contact]; contactShare:transcript.contact];
NSArray<TSAttachmentPointer *> *attachmentPointers =
[TSAttachmentPointer attachmentPointersFromProtos:transcript.attachmentPointerProtos
albumMessage:outgoingMessage];
for (TSAttachmentPointer *pointer in attachmentPointers) {
[pointer saveWithTransaction:transaction];
[outgoingMessage.attachmentIds addObject:pointer.uniqueId];
}
TSQuotedMessage *_Nullable quotedMessage = transcript.quotedMessage; TSQuotedMessage *_Nullable quotedMessage = transcript.quotedMessage;
if (quotedMessage && quotedMessage.thumbnailAttachmentPointerId) { if (quotedMessage && quotedMessage.thumbnailAttachmentPointerId) {
// We weren't able to derive a local thumbnail, so we'll fetch the referenced attachment. // We weren't able to derive a local thumbnail, so we'll fetch the referenced attachment.
@ -106,8 +108,7 @@ NS_ASSUME_NONNULL_BEGIN
if ([attachmentPointer isKindOfClass:[TSAttachmentPointer class]]) { if ([attachmentPointer isKindOfClass:[TSAttachmentPointer class]]) {
OWSAttachmentsProcessor *attachmentProcessor = OWSAttachmentsProcessor *attachmentProcessor =
[[OWSAttachmentsProcessor alloc] initWithAttachmentPointer:attachmentPointer [[OWSAttachmentsProcessor alloc] initWithAttachmentPointers:@[ attachmentPointer ]];
networkManager:self.networkManager];
OWSLogDebug(@"downloading thumbnail for transcript: %lu", (unsigned long)transcript.timestamp); OWSLogDebug(@"downloading thumbnail for transcript: %lu", (unsigned long)transcript.timestamp);
[attachmentProcessor fetchAttachmentsForMessage:outgoingMessage [attachmentProcessor fetchAttachmentsForMessage:outgoingMessage
@ -160,6 +161,8 @@ NS_ASSUME_NONNULL_BEGIN
[self.readReceiptManager applyEarlyReadReceiptsForOutgoingMessageFromLinkedDevice:outgoingMessage [self.readReceiptManager applyEarlyReadReceiptsForOutgoingMessageFromLinkedDevice:outgoingMessage
transaction:transaction]; transaction:transaction];
OWSAttachmentsProcessor *attachmentsProcessor =
[[OWSAttachmentsProcessor alloc] initWithAttachmentPointers:attachmentPointers];
[attachmentsProcessor [attachmentsProcessor
fetchAttachmentsForMessage:outgoingMessage fetchAttachmentsForMessage:outgoingMessage
transaction:transaction transaction:transaction

@ -23,26 +23,16 @@ extern NSString *const kAttachmentDownloadAttachmentIDKey;
*/ */
@interface OWSAttachmentsProcessor : NSObject @interface OWSAttachmentsProcessor : NSObject
@property (nonatomic, readonly) NSArray<NSString *> *attachmentIds;
@property (nonatomic, readonly) NSArray<TSAttachmentPointer *> *attachmentPointers; @property (nonatomic, readonly) NSArray<TSAttachmentPointer *> *attachmentPointers;
@property (nonatomic, readonly) BOOL hasSupportedAttachments;
- (instancetype)init NS_UNAVAILABLE; - (instancetype)init NS_UNAVAILABLE;
- (instancetype)initWithAttachmentProtos:(NSArray<SSKProtoAttachmentPointer *> *)attachmentProtos
networkManager:(TSNetworkManager *)networkManager
transaction:(YapDatabaseReadWriteTransaction *)transaction NS_DESIGNATED_INITIALIZER;
/* /*
* Retry fetching failed attachment download * Retry fetching failed attachment download
*/ */
- (instancetype)initWithAttachmentPointer:(TSAttachmentPointer *)attachmentPointer - (instancetype)initWithAttachmentPointers:(NSArray<TSAttachmentPointer *> *)attachmentPointers
networkManager:(TSNetworkManager *)networkManager NS_DESIGNATED_INITIALIZER; NS_DESIGNATED_INITIALIZER;
- (void)fetchAttachmentsForMessage:(nullable TSMessage *)message
primaryStorage:(OWSPrimaryStorage *)primaryStorage
success:(void (^)(NSArray<TSAttachmentStream *> *attachmentStreams))successHandler
failure:(void (^)(NSError *error))failureHandler;
- (void)fetchAttachmentsForMessage:(nullable TSMessage *)message - (void)fetchAttachmentsForMessage:(nullable TSMessage *)message
transaction:(YapDatabaseReadWriteTransaction *)transaction transaction:(YapDatabaseReadWriteTransaction *)transaction
success:(void (^)(NSArray<TSAttachmentStream *> *attachmentStreams))successHandler success:(void (^)(NSArray<TSAttachmentStream *> *attachmentStreams))successHandler

@ -12,6 +12,7 @@
#import "OWSFileSystem.h" #import "OWSFileSystem.h"
#import "OWSPrimaryStorage.h" #import "OWSPrimaryStorage.h"
#import "OWSRequestFactory.h" #import "OWSRequestFactory.h"
#import "SSKEnvironment.h"
#import "TSAttachmentPointer.h" #import "TSAttachmentPointer.h"
#import "TSAttachmentStream.h" #import "TSAttachmentStream.h"
#import "TSGroupModel.h" #import "TSGroupModel.h"
@ -43,68 +44,27 @@ static const CGFloat kAttachmentDownloadProgressTheta = 0.001f;
@implementation OWSAttachmentsProcessor @implementation OWSAttachmentsProcessor
- (instancetype)initWithAttachmentPointer:(TSAttachmentPointer *)attachmentPointer - (instancetype)initWithAttachmentPointers:(NSArray<TSAttachmentPointer *> *)attachmentPointers
networkManager:(TSNetworkManager *)networkManager
{ {
self = [super init]; self = [super init];
if (!self) { if (!self) {
return self; return self;
} }
_networkManager = networkManager; _attachmentPointers = attachmentPointers;
_attachmentPointers = @[ attachmentPointer ];
_attachmentIds = @[ attachmentPointer.uniqueId ];
return self; return self;
} }
- (instancetype)initWithAttachmentProtos:(NSArray<SSKProtoAttachmentPointer *> *)attachmentProtos #pragma mark - Dependencies
networkManager:(TSNetworkManager *)networkManager
transaction:(YapDatabaseReadWriteTransaction *)transaction
{
self = [super init];
if (!self) {
return self;
}
_networkManager = networkManager;
NSMutableArray<NSString *> *attachmentIds = [NSMutableArray new];
NSMutableArray<TSAttachmentPointer *> *attachmentPointers = [NSMutableArray new];
for (SSKProtoAttachmentPointer *attachmentProto in attachmentProtos) {
TSAttachmentPointer *_Nullable pointer = [TSAttachmentPointer attachmentPointerFromProto:attachmentProto];
if (!pointer) {
OWSFailDebug(@"Invalid attachment.");
continue;
}
[attachmentIds addObject:pointer.uniqueId];
[pointer saveWithTransaction:transaction];
[attachmentPointers addObject:pointer];
}
_attachmentIds = [attachmentIds copy]; - (TSNetworkManager *)networkManager
_attachmentPointers = [attachmentPointers copy];
return self;
}
// PERF: Remove this and use a pre-existing dbConnection
- (void)fetchAttachmentsForMessage:(nullable TSMessage *)message
primaryStorage:(OWSPrimaryStorage *)primaryStorage
success:(void (^)(NSArray<TSAttachmentStream *> *attachmentStreams))successHandler
failure:(void (^)(NSError *error))failureHandler
{ {
[[primaryStorage newDatabaseConnection] readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) { return SSKEnvironment.shared.networkManager;
[self fetchAttachmentsForMessage:message
transaction:transaction
success:successHandler
failure:failureHandler];
}];
} }
#pragma mark
- (void)fetchAttachmentsForMessage:(nullable TSMessage *)message - (void)fetchAttachmentsForMessage:(nullable TSMessage *)message
transaction:(YapDatabaseReadWriteTransaction *)transaction transaction:(YapDatabaseReadWriteTransaction *)transaction
success:(void (^)(NSArray<TSAttachmentStream *> *attachmentStreams))successHandler success:(void (^)(NSArray<TSAttachmentStream *> *attachmentStreams))successHandler
@ -516,11 +476,6 @@ static const CGFloat kAttachmentDownloadProgressTheta = 0.001f;
} }
} }
- (BOOL)hasSupportedAttachments
{
return self.attachmentPointers.count > 0;
}
@end @end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END

@ -7,6 +7,7 @@
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@class SSKProtoAttachmentPointer; @class SSKProtoAttachmentPointer;
@class TSMessage;
typedef NS_ENUM(NSUInteger, TSAttachmentPointerState) { typedef NS_ENUM(NSUInteger, TSAttachmentPointerState) {
TSAttachmentPointerStateEnqueued = 0, TSAttachmentPointerStateEnqueued = 0,
@ -31,7 +32,12 @@ typedef NS_ENUM(NSUInteger, TSAttachmentPointerState) {
albumMessageId:(nullable NSString *)albumMessageId albumMessageId:(nullable NSString *)albumMessageId
attachmentType:(TSAttachmentType)attachmentType NS_DESIGNATED_INITIALIZER; attachmentType:(TSAttachmentType)attachmentType NS_DESIGNATED_INITIALIZER;
+ (nullable TSAttachmentPointer *)attachmentPointerFromProto:(SSKProtoAttachmentPointer *)attachmentProto; + (nullable TSAttachmentPointer *)attachmentPointerFromProto:(SSKProtoAttachmentPointer *)attachmentProto
albumMessage:(nullable TSMessage *)message;
+ (NSArray<TSAttachmentPointer *> *)attachmentPointersFromProtos:
(NSArray<SSKProtoAttachmentPointer *> *)attachmentProtos
albumMessage:(TSMessage *)message;
@property (atomic) TSAttachmentPointerState state; @property (atomic) TSAttachmentPointerState state;
@property (nullable, atomic) NSString *mostRecentFailureLocalizedText; @property (nullable, atomic) NSString *mostRecentFailureLocalizedText;

@ -55,9 +55,8 @@ NS_ASSUME_NONNULL_BEGIN
return self; return self;
} }
+ (nullable TSAttachmentPointer *)attachmentPointerFromProto:(SSKProtoAttachmentPointer *)attachmentProto + (nullable TSAttachmentPointer *)attachmentPointerFromProto:(SSKProtoAttachmentPointer *)attachmentProto
message:(TSMessage *)message albumMessage:(nullable TSMessage *)albumMessage
{ {
if (attachmentProto.id < 1) { if (attachmentProto.id < 1) {
OWSFailDebug(@"Invalid attachment id."); OWSFailDebug(@"Invalid attachment id.");
@ -86,10 +85,10 @@ NS_ASSUME_NONNULL_BEGIN
if (attachmentProto.hasCaption) { if (attachmentProto.hasCaption) {
caption = attachmentProto.caption; caption = attachmentProto.caption;
} }
NSString *_Nullable albumMessageId; NSString *_Nullable albumMessageId;
if ([MIMETypeUtil isVisualMedia:attachmentProto.contentType]) { if (albumMessage != nil) {
OWSAssertDebug(message.uniqueId); albumMessageId = albumMessage.uniqueId;
albumMessageId = message.uniqueId;
} }
TSAttachmentPointer *pointer = [[TSAttachmentPointer alloc] initWithServerId:attachmentProto.id TSAttachmentPointer *pointer = [[TSAttachmentPointer alloc] initWithServerId:attachmentProto.id
@ -104,6 +103,21 @@ NS_ASSUME_NONNULL_BEGIN
return pointer; return pointer;
} }
+ (NSArray<TSAttachmentPointer *> *)attachmentPointersFromProtos:
(NSArray<SSKProtoAttachmentPointer *> *)attachmentProtos
albumMessage:(TSMessage *)albumMessage
{
NSMutableArray *attachmentPointers = [NSMutableArray new];
for (SSKProtoAttachmentPointer *attachmentProto in attachmentProtos) {
TSAttachmentPointer *_Nullable attachmentPointer =
[self attachmentPointerFromProto:attachmentProto albumMessage:albumMessage];
if (attachmentPointer) {
[attachmentPointers addObject:attachmentPointer];
}
}
return [attachmentPointers copy];
}
- (BOOL)isDecimalNumberText:(NSString *)text - (BOOL)isDecimalNumberText:(NSString *)text
{ {
return [text componentsSeparatedByCharactersInSet:[NSCharacterSet decimalDigitCharacterSet]].count == 1; return [text componentsSeparatedByCharactersInSet:[NSCharacterSet decimalDigitCharacterSet]].count == 1;

@ -1000,7 +1000,7 @@ NSString *NSStringForContactAddressType(OWSContactAddressType value)
SSKProtoAttachmentPointer *avatarAttachment = avatarInfo.avatar; SSKProtoAttachmentPointer *avatarAttachment = avatarInfo.avatar;
TSAttachmentPointer *_Nullable attachmentPointer = TSAttachmentPointer *_Nullable attachmentPointer =
[TSAttachmentPointer attachmentPointerFromProto:avatarAttachment]; [TSAttachmentPointer attachmentPointerFromProto:avatarAttachment albumMessage:nil];
if (attachmentPointer) { if (attachmentPointer) {
[attachmentPointer saveWithTransaction:transaction]; [attachmentPointer saveWithTransaction:transaction];
contact.avatarAttachmentId = attachmentPointer.uniqueId; contact.avatarAttachmentId = attachmentPointer.uniqueId;

@ -188,7 +188,7 @@ NS_ASSUME_NONNULL_BEGIN
SSKProtoAttachmentPointer *thumbnailAttachmentProto = quotedAttachment.thumbnail; SSKProtoAttachmentPointer *thumbnailAttachmentProto = quotedAttachment.thumbnail;
TSAttachmentPointer *_Nullable thumbnailPointer = TSAttachmentPointer *_Nullable thumbnailPointer =
[TSAttachmentPointer attachmentPointerFromProto:thumbnailAttachmentProto]; [TSAttachmentPointer attachmentPointerFromProto:thumbnailAttachmentProto albumMessage:nil];
if (thumbnailPointer) { if (thumbnailPointer) {
[thumbnailPointer saveWithTransaction:transaction]; [thumbnailPointer saveWithTransaction:transaction];

@ -729,15 +729,11 @@ NS_ASSUME_NONNULL_BEGIN
return; return;
} }
TSAttachmentPointer *avatarPointer =
[TSAttachmentPointer attachmentPointerFromProto:dataMessage.group.avatar albumMessage:nil];
OWSAttachmentsProcessor *attachmentsProcessor = OWSAttachmentsProcessor *attachmentsProcessor =
[[OWSAttachmentsProcessor alloc] initWithAttachmentProtos:@[ dataMessage.group.avatar ] [[OWSAttachmentsProcessor alloc] initWithAttachmentPointers:@[ avatarPointer ]];
networkManager:self.networkManager
transaction:transaction];
if (!attachmentsProcessor.hasSupportedAttachments) {
OWSLogWarn(@"received unsupported group avatar envelope");
return;
}
[attachmentsProcessor fetchAttachmentsForMessage:nil [attachmentsProcessor fetchAttachmentsForMessage:nil
transaction:transaction transaction:transaction
success:^(NSArray<TSAttachmentStream *> *attachmentStreams) { success:^(NSArray<TSAttachmentStream *> *attachmentStreams) {
@ -775,26 +771,26 @@ NS_ASSUME_NONNULL_BEGIN
return; return;
} }
OWSAttachmentsProcessor *attachmentsProcessor =
[[OWSAttachmentsProcessor alloc] initWithAttachmentProtos:dataMessage.attachments
networkManager:self.networkManager
transaction:transaction];
if (!attachmentsProcessor.hasSupportedAttachments) {
OWSLogWarn(@"received unsupported media envelope");
return;
}
TSIncomingMessage *_Nullable createdMessage = [self handleReceivedEnvelope:envelope TSIncomingMessage *_Nullable createdMessage = [self handleReceivedEnvelope:envelope
withDataMessage:dataMessage withDataMessage:dataMessage
attachmentIds:attachmentsProcessor.attachmentIds
transaction:transaction]; transaction:transaction];
if (!createdMessage) { if (!createdMessage) {
return; return;
} }
NSArray<TSAttachmentPointer *> *attachmentPointers =
[TSAttachmentPointer attachmentPointersFromProtos:dataMessage.attachments albumMessage:createdMessage];
for (TSAttachmentPointer *pointer in attachmentPointers) {
[pointer saveWithTransaction:transaction];
[createdMessage.attachmentIds addObject:pointer.uniqueId];
}
[createdMessage saveWithTransaction:transaction];
OWSLogDebug(@"incoming attachment message: %@", createdMessage.debugDescription); OWSLogDebug(@"incoming attachment message: %@", createdMessage.debugDescription);
OWSAttachmentsProcessor *attachmentsProcessor =
[[OWSAttachmentsProcessor alloc] initWithAttachmentPointers:attachmentPointers];
[attachmentsProcessor fetchAttachmentsForMessage:createdMessage [attachmentsProcessor fetchAttachmentsForMessage:createdMessage
transaction:transaction transaction:transaction
success:^(NSArray<TSAttachmentStream *> *attachmentStreams) { success:^(NSArray<TSAttachmentStream *> *attachmentStreams) {
@ -1054,7 +1050,7 @@ NS_ASSUME_NONNULL_BEGIN
return; return;
} }
[self handleReceivedEnvelope:envelope withDataMessage:dataMessage attachmentIds:@[] transaction:transaction]; [self handleReceivedEnvelope:envelope withDataMessage:dataMessage transaction:transaction];
} }
- (void)handleGroupInfoRequest:(SSKProtoEnvelope *)envelope - (void)handleGroupInfoRequest:(SSKProtoEnvelope *)envelope
@ -1137,7 +1133,6 @@ NS_ASSUME_NONNULL_BEGIN
- (TSIncomingMessage *_Nullable)handleReceivedEnvelope:(SSKProtoEnvelope *)envelope - (TSIncomingMessage *_Nullable)handleReceivedEnvelope:(SSKProtoEnvelope *)envelope
withDataMessage:(SSKProtoDataMessage *)dataMessage withDataMessage:(SSKProtoDataMessage *)dataMessage
attachmentIds:(NSArray<NSString *> *)attachmentIds
transaction:(YapDatabaseReadWriteTransaction *)transaction transaction:(YapDatabaseReadWriteTransaction *)transaction
{ {
if (!envelope) { if (!envelope) {
@ -1247,14 +1242,6 @@ NS_ASSUME_NONNULL_BEGIN
return nil; return nil;
} }
if (body.length == 0 && attachmentIds.count < 1 && !contact) {
OWSLogWarn(@"ignoring empty incoming message from: %@ for group: %@ with timestamp: %lu",
envelopeAddress(envelope),
groupId,
(unsigned long)timestamp);
return nil;
}
TSQuotedMessage *_Nullable quotedMessage = [TSQuotedMessage quotedMessageForDataMessage:dataMessage TSQuotedMessage *_Nullable quotedMessage = [TSQuotedMessage quotedMessageForDataMessage:dataMessage
thread:oldGroupThread thread:oldGroupThread
transaction:transaction]; transaction:transaction];
@ -1270,7 +1257,7 @@ NS_ASSUME_NONNULL_BEGIN
authorId:envelope.source authorId:envelope.source
sourceDeviceId:envelope.sourceDevice sourceDeviceId:envelope.sourceDevice
messageBody:body messageBody:body
attachmentIds:attachmentIds attachmentIds:@[]
expiresInSeconds:dataMessage.expireTimer expiresInSeconds:dataMessage.expireTimer
quotedMessage:quotedMessage quotedMessage:quotedMessage
contactShare:contact contactShare:contact
@ -1289,13 +1276,6 @@ NS_ASSUME_NONNULL_BEGIN
} }
} }
} else { } else {
if (body.length == 0 && attachmentIds.count < 1 && !contact) {
OWSLogWarn(@"ignoring empty incoming message from: %@ with timestamp: %lu",
envelopeAddress(envelope),
(unsigned long)timestamp);
return nil;
}
OWSLogDebug( OWSLogDebug(
@"incoming message from: %@ with timestamp: %lu", envelopeAddress(envelope), (unsigned long)timestamp); @"incoming message from: %@ with timestamp: %lu", envelopeAddress(envelope), (unsigned long)timestamp);
TSContactThread *thread = TSContactThread *thread =
@ -1311,7 +1291,7 @@ NS_ASSUME_NONNULL_BEGIN
authorId:[thread contactIdentifier] authorId:[thread contactIdentifier]
sourceDeviceId:envelope.sourceDevice sourceDeviceId:envelope.sourceDevice
messageBody:body messageBody:body
attachmentIds:attachmentIds attachmentIds:@[]
expiresInSeconds:dataMessage.expireTimer expiresInSeconds:dataMessage.expireTimer
quotedMessage:quotedMessage quotedMessage:quotedMessage
contactShare:contact contactShare:contact
@ -1365,8 +1345,7 @@ NS_ASSUME_NONNULL_BEGIN
if ([attachmentPointer isKindOfClass:[TSAttachmentPointer class]]) { if ([attachmentPointer isKindOfClass:[TSAttachmentPointer class]]) {
OWSAttachmentsProcessor *attachmentProcessor = OWSAttachmentsProcessor *attachmentProcessor =
[[OWSAttachmentsProcessor alloc] initWithAttachmentPointer:attachmentPointer [[OWSAttachmentsProcessor alloc] initWithAttachmentPointers:@[ attachmentPointer ]];
networkManager:self.networkManager];
OWSLogDebug(@"downloading thumbnail for message: %lu", (unsigned long)incomingMessage.timestamp); OWSLogDebug(@"downloading thumbnail for message: %lu", (unsigned long)incomingMessage.timestamp);
[attachmentProcessor fetchAttachmentsForMessage:incomingMessage [attachmentProcessor fetchAttachmentsForMessage:incomingMessage
@ -1396,8 +1375,7 @@ NS_ASSUME_NONNULL_BEGIN
OWSFailDebug(@"avatar attachmentPointer was unexpectedly nil"); OWSFailDebug(@"avatar attachmentPointer was unexpectedly nil");
} else { } else {
OWSAttachmentsProcessor *attachmentProcessor = OWSAttachmentsProcessor *attachmentProcessor =
[[OWSAttachmentsProcessor alloc] initWithAttachmentPointer:attachmentPointer [[OWSAttachmentsProcessor alloc] initWithAttachmentPointers:@[ attachmentPointer ]];
networkManager:self.networkManager];
OWSLogDebug(@"downloading contact avatar for message: %lu", (unsigned long)incomingMessage.timestamp); OWSLogDebug(@"downloading contact avatar for message: %lu", (unsigned long)incomingMessage.timestamp);
[attachmentProcessor fetchAttachmentsForMessage:incomingMessage [attachmentProcessor fetchAttachmentsForMessage:incomingMessage

Loading…
Cancel
Save