@@ -123,7 +123,7 @@ - (instancetype)initWithTitle:(NSString * __nonnull)title
123123 image: image
124124 callback: callback];
125125}
126-
126+
127127- (instancetype )initWithTitle : (NSString *)title
128128 accessibilityIdentifier : (NSString *)accessibilityIdentifier
129129 image : (UIImage *)image
@@ -195,16 +195,10 @@ - (instancetype)initWithTitle:(NSString * __nonnull)title
195195 _accessibilityHint = accessibilityHint;
196196 _showsSelectionState = YES ;
197197 _showsDisclosureIndicator = YES ;
198- _subsection = NSNotFound ;
199198 }
200199 return self;
201200}
202201
203- - (BlogDetailsRow *)withSubsection : (BlogDetailsSubsection)subsection {
204- _subsection = subsection;
205- return self;
206- }
207-
208202@end
209203
210204@implementation BlogDetailsSection
@@ -260,18 +254,18 @@ @implementation BlogDetailsViewController
260254- (instancetype )init
261255{
262256 self = [super init ];
263-
257+
264258 if (self) {
265259 self.isScrollEnabled = false ;
266260 }
267-
261+
268262 return self;
269263}
270264
271265- (void )viewDidLoad
272266{
273267 [super viewDidLoad ];
274-
268+
275269 if (self.isSidebarModeEnabled ) {
276270 _tableView = [[UITableView alloc ] initWithFrame: CGRectZero style: UITableViewStyleGrouped];
277271 } else if (self.isScrollEnabled ) {
@@ -289,7 +283,7 @@ - (void)viewDidLoad
289283 }
290284 [self .view addSubview: self .tableView];
291285 [self .view pinSubviewToAllEdges: self .tableView];
292-
286+
293287 UIRefreshControl *refreshControl = [UIRefreshControl new ];
294288 [refreshControl addTarget: self action: @selector (pulledToRefresh ) forControlEvents: UIControlEventValueChanged];
295289 self.tableView .refreshControl = refreshControl;
@@ -359,7 +353,7 @@ - (void)viewDidAppear:(BOOL)animated
359353 [WPAnalytics trackEvent: WPAnalyticsEventJetpackInstallFullPluginCardViewed
360354 properties: @{WPAppAnalyticsKeyTabSource: @" site_menu" }];
361355 }
362-
356+
363357 if ([self shouldShowBlaze ]) {
364358 [BlazeEventsTracker trackEntryPointDisplayedFor: BlazeSourceMenuItem];
365359 }
@@ -396,7 +390,7 @@ - (void)handleTraitChanges
396390 [self reloadTableViewPreservingSelection ];
397391}
398392
399- - (void )showDetailViewForSubsection : (BlogDetailsSubsection)section
393+ - (void )showDetailViewForSubsection : (BlogDetailsSubsection)section
400394{
401395 [self showDetailViewForSubsection: section userInfo: @{}];
402396}
@@ -646,16 +640,6 @@ - (SiteIconPickerPresenter *)siteIconPickerPresenter
646640 return _siteIconPickerPresenter;
647641}
648642
649- - (BlogDetailsSubsection)selectedSubsection {
650- NSIndexPath *indexPath = self.tableView .indexPathForSelectedRow ;
651- if (!indexPath) {
652- return NSNotFound ;
653- }
654- BlogDetailsSection *section = [self .tableSections objectAtIndex: indexPath.section];
655- BlogDetailsRow *row = [section.rows objectAtIndex: indexPath.row];
656- return row.subsection ;
657- }
658-
659643#pragma mark - iOS 10 bottom padding
660644
661645- (CGFloat)tableView : (UITableView *)tableView heightForFooterInSection : (NSInteger )sectionNum {
@@ -700,59 +684,59 @@ - (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger
700684- (BlogDetailsRow *)postsRow
701685{
702686 __weak __typeof (self) weakSelf = self;
703- BlogDetailsRow *row = [[[ BlogDetailsRow alloc ] initWithTitle: NSLocalizedString(@" Posts" , @" Noun. Title. Links to the blog's Posts screen." )
704- accessibilityIdentifier: @" Blog Post Row"
705- image: [[UIImage imageNamed: @" site-menu-posts" ] imageFlippedForRightToLeftLayoutDirection ]
706- callback: ^{
707- [weakSelf showPostListFromSource: BlogDetailsNavigationSourceRow];
708- }] withSubsection: BlogDetailsSubsectionPosts ];
687+ BlogDetailsRow *row = [[BlogDetailsRow alloc ] initWithTitle: NSLocalizedString(@" Posts" , @" Noun. Title. Links to the blog's Posts screen." )
688+ accessibilityIdentifier: @" Blog Post Row"
689+ image: [[UIImage imageNamed: @" site-menu-posts" ] imageFlippedForRightToLeftLayoutDirection ]
690+ callback: ^{
691+ [weakSelf showPostListFromSource: BlogDetailsNavigationSourceRow];
692+ } ];
709693 return row;
710694}
711695
712696- (BlogDetailsRow *)pagesRow
713697{
714698 __weak __typeof (self) weakSelf = self;
715- BlogDetailsRow *row = [[[ BlogDetailsRow alloc ] initWithTitle: NSLocalizedString(@" Pages" , @" Noun. Title. Links to the blog's Pages screen." )
716- accessibilityIdentifier: @" Site Pages Row"
717- image: [UIImage imageNamed: @" site-menu-pages" ]
718- callback: ^{
719- [weakSelf showPageListFromSource: BlogDetailsNavigationSourceRow];
720- }] withSubsection: BlogDetailsSubsectionPages] ;
699+ BlogDetailsRow *row = [[BlogDetailsRow alloc ] initWithTitle: NSLocalizedString(@" Pages" , @" Noun. Title. Links to the blog's Pages screen." )
700+ accessibilityIdentifier: @" Site Pages Row"
701+ image: [UIImage imageNamed: @" site-menu-pages" ]
702+ callback: ^{
703+ [weakSelf showPageListFromSource: BlogDetailsNavigationSourceRow];
704+ }];
721705 return row;
722706}
723707
724708- (BlogDetailsRow *)mediaRow
725709{
726710 __weak __typeof (self) weakSelf = self;
727- BlogDetailsRow *row = [[[ BlogDetailsRow alloc ] initWithTitle: NSLocalizedString(@" Media" , @" Noun. Title. Links to the blog's Media library." )
728- accessibilityIdentifier: @" Media Row"
729- image: [UIImage imageNamed: @" site-menu-media" ]
730- callback: ^{
731- [weakSelf showMediaLibraryFromSource: BlogDetailsNavigationSourceRow];
732- }] withSubsection: BlogDetailsSubsectionMedia ];
711+ BlogDetailsRow *row = [[BlogDetailsRow alloc ] initWithTitle: NSLocalizedString(@" Media" , @" Noun. Title. Links to the blog's Media library." )
712+ accessibilityIdentifier: @" Media Row"
713+ image: [UIImage imageNamed: @" site-menu-media" ]
714+ callback: ^{
715+ [weakSelf showMediaLibraryFromSource: BlogDetailsNavigationSourceRow];
716+ } ];
733717 return row;
734718}
735719
736720- (BlogDetailsRow *)commentsRow
737721{
738722 __weak __typeof (self) weakSelf = self;
739- BlogDetailsRow *row = [[[ BlogDetailsRow alloc ] initWithTitle: NSLocalizedString(@" Comments" , @" Noun. Title. Links to the blog's Comments screen." )
740- image: [[UIImage imageNamed: @" site-menu-comments" ] imageFlippedForRightToLeftLayoutDirection ]
741- callback: ^{
742- [weakSelf showCommentsFromSource: BlogDetailsNavigationSourceRow];
743- }] withSubsection: BlogDetailsSubsectionComments ];
723+ BlogDetailsRow *row = [[BlogDetailsRow alloc ] initWithTitle: NSLocalizedString(@" Comments" , @" Noun. Title. Links to the blog's Comments screen." )
724+ image: [[UIImage imageNamed: @" site-menu-comments" ] imageFlippedForRightToLeftLayoutDirection ]
725+ callback: ^{
726+ [weakSelf showCommentsFromSource: BlogDetailsNavigationSourceRow];
727+ } ];
744728 return row;
745729}
746730
747731- (BlogDetailsRow *)statsRow
748732{
749733 __weak __typeof (self) weakSelf = self;
750- BlogDetailsRow *statsRow = [[[ BlogDetailsRow alloc ] initWithTitle: NSLocalizedString(@" Stats" , @" Noun. Abbv. of Statistics. Links to a blog's Stats screen." )
751- accessibilityIdentifier: @" Stats Row"
752- image: [UIImage imageNamed: @" site-menu-stats" ]
753- callback: ^{
754- [weakSelf showStatsFromSource: BlogDetailsNavigationSourceRow];
755- }] withSubsection: BlogDetailsSubsectionStats ];
734+ BlogDetailsRow *statsRow = [[BlogDetailsRow alloc ] initWithTitle: NSLocalizedString(@" Stats" , @" Noun. Abbv. of Statistics. Links to a blog's Stats screen." )
735+ accessibilityIdentifier: @" Stats Row"
736+ image: [UIImage imageNamed: @" site-menu-stats" ]
737+ callback: ^{
738+ [weakSelf showStatsFromSource: BlogDetailsNavigationSourceRow];
739+ } ];
756740 return statsRow;
757741}
758742
@@ -1040,7 +1024,7 @@ - (void)configureTableViewData
10401024 if ([self .blog supports: BlogFeatureRemovable]) {
10411025 [marr addNullableObject: [self removeSiteSectionViewModel ]];
10421026 }
1043-
1027+
10441028 if (self.shouldShowBottomJetpackBrandingMenuCard == YES ) {
10451029 [marr addNullableObject: [self jetpackCardSectionViewModel ]];
10461030 }
@@ -1185,13 +1169,13 @@ - (BlogDetailsSection *)homeSectionViewModel
11851169{
11861170 __weak __typeof (self) weakSelf = self;
11871171 NSMutableArray *rows = [NSMutableArray array ];
1188-
1189- [rows addObject: [[[ BlogDetailsRow alloc ] initWithTitle: NSLocalizedString(@" Home" , @" Noun. Links to a blog's dashboard screen." )
1172+
1173+ [rows addObject: [[BlogDetailsRow alloc ] initWithTitle: NSLocalizedString(@" Home" , @" Noun. Links to a blog's dashboard screen." )
11901174 accessibilityIdentifier: @" Home Row"
11911175 image: [UIImage imageNamed: @" site-menu-home" ]
11921176 callback: ^{
11931177 [weakSelf showDashboard ];
1194- }] withSubsection: BlogDetailsSubsectionHome ]];
1178+ } ]];
11951179
11961180 return [[BlogDetailsSection alloc ] initWithTitle: nil andRows: rows category: BlogDetailsSectionCategoryHome];
11971181}
@@ -1200,7 +1184,7 @@ - (BlogDetailsSection *)generalSectionViewModel
12001184{
12011185 __weak __typeof (self) weakSelf = self;
12021186 NSMutableArray *rows = [NSMutableArray array ];
1203-
1187+
12041188 if ([self .blog isViewingStatsAllowed ]) {
12051189 [rows addObject: [self statsRow ]];
12061190 }
@@ -1212,7 +1196,7 @@ - (BlogDetailsSection *)generalSectionViewModel
12121196 [weakSelf showActivity ];
12131197 }]];
12141198 }
1215-
1199+
12161200 if ([self shouldShowBlaze ]) {
12171201 [rows addObject: [self blazeRow ]];
12181202 }
@@ -1233,15 +1217,15 @@ - (BlogDetailsSection *)generalSectionViewModel
12331217 if (rows.count == 0 ) {
12341218 return nil ;
12351219 }
1236-
1220+
12371221 return [[BlogDetailsSection alloc ] initWithTitle: nil andRows: rows category: BlogDetailsSectionCategoryGeneral];
12381222}
12391223
12401224- (BlogDetailsSection *)jetpackSectionViewModel
12411225{
12421226 __weak __typeof (self) weakSelf = self;
12431227 NSMutableArray *rows = [NSMutableArray array ];
1244-
1228+
12451229 if ([self .blog isViewingStatsAllowed ]) {
12461230 [rows addObject: [self statsRow ]];
12471231 }
@@ -1285,7 +1269,7 @@ - (BlogDetailsSection *)jetpackSectionViewModel
12851269
12861270 [rows addObject: settingsRow];
12871271 }
1288-
1272+
12891273 if ([self shouldShowBlaze ]) {
12901274 [rows addObject: [self blazeRow ]];
12911275 }
@@ -1345,7 +1329,7 @@ - (BlogDetailsSection *)configurationSectionViewModel
13451329{
13461330 __weak __typeof (self) weakSelf = self;
13471331 NSMutableArray *rows = [NSMutableArray array ];
1348-
1332+
13491333 if ([self shouldAddMeRow ]) {
13501334 BlogDetailsRow *row = [[BlogDetailsRow alloc ] initWithTitle: NSLocalizedString(@" Me" , @" Noun. Title. Links to the Me screen." )
13511335 image: [UIImage gridiconOfType: GridiconTypeUserCircle]
@@ -1660,9 +1644,9 @@ - (NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(no
16601644#pragma mark - Private methods
16611645
16621646- (void )trackEvent : (WPAnalyticsStat)event fromSource : (BlogDetailsNavigationSource)source {
1663-
1647+
16641648 NSString *sourceString = [self propertiesStringForSource: source];
1665-
1649+
16661650 [WPAppAnalytics track: event withProperties: @{WPAppAnalyticsKeyTapSource: sourceString, WPAppAnalyticsKeyTabSource: @" site_menu" } withBlog: self .blog];
16671651}
16681652
@@ -1956,7 +1940,7 @@ - (void)showMenus
19561940- (void )showViewSiteFromSource : (BlogDetailsNavigationSource)source
19571941{
19581942 [self trackEvent: WPAnalyticsStatOpenedViewSite fromSource: source];
1959-
1943+
19601944 NSURL *targetURL = [NSURL URLWithString: self .blog.homeURL];
19611945
19621946 UIViewController *webViewController = [WebViewControllerFactory controllerWithUrl: targetURL
@@ -2033,7 +2017,7 @@ - (void)confirmRemoveSite
20332017 if ([AppConfiguration isWordPress ]) {
20342018 [ContentMigrationCoordinator.shared cleanupExportedDataIfNeeded ];
20352019 }
2036-
2020+
20372021 // Delete local data after removing the last site
20382022 if (!AccountHelper.isLoggedIn ) {
20392023 [AccountHelper deleteAccountData ];
0 commit comments