From 5989c03ac445dd682551007d96005c7b1491d3b1 Mon Sep 17 00:00:00 2001 From: kean Date: Fri, 8 Nov 2024 19:07:27 -0500 Subject: [PATCH] Remove ReaderContentType --- .../Reader/Controllers/ReaderHelpers.swift | 45 ------------------- .../Sidebar/ReaderSidebarViewModel.swift | 16 ------- 2 files changed, 61 deletions(-) diff --git a/WordPress/Classes/ViewRelated/Reader/Controllers/ReaderHelpers.swift b/WordPress/Classes/ViewRelated/Reader/Controllers/ReaderHelpers.swift index af136a34954b..3cfa60f50848 100644 --- a/WordPress/Classes/ViewRelated/Reader/Controllers/ReaderHelpers.swift +++ b/WordPress/Classes/ViewRelated/Reader/Controllers/ReaderHelpers.swift @@ -232,38 +232,6 @@ struct ReaderNotificationKeys { Blog.lookup(withID: siteID, in: ContextManager.sharedInstance().mainContext)?.isAdmin ?? false } - // convenience method that returns the topic type - class func topicType(_ topic: ReaderAbstractTopic?) -> ReaderTopicType { - guard let topic = topic else { - return .noTopic - } - if topicIsDiscover(topic) { - return .discover - } - if topicIsFollowing(topic) { - return .following - } - if topicIsLiked(topic) { - return .likes - } - if isTopicList(topic) { - return .list - } - if isTopicSearchTopic(topic) { - return .search - } - if isTopicSite(topic) { - return .site - } - if isTopicTag(topic) { - return .tag - } - if topic is ReaderTeamTopic { - return .organization - } - return .noTopic - } - // MARK: Logged in helper @objc open class func isLoggedIn() -> Bool { @@ -499,19 +467,6 @@ struct ReaderNotificationKeys { } } -/// Typed topic type -enum ReaderTopicType { - case discover - case following - case likes - case list - case search - case site - case tag - case organization - case noTopic -} - @objc enum SiteOrganizationType: Int { // site does not belong to an organization case none diff --git a/WordPress/Classes/ViewRelated/Reader/Sidebar/ReaderSidebarViewModel.swift b/WordPress/Classes/ViewRelated/Reader/Sidebar/ReaderSidebarViewModel.swift index 26568ceef201..1e51a77e70c9 100644 --- a/WordPress/Classes/ViewRelated/Reader/Sidebar/ReaderSidebarViewModel.swift +++ b/WordPress/Classes/ViewRelated/Reader/Sidebar/ReaderSidebarViewModel.swift @@ -44,12 +44,6 @@ final class ReaderSidebarViewModel: ObservableObject { .first(where: ReaderHelpers.topicIsLiked) } - func getTopic(for topicType: ReaderTopicType) -> ReaderAbstractTopic? { - return try? ReaderAbstractTopic.lookupAllMenus(in: contextManager.mainContext).first { - ReaderHelpers.topicType($0) == topicType - } - } - func onAppear() { reloadMenuIfNeeded() } @@ -117,16 +111,6 @@ enum ReaderStaticScreen: String, CaseIterable, Identifiable, Hashable { } } - var topicType: ReaderTopicType? { - switch self { - case .recent: .following - case .discover: .discover - case .saved: nil - case .likes: .likes - case .search: nil - } - } - var accessibilityIdentifier: String { "reader_sidebar_\(rawValue)" }