Skip to content
Merged
Changes from all commits
Commits
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
14 changes: 14 additions & 0 deletions WordPress/Classes/System/Root View/SplitViewRootPresenter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,11 @@ extension SplitViewRootPresenter: UISplitViewControllerDelegate {

// TODO: refactor this
func splitViewControllerDidCollapse(_ svc: UISplitViewController) {
// Make sure the tab bar controller (displayed in compact mode) shows the same blog as the one in split view.
if let blog = siteContent?.blog, tabBarVC.mySitesCoordinator.currentBlog != siteContent?.blog {
tabBarVC.mySitesCoordinator.showBlogDetails(for: blog)
}

switch sidebarViewModel.selection {
case .blog:
break
Expand Down Expand Up @@ -340,6 +345,15 @@ extension SplitViewRootPresenter: UISplitViewControllerDelegate {
break
}
}

func splitViewControllerDidExpand(_ svc: UISplitViewController) {
// Make sure the split view shows the same blog as the tab bar controller (displayed in the compact mode)
if let blog = tabBarVC.mySitesCoordinator.currentBlog,
case let .blog(blogID) = sidebarViewModel.selection,
blog.objectID != blogID.objectID {
sidebarViewModel.selection = .blog(TaggedManagedObjectID(blog))
}
}
}

// MARK: - Content displayed within the split view, alongside the sidebar
Expand Down