Undo renaming of contactShare property of TSMessage.

This commit is contained in:
Matthew Chen 2018-05-01 11:26:01 -04:00
parent 147368913c
commit 0316a98eb8
27 changed files with 62 additions and 61 deletions

View File

@ -820,7 +820,7 @@ NS_ASSUME_NONNULL_BEGIN
isDelivered:YES
isRead:NO
quotedMessage:nil
contact:nil
contactShare:nil
transaction:transaction];
// This is a hack to "back-date" the message.
@ -1753,7 +1753,7 @@ NS_ASSUME_NONNULL_BEGIN
isDelivered:NO
isRead:NO
quotedMessage:nil
contact:nil
contactShare:nil
transaction:transaction];
}];
}
@ -1801,7 +1801,7 @@ NS_ASSUME_NONNULL_BEGIN
isDelivered:isDelivered
isRead:isRead
quotedMessage:nil
contact:nil
contactShare:nil
transaction:transaction];
}];
}
@ -1975,7 +1975,7 @@ NS_ASSUME_NONNULL_BEGIN
isDelivered:quotedMessageIsDelivered
isRead:quotedMessageIsRead
quotedMessage:nil
contact:nil
contactShare:nil
transaction:transaction];
OWSAssert(messageToQuote);
quotedMessage = [[OWSQuotedReplyModel quotedReplyForMessage:messageToQuote transaction:transaction]
@ -2000,7 +2000,7 @@ NS_ASSUME_NONNULL_BEGIN
isDelivered:replyIsDelivered
isRead:replyIsRead
quotedMessage:quotedMessage
contact:nil
contactShare:nil
transaction:transaction];
}
}
@ -2849,7 +2849,7 @@ NS_ASSUME_NONNULL_BEGIN
isDelivered:NO
isRead:NO
quotedMessage:nil
contact:nil
contactShare:nil
transaction:transaction];
[message setReceivedAtTimestamp:(uint64_t)((int64_t)[NSDate ows_millisecondTimeStamp] + dateOffset)];
[message saveWithTransaction:transaction];
@ -2919,7 +2919,7 @@ typedef OWSContact * (^OWSContactBlock)(void);
isDelivered:NO
isRead:NO
quotedMessage:nil
contact:contact
contactShare:contact
transaction:transaction];
[message saveWithTransaction:transaction];
}];
@ -3104,7 +3104,7 @@ typedef OWSContact * (^OWSContactBlock)(void);
[ThreadUtil sendMessageWithAttachment:attachment
inThread:thread
quotedReplyModel:nil
contact:nil
contactShare:nil
messageSender:messageSender
ignoreErrors:YES
completion:nil];
@ -3414,7 +3414,7 @@ typedef OWSContact * (^OWSContactBlock)(void);
attachmentIds:@[]
expiresInSeconds:0
quotedMessage:nil
contact:nil];
contactShare:nil];
[message markAsReadNowWithSendReadReceipt:NO transaction:transaction];
break;
}
@ -3426,7 +3426,7 @@ typedef OWSContact * (^OWSContactBlock)(void);
isDelivered:NO
isRead:NO
quotedMessage:nil
contact:nil
contactShare:nil
transaction:transaction];
break;
}
@ -3454,7 +3454,7 @@ typedef OWSContact * (^OWSContactBlock)(void);
]
expiresInSeconds:0
quotedMessage:nil
contact:nil];
contactShare:nil];
[message markAsReadNowWithSendReadReceipt:NO transaction:transaction];
break;
}
@ -3480,7 +3480,7 @@ typedef OWSContact * (^OWSContactBlock)(void);
isRead:NO
isVoiceMessage:NO
quotedMessage:nil
contact:nil
contactShare:nil
transaction:transaction];
break;
}
@ -3842,7 +3842,7 @@ typedef OWSContact * (^OWSContactBlock)(void);
isVoiceMessage:NO
groupMetaMessage:TSGroupMessageUnspecified
quotedMessage:nil
contact:nil];
contactShare:nil];
DDLogError(@"%@ resurrectNewOutgoingMessages2 timestamp: %llu.", self.logTag, message.timestamp);
[messages addObject:message];
}
@ -3908,7 +3908,7 @@ typedef OWSContact * (^OWSContactBlock)(void);
attachmentIds:[NSMutableArray new]
expiresInSeconds:0
quotedMessage:nil
contact:nil];
contactShare:nil];
[message markAsReadNowWithSendReadReceipt:NO transaction:transaction];
}
{
@ -3922,7 +3922,7 @@ typedef OWSContact * (^OWSContactBlock)(void);
isVoiceMessage:NO
groupMetaMessage:TSGroupMessageUnspecified
quotedMessage:nil
contact:nil];
contactShare:nil];
[message saveWithTransaction:transaction];
[message updateWithFakeMessageState:TSOutgoingMessageStateSent transaction:transaction];
[message updateWithSentRecipient:recipientId transaction:transaction];
@ -4101,7 +4101,7 @@ typedef OWSContact * (^OWSContactBlock)(void);
isDelivered:(BOOL)isDelivered
isRead:(BOOL)isRead
quotedMessage:(nullable TSQuotedMessage *)quotedMessage
contact:(nullable OWSContact *)contact
contactShare:(nullable OWSContact *)contactShare
transaction:(YapDatabaseReadWriteTransaction *)transaction
{
OWSAssert(thread);
@ -4127,7 +4127,7 @@ typedef OWSContact * (^OWSContactBlock)(void);
isRead:isRead
isVoiceMessage:attachment.isVoiceMessage
quotedMessage:quotedMessage
contact:contact
contactShare:contactShare
transaction:transaction];
}
@ -4140,12 +4140,12 @@ typedef OWSContact * (^OWSContactBlock)(void);
isRead:(BOOL)isRead
isVoiceMessage:(BOOL)isVoiceMessage
quotedMessage:(nullable TSQuotedMessage *)quotedMessage
contact:(nullable OWSContact *)contact
contactShare:(nullable OWSContact *)contactShare
transaction:(YapDatabaseReadWriteTransaction *)transaction
{
OWSAssert(thread);
OWSAssert(transaction);
OWSAssert(messageBody.length > 0 || attachmentId.length > 0 || contact);
OWSAssert(messageBody.length > 0 || attachmentId.length > 0 || contactShare);
NSMutableArray<NSString *> *attachmentIds = [NSMutableArray new];
if (attachmentId) {
@ -4162,7 +4162,7 @@ typedef OWSContact * (^OWSContactBlock)(void);
isVoiceMessage:isVoiceMessage
groupMetaMessage:TSGroupMessageUnspecified
quotedMessage:quotedMessage
contact:contact];
contactShare:contactShare];
if (attachmentId.length > 0 && filename.length > 0) {
message.attachmentFilenameMap[attachmentId] = filename;
@ -4250,7 +4250,7 @@ typedef OWSContact * (^OWSContactBlock)(void);
attachmentIds:attachmentIds
expiresInSeconds:0
quotedMessage:quotedMessage
contact:nil];
contactShare:nil];
[message markAsReadNowWithSendReadReceipt:NO transaction:transaction];
return message;
}

View File

@ -72,7 +72,7 @@ NS_ASSUME_NONNULL_BEGIN
+ (TSOutgoingMessage *)sendMessageWithAttachment:(SignalAttachment *)attachment
inThread:(TSThread *)thread
quotedReplyModel:(nullable OWSQuotedReplyModel *)quotedReplyModel
contact:(nullable OWSContact *)contact
contactShare:(nullable OWSContact *)contactShare
messageSender:(OWSMessageSender *)messageSender
ignoreErrors:(BOOL)ignoreErrors
completion:(void (^_Nullable)(NSError *_Nullable error))completion;

View File

@ -107,7 +107,7 @@ NS_ASSUME_NONNULL_BEGIN
return [self sendMessageWithAttachment:attachment
inThread:thread
quotedReplyModel:quotedReplyModel
contact:nil
contactShare:nil
messageSender:messageSender
ignoreErrors:NO
completion:completion];
@ -116,7 +116,7 @@ NS_ASSUME_NONNULL_BEGIN
+ (TSOutgoingMessage *)sendMessageWithAttachment:(SignalAttachment *)attachment
inThread:(TSThread *)thread
quotedReplyModel:(nullable OWSQuotedReplyModel *)quotedReplyModel
contact:(nullable OWSContact *)contact
contactShare:(nullable OWSContact *)contactShare
messageSender:(OWSMessageSender *)messageSender
ignoreErrors:(BOOL)ignoreErrors
completion:(void (^_Nullable)(NSError *_Nullable error))completion
@ -142,7 +142,7 @@ NS_ASSUME_NONNULL_BEGIN
isVoiceMessage:[attachment isVoiceMessage]
groupMetaMessage:TSGroupMessageUnspecified
quotedMessage:[quotedReplyModel buildQuotedMessage]
contact:contact];
contactShare:contactShare];
[messageSender enqueueAttachment:attachment.dataSource
contentType:attachment.mimeType

View File

@ -30,7 +30,7 @@ NS_ASSUME_NONNULL_BEGIN
isVoiceMessage:NO
groupMetaMessage:TSGroupMessageUnspecified
quotedMessage:nil
contact:nil];
contactShare:nil];
if (!self) {
return self;
}

View File

@ -96,7 +96,7 @@ NS_ASSUME_NONNULL_BEGIN
isVoiceMessage:NO
groupMetaMessage:TSGroupMessageUnspecified
quotedMessage:transcript.quotedMessage
contact:transcript.contact];
contactShare:transcript.contact];
// TODO: When written, desktop didn't yet support sending quotedMessages, so we didn't have a
// good way to test the handling of transcripts with a quotedMessage. This assertion can be delete

View File

@ -23,7 +23,7 @@ NS_ASSUME_NONNULL_BEGIN
isVoiceMessage:NO
groupMetaMessage:TSGroupMessageUnspecified
quotedMessage:nil
contact:nil];
contactShare:nil];
if (!self) {
return self;

View File

@ -39,7 +39,7 @@ NS_ASSUME_NONNULL_BEGIN
isVoiceMessage:NO
groupMetaMessage:TSGroupMessageUnspecified
quotedMessage:nil
contact:nil];
contactShare:nil];
if (!self) {
return self;
}

View File

@ -25,7 +25,7 @@ NS_ASSUME_NONNULL_BEGIN
isVoiceMessage:NO
groupMetaMessage:TSGroupMessageUnspecified
quotedMessage:nil
contact:nil];
contactShare:nil];
}
- (OWSSignalServiceProtosSyncMessageBuilder *)syncMessageBuilder

View File

@ -29,7 +29,7 @@ NS_ASSUME_NONNULL_BEGIN
isVoiceMessage:NO
groupMetaMessage:TSGroupMessageUnspecified
quotedMessage:nil
contact:nil];
contactShare:nil];
if (!self) {
return self;
}

View File

@ -35,7 +35,7 @@ NS_ASSUME_NONNULL_BEGIN
isVoiceMessage:NO
groupMetaMessage:TSGroupMessageUnspecified
quotedMessage:nil
contact:nil];
contactShare:nil];
if (!self) {
return self;
}

View File

@ -36,7 +36,7 @@ NS_ASSUME_NONNULL_BEGIN
isVoiceMessage:NO
groupMetaMessage:TSGroupMessageUnspecified
quotedMessage:nil
contact:nil];
contactShare:nil];
if (self) {
_block = block;

View File

@ -20,7 +20,7 @@ NS_ASSUME_NONNULL_BEGIN
isVoiceMessage:NO
groupMetaMessage:TSGroupMessageUnspecified
quotedMessage:nil
contact:nil];
contactShare:nil];
}
- (BOOL)shouldBeSaved

View File

@ -34,7 +34,7 @@ typedef NS_ENUM(int32_t, TSErrorMessageType) {
expiresInSeconds:(uint32_t)expiresInSeconds
expireStartedAt:(uint64_t)expireStartedAt
quotedMessage:(nullable TSQuotedMessage *)quotedMessage
contact:(nullable OWSContact *)contact NS_UNAVAILABLE;
contactShare:(nullable OWSContact *)contact NS_UNAVAILABLE;
- (instancetype)initWithCoder:(NSCoder *)coder NS_DESIGNATED_INITIALIZER;

View File

@ -66,7 +66,7 @@ NSUInteger TSErrorMessageSchemaVersion = 1;
expiresInSeconds:0
expireStartedAt:0
quotedMessage:nil
contact:nil];
contactShare:nil];
if (!self) {
return self;

View File

@ -19,7 +19,7 @@ NS_ASSUME_NONNULL_BEGIN
expiresInSeconds:(uint32_t)expiresInSeconds
expireStartedAt:(uint64_t)expireStartedAt
quotedMessage:(nullable TSQuotedMessage *)quotedMessage
contact:(nullable OWSContact *)contact NS_UNAVAILABLE;
contactShare:(nullable OWSContact *)contactShare NS_UNAVAILABLE;
/**
* Inits an incoming group message that expires.
@ -51,7 +51,7 @@ NS_ASSUME_NONNULL_BEGIN
attachmentIds:(NSArray<NSString *> *)attachmentIds
expiresInSeconds:(uint32_t)expiresInSeconds
quotedMessage:(nullable TSQuotedMessage *)quotedMessage
contact:(nullable OWSContact *)contact NS_DESIGNATED_INITIALIZER;
contactShare:(nullable OWSContact *)contactShare NS_DESIGNATED_INITIALIZER;
- (instancetype)initWithCoder:(NSCoder *)coder NS_DESIGNATED_INITIALIZER;

View File

@ -44,7 +44,7 @@ NS_ASSUME_NONNULL_BEGIN
attachmentIds:(NSArray<NSString *> *)attachmentIds
expiresInSeconds:(uint32_t)expiresInSeconds
quotedMessage:(nullable TSQuotedMessage *)quotedMessage
contact:(nullable OWSContact *)contact
contactShare:(nullable OWSContact *)contactShare
{
self = [super initMessageWithTimestamp:timestamp
inThread:thread
@ -53,7 +53,7 @@ NS_ASSUME_NONNULL_BEGIN
expiresInSeconds:expiresInSeconds
expireStartedAt:0
quotedMessage:quotedMessage
contact:contact];
contactShare:contactShare];
if (!self) {
return self;

View File

@ -35,7 +35,7 @@ typedef NS_ENUM(NSInteger, TSInfoMessageType) {
expiresInSeconds:(uint32_t)expiresInSeconds
expireStartedAt:(uint64_t)expireStartedAt
quotedMessage:(nullable TSQuotedMessage *)quotedMessage
contact:(nullable OWSContact *)contact NS_UNAVAILABLE;
contactShare:(nullable OWSContact *)contact NS_UNAVAILABLE;
- (instancetype)initWithCoder:(NSCoder *)coder NS_DESIGNATED_INITIALIZER;

View File

@ -53,7 +53,7 @@ NSUInteger TSInfoMessageSchemaVersion = 1;
expiresInSeconds:0
expireStartedAt:0
quotedMessage:nil
contact:nil];
contactShare:nil];
if (!self) {
return self;

View File

@ -25,7 +25,7 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, readonly) uint64_t expiresAt;
@property (nonatomic, readonly) BOOL isExpiringMessage;
@property (nonatomic, readonly, nullable) TSQuotedMessage *quotedMessage;
@property (nonatomic, readonly, nullable) OWSContact *contact;
@property (nonatomic, readonly, nullable) OWSContact *contactShare;
- (instancetype)initInteractionWithTimestamp:(uint64_t)timestamp inThread:(TSThread *)thread NS_UNAVAILABLE;
@ -36,7 +36,7 @@ NS_ASSUME_NONNULL_BEGIN
expiresInSeconds:(uint32_t)expiresInSeconds
expireStartedAt:(uint64_t)expireStartedAt
quotedMessage:(nullable TSQuotedMessage *)quotedMessage
contact:(nullable OWSContact *)contact NS_DESIGNATED_INITIALIZER;
contactShare:(nullable OWSContact *)contactShare NS_DESIGNATED_INITIALIZER;
- (nullable instancetype)initWithCoder:(NSCoder *)coder NS_DESIGNATED_INITIALIZER;

View File

@ -66,7 +66,7 @@ static const NSUInteger OWSMessageSchemaVersion = 4;
expiresInSeconds:(uint32_t)expiresInSeconds
expireStartedAt:(uint64_t)expireStartedAt
quotedMessage:(nullable TSQuotedMessage *)quotedMessage
contact:(nullable OWSContact *)contact
contactShare:(nullable OWSContact *)contactShare
{
self = [super initInteractionWithTimestamp:timestamp inThread:thread];
@ -83,7 +83,7 @@ static const NSUInteger OWSMessageSchemaVersion = 4;
[self updateExpiresAt];
_receivedAtTimestamp = [NSDate ows_millisecondTimeStamp];
_quotedMessage = quotedMessage;
_contact = contact;
_contactShare = contactShare;
return self;
}
@ -261,7 +261,7 @@ static const NSUInteger OWSMessageSchemaVersion = 4;
return bodyDescription;
} else if (attachmentDescription.length > 0) {
return attachmentDescription;
} else if (self.contact) {
} else if (self.contactShare) {
// TODO: Include properly formatted name.
return @"👤";
} else {

View File

@ -75,7 +75,7 @@ typedef NS_ENUM(NSInteger, TSGroupMetaMessage) {
expiresInSeconds:(uint32_t)expiresInSeconds
expireStartedAt:(uint64_t)expireStartedAt
quotedMessage:(nullable TSQuotedMessage *)quotedMessage
contact:(nullable OWSContact *)contact NS_UNAVAILABLE;
contactShare:(nullable OWSContact *)contactShare NS_UNAVAILABLE;
- (instancetype)initOutgoingMessageWithTimestamp:(uint64_t)timestamp
inThread:(nullable TSThread *)thread
@ -86,7 +86,7 @@ typedef NS_ENUM(NSInteger, TSGroupMetaMessage) {
isVoiceMessage:(BOOL)isVoiceMessage
groupMetaMessage:(TSGroupMetaMessage)groupMetaMessage
quotedMessage:(nullable TSQuotedMessage *)quotedMessage
contact:(nullable OWSContact *)contact NS_DESIGNATED_INITIALIZER;
contactShare:(nullable OWSContact *)contactShare NS_DESIGNATED_INITIALIZER;
- (instancetype)initWithCoder:(NSCoder *)coder NS_DESIGNATED_INITIALIZER;

View File

@ -245,7 +245,7 @@ NSString *NSStringForOutgoingMessageRecipientState(OWSOutgoingMessageRecipientSt
isVoiceMessage:NO
groupMetaMessage:TSGroupMessageUnspecified
quotedMessage:quotedMessage
contact:nil];
contactShare:nil];
}
+ (instancetype)outgoingMessageInThread:(nullable TSThread *)thread
@ -260,7 +260,7 @@ NSString *NSStringForOutgoingMessageRecipientState(OWSOutgoingMessageRecipientSt
isVoiceMessage:NO
groupMetaMessage:groupMetaMessage
quotedMessage:nil
contact:nil];
contactShare:nil];
}
- (instancetype)initOutgoingMessageWithTimestamp:(uint64_t)timestamp
@ -272,7 +272,7 @@ NSString *NSStringForOutgoingMessageRecipientState(OWSOutgoingMessageRecipientSt
isVoiceMessage:(BOOL)isVoiceMessage
groupMetaMessage:(TSGroupMetaMessage)groupMetaMessage
quotedMessage:(nullable TSQuotedMessage *)quotedMessage
contact:(nullable OWSContact *)contact
contactShare:(nullable OWSContact *)contactShare
{
self = [super initMessageWithTimestamp:timestamp
inThread:thread
@ -281,7 +281,7 @@ NSString *NSStringForOutgoingMessageRecipientState(OWSOutgoingMessageRecipientSt
expiresInSeconds:expiresInSeconds
expireStartedAt:expireStartedAt
quotedMessage:quotedMessage
contact:contact];
contactShare:contactShare];
if (!self) {
return self;
}
@ -794,8 +794,9 @@ NSString *NSStringForOutgoingMessageRecipientState(OWSOutgoingMessageRecipientSt
}
// Contact Share
if (self.contact) {
OWSSignalServiceProtosDataMessageContact *_Nullable contactProto = [OWSContacts protoForContact:self.contact];
if (self.contactShare) {
OWSSignalServiceProtosDataMessageContact *_Nullable contactProto =
[OWSContacts protoForContact:self.contactShare];
if (contactProto) {
[builder addContact:contactProto];
}

View File

@ -1014,7 +1014,7 @@ NS_ASSUME_NONNULL_BEGIN
attachmentIds:attachmentIds
expiresInSeconds:dataMessage.expireTimer
quotedMessage:quotedMessage
contact:contact];
contactShare:contact];
[self finalizeIncomingMessage:incomingMessage
thread:oldGroupThread
@ -1059,7 +1059,7 @@ NS_ASSUME_NONNULL_BEGIN
attachmentIds:attachmentIds
expiresInSeconds:dataMessage.expireTimer
quotedMessage:quotedMessage
contact:contact];
contactShare:contact];
[self finalizeIncomingMessage:incomingMessage
thread:thread

View File

@ -1166,7 +1166,7 @@ NSString *const OWSMessageSenderRateLimitedException = @"RateLimitedException";
attachmentIds:attachmentIds
expiresInSeconds:outgoingMessage.expiresInSeconds
quotedMessage:outgoingMessage.quotedMessage
contact:outgoingMessage.contact];
contactShare:outgoingMessage.contactShare];
[incomingMessage saveWithTransaction:transaction];
}];
}

View File

@ -31,7 +31,7 @@ NS_ASSUME_NONNULL_BEGIN
isVoiceMessage:NO
groupMetaMessage:TSGroupMessageUnspecified
quotedMessage:nil
contact:nil];
contactShare:nil];
if (!self) {
return self;
}

View File

@ -33,7 +33,7 @@ NS_ASSUME_NONNULL_BEGIN
isVoiceMessage:NO
groupMetaMessage:TSGroupMessageUnspecified
quotedMessage:nil
contact:nil];
contactShare:nil];
if (!self) {
return self;
}

View File

@ -23,7 +23,7 @@ NS_ASSUME_NONNULL_BEGIN
isVoiceMessage:NO
groupMetaMessage:TSGroupMessageUnspecified
quotedMessage:nil
contact:nil];
contactShare:nil];
}
- (BOOL)shouldBeSaved