Added support for content types PNG in the DocumentView view for the Browse module.

This commit is contained in:
Javier Cicchelli 2022-12-20 02:05:22 +01:00
parent dc00fa66cb
commit b77f1b758c

View File

@ -100,6 +100,10 @@ private extension DocumentView {
// MARK: Computed // MARK: Computed
var supportedContentTypes: [String] {
[.ContentType.jpeg, .ContentType.png]
}
var imageFromData: UIImage { var imageFromData: UIImage {
guard guard
let loadedData, let loadedData,
@ -114,7 +118,7 @@ private extension DocumentView {
// MARK: Functions // MARK: Functions
func loadDataIfPossible() async { func loadDataIfPossible() async {
guard document.contentType == .Constants.supportedContentType else { guard supportedContentTypes.contains(document.contentType) else {
status = .notSupported status = .notSupported
return return
} }
@ -147,8 +151,9 @@ private extension DocumentView {
// MARK: - String+Constants // MARK: - String+Constants
private extension String { private extension String {
enum Constants { enum ContentType {
static let supportedContentType = "image/jpeg" static let jpeg = "image/jpeg"
static let png = "image/png"
} }
} }