Media Preview content scanning (#5851)

* implemented checkSourceSafetyIfNeeded in the timeline media preview

* added a subtitle to the spinner when scanning and an animated drag gesture for the error and loading states

* pr suggestions

* pr suggestions part 2
This commit is contained in:
Mauro
2026-07-09 18:46:14 +02:00
committed by GitHub
parent ee89f8846f
commit 6bd8423675
15 changed files with 323 additions and 60 deletions
@@ -144,8 +144,30 @@ class TimelineMediaPreviewDataSource: NSObject, QLPreviewControllerDataSource {
enum TimelineMediaPreviewItem: Equatable {
case media(Media)
case contentScan(Scan)
case loading(Loading)
/// The media item this preview is for, regardless of its content scanning state.
var mediaItem: Media? {
switch self {
case .media(let mediaItem): mediaItem
case .contentScan(let scan): scan.media
case .loading: nil
}
}
/// A media item that is being processed by the content scanner, or that failed a scan
/// and therefore must not be downloaded or previewed.
struct Scan: Equatable {
enum State: Equatable {
case scanning
case failure(ContentScanningFailure)
}
let media: Media
let state: State
}
/// Wraps a media file and title to be previewed with QuickLook.
@Observable class Media: NSObject, QLPreviewItem, Identifiable {
fileprivate(set) var timelineItem: EventBasedMessageTimelineItemProtocol {