diff --git a/Mac/MainWindow/NNW3/NNW3ImportController.swift b/Mac/MainWindow/NNW3/NNW3ImportController.swift index 32084490e..9a6f4a977 100644 --- a/Mac/MainWindow/NNW3/NNW3ImportController.swift +++ b/Mac/MainWindow/NNW3/NNW3ImportController.swift @@ -8,6 +8,7 @@ import AppKit import Account +import UniformTypeIdentifiers struct NNW3ImportController { @@ -69,7 +70,7 @@ private extension NNW3ImportController { panel.canChooseDirectories = false panel.resolvesAliases = true panel.directoryURL = NNW3ImportController.defaultFileURL - panel.allowedFileTypes = ["plist"] + panel.allowedContentTypes = [UTType.propertyList] panel.allowsOtherFileTypes = false panel.accessoryView = accessoryViewController.view panel.isAccessoryViewDisclosed = true diff --git a/Mac/MainWindow/OPML/ExportOPMLWindowController.swift b/Mac/MainWindow/OPML/ExportOPMLWindowController.swift index 4b2ce20a6..2d2ac30cf 100644 --- a/Mac/MainWindow/OPML/ExportOPMLWindowController.swift +++ b/Mac/MainWindow/OPML/ExportOPMLWindowController.swift @@ -8,6 +8,7 @@ import AppKit import Account +import UniformTypeIdentifiers class ExportOPMLWindowController: NSWindowController { @@ -75,7 +76,7 @@ class ExportOPMLWindowController: NSWindowController { func exportOPML(account: Account) { let panel = NSSavePanel() - panel.allowedFileTypes = ["opml"] + panel.allowedContentTypes = [UTType.opml] panel.allowsOtherFileTypes = false panel.prompt = NSLocalizedString("Export OPML", comment: "Export OPML") panel.title = NSLocalizedString("Export OPML", comment: "Export OPML") diff --git a/Mac/MainWindow/OPML/ImportOPMLWindowController.swift b/Mac/MainWindow/OPML/ImportOPMLWindowController.swift index f0737fe93..1db6ca6d2 100644 --- a/Mac/MainWindow/OPML/ImportOPMLWindowController.swift +++ b/Mac/MainWindow/OPML/ImportOPMLWindowController.swift @@ -8,6 +8,7 @@ import AppKit import Account +import UniformTypeIdentifiers class ImportOPMLWindowController: NSWindowController { @@ -85,7 +86,7 @@ class ImportOPMLWindowController: NSWindowController { panel.allowsMultipleSelection = false panel.canChooseDirectories = false panel.resolvesAliases = true - panel.allowedFileTypes = ["opml", "xml"] + panel.allowedContentTypes = [UTType.opml, UTType.xml] panel.allowsOtherFileTypes = false panel.beginSheetModal(for: hostWindow!) { modalResult in diff --git a/Mac/ShareExtension/ShareViewController.swift b/Mac/ShareExtension/ShareViewController.swift index 2d7558063..d8e655a0a 100644 --- a/Mac/ShareExtension/ShareViewController.swift +++ b/Mac/ShareExtension/ShareViewController.swift @@ -8,6 +8,7 @@ import Cocoa import os.log +import UniformTypeIdentifiers class ShareViewController: NSViewController { @@ -33,14 +34,14 @@ class ShareViewController: NSViewController { // Try to get any HTML that is maybe passed in for item in self.extensionContext!.inputItems as! [NSExtensionItem] { for itemProvider in item.attachments! { - if itemProvider.hasItemConformingToTypeIdentifier(kUTTypePropertyList as String) { + if itemProvider.hasItemConformingToTypeIdentifier(UTType.propertyList.identifier) { provider = itemProvider } } } if provider != nil { - provider!.loadItem(forTypeIdentifier: kUTTypePropertyList as String, options: nil, completionHandler: { [weak self] (pList, error) in + provider!.loadItem(forTypeIdentifier: UTType.propertyList.identifier, options: nil, completionHandler: { [weak self] (pList, error) in if error != nil { return } diff --git a/Shared/Extensions/UTType+Extensions.swift b/Shared/Extensions/UTType+Extensions.swift index c3e307c91..77edccdc5 100644 --- a/Shared/Extensions/UTType+Extensions.swift +++ b/Shared/Extensions/UTType+Extensions.swift @@ -7,3 +7,9 @@ // import Foundation +import UniformTypeIdentifiers + +extension UTType { + + static let opml = UTType("public.opml")! +}