Fix update of 'last modified' cell if removing latest entries

This commit is contained in:
relikd
2020-06-19 17:01:10 +02:00
parent 5dfb7d4ba4
commit f284365469
4 changed files with 72 additions and 42 deletions

View File

@@ -104,7 +104,7 @@ extension GroupedDomainDataSource {
pipeline.reset(dataSource: logs)
}
func syncUpdate(_: SyncUpdate, insert rows: SQLiteRowRange) {
func syncUpdate(_: SyncUpdate, insert rows: SQLiteRowRange, affects: SyncUpdateEnd) {
guard let latest = AppDB?.dnsLogsGrouped(range: rows, parentDomain: parent) else {
assertionFailure("NotifySyncInsert fired with empty range")
return
@@ -122,7 +122,12 @@ extension GroupedDomainDataSource {
cellAnimationsCommit()
}
func syncUpdate(_: SyncUpdate, remove rows: SQLiteRowRange) {
func syncUpdate(_ sender: SyncUpdate, remove rows: SQLiteRowRange, affects: SyncUpdateEnd) {
if affects == .Latest {
// TODO: alternatively query last modified from db (last entry _before_ range)
syncUpdate(sender, reset: sender.rows)
return
}
guard let outdated = AppDB?.dnsLogsGrouped(range: rows, parentDomain: parent),
outdated.count > 0 else {
return