@ -3956,20 +3956,30 @@ typedef NS_ENUM(NSInteger, MessagesRangeSizeMode) {
TSThread * thread = self . thread ;
TSThread * thread = self . thread ;
uint64_t lastVisibleTimestamp = self . lastVisibleTimestamp ;
uint64_t lastVisibleTimestamp = self . lastVisibleTimestamp ;
[ self . editingDatabaseConnection asyncReadWriteWithBlock : ^( YapDatabaseReadWriteTransaction * _Nonnull transaction ) {
[ self . editingDatabaseConnection asyncReadWriteWithBlock : ^( YapDatabaseReadWriteTransaction * _Nonnull transaction ) {
NSMutableArray < id < OWSReadTracking > > * interactions = [ NSMutableArray new ] ;
NSMutableArray < id < OWSReadTracking > > * interactions = [ NSMutableArray new ] ;
[ [ TSDatabaseView unseenDatabaseViewExtension : transaction ]
[ [ TSDatabaseView unseenDatabaseViewExtension : transaction ]
enumerateRowsInGroup : thread . uniqueId
enumerateRowsInGroup : thread . uniqueId
usingBlock : ^(
usingBlock : ^(
NSString * collection , NSString * key , id object , id metadata , NSUInteger index , BOOL * stop ) {
NSString * collection , NSString * key , id object , id metadata , NSUInteger index , BOOL * stop ) {
TSInteraction * interaction = object ;
if ( ![ object conformsToProtocol : @ protocol ( OWSReadTracking ) ] ) {
if ( interaction . timestampForSorting > lastVisibleTimestamp ) {
OWSFail ( @ "Expected to conform to OWSReadTracking : object with class : %@ collection: %@ "
@ "key : %@",
[ object class ] ,
collection ,
key ) ;
return ;
}
id < OWSReadTracking > possiblyRead = ( id < OWSReadTracking > ) object ;
if ( possiblyRead . timestampForSorting > lastVisibleTimestamp ) {
* stop = YES ;
* stop = YES ;
return ;
return ;
}
}
id < OWSReadTracking > possiblyRead = ( id < OWSReadTracking > ) object ;
OWSAssert ( !possiblyRead . read ) ;
OWSAssert ( !possiblyRead . read ) ;
if ( !possiblyRead . read ) {
if ( !possiblyRead . read ) {
[ interactions addObject : possiblyRead ] ;
[ interactions addObject : possiblyRead ] ;