Files
Kisani/Core/Protocols/PhotoLibraryProtocol.swift
Robin Kutesa 9cb1bc29ca 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>
2026-05-18 23:33:47 +03:00

32 lines
913 B
Swift

import Foundation
import Photos
struct PhotoAsset: Sendable {
let localIdentifier: String
let filename: String
let creationDate: Date?
let mediaType: PHAssetMediaType
let pixelWidth: Int
let pixelHeight: Int
let duration: TimeInterval
let isScreenshot: Bool
let isRAW: Bool
let isScreenRecording: Bool
}
protocol PhotoLibraryProtocol: AnyObject {
var authorizationStatus: PHAuthorizationStatus { get }
func requestAuthorization() async -> PHAuthorizationStatus
func fetchAssets(filter: BackupFilter) -> [PhotoAsset]
func exportAsset(_ asset: PhotoAsset) async throws -> URL
}
struct BackupFilter: Codable, Sendable, Equatable {
var includePhotos: Bool = true
var includeVideos: Bool = true
var includeScreenshots: Bool = false
var includeRAW: Bool = false
var newFilesOnly: Bool = true
var includeScreenRecordings: Bool = false
}