@@ -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
@@ -1036,7 +1020,7 @@ - (void)configureTableViewData
10361020 if ([self .blog supports: BlogFeatureRemovable]) {
10371021 [marr addNullableObject: [self removeSiteSectionViewModel ]];
10381022 }
1039-
1023+
10401024 if (self.shouldShowBottomJetpackBrandingMenuCard == YES ) {
10411025 [marr addNullableObject: [self jetpackCardSectionViewModel ]];
10421026 }
@@ -1178,13 +1162,13 @@ - (BlogDetailsSection *)homeSectionViewModel
11781162{
11791163 __weak __typeof (self) weakSelf = self;
11801164 NSMutableArray *rows = [NSMutableArray array ];
1181-
1182- [rows addObject: [[[ BlogDetailsRow alloc ] initWithTitle: NSLocalizedString(@" Home" , @" Noun. Links to a blog's dashboard screen." )
1165+
1166+ [rows addObject: [[BlogDetailsRow alloc ] initWithTitle: NSLocalizedString(@" Home" , @" Noun. Links to a blog's dashboard screen." )
11831167 accessibilityIdentifier: @" Home Row"
11841168 image: [UIImage imageNamed: @" site-menu-home" ]
11851169 callback: ^{
11861170 [weakSelf showDashboard ];
1187- }] withSubsection: BlogDetailsSubsectionHome ]];
1171+ } ]];
11881172
11891173 return [[BlogDetailsSection alloc ] initWithTitle: nil andRows: rows category: BlogDetailsSectionCategoryHome];
11901174}
@@ -1193,7 +1177,7 @@ - (BlogDetailsSection *)generalSectionViewModel
11931177{
11941178 __weak __typeof (self) weakSelf = self;
11951179 NSMutableArray *rows = [NSMutableArray array ];
1196-
1180+
11971181 if ([self .blog isViewingStatsAllowed ]) {
11981182 [rows addObject: [self statsRow ]];
11991183 }
@@ -1205,7 +1189,7 @@ - (BlogDetailsSection *)generalSectionViewModel
12051189 [weakSelf showActivity ];
12061190 }]];
12071191 }
1208-
1192+
12091193 if ([self shouldShowBlaze ]) {
12101194 [rows addObject: [self blazeRow ]];
12111195 }
@@ -1226,15 +1210,15 @@ - (BlogDetailsSection *)generalSectionViewModel
12261210 if (rows.count == 0 ) {
12271211 return nil ;
12281212 }
1229-
1213+
12301214 return [[BlogDetailsSection alloc ] initWithTitle: nil andRows: rows category: BlogDetailsSectionCategoryGeneral];
12311215}
12321216
12331217- (BlogDetailsSection *)jetpackSectionViewModel
12341218{
12351219 __weak __typeof (self) weakSelf = self;
12361220 NSMutableArray *rows = [NSMutableArray array ];
1237-
1221+
12381222 if ([self .blog isViewingStatsAllowed ]) {
12391223 [rows addObject: [self statsRow ]];
12401224 }
@@ -1278,7 +1262,7 @@ - (BlogDetailsSection *)jetpackSectionViewModel
12781262
12791263 [rows addObject: settingsRow];
12801264 }
1281-
1265+
12821266 if ([self shouldShowBlaze ]) {
12831267 [rows addObject: [self blazeRow ]];
12841268 }
@@ -1338,7 +1322,7 @@ - (BlogDetailsSection *)configurationSectionViewModel
13381322{
13391323 __weak __typeof (self) weakSelf = self;
13401324 NSMutableArray *rows = [NSMutableArray array ];
1341-
1325+
13421326 if ([self shouldAddMeRow ]) {
13431327 BlogDetailsRow *row = [[BlogDetailsRow alloc ] initWithTitle: NSLocalizedString(@" Me" , @" Noun. Title. Links to the Me screen." )
13441328 image: [UIImage gridiconOfType: GridiconTypeUserCircle]
@@ -1643,9 +1627,9 @@ - (NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(no
16431627#pragma mark - Private methods
16441628
16451629- (void )trackEvent : (WPAnalyticsStat)event fromSource : (BlogDetailsNavigationSource)source {
1646-
1630+
16471631 NSString *sourceString = [self propertiesStringForSource: source];
1648-
1632+
16491633 [WPAppAnalytics track: event withProperties: @{WPAppAnalyticsKeyTapSource: sourceString, WPAppAnalyticsKeyTabSource: @" site_menu" } withBlog: self .blog];
16501634}
16511635
@@ -1939,7 +1923,7 @@ - (void)showMenus
19391923- (void )showViewSiteFromSource : (BlogDetailsNavigationSource)source
19401924{
19411925 [self trackEvent: WPAnalyticsStatOpenedViewSite fromSource: source];
1942-
1926+
19431927 NSURL *targetURL = [NSURL URLWithString: self .blog.homeURL];
19441928
19451929 UIViewController *webViewController = [WebViewControllerFactory controllerWithUrl: targetURL
@@ -2016,7 +2000,7 @@ - (void)confirmRemoveSite
20162000 if ([AppConfiguration isWordPress ]) {
20172001 [ContentMigrationCoordinator.shared cleanupExportedDataIfNeeded ];
20182002 }
2019-
2003+
20202004 // Delete local data after removing the last site
20212005 if (!AccountHelper.isLoggedIn ) {
20222006 [AccountHelper deleteAccountData ];
0 commit comments