Add debug UI for multi-image sends.

pull/1/head
Matthew Chen 7 years ago
parent f6591fac25
commit ecba67b511

@ -481,6 +481,7 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType)
if (message.attachmentIds.count == 0) { if (message.attachmentIds.count == 0) {
return nil; return nil;
} }
// TODO: Support multi-image messages.
NSString *_Nullable attachmentId = message.attachmentIds.firstObject; NSString *_Nullable attachmentId = message.attachmentIds.firstObject;
if (attachmentId.length == 0) { if (attachmentId.length == 0) {
return nil; return nil;

@ -398,6 +398,7 @@ class MessageDetailViewController: OWSViewController, MediaGalleryDataSourceDele
} }
private func fetchAttachment(transaction: YapDatabaseReadTransaction) -> TSAttachment? { private func fetchAttachment(transaction: YapDatabaseReadTransaction) -> TSAttachment? {
// TODO: Support multi-image messages.
guard let attachmentId = message.attachmentIds.firstObject as? String else { guard let attachmentId = message.attachmentIds.firstObject as? String else {
return nil return nil
} }

@ -579,6 +579,7 @@ typedef void (^SendMessageBlock)(SendCompletionBlock completion);
return; return;
} }
// TODO: Support multi-image messages.
NSString *_Nullable attachmentRecordId = self.outgoingMessage.attachmentIds.firstObject; NSString *_Nullable attachmentRecordId = self.outgoingMessage.attachmentIds.firstObject;
if (!attachmentRecordId) { if (!attachmentRecordId) {
OWSLogDebug(@"Ignoring upload progress until outgoing message has an attachment record id"); OWSLogDebug(@"Ignoring upload progress until outgoing message has an attachment record id");

@ -376,11 +376,10 @@ NSString *const OWSMessageSenderRateLimitedException = @"RateLimitedException";
success:successHandler success:successHandler
failure:failureHandler]; failure:failureHandler];
// TODO de-dupe attachment enque logic. // TODO: de-dupe attachment enqueue logic.
if (message.hasAttachments) { for (NSString *attachmentId in message.attachmentIds) {
OWSUploadOperation *uploadAttachmentOperation = OWSUploadOperation *uploadAttachmentOperation =
[[OWSUploadOperation alloc] initWithAttachmentId:message.attachmentIds.firstObject [[OWSUploadOperation alloc] initWithAttachmentId:attachmentId dbConnection:self.dbConnection];
dbConnection:self.dbConnection];
[sendMessageOperation addDependency:uploadAttachmentOperation]; [sendMessageOperation addDependency:uploadAttachmentOperation];
[sendingQueue addOperation:uploadAttachmentOperation]; [sendingQueue addOperation:uploadAttachmentOperation];
} }

@ -609,6 +609,7 @@ public class ShareViewController: UIViewController, ShareViewDelegate, SAEFailed
} }
// Prefer a URL provider if available // Prefer a URL provider if available
// TODO: Support multi-image messages.
if let preferredAttachment = attachments.first(where: { (attachment: Any) -> Bool in if let preferredAttachment = attachments.first(where: { (attachment: Any) -> Bool in
guard let itemProvider = attachment as? NSItemProvider else { guard let itemProvider = attachment as? NSItemProvider else {
return false return false

Loading…
Cancel
Save