diff --git a/DuckDuckGo/FilePreviewHelper.swift b/DuckDuckGo/FilePreviewHelper.swift index f13b508379..f8f4009311 100644 --- a/DuckDuckGo/FilePreviewHelper.swift +++ b/DuckDuckGo/FilePreviewHelper.swift @@ -33,7 +33,10 @@ struct FilePreviewHelper { static func canAutoPreviewMIMEType(_ mimeType: MIMEType) -> Bool { switch mimeType { - case .reality, .usdz, .passbook, .calendar: + case .passbook: + return UIDevice.current.userInterfaceIdiom == .phone + + case .reality, .usdz, .calendar: return true default: return false diff --git a/DuckDuckGo/PassKitPreviewHelper.swift b/DuckDuckGo/PassKitPreviewHelper.swift index 6b95cbe2e6..3a734eee03 100644 --- a/DuckDuckGo/PassKitPreviewHelper.swift +++ b/DuckDuckGo/PassKitPreviewHelper.swift @@ -34,8 +34,9 @@ class PassKitPreviewHelper: FilePreview { do { let data = try Data(contentsOf: self.filePath) let pass = try PKPass(data: data) - let controller = PKAddPassesViewController(pass: pass)! - viewController?.present(controller, animated: true) + if let controller = PKAddPassesViewController(pass: pass) { + viewController?.present(controller, animated: true) + } } catch { os_log("Can't present passkit: %s", type: .debug, error.localizedDescription) }