parent
a9459757f0
commit
1d4c0624be
|
@ -2764,11 +2764,10 @@ typedef enum : NSUInteger {
|
|||
(unsigned long)[attachment dataLength],
|
||||
[attachment mimeType]);
|
||||
|
||||
TSQuotedMessage *_Nullable quotedMessage = [self.inputToolbar.quotedReply buildQuotedMessage];
|
||||
BOOL didAddToProfileWhitelist = [ThreadUtil addThreadToProfileWhitelistIfEmptyContactThread:self.thread];
|
||||
TSOutgoingMessage *message = [ThreadUtil sendMessageWithAttachment:attachment
|
||||
inThread:self.thread
|
||||
quotedMessage:quotedMessage
|
||||
quotedReplyModel:self.inputToolbar.quotedReply
|
||||
messageSender:self.messageSender
|
||||
completion:nil];
|
||||
|
||||
|
@ -4026,20 +4025,19 @@ typedef enum : NSUInteger {
|
|||
BOOL didAddToProfileWhitelist = [ThreadUtil addThreadToProfileWhitelistIfEmptyContactThread:self.thread];
|
||||
TSOutgoingMessage *message;
|
||||
|
||||
TSQuotedMessage *_Nullable quotedMessage = [self.inputToolbar.quotedReply buildQuotedMessage];
|
||||
if ([text lengthOfBytesUsingEncoding:NSUTF8StringEncoding] >= kOversizeTextMessageSizeThreshold) {
|
||||
DataSource *_Nullable dataSource = [DataSourceValue dataSourceWithOversizeText:text];
|
||||
SignalAttachment *attachment =
|
||||
[SignalAttachment attachmentWithDataSource:dataSource dataUTI:kOversizeTextAttachmentUTI];
|
||||
message = [ThreadUtil sendMessageWithAttachment:attachment
|
||||
inThread:self.thread
|
||||
quotedMessage:quotedMessage
|
||||
quotedReplyModel:self.inputToolbar.quotedReply
|
||||
messageSender:self.messageSender
|
||||
completion:nil];
|
||||
} else {
|
||||
message = [ThreadUtil sendMessageWithText:text
|
||||
inThread:self.thread
|
||||
quotedMessage:quotedMessage
|
||||
quotedReplyModel:self.inputToolbar.quotedReply
|
||||
messageSender:self.messageSender];
|
||||
}
|
||||
|
||||
|
|
|
@ -474,7 +474,6 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType)
|
|||
self.quotedReply =
|
||||
[[OWSQuotedReplyModel alloc] initWithQuotedMessage:message.quotedMessage transaction:transaction];
|
||||
|
||||
// TODO move this to OWSQuotedReplyModel?
|
||||
if (self.quotedReply.body.length > 0) {
|
||||
self.displayableQuotedText =
|
||||
[self displayableQuotedTextForText:self.quotedReply.body interactionId:message.uniqueId];
|
||||
|
@ -482,7 +481,6 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType)
|
|||
}
|
||||
}
|
||||
|
||||
// TODO converge naming
|
||||
- (nullable NSString *)quotedAttachmentMimetype
|
||||
{
|
||||
return self.quotedReply.contentType;
|
||||
|
|
|
@ -281,7 +281,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
NSString *text = [[[@(counter) description] stringByAppendingString:@" "] stringByAppendingString:randomText];
|
||||
OWSMessageSender *messageSender = [Environment current].messageSender;
|
||||
TSOutgoingMessage *message =
|
||||
[ThreadUtil sendMessageWithText:text inThread:thread quotedMessage:nil messageSender:messageSender];
|
||||
[ThreadUtil sendMessageWithText:text inThread:thread quotedReplyModel:nil messageSender:messageSender];
|
||||
DDLogError(@"%@ sendTextMessageInThread timestamp: %llu.", self.logTag, message.timestamp);
|
||||
}
|
||||
|
||||
|
@ -345,7 +345,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
OWSAssert(![attachment hasError]);
|
||||
[ThreadUtil sendMessageWithAttachment:attachment
|
||||
inThread:thread
|
||||
quotedMessage:nil
|
||||
quotedReplyModel:nil
|
||||
messageSender:messageSender
|
||||
completion:nil];
|
||||
success();
|
||||
|
@ -1716,7 +1716,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
OWSMessageSender *messageSender = [Environment current].messageSender;
|
||||
[ThreadUtil sendMessageWithAttachment:attachment
|
||||
inThread:thread
|
||||
quotedMessage:nil
|
||||
quotedReplyModel:nil
|
||||
messageSender:messageSender
|
||||
completion:nil];
|
||||
success();
|
||||
|
@ -2907,7 +2907,7 @@ isQuotedMessageAttachmentDownloaded:(BOOL)isQuotedMessageAttachmentDownloaded
|
|||
[SignalAttachment attachmentWithDataSource:dataSource dataUTI:kOversizeTextAttachmentUTI];
|
||||
[ThreadUtil sendMessageWithAttachment:attachment
|
||||
inThread:thread
|
||||
quotedMessage:nil
|
||||
quotedReplyModel:nil
|
||||
messageSender:messageSender
|
||||
completion:nil];
|
||||
}
|
||||
|
@ -2944,7 +2944,7 @@ isQuotedMessageAttachmentDownloaded:(BOOL)isQuotedMessageAttachmentDownloaded
|
|||
}
|
||||
[ThreadUtil sendMessageWithAttachment:attachment
|
||||
inThread:thread
|
||||
quotedMessage:nil
|
||||
quotedReplyModel:nil
|
||||
messageSender:messageSender
|
||||
ignoreErrors:YES
|
||||
completion:nil];
|
||||
|
@ -3356,7 +3356,7 @@ isQuotedMessageAttachmentDownloaded:(BOOL)isQuotedMessageAttachmentDownloaded
|
|||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)1.f * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
|
||||
[ThreadUtil sendMessageWithText:[@(counter) description]
|
||||
inThread:thread
|
||||
quotedMessage:nil
|
||||
quotedReplyModel:nil
|
||||
messageSender:messageSender];
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)1.f * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
|
||||
[self createNewGroups:counter - 1 recipientId:recipientId];
|
||||
|
@ -3879,12 +3879,13 @@ isQuotedMessageAttachmentDownloaded:(BOOL)isQuotedMessageAttachmentDownloaded
|
|||
OWSAssert(![attachment hasError]);
|
||||
[ThreadUtil sendMessageWithAttachment:attachment
|
||||
inThread:thread
|
||||
quotedMessage:nil
|
||||
quotedReplyModel:nil
|
||||
messageSender:messageSender
|
||||
completion:nil];
|
||||
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 1 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
|
||||
sendUnsafeFile();
|
||||
sendUnsafeFile = nil;
|
||||
});
|
||||
};
|
||||
}
|
||||
|
|
|
@ -221,7 +221,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
}
|
||||
[ThreadUtil sendMessageWithAttachment:attachment
|
||||
inThread:thread
|
||||
quotedMessage:nil
|
||||
quotedReplyModel:nil
|
||||
messageSender:messageSender
|
||||
completion:nil];
|
||||
}
|
||||
|
@ -248,7 +248,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
}
|
||||
[ThreadUtil sendMessageWithAttachment:attachment
|
||||
inThread:thread
|
||||
quotedMessage:nil
|
||||
quotedReplyModel:nil
|
||||
messageSender:messageSender
|
||||
completion:nil];
|
||||
}
|
||||
|
|
|
@ -191,10 +191,10 @@ NSString *const Signal_Message_MarkAsRead_Identifier = @"Signal_Message_MarkAsRe
|
|||
TSThread *thread = [TSThread fetchObjectWithUniqueID:threadId];
|
||||
NSString *replyText = responseInfo[UIUserNotificationActionResponseTypedTextKey];
|
||||
|
||||
// TODO we could do an actual quoted reply here, but most apps don't.
|
||||
// In line with most apps, we send a normal outgoing messgae here - not a "quoted reply".
|
||||
[ThreadUtil sendMessageWithText:replyText
|
||||
inThread:thread
|
||||
quotedMessage:nil
|
||||
quotedReplyModel:nil
|
||||
messageSender:self.messageSender
|
||||
success:^{
|
||||
// TODO do we really want to mark them all as read?
|
||||
|
|
|
@ -518,7 +518,7 @@ typedef void (^DebugLogUploadFailure)(DebugLogUploader *uploader, NSError *error
|
|||
}];
|
||||
[ThreadUtil sendMessageWithText:url.absoluteString
|
||||
inThread:thread
|
||||
quotedMessage:nil
|
||||
quotedReplyModel:nil
|
||||
messageSender:messageSender];
|
||||
});
|
||||
|
||||
|
@ -541,7 +541,7 @@ typedef void (^DebugLogUploadFailure)(DebugLogUploader *uploader, NSError *error
|
|||
OWSMessageSender *messageSender = Environment.current.messageSender;
|
||||
[ThreadUtil sendMessageWithText:url.absoluteString
|
||||
inThread:thread
|
||||
quotedMessage:nil
|
||||
quotedReplyModel:nil
|
||||
messageSender:messageSender];
|
||||
} else {
|
||||
[Pastelog showFailureAlertWithMessage:@"Could not find last thread."];
|
||||
|
|
|
@ -201,7 +201,7 @@ typedef void (^SendMessageBlock)(SendCompletionBlock completion);
|
|||
__block TSOutgoingMessage *outgoingMessage = nil;
|
||||
outgoingMessage = [ThreadUtil sendMessageWithAttachment:attachment
|
||||
inThread:self.thread
|
||||
quotedMessage:nil
|
||||
quotedReplyModel:nil
|
||||
messageSender:self.messageSender
|
||||
completion:^(NSError *_Nullable error) {
|
||||
sendCompletion(error, outgoingMessage);
|
||||
|
@ -233,7 +233,7 @@ typedef void (^SendMessageBlock)(SendCompletionBlock completion);
|
|||
__block TSOutgoingMessage *outgoingMessage = nil;
|
||||
outgoingMessage = [ThreadUtil sendMessageWithText:messageText
|
||||
inThread:self.thread
|
||||
quotedMessage:nil
|
||||
quotedReplyModel:nil
|
||||
messageSender:self.messageSender
|
||||
success:^{
|
||||
sendCompletion(nil, outgoingMessage);
|
||||
|
|
|
@ -43,34 +43,33 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
|
||||
#pragma mark -
|
||||
|
||||
@class OWSQuotedReplyModel;
|
||||
@class TSOutgoingMessage;
|
||||
@class TSQuotedMessage;
|
||||
|
||||
@interface ThreadUtil : NSObject
|
||||
|
||||
// TODO should these all take the quotedMessageViewModel?
|
||||
+ (TSOutgoingMessage *)sendMessageWithText:(NSString *)text
|
||||
inThread:(TSThread *)thread
|
||||
quotedMessage:(nullable TSQuotedMessage *)quotedMessage
|
||||
quotedReplyModel:(nullable OWSQuotedReplyModel *)quotedReplyModel
|
||||
messageSender:(OWSMessageSender *)messageSender
|
||||
success:(void (^)(void))successHandler
|
||||
failure:(void (^)(NSError *error))failureHandler;
|
||||
|
||||
+ (TSOutgoingMessage *)sendMessageWithText:(NSString *)text
|
||||
inThread:(TSThread *)thread
|
||||
quotedMessage:(nullable TSQuotedMessage *)quotedMessage
|
||||
quotedReplyModel:(nullable OWSQuotedReplyModel *)quotedReplyModel
|
||||
messageSender:(OWSMessageSender *)messageSender;
|
||||
|
||||
+ (TSOutgoingMessage *)sendMessageWithAttachment:(SignalAttachment *)attachment
|
||||
inThread:(TSThread *)thread
|
||||
quotedMessage:(nullable TSQuotedMessage *)quotedMessage
|
||||
quotedReplyModel:(nullable OWSQuotedReplyModel *)quotedReplyModel
|
||||
messageSender:(OWSMessageSender *)messageSender
|
||||
completion:(void (^_Nullable)(NSError *_Nullable error))completion;
|
||||
|
||||
// We only should set ignoreErrors in debug or test code.
|
||||
+ (TSOutgoingMessage *)sendMessageWithAttachment:(SignalAttachment *)attachment
|
||||
inThread:(TSThread *)thread
|
||||
quotedMessage:(nullable TSQuotedMessage *)quotedMessage
|
||||
quotedReplyModel:(nullable OWSQuotedReplyModel *)quotedReplyModel
|
||||
messageSender:(OWSMessageSender *)messageSender
|
||||
ignoreErrors:(BOOL)ignoreErrors
|
||||
completion:(void (^_Nullable)(NSError *_Nullable error))completion;
|
||||
|
|
|
@ -55,12 +55,12 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
|
||||
+ (TSOutgoingMessage *)sendMessageWithText:(NSString *)text
|
||||
inThread:(TSThread *)thread
|
||||
quotedMessage:(nullable TSQuotedMessage *)quotedMessage
|
||||
quotedReplyModel:(nullable OWSQuotedReplyModel *)quotedReplyModel
|
||||
messageSender:(OWSMessageSender *)messageSender
|
||||
{
|
||||
return [self sendMessageWithText:text
|
||||
inThread:thread
|
||||
quotedMessage:quotedMessage
|
||||
quotedReplyModel:quotedReplyModel
|
||||
messageSender:messageSender
|
||||
success:^{
|
||||
DDLogInfo(@"%@ Successfully sent message.", self.logTag);
|
||||
|
@ -73,7 +73,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
|
||||
+ (TSOutgoingMessage *)sendMessageWithText:(NSString *)text
|
||||
inThread:(TSThread *)thread
|
||||
quotedMessage:(nullable TSQuotedMessage *)quotedMessage
|
||||
quotedReplyModel:(nullable OWSQuotedReplyModel *)quotedReplyModel
|
||||
messageSender:(OWSMessageSender *)messageSender
|
||||
success:(void (^)(void))successHandler
|
||||
failure:(void (^)(NSError *error))failureHandler
|
||||
|
@ -90,7 +90,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
messageBody:text
|
||||
attachmentId:nil
|
||||
expiresInSeconds:expiresInSeconds
|
||||
quotedMessage:quotedMessage];
|
||||
quotedMessage:[quotedReplyModel buildQuotedMessage]];
|
||||
|
||||
[messageSender enqueueMessage:message success:successHandler failure:failureHandler];
|
||||
|
||||
|
@ -99,13 +99,13 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
|
||||
+ (TSOutgoingMessage *)sendMessageWithAttachment:(SignalAttachment *)attachment
|
||||
inThread:(TSThread *)thread
|
||||
quotedMessage:(nullable TSQuotedMessage *)quotedMessage
|
||||
quotedReplyModel:(nullable OWSQuotedReplyModel *)quotedReplyModel
|
||||
messageSender:(OWSMessageSender *)messageSender
|
||||
completion:(void (^_Nullable)(NSError *_Nullable error))completion
|
||||
{
|
||||
return [self sendMessageWithAttachment:attachment
|
||||
inThread:thread
|
||||
quotedMessage:quotedMessage
|
||||
quotedReplyModel:quotedReplyModel
|
||||
messageSender:messageSender
|
||||
ignoreErrors:NO
|
||||
completion:completion];
|
||||
|
@ -113,7 +113,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
|
||||
+ (TSOutgoingMessage *)sendMessageWithAttachment:(SignalAttachment *)attachment
|
||||
inThread:(TSThread *)thread
|
||||
quotedMessage:(nullable TSQuotedMessage *)quotedMessage
|
||||
quotedReplyModel:(nullable OWSQuotedReplyModel *)quotedReplyModel
|
||||
messageSender:(OWSMessageSender *)messageSender
|
||||
ignoreErrors:(BOOL)ignoreErrors
|
||||
completion:(void (^_Nullable)(NSError *_Nullable error))completion
|
||||
|
@ -127,6 +127,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
|
||||
OWSDisappearingMessagesConfiguration *configuration =
|
||||
[OWSDisappearingMessagesConfiguration fetchObjectWithUniqueID:thread.uniqueId];
|
||||
|
||||
TSOutgoingMessage *message = [[TSOutgoingMessage alloc]
|
||||
initOutgoingMessageWithTimestamp:[NSDate ows_millisecondTimeStamp]
|
||||
inThread:thread
|
||||
|
@ -135,7 +136,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
expiresInSeconds:(configuration.isEnabled ? configuration.durationSeconds : 0)expireStartedAt:0
|
||||
isVoiceMessage:[attachment isVoiceMessage]
|
||||
groupMetaMessage:TSGroupMessageNone
|
||||
quotedMessage:quotedMessage];
|
||||
quotedMessage:[quotedReplyModel buildQuotedMessage]];
|
||||
|
||||
[messageSender enqueueAttachment:attachment.dataSource
|
||||
contentType:attachment.mimeType
|
||||
|
|
|
@ -388,7 +388,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
if (![[NSFileManager defaultManager] fileExistsAtPath:self.mediaURL.path]) {
|
||||
DDLogError(@"%@ while generating thumbnail, source file doesn't exist: %@", self.logTag, self.mediaURL);
|
||||
// If we're not lazy-restoring this message, the attachment should exist on disk.
|
||||
// OWSAssert(self.lazyRestoreFragmentId);
|
||||
OWSAssert(self.lazyRestoreFragmentId);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue