Skip to content

Commit b75d847

Browse files
Update: Do not show stats on iPads
1 parent 85bf735 commit b75d847

File tree

2 files changed

+38
-11
lines changed

2 files changed

+38
-11
lines changed

WordPress/Classes/ViewRelated/Blog/Blog Details/BlogDetailsViewController+SectionHelpers.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,20 @@ extension BlogDetailsViewController {
4040
return subsection.sectionCategory(for: blog)
4141
}
4242

43+
@objc func defaultSubsection() -> BlogDetailsSubsection {
44+
if JetpackFeaturesRemovalCoordinator.shouldRemoveJetpackFeatures() {
45+
return .posts
46+
}
47+
if shouldShowDashboard() {
48+
return .home
49+
}
50+
return .stats
51+
}
52+
53+
@objc func shouldShowStats() -> Bool {
54+
return JetpackFeaturesRemovalCoordinator.jetpackFeaturesEnabled()
55+
}
56+
4357
@objc func shouldAddJetpackSection() -> Bool {
4458
guard JetpackFeaturesRemovalCoordinator.jetpackFeaturesEnabled() else {
4559
return false

WordPress/Classes/ViewRelated/Blog/Blog Details/BlogDetailsViewController.m

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,7 @@ - (NSIndexPath *)restorableSelectedIndexPath
599599
{
600600
if (!_restorableSelectedIndexPath) {
601601
// If nil, default to stats subsection.
602-
BlogDetailsSubsection subsection = [self shouldShowDashboard] ? BlogDetailsSubsectionHome : BlogDetailsSubsectionStats;
602+
BlogDetailsSubsection subsection = [self defaultSubsection];
603603
self.selectedSectionCategory = [self sectionCategoryWithSubsection:subsection blog: self.blog];
604604
NSUInteger section = [self findSectionIndexWithSections:self.tableSections category:self.selectedSectionCategory];
605605
_restorableSelectedIndexPath = [NSIndexPath indexPathForRow:0 inSection:section];
@@ -703,7 +703,7 @@ - (void)reloadTableViewPreservingSelection
703703
case BlogDetailsSectionCategoryQuickStart:
704704
case BlogDetailsSectionCategoryJetpackBrandingCard:
705705
case BlogDetailsSectionCategoryDomainCredit: {
706-
BlogDetailsSubsection subsection = [self shouldShowDashboard] ? BlogDetailsSubsectionHome : BlogDetailsSubsectionStats;
706+
BlogDetailsSubsection subsection = [self defaultSubsection];
707707
BlogDetailsSectionCategory category = [self sectionCategoryWithSubsection:subsection blog: self.blog];
708708
sectionIndex = [self findSectionIndexWithSections:self.tableSections category:category];
709709
}
@@ -1113,11 +1113,19 @@ - (void)showInitialDetailsForBlog
11131113

11141114
WPSplitViewController *splitViewController = (WPSplitViewController *)self.splitViewController;
11151115
splitViewController.isShowingInitialDetail = YES;
1116-
1117-
if ([self shouldShowDashboard]) {
1118-
[self showDetailViewForSubsection:BlogDetailsSubsectionHome];
1119-
} else {
1120-
[self showDetailViewForSubsection:BlogDetailsSubsectionStats];
1116+
BlogDetailsSubsection subsection = [self defaultSubsection];
1117+
switch (subsection) {
1118+
case BlogDetailsSubsectionHome:
1119+
[self showDetailViewForSubsection:BlogDetailsSubsectionHome];
1120+
break;
1121+
case BlogDetailsSubsectionStats:
1122+
[self showDetailViewForSubsection:BlogDetailsSubsectionStats];
1123+
break;
1124+
case BlogDetailsSubsectionPosts:
1125+
[self showDetailViewForSubsection: BlogDetailsSubsectionPosts];
1126+
break;
1127+
default:
1128+
break;
11211129
}
11221130
}
11231131

@@ -1744,10 +1752,15 @@ - (void)handleDataModelChange:(NSNotification *)note
17441752

17451753
- (UIViewController *)initialDetailViewControllerForSplitView:(WPSplitViewController *)splitView
17461754
{
1747-
StatsViewController *statsView = [StatsViewController new];
1748-
statsView.blog = self.blog;
1749-
1750-
return statsView;
1755+
if ([self shouldShowStats]) {
1756+
StatsViewController *statsView = [StatsViewController new];
1757+
statsView.blog = self.blog;
1758+
return statsView;
1759+
} else {
1760+
PostListViewController *postsView = [PostListViewController controllerWithBlog:self.blog];
1761+
postsView.navigationItem.largeTitleDisplayMode = UINavigationItemLargeTitleDisplayModeNever;
1762+
return postsView;
1763+
}
17511764
}
17521765

17531766
#pragma mark - UIViewControllerTransitioningDelegate

0 commit comments

Comments
 (0)