@@ -104,11 +104,11 @@ extension ReaderRoute: NavigationAction {
104104 }
105105 case . feed:
106106 if let feedIDValue = values [ " feed_id " ] , let feedID = Int ( feedIDValue) {
107- presenter. showReaderStream ( with : feedID, isFeed: true )
107+ presenter. showReader ( path : . site ( siteID : feedID, isFeed: true ) )
108108 }
109109 case . blog:
110110 if let blogIDValue = values [ " blog_id " ] , let blogID = Int ( blogIDValue) {
111- presenter. showReaderStream ( with : blogID, isFeed: false )
111+ presenter. showReader ( path : . site ( siteID : blogID, isFeed: false ) )
112112 }
113113 case . feedsPost:
114114 if let ( feedID, postID) = feedAndPostID ( from: values) {
@@ -167,29 +167,4 @@ private extension RootViewPresenter {
167167 showReader ( path: . topic( topic) )
168168 }
169169 }
170-
171- /// - warning: This method performs the navigation asyncronously after
172- /// fetching the information about the stream from the backend.
173- func showReaderStream( with siteID: Int , isFeed: Bool ) {
174- getSiteTopic ( siteID: NSNumber ( value: siteID) , isFeed: isFeed) { [ weak self] topic in
175- guard let topic else { return }
176- self ? . showReader ( path: . topic( topic) )
177- }
178- }
179-
180- private func getSiteTopic( siteID: NSNumber , isFeed: Bool , completion: @escaping ( ReaderSiteTopic ? ) -> Void ) {
181- let service = ReaderTopicService ( coreDataStack: ContextManager . shared)
182- service. siteTopicForSite ( withID: siteID, isFeed: isFeed, success: { objectID, isFollowing in
183- guard let objectID,
184- let topic = try ? ContextManager . shared. mainContext. existingObject ( with: objectID) as? ReaderSiteTopic else {
185- DDLogError ( " Reader: Error retriving site topic - invalid Site Id " )
186- completion ( nil )
187- return
188- }
189- completion ( topic)
190- } , failure: { error in
191- DDLogError ( " Reader: Error retriving site topic - \( error? . localizedDescription ?? " unknown failure reason " ) " )
192- completion ( nil )
193- } )
194- }
195170}
0 commit comments