Skip to content

Commit ae358a7

Browse files
author
Momo Ozawa
committed
Refactor: scroll to cell if MSD is enabled
1 parent 9f10ae7 commit ae358a7

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

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

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1710,13 +1710,25 @@ - (void)scrollToElement:(QuickStartTourElement) element
17101710
{
17111711
int sectionCount = 0;
17121712
int rowCount = 0;
1713+
1714+
MySiteViewController *parentVC = (MySiteViewController *)self.parentViewController;
1715+
17131716
for (BlogDetailsSection *section in self.tableSections) {
17141717
rowCount = 0;
17151718
for (BlogDetailsRow *row in section.rows) {
17161719
if (row.quickStartIdentifier == element) {
1717-
self.additionalSafeAreaInsets = UIEdgeInsetsMake(0, 0, [BlogDetailsViewController bottomPaddingForQuickStartNotices], 0);
1720+
17181721
NSIndexPath *path = [NSIndexPath indexPathForRow:rowCount inSection:sectionCount];
1719-
[self.tableView scrollToRowAtIndexPath:path atScrollPosition:UITableViewScrollPositionTop animated:true];
1722+
1723+
if ([Feature enabled:FeatureFlagMySiteDashboard]) {
1724+
parentVC.additionalSafeAreaInsets = UIEdgeInsetsMake(0, 0, [BlogDetailsViewController bottomPaddingForQuickStartNotices], 0);
1725+
UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:path];
1726+
[parentVC.scrollView scrollToView:cell animated:true];
1727+
} else {
1728+
self.additionalSafeAreaInsets = UIEdgeInsetsMake(0, 0, [BlogDetailsViewController bottomPaddingForQuickStartNotices], 0);
1729+
[self.tableView scrollToRowAtIndexPath:path atScrollPosition:UITableViewScrollPositionTop animated:true];
1730+
}
1731+
17201732
}
17211733
rowCount++;
17221734
}

0 commit comments

Comments
 (0)