mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2025-02-03 20:37:34 +01:00
Add copy url actions for feeds
This commit is contained in:
parent
c03c444997
commit
e88210bbb7
@ -612,6 +612,14 @@ private extension MasterFeedViewController {
|
||||
actions.append(homePageAction)
|
||||
}
|
||||
|
||||
if let copyFeedPageAction = self.copyFeedPageAction(indexPath: indexPath) {
|
||||
actions.append(copyFeedPageAction)
|
||||
}
|
||||
|
||||
if let copyHomePageAction = self.copyHomePageAction(indexPath: indexPath) {
|
||||
actions.append(copyHomePageAction)
|
||||
}
|
||||
|
||||
if includeDeleteRename {
|
||||
actions.append(self.deleteAction(indexPath: indexPath))
|
||||
actions.append(self.renameAction(indexPath: indexPath))
|
||||
@ -639,6 +647,35 @@ private extension MasterFeedViewController {
|
||||
return action
|
||||
}
|
||||
|
||||
func copyFeedPageAction(indexPath: IndexPath) -> UIAction? {
|
||||
guard let node = coordinator.nodeFor(indexPath),
|
||||
let feed = node.representedObject as? Feed,
|
||||
let url = URL(string: feed.url) else {
|
||||
return nil
|
||||
}
|
||||
|
||||
let title = NSLocalizedString("Copy Feed URL", comment: "Copy Feed URL")
|
||||
let action = UIAction(title: title, image: UIImage(systemName: "doc.on.doc")) { action in
|
||||
UIPasteboard.general.url = url
|
||||
}
|
||||
return action
|
||||
}
|
||||
|
||||
func copyHomePageAction(indexPath: IndexPath) -> UIAction? {
|
||||
guard let node = coordinator.nodeFor(indexPath),
|
||||
let feed = node.representedObject as? Feed,
|
||||
let homePageURL = feed.homePageURL,
|
||||
let url = URL(string: homePageURL) else {
|
||||
return nil
|
||||
}
|
||||
|
||||
let title = NSLocalizedString("Copy Home Page URL", comment: "Copy Home Page URL")
|
||||
let action = UIAction(title: title, image: UIImage(systemName: "doc.on.doc")) { action in
|
||||
UIPasteboard.general.url = url
|
||||
}
|
||||
return action
|
||||
}
|
||||
|
||||
func deleteAction(indexPath: IndexPath) -> UIAction {
|
||||
let title = NSLocalizedString("Delete", comment: "Delete")
|
||||
let action = UIAction(title: title, image: UIImage(systemName: "trash")) { action in
|
||||
|
Loading…
x
Reference in New Issue
Block a user