diff --git a/iOS/AppAssets.swift b/iOS/AppAssets.swift index 1ad368e43..a31ac6ea5 100644 --- a/iOS/AppAssets.swift +++ b/iOS/AppAssets.swift @@ -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")! }() diff --git a/iOS/MasterFeed/MasterFeedViewController.swift b/iOS/MasterFeed/MasterFeedViewController.swift index a0681824a..f6e0c823b 100644 --- a/iOS/MasterFeed/MasterFeedViewController.swift +++ b/iOS/MasterFeed/MasterFeedViewController.swift @@ -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 ?? "" diff --git a/iOS/SceneCoordinator.swift b/iOS/SceneCoordinator.swift index bfd9c45fd..9a845871d 100644 --- a/iOS/SceneCoordinator.swift +++ b/iOS/SceneCoordinator.swift @@ -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)