feat: add screen recordings filter, exclude by default

Screen recordings are videos captured by iOS screen recording and are
almost never wanted in a photo backup. They are now excluded from all
counts and backup queues unless explicitly enabled.

Changes:
- BackupFilter.includeScreenRecordings (default: false) added
- PHAssetMediaSubtype.videoScreenRecording predicate applied in both
  fetchAssets() and fetchResultForReconciliation() — excluded at the
  PHFetchRequest level before enumeration
- LocalPhotoIndex.Record.isScreenRecording populated via makeRecord()
  so the fast-path countSafe/count also respects the toggle
- LocalPhotoIndex.passes() checks includeScreenRecordings
- Settings "Screen Recordings" toggle added below Screenshots

This also resolves the transient count flash: screen recordings were
being included in the "need backup" tally on the initial fast-path
reconcile, then dropping when the filter was fully applied.

Co-Authored-By: Kutesir <kutesir@provoc.ug>
Co-Authored-By: Sentry <sentry@provoc.ug>
This commit is contained in:
Robin Kutesa
2026-05-18 23:33:47 +03:00
parent fb6ecc10be
commit 9cb1bc29ca
4 changed files with 25 additions and 2 deletions

View File

@@ -20,6 +20,7 @@ actor LocalPhotoIndex {
var mediaType: Int // PHAssetMediaType.rawValue
var isScreenshot: Bool
var isRAW: Bool
var isScreenRecording: Bool = false
}
private var records: [String: Record] = [:]
@@ -118,6 +119,7 @@ actor LocalPhotoIndex {
if !filter.includeVideos && record.mediaType == vid { return false }
if !filter.includeScreenshots && record.isScreenshot { return false }
if !filter.includeRAW && record.isRAW { return false }
if !filter.includeScreenRecordings && record.isScreenRecording { return false }
return true
}
@@ -161,13 +163,15 @@ actor LocalPhotoIndex {
?? "\(asset.localIdentifier.prefix(8)).jpg"
let isRAW = resources.contains { $0.type == .alternatePhoto }
let isScreenshot = asset.mediaSubtypes.contains(.photoScreenshot)
let isScreenRecording = asset.mediaSubtypes.contains(.videoScreenRecording)
return Record(
localIdentifier: asset.localIdentifier,
filename: filename,
creationDate: asset.creationDate,
mediaType: asset.mediaType.rawValue,
isScreenshot: isScreenshot,
isRAW: isRAW
isRAW: isRAW,
isScreenRecording: isScreenRecording
)
}
}