diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt index edca824e1538..517908625788 100644 --- a/RELEASE-NOTES.txt +++ b/RELEASE-NOTES.txt @@ -1,5 +1,6 @@ 21.5 ----- +* [***] [internal] A significant refactor to the app’s architecture was made to allow for the new simplified UI. Regression testing on the app’s main flows is needed. [#19817] 21.4 diff --git a/WordPress/Classes/System/3DTouch/WP3DTouchShortcutHandler.swift b/WordPress/Classes/System/3DTouch/WP3DTouchShortcutHandler.swift index 805aa52973d6..2127f862ee8c 100644 --- a/WordPress/Classes/System/3DTouch/WP3DTouchShortcutHandler.swift +++ b/WordPress/Classes/System/3DTouch/WP3DTouchShortcutHandler.swift @@ -25,7 +25,7 @@ open class WP3DTouchShortcutHandler: NSObject { @objc static let applicationShortcutUserInfoIconKey = "applicationShortcutUserInfoIconKey" @objc open func handleShortcutItem(_ shortcutItem: UIApplicationShortcutItem) -> Bool { - let tabBarController: WPTabBarController = WPTabBarController.sharedInstance() + let rootViewPresenter = RootViewCoordinator.sharedPresenter switch shortcutItem.type { case ShortcutIdentifier.LogIn.type: @@ -33,23 +33,23 @@ open class WP3DTouchShortcutHandler: NSObject { return true case ShortcutIdentifier.NewPost.type: WPAnalytics.track(.shortcutNewPost) - tabBarController.showPostTab(animated: false, toMedia: false) + rootViewPresenter.showPostTab(animated: false, toMedia: false) return true case ShortcutIdentifier.NewPhotoPost.type: WPAnalytics.track(.shortcutNewPhotoPost) - tabBarController.showPostTab(animated: false, toMedia: true) + rootViewPresenter.showPostTab(animated: false, toMedia: true) return true case ShortcutIdentifier.Stats.type: WPAnalytics.track(.shortcutStats) clearCurrentViewController() if let mainBlog = Blog.lastUsedOrFirst(in: ContextManager.sharedInstance().mainContext) { - tabBarController.mySitesCoordinator.showStats(for: mainBlog) + rootViewPresenter.mySitesCoordinator.showStats(for: mainBlog) } return true case ShortcutIdentifier.Notifications.type: WPAnalytics.track(.shortcutNotifications) clearCurrentViewController() - tabBarController.showNotificationsTab() + rootViewPresenter.showNotificationsTab() return true default: return false diff --git a/WordPress/Classes/System/MySitesCoordinator+RootViewPresenter.swift b/WordPress/Classes/System/MySitesCoordinator+RootViewPresenter.swift index 94cbe55070d6..3703d41d14de 100644 --- a/WordPress/Classes/System/MySitesCoordinator+RootViewPresenter.swift +++ b/WordPress/Classes/System/MySitesCoordinator+RootViewPresenter.swift @@ -4,4 +4,132 @@ import Foundation /// and the app's UI is simplified. extension MySitesCoordinator: RootViewPresenter { + // MARK: General + + var currentViewController: UIViewController? { + return rootViewController + } + + func getMeScenePresenter() -> ScenePresenter { + meScenePresenter + } + + func currentlySelectedScreen() -> String { + return "Blog List" + } + + func currentlyVisibleBlog() -> Blog? { + currentBlog + } + + // MARK: Reader + + var readerTabViewController: ReaderTabViewController? { + fallbackBehavior() + return nil + } + + var readerCoordinator: ReaderCoordinator? { + fallbackBehavior() + return nil + } + + var readerNavigationController: UINavigationController? { + fallbackBehavior() + return nil + } + + func showReaderTab() { + fallbackBehavior() + } + + func switchToDiscover() { + fallbackBehavior() + } + + func switchToSavedPosts() { + fallbackBehavior() + } + + func resetReaderDiscoverNudgeFlow() { + fallbackBehavior() + } + + func resetReaderTab() { + fallbackBehavior() + } + + func navigateToReaderSearch() { + fallbackBehavior() + } + + func switchToTopic(where predicate: (ReaderAbstractTopic) -> Bool) { + fallbackBehavior() + } + + func switchToMyLikes() { + fallbackBehavior() + } + + func switchToFollowedSites() { + fallbackBehavior() + } + + func navigateToReaderSite(_ topic: ReaderSiteTopic) { + fallbackBehavior() + } + + func navigateToReaderTag(_ topic: ReaderTagTopic) { + fallbackBehavior() + } + + func navigateToReader(_ pushControlller: UIViewController?) { + fallbackBehavior() + } + + func showReaderTab(forPost: NSNumber, onBlog: NSNumber) { + fallbackBehavior() + } + + // MARK: My Site + + var mySitesCoordinator: MySitesCoordinator { + return self + } + + func showMySitesTab() { + // Do nothing + // Landing here means we're trying to show the My Sites, but it's already showing. + } + + // MARK: Notifications + + var notificationsViewController: NotificationsViewController? { + fallbackBehavior() + return nil + } + + func showNotificationsTab() { + fallbackBehavior() + } + + func switchNotificationsTabToNotificationSettings() { + fallbackBehavior() + } + + func showNotificationsTabForNote(withID notificationID: String) { + fallbackBehavior() + } + + func popNotificationsTabToRoot() { + fallbackBehavior() + } + + // MARK: Helpers + + /// Default implementation for functions that are not supported by the simplified UI. + private func fallbackBehavior(callingFunction: String = #function) { + let properties = ["calling_function": callingFunction] + WPAnalytics.track(.jetpackFeatureIncorrectlyAccessed, properties: properties) + } } diff --git a/WordPress/Classes/System/RootViewControllerCoordinator.swift b/WordPress/Classes/System/RootViewControllerCoordinator.swift deleted file mode 100644 index 04fa755969b0..000000000000 --- a/WordPress/Classes/System/RootViewControllerCoordinator.swift +++ /dev/null @@ -1,27 +0,0 @@ -import Foundation - -class RootViewControllerCoordinator { - - // MARK: Static shared variables - - static let shared = RootViewControllerCoordinator() - static var sharedPresenter: RootViewPresenter { - shared.rootViewPresenter - } - - // MARK: Private instance variables - - private var rootViewPresenter: RootViewPresenter - - // MARK: Initializer - - init() { - if JetpackFeaturesRemovalCoordinator.shouldRemoveJetpackFeatures() { - let meScenePresenter = MeScenePresenter() - self.rootViewPresenter = MySitesCoordinator(meScenePresenter: meScenePresenter, onBecomeActiveTab: {}) - } - else { - self.rootViewPresenter = WPTabBarController.sharedInstance() // TODO: Remove shared instance and create an instance here - } - } -} diff --git a/WordPress/Classes/System/RootViewCoordinator.swift b/WordPress/Classes/System/RootViewCoordinator.swift new file mode 100644 index 000000000000..93edc73bd465 --- /dev/null +++ b/WordPress/Classes/System/RootViewCoordinator.swift @@ -0,0 +1,38 @@ +import Foundation + +class RootViewCoordinator { + + // MARK: Static shared variables + + static let shared = RootViewCoordinator() + static var sharedPresenter: RootViewPresenter { + shared.rootViewPresenter + } + + // MARK: Public Variables + + lazy var whatIsNewScenePresenter: ScenePresenter = { + return makeWhatIsNewPresenter() + }() + + lazy var bloggingPromptCoordinator: BloggingPromptCoordinator = { + return makeBloggingPromptCoordinator() + }() + + // MARK: Private instance variables + + private(set) var rootViewPresenter: RootViewPresenter + + // MARK: Initializer + + init() { + if JetpackFeaturesRemovalCoordinator.jetpackFeaturesEnabled() { + self.rootViewPresenter = WPTabBarController() + } + else { + let meScenePresenter = MeScenePresenter() + self.rootViewPresenter = MySitesCoordinator(meScenePresenter: meScenePresenter, onBecomeActiveTab: {}) + } + updatePromptsIfNeeded() + } +} diff --git a/WordPress/Classes/ViewRelated/System/WPTabBarController+ShowTab.swift b/WordPress/Classes/System/RootViewPresenter+EditorNavigation.swift similarity index 54% rename from WordPress/Classes/ViewRelated/System/WPTabBarController+ShowTab.swift rename to WordPress/Classes/System/RootViewPresenter+EditorNavigation.swift index 1d7b2558bd31..3e0e52a0a5f7 100644 --- a/WordPress/Classes/ViewRelated/System/WPTabBarController+ShowTab.swift +++ b/WordPress/Classes/System/RootViewPresenter+EditorNavigation.swift @@ -1,14 +1,65 @@ -extension WPTabBarController { +import Foundation - func showBlogDetails(for blog: Blog) { - mySitesCoordinator.showBlogDetails(for: blog) +extension RootViewPresenter { + func currentOrLastBlog() -> Blog? { + if let blog = currentlyVisibleBlog() { + return blog + } + let context = ContextManager.shared.mainContext + return Blog.lastUsedOrFirst(in: context) + } + + func showPostTab() { + showPostTab(completion: nil) + } + + func showPostTab(completion afterDismiss: (() -> Void)?) { + let context = ContextManager.shared.mainContext + // Ignore taps on the post tab and instead show the modal. + if Blog.count(in: context) == 0 { + mySitesCoordinator.showAddNewSite() + } else { + showPostTab(animated: true, toMedia: false, completion: afterDismiss) + } + } + + func showPostTab(for blog: Blog) { + let context = ContextManager.shared.mainContext + if Blog.count(in: context) == 0 { + mySitesCoordinator.showAddNewSite() + } else { + showPostTab(animated: true, toMedia: false, blog: blog) + } + } + + func showPostTab(animated: Bool, + toMedia openToMedia: Bool, + blog: Blog? = nil, + completion afterDismiss: (() -> Void)? = nil) { + if rootViewController.presentedViewController != nil { + rootViewController.dismiss(animated: false) + } + + guard let blog = blog ?? currentOrLastBlog() else { + return + } + + let editor = EditPostViewController(blog: blog) + editor.modalPresentationStyle = .fullScreen + editor.showImmediately = !animated + editor.openWithMediaPicker = openToMedia + editor.afterDismiss = afterDismiss + + let properties = [WPAppAnalyticsKeyTapSource: "create_button", WPAppAnalyticsKeyPostType: "post"] + WPAppAnalytics.track(.editorCreatedPost, withProperties: properties, with: blog) + rootViewController.present(editor, animated: false) } - @objc func showPageEditor(forBlog: Blog? = nil) { + func showPageEditor(forBlog: Blog? = nil) { showPageEditor(blog: forBlog) } - @objc func showStoryEditor(forBlog: Blog? = nil) { + func showStoryEditor(forBlog: Blog? = nil) { showStoryEditor(blog: forBlog) } @@ -17,8 +68,8 @@ extension WPTabBarController { func showPageEditor(blog inBlog: Blog? = nil, title: String? = nil, content: String? = nil, source: String = "create_button") { // If we are already showing a view controller, dismiss and show the editor afterward - guard presentedViewController == nil else { - dismiss(animated: true) { [weak self] in + guard rootViewController.presentedViewController == nil else { + rootViewController.dismiss(animated: true) { [weak self] in self?.showPageEditor(blog: inBlog, title: title, content: content, source: source) } return @@ -32,22 +83,22 @@ extension WPTabBarController { let blogID = blog.dotComID?.intValue ?? 0 as Any WPAnalytics.track(WPAnalyticsEvent.editorCreatedPage, properties: [WPAppAnalyticsKeyTapSource: source, WPAppAnalyticsKeyBlogID: blogID, WPAppAnalyticsKeyPostType: "page"]) - PageCoordinator.showLayoutPickerIfNeeded(from: self, forBlog: blog) { [weak self] (selectedLayout) in + PageCoordinator.showLayoutPickerIfNeeded(from: rootViewController, forBlog: blog) { [weak self] (selectedLayout) in self?.showEditor(blog: blog, title: selectedLayout?.title, content: selectedLayout?.content, templateKey: selectedLayout?.slug) } } private func showEditor(blog: Blog, title: String?, content: String?, templateKey: String?) { let editorViewController = EditPageViewController(blog: blog, postTitle: title, content: content, appliedTemplate: templateKey) - present(editorViewController, animated: false) + rootViewController.present(editorViewController, animated: false) } /// Show the story editor /// - Parameter blog: Blog to a add a story to. Uses the current or last blog if not provided func showStoryEditor(blog inBlog: Blog? = nil, title: String? = nil, content: String? = nil, source: String = "create_button") { // If we are already showing a view controller, dismiss and show the editor afterward - guard presentedViewController == nil else { - dismiss(animated: true) { [weak self] in + guard rootViewController.presentedViewController == nil else { + rootViewController.dismiss(animated: true) { [weak self] in self?.showStoryEditor(blog: inBlog, title: title, content: content, source: source) } return @@ -61,10 +112,10 @@ extension WPTabBarController { }, openURL: { [weak self] url in let webViewController = WebViewControllerFactory.controller(url: url, source: "show_story_example") let navController = UINavigationController(rootViewController: webViewController) - self?.presentedViewController?.present(navController, animated: true) + self?.rootViewController.presentedViewController?.present(navController, animated: true) }) - present(intro, animated: true, completion: { + rootViewController.present(intro, animated: true, completion: { StoriesIntroViewController.trackShown() }) } else { @@ -75,7 +126,7 @@ extension WPTabBarController { do { let controller = try StoryEditor.editor(blog: blog, context: ContextManager.shared.mainContext, updated: {_ in }) - present(controller, animated: true, completion: nil) + rootViewController.present(controller, animated: true, completion: nil) } catch { assertionFailure("Story editor should not fail since this button is hidden on iPads.") } diff --git a/WordPress/Classes/ViewRelated/System/WPTabBarController+MeNavigation.swift b/WordPress/Classes/System/RootViewPresenter+MeNavigation.swift similarity index 78% rename from WordPress/Classes/ViewRelated/System/WPTabBarController+MeNavigation.swift rename to WordPress/Classes/System/RootViewPresenter+MeNavigation.swift index 59560d5e8b75..50c9f1415af1 100644 --- a/WordPress/Classes/ViewRelated/System/WPTabBarController+MeNavigation.swift +++ b/WordPress/Classes/System/RootViewPresenter+MeNavigation.swift @@ -1,32 +1,32 @@ - import UIKit /// Methods to access the Me Scene and sub levels -extension WPTabBarController { +extension RootViewPresenter { /// removes all but the primary viewControllers from the stack - @objc func popMeTabToRoot() { + func popMeTabToRoot() { getNavigationController()?.popToRootViewController(animated: false) } /// presents the Me scene. If the feature flag is disabled, replaces the previously defined `showMeTab` - @objc func showMeScene(animated: Bool = true, completion: (() -> Void)? = nil) { - meScenePresenter.present(on: self, animated: animated, completion: completion) + func showMeScene(animated: Bool = true, completion: (() -> Void)? = nil) { + let meScenePresenter = getMeScenePresenter() + meScenePresenter.present(on: rootViewController, animated: animated, completion: completion) } /// access to sub levels - @objc func navigateToAccountSettings() { + func navigateToAccountSettings() { showMeScene(animated: false) { self.popMeTabToRoot() self.getMeViewController()?.navigateToAccountSettings() } } - @objc func navigateToAppSettings() { + func navigateToAppSettings() { showMeScene() { self.popMeTabToRoot() self.getMeViewController()?.navigateToAppSettings() } } - @objc func navigateToSupport() { + func navigateToSupport() { showMeScene() { self.popMeTabToRoot() self.getMeViewController()?.navigateToHelpAndSupport() @@ -35,6 +35,7 @@ extension WPTabBarController { /// obtains a reference to the navigation controller of the presented MeViewController private func getNavigationController() -> UINavigationController? { + let meScenePresenter = getMeScenePresenter() guard let splitController = meScenePresenter.presentedViewController as? WPSplitViewController, let navigationController = splitController.viewControllers.first as? UINavigationController else { return nil diff --git a/WordPress/Classes/System/RootViewPresenter.swift b/WordPress/Classes/System/RootViewPresenter.swift index 81d5403075b7..1214ebbfd513 100644 --- a/WordPress/Classes/System/RootViewPresenter.swift +++ b/WordPress/Classes/System/RootViewPresenter.swift @@ -1,6 +1,49 @@ import Foundation -protocol RootViewPresenter { +protocol RootViewPresenter: AnyObject { + + // MARK: General + var rootViewController: UIViewController { get } + var currentViewController: UIViewController? { get } func showBlogDetails(for blog: Blog) + func getMeScenePresenter() -> ScenePresenter + func currentlySelectedScreen() -> String + func currentlyVisibleBlog() -> Blog? + + // MARK: Reader + + var readerTabViewController: ReaderTabViewController? { get } + var readerCoordinator: ReaderCoordinator? { get } + var readerNavigationController: UINavigationController? { get } + func showReaderTab() + func showReaderTab(forPost: NSNumber, onBlog: NSNumber) + func switchToDiscover() + func switchToSavedPosts() + func resetReaderDiscoverNudgeFlow() + func resetReaderTab() + func navigateToReaderSearch() + func switchToTopic(where predicate: (ReaderAbstractTopic) -> Bool) + func switchToMyLikes() + func switchToFollowedSites() + func navigateToReaderSite(_ topic: ReaderSiteTopic) + func navigateToReaderTag( _ topic: ReaderTagTopic) + func navigateToReader(_ pushControlller: UIViewController?) + + // MARK: My Site + + var mySitesCoordinator: MySitesCoordinator { get } + func showMySitesTab() + func showPages(for blog: Blog) + func showPosts(for blog: Blog) + func showMedia(for blog: Blog) + + // MARK: Notifications + + var notificationsViewController: NotificationsViewController? { get } + func showNotificationsTab() + func showNotificationsTabForNote(withID notificationID: String) + func switchNotificationsTabToNotificationSettings() + func popNotificationsTabToRoot() + } diff --git a/WordPress/Classes/System/WPTabBarController+RootViewPresenter.swift b/WordPress/Classes/System/WPTabBarController+RootViewPresenter.swift index 40b6cb2baaab..ef1371a88c47 100644 --- a/WordPress/Classes/System/WPTabBarController+RootViewPresenter.swift +++ b/WordPress/Classes/System/WPTabBarController+RootViewPresenter.swift @@ -3,7 +3,43 @@ import Foundation /// `WPTabBarController` is used as the root presenter when Jetpack features are enabled /// and the app's UI is normal. extension WPTabBarController: RootViewPresenter { + + // MARK: General + var rootViewController: UIViewController { return self } + + var currentViewController: UIViewController? { + return viewControllers?[selectedIndex] + } + + func showBlogDetails(for blog: Blog) { + mySitesCoordinator.showBlogDetails(for: blog) + } + + func getMeScenePresenter() -> ScenePresenter { + meScenePresenter + } + + func currentlyVisibleBlog() -> Blog? { + guard selectedIndex == WPTab.mySites.rawValue else { + return nil + } + return mySitesCoordinator.currentBlog + } + + // MARK: My Site + + func showPages(for blog: Blog) { + mySitesCoordinator.showPages(for: blog) + } + + func showPosts(for blog: Blog) { + mySitesCoordinator.showPosts(for: blog) + } + + func showMedia(for blog: Blog) { + mySitesCoordinator.showMedia(for: blog) + } } diff --git a/WordPress/Classes/System/WindowManager.swift b/WordPress/Classes/System/WindowManager.swift index 27c4809b5a8c..5521caa432b1 100644 --- a/WordPress/Classes/System/WindowManager.swift +++ b/WordPress/Classes/System/WindowManager.swift @@ -57,13 +57,13 @@ class WindowManager: NSObject { /// @objc func showAppUI(for blog: Blog? = nil, completion: Completion? = nil) { isShowingFullscreenSignIn = false - show(RootViewControllerCoordinator.sharedPresenter.rootViewController, completion: completion) + show(RootViewCoordinator.sharedPresenter.rootViewController, completion: completion) guard let blog = blog else { return } - RootViewControllerCoordinator.sharedPresenter.showBlogDetails(for: blog) + RootViewCoordinator.sharedPresenter.showBlogDetails(for: blog) } /// Shows the initial UI for unauthenticated users. diff --git a/WordPress/Classes/System/WordPressAppDelegate+openURL.swift b/WordPress/Classes/System/WordPressAppDelegate+openURL.swift index 431e4d0c5c9c..181d0b928171 100644 --- a/WordPress/Classes/System/WordPressAppDelegate+openURL.swift +++ b/WordPress/Classes/System/WordPressAppDelegate+openURL.swift @@ -88,7 +88,7 @@ import AutomatticTracks return false } - WPTabBarController.sharedInstance()?.showReaderTab(forPost: NSNumber(value: postId), onBlog: NSNumber(value: blogId)) + RootViewCoordinator.sharedPresenter.showReaderTab(forPost: NSNumber(value: postId), onBlog: NSNumber(value: blogId)) return true } @@ -112,14 +112,14 @@ import AutomatticTracks // so the Stats view displays the correct stats. SiteStatsInformation.sharedInstance.siteID = currentSiteID - WPTabBarController.sharedInstance()?.dismiss(animated: true, completion: nil) + RootViewCoordinator.sharedPresenter.rootViewController.dismiss(animated: true, completion: nil) } let navController = UINavigationController(rootViewController: statsViewController) navController.modalPresentationStyle = .currentContext navController.navigationBar.isTranslucent = false - WPTabBarController.sharedInstance()?.present(navController, animated: true, completion: nil) + RootViewCoordinator.sharedPresenter.rootViewController.present(navController, animated: true, completion: nil) return true } @@ -171,7 +171,7 @@ import AutomatticTracks let postVC = EditPostViewController(post: post) postVC.modalPresentationStyle = .fullScreen - WPTabBarController.sharedInstance()?.present(postVC, animated: true, completion: nil) + RootViewCoordinator.sharedPresenter.rootViewController.present(postVC, animated: true, completion: nil) WPAppAnalytics.track(.editorCreatedPost, withProperties: [WPAppAnalyticsKeyTapSource: "url_scheme", WPAppAnalyticsKeyPostType: "post"]) @@ -200,7 +200,7 @@ import AutomatticTracks // Should more formats be accepted be accepted in the future, this line would have to be expanded to accomodate it. let contentEscaped = contentRaw.escapeHtmlNamedEntities() - WPTabBarController.sharedInstance()?.showPageEditor(blog: blog, title: title, content: contentEscaped, source: "url_scheme") + RootViewCoordinator.sharedPresenter.showPageEditor(blog: blog, title: title, content: contentEscaped, source: "url_scheme") return true } diff --git a/WordPress/Classes/System/WordPressAppDelegate.swift b/WordPress/Classes/System/WordPressAppDelegate.swift index afd17c225ff3..5a3dfd398e54 100644 --- a/WordPress/Classes/System/WordPressAppDelegate.swift +++ b/WordPress/Classes/System/WordPressAppDelegate.swift @@ -660,7 +660,7 @@ extension WordPressAppDelegate { return "Jetpack Migration View" #endif default: - return WPTabBarController.sharedInstance().currentlySelectedScreen() + return RootViewCoordinator.sharedPresenter.currentlySelectedScreen() } } diff --git a/WordPress/Classes/Utility/Analytics/WPAnalyticsEvent.swift b/WordPress/Classes/Utility/Analytics/WPAnalyticsEvent.swift index 83765b99e02a..a4736e135ad1 100644 --- a/WordPress/Classes/Utility/Analytics/WPAnalyticsEvent.swift +++ b/WordPress/Classes/Utility/Analytics/WPAnalyticsEvent.swift @@ -420,6 +420,7 @@ import Foundation case jetpackBrandingMenuCardHidden case jetpackBrandingMenuCardRemindLater case jetpackBrandingMenuCardContextualMenuAccessed + case jetpackFeatureIncorrectlyAccessed /// A String that represents the event var value: String { @@ -1141,6 +1142,8 @@ import Foundation return "remove_feature_card_remind_later_tapped" case .jetpackBrandingMenuCardContextualMenuAccessed: return "remove_feature_card_menu_accessed" + case .jetpackFeatureIncorrectlyAccessed: + return "jetpack_feature_incorrectly_accessed" } // END OF SWITCH } diff --git a/WordPress/Classes/Utility/InteractiveNotificationsManager.swift b/WordPress/Classes/Utility/InteractiveNotificationsManager.swift index 8a4a4e5683f1..e350320ee656 100644 --- a/WordPress/Classes/Utility/InteractiveNotificationsManager.swift +++ b/WordPress/Classes/Utility/InteractiveNotificationsManager.swift @@ -210,7 +210,7 @@ final class InteractiveNotificationsManager: NSObject { if identifier == UNNotificationDefaultActionIdentifier { let targetBlog: Blog? = blog(from: threadId) - WPTabBarController.sharedInstance()?.mySitesCoordinator.showCreateSheet(for: targetBlog) + RootViewCoordinator.sharedPresenter.mySitesCoordinator.showCreateSheet(for: targetBlog) } case .weeklyRoundup: let targetBlog = blog(from: userInfo) @@ -226,7 +226,7 @@ final class InteractiveNotificationsManager: NSObject { let targetDate = date(from: userInfo) - WPTabBarController.sharedInstance()?.mySitesCoordinator.showStats( + RootViewCoordinator.sharedPresenter.mySitesCoordinator.showStats( for: targetBlog, timePeriod: .weeks, date: targetDate) @@ -236,7 +236,7 @@ final class InteractiveNotificationsManager: NSObject { WPAnalytics.track(.bloggingRemindersNotificationReceived, properties: ["prompt_included": true]) let answerPromptBlock = { - WPTabBarController.sharedInstance()?.showPromptAnsweringFlow(with: userInfo) + RootViewCoordinator.shared.showPromptAnsweringFlow(with: userInfo) } // check if user interacted with custom notification actions. @@ -346,7 +346,7 @@ private extension InteractiveNotificationsManager { /// - Parameter noteID: The Notification's Identifier /// func showDetailsWithNoteID(_ noteId: NSNumber) { - WPTabBarController.sharedInstance().showNotificationsTabForNote(withID: noteId.stringValue) + RootViewCoordinator.sharedPresenter.showNotificationsTabForNote(withID: noteId.stringValue) } diff --git a/WordPress/Classes/Utility/PushNotificationsManager.swift b/WordPress/Classes/Utility/PushNotificationsManager.swift index 73416fd7541c..7d4d1aacf16e 100644 --- a/WordPress/Classes/Utility/PushNotificationsManager.swift +++ b/WordPress/Classes/Utility/PushNotificationsManager.swift @@ -248,7 +248,7 @@ extension PushNotificationsManager { WPAnalytics.track(.supportReceivedResponseFromSupport) if applicationState == .background { - WPTabBarController.sharedInstance().showMeScene() + RootViewCoordinator.sharedPresenter.showMeScene() } completionHandler?(.newData) @@ -335,7 +335,7 @@ extension PushNotificationsManager { return false } - WPTabBarController.sharedInstance().showNotificationsTabForNote(withID: notificationId) + RootViewCoordinator.sharedPresenter.showNotificationsTabForNote(withID: notificationId) completionHandler?(.newData) return true @@ -427,10 +427,12 @@ extension PushNotificationsManager { return false } - if WPTabBarController.sharedInstance()?.presentedViewController != nil { - WPTabBarController.sharedInstance()?.dismiss(animated: false) + let rootViewController = RootViewCoordinator.sharedPresenter.rootViewController + + if rootViewController.presentedViewController != nil { + rootViewController.dismiss(animated: false) } - WPTabBarController.sharedInstance()?.showMySitesTab() + RootViewCoordinator.sharedPresenter.showMySitesTab() if let taskName = userInfo.string(forKey: QuickStartTracking.taskNameKey), let quickStartType = userInfo.string(forKey: QuickStartTracking.quickStartTypeKey) { diff --git a/WordPress/Classes/Utility/Spotlight/SearchManager.swift b/WordPress/Classes/Utility/Spotlight/SearchManager.swift index 92949d66cb50..f63122c0df4d 100644 --- a/WordPress/Classes/Utility/Spotlight/SearchManager.swift +++ b/WordPress/Classes/Utility/Spotlight/SearchManager.swift @@ -311,47 +311,47 @@ fileprivate extension SearchManager { // MARK: Site Tab Navigation func openMySitesTab() -> Bool { - WPTabBarController.sharedInstance().showMySitesTab() + RootViewCoordinator.sharedPresenter.showMySitesTab() return true } func openSiteDetailsScreen(for blog: Blog) { - WPTabBarController.sharedInstance()?.mySitesCoordinator.showBlogDetails(for: blog) + RootViewCoordinator.sharedPresenter.showBlogDetails(for: blog) } // MARK: Reader Tab Navigation func openReaderTab() -> Bool { - WPTabBarController.sharedInstance().showReaderTab() + RootViewCoordinator.sharedPresenter.showReaderTab() return true } // MARK: Me Tab Navigation func openMeTab() -> Bool { - WPTabBarController.sharedInstance().showMeScene() + RootViewCoordinator.sharedPresenter.showMeScene() return true } func openAppSettingsScreen() -> Bool { - WPTabBarController.sharedInstance().navigateToAppSettings() + RootViewCoordinator.sharedPresenter.navigateToAppSettings() return true } func openSupportScreen() -> Bool { - WPTabBarController.sharedInstance().navigateToSupport() + RootViewCoordinator.sharedPresenter.navigateToSupport() return true } // MARK: Notification Tab Navigation func openNotificationsTab() -> Bool { - WPTabBarController.sharedInstance().showNotificationsTab() + RootViewCoordinator.sharedPresenter.showNotificationsTab() return true } func openNotificationSettingsScreen() -> Bool { - WPTabBarController.sharedInstance().switchNotificationsTabToNotificationSettings() + RootViewCoordinator.sharedPresenter.switchNotificationsTabToNotificationSettings() return true } @@ -398,9 +398,9 @@ fileprivate extension SearchManager { func openListView(for apost: AbstractPost) { closePreviewIfNeeded(for: apost) if let post = apost as? Post { - WPTabBarController.sharedInstance().mySitesCoordinator.showPosts(for: post.blog) + RootViewCoordinator.sharedPresenter.showPosts(for: post.blog) } else if let page = apost as? Page { - WPTabBarController.sharedInstance().mySitesCoordinator.showPages(for: page.blog) + RootViewCoordinator.sharedPresenter.showPages(for: page.blog) } } @@ -412,7 +412,7 @@ fileprivate extension SearchManager { onFailure() return } - WPTabBarController.sharedInstance().showReaderTab(forPost: postID, onBlog: blogID) + RootViewCoordinator.sharedPresenter.showReaderTab(forPost: postID, onBlog: blogID) } func openReader(for postID: NSNumber, siteID: NSNumber, onFailure: () -> Void) { @@ -421,7 +421,7 @@ fileprivate extension SearchManager { onFailure() return } - WPTabBarController.sharedInstance().showReaderTab(forPost: postID, onBlog: siteID) + RootViewCoordinator.sharedPresenter.showReaderTab(forPost: postID, onBlog: siteID) } // MARK: - Editor @@ -431,7 +431,7 @@ fileprivate extension SearchManager { openListView(for: post) let editor = EditPostViewController.init(post: post) editor.modalPresentationStyle = .fullScreen - WPTabBarController.sharedInstance().present(editor, animated: true) + RootViewCoordinator.sharedPresenter.rootViewController.present(editor, animated: true) } func openEditor(for page: Page) { @@ -439,22 +439,23 @@ fileprivate extension SearchManager { openListView(for: page) let editorViewController = EditPageViewController(page: page) - WPTabBarController.sharedInstance().present(editorViewController, animated: false) + RootViewCoordinator.sharedPresenter.rootViewController.present(editorViewController, animated: false) } // MARK: - Preview func openPreview(for apost: AbstractPost) { - WPTabBarController.sharedInstance().showMySitesTab() + RootViewCoordinator.sharedPresenter.showMySitesTab() closePreviewIfNeeded(for: apost) let controller = PreviewWebKitViewController(post: apost, source: "spotlight_preview_post") controller.trackOpenEvent() let navWrapper = LightNavigationController(rootViewController: controller) - if WPTabBarController.sharedInstance()?.traitCollection.userInterfaceIdiom == .pad { + let rootViewController = RootViewCoordinator.sharedPresenter.rootViewController + if rootViewController.traitCollection.userInterfaceIdiom == .pad { navWrapper.modalPresentationStyle = .fullScreen } - WPTabBarController.sharedInstance().present(navWrapper, animated: true) + rootViewController.present(navWrapper, animated: true) openListView(for: apost) } @@ -463,7 +464,8 @@ fileprivate extension SearchManager { /// AbstractPost, leave it open, otherwise close it. /// func closePreviewIfNeeded(for apost: AbstractPost) { - guard let navController = WPTabBarController.sharedInstance().presentedViewController as? UINavigationController else { + let rootViewController = RootViewCoordinator.sharedPresenter.rootViewController + guard let navController = rootViewController.presentedViewController as? UINavigationController else { return } @@ -479,7 +481,8 @@ fileprivate extension SearchManager { /// If there is any post preview window open, close it. /// func closeAnyOpenPreview() { - guard let navController = WPTabBarController.sharedInstance().presentedViewController as? UINavigationController, + let rootViewController = RootViewCoordinator.sharedPresenter.rootViewController + guard let navController = rootViewController.presentedViewController as? UINavigationController, navController.topViewController is PreviewWebKitViewController else { return } diff --git a/WordPress/Classes/Utility/Universal Links/Route+Page.swift b/WordPress/Classes/Utility/Universal Links/Route+Page.swift index 924e791c44ab..df34b828c1c6 100644 --- a/WordPress/Classes/Utility/Universal Links/Route+Page.swift +++ b/WordPress/Classes/Utility/Universal Links/Route+Page.swift @@ -15,9 +15,9 @@ struct NewPageForSiteRoute: Route { struct NewPageNavigationAction: NavigationAction { func perform(_ values: [String: String], source: UIViewController? = nil, router: LinkRouter) { if let blog = blog(from: values) { - WPTabBarController.sharedInstance()?.showPageEditor(forBlog: blog) + RootViewCoordinator.sharedPresenter.showPageEditor(forBlog: blog) } else { - WPTabBarController.sharedInstance()?.showPageEditor() + RootViewCoordinator.sharedPresenter.showPageEditor() } } } diff --git a/WordPress/Classes/Utility/Universal Links/Routes+Me.swift b/WordPress/Classes/Utility/Universal Links/Routes+Me.swift index 90ba37fcec8e..e6d0fa219ff4 100644 --- a/WordPress/Classes/Utility/Universal Links/Routes+Me.swift +++ b/WordPress/Classes/Utility/Universal Links/Routes+Me.swift @@ -26,11 +26,11 @@ enum MeNavigationAction: NavigationAction { func perform(_ values: [String: String] = [:], source: UIViewController? = nil, router: LinkRouter) { switch self { case .root: - WPTabBarController.sharedInstance().showMeScene() + RootViewCoordinator.sharedPresenter.showMeScene() case .accountSettings: - WPTabBarController.sharedInstance().navigateToAccountSettings() + RootViewCoordinator.sharedPresenter.navigateToAccountSettings() case .notificationSettings: - WPTabBarController.sharedInstance().switchNotificationsTabToNotificationSettings() + RootViewCoordinator.sharedPresenter.switchNotificationsTabToNotificationSettings() } } } diff --git a/WordPress/Classes/Utility/Universal Links/Routes+MySites.swift b/WordPress/Classes/Utility/Universal Links/Routes+MySites.swift index 8d7b7af6dcac..cb5b035eee9f 100644 --- a/WordPress/Classes/Utility/Universal Links/Routes+MySites.swift +++ b/WordPress/Classes/Utility/Universal Links/Routes+MySites.swift @@ -44,9 +44,7 @@ extension MySitesRoute: Route { extension MySitesRoute: NavigationAction { func perform(_ values: [String: String], source: UIViewController? = nil, router: LinkRouter) { - guard let coordinator = WPTabBarController.sharedInstance().mySitesCoordinator else { - return - } + let coordinator = RootViewCoordinator.sharedPresenter.mySitesCoordinator guard let blog = blog(from: values) else { WPAppAnalytics.track(.deepLinkFailed, withProperties: ["route": path]) diff --git a/WordPress/Classes/Utility/Universal Links/Routes+Notifications.swift b/WordPress/Classes/Utility/Universal Links/Routes+Notifications.swift index 754c0ca98182..dff33ca35e5c 100644 --- a/WordPress/Classes/Utility/Universal Links/Routes+Notifications.swift +++ b/WordPress/Classes/Utility/Universal Links/Routes+Notifications.swift @@ -8,7 +8,7 @@ struct NotificationsRoute: Route { struct NotificationsNavigationAction: NavigationAction { func perform(_ values: [String: String], source: UIViewController? = nil, router: LinkRouter) { - WPTabBarController.sharedInstance().showNotificationsTab() - WPTabBarController.sharedInstance().popNotificationsTabToRoot() + RootViewCoordinator.sharedPresenter.showNotificationsTab() + RootViewCoordinator.sharedPresenter.popNotificationsTabToRoot() } } diff --git a/WordPress/Classes/Utility/Universal Links/Routes+Post.swift b/WordPress/Classes/Utility/Universal Links/Routes+Post.swift index 7084b136ecc2..ef3b1124ba79 100644 --- a/WordPress/Classes/Utility/Universal Links/Routes+Post.swift +++ b/WordPress/Classes/Utility/Universal Links/Routes+Post.swift @@ -15,9 +15,9 @@ struct NewPostForSiteRoute: Route { struct NewPostNavigationAction: NavigationAction { func perform(_ values: [String: String], source: UIViewController? = nil, router: LinkRouter) { if let blog = blog(from: values) { - WPTabBarController.sharedInstance().showPostTab(for: blog) + RootViewCoordinator.sharedPresenter.showPostTab(for: blog) } else { - WPTabBarController.sharedInstance().showPostTab() + RootViewCoordinator.sharedPresenter.showPostTab() } } } diff --git a/WordPress/Classes/Utility/Universal Links/Routes+Reader.swift b/WordPress/Classes/Utility/Universal Links/Routes+Reader.swift index 2937e21b97cb..fe3dda9b6eab 100644 --- a/WordPress/Classes/Utility/Universal Links/Routes+Reader.swift +++ b/WordPress/Classes/Utility/Universal Links/Routes+Reader.swift @@ -62,7 +62,7 @@ extension ReaderRoute: Route { extension ReaderRoute: NavigationAction { func perform(_ values: [String: String], source: UIViewController? = nil, router: LinkRouter) { - guard let coordinator = WPTabBarController.sharedInstance().readerCoordinator else { + guard let coordinator = RootViewCoordinator.sharedPresenter.readerCoordinator else { return } diff --git a/WordPress/Classes/Utility/Universal Links/Routes+Start.swift b/WordPress/Classes/Utility/Universal Links/Routes+Start.swift index 92a99df4ce07..38f6d76938f7 100644 --- a/WordPress/Classes/Utility/Universal Links/Routes+Start.swift +++ b/WordPress/Classes/Utility/Universal Links/Routes+Start.swift @@ -10,11 +10,10 @@ struct StartRoute: Route, NavigationAction { } func perform(_ values: [String: String], source: UIViewController?, router: LinkRouter) { - guard AccountHelper.isDotcomAvailable(), - let coordinator = WPTabBarController.sharedInstance().mySitesCoordinator else { + guard AccountHelper.isDotcomAvailable() else { return } - coordinator.showSiteCreation() + RootViewCoordinator.sharedPresenter.mySitesCoordinator.showSiteCreation() } } diff --git a/WordPress/Classes/Utility/Universal Links/Routes+Stats.swift b/WordPress/Classes/Utility/Universal Links/Routes+Stats.swift index 237b9b8703c7..723182bb4259 100644 --- a/WordPress/Classes/Utility/Universal Links/Routes+Stats.swift +++ b/WordPress/Classes/Utility/Universal Links/Routes+Stats.swift @@ -67,9 +67,7 @@ extension StatsRoute: Route { extension StatsRoute: NavigationAction { func perform(_ values: [String: String], source: UIViewController? = nil, router: LinkRouter) { - guard let coordinator = WPTabBarController.sharedInstance().mySitesCoordinator else { - return - } + let coordinator = RootViewCoordinator.sharedPresenter.mySitesCoordinator switch self { case .root: diff --git a/WordPress/Classes/ViewRelated/Blog/Blog Dashboard/Cards/Posts/DashboardEmptyPostsCardCell.swift b/WordPress/Classes/ViewRelated/Blog/Blog Dashboard/Cards/Posts/DashboardEmptyPostsCardCell.swift index c8d036bacbeb..87a55a0b43de 100644 --- a/WordPress/Classes/ViewRelated/Blog/Blog Dashboard/Cards/Posts/DashboardEmptyPostsCardCell.swift +++ b/WordPress/Classes/ViewRelated/Blog/Blog Dashboard/Cards/Posts/DashboardEmptyPostsCardCell.swift @@ -150,8 +150,8 @@ extension DashboardEmptyPostsCardCell { private extension DashboardEmptyPostsCardCell { func presentEditor() { BlogDashboardAnalytics.shared.track(.dashboardCardItemTapped, properties: ["type": "post", "sub_type": cardType?.rawValue ?? ""]) - let controller = viewController?.tabBarController as? WPTabBarController - controller?.showPostTab() + let presenter = RootViewCoordinator.sharedPresenter + presenter.showPostTab() } } diff --git a/WordPress/Classes/ViewRelated/Blog/Blog Details/BlogDetailsViewController+SectionHelpers.swift b/WordPress/Classes/ViewRelated/Blog/Blog Details/BlogDetailsViewController+SectionHelpers.swift index 6d3556a9f7a0..a2cf3cd70e37 100644 --- a/WordPress/Classes/ViewRelated/Blog/Blog Details/BlogDetailsViewController+SectionHelpers.swift +++ b/WordPress/Classes/ViewRelated/Blog/Blog Details/BlogDetailsViewController+SectionHelpers.swift @@ -32,6 +32,11 @@ extension BlogDetailsSubsection { } extension BlogDetailsViewController { + + @objc class func mySitesCoordinator() -> MySitesCoordinator { + RootViewCoordinator.sharedPresenter.mySitesCoordinator + } + @objc func findSectionIndex(sections: [BlogDetailsSection], category: BlogDetailsSectionCategory) -> Int { return sections.findSectionIndex(of: category) ?? NSNotFound } @@ -41,7 +46,7 @@ extension BlogDetailsViewController { } @objc func defaultSubsection() -> BlogDetailsSubsection { - if JetpackFeaturesRemovalCoordinator.shouldRemoveJetpackFeatures() { + if !JetpackFeaturesRemovalCoordinator.jetpackFeaturesEnabled() { return .posts } if shouldShowDashboard() { diff --git a/WordPress/Classes/ViewRelated/Blog/Blog Details/BlogDetailsViewController.m b/WordPress/Classes/ViewRelated/Blog/Blog Details/BlogDetailsViewController.m index b57c0353cdb4..a582a8d0d146 100644 --- a/WordPress/Classes/ViewRelated/Blog/Blog Details/BlogDetailsViewController.m +++ b/WordPress/Classes/ViewRelated/Blog/Blog Details/BlogDetailsViewController.m @@ -259,7 +259,7 @@ + (UIViewController *)viewControllerWithRestorationIdentifierPath:(NSArray *)ide // If there's already a blog details view controller for this blog in the primary // navigation stack, we'll return that instead of creating a new one. - UISplitViewController *splitViewController = [WPTabBarController sharedInstance].mySitesCoordinator.splitViewController; + UISplitViewController *splitViewController = [self mySitesCoordinator].splitViewController; UINavigationController *navigationController = splitViewController.viewControllers.firstObject; if (navigationController && [navigationController isKindOfClass:[UINavigationController class]]) { BlogDetailsViewController *topViewController = (BlogDetailsViewController *)navigationController.topViewController; diff --git a/WordPress/Classes/ViewRelated/Blog/Blogging Prompts/WPTabBarController+BloggingPrompt.swift b/WordPress/Classes/ViewRelated/Blog/Blogging Prompts/RootViewCoordinator+BloggingPrompt.swift similarity index 83% rename from WordPress/Classes/ViewRelated/Blog/Blogging Prompts/WPTabBarController+BloggingPrompt.swift rename to WordPress/Classes/ViewRelated/Blog/Blogging Prompts/RootViewCoordinator+BloggingPrompt.swift index c701b4512a33..fdee3998d56e 100644 --- a/WordPress/Classes/ViewRelated/Blog/Blogging Prompts/WPTabBarController+BloggingPrompt.swift +++ b/WordPress/Classes/ViewRelated/Blog/Blogging Prompts/RootViewCoordinator+BloggingPrompt.swift @@ -1,14 +1,14 @@ -/// Encapsulates logic related to Blogging Prompts in WPTabBarController. +/// Encapsulates logic related to Blogging Prompts in RootViewCoordinator. /// -extension WPTabBarController { +extension RootViewCoordinator { @objc func makeBloggingPromptCoordinator() -> BloggingPromptCoordinator { return BloggingPromptCoordinator() } @objc func updatePromptsIfNeeded() { - guard let blog = currentOrLastBlog() else { + guard let blog = rootViewPresenter.currentOrLastBlog() else { return } @@ -22,7 +22,7 @@ extension WPTabBarController { guard Feature.enabled(.bloggingPrompts), let siteID = userInfo[BloggingPrompt.NotificationKeys.siteID] as? Int, let blog = accountSites?.first(where: { $0.dotComID == NSNumber(value: siteID) }), - let viewController = viewControllers?[selectedIndex] else { + let viewController = rootViewPresenter.currentViewController else { return } @@ -40,7 +40,7 @@ extension WPTabBarController { } -private extension WPTabBarController { +private extension RootViewCoordinator { var accountSites: [Blog]? { try? WPAccount.lookupDefaultWordPressComAccount(in: ContextManager.shared.mainContext)?.visibleBlogs diff --git a/WordPress/Classes/ViewRelated/Blog/My Site/MySiteViewController+FAB.swift b/WordPress/Classes/ViewRelated/Blog/My Site/MySiteViewController+FAB.swift index 5d6efbbafa33..5976b5edb80d 100644 --- a/WordPress/Classes/ViewRelated/Blog/My Site/MySiteViewController+FAB.swift +++ b/WordPress/Classes/ViewRelated/Blog/My Site/MySiteViewController+FAB.swift @@ -5,23 +5,23 @@ extension MySiteViewController { /// - Returns: CreateButtonCoordinator with new post, page, and story actions. @objc func makeCreateButtonCoordinator() -> CreateButtonCoordinator { - let newPage = { [weak self] in - let controller = self?.tabBarController as? WPTabBarController - let blog = controller?.currentOrLastBlog() - controller?.showPageEditor(forBlog: blog) + let newPage = { + let presenter = RootViewCoordinator.sharedPresenter + let blog = presenter.currentOrLastBlog() + presenter.showPageEditor(forBlog: blog) } let newPost = { [weak self] in - let controller = self?.tabBarController as? WPTabBarController - controller?.showPostTab(completion: { + let presenter = RootViewCoordinator.sharedPresenter + presenter.showPostTab(completion: { self?.startAlertTimer() }) } - let newStory = { [weak self] in - let controller = self?.tabBarController as? WPTabBarController - let blog = controller?.currentOrLastBlog() - controller?.showStoryEditor(forBlog: blog) + let newStory = { + let presenter = RootViewCoordinator.sharedPresenter + let blog = presenter.currentOrLastBlog() + presenter.showStoryEditor(forBlog: blog) } let source = "my_site" diff --git a/WordPress/Classes/ViewRelated/Blog/My Site/MySiteViewController+OnboardingPrompt.swift b/WordPress/Classes/ViewRelated/Blog/My Site/MySiteViewController+OnboardingPrompt.swift index 869d3f17434b..8d1ffaef503e 100644 --- a/WordPress/Classes/ViewRelated/Blog/My Site/MySiteViewController+OnboardingPrompt.swift +++ b/WordPress/Classes/ViewRelated/Blog/My Site/MySiteViewController+OnboardingPrompt.swift @@ -17,13 +17,13 @@ extension MySiteViewController { case .stats: // Show the stats view for the current blog if let blog = blog { - WPTabBarController.sharedInstance().mySitesCoordinator.showStats(for: blog, timePeriod: .insights) + RootViewCoordinator.sharedPresenter.mySitesCoordinator.showStats(for: blog, timePeriod: .insights) } case .writing: // Open the editor - let controller = tabBarController as? WPTabBarController - controller?.showPostTab(completion: { - self.startAlertTimer() + let presenter = RootViewCoordinator.sharedPresenter + presenter.showPostTab(completion: { [weak self] in + self?.startAlertTimer() }) case .showMeAround: diff --git a/WordPress/Classes/ViewRelated/Blog/My Site/MySiteViewController.swift b/WordPress/Classes/ViewRelated/Blog/My Site/MySiteViewController.swift index 3c834cbf07b4..adc26288e2c7 100644 --- a/WordPress/Classes/ViewRelated/Blog/My Site/MySiteViewController.swift +++ b/WordPress/Classes/ViewRelated/Blog/My Site/MySiteViewController.swift @@ -190,7 +190,7 @@ class MySiteViewController: UIViewController, NoResultsViewHost { workaroundLargeTitleCollapseBug() if AppConfiguration.showsWhatIsNew { - WPTabBarController.sharedInstance()?.presentWhatIsNew(on: self) + RootViewCoordinator.shared.presentWhatIsNew(on: self) } FancyAlertViewController.presentCustomAppIconUpgradeAlertIfNecessary(from: self) @@ -283,7 +283,7 @@ class MySiteViewController: UIViewController, NoResultsViewHost { private func updateSegmentedControl(for blog: Blog, switchTabsIfNeeded: Bool = false) { // The segmented control should be hidden if the blog is not a WP.com/Atomic/Jetpack site, or if the device doesn't have a horizontally compact view let hideSegmentedControl = - JetpackFeaturesRemovalCoordinator.shouldRemoveJetpackFeatures() || + !JetpackFeaturesRemovalCoordinator.jetpackFeaturesEnabled() || !blog.isAccessibleThroughWPCom() || !splitViewControllerIsHorizontallyCompact diff --git a/WordPress/Classes/ViewRelated/Blog/QuickStartTours.swift b/WordPress/Classes/ViewRelated/Blog/QuickStartTours.swift index b99163939473..096e6addcef9 100644 --- a/WordPress/Classes/ViewRelated/Blog/QuickStartTours.swift +++ b/WordPress/Classes/ViewRelated/Blog/QuickStartTours.swift @@ -240,11 +240,7 @@ struct QuickStartFollowTour: QuickStartTour { let accessibilityHintText = NSLocalizedString("Guides you through the process of following other sites.", comment: "This value is used to set the accessibility hint text for following the sites of other users.") func setupReaderTab() { - guard let tabBar = WPTabBarController.sharedInstance() else { - return - } - - tabBar.resetReaderTab() + RootViewCoordinator.sharedPresenter.resetReaderTab() } } diff --git a/WordPress/Classes/ViewRelated/Comments/CommentAnalytics.swift b/WordPress/Classes/ViewRelated/Comments/CommentAnalytics.swift index 4eaaa0e9cb66..66acd29fac80 100644 --- a/WordPress/Classes/ViewRelated/Comments/CommentAnalytics.swift +++ b/WordPress/Classes/ViewRelated/Comments/CommentAnalytics.swift @@ -11,7 +11,7 @@ import Foundation } static func trackingContext() -> String { - let screen = WPTabBarController.sharedInstance()?.currentlySelectedScreen() ?? Constants.unknown + let screen = RootViewCoordinator.sharedPresenter.currentlySelectedScreen() switch screen { case WPTabBarCurrentlySelectedScreenSites: return Constants.sites diff --git a/WordPress/Classes/ViewRelated/Feature Introduction/Stats Revamp v2/StatsRevampV2IntroductionPresenter.swift b/WordPress/Classes/ViewRelated/Feature Introduction/Stats Revamp v2/StatsRevampV2IntroductionPresenter.swift index 55f69ec00382..45fc6ba0cf73 100644 --- a/WordPress/Classes/ViewRelated/Feature Introduction/Stats Revamp v2/StatsRevampV2IntroductionPresenter.swift +++ b/WordPress/Classes/ViewRelated/Feature Introduction/Stats Revamp v2/StatsRevampV2IntroductionPresenter.swift @@ -40,11 +40,11 @@ class StatsRevampV2IntroductionPresenter: NSObject { func primaryButtonSelected() { presentingViewController?.dismiss(animated: true) - guard let blog = WPTabBarController.sharedInstance().currentOrLastBlog() else { + guard let blog = RootViewCoordinator.sharedPresenter.currentOrLastBlog() else { return } - WPTabBarController.sharedInstance().mySitesCoordinator.showStats(for: blog, timePeriod: .insights) + RootViewCoordinator.sharedPresenter.mySitesCoordinator.showStats(for: blog, timePeriod: .insights) } // "Remind Me" prompt diff --git a/WordPress/Classes/ViewRelated/Gutenberg/GutenbergViewController+MoreActions.swift b/WordPress/Classes/ViewRelated/Gutenberg/GutenbergViewController+MoreActions.swift index 1331500e7699..232b734f5717 100644 --- a/WordPress/Classes/ViewRelated/Gutenberg/GutenbergViewController+MoreActions.swift +++ b/WordPress/Classes/ViewRelated/Gutenberg/GutenbergViewController+MoreActions.swift @@ -68,7 +68,7 @@ extension GutenbergViewController { ActionDispatcher.dispatch(NoticeAction.unlock) } - let helpTitle = JetpackFeaturesRemovalCoordinator.shouldRemoveJetpackFeatures() ? MoreSheetAlert.editorHelpTitle : MoreSheetAlert.editorHelpAndSupportTitle + let helpTitle = JetpackFeaturesRemovalCoordinator.jetpackFeaturesEnabled() ? MoreSheetAlert.editorHelpAndSupportTitle : MoreSheetAlert.editorHelpTitle alert.addDefaultActionWithTitle(helpTitle) { [weak self] _ in self?.showEditorHelp() ActionDispatcher.dispatch(NoticeAction.unlock) diff --git a/WordPress/Classes/ViewRelated/Gutenberg/GutenbergViewController.swift b/WordPress/Classes/ViewRelated/Gutenberg/GutenbergViewController.swift index 868101400fb4..bbc4403c69b1 100644 --- a/WordPress/Classes/ViewRelated/Gutenberg/GutenbergViewController.swift +++ b/WordPress/Classes/ViewRelated/Gutenberg/GutenbergViewController.swift @@ -1193,7 +1193,7 @@ extension GutenbergViewController: GutenbergBridgeDataSource { let isWPComSite = post.blog.isHostedAtWPcom || post.blog.isAtomic() // Disable Jetpack-powered editor features in WordPress app based on Features Removal coordination - if JetpackFeaturesRemovalCoordinator.shouldRemoveJetpackFeatures() { + if !JetpackFeaturesRemovalCoordinator.jetpackFeaturesEnabled() { return [ .mentions: false, .xposts: false, diff --git a/WordPress/Classes/ViewRelated/Jetpack/Branding/Coordinator/JetpackFeaturesRemovalCoordinator.swift b/WordPress/Classes/ViewRelated/Jetpack/Branding/Coordinator/JetpackFeaturesRemovalCoordinator.swift index 4fbcd8f8a370..e08cb14fe73a 100644 --- a/WordPress/Classes/ViewRelated/Jetpack/Branding/Coordinator/JetpackFeaturesRemovalCoordinator.swift +++ b/WordPress/Classes/ViewRelated/Jetpack/Branding/Coordinator/JetpackFeaturesRemovalCoordinator.swift @@ -107,22 +107,16 @@ class JetpackFeaturesRemovalCoordinator { return formatter.date(from: dateString) } - /// Used to determine if the Jetpack features should be removed based on the removal phase. - static func shouldRemoveJetpackFeatures() -> Bool { + /// Used to determine if the Jetpack features are enabled based on the removal phase. + static func jetpackFeaturesEnabled() -> Bool { switch generalPhase() { case .four, .newUsers: - return true - default: return false + default: + return true } } - /// Inverse of `shouldRemoveJetpackFeatures`. - /// Added to enhance verbosity in some areas of the code. - static func jetpackFeaturesEnabled() -> Bool { - !shouldRemoveJetpackFeatures() - } - /// Used to display feature-specific or feature-collection overlays. /// - Parameters: /// - source: The source that triggers the display of the overlay. diff --git a/WordPress/Classes/ViewRelated/Me/App Settings/AppSettingsViewController.swift b/WordPress/Classes/ViewRelated/Me/App Settings/AppSettingsViewController.swift index 008ce2e74dd3..287b8c2436e9 100644 --- a/WordPress/Classes/ViewRelated/Me/App Settings/AppSettingsViewController.swift +++ b/WordPress/Classes/ViewRelated/Me/App Settings/AppSettingsViewController.swift @@ -312,7 +312,7 @@ class AppSettingsViewController: UITableViewController { return } self.tableView.deselectSelectedRowWithAnimation(true) - WPTabBarController.sharedInstance().presentWhatIsNew(on: self) + RootViewCoordinator.shared.presentWhatIsNew(on: self) } } @@ -511,7 +511,7 @@ private extension AppSettingsViewController { rows.append(debugRow) } - if let presenter = WPTabBarController.sharedInstance()?.whatIsNewScenePresenter as? WhatIsNewScenePresenter, + if let presenter = RootViewCoordinator.shared.whatIsNewScenePresenter as? WhatIsNewScenePresenter, presenter.versionHasAnnouncements, AppConfiguration.showsWhatIsNew { let whatIsNewRow = NavigationItemRow(title: AppConstants.Settings.whatIsNewTitle, diff --git a/WordPress/Classes/ViewRelated/Media/MediaNoticeNavigationCoordinator.swift b/WordPress/Classes/ViewRelated/Media/MediaNoticeNavigationCoordinator.swift index 0671f120e1ec..d2f49a0cc7a4 100644 --- a/WordPress/Classes/ViewRelated/Media/MediaNoticeNavigationCoordinator.swift +++ b/WordPress/Classes/ViewRelated/Media/MediaNoticeNavigationCoordinator.swift @@ -16,13 +16,13 @@ class MediaNoticeNavigationCoordinator { let editor = EditPostViewController(blog: blog) editor.modalPresentationStyle = .fullScreen editor.insertedMedia = media - WPTabBarController.sharedInstance().present(editor, animated: false) + RootViewCoordinator.sharedPresenter.rootViewController.present(editor, animated: false) WPAppAnalytics.track(.editorCreatedPost, withProperties: [WPAppAnalyticsKeyTapSource: source, WPAppAnalyticsKeyPostType: "post"], with: blog) } static func navigateToMediaLibrary(with userInfo: NSDictionary) { if let blog = blog(from: userInfo) { - WPTabBarController.sharedInstance()?.mySitesCoordinator.showMedia(for: blog) + RootViewCoordinator.sharedPresenter.showMedia(for: blog) } } diff --git a/WordPress/Classes/ViewRelated/NUX/Post Signup Interstitial/PostSignUpInterstitialViewController.swift b/WordPress/Classes/ViewRelated/NUX/Post Signup Interstitial/PostSignUpInterstitialViewController.swift index 1b96f5b60559..8238b74661bc 100644 --- a/WordPress/Classes/ViewRelated/NUX/Post Signup Interstitial/PostSignUpInterstitialViewController.swift +++ b/WordPress/Classes/ViewRelated/NUX/Post Signup Interstitial/PostSignUpInterstitialViewController.swift @@ -102,7 +102,7 @@ class PostSignUpInterstitialViewController: UIViewController { @IBAction func cancel(_ sender: Any) { dismiss?(.none) - WPTabBarController.sharedInstance().showReaderTab() + RootViewCoordinator.sharedPresenter.showReaderTab() tracker.track(click: .dismiss, ifTrackingNotEnabled: { WPAnalytics.track(.welcomeNoSitesInterstitialDismissed) diff --git a/WordPress/Classes/ViewRelated/NUX/WordPressAuthenticationManager.swift b/WordPress/Classes/ViewRelated/NUX/WordPressAuthenticationManager.swift index 00e16e68fc7e..a0bdf2de5ec7 100644 --- a/WordPress/Classes/ViewRelated/NUX/WordPressAuthenticationManager.swift +++ b/WordPress/Classes/ViewRelated/NUX/WordPressAuthenticationManager.swift @@ -585,9 +585,9 @@ private extension WordPressAuthenticationManager { /// We'll pre-switch to the users selected tab before the login flow dismisses private func handleOnboardingQuestionsWillDismiss(option: OnboardingOption) { if option == .reader { - WPTabBarController.sharedInstance().showReaderTab() + RootViewCoordinator.sharedPresenter.showReaderTab() } else if option == .notifications { - WPTabBarController.sharedInstance().showNotificationsTab() + RootViewCoordinator.sharedPresenter.showNotificationsTab() } } diff --git a/WordPress/Classes/ViewRelated/Notifications/Controllers/NotificationsViewController.swift b/WordPress/Classes/ViewRelated/Notifications/Controllers/NotificationsViewController.swift index 86e28de6b882..b4dee86ee525 100644 --- a/WordPress/Classes/ViewRelated/Notifications/Controllers/NotificationsViewController.swift +++ b/WordPress/Classes/ViewRelated/Notifications/Controllers/NotificationsViewController.swift @@ -227,7 +227,7 @@ class NotificationsViewController: UIViewController, UIViewControllerRestoration defer { if AppConfiguration.showsWhatIsNew { - WPTabBarController.sharedInstance()?.presentWhatIsNew(on: self) + RootViewCoordinator.shared.presentWhatIsNew(on: self) } } @@ -297,7 +297,7 @@ class NotificationsViewController: UIViewController, UIViewControllerRestoration static func viewController(withRestorationIdentifierPath identifierComponents: [String], coder: NSCoder) -> UIViewController? { - return WPTabBarController.sharedInstance().notificationsViewController + return RootViewCoordinator.sharedPresenter.notificationsViewController } override func encodeRestorableState(with coder: NSCoder) { @@ -1639,10 +1639,10 @@ extension NotificationsViewController: NoResultsViewControllerDelegate { .follow, .like: WPAnalytics.track(.notificationsTappedViewReader, withProperties: properties) - WPTabBarController.sharedInstance().showReaderTab() + RootViewCoordinator.sharedPresenter.showReaderTab() case .unread: WPAnalytics.track(.notificationsTappedNewPost, withProperties: properties) - WPTabBarController.sharedInstance().showPostTab() + RootViewCoordinator.sharedPresenter.showPostTab() } } } diff --git a/WordPress/Classes/ViewRelated/Notifications/ReplyTextView/ReplyTextView.swift b/WordPress/Classes/ViewRelated/Notifications/ReplyTextView/ReplyTextView.swift index 2d0ede94ae34..8776ab45a89d 100644 --- a/WordPress/Classes/ViewRelated/Notifications/ReplyTextView/ReplyTextView.swift +++ b/WordPress/Classes/ViewRelated/Notifications/ReplyTextView/ReplyTextView.swift @@ -173,9 +173,7 @@ import Gridicons } @IBAction fileprivate func btnEnterFullscreenPressed(_ sender: Any) { - guard let presenter = WPTabBarController.sharedInstance() else { - return - } + let rootViewController = RootViewCoordinator.sharedPresenter.rootViewController let editViewController = FullScreenCommentReplyViewController() @@ -210,7 +208,7 @@ import Gridicons } // Dismiss the fullscreen view, once it has fully closed process the saving if needed - presenter.dismiss(animated: true) { + rootViewController.dismiss(animated: true) { let respondsToDidExit = self.delegate?.responds(to: #selector(ReplyTextViewDelegate.replyTextView(_:didExitFullScreen:))) ?? false if respondsToDidExit { @@ -222,7 +220,7 @@ import Gridicons self.resignFirstResponder() let navController = LightNavigationController(rootViewController: editViewController) - presenter.present(navController, animated: true) + rootViewController.present(navController, animated: true) } // MARK: - Gestures Recognizers diff --git a/WordPress/Classes/ViewRelated/Post/PostListViewController.swift b/WordPress/Classes/ViewRelated/Post/PostListViewController.swift index a39803d86a54..d3d2114fc63a 100644 --- a/WordPress/Classes/ViewRelated/Post/PostListViewController.swift +++ b/WordPress/Classes/ViewRelated/Post/PostListViewController.swift @@ -191,7 +191,8 @@ class PostListViewController: AbstractPostListViewController, UIViewControllerRe guard let self = self else { return } - (self.tabBarController as? WPTabBarController)?.showStoryEditor(blog: self.blog, title: nil, content: nil) + let presenter = RootViewCoordinator.sharedPresenter + presenter.showStoryEditor(blog: self.blog, title: nil, content: nil) }, source: Constants.source), at: 0) } return CreateButtonCoordinator(self, actions: actions, source: Constants.source, blog: blog) diff --git a/WordPress/Classes/ViewRelated/Reader/Detail/ReaderDetailViewController.swift b/WordPress/Classes/ViewRelated/Reader/Detail/ReaderDetailViewController.swift index c25f9925cc57..bfbd7915a133 100644 --- a/WordPress/Classes/ViewRelated/Reader/Detail/ReaderDetailViewController.swift +++ b/WordPress/Classes/ViewRelated/Reader/Detail/ReaderDetailViewController.swift @@ -144,7 +144,10 @@ class ReaderDetailViewController: UIViewController, ReaderDetailView { /// allowing Reader Detail to use a blue navbar. var useCompatibilityMode: Bool { // Use compatibility mode if not presented within the Reader - return WPTabBarController.sharedInstance()?.readerNavigationController.viewControllers.contains(self) == false + guard let readerNavigationController = RootViewCoordinator.sharedPresenter.readerNavigationController else { + return false + } + return readerNavigationController.viewControllers.contains(self) == false } /// Used to disable ineffective buttons when a Related post fails to load. diff --git a/WordPress/Classes/ViewRelated/Reader/ReaderSaveForLaterAction.swift b/WordPress/Classes/ViewRelated/Reader/ReaderSaveForLaterAction.swift index 400d5987cfd3..e335713c22e0 100644 --- a/WordPress/Classes/ViewRelated/Reader/ReaderSaveForLaterAction.swift +++ b/WordPress/Classes/ViewRelated/Reader/ReaderSaveForLaterAction.swift @@ -65,7 +65,7 @@ final class ReaderSaveForLaterAction { actionTitle: Strings.viewAll, actionHandler: { _ in self.trackViewAllSavedPostsAction(origin: origin) - WPTabBarController.sharedInstance().switchToSavedPosts() + RootViewCoordinator.sharedPresenter.switchToSavedPosts() }) present(notice) diff --git a/WordPress/Classes/ViewRelated/Reader/ReaderStreamViewController.swift b/WordPress/Classes/ViewRelated/Reader/ReaderStreamViewController.swift index 7951e736417c..e4a6a662b5ea 100644 --- a/WordPress/Classes/ViewRelated/Reader/ReaderStreamViewController.swift +++ b/WordPress/Classes/ViewRelated/Reader/ReaderStreamViewController.swift @@ -798,7 +798,7 @@ import Combine } private func showFollowing() { - WPTabBarController.sharedInstance().switchToFollowedSites() + RootViewCoordinator.sharedPresenter.switchToFollowedSites() } // MARK: - Blocking @@ -1587,7 +1587,7 @@ extension ReaderStreamViewController: WPTableViewHandlerDelegate { private func resetReaderDiscoverNudgeFlow() { shouldShowCommentSpotlight = false - WPTabBarController.sharedInstance().resetReaderDiscoverNudgeFlow() + RootViewCoordinator.sharedPresenter.resetReaderDiscoverNudgeFlow() } func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { diff --git a/WordPress/Classes/ViewRelated/Reader/Tab Navigation/ReaderTabViewController.swift b/WordPress/Classes/ViewRelated/Reader/Tab Navigation/ReaderTabViewController.swift index 7c9d3a93bc31..426dd587ef5a 100644 --- a/WordPress/Classes/ViewRelated/Reader/Tab Navigation/ReaderTabViewController.swift +++ b/WordPress/Classes/ViewRelated/Reader/Tab Navigation/ReaderTabViewController.swift @@ -57,7 +57,7 @@ class ReaderTabViewController: UIViewController { ReaderTracker.shared.start(.main) if AppConfiguration.showsWhatIsNew { - WPTabBarController.sharedInstance()?.presentWhatIsNew(on: self) + RootViewCoordinator.shared.presentWhatIsNew(on: self) } } @@ -162,7 +162,7 @@ extension ReaderTabViewController: UIViewControllerRestoration { let index = Int(coder.decodeInt32(forKey: ReaderTabViewController.encodedIndexKey)) - let controller = WPTabBarController.sharedInstance().readerTabViewController + let controller = RootViewCoordinator.sharedPresenter.readerTabViewController controller?.setStartIndex(index) return controller diff --git a/WordPress/Classes/ViewRelated/Reader/Tab Navigation/WPTabBarController+ReaderTabNavigation.swift b/WordPress/Classes/ViewRelated/Reader/Tab Navigation/WPTabBarController+ReaderTabNavigation.swift index 1f18fb510b4e..63ee8a865294 100644 --- a/WordPress/Classes/ViewRelated/Reader/Tab Navigation/WPTabBarController+ReaderTabNavigation.swift +++ b/WordPress/Classes/ViewRelated/Reader/Tab Navigation/WPTabBarController+ReaderTabNavigation.swift @@ -78,11 +78,11 @@ extension WPTabBarController { func navigateToReader(_ pushControlller: UIViewController? = nil) { showReaderTab() - readerNavigationController.popToRootViewController(animated: false) + readerNavigationController?.popToRootViewController(animated: false) guard let controller = pushControlller else { return } - readerNavigationController.pushViewController(controller, animated: true) + readerNavigationController?.pushViewController(controller, animated: true) } func resetReaderDiscoverNudgeFlow() { diff --git a/WordPress/Classes/ViewRelated/Site Creation/Final Assembly/SiteAssemblyWizardContent.swift b/WordPress/Classes/ViewRelated/Site Creation/Final Assembly/SiteAssemblyWizardContent.swift index de58061038e3..16f4dea3d909 100644 --- a/WordPress/Classes/ViewRelated/Site Creation/Final Assembly/SiteAssemblyWizardContent.swift +++ b/WordPress/Classes/ViewRelated/Site Creation/Final Assembly/SiteAssemblyWizardContent.swift @@ -242,7 +242,7 @@ extension SiteAssemblyWizardContent: NUXButtonViewControllerDelegate { } self.dismissTapped(viaDone: true) { [blog, weak self] in - WPTabBarController.sharedInstance()?.mySitesCoordinator.showBlogDetails(for: blog) + RootViewCoordinator.sharedPresenter.showBlogDetails(for: blog) // present quick start, and mark site title as complete if they already selected one guard let self = self else { @@ -259,16 +259,13 @@ extension SiteAssemblyWizardContent: NUXButtonViewControllerDelegate { return } - guard let tabBar = WPTabBarController.sharedInstance() else { - return - } - + let rootViewController = RootViewCoordinator.sharedPresenter.rootViewController let quickstartPrompt = QuickStartPromptViewController(blog: blog) quickstartPrompt.onDismiss = { blog, showQuickStart in if showQuickStart { QuickStartTourGuide.shared.setupWithDelay(for: blog, type: .newSite, withCompletedSteps: completedSteps) } } - tabBar.present(quickstartPrompt, animated: true) + rootViewController.present(quickstartPrompt, animated: true) } } diff --git a/WordPress/Classes/ViewRelated/Stats/Insights/SiteStatsInsightsTableViewController.swift b/WordPress/Classes/ViewRelated/Stats/Insights/SiteStatsInsightsTableViewController.swift index a1e74961b937..171e45b05650 100644 --- a/WordPress/Classes/ViewRelated/Stats/Insights/SiteStatsInsightsTableViewController.swift +++ b/WordPress/Classes/ViewRelated/Stats/Insights/SiteStatsInsightsTableViewController.swift @@ -359,7 +359,7 @@ extension SiteStatsInsightsTableViewController: SiteStatsInsightsDelegate { } func showCreatePost() { - WPTabBarController.sharedInstance().showPostTab { [weak self] in + RootViewCoordinator.sharedPresenter.showPostTab { [weak self] in self?.refreshInsights() } } @@ -518,9 +518,8 @@ extension SiteStatsInsightsTableViewController: SiteStatsInsightsDelegate { } self.navigationController?.popToRootViewController(animated: false) - WPTabBarController.sharedInstance().showReaderTab() - if let nc = WPTabBarController.sharedInstance().selectedViewController as? UINavigationController, - let vc = nc.topViewController as? ReaderTabViewController { + RootViewCoordinator.sharedPresenter.showReaderTab() + if let vc = RootViewCoordinator.sharedPresenter.readerTabViewController { vc.presentDiscoverTab() } } diff --git a/WordPress/Classes/ViewRelated/Support/SupportTableViewController.swift b/WordPress/Classes/ViewRelated/Support/SupportTableViewController.swift index f4c992c584d0..ffe603587d7e 100644 --- a/WordPress/Classes/ViewRelated/Support/SupportTableViewController.swift +++ b/WordPress/Classes/ViewRelated/Support/SupportTableViewController.swift @@ -73,11 +73,11 @@ class SupportTableViewController: UITableViewController { navigationController.modalPresentationStyle = .formSheet } - let tabBarController = WPTabBarController.sharedInstance() - if let presentedVC = tabBarController?.presentedViewController { + let rootViewController = RootViewCoordinator.sharedPresenter.rootViewController + if let presentedVC = rootViewController.presentedViewController { presentedVC.present(navigationController, animated: true) } else { - tabBarController?.present(navigationController, animated: true) + rootViewController.present(navigationController, animated: true) } } diff --git a/WordPress/Classes/ViewRelated/System/Coordinators/MySitesCoordinator.swift b/WordPress/Classes/ViewRelated/System/Coordinators/MySitesCoordinator.swift index 29b43a40cb01..f4e2738a828a 100644 --- a/WordPress/Classes/ViewRelated/System/Coordinators/MySitesCoordinator.swift +++ b/WordPress/Classes/ViewRelated/System/Coordinators/MySitesCoordinator.swift @@ -6,7 +6,7 @@ class MySitesCoordinator: NSObject { static let splitViewControllerRestorationID = "MySiteSplitViewControllerRestorationID" static let navigationControllerRestorationID = "MySiteNavigationControllerRestorationID" - private let meScenePresenter: ScenePresenter + let meScenePresenter: ScenePresenter let becomeActiveTab: () -> Void diff --git a/WordPress/Classes/ViewRelated/System/Coordinators/ReaderCoordinator.swift b/WordPress/Classes/ViewRelated/System/Coordinators/ReaderCoordinator.swift index 4aef7b14b531..e999368294fe 100644 --- a/WordPress/Classes/ViewRelated/System/Coordinators/ReaderCoordinator.swift +++ b/WordPress/Classes/ViewRelated/System/Coordinators/ReaderCoordinator.swift @@ -13,35 +13,35 @@ class ReaderCoordinator: NSObject { } func showReaderTab() { - WPTabBarController.sharedInstance().showReaderTab() + RootViewCoordinator.sharedPresenter.showReaderTab() } func showDiscover() { - WPTabBarController.sharedInstance().switchToDiscover() + RootViewCoordinator.sharedPresenter.switchToDiscover() } func showSearch() { - WPTabBarController.sharedInstance().navigateToReaderSearch() + RootViewCoordinator.sharedPresenter.navigateToReaderSearch() } func showA8C() { - WPTabBarController.sharedInstance()?.switchToTopic(where: { topic in + RootViewCoordinator.sharedPresenter.switchToTopic(where: { topic in return (topic as? ReaderTeamTopic)?.slug == ReaderTeamTopic.a8cSlug }) } func showP2() { - WPTabBarController.sharedInstance()?.switchToTopic(where: { topic in + RootViewCoordinator.sharedPresenter.switchToTopic(where: { topic in return (topic as? ReaderTeamTopic)?.slug == ReaderTeamTopic.p2Slug }) } func showMyLikes() { - WPTabBarController.sharedInstance().switchToMyLikes() + RootViewCoordinator.sharedPresenter.switchToMyLikes() } func showManageFollowing() { - WPTabBarController.sharedInstance()?.switchToFollowedSites() + RootViewCoordinator.sharedPresenter.switchToFollowedSites() } func showList(named listName: String, forUser user: String) { @@ -53,7 +53,7 @@ class ReaderCoordinator: NSObject { return } - WPTabBarController.sharedInstance()?.switchToTopic(where: { $0 == topic }) + RootViewCoordinator.sharedPresenter.switchToTopic(where: { $0 == topic }) } func showTag(named tagName: String) { @@ -62,7 +62,7 @@ class ReaderCoordinator: NSObject { getTagTopic(tagSlug: slug) { result in guard let topic = try? result.get() else { return } - WPTabBarController.sharedInstance()?.navigateToReaderTag(topic) + RootViewCoordinator.sharedPresenter.navigateToReaderTag(topic) } } @@ -91,7 +91,7 @@ class ReaderCoordinator: NSObject { return } - WPTabBarController.sharedInstance()?.navigateToReaderSite(topic) + RootViewCoordinator.sharedPresenter.navigateToReaderSite(topic) } } @@ -134,7 +134,7 @@ class ReaderCoordinator: NSObject { } detailViewController.postLoadFailureBlock = postLoadFailureBlock - WPTabBarController.sharedInstance().navigateToReader(detailViewController) + RootViewCoordinator.sharedPresenter.navigateToReader(detailViewController) } } diff --git a/WordPress/Classes/ViewRelated/System/WPTabBarController.h b/WordPress/Classes/ViewRelated/System/WPTabBarController.h index 36c46c334c4f..02c08d28d50c 100644 --- a/WordPress/Classes/ViewRelated/System/WPTabBarController.h +++ b/WordPress/Classes/ViewRelated/System/WPTabBarController.h @@ -1,5 +1,7 @@ #import +NS_ASSUME_NONNULL_BEGIN + extern NSString * const WPNewPostURLParamContentKey; extern NSString * const WPNewPostURLParamTagsKey; extern NSString * const WPTabBarCurrentlySelectedScreenSites; @@ -21,27 +23,19 @@ extern NSNotificationName const WPTabBarHeightChangedNotification; @interface WPTabBarController : UITabBarController -@property (nonatomic, strong, readonly) NotificationsViewController *notificationsViewController; -@property (nonatomic, strong, readonly) UINavigationController *readerNavigationController; -@property (nonatomic, strong, readonly) MySitesCoordinator *mySitesCoordinator; -@property (nonatomic, strong, readonly) ReaderCoordinator *readerCoordinator; -@property (nonatomic, strong, readonly) BloggingPromptCoordinator *bloggingPromptCoordinator; +@property (nonatomic, strong, readonly, nullable) NotificationsViewController *notificationsViewController; +@property (nonatomic, strong, readonly, nullable) UINavigationController *readerNavigationController; +@property (nonatomic, strong, readonly, nonnull) MySitesCoordinator *mySitesCoordinator; +@property (nonatomic, strong, readonly, nullable) ReaderCoordinator *readerCoordinator; @property (nonatomic, strong) id meScenePresenter; -@property (nonatomic, strong) id whatIsNewScenePresenter; @property (nonatomic, strong, readonly) ReaderTabViewModel *readerTabViewModel; -+ (instancetype)sharedInstance; - - (NSString *)currentlySelectedScreen; - (void)showMySitesTab; - (void)showReaderTab; - (void)resetReaderTab; -- (void)showPostTab; -- (void)showPostTabWithCompletion:(void (^)(void))afterDismiss; -- (void)showPostTabForBlog:(Blog *)blog; - (void)showNotificationsTab; -- (void)showPostTabAnimated:(BOOL)animated toMedia:(BOOL)openToMedia; - (void)showReaderTabForPost:(NSNumber *)postId onBlog:(NSNumber *)blogId; - (void)reloadSplitViewControllers; @@ -51,6 +45,6 @@ extern NSNotificationName const WPTabBarHeightChangedNotification; - (void)showNotificationsTabForNoteWithID:(NSString *)notificationID; - (void)updateNotificationBadgeVisibility; -- (Blog *)currentOrLastBlog; - @end + +NS_ASSUME_NONNULL_END diff --git a/WordPress/Classes/ViewRelated/System/WPTabBarController.m b/WordPress/Classes/ViewRelated/System/WPTabBarController.m index cfdf617a198e..7e420ec5b941 100644 --- a/WordPress/Classes/ViewRelated/System/WPTabBarController.m +++ b/WordPress/Classes/ViewRelated/System/WPTabBarController.m @@ -56,8 +56,7 @@ @interface WPTabBarController () )whatIsNewScenePresenter -{ - if (_whatIsNewScenePresenter) { - return _whatIsNewScenePresenter; - } - self.whatIsNewScenePresenter = [self makeWhatIsNewPresenter]; - return _whatIsNewScenePresenter; -} - -#pragma mark - Blogging Prompt -- (BloggingPromptCoordinator *)bloggingPromptCoordinator -{ - if (_bloggingPromptCoordinator) { - return _bloggingPromptCoordinator; - } - - self.bloggingPromptCoordinator = [self makeBloggingPromptCoordinator]; - return _bloggingPromptCoordinator; -} - @end diff --git a/WordPress/Classes/ViewRelated/What's New/Dependency container/WPTabBarController+WhatIsNew.swift b/WordPress/Classes/ViewRelated/What's New/Dependency container/RootViewCoordinator+WhatIsNew.swift similarity index 97% rename from WordPress/Classes/ViewRelated/What's New/Dependency container/WPTabBarController+WhatIsNew.swift rename to WordPress/Classes/ViewRelated/What's New/Dependency container/RootViewCoordinator+WhatIsNew.swift index 0e2d798d8747..b610032bce8b 100644 --- a/WordPress/Classes/ViewRelated/What's New/Dependency container/WPTabBarController+WhatIsNew.swift +++ b/WordPress/Classes/ViewRelated/What's New/Dependency container/RootViewCoordinator+WhatIsNew.swift @@ -1,6 +1,6 @@ /// dependency container for the What's New / Feature Announcements scene -extension WPTabBarController { +extension RootViewCoordinator { @objc func presentWhatIsNew(on viewController: UIViewController) { diff --git a/WordPress/WordPress.xcodeproj/project.pbxproj b/WordPress/WordPress.xcodeproj/project.pbxproj index 62cd3edae828..76a87ca0204c 100644 --- a/WordPress/WordPress.xcodeproj/project.pbxproj +++ b/WordPress/WordPress.xcodeproj/project.pbxproj @@ -661,7 +661,6 @@ 3F2F856126FAF235000FCDA5 /* ReaderScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE8707182006E48E004FB5A4 /* ReaderScreen.swift */; }; 3F2F856326FAF612000FCDA5 /* EditorGutenbergTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CC2BB0CF228ACF710034F9AB /* EditorGutenbergTests.swift */; }; 3F3087C424EDB7040087B548 /* AnnouncementCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F3087C324EDB7040087B548 /* AnnouncementCell.swift */; }; - 3F30E50923FB362700225013 /* WPTabBarController+MeNavigation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F30E50823FB362700225013 /* WPTabBarController+MeNavigation.swift */; }; 3F338B71289BD3040014ADC5 /* Nimble in Frameworks */ = {isa = PBXBuildFile; productRef = 3F338B70289BD3040014ADC5 /* Nimble */; }; 3F338B73289BD5970014ADC5 /* Nimble in Frameworks */ = {isa = PBXBuildFile; productRef = 3F338B72289BD5970014ADC5 /* Nimble */; }; 3F39C93527A09927001EC300 /* TracksLogger.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F39C93427A09927001EC300 /* TracksLogger.swift */; }; @@ -723,7 +722,7 @@ 3F662C4A24DC9FAC00CAEA95 /* WhatIsNewViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F662C4924DC9FAC00CAEA95 /* WhatIsNewViewController.swift */; }; 3F685B6A26D431FA001C6808 /* DomainSuggestionViewControllerWrapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3FAF9CC426D03C7400268EA2 /* DomainSuggestionViewControllerWrapper.swift */; }; 3F6975FF242D941E001F1807 /* ReaderTabViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F6975FE242D941E001F1807 /* ReaderTabViewModel.swift */; }; - 3F6A7E92251BC1DC005B6A61 /* WPTabBarController+WhatIsNew.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F6A7E91251BC1DC005B6A61 /* WPTabBarController+WhatIsNew.swift */; }; + 3F6A7E92251BC1DC005B6A61 /* RootViewCoordinator+WhatIsNew.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F6A7E91251BC1DC005B6A61 /* RootViewCoordinator+WhatIsNew.swift */; }; 3F6AD0562502A91400080F3B /* AnnouncementsCache.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F6AD0552502A91400080F3B /* AnnouncementsCache.swift */; }; 3F6BC04B25B2474C007369D3 /* FeatureFlag.swift in Sources */ = {isa = PBXBuildFile; fileRef = F1D690151F828FF000200E30 /* FeatureFlag.swift */; }; 3F6BC05C25B24773007369D3 /* FeatureFlagOverrideStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17A09B98238FE13B0022AE0D /* FeatureFlagOverrideStore.swift */; }; @@ -1559,14 +1558,18 @@ 8031F34B292FF46E00E8F95E /* ExtensionConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 800035C0292307E8007D2D26 /* ExtensionConfiguration.swift */; }; 8031F34C29302A2500E8F95E /* ExtensionConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 800035C229230A0B007D2D26 /* ExtensionConfiguration.swift */; }; 8031F34D29302C8100E8F95E /* ExtensionConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 800035C0292307E8007D2D26 /* ExtensionConfiguration.swift */; }; - 803BB9792959543D00B3F6D6 /* RootViewControllerCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 803BB9782959543D00B3F6D6 /* RootViewControllerCoordinator.swift */; }; - 803BB97A2959543D00B3F6D6 /* RootViewControllerCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 803BB9782959543D00B3F6D6 /* RootViewControllerCoordinator.swift */; }; + 803BB9792959543D00B3F6D6 /* RootViewCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 803BB9782959543D00B3F6D6 /* RootViewCoordinator.swift */; }; + 803BB97A2959543D00B3F6D6 /* RootViewCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 803BB9782959543D00B3F6D6 /* RootViewCoordinator.swift */; }; 803BB97C2959559500B3F6D6 /* RootViewPresenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 803BB97B2959559500B3F6D6 /* RootViewPresenter.swift */; }; 803BB97D2959559500B3F6D6 /* RootViewPresenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 803BB97B2959559500B3F6D6 /* RootViewPresenter.swift */; }; 803BB980295957CF00B3F6D6 /* WPTabBarController+RootViewPresenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 803BB97F295957CF00B3F6D6 /* WPTabBarController+RootViewPresenter.swift */; }; 803BB981295957CF00B3F6D6 /* WPTabBarController+RootViewPresenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 803BB97F295957CF00B3F6D6 /* WPTabBarController+RootViewPresenter.swift */; }; 803BB983295957F600B3F6D6 /* MySitesCoordinator+RootViewPresenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 803BB982295957F600B3F6D6 /* MySitesCoordinator+RootViewPresenter.swift */; }; 803BB984295957F600B3F6D6 /* MySitesCoordinator+RootViewPresenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 803BB982295957F600B3F6D6 /* MySitesCoordinator+RootViewPresenter.swift */; }; + 803BB986295A873800B3F6D6 /* RootViewPresenter+MeNavigation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 803BB985295A873800B3F6D6 /* RootViewPresenter+MeNavigation.swift */; }; + 803BB987295A873800B3F6D6 /* RootViewPresenter+MeNavigation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 803BB985295A873800B3F6D6 /* RootViewPresenter+MeNavigation.swift */; }; + 803BB989295B80D300B3F6D6 /* RootViewPresenter+EditorNavigation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 803BB988295B80D300B3F6D6 /* RootViewPresenter+EditorNavigation.swift */; }; + 803BB98A295B80D300B3F6D6 /* RootViewPresenter+EditorNavigation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 803BB988295B80D300B3F6D6 /* RootViewPresenter+EditorNavigation.swift */; }; 803C493B283A7C0C00003E9B /* QuickStartChecklistHeader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 803C493A283A7C0C00003E9B /* QuickStartChecklistHeader.swift */; }; 803C493C283A7C0C00003E9B /* QuickStartChecklistHeader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 803C493A283A7C0C00003E9B /* QuickStartChecklistHeader.swift */; }; 803C493E283A7C2200003E9B /* QuickStartChecklistHeader.xib in Resources */ = {isa = PBXBuildFile; fileRef = 803C493D283A7C2200003E9B /* QuickStartChecklistHeader.xib */; }; @@ -3519,7 +3522,6 @@ F5D399302541F25B0058D0AB /* SheetActions.swift in Sources */ = {isa = PBXBuildFile; fileRef = F5D3992F2541F25B0058D0AB /* SheetActions.swift */; }; F5E032D6240889EB003AF350 /* CreateButtonCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = F5E032D5240889EB003AF350 /* CreateButtonCoordinator.swift */; }; F5E032DB24088F44003AF350 /* UIView+SpringAnimations.swift in Sources */ = {isa = PBXBuildFile; fileRef = F5E032DA24088F44003AF350 /* UIView+SpringAnimations.swift */; }; - F5E032DF2408D1F1003AF350 /* WPTabBarController+ShowTab.swift in Sources */ = {isa = PBXBuildFile; fileRef = F5E032DE2408D1F1003AF350 /* WPTabBarController+ShowTab.swift */; }; F5E032E62408D537003AF350 /* ActionSheetViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F5E032E32408D537003AF350 /* ActionSheetViewController.swift */; }; F5E032E82408D537003AF350 /* BottomSheetPresentationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F5E032E52408D537003AF350 /* BottomSheetPresentationController.swift */; }; F5E1577F25DE04E200EEEDFB /* GutenbergMediaFilesUploadProcessor.swift in Sources */ = {isa = PBXBuildFile; fileRef = F5E1577E25DE04E200EEEDFB /* GutenbergMediaFilesUploadProcessor.swift */; }; @@ -4591,7 +4593,6 @@ FABB23F82602FC2C00C8785C /* ImmuTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E1E49CE31C4902EE002393A4 /* ImmuTableViewController.swift */; }; FABB23F92602FC2C00C8785C /* NullStockPhotosService.swift in Sources */ = {isa = PBXBuildFile; fileRef = D88A6495208D7B0B008AE9BC /* NullStockPhotosService.swift */; }; FABB23FA2602FC2C00C8785C /* RevisionPreviewViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A162F2221C26D7500FDC035 /* RevisionPreviewViewController.swift */; }; - FABB23FB2602FC2C00C8785C /* WPTabBarController+MeNavigation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F30E50823FB362700225013 /* WPTabBarController+MeNavigation.swift */; }; FABB23FC2602FC2C00C8785C /* SitePromptView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 467D3DF925E4436000EB9CB0 /* SitePromptView.swift */; }; FABB23FD2602FC2C00C8785C /* BaseRestoreCompleteViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAB8AA2125AF031200F9F8A0 /* BaseRestoreCompleteViewController.swift */; }; FABB23FE2602FC2C00C8785C /* SharingService.swift in Sources */ = {isa = PBXBuildFile; fileRef = E616E4B21C480896002C024E /* SharingService.swift */; }; @@ -4608,7 +4609,6 @@ FABB240A2602FC2C00C8785C /* Environment.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E58879920FE8D9300DB6F80 /* Environment.swift */; }; FABB240B2602FC2C00C8785C /* AbstractPostListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 591232681CCEAA5100B86207 /* AbstractPostListViewController.swift */; }; FABB240C2602FC2C00C8785C /* ManagedAccountSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = E14200771C117A2E00B3B115 /* ManagedAccountSettings.swift */; }; - FABB240D2602FC2C00C8785C /* WPTabBarController+ShowTab.swift in Sources */ = {isa = PBXBuildFile; fileRef = F5E032DE2408D1F1003AF350 /* WPTabBarController+ShowTab.swift */; }; FABB240E2602FC2C00C8785C /* Blog+Plans.swift in Sources */ = {isa = PBXBuildFile; fileRef = 401AC82622DD2387006D78D4 /* Blog+Plans.swift */; }; FABB240F2602FC2C00C8785C /* PostType.m in Sources */ = {isa = PBXBuildFile; fileRef = 08B6D6F11C8F7DCE0052C52B /* PostType.m */; }; FABB24102602FC2C00C8785C /* ThemeService.m in Sources */ = {isa = PBXBuildFile; fileRef = 59A9AB341B4C33A500A433DC /* ThemeService.m */; }; @@ -4711,7 +4711,7 @@ FABB24732602FC2C00C8785C /* PostTagService.m in Sources */ = {isa = PBXBuildFile; fileRef = 082AB9D81C4EEEF4000CA523 /* PostTagService.m */; }; FABB24742602FC2C00C8785C /* ReaderTabViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F6975FE242D941E001F1807 /* ReaderTabViewModel.swift */; }; FABB24752602FC2C00C8785C /* ReaderSearchSuggestionService.swift in Sources */ = {isa = PBXBuildFile; fileRef = E62079E01CF7A61200F5CD46 /* ReaderSearchSuggestionService.swift */; }; - FABB24762602FC2C00C8785C /* WPTabBarController+WhatIsNew.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F6A7E91251BC1DC005B6A61 /* WPTabBarController+WhatIsNew.swift */; }; + FABB24762602FC2C00C8785C /* RootViewCoordinator+WhatIsNew.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F6A7E91251BC1DC005B6A61 /* RootViewCoordinator+WhatIsNew.swift */; }; FABB24772602FC2C00C8785C /* CachedAnimatedImageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FF8A04DF1D9BFE7400523BC4 /* CachedAnimatedImageView.swift */; }; FABB24782602FC2C00C8785C /* AccountToAccount20to21.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5A6CEA519FA800E009F07DE /* AccountToAccount20to21.swift */; }; FABB24792602FC2C00C8785C /* AutoUploadMessageProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = F16C35DB23F3F78E00C81331 /* AutoUploadMessageProvider.swift */; }; @@ -5276,8 +5276,8 @@ FEAC916F28001FC4005026E7 /* AvatarTrainView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FEAC916D28001FC4005026E7 /* AvatarTrainView.swift */; }; FEC26030283FBA1A003D886A /* BloggingPromptCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = FEC2602F283FBA1A003D886A /* BloggingPromptCoordinator.swift */; }; FEC26031283FBA1A003D886A /* BloggingPromptCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = FEC2602F283FBA1A003D886A /* BloggingPromptCoordinator.swift */; }; - FEC26033283FC902003D886A /* WPTabBarController+BloggingPrompt.swift in Sources */ = {isa = PBXBuildFile; fileRef = FEC26032283FC902003D886A /* WPTabBarController+BloggingPrompt.swift */; }; - FEC26034283FC902003D886A /* WPTabBarController+BloggingPrompt.swift in Sources */ = {isa = PBXBuildFile; fileRef = FEC26032283FC902003D886A /* WPTabBarController+BloggingPrompt.swift */; }; + FEC26033283FC902003D886A /* RootViewCoordinator+BloggingPrompt.swift in Sources */ = {isa = PBXBuildFile; fileRef = FEC26032283FC902003D886A /* RootViewCoordinator+BloggingPrompt.swift */; }; + FEC26034283FC902003D886A /* RootViewCoordinator+BloggingPrompt.swift in Sources */ = {isa = PBXBuildFile; fileRef = FEC26032283FC902003D886A /* RootViewCoordinator+BloggingPrompt.swift */; }; FECA442F28350B7800D01F15 /* PromptRemindersScheduler.swift in Sources */ = {isa = PBXBuildFile; fileRef = FECA442E28350B7800D01F15 /* PromptRemindersScheduler.swift */; }; FECA443028350B7800D01F15 /* PromptRemindersScheduler.swift in Sources */ = {isa = PBXBuildFile; fileRef = FECA442E28350B7800D01F15 /* PromptRemindersScheduler.swift */; }; FECA44322836647100D01F15 /* PromptRemindersSchedulerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = FECA44312836647100D01F15 /* PromptRemindersSchedulerTests.swift */; }; @@ -6094,7 +6094,6 @@ 3F2ABE192770EF3E005D8916 /* Blog+VideoLimits.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Blog+VideoLimits.swift"; sourceTree = ""; }; 3F2F0C15256C6B2C003351C7 /* StatsWidgetsService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatsWidgetsService.swift; sourceTree = ""; }; 3F3087C324EDB7040087B548 /* AnnouncementCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnnouncementCell.swift; sourceTree = ""; }; - 3F30E50823FB362700225013 /* WPTabBarController+MeNavigation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "WPTabBarController+MeNavigation.swift"; sourceTree = ""; }; 3F39C93427A09927001EC300 /* TracksLogger.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TracksLogger.swift; sourceTree = ""; }; 3F3CA64F25D3003C00642A89 /* StatsWidgetsStore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatsWidgetsStore.swift; sourceTree = ""; }; 3F3D854A251E6418001CA4D2 /* AnnouncementsDataStoreTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnnouncementsDataStoreTests.swift; sourceTree = ""; }; @@ -6136,7 +6135,7 @@ 3F63B93B258179D100F581BE /* StatsWidgetEntry.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatsWidgetEntry.swift; sourceTree = ""; }; 3F662C4924DC9FAC00CAEA95 /* WhatIsNewViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WhatIsNewViewController.swift; sourceTree = ""; }; 3F6975FE242D941E001F1807 /* ReaderTabViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReaderTabViewModel.swift; sourceTree = ""; }; - 3F6A7E91251BC1DC005B6A61 /* WPTabBarController+WhatIsNew.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "WPTabBarController+WhatIsNew.swift"; sourceTree = ""; }; + 3F6A7E91251BC1DC005B6A61 /* RootViewCoordinator+WhatIsNew.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "RootViewCoordinator+WhatIsNew.swift"; sourceTree = ""; }; 3F6AD0552502A91400080F3B /* AnnouncementsCache.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnnouncementsCache.swift; sourceTree = ""; }; 3F6DA04025646F96002AB88F /* HomeWidgetData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeWidgetData.swift; sourceTree = ""; }; 3F720C2028899DD900519938 /* JetpackBrandingVisibility.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JetpackBrandingVisibility.swift; sourceTree = ""; }; @@ -6886,10 +6885,12 @@ 801D9519291AC0B00051993E /* JetpackOverlayFrequencyTracker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JetpackOverlayFrequencyTracker.swift; sourceTree = ""; }; 801D951C291ADB7E0051993E /* JetpackOverlayFrequencyTrackerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JetpackOverlayFrequencyTrackerTests.swift; sourceTree = ""; }; 80293CF6284450AD0083F946 /* WordPress-Swift.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "WordPress-Swift.h"; sourceTree = ""; }; - 803BB9782959543D00B3F6D6 /* RootViewControllerCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RootViewControllerCoordinator.swift; sourceTree = ""; }; + 803BB9782959543D00B3F6D6 /* RootViewCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RootViewCoordinator.swift; sourceTree = ""; }; 803BB97B2959559500B3F6D6 /* RootViewPresenter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RootViewPresenter.swift; sourceTree = ""; }; 803BB97F295957CF00B3F6D6 /* WPTabBarController+RootViewPresenter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "WPTabBarController+RootViewPresenter.swift"; sourceTree = ""; }; 803BB982295957F600B3F6D6 /* MySitesCoordinator+RootViewPresenter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "MySitesCoordinator+RootViewPresenter.swift"; sourceTree = ""; }; + 803BB985295A873800B3F6D6 /* RootViewPresenter+MeNavigation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "RootViewPresenter+MeNavigation.swift"; sourceTree = ""; }; + 803BB988295B80D300B3F6D6 /* RootViewPresenter+EditorNavigation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "RootViewPresenter+EditorNavigation.swift"; sourceTree = ""; }; 803C493A283A7C0C00003E9B /* QuickStartChecklistHeader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QuickStartChecklistHeader.swift; sourceTree = ""; }; 803C493D283A7C2200003E9B /* QuickStartChecklistHeader.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = QuickStartChecklistHeader.xib; sourceTree = ""; }; 803D90F6292F0188007CC0D0 /* JetpackRedirector.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JetpackRedirector.swift; sourceTree = ""; }; @@ -8689,7 +8690,6 @@ F5D3992F2541F25B0058D0AB /* SheetActions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SheetActions.swift; sourceTree = ""; }; F5E032D5240889EB003AF350 /* CreateButtonCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CreateButtonCoordinator.swift; sourceTree = ""; }; F5E032DA24088F44003AF350 /* UIView+SpringAnimations.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIView+SpringAnimations.swift"; sourceTree = ""; }; - F5E032DE2408D1F1003AF350 /* WPTabBarController+ShowTab.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "WPTabBarController+ShowTab.swift"; sourceTree = ""; }; F5E032E32408D537003AF350 /* ActionSheetViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ActionSheetViewController.swift; sourceTree = ""; }; F5E032E52408D537003AF350 /* BottomSheetPresentationController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BottomSheetPresentationController.swift; sourceTree = ""; }; F5E032EB240D49FF003AF350 /* ActionSheetComponent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionSheetComponent.swift; sourceTree = ""; }; @@ -8867,7 +8867,7 @@ FEAC916D28001FC4005026E7 /* AvatarTrainView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AvatarTrainView.swift; sourceTree = ""; }; FEB7A8922718852A00A8CF85 /* WordPress 134.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = "WordPress 134.xcdatamodel"; sourceTree = ""; }; FEC2602F283FBA1A003D886A /* BloggingPromptCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BloggingPromptCoordinator.swift; sourceTree = ""; }; - FEC26032283FC902003D886A /* WPTabBarController+BloggingPrompt.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "WPTabBarController+BloggingPrompt.swift"; sourceTree = ""; }; + FEC26032283FC902003D886A /* RootViewCoordinator+BloggingPrompt.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "RootViewCoordinator+BloggingPrompt.swift"; sourceTree = ""; }; FECA442E28350B7800D01F15 /* PromptRemindersScheduler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PromptRemindersScheduler.swift; sourceTree = ""; }; FECA44312836647100D01F15 /* PromptRemindersSchedulerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PromptRemindersSchedulerTests.swift; sourceTree = ""; }; FED65D78293511E4008071BF /* SharedDataIssueSolver.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SharedDataIssueSolver.swift; sourceTree = ""; }; @@ -10828,7 +10828,7 @@ 3F6A7E90251BC1C4005B6A61 /* Dependency container */ = { isa = PBXGroup; children = ( - 3F6A7E91251BC1DC005B6A61 /* WPTabBarController+WhatIsNew.swift */, + 3F6A7E91251BC1DC005B6A61 /* RootViewCoordinator+WhatIsNew.swift */, ); path = "Dependency container"; sourceTree = ""; @@ -12521,8 +12521,10 @@ 803BB97E295957A200B3F6D6 /* Root View */ = { isa = PBXGroup; children = ( - 803BB9782959543D00B3F6D6 /* RootViewControllerCoordinator.swift */, + 803BB9782959543D00B3F6D6 /* RootViewCoordinator.swift */, 803BB97B2959559500B3F6D6 /* RootViewPresenter.swift */, + 803BB985295A873800B3F6D6 /* RootViewPresenter+MeNavigation.swift */, + 803BB988295B80D300B3F6D6 /* RootViewPresenter+EditorNavigation.swift */, 803BB97F295957CF00B3F6D6 /* WPTabBarController+RootViewPresenter.swift */, 803BB982295957F600B3F6D6 /* MySitesCoordinator+RootViewPresenter.swift */, ); @@ -12912,8 +12914,6 @@ 3101866A1A373B01008F7DF6 /* WPTabBarController.m */, 17A28DC2205001A900EA6D9E /* FilterTabBar.swift */, D8B9B58E204F4EA1003C6042 /* NetworkAware.swift */, - F5E032DE2408D1F1003AF350 /* WPTabBarController+ShowTab.swift */, - 3F30E50823FB362700225013 /* WPTabBarController+MeNavigation.swift */, 43DDFE8B21715ADD008BE72F /* WPTabBarController+QuickStart.swift */, 57BAD50B225CCE1A006139EC /* WPTabBarController+Swift.swift */, ); @@ -13650,7 +13650,7 @@ 98517E5828220411001FFD45 /* BloggingPromptTableViewCell.swift */, 98517E5B28220474001FFD45 /* BloggingPromptTableViewCell.xib */, FEC2602F283FBA1A003D886A /* BloggingPromptCoordinator.swift */, - FEC26032283FC902003D886A /* WPTabBarController+BloggingPrompt.swift */, + FEC26032283FC902003D886A /* RootViewCoordinator+BloggingPrompt.swift */, ); path = "Blogging Prompts"; sourceTree = ""; @@ -20886,6 +20886,7 @@ 5903AE1B19B60A98009D5354 /* WPButtonForNavigationBar.m in Sources */, 1717139F265FE59700F3A022 /* ButtonStyles.swift in Sources */, C3FF78E828354A91008FA600 /* SiteDesignSectionLoader.swift in Sources */, + 803BB989295B80D300B3F6D6 /* RootViewPresenter+EditorNavigation.swift in Sources */, B58C4ECA207C5E1A00E32E4D /* UIImage+Assets.swift in Sources */, E684383E221F535900752258 /* LoadMoreCounter.swift in Sources */, E6158ACA1ECDF518005FA441 /* LoginEpilogueUserInfo.swift in Sources */, @@ -21009,7 +21010,6 @@ E1E49CE41C4902EE002393A4 /* ImmuTableViewController.swift in Sources */, D88A6496208D7B0B008AE9BC /* NullStockPhotosService.swift in Sources */, 9A162F2321C26D7500FDC035 /* RevisionPreviewViewController.swift in Sources */, - 3F30E50923FB362700225013 /* WPTabBarController+MeNavigation.swift in Sources */, 467D3DFA25E4436000EB9CB0 /* SitePromptView.swift in Sources */, FAB8AA2225AF031200F9F8A0 /* BaseRestoreCompleteViewController.swift in Sources */, E616E4B31C480896002C024E /* SharingService.swift in Sources */, @@ -21030,7 +21030,6 @@ 7E58879A20FE8D9300DB6F80 /* Environment.swift in Sources */, 591232691CCEAA5100B86207 /* AbstractPostListViewController.swift in Sources */, E14200781C117A2E00B3B115 /* ManagedAccountSettings.swift in Sources */, - F5E032DF2408D1F1003AF350 /* WPTabBarController+ShowTab.swift in Sources */, 401AC82722DD2387006D78D4 /* Blog+Plans.swift in Sources */, 08B6D6F31C8F7DCE0052C52B /* PostType.m in Sources */, FE06AC8526C3C2F800B69DE4 /* ShareAppTextActivityItemSource.swift in Sources */, @@ -21167,7 +21166,7 @@ 082AB9D91C4EEEF4000CA523 /* PostTagService.m in Sources */, 3F6975FF242D941E001F1807 /* ReaderTabViewModel.swift in Sources */, E62079E11CF7A61200F5CD46 /* ReaderSearchSuggestionService.swift in Sources */, - 3F6A7E92251BC1DC005B6A61 /* WPTabBarController+WhatIsNew.swift in Sources */, + 3F6A7E92251BC1DC005B6A61 /* RootViewCoordinator+WhatIsNew.swift in Sources */, 3FAE0652287C8FC500F46508 /* JPScrollViewDelegate.swift in Sources */, FF8A04E01D9BFE7400523BC4 /* CachedAnimatedImageView.swift in Sources */, B5A6CEA619FA800E009F07DE /* AccountToAccount20to21.swift in Sources */, @@ -21183,7 +21182,7 @@ F10465142554260600655194 /* BindableTapGestureRecognizer.swift in Sources */, E62079DF1CF79FC200F5CD46 /* ReaderSearchSuggestion.swift in Sources */, E64ECA4D1CE62041000188A0 /* ReaderSearchViewController.swift in Sources */, - 803BB9792959543D00B3F6D6 /* RootViewControllerCoordinator.swift in Sources */, + 803BB9792959543D00B3F6D6 /* RootViewCoordinator.swift in Sources */, 98F537A722496CF300B334F9 /* SiteStatsTableHeaderView.swift in Sources */, E14977181C0DC0770057CD60 /* MediaSizeSliderCell.swift in Sources */, C7BB60162863609C00748FD9 /* QRLoginInternetConnectionChecker.swift in Sources */, @@ -21553,7 +21552,7 @@ E15632CC1EB9ECF40035A099 /* TableViewKeyboardObserver.swift in Sources */, E1A03F48174283E10085D192 /* BlogToJetpackAccount.m in Sources */, B522C4F81B3DA79B00E47B59 /* NotificationSettingsViewController.swift in Sources */, - FEC26033283FC902003D886A /* WPTabBarController+BloggingPrompt.swift in Sources */, + FEC26033283FC902003D886A /* RootViewCoordinator+BloggingPrompt.swift in Sources */, 93E63369272AC532009DACF8 /* LoginEpilogueChooseSiteTableViewCell.swift in Sources */, 9A51DA1522E9E8C7005CC335 /* ChangeUsernameViewController.swift in Sources */, 5D6C4B121B604190005E3C43 /* RichTextView.swift in Sources */, @@ -21707,6 +21706,7 @@ 400A2C872217A985000A8A59 /* ReferrerStatsRecordValue+CoreDataProperties.swift in Sources */, 57AA848F228715DA00D3C2A2 /* PostCardCell.swift in Sources */, FE43DAAF26DFAD1C00CFF595 /* CommentContentTableViewCell.swift in Sources */, + 803BB986295A873800B3F6D6 /* RootViewPresenter+MeNavigation.swift in Sources */, F4CBE3D6292597E3004FFBB6 /* SupportTableViewControllerConfiguration.swift in Sources */, 8F22804451E5812433733348 /* TimeZoneSearchHeaderView.swift in Sources */, 8332DD2429259AE300802F7D /* DataMigrator.swift in Sources */, @@ -22893,7 +22893,7 @@ FABB21762602FC2C00C8785C /* CameraHandler.swift in Sources */, FA73D7EA27987BA500DF24B3 /* SitePickerViewController+SiteIcon.swift in Sources */, FABB21772602FC2C00C8785C /* JetpackConnectionViewController.swift in Sources */, - 803BB97A2959543D00B3F6D6 /* RootViewControllerCoordinator.swift in Sources */, + 803BB97A2959543D00B3F6D6 /* RootViewCoordinator.swift in Sources */, FABB21782602FC2C00C8785C /* NotificationActionsService.swift in Sources */, FABB21792602FC2C00C8785C /* JetpackScanService.swift in Sources */, FABB217A2602FC2C00C8785C /* FilterSheetView.swift in Sources */, @@ -23166,6 +23166,7 @@ 0A3FCA1E28B71CBD00499A15 /* FullScreenCommentReplyViewModel.swift in Sources */, FABB224A2602FC2C00C8785C /* ReaderFollowedSitesViewController.swift in Sources */, FABB224B2602FC2C00C8785C /* AnnouncementsCache.swift in Sources */, + 803BB987295A873800B3F6D6 /* RootViewPresenter+MeNavigation.swift in Sources */, 8B74A9A9268E3C68003511CE /* RewindStatus+multiSite.swift in Sources */, FABB224C2602FC2C00C8785C /* GravatarUploader.swift in Sources */, FABB224D2602FC2C00C8785C /* NotificationSettingDetailsViewController.swift in Sources */, @@ -23674,6 +23675,7 @@ FABB23DC2602FC2C00C8785C /* JetpackScanThreatCell.swift in Sources */, FABB23DD2602FC2C00C8785C /* SiteSegmentsCell.swift in Sources */, FABB23DE2602FC2C00C8785C /* SharingConnectionsViewController.m in Sources */, + 803BB98A295B80D300B3F6D6 /* RootViewPresenter+EditorNavigation.swift in Sources */, FABB23DF2602FC2C00C8785C /* BlogSelectorViewController.m in Sources */, FABB23E02602FC2C00C8785C /* HomepageSettingsViewController.swift in Sources */, 93E6336D272AF504009DACF8 /* LoginEpilogueDividerView.swift in Sources */, @@ -23705,7 +23707,6 @@ FABB23F92602FC2C00C8785C /* NullStockPhotosService.swift in Sources */, FABB23FA2602FC2C00C8785C /* RevisionPreviewViewController.swift in Sources */, 3F2ABE1D277118CC005D8916 /* WPMediaAsset+VideoLimits.swift in Sources */, - FABB23FB2602FC2C00C8785C /* WPTabBarController+MeNavigation.swift in Sources */, 80EF928B280D28140064A971 /* Atomic.swift in Sources */, 3FFDEF9129187F2100B625CE /* MigrationActionsConfiguration.swift in Sources */, FABB23FC2602FC2C00C8785C /* SitePromptView.swift in Sources */, @@ -23727,7 +23728,6 @@ FABB240B2602FC2C00C8785C /* AbstractPostListViewController.swift in Sources */, FABB240C2602FC2C00C8785C /* ManagedAccountSettings.swift in Sources */, FA88EAD6260AE69C001D232B /* TemplatePreviewViewController.swift in Sources */, - FABB240D2602FC2C00C8785C /* WPTabBarController+ShowTab.swift in Sources */, F41BDD7B29114E2400B7F2B0 /* MigrationStep.swift in Sources */, FABB240E2602FC2C00C8785C /* Blog+Plans.swift in Sources */, FABB240F2602FC2C00C8785C /* PostType.m in Sources */, @@ -23864,7 +23864,7 @@ FADFBD27265F580500039C41 /* MultilineButton.swift in Sources */, C71AF534281064DE00F9E99E /* OnboardingQuestionsCoordinator.swift in Sources */, FABB24752602FC2C00C8785C /* ReaderSearchSuggestionService.swift in Sources */, - FABB24762602FC2C00C8785C /* WPTabBarController+WhatIsNew.swift in Sources */, + FABB24762602FC2C00C8785C /* RootViewCoordinator+WhatIsNew.swift in Sources */, FABB24772602FC2C00C8785C /* CachedAnimatedImageView.swift in Sources */, FABB24782602FC2C00C8785C /* AccountToAccount20to21.swift in Sources */, FABB24792602FC2C00C8785C /* AutoUploadMessageProvider.swift in Sources */, @@ -24320,7 +24320,7 @@ 46F583B02624CE790010A723 /* BlockEditorSettingElement+CoreDataProperties.swift in Sources */, FABB25D22602FC2C00C8785C /* SiteSegmentsWizardContent.swift in Sources */, FABB25D32602FC2C00C8785C /* ReaderTopicToReaderDefaultTopic37to38.swift in Sources */, - FEC26034283FC902003D886A /* WPTabBarController+BloggingPrompt.swift in Sources */, + FEC26034283FC902003D886A /* RootViewCoordinator+BloggingPrompt.swift in Sources */, FABB25D42602FC2C00C8785C /* UploadsManager.swift in Sources */, 9856A3E5261FD27A008D6354 /* UserProfileSectionHeader.swift in Sources */, FABB25D62602FC2C00C8785C /* ActivityListSectionHeaderView.swift in Sources */, diff --git a/WordPress/WordPressShareExtension/ShareNoticeNavigationCoordinator.swift b/WordPress/WordPressShareExtension/ShareNoticeNavigationCoordinator.swift index 3c3fbaeba746..ed1ed9b94f76 100644 --- a/WordPress/WordPressShareExtension/ShareNoticeNavigationCoordinator.swift +++ b/WordPress/WordPressShareExtension/ShareNoticeNavigationCoordinator.swift @@ -19,13 +19,13 @@ class ShareNoticeNavigationCoordinator { let editor = EditPostViewController.init(post: post) editor.modalPresentationStyle = .fullScreen - WPTabBarController.sharedInstance().present(editor, animated: false) + RootViewCoordinator.sharedPresenter.rootViewController.present(editor, animated: false) } static func navigateToPostList(with userInfo: NSDictionary) { fetchPost(from: userInfo, onSuccess: { post in if let post = post { - WPTabBarController.sharedInstance().mySitesCoordinator.showPosts(for: post.blog) + RootViewCoordinator.sharedPresenter.showPosts(for: post.blog) } }, onFailure: { DDLogError("Could not fetch post from share notification.") @@ -35,7 +35,7 @@ class ShareNoticeNavigationCoordinator { static func navigateToBlogDetails(with userInfo: NSDictionary) { fetchBlog(from: userInfo, onSuccess: { blog in if let blog = blog { - WPTabBarController.sharedInstance()?.mySitesCoordinator.showBlogDetails(for: blog) + RootViewCoordinator.sharedPresenter.showBlogDetails(for: blog) } }, onFailure: { DDLogError("Could not fetch blog from share notification.")