Merge branch 'charlesmchen/tweakDisappearingMessagesIndicator'

pull/1/head
Matthew Chen 7 years ago
commit 1ce147e945

@ -43,6 +43,7 @@
340FC8D0205BF2FA007AEB0F /* OWSBackupIO.m in Sources */ = {isa = PBXBuildFile; fileRef = 340FC8CE205BF2FA007AEB0F /* OWSBackupIO.m */; };
341F2C0F1F2B8AE700D07D6B /* DebugUIMisc.m in Sources */ = {isa = PBXBuildFile; fileRef = 341F2C0E1F2B8AE700D07D6B /* DebugUIMisc.m */; };
34277A5E20751BDC006049F2 /* OWSQuotedMessageView.m in Sources */ = {isa = PBXBuildFile; fileRef = 34277A5C20751BDC006049F2 /* OWSQuotedMessageView.m */; };
3427C64320F500E000EEC730 /* OWSMessageTimerView.m in Sources */ = {isa = PBXBuildFile; fileRef = 3427C64220F500DF00EEC730 /* OWSMessageTimerView.m */; };
3430FE181F7751D4000EC51B /* GiphyAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3430FE171F7751D4000EC51B /* GiphyAPI.swift */; };
34330A5A1E7875FB00DF2FB9 /* fontawesome-webfont.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 34330A591E7875FB00DF2FB9 /* fontawesome-webfont.ttf */; };
34330A5C1E787A9800DF2FB9 /* dripicons-v2.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 34330A5B1E787A9800DF2FB9 /* dripicons-v2.ttf */; };
@ -641,6 +642,8 @@
341F2C0E1F2B8AE700D07D6B /* DebugUIMisc.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DebugUIMisc.m; sourceTree = "<group>"; };
34277A5C20751BDC006049F2 /* OWSQuotedMessageView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OWSQuotedMessageView.m; sourceTree = "<group>"; };
34277A5D20751BDC006049F2 /* OWSQuotedMessageView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OWSQuotedMessageView.h; sourceTree = "<group>"; };
3427C64120F500DE00EEC730 /* OWSMessageTimerView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OWSMessageTimerView.h; sourceTree = "<group>"; };
3427C64220F500DF00EEC730 /* OWSMessageTimerView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OWSMessageTimerView.m; sourceTree = "<group>"; };
3430FE171F7751D4000EC51B /* GiphyAPI.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GiphyAPI.swift; sourceTree = "<group>"; };
34330A591E7875FB00DF2FB9 /* fontawesome-webfont.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "fontawesome-webfont.ttf"; sourceTree = "<group>"; };
34330A5B1E787A9800DF2FB9 /* dripicons-v2.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "dripicons-v2.ttf"; sourceTree = "<group>"; };
@ -1771,6 +1774,8 @@
34D920E620E179C200D51158 /* OWSMessageFooterView.m */,
34DBF000206BD5A400025978 /* OWSMessageTextView.h */,
34DBEFFF206BD5A400025978 /* OWSMessageTextView.m */,
3427C64120F500DE00EEC730 /* OWSMessageTimerView.h */,
3427C64220F500DF00EEC730 /* OWSMessageTimerView.m */,
34277A5D20751BDC006049F2 /* OWSQuotedMessageView.h */,
34277A5C20751BDC006049F2 /* OWSQuotedMessageView.m */,
34D1F0A51F867BFC0066283D /* OWSSystemMessageCell.h */,
@ -3363,6 +3368,7 @@
45A663C51F92EC760027B59E /* GroupTableViewCell.swift in Sources */,
34CA631B2097806F00E526A0 /* OWSContactShareView.m in Sources */,
34D1F0861F8678AA0066283D /* ConversationViewController.m in Sources */,
3427C64320F500E000EEC730 /* OWSMessageTimerView.m in Sources */,
B90418E6183E9DD40038554A /* DateUtil.m in Sources */,
340FC8BD204DAC8D007AEB0F /* ShowGroupMembersViewController.m in Sources */,
459311FC1D75C948008DD4F0 /* OWSDeviceTableViewCell.m in Sources */,

@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "timer00_12@1x.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "timer00_12@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "timer00_12@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 217 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 656 B

@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "timer05_12@1x.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "timer05_12@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "timer05_12@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 249 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 432 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 758 B

@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "timer10_12@1x.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "timer10_12@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "timer10_12@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 255 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 433 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 759 B

@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "timer15_12@1x.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "timer15_12@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "timer15_12@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 244 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 398 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 685 B

@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "timer20_12@1x.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "timer20_12@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "timer20_12@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 268 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 486 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 815 B

@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "timer25_12@1x.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "timer25_12@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "timer25_12@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 272 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 504 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 860 B

@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "timer30_12@1x.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "timer30_12@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "timer30_12@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 267 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 446 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 782 B

@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "timer35_12@1x.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "timer35_12@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "timer35_12@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 282 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 545 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 862 B

@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "timer40_12@1x.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "timer40_12@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "timer40_12@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 289 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 554 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 900 B

@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "timer45_12@1x.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "timer45_12@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "timer45_12@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 251 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 482 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 759 B

@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "timer50_12@1x.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "timer50_12@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "timer50_12@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 302 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 599 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 932 B

@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "timer55_12@1x.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "timer55_12@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "timer55_12@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 312 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 621 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 962 B

@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "timer60_12@1x.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "timer60_12@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "timer60_12@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 272 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 539 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 864 B

@ -4,6 +4,7 @@
#import "OWSMessageFooterView.h"
#import "DateUtil.h"
#import "OWSMessageTimerView.h"
#import "Signal-Swift.h"
#import <QuartzCore/QuartzCore.h>
@ -13,6 +14,7 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic) UILabel *timestampLabel;
@property (nonatomic) UIImageView *statusIndicatorImageView;
@property (nonatomic) OWSMessageTimerView *messageTimerView;
@end
@ -38,9 +40,20 @@ NS_ASSUME_NONNULL_BEGIN
self.axis = UILayoutConstraintAxisHorizontal;
self.spacing = self.hSpacing;
self.alignment = UIStackViewAlignmentCenter;
self.distribution = UIStackViewDistributionEqualSpacing;
UIStackView *leftStackView = [UIStackView new];
leftStackView.axis = UILayoutConstraintAxisHorizontal;
leftStackView.spacing = self.hSpacing;
leftStackView.alignment = UIStackViewAlignmentCenter;
[self addArrangedSubview:leftStackView];
self.timestampLabel = [UILabel new];
[self addArrangedSubview:self.timestampLabel];
[leftStackView addArrangedSubview:self.timestampLabel];
self.messageTimerView = [OWSMessageTimerView new];
[self.messageTimerView setContentHuggingHigh];
[leftStackView addArrangedSubview:self.messageTimerView];
self.statusIndicatorImageView = [UIImageView new];
[self.statusIndicatorImageView setContentHuggingHigh];
@ -90,6 +103,18 @@ NS_ASSUME_NONNULL_BEGIN
}
self.timestampLabel.textColor = textColor;
if (viewItem.isExpiringMessage) {
TSMessage *message = (TSMessage *)viewItem.interaction;
uint64_t expirationTimestamp = message.expiresAt;
uint32_t expiresInSeconds = message.expiresInSeconds;
[self.messageTimerView configureWithExpirationTimestamp:expirationTimestamp
initialDurationSeconds:expiresInSeconds
tintColor:textColor];
self.messageTimerView.hidden = NO;
} else {
self.messageTimerView.hidden = YES;
}
if (viewItem.interaction.interactionType == OWSInteractionType_OutgoingMessage) {
TSOutgoingMessage *outgoingMessage = (TSOutgoingMessage *)viewItem.interaction;
@ -218,6 +243,11 @@ NS_ASSUME_NONNULL_BEGIN
result.width += (self.maxImageWidth + self.hSpacing);
}
}
if (viewItem.isExpiringMessage) {
result.width += ([OWSMessageTimerView measureSize].width + self.hSpacing);
}
return CGSizeCeil(result);
}
@ -236,6 +266,8 @@ NS_ASSUME_NONNULL_BEGIN
- (void)prepareForReuse
{
[self.statusIndicatorImageView.layer removeAllAnimations];
[self.messageTimerView prepareForReuse];
}
@end

@ -0,0 +1,25 @@
//
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface OWSMessageTimerView : UIView
- (instancetype)init NS_DESIGNATED_INITIALIZER;
- (instancetype)initWithFrame:(CGRect)frame NS_UNAVAILABLE;
- (nullable instancetype)initWithCoder:(NSCoder *)aDecoder NS_UNAVAILABLE;
- (void)configureWithExpirationTimestamp:(uint64_t)expirationTimestamp
initialDurationSeconds:(uint32_t)initialDurationSeconds
tintColor:(UIColor *)tintColor;
- (void)prepareForReuse;
+ (CGSize)measureSize;
@end
NS_ASSUME_NONNULL_END

@ -0,0 +1,195 @@
//
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
//
#import "OWSMessageTimerView.h"
#import "ConversationViewController.h"
#import "NSDate+OWS.h"
#import "OWSMath.h"
#import "UIColor+OWS.h"
#import "UIView+OWS.h"
#import <QuartzCore/QuartzCore.h>
#import <SignalServiceKit/NSTimer+OWS.h>
NS_ASSUME_NONNULL_BEGIN
const CGFloat kDisappearingMessageIconSize = 12.f;
@interface OWSMessageTimerView ()
@property (nonatomic) uint32_t initialDurationSeconds;
@property (nonatomic) uint64_t expirationTimestamp;
@property (nonatomic) UIColor *tintColor;
@property (nonatomic) UIImageView *imageView;
@property (nonatomic, nullable) NSTimer *animationTimer;
// 0 == about to expire, 12 == just started countdown.
@property (nonatomic) NSInteger progress12;
@end
#pragma mark -
@implementation OWSMessageTimerView
- (void)dealloc
{
[self clearAnimation];
}
- (instancetype)init
{
self = [super initWithFrame:CGRectZero];
if (!self) {
return self;
}
[self commonInit];
return self;
}
- (void)commonInit
{
self.imageView = [UIImageView new];
[self addSubview:self.imageView];
[self.imageView autoPinToSuperviewEdges];
[self.imageView autoSetDimension:ALDimensionWidth toSize:kDisappearingMessageIconSize];
[self.imageView autoSetDimension:ALDimensionHeight toSize:kDisappearingMessageIconSize];
}
- (void)configureWithExpirationTimestamp:(uint64_t)expirationTimestamp
initialDurationSeconds:(uint32_t)initialDurationSeconds
tintColor:(UIColor *)tintColor;
{
self.expirationTimestamp = expirationTimestamp;
self.initialDurationSeconds = initialDurationSeconds;
self.tintColor = tintColor;
[self updateProgress12];
[self updateIcon];
[self startAnimation];
}
- (void)updateProgress12
{
BOOL hasStartedCountdown = self.expirationTimestamp > 0;
if (!hasStartedCountdown) {
self.progress12 = 12;
return;
}
CGFloat secondsLeft = MAX(0, (self.expirationTimestamp - [NSDate ows_millisecondTimeStamp]) / 1000.f);
CGFloat progress = 0.f;
if (self.initialDurationSeconds > 0) {
progress = CGFloatClamp(secondsLeft / self.initialDurationSeconds, 0.f, 1.f);
}
OWSAssert(progress >= 0.f);
OWSAssert(progress <= 1.f);
self.progress12 = (NSInteger)round(CGFloatClamp(progress, 0.f, 1.f) * 12);
}
- (void)setProgress12:(NSInteger)progress12
{
if (_progress12 == progress12) {
return;
}
_progress12 = progress12;
[self updateIcon];
}
- (void)updateIcon
{
self.imageView.image = [[self progressIcon] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
self.imageView.tintColor = self.tintColor;
}
- (UIImage *)progressIcon
{
OWSAssert(self.progress12 >= 0);
OWSAssert(self.progress12 <= 12);
UIImage *_Nullable image;
switch (self.progress12) {
default:
case 0:
image = [UIImage imageNamed:@"disappearing_message_00"];
break;
case 1:
image = [UIImage imageNamed:@"disappearing_message_05"];
break;
case 2:
image = [UIImage imageNamed:@"disappearing_message_10"];
break;
case 3:
image = [UIImage imageNamed:@"disappearing_message_15"];
break;
case 4:
image = [UIImage imageNamed:@"disappearing_message_20"];
break;
case 5:
image = [UIImage imageNamed:@"disappearing_message_25"];
break;
case 6:
image = [UIImage imageNamed:@"disappearing_message_30"];
break;
case 7:
image = [UIImage imageNamed:@"disappearing_message_35"];
break;
case 8:
image = [UIImage imageNamed:@"disappearing_message_40"];
break;
case 9:
image = [UIImage imageNamed:@"disappearing_message_45"];
break;
case 10:
image = [UIImage imageNamed:@"disappearing_message_50"];
break;
case 11:
image = [UIImage imageNamed:@"disappearing_message_55"];
break;
case 12:
image = [UIImage imageNamed:@"disappearing_message_60"];
break;
}
OWSAssert(image);
OWSAssert(image.size.width == kDisappearingMessageIconSize);
OWSAssert(image.size.height == kDisappearingMessageIconSize);
return image;
}
- (void)startAnimation
{
[self clearAnimation];
self.animationTimer = [NSTimer weakScheduledTimerWithTimeInterval:0.1f
target:self
selector:@selector(updateProgress12)
userInfo:nil
repeats:YES];
}
- (void)clearAnimation
{
[self.animationTimer invalidate];
self.animationTimer = nil;
}
- (void)prepareForReuse
{
[self clearAnimation];
}
+ (CGSize)measureSize
{
return CGSizeMake(kDisappearingMessageIconSize, kDisappearingMessageIconSize);
}
@end
NS_ASSUME_NONNULL_END

@ -4807,6 +4807,7 @@ typedef enum : NSUInteger {
TSOutgoingMessage *outgoingMessage = (TSOutgoingMessage *)viewItem.interaction;
MessageReceiptStatus receiptStatus =
[MessageRecipientStatusUtils recipientStatusWithOutgoingMessage:outgoingMessage];
BOOL isDisappearingMessage = outgoingMessage.isExpiringMessage;
if (nextViewItem && nextViewItem.interaction.interactionType == interactionType) {
TSOutgoingMessage *nextOutgoingMessage = (TSOutgoingMessage *)nextViewItem.interaction;
@ -4816,10 +4817,12 @@ typedef enum : NSUInteger {
// We can skip the "outgoing message status" footer if the next message
// has the same footer and no "date break" separates us...
// ...but always show "failed to send" status.
shouldHideFooter = ([timestampText isEqualToString:nextTimestampText]
&& receiptStatus == nextReceiptStatus
&& outgoingMessage.messageState != TSOutgoingMessageStateFailed && !nextViewItem.shouldShowDate);
// ...but always show "failed to send" status
// ...and always show the "disappearing messages" animation.
shouldHideFooter
= ([timestampText isEqualToString:nextTimestampText] && receiptStatus == nextReceiptStatus
&& outgoingMessage.messageState != TSOutgoingMessageStateFailed && !nextViewItem.shouldShowDate
&& !isDisappearingMessage);
}
// clustering
@ -4843,6 +4846,7 @@ typedef enum : NSUInteger {
TSIncomingMessage *incomingMessage = (TSIncomingMessage *)viewItem.interaction;
NSString *incomingSenderId = incomingMessage.authorId;
OWSAssert(incomingSenderId.length > 0);
BOOL isDisappearingMessage = incomingMessage.isExpiringMessage;
NSString *_Nullable nextIncomingSenderId = nil;
if (nextViewItem && nextViewItem.interaction.interactionType == interactionType) {
@ -4855,8 +4859,10 @@ typedef enum : NSUInteger {
NSString *nextTimestampText = [DateUtil formatTimestampShort:nextViewItem.interaction.timestamp];
// We can skip the "incoming message status" footer in a cluster if the next message
// has the same footer and no "date break" separates us.
shouldHideFooter = [timestampText isEqualToString:nextTimestampText] && !nextViewItem.shouldShowDate &&
[NSObject isNullableObject:nextIncomingSenderId equalTo:incomingSenderId];
// ...but always show the "disappearing messages" animation.
shouldHideFooter = ([timestampText isEqualToString:nextTimestampText] && !nextViewItem.shouldShowDate &&
[NSObject isNullableObject:nextIncomingSenderId equalTo:incomingSenderId]
&& !isDisappearingMessage);
}
// clustering

@ -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;

@ -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) {

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

@ -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;

Loading…
Cancel
Save