mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
[macOS] Reduced Deprecation Warnings
- ShareViewController now uses `UTType` - Now using NSWorkspace.shared.icon(for: .applicationBundle) - Unused code `extensionPointTypeTitle` removed - NNW3 Import now uses `allowedContentTypes`
This commit is contained in:
@@ -69,7 +69,7 @@ private extension NNW3ImportController {
|
||||
panel.canChooseDirectories = false
|
||||
panel.resolvesAliases = true
|
||||
panel.directoryURL = NNW3ImportController.defaultFileURL
|
||||
panel.allowedFileTypes = ["plist"]
|
||||
panel.allowedContentTypes = [.propertyList]
|
||||
panel.allowsOtherFileTypes = false
|
||||
panel.accessoryView = accessoryViewController.view
|
||||
panel.isAccessoryViewDisclosed = true
|
||||
|
||||
@@ -66,7 +66,6 @@ protocol ExtensionPointPreferencesEnabler: AnyObject {
|
||||
alert.alertStyle = .warning
|
||||
let prompt = NSLocalizedString("alert.title.deactivate-extension.%@", comment: "Deactivate “%@“?")
|
||||
alert.messageText = String(format: prompt, extensionPoint.title)
|
||||
let extensionPointTypeTitle = extensionPoint.extensionPointID.extensionPointType.title
|
||||
alert.informativeText = NSLocalizedString("alert.message.cannot-undo-action", comment: "You can't undo this action.")
|
||||
|
||||
alert.addButton(withTitle: NSLocalizedString("button.title.deactivate", comment: "Deactivate Extension"))
|
||||
|
||||
@@ -125,7 +125,7 @@ private extension GeneralPreferencesViewController {
|
||||
let item = NSMenuItem(title: name, action: nil, keyEquivalent: "")
|
||||
item.representedObject = browser.bundleIdentifier
|
||||
|
||||
let icon = browser.icon ?? NSWorkspace.shared.icon(forFileType: kUTTypeApplicationBundle as String)
|
||||
let icon = browser.icon ?? NSWorkspace.shared.icon(for: .applicationBundle)
|
||||
icon.size = NSSize(width: 16.0, height: 16.0)
|
||||
item.image = browser.icon
|
||||
menu.addItem(item)
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
//
|
||||
|
||||
import Cocoa
|
||||
import UniformTypeIdentifiers
|
||||
|
||||
class ShareViewController: NSViewController {
|
||||
|
||||
@@ -31,14 +32,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.description) {
|
||||
provider = itemProvider
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if provider != nil {
|
||||
provider!.loadItem(forTypeIdentifier: kUTTypePropertyList as String, options: nil, completionHandler: { [weak self] (pList, error) in
|
||||
provider!.loadItem(forTypeIdentifier: UTType.propertyList.description, options: nil, completionHandler: { [weak self] (pList, error) in
|
||||
if error != nil {
|
||||
return
|
||||
}
|
||||
@@ -58,14 +59,14 @@ class ShareViewController: NSViewController {
|
||||
// Try to get the URL if it is passed in as a URL
|
||||
for item in self.extensionContext!.inputItems as! [NSExtensionItem] {
|
||||
for itemProvider in item.attachments! {
|
||||
if itemProvider.hasItemConformingToTypeIdentifier(kUTTypeURL as String) {
|
||||
if itemProvider.hasItemConformingToTypeIdentifier(UTType.url.description) {
|
||||
provider = itemProvider
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if provider != nil {
|
||||
provider!.loadItem(forTypeIdentifier: kUTTypeURL as String, options: nil, completionHandler: { [weak self] (urlCoded, error) in
|
||||
provider!.loadItem(forTypeIdentifier: UTType.url.description, options: nil, completionHandler: { [weak self] (urlCoded, error) in
|
||||
if error != nil {
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user