mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2025-02-02 03:56:55 +01:00
Add Get Info context menu option
This commit is contained in:
parent
f785e9f839
commit
09a3a03fc4
@ -68,6 +68,10 @@ struct AppAssets {
|
||||
return RSImage(named: "faviconTemplateImage")!
|
||||
}()
|
||||
|
||||
static var infoImage: UIImage = {
|
||||
UIImage(systemName: "info.circle")!
|
||||
}()
|
||||
|
||||
static var markAllInFeedAsReadImage: UIImage = {
|
||||
return UIImage(systemName: "asterisk.circle")!
|
||||
}()
|
||||
|
@ -229,6 +229,10 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner {
|
||||
popoverController.sourceRect = CGRect(x: view.frame.size.width/2, y: view.frame.size.height/2, width: 1, height: 1)
|
||||
}
|
||||
|
||||
if let action = self.getInfoAlertAction(indexPath: indexPath, completionHandler: completionHandler) {
|
||||
alert.addAction(action)
|
||||
}
|
||||
|
||||
if let action = self.homePageAlertAction(indexPath: indexPath, completionHandler: completionHandler) {
|
||||
alert.addAction(action)
|
||||
}
|
||||
@ -697,6 +701,10 @@ private extension MasterFeedViewController {
|
||||
|
||||
var actions = [UIAction]()
|
||||
|
||||
if let inspectorAction = self.getInfoAction(indexPath: indexPath) {
|
||||
actions.append(inspectorAction)
|
||||
}
|
||||
|
||||
if let homePageAction = self.homePageAction(indexPath: indexPath) {
|
||||
actions.append(homePageAction)
|
||||
}
|
||||
@ -835,6 +843,31 @@ private extension MasterFeedViewController {
|
||||
return action
|
||||
}
|
||||
|
||||
func getInfoAction(indexPath: IndexPath) -> UIAction? {
|
||||
guard let node = dataSource.itemIdentifier(for: indexPath), let feed = node.representedObject as? Feed else {
|
||||
return nil
|
||||
}
|
||||
|
||||
let title = NSLocalizedString("Get Info", comment: "Get Info")
|
||||
let action = UIAction(title: title, image: AppAssets.infoImage) { [weak self] action in
|
||||
self?.coordinator.showFeedInspector(for: feed)
|
||||
}
|
||||
return action
|
||||
}
|
||||
|
||||
func getInfoAlertAction(indexPath: IndexPath, completionHandler: @escaping (Bool) -> Void) -> UIAlertAction? {
|
||||
guard let node = dataSource.itemIdentifier(for: indexPath), let feed = node.representedObject as? Feed else {
|
||||
return nil
|
||||
}
|
||||
|
||||
let title = NSLocalizedString("Get Info", comment: "Get Infor")
|
||||
let action = UIAlertAction(title: title, style: .default) { [weak self] action in
|
||||
self?.coordinator.showFeedInspector(for: feed)
|
||||
completionHandler(true)
|
||||
}
|
||||
return action
|
||||
}
|
||||
|
||||
func rename(indexPath: IndexPath) {
|
||||
|
||||
let name = (dataSource.itemIdentifier(for: indexPath)?.representedObject as? DisplayNameProvider)?.nameForDisplay ?? ""
|
||||
|
@ -800,6 +800,12 @@ class SceneCoordinator: NSObject, UndoableCommandRunner, UnreadCountProvider {
|
||||
}
|
||||
}
|
||||
|
||||
func showFeedInspector(for feed: Feed) {
|
||||
rootSplitViewController.present(style: .formSheet) {
|
||||
FeedInspectorView(viewModel: FeedInspectorView.ViewModel(feed: feed))
|
||||
}
|
||||
}
|
||||
|
||||
func showAdd(_ type: AddControllerType, initialFeed: String? = nil, initialFeedName: String? = nil) {
|
||||
selectFeed(nil)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user