Respond to CR.

// FREEBIE
pull/1/head
Matthew Chen 8 years ago
parent 00feb14b10
commit 19ba564f80

@ -44,7 +44,7 @@ import PromiseKit
profileManager: self.profileManager)
let dataSource = DataSourceValue.dataSource(withSyncMessage: syncContactsMessage.buildPlainTextAttachmentData())
self.messageSender.enqueueOutgoingTemporaryAttachment(dataSource,
self.messageSender.enqueueTemporaryAttachment(dataSource,
contentType: OWSMimeTypeApplicationOctetStream,
in: syncContactsMessage,
success: {

@ -1465,7 +1465,7 @@ const NSUInteger kOWSProfileManager_MaxAvatarDiameter = 640;
return;
}
[self.messageSender enqueueOutgoingMessage:message
[self.messageSender enqueueMessage:message
success:^{
DDLogInfo(@"%@ Successfully sent profile key message to thread: %@", self.logTag, thread);
[OWSProfileManager.sharedManager addThreadToProfileWhitelist:thread];

@ -1654,7 +1654,7 @@ typedef NS_ENUM(NSInteger, MessagesRangeSizeMode) {
[UIAlertAction actionWithTitle:NSLocalizedString(@"SEND_AGAIN_BUTTON", @"")
style:UIAlertActionStyleDefault
handler:^(UIAlertAction *_Nonnull action) {
[self.messageSender enqueueOutgoingMessage:message
[self.messageSender enqueueMessage:message
success:^{
DDLogInfo(@"%@ Successfully resent failed message.", self.logTag);
}
@ -3391,7 +3391,7 @@ typedef NS_ENUM(NSInteger, MessagesRangeSizeMode) {
if (newGroupModel.groupImage) {
NSData *data = UIImagePNGRepresentation(newGroupModel.groupImage);
DataSource *_Nullable dataSource = [DataSourceValue dataSourceWithData:data fileExtension:@"png"];
[self.messageSender enqueueOutgoingAttachment:dataSource
[self.messageSender enqueueAttachment:dataSource
contentType:OWSMimeTypeImagePng
sourceFilename:nil
inMessage:message
@ -3405,7 +3405,7 @@ typedef NS_ENUM(NSInteger, MessagesRangeSizeMode) {
DDLogError(@"%@ Failed to send group avatar update with error: %@", self.logTag, error);
}];
} else {
[self.messageSender enqueueOutgoingMessage:message
[self.messageSender enqueueMessage:message
success:^{
DDLogDebug(@"%@ Successfully sent group update", self.logTag);
if (successCompletion) {

@ -219,7 +219,7 @@ NS_ASSUME_NONNULL_BEGIN
OWSSyncGroupsRequestMessage *syncGroupsRequestMessage =
[[OWSSyncGroupsRequestMessage alloc] initWithThread:thread
groupId:[Randomness generateRandomBytes:16]];
[[Environment getCurrent].messageSender enqueueOutgoingMessage:syncGroupsRequestMessage
[[Environment getCurrent].messageSender enqueueMessage:syncGroupsRequestMessage
success:^{
DDLogWarn(@"%@ Successfully sent Request Group Info message.", self.logTag);
}
@ -1066,11 +1066,11 @@ NS_ASSUME_NONNULL_BEGIN
});
});
};
[messageSender enqueueOutgoingMessage:message
success:completion
failure:^(NSError *error) {
completion();
}];
[messageSender enqueueMessage:message
success:completion
failure:^(NSError *error) {
completion();
}];
}
+ (void)injectFakeIncomingMessages:(int)counter thread:(TSThread *)thread

@ -437,7 +437,7 @@ NS_ASSUME_NONNULL_BEGIN
OWSAssert(message);
OWSMessageSender *messageSender = [Environment getCurrent].messageSender;
[messageSender enqueueOutgoingMessage:message
[messageSender enqueueMessage:message
success:^{
DDLogInfo(@"%@ Successfully sent message.", self.logTag);
}

@ -679,7 +679,7 @@ typedef NS_ENUM(NSInteger, CellState) { kArchiveState, kInboxState };
TSOutgoingMessage *message = [[TSOutgoingMessage alloc] initWithTimestamp:[NSDate ows_millisecondTimeStamp]
inThread:thread
groupMetaMessage:TSGroupMessageQuit];
[self.messageSender enqueueOutgoingMessage:message
[self.messageSender enqueueMessage:message
success:^{
[self dismissViewControllerAnimated:YES
completion:^{

@ -500,16 +500,14 @@ const NSUInteger kNewGroupViewControllerAvatarWidth = 68;
NSData *data = UIImagePNGRepresentation(model.groupImage);
DataSource *_Nullable dataSource =
[DataSourceValue dataSourceWithData:data fileExtension:@"png"];
[self.messageSender enqueueOutgoingAttachment:dataSource
contentType:OWSMimeTypeImagePng
sourceFilename:nil
inMessage:message
success:successHandler
failure:failureHandler];
[self.messageSender enqueueAttachment:dataSource
contentType:OWSMimeTypeImagePng
sourceFilename:nil
inMessage:message
success:successHandler
failure:failureHandler];
} else {
[self.messageSender enqueueOutgoingMessage:message
success:successHandler
failure:failureHandler];
[self.messageSender enqueueMessage:message success:successHandler failure:failureHandler];
}
});
}];

@ -885,7 +885,7 @@ NS_ASSUME_NONNULL_BEGIN
TSOutgoingMessage *message = [[TSOutgoingMessage alloc] initWithTimestamp:[NSDate ows_millisecondTimeStamp]
inThread:gThread
groupMetaMessage:TSGroupMessageQuit];
[self.messageSender enqueueOutgoingMessage:message
[self.messageSender enqueueMessage:message
success:^{
DDLogInfo(@"%@ Successfully left group.", self.logTag);
}

@ -115,7 +115,7 @@ NSString *const kTSStorageManagerOWSContactsSyncingLastMessageKey =
DataSource *dataSource =
[DataSourceValue dataSourceWithSyncMessage:[syncContactsMessage buildPlainTextAttachmentData]];
[self.messageSender enqueueOutgoingTemporaryAttachment:dataSource
[self.messageSender enqueueTemporaryAttachment:dataSource
contentType:OWSMimeTypeApplicationOctetStream
inMessage:syncContactsMessage
success:^{

@ -86,7 +86,7 @@ NS_ASSUME_NONNULL_BEGIN
attachmentIds:[NSMutableArray new]
expiresInSeconds:(configuration.isEnabled ? configuration.durationSeconds : 0)];
[messageSender enqueueOutgoingMessage:message success:successHandler failure:failureHandler];
[messageSender enqueueMessage:message success:successHandler failure:failureHandler];
return message;
}
@ -117,7 +117,7 @@ NS_ASSUME_NONNULL_BEGIN
inThread:thread
isVoiceMessage:[attachment isVoiceMessage]
expiresInSeconds:(configuration.isEnabled ? configuration.durationSeconds : 0)];
[messageSender enqueueOutgoingAttachment:attachment.dataSource
[messageSender enqueueAttachment:attachment.dataSource
contentType:attachment.mimeType
sourceFilename:attachment.filenameOrDefault
inMessage:message

@ -258,7 +258,7 @@ NSString *const kOWSBlockingManager_SyncedBlockedPhoneNumbersKey = @"kOWSBlockin
OWSBlockedPhoneNumbersMessage *message =
[[OWSBlockedPhoneNumbersMessage alloc] initWithPhoneNumbers:blockedPhoneNumbers];
[self.messageSender enqueueOutgoingMessage:message
[self.messageSender enqueueMessage:message
success:^{
DDLogInfo(@"%@ Successfully sent blocked phone numbers sync message", self.logTag);

@ -517,10 +517,10 @@ NSString *const kNSNotificationName_IdentityStateDidChange = @"kNSNotificationNa
// subsequently
OWSOutgoingNullMessage *nullMessage = [[OWSOutgoingNullMessage alloc] initWithContactThread:contactThread
verificationStateSyncMessage:message];
[self.messageSender enqueueOutgoingMessage:nullMessage
[self.messageSender enqueueMessage:nullMessage
success:^{
DDLogInfo(@"%@ Successfully sent verification state NullMessage", self.logTag);
[self.messageSender enqueueOutgoingMessage:message
[self.messageSender enqueueMessage:message
success:^{
DDLogInfo(@"%@ Successfully sent verification state sync message", self.logTag);

@ -366,7 +366,7 @@ NS_ASSUME_NONNULL_BEGIN
OWSSyncGroupsRequestMessage *syncGroupsRequestMessage =
[[OWSSyncGroupsRequestMessage alloc] initWithThread:thread groupId:groupId];
[self.messageSender enqueueOutgoingMessage:syncGroupsRequestMessage
[self.messageSender enqueueMessage:syncGroupsRequestMessage
success:^{
DDLogWarn(@"%@ Successfully sent Request Group Info message.", self.logTag);
}
@ -609,7 +609,7 @@ NS_ASSUME_NONNULL_BEGIN
profileManager:self.profileManager];
DataSource *dataSource =
[DataSourceValue dataSourceWithSyncMessage:[syncContactsMessage buildPlainTextAttachmentData]];
[self.messageSender enqueueOutgoingTemporaryAttachment:dataSource
[self.messageSender enqueueTemporaryAttachment:dataSource
contentType:OWSMimeTypeApplicationOctetStream
inMessage:syncContactsMessage
success:^{
@ -622,7 +622,7 @@ NS_ASSUME_NONNULL_BEGIN
OWSSyncGroupsMessage *syncGroupsMessage = [[OWSSyncGroupsMessage alloc] init];
DataSource *dataSource = [DataSourceValue
dataSourceWithSyncMessage:[syncGroupsMessage buildPlainTextAttachmentDataWithTransaction:transaction]];
[self.messageSender enqueueOutgoingTemporaryAttachment:dataSource
[self.messageSender enqueueTemporaryAttachment:dataSource
contentType:OWSMimeTypeApplicationOctetStream
inMessage:syncGroupsMessage
success:^{
@ -639,7 +639,7 @@ NS_ASSUME_NONNULL_BEGIN
[[OWSReadReceiptManager sharedManager] areReadReceiptsEnabledWithTransaction:transaction];
OWSSyncConfigurationMessage *syncConfigurationMessage =
[[OWSSyncConfigurationMessage alloc] initWithReadReceiptsEnabled:areReadReceiptsEnabled];
[self.messageSender enqueueOutgoingMessage:syncConfigurationMessage
[self.messageSender enqueueMessage:syncConfigurationMessage
success:^{
DDLogInfo(@"%@ Successfully sent Configuration response syncMessage.", self.logTag);
}
@ -774,7 +774,7 @@ NS_ASSUME_NONNULL_BEGIN
if (gThread.groupModel.groupImage) {
NSData *data = UIImagePNGRepresentation(gThread.groupModel.groupImage);
DataSource *_Nullable dataSource = [DataSourceValue dataSourceWithData:data fileExtension:@"png"];
[self.messageSender enqueueOutgoingAttachment:dataSource
[self.messageSender enqueueAttachment:dataSource
contentType:OWSMimeTypeImagePng
sourceFilename:nil
inMessage:message
@ -785,7 +785,7 @@ NS_ASSUME_NONNULL_BEGIN
DDLogError(@"%@ Failed to send group avatar update with error: %@", self.logTag, error);
}];
} else {
[self.messageSender enqueueOutgoingMessage:message
[self.messageSender enqueueMessage:message
success:^{
DDLogDebug(@"%@ Successfully sent group update", self.logTag);
}

@ -63,33 +63,33 @@ NS_SWIFT_NAME(MessageSender)
/**
* Send and resend text messages or resend messages with existing attachments.
* If you haven't yet created the attachment, see the ` enqueueOutgoingAttachment:` variants.
* If you haven't yet created the attachment, see the ` enqueueAttachment:` variants.
*/
// TODO: make transaction nonnull and remove `sendMessage:success:failure`
- (void)enqueueOutgoingMessage:(TSOutgoingMessage *)message
success:(void (^)(void))successHandler
failure:(void (^)(NSError *error))failureHandler;
- (void)enqueueMessage:(TSOutgoingMessage *)message
success:(void (^)(void))successHandler
failure:(void (^)(NSError *error))failureHandler;
/**
* Takes care of allocating and uploading the attachment, then sends the message.
* Only necessary to call once. If sending fails, retry with `sendMessage:`.
*/
- (void)enqueueOutgoingAttachment:(DataSource *)dataSource
contentType:(NSString *)contentType
sourceFilename:(nullable NSString *)sourceFilename
inMessage:(TSOutgoingMessage *)outgoingMessage
success:(void (^)(void))successHandler
failure:(void (^)(NSError *error))failureHandler;
- (void)enqueueAttachment:(DataSource *)dataSource
contentType:(NSString *)contentType
sourceFilename:(nullable NSString *)sourceFilename
inMessage:(TSOutgoingMessage *)outgoingMessage
success:(void (^)(void))successHandler
failure:(void (^)(NSError *error))failureHandler;
/**
* Same as ` enqueueOutgoingAttachment:`, but deletes the local copy of the attachment after sending.
* Same as ` enqueueAttachment:`, but deletes the local copy of the attachment after sending.
* Used for sending sync request data, not for user visible attachments.
*/
- (void)enqueueOutgoingTemporaryAttachment:(DataSource *)dataSource
contentType:(NSString *)contentType
inMessage:(TSOutgoingMessage *)outgoingMessage
success:(void (^)(void))successHandler
failure:(void (^)(NSError *error))failureHandler;
- (void)enqueueTemporaryAttachment:(DataSource *)dataSource
contentType:(NSString *)contentType
inMessage:(TSOutgoingMessage *)outgoingMessage
success:(void (^)(void))successHandler
failure:(void (^)(NSError *error))failureHandler;
/**
* Set local configuration to match that of the of `outgoingMessage`'s sender

@ -419,9 +419,9 @@ NSString *const OWSMessageSenderRateLimitedException = @"RateLimitedException";
}
}
- (void)enqueueOutgoingMessage:(TSOutgoingMessage *)message
success:(void (^)(void))successHandler
failure:(void (^)(NSError *error))failureHandler
- (void)enqueueMessage:(TSOutgoingMessage *)message
success:(void (^)(void))successHandler
failure:(void (^)(NSError *error))failureHandler
{
OWSAssert(message);
@ -509,11 +509,11 @@ NSString *const OWSMessageSenderRateLimitedException = @"RateLimitedException";
failure:failureHandler];
}
- (void)enqueueOutgoingTemporaryAttachment:(DataSource *)dataSource
contentType:(NSString *)contentType
inMessage:(TSOutgoingMessage *)message
success:(void (^)(void))successHandler
failure:(void (^)(NSError *error))failureHandler
- (void)enqueueTemporaryAttachment:(DataSource *)dataSource
contentType:(NSString *)contentType
inMessage:(TSOutgoingMessage *)message
success:(void (^)(void))successHandler
failure:(void (^)(NSError *error))failureHandler
{
OWSAssert(dataSource);
@ -531,20 +531,20 @@ NSString *const OWSMessageSenderRateLimitedException = @"RateLimitedException";
[message remove];
};
[self enqueueOutgoingAttachment:dataSource
contentType:contentType
sourceFilename:nil
inMessage:message
success:successWithDeleteHandler
failure:failureWithDeleteHandler];
[self enqueueAttachment:dataSource
contentType:contentType
sourceFilename:nil
inMessage:message
success:successWithDeleteHandler
failure:failureWithDeleteHandler];
}
- (void)enqueueOutgoingAttachment:(DataSource *)dataSource
contentType:(NSString *)contentType
sourceFilename:(nullable NSString *)sourceFilename
inMessage:(TSOutgoingMessage *)message
success:(void (^)(void))successHandler
failure:(void (^)(NSError *error))failureHandler
- (void)enqueueAttachment:(DataSource *)dataSource
contentType:(NSString *)contentType
sourceFilename:(nullable NSString *)sourceFilename
inMessage:(TSOutgoingMessage *)message
success:(void (^)(void))successHandler
failure:(void (^)(NSError *error))failureHandler
{
OWSAssert(dataSource);
@ -569,7 +569,7 @@ NSString *const OWSMessageSenderRateLimitedException = @"RateLimitedException";
message.attachmentFilenameMap[attachmentStream.uniqueId] = sourceFilename;
}
[self enqueueOutgoingMessage:message success:successHandler failure:failureHandler];
[self enqueueMessage:message success:successHandler failure:failureHandler];
});
}

@ -49,7 +49,7 @@ NS_ASSUME_NONNULL_BEGIN
[[OWSDisappearingMessagesConfigurationMessage alloc] initWithConfiguration:self.configuration
thread:self.thread];
[self.messageSender enqueueOutgoingMessage:message
[self.messageSender enqueueMessage:message
success:^{
DDLogDebug(
@"%@ Successfully notified %@ of new disappearing messages configuration", self.logTag, self.thread);

@ -229,7 +229,7 @@ NSString *const OWSReadReceiptManagerAreReadReceiptsEnabled = @"areReadReceiptsE
OWSReadReceiptsForLinkedDevicesMessage *message =
[[OWSReadReceiptsForLinkedDevicesMessage alloc] initWithReadReceipts:readReceiptsForLinkedDevices];
[self.messageSender enqueueOutgoingMessage:message
[self.messageSender enqueueMessage:message
success:^{
DDLogInfo(@"%@ Successfully sent %zd read receipt to linked devices.",
self.logTag,
@ -253,7 +253,7 @@ NSString *const OWSReadReceiptManagerAreReadReceiptsEnabled = @"areReadReceiptsE
[[OWSReadReceiptsForSenderMessage alloc] initWithThread:thread
messageTimestamps:timestamps.allObjects];
[self.messageSender enqueueOutgoingMessage:message
[self.messageSender enqueueMessage:message
success:^{
DDLogInfo(@"%@ Successfully sent %zd read receipts to sender.", self.logTag, timestamps.count);
}
@ -590,7 +590,7 @@ NSString *const OWSReadReceiptManagerAreReadReceiptsEnabled = @"areReadReceiptsE
OWSSyncConfigurationMessage *syncConfigurationMessage =
[[OWSSyncConfigurationMessage alloc] initWithReadReceiptsEnabled:value];
[self.messageSender enqueueOutgoingMessage:syncConfigurationMessage
[self.messageSender enqueueMessage:syncConfigurationMessage
success:^{
DDLogInfo(@"%@ Successfully sent Configuration syncMessage.", self.logTag);
}

@ -81,8 +81,7 @@ NS_ASSUME_NONNULL_BEGIN
*/
+ (nullable instancetype)fetchObjectWithUniqueID:(NSString *)uniqueID
transaction:(YapDatabaseReadTransaction *)transaction
NS_SWIFT_NAME(fetch(uniqueId:transaction
:));
NS_SWIFT_NAME(fetch(uniqueId:transaction:));
+ (nullable instancetype)fetchObjectWithUniqueID:(NSString *)uniqueID NS_SWIFT_NAME(fetch(uniqueId:));
/**

Loading…
Cancel
Save