From ab80d190d47c0fd80c6905b9cddb7ce8f34484c3 Mon Sep 17 00:00:00 2001 From: Stuart Breckenridge Date: Mon, 1 Feb 2021 08:33:37 +0800 Subject: [PATCH] Notifications MasterFeedViewController now observes changes in active extension points so the context menu can be rebuilt. --- iOS/MasterFeed/MasterFeedViewController.swift | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/iOS/MasterFeed/MasterFeedViewController.swift b/iOS/MasterFeed/MasterFeedViewController.swift index 2adf09c2f..acf0a10bb 100644 --- a/iOS/MasterFeed/MasterFeedViewController.swift +++ b/iOS/MasterFeed/MasterFeedViewController.swift @@ -70,6 +70,7 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner { NotificationCenter.default.addObserver(self, selector: #selector(webFeedSettingDidChange(_:)), name: .WebFeedSettingDidChange, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(contentSizeCategoryDidChange), name: UIContentSizeCategory.didChangeNotification, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(willEnterForeground(_:)), name: UIApplication.willEnterForegroundNotification, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(configureContextMenu(_:)), name: .ActiveExtensionPointsDidChange, object: nil) refreshControl = UIRefreshControl() refreshControl!.addTarget(self, action: #selector(refreshAccounts(_:)), for: .valueChanged) @@ -581,8 +582,12 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner { } refreshProgressView?.update() addNewItemButton?.isEnabled = !AccountManager.shared.activeAccounts.isEmpty - - + + configureContextMenu() + } + + @objc + func configureContextMenu(_: Any? = nil) { if #available(iOS 14.0, *) { let addWebFeedActionTitle = NSLocalizedString("Add Web Feed", comment: "Add Web Feed") let addWebFeedAction = UIAction(title: addWebFeedActionTitle, image: AppAssets.faviconTemplateImage.withRenderingMode(.alwaysOriginal).withTintColor(.secondaryLabel)) { _ in @@ -619,7 +624,6 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner { self.addNewItemButton.menu = menu } - } func focus() {