Merge pull request #1767 from hartlco/1766-Go-to-feed-visible-when-you-are-already-inside-the-feed

Don’t show “Go to feed” action if already inside feed
This commit is contained in:
Brent Simmons 2020-02-02 12:51:21 -08:00 committed by GitHub
commit 782dfd688e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 2 deletions

View File

@ -769,7 +769,8 @@ private extension MasterTimelineViewController {
}
func discloseFeedAction(_ article: Article) -> UIAction? {
guard let webFeed = article.webFeed else { return nil }
guard let webFeed = article.webFeed,
!coordinator.timelineFeedIsEqualTo(webFeed) else { return nil }
let title = NSLocalizedString("Go to Feed", comment: "Go to Feed")
let action = UIAction(title: title, image: AppAssets.openInSidebarImage) { [weak self] action in
@ -779,7 +780,8 @@ private extension MasterTimelineViewController {
}
func discloseFeedAlertAction(_ article: Article, completion: @escaping (Bool) -> Void) -> UIAlertAction? {
guard let webFeed = article.webFeed else { return nil }
guard let webFeed = article.webFeed,
!coordinator.timelineFeedIsEqualTo(webFeed) else { return nil }
let title = NSLocalizedString("Go to Feed", comment: "Go to Feed")
let action = UIAlertAction(title: title, style: .default) { [weak self] action in

View File

@ -997,6 +997,14 @@ class SceneCoordinator: NSObject, UndoableCommandRunner, UnreadCountProvider {
markArticlesWithUndo([article], statusKey: .starred, flag: !article.status.starred)
}
func timelineFeedIsEqualTo(_ feed: WebFeed) -> Bool {
guard let timelineFeed = timelineFeed as? WebFeed else {
return false
}
return timelineFeed == feed
}
func discloseFeed(_ feed: WebFeed, animations: Animations = [], completion: (() -> Void)? = nil) {
if isSearching {
masterTimelineViewController?.hideSearch()