[place-page] [ios] Optimized place page layout routine.

This commit is contained in:
Ilya Grechuhin 2018-03-07 14:26:08 +03:00 committed by Vlad Mihaylenko
parent 96558e0bdc
commit bace567f8f
2 changed files with 23 additions and 20 deletions

View file

@ -141,18 +141,20 @@ map<MetainfoRows, Class> const kMetaInfoCells = {
if (_buttonsSectionEnabled == buttonsSectionEnabled)
return;
_buttonsSectionEnabled = buttonsSectionEnabled;
auto data = self.data;
auto tv = self.placePageView.tableView;
if (!data || !tv)
return;
dispatch_async(dispatch_get_main_queue(), ^{
auto data = self.data;
auto tv = self.placePageView.tableView;
if (!data || !tv)
return;
auto const & sections = data.sections;
auto const it = find(sections.begin(), sections.end(), place_page::Sections::Buttons);
if (it == sections.end())
return;
NSInteger const sectionNumber = distance(sections.begin(), it);
[tv reloadSections:[NSIndexSet indexSetWithIndex:sectionNumber]
withRowAnimation:UITableViewRowAnimationNone];
auto const & sections = data.sections;
auto const it = find(sections.begin(), sections.end(), place_page::Sections::Buttons);
if (it == sections.end())
return;
NSInteger const sectionNumber = distance(sections.begin(), it);
[tv reloadSections:[NSIndexSet indexSetWithIndex:sectionNumber]
withRowAnimation:UITableViewRowAnimationNone];
});
}
- (MWMPlacePageActionBar *)actionBar

View file

@ -357,17 +357,18 @@ array<Class, 8> const kPreviewCells = {{[_MWMPPPTitle class],
{
if (IPAD)
return;
dispatch_async(dispatch_get_main_queue(), ^{
auto data = self.data;
if (!data)
return;
auto data = self.data;
if (!data)
return;
CLS_LOG(@"layoutInOpenState\tisOpen:%@\tLatitude:%@\tLongitude:%@", @(isOpen),
@(data.latLon.lat), @(data.latLon.lon));
CLS_LOG(@"layoutInOpenState\tisOpen:%@\tLatitude:%@\tLongitude:%@", @(isOpen), @(data.latLon.lat),
@(data.latLon.lon));
[self.tableView update:^{
self.cachedBannerCell.state = isOpen ? MWMAdBannerStateDetailed : MWMAdBannerStateCompact;
}];
[self.tableView update:^{
self.cachedBannerCell.state = isOpen ? MWMAdBannerStateDetailed : MWMAdBannerStateCompact;
}];
});
}
- (MWMDirectionView *)directionView