Rework unread indicators.

pull/1/head
Matthew Chen 7 years ago
parent 8d72bb032e
commit ecafe546b6

@ -741,9 +741,7 @@ typedef enum : NSUInteger {
{
NSInteger row = 0;
for (ConversationViewItem *viewItem in self.viewItems) {
OWSInteractionType interactionType
= (viewItem ? viewItem.interaction.interactionType : OWSInteractionType_Unknown);
if (interactionType == OWSInteractionType_UnreadIndicator) {
if (viewItem.unreadIndicator) {
return [NSIndexPath indexPathForRow:row inSection:0];
}
row++;
@ -4742,7 +4740,6 @@ typedef enum : NSUInteger {
BOOL canShowDate = NO;
switch (viewItem.interaction.interactionType) {
case OWSInteractionType_Unknown:
case OWSInteractionType_UnreadIndicator:
case OWSInteractionType_Offer:
canShowDate = NO;
break;

@ -261,9 +261,6 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType)
case OWSInteractionType_Call:
measurementCell = [OWSSystemMessageCell new];
break;
case OWSInteractionType_UnreadIndicator:
OWSFail(@"%@ unexpected unread indicator.", self.logTag);
return nil;
case OWSInteractionType_Offer:
measurementCell = [OWSContactOffersCell new];
break;
@ -280,11 +277,6 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType)
{
OWSAssert(previousLayoutItem);
if (self.interaction.interactionType == OWSInteractionType_UnreadIndicator
|| previousLayoutItem.interaction.interactionType == OWSInteractionType_UnreadIndicator) {
return 20.f;
}
if (self.hasCellHeader) {
return OWSMessageHeaderViewDateHeaderVMargin;
}
@ -326,9 +318,6 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType)
case OWSInteractionType_Call:
return [collectionView dequeueReusableCellWithReuseIdentifier:[OWSSystemMessageCell cellReuseIdentifier]
forIndexPath:indexPath];
case OWSInteractionType_UnreadIndicator:
OWSFail(@"%@ unexpected unread indicator.", self.logTag);
return nil;
case OWSInteractionType_Offer:
return [collectionView dequeueReusableCellWithReuseIdentifier:[OWSContactOffersCell cellReuseIdentifier]
forIndexPath:indexPath];

@ -27,7 +27,7 @@ NS_ASSUME_NONNULL_BEGIN
- (OWSInteractionType)interactionType
{
return OWSInteractionType_UnreadIndicator;
return OWSInteractionType_Unknown;
}
@end

@ -603,17 +603,10 @@ NS_ASSUME_NONNULL_BEGIN
= (missingUnseenSafetyNumberChanges.count + nonBlockingSafetyNumberChanges.count);
}
// TODO:
NSInteger unreadIndicatorPosition = visibleUnseenMessageCount;
// TODO:
// if (dynamicInteractions.firstUnseenInteractionTimestamp) {
// // The unread indicator is _before_ the last visible unseen message.
// NSInteger unreadIndicatorPosition = visibleUnseenMessageCount + 1;
// if (shouldHaveContactOffers) {
// unreadIndicatorPosition++;
// }
// dynamicInteractions.unreadIndicatorPosition = @(unreadIndicatorPosition);
// }
if (shouldHaveContactOffers) {
unreadIndicatorPosition++;
}
dynamicInteractions.unreadIndicator = [[OWSUnreadIndicator alloc]
initUnreadIndicatorWithTimestamp:interactionAfterUnreadIndicator.timestampForSorting

@ -15,8 +15,6 @@ typedef NS_ENUM(NSInteger, OWSInteractionType) {
OWSInteractionType_Error,
OWSInteractionType_Call,
OWSInteractionType_Info,
// TODO: Obsolete, consider replacing with OWSInteractionType_Unknown.
OWSInteractionType_UnreadIndicator,
OWSInteractionType_Offer,
};

@ -25,8 +25,6 @@ NSString *NSStringFromOWSInteractionType(OWSInteractionType value)
return @"OWSInteractionType_Call";
case OWSInteractionType_Info:
return @"OWSInteractionType_Info";
case OWSInteractionType_UnreadIndicator:
return @"OWSInteractionType_UnreadIndicator";
case OWSInteractionType_Offer:
return @"OWSInteractionType_Offer";
}

Loading…
Cancel
Save