mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 19:44:05 +00:00
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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user