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

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

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

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

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

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

Loading…
Cancel
Save