From b77f1b758c215ffc7acdd73a47ac282d0a0a9072 Mon Sep 17 00:00:00 2001 From: Javier Cicchelli Date: Tue, 20 Dec 2022 02:05:22 +0100 Subject: [PATCH] Added support for content types PNG in the DocumentView view for the Browse module. --- Modules/Sources/Browse/UI/Views/DocumentView.swift | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Modules/Sources/Browse/UI/Views/DocumentView.swift b/Modules/Sources/Browse/UI/Views/DocumentView.swift index 8a4e5e8..0fe9294 100644 --- a/Modules/Sources/Browse/UI/Views/DocumentView.swift +++ b/Modules/Sources/Browse/UI/Views/DocumentView.swift @@ -100,6 +100,10 @@ private extension DocumentView { // MARK: Computed + var supportedContentTypes: [String] { + [.ContentType.jpeg, .ContentType.png] + } + var imageFromData: UIImage { guard let loadedData, @@ -114,7 +118,7 @@ private extension DocumentView { // MARK: Functions func loadDataIfPossible() async { - guard document.contentType == .Constants.supportedContentType else { + guard supportedContentTypes.contains(document.contentType) else { status = .notSupported return } @@ -147,8 +151,9 @@ private extension DocumentView { // MARK: - String+Constants private extension String { - enum Constants { - static let supportedContentType = "image/jpeg" + enum ContentType { + static let jpeg = "image/jpeg" + static let png = "image/png" } }