|
|
@ -224,11 +224,17 @@ NSString *const TSSecondaryDevicesDatabaseViewExtensionName = @"TSSecondaryDevic
|
|
|
|
|
|
|
|
|
|
|
|
TSThread *thread = (TSThread *)object;
|
|
|
|
TSThread *thread = (TSThread *)object;
|
|
|
|
|
|
|
|
|
|
|
|
YapDatabaseViewTransaction *viewTransaction = [transaction ext:TSMessageDatabaseViewExtensionName];
|
|
|
|
if (thread.isGroupThread) {
|
|
|
|
OWSAssert(viewTransaction);
|
|
|
|
// Do nothing; we never hide group threads.
|
|
|
|
NSUInteger threadMessageCount = [viewTransaction numberOfItemsInGroup:thread.uniqueId];
|
|
|
|
} else if (thread.hasEverHadMessage) {
|
|
|
|
if (threadMessageCount < 1) {
|
|
|
|
// Do nothing; we never hide threads that have ever had a message.
|
|
|
|
return nil;
|
|
|
|
} else {
|
|
|
|
|
|
|
|
YapDatabaseViewTransaction *viewTransaction = [transaction ext:TSMessageDatabaseViewExtensionName];
|
|
|
|
|
|
|
|
OWSAssert(viewTransaction);
|
|
|
|
|
|
|
|
NSUInteger threadMessageCount = [viewTransaction numberOfItemsInGroup:thread.uniqueId];
|
|
|
|
|
|
|
|
if (threadMessageCount < 1) {
|
|
|
|
|
|
|
|
return nil;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (thread.archivalDate) {
|
|
|
|
if (thread.archivalDate) {
|
|
|
@ -248,7 +254,7 @@ NSString *const TSSecondaryDevicesDatabaseViewExtensionName = @"TSSecondaryDevic
|
|
|
|
[[YapWhitelistBlacklist alloc] initWithWhitelist:[NSSet setWithObject:[TSThread collection]]];
|
|
|
|
[[YapWhitelistBlacklist alloc] initWithWhitelist:[NSSet setWithObject:[TSThread collection]]];
|
|
|
|
|
|
|
|
|
|
|
|
YapDatabaseView *databaseView =
|
|
|
|
YapDatabaseView *databaseView =
|
|
|
|
[[YapDatabaseView alloc] initWithGrouping:viewGrouping sorting:viewSorting versionTag:@"2" options:options];
|
|
|
|
[[YapDatabaseView alloc] initWithGrouping:viewGrouping sorting:viewSorting versionTag:@"3" options:options];
|
|
|
|
|
|
|
|
|
|
|
|
[[TSStorageManager sharedManager].database registerExtension:databaseView
|
|
|
|
[[TSStorageManager sharedManager].database registerExtension:databaseView
|
|
|
|
withName:TSThreadDatabaseViewExtensionName];
|
|
|
|
withName:TSThreadDatabaseViewExtensionName];
|
|
|
|