Skip to content

Commit

Permalink
refactor: Add ConvertedType.documentTypes
Browse files Browse the repository at this point in the history
Signed-off-by: Philippe Weidmann <[email protected]>
  • Loading branch information
PhilippeWeidmann committed Dec 6, 2024
1 parent 58e408e commit 48363c8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ final class PreviewViewController: UIViewController, PreviewContentCellDelegate,
}

let file = previewFiles[index]
if file.convertedType == .spreadsheet || file.convertedType == .presentation || file.convertedType == .text {
if ConvertedType.documentTypes.contains(file.convertedType) {
handleOfficePreviewError(error, previewIndex: index)
}

Expand Down
7 changes: 4 additions & 3 deletions kDriveCore/Data/Models/File.swift
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,12 @@ public enum ConvertedType: String, CaseIterable {
return types.first { uti.conforms(to: $0.uti) } ?? .unknown
}

public static let downloadableTypes = Set<ConvertedType>(arrayLiteral: .code, .form, .pdf, .presentation, .spreadsheet, .text,
.url)
public static let remotePlayableTypes = Set<ConvertedType>(arrayLiteral: .audio, .video)
public static let downloadableTypes: Set<ConvertedType> = [.code, .form, .pdf, .presentation, .spreadsheet, .text, .url]
public static let remotePlayableTypes: Set<ConvertedType> = [.audio, .video]
// Currently it's the same as the downloadableTypes but later this could change
public static let ignoreThumbnailTypes = downloadableTypes
/// Documents that can be previewed by the OS but not necessarily handled by OnlyOffice (eg. .pages)
public static let documentTypes: Set<ConvertedType> = [.presentation, .spreadsheet, .text]
}

public enum SortType: String {
Expand Down

0 comments on commit 48363c8

Please sign in to comment.