Respond to CR.

This commit is contained in:
Matthew Chen 2018-07-11 15:43:25 -04:00
parent 6711ed1cf3
commit e48a1e0816
5 changed files with 15 additions and 25 deletions

View File

@ -103,7 +103,7 @@ NS_ASSUME_NONNULL_BEGIN
}
self.timestampLabel.textColor = textColor;
if ([self shouldShowDisappearingTimer:viewItem]) {
if (viewItem.isExpiringMessage) {
TSMessage *message = (TSMessage *)viewItem.interaction;
uint64_t expirationTimestamp = message.expiresAt;
uint32_t expiresInSeconds = message.expiresInSeconds;
@ -185,19 +185,6 @@ NS_ASSUME_NONNULL_BEGIN
return messageStatus == MessageReceiptStatusFailed;
}
- (BOOL)shouldShowDisappearingTimer:(ConversationViewItem *)viewItem
{
OWSAssert(viewItem);
if (viewItem.interaction.interactionType != OWSInteractionType_OutgoingMessage
&& viewItem.interaction.interactionType != OWSInteractionType_IncomingMessage) {
return NO;
}
TSMessage *message = (TSMessage *)viewItem.interaction;
return message.isExpiringMessage;
}
- (void)configureLabelsWithConversationViewItem:(ConversationViewItem *)viewItem
{
OWSAssert(viewItem);
@ -257,7 +244,7 @@ NS_ASSUME_NONNULL_BEGIN
}
}
if ([self shouldShowDisappearingTimer:viewItem]) {
if (viewItem.isExpiringMessage) {
result.width += ([OWSMessageTimerView measureSize].width + self.hSpacing);
}

View File

@ -54,6 +54,8 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType);
@property (nonatomic, readonly) BOOL hasQuotedAttachment;
@property (nonatomic, readonly) BOOL hasQuotedText;
@property (nonatomic, readonly) BOOL isExpiringMessage;
@property (nonatomic) BOOL shouldShowDate;
@property (nonatomic) BOOL shouldShowSenderAvatar;
@property (nonatomic, nullable) NSAttributedString *senderName;

View File

@ -138,6 +138,17 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType)
return self.hasQuotedAttachment || self.hasQuotedText;
}
- (BOOL)isExpiringMessage
{
if (self.interaction.interactionType != OWSInteractionType_OutgoingMessage
&& self.interaction.interactionType != OWSInteractionType_IncomingMessage) {
return NO;
}
TSMessage *message = (TSMessage *)self.interaction;
return message.isExpiringMessage;
}
- (void)setShouldShowDate:(BOOL)shouldShowDate
{
if (_shouldShowDate == shouldShowDate) {

View File

@ -45,7 +45,6 @@ NS_ASSUME_NONNULL_BEGIN
- (void)setQuotedMessageThumbnailAttachmentStream:(TSAttachmentStream *)attachmentStream;
- (BOOL)shouldStartExpireTimer;
- (BOOL)shouldStartExpireTimerWithTransaction:(YapDatabaseReadTransaction *)transaction;
#pragma mark - Update With... Methods

View File

@ -182,15 +182,6 @@ static const NSUInteger OWSMessageSchemaVersion = 4;
[self updateExpiresAt];
}
- (BOOL)shouldStartExpireTimer
{
__block BOOL result;
[self.dbReadConnection readWithBlock:^(YapDatabaseReadTransaction *_Nonnull transaction) {
result = [self shouldStartExpireTimerWithTransaction:transaction];
}];
return result;
}
- (BOOL)shouldStartExpireTimerWithTransaction:(YapDatabaseReadTransaction *)transaction
{
return self.isExpiringMessage;