mirror of
https://github.com/stablyai/orca.git
synced 2026-10-31 17:17:38 +00:00
26 lines
642 B
Swift
26 lines
642 B
Swift
import ExpoModulesCore
|
|
import QuickLook
|
|
|
|
/// QLPreviewController holds its data source weakly, so the module keeps the current one alive.
|
|
final class MobileWebShellPdfPreview: NSObject, QLPreviewControllerDataSource {
|
|
private let url: URL
|
|
|
|
init(url: URL) {
|
|
self.url = url
|
|
}
|
|
|
|
func numberOfPreviewItems(in controller: QLPreviewController) -> Int {
|
|
1
|
|
}
|
|
|
|
func previewController(_ controller: QLPreviewController, previewItemAt index: Int) -> QLPreviewItem {
|
|
url as NSURL
|
|
}
|
|
}
|
|
|
|
final class PdfPresenterUnavailableException: Exception {
|
|
override var reason: String {
|
|
"No screen is available to present the PDF"
|
|
}
|
|
}
|