Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
43f6e46
Update: replace Reader-related WPTabBarController.sharedInstance usages
hassaanelgarem Dec 27, 2022
5866206
Refactor: MeNavigation as an extension on RootViewPresenter for reusa…
hassaanelgarem Dec 27, 2022
0dfbf89
Fix: remove white spaces
hassaanelgarem Dec 27, 2022
9a66698
Update: replace Search-related WPTabBarController.sharedInstance usages
hassaanelgarem Dec 27, 2022
ca886bb
Update: replace usages of `showNotificationsTab`
hassaanelgarem Dec 27, 2022
493a27f
Update: replace usage of `showReaderTab(forPost:)`
hassaanelgarem Dec 27, 2022
14fa3a5
Update: replace usages of `WPTabBarController.sharedInstance` in Me n…
hassaanelgarem Dec 27, 2022
831de53
Update: replace usage of `showMedia(for:)`
hassaanelgarem Dec 27, 2022
3e38635
Update: replace usage of `showPosts(for:)`
hassaanelgarem Dec 27, 2022
1882ea1
Update: replace usages of `present()` and `dismiss()`
hassaanelgarem Dec 27, 2022
8bab975
Update: replace usages of `WPTabBarController.sharedInstance()` in `P…
hassaanelgarem Dec 27, 2022
8fbfd1b
Update: replace usages of `currentlySelectedScreen()`
hassaanelgarem Dec 27, 2022
cd976e8
Update: replace usages of `showBlogDetails()`
hassaanelgarem Dec 27, 2022
19f48de
Update: replace usage of `WPTabBarController.sharedInstance()` in Sup…
hassaanelgarem Dec 27, 2022
e571333
Update: replace usages of some reader-related function
hassaanelgarem Dec 27, 2022
fb98daf
Update: remove unneeded optional casting
hassaanelgarem Dec 27, 2022
dc3bfca
Update: replace usages of `WPTabBarController.sharedInstance` related…
hassaanelgarem Dec 27, 2022
2a33e0b
Update: replace usages of `WPTabBarController.sharedInstance` as a VC
hassaanelgarem Dec 27, 2022
43862d6
Update: replace usages of `WPTabBarController.mySitesCoordinator`
hassaanelgarem Dec 27, 2022
fb65edc
Update: replace usages of `WPTabBarController.sharedInstance()` by ca…
hassaanelgarem Dec 27, 2022
9ea1a36
Update: move `currentOrLastBlog` to `RootViewPresenter`
hassaanelgarem Dec 27, 2022
57e4609
Refactor: add a new file for editor navigation extension
hassaanelgarem Dec 27, 2022
51a6982
Refactor: move showPostTab functions to `RootViewPresenter`
hassaanelgarem Dec 27, 2022
2ecdd7b
Refactor: move ShowTab functions to `RootViewPresenter`
hassaanelgarem Dec 27, 2022
ffcac18
Remove: Unneeded `WPTabBarController+ShowTab` file
hassaanelgarem Dec 27, 2022
f17c60f
Update: Replace usages of `WPTabBar.sharedInstance` in 3D touch handler
hassaanelgarem Dec 27, 2022
77fb5c6
Update: replace editor navigation usages of `WPTabBar.sharedInstance`
hassaanelgarem Dec 27, 2022
1119446
Update: replace usages of `tabBarController` with RootViewPresenter
hassaanelgarem Dec 27, 2022
fe3bd34
Refactor: move whats new logic to `RootViewControllerCoordinator`
hassaanelgarem Dec 27, 2022
2a9a886
Refactor: move blogging prompts logic to `RootViewControllerCoordinator`
hassaanelgarem Dec 27, 2022
67c8786
Update: remove usage of `WPTabBar.sharedInstance` in `BlogDetailsVC.m`
hassaanelgarem Dec 27, 2022
c450a6f
Update: Completely remove `WPTabBarController.sharedInstance()`
hassaanelgarem Dec 27, 2022
fde1ace
Update: Fix incorrect documentation
hassaanelgarem Dec 27, 2022
476a929
Merge branch 'task/19810-simplify-ui' into task/19812-handle-simplifi…
hassaanelgarem Dec 28, 2022
2b07177
Add: track incorrectly accessed jetpack functions
hassaanelgarem Dec 28, 2022
2f68760
Merge branch 'task/19810-simplify-ui' into task/19812-handle-simplifi…
hassaanelgarem Dec 28, 2022
d16a995
Refactor: rename `RootViewControllerCoordinator` to `RootViewCoordina…
hassaanelgarem Dec 28, 2022
d3f07f3
Add: release note
hassaanelgarem Dec 28, 2022
fb960a3
Update: make `RootViewPresenter.mySitesCoordinator` optional
hassaanelgarem Dec 29, 2022
f03e6c2
Update: Make `WPTabBarController.mySitesCoordinator` nullable
hassaanelgarem Dec 29, 2022
5a44295
Update: Add readerCoordinator to RootViewPresenter
hassaanelgarem Dec 29, 2022
9b95aa5
Update: Specify nullability identifiers for `WPTabBarController`
hassaanelgarem Dec 29, 2022
d897810
Update: Add `readerNavigationController` to RootViewPresenter
hassaanelgarem Dec 29, 2022
f3f2794
Update: Add `notificationsViewController` to RootViewPresenter
hassaanelgarem Dec 29, 2022
e619798
Update: Use `RootViewPresenter.readerTabVC` instead of accessing the …
hassaanelgarem Dec 29, 2022
c17f29e
Update: call `fallbackBehavior()` when accessing unsupported variables
hassaanelgarem Dec 29, 2022
9d7ec3c
Update: remove `shouldRemoveJetpackFeatures()` and depend on `jetpack…
hassaanelgarem Dec 29, 2022
3dcf3f7
Merge branch 'task/19810-simplify-ui' into task/19812-handle-simplifi…
hassaanelgarem Jan 1, 2023
aea0501
Fix: Replace deprecated `shouldRemoveJetpackFeatures` to fix build er…
hassaanelgarem Jan 1, 2023
1af613b
Update: make `mySitesCoordinator` non-optional
hassaanelgarem Jan 1, 2023
1775563
Merge branch 'trunk' into task/19812-handle-simplified-ui
hassaanelgarem Jan 2, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 21 additions & 18 deletions WordPress/Classes/Utility/Spotlight/SearchManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -311,12 +311,12 @@ fileprivate extension SearchManager {
// MARK: Site Tab Navigation

func openMySitesTab() -> Bool {
WPTabBarController.sharedInstance().showMySitesTab()
RootViewControllerCoordinator.sharedPresenter.showMySitesTab()
return true
}

func openSiteDetailsScreen(for blog: Blog) {
WPTabBarController.sharedInstance()?.mySitesCoordinator.showBlogDetails(for: blog)
RootViewControllerCoordinator.sharedPresenter.showBlogDetails(for: blog)
}

// MARK: Reader Tab Navigation
Expand All @@ -329,29 +329,29 @@ fileprivate extension SearchManager {
// MARK: Me Tab Navigation

func openMeTab() -> Bool {
WPTabBarController.sharedInstance().showMeScene()
RootViewControllerCoordinator.sharedPresenter.showMeScene()
return true
}

func openAppSettingsScreen() -> Bool {
WPTabBarController.sharedInstance().navigateToAppSettings()
RootViewControllerCoordinator.sharedPresenter.navigateToAppSettings()
return true
}

func openSupportScreen() -> Bool {
WPTabBarController.sharedInstance().navigateToSupport()
RootViewControllerCoordinator.sharedPresenter.navigateToSupport()
return true
}

// MARK: Notification Tab Navigation

func openNotificationsTab() -> Bool {
WPTabBarController.sharedInstance().showNotificationsTab()
RootViewControllerCoordinator.sharedPresenter.showNotificationsTab()
return true
}

func openNotificationSettingsScreen() -> Bool {
WPTabBarController.sharedInstance().switchNotificationsTabToNotificationSettings()
RootViewControllerCoordinator.sharedPresenter.switchNotificationsTabToNotificationSettings()
return true
}

Expand Down Expand Up @@ -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)
RootViewControllerCoordinator.sharedPresenter.showPosts(for: post.blog)
} else if let page = apost as? Page {
WPTabBarController.sharedInstance().mySitesCoordinator.showPages(for: page.blog)
RootViewControllerCoordinator.sharedPresenter.showPages(for: page.blog)
}
}

Expand All @@ -412,7 +412,7 @@ fileprivate extension SearchManager {
onFailure()
return
}
WPTabBarController.sharedInstance().showReaderTab(forPost: postID, onBlog: blogID)
RootViewControllerCoordinator.sharedPresenter.showReaderTab(forPost: postID, onBlog: blogID)
}

func openReader(for postID: NSNumber, siteID: NSNumber, onFailure: () -> Void) {
Expand All @@ -421,7 +421,7 @@ fileprivate extension SearchManager {
onFailure()
return
}
WPTabBarController.sharedInstance().showReaderTab(forPost: postID, onBlog: siteID)
RootViewControllerCoordinator.sharedPresenter.showReaderTab(forPost: postID, onBlog: siteID)
}

// MARK: - Editor
Expand All @@ -431,30 +431,31 @@ fileprivate extension SearchManager {
openListView(for: post)
let editor = EditPostViewController.init(post: post)
editor.modalPresentationStyle = .fullScreen
WPTabBarController.sharedInstance().present(editor, animated: true)
RootViewControllerCoordinator.sharedPresenter.rootViewController.present(editor, animated: true)
}

func openEditor(for page: Page) {
closePreviewIfNeeded(for: page)
openListView(for: page)

let editorViewController = EditPageViewController(page: page)
WPTabBarController.sharedInstance().present(editorViewController, animated: false)
RootViewControllerCoordinator.sharedPresenter.rootViewController.present(editorViewController, animated: false)
}

// MARK: - Preview

func openPreview(for apost: AbstractPost) {
WPTabBarController.sharedInstance().showMySitesTab()
RootViewControllerCoordinator.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 = RootViewControllerCoordinator.sharedPresenter.rootViewController
if rootViewController.traitCollection.userInterfaceIdiom == .pad {
navWrapper.modalPresentationStyle = .fullScreen
}
WPTabBarController.sharedInstance().present(navWrapper, animated: true)
rootViewController.present(navWrapper, animated: true)

openListView(for: apost)
}
Expand All @@ -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 = RootViewControllerCoordinator.sharedPresenter.rootViewController
guard let navController = rootViewController.presentedViewController as? UINavigationController else {
return
}

Expand All @@ -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 = RootViewControllerCoordinator.sharedPresenter.rootViewController
guard let navController = rootViewController.presentedViewController as? UINavigationController,
navController.topViewController is PreviewWebKitViewController else {
return
}
Expand Down