Merge branch 'charlesmchen/linkedDeviceSendVsScrollState'

pull/1/head
Matthew Chen 8 years ago
commit 28219008b7

@ -3614,8 +3614,11 @@ typedef NS_ENUM(NSInteger, MessagesRangeSizeMode) {
TSInteraction *interaction = [self interactionAtIndexPath:rowChange.newIndexPath];
if ([interaction isKindOfClass:[TSOutgoingMessage class]]) {
scrollToBottom = YES;
shouldAnimateScrollToBottom = NO;
TSOutgoingMessage *outgoingMessage = (TSOutgoingMessage *)interaction;
if (!outgoingMessage.isFromLinkedDevice) {
scrollToBottom = YES;
shouldAnimateScrollToBottom = NO;
}
}
break;
}

@ -101,6 +101,9 @@ typedef NS_ENUM(NSInteger, TSGroupMetaMessage) {
@property (nonatomic, readonly) BOOL isVoiceMessage;
// This property won't be accurate for legacy messages.
@property (atomic, readonly) BOOL isFromLinkedDevice;
/**
* Signal Identifier (e.g. e164 number) or nil if in a group thread.
*/
@ -168,6 +171,7 @@ typedef NS_ENUM(NSInteger, TSGroupMetaMessage) {
- (void)updateWithWasDeliveredWithTransaction:(YapDatabaseReadWriteTransaction *)transaction;
- (void)updateWithWasDelivered;
- (void)updateWithWasSentAndDelivered;
- (void)updateWithWasSentAndDeliveredFromLinkedDevice;
- (void)updateWithSingleGroupRecipient:(NSString *)singleGroupRecipient
transaction:(YapDatabaseReadWriteTransaction *)transaction;

@ -28,6 +28,7 @@ NSString *const kTSOutgoingMessageSentRecipientAll = @"kTSOutgoingMessageSentRec
@property (atomic) NSString *mostRecentFailureText;
@property (atomic) BOOL wasDelivered;
@property (atomic) NSString *singleGroupRecipient;
@property (atomic) BOOL isFromLinkedDevice;
// For outgoing, non-legacy group messages sent from this client, this
// contains the list of recipients to whom the message has been sent.
@ -333,6 +334,18 @@ NSString *const kTSOutgoingMessageSentRecipientAll = @"kTSOutgoingMessageSentRec
}];
}
- (void)updateWithWasSentAndDeliveredFromLinkedDevice
{
[self.dbReadWriteConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
[self applyChangeToSelfAndLatestOutgoingMessage:transaction
changeBlock:^(TSOutgoingMessage *message) {
[message setMessageState:TSOutgoingMessageStateSentToService];
[message setWasDelivered:YES];
[message setIsFromLinkedDevice:YES];
}];
}];
}
- (void)updateWithSingleGroupRecipient:(NSString *)singleGroupRecipient
transaction:(YapDatabaseReadWriteTransaction *)transaction
{

@ -1084,7 +1084,7 @@ NSString *const OWSMessageSenderRateLimitedException = @"RateLimitedException";
- (void)handleMessageSentRemotely:(TSOutgoingMessage *)message sentAt:(uint64_t)sentAt
{
[message updateWithWasSentAndDelivered];
[message updateWithWasSentAndDeliveredFromLinkedDevice];
[self becomeConsistentWithDisappearingConfigurationForMessage:message];
[OWSDisappearingMessagesJob setExpirationForMessage:message expirationStartedAt:sentAt];
}

Loading…
Cancel
Save