Fix deprecation warnings.

This commit is contained in:
Brent Simmons 2024-02-24 19:17:58 -08:00
parent 0627f57608
commit d2afd4582b
5 changed files with 15 additions and 5 deletions

View File

@ -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

View File

@ -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")

View File

@ -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

View File

@ -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
}

View File

@ -7,3 +7,9 @@
//
import Foundation
import UniformTypeIdentifiers
extension UTType {
static let opml = UTType("public.opml")!
}