diff --git a/WordPress/Classes/ViewRelated/Blog/Blog Dashboard/BlogDashboardViewController.swift b/WordPress/Classes/ViewRelated/Blog/Blog Dashboard/BlogDashboardViewController.swift index 9326a17f7086..79018c6f4221 100644 --- a/WordPress/Classes/ViewRelated/Blog/Blog Dashboard/BlogDashboardViewController.swift +++ b/WordPress/Classes/ViewRelated/Blog/Blog Dashboard/BlogDashboardViewController.swift @@ -21,6 +21,11 @@ final class BlogDashboardViewController: UIViewController { return collectionView }() + /// The "My Site" main scroll view + var mySiteScrollView: UIScrollView? { + return view.superview?.superview as? UIScrollView + } + @objc init(blog: Blog) { self.blog = blog super.init(nibName: nil, bundle: nil) diff --git a/WordPress/Classes/ViewRelated/Blog/Blog Dashboard/ViewModel/BlogDashboardViewModel.swift b/WordPress/Classes/ViewRelated/Blog/Blog Dashboard/ViewModel/BlogDashboardViewModel.swift index fe2cdb0cf16c..390f8af0301f 100644 --- a/WordPress/Classes/ViewRelated/Blog/Blog Dashboard/ViewModel/BlogDashboardViewModel.swift +++ b/WordPress/Classes/ViewRelated/Blog/Blog Dashboard/ViewModel/BlogDashboardViewModel.swift @@ -81,7 +81,22 @@ class BlogDashboardViewModel { private extension BlogDashboardViewModel { func apply(snapshot: DashboardSnapshot) { - dataSource?.apply(snapshot, animatingDifferences: false) + let scrollView = viewController?.mySiteScrollView + let position = scrollView?.contentOffset + + dataSource?.apply(snapshot, animatingDifferences: false) { [weak self] in + guard let scrollView = scrollView, let position = position else { + return + } + + self?.scroll(scrollView, to: position) + } + } + + func scroll(_ scrollView: UIScrollView, to position: CGPoint) { + if position.y > 0 { + scrollView.setContentOffset(position, animated: false) + } } }