2018-02-12 07:10:28 +01:00
|
|
|
//
|
|
|
|
// SmartFeedPasteboardWriter.swift
|
2018-08-29 07:18:24 +02:00
|
|
|
// NetNewsWire
|
2018-02-12 07:10:28 +01:00
|
|
|
//
|
|
|
|
// Created by Brent Simmons on 2/11/18.
|
|
|
|
// Copyright © 2018 Ranchero Software. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
import AppKit
|
|
|
|
import Account
|
|
|
|
|
2024-03-26 05:10:37 +01:00
|
|
|
@MainActor @objc final class SmartFeedPasteboardWriter: NSObject, NSPasteboardWriting {
|
2018-02-12 07:10:28 +01:00
|
|
|
|
|
|
|
private let smartFeed: PseudoFeed
|
|
|
|
|
|
|
|
init(smartFeed: PseudoFeed) {
|
|
|
|
|
|
|
|
self.smartFeed = smartFeed
|
|
|
|
}
|
|
|
|
|
|
|
|
// MARK: - NSPasteboardWriting
|
|
|
|
|
2024-04-08 06:32:47 +02:00
|
|
|
nonisolated func writableTypes(for pasteboard: NSPasteboard) -> [NSPasteboard.PasteboardType] {
|
2018-02-12 07:10:28 +01:00
|
|
|
|
|
|
|
return [.string]
|
|
|
|
}
|
|
|
|
|
2024-04-08 06:32:47 +02:00
|
|
|
nonisolated func pasteboardPropertyList(forType type: NSPasteboard.PasteboardType) -> Any? {
|
|
|
|
|
|
|
|
MainActor.assumeIsolated {
|
|
|
|
let plist: Any?
|
|
|
|
|
|
|
|
switch type {
|
|
|
|
case .string:
|
|
|
|
plist = smartFeed.nameForDisplay
|
|
|
|
default:
|
|
|
|
plist = nil
|
|
|
|
}
|
|
|
|
|
|
|
|
return plist
|
2018-02-12 07:10:28 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|