Merge pull request #3000 from igrechuhin/MAPSME-943

[ios] Fixed zero update size display for leaf node.
This commit is contained in:
Sergey Yershov 2016-04-26 13:50:14 +04:00
commit 2300f9a9c3

View file

@ -263,11 +263,13 @@ using namespace mwm;
- (void)configAllMapsView
{
if (self.dataSource != self.defaultDataSource)
return;
auto const & s = GetFramework().Storage();
TCountryId const parentCountryId = self.parentCountryId.UTF8String;
if (self.mode == DownloaderMode::Downloaded)
if (self.dataSource != self.defaultDataSource)
{
self.showAllMapsButtons = NO;
}
else if (self.mode == DownloaderMode::Downloaded)
{
Storage::UpdateInfo updateInfo{};
s.GetUpdateInfo(parentCountryId, updateInfo);
@ -595,19 +597,10 @@ using namespace mwm;
if (buttons & UpdateAction)
{
TCountriesVec downloadedChildren;
TCountriesVec availableChildren;
s.GetChildrenInGroups(m_actionSheetId, downloadedChildren, availableChildren);
TMwmSize updateSize = 0;
for (TCountryId const & countryId : downloadedChildren)
{
NodeAttrs nodeAttrs;
s.GetNodeAttrs(countryId, nodeAttrs);
if (nodeAttrs.m_status == NodeStatus::OnDiskOutOfDate)
updateSize += nodeAttrs.m_mwmSize;
}
Storage::UpdateInfo updateInfo;
s.GetUpdateInfo(m_actionSheetId, updateInfo);
NSString * title = [NSString stringWithFormat:kAllMapsLabelFormat, kUpdateActionTitle,
formattedSize(updateSize)];
formattedSize(updateInfo.m_totalUpdateSizeInBytes)];
[actionSheet addButtonWithTitle:title];
UIAlertAction * action = [UIAlertAction actionWithTitle:title
style:UIAlertActionStyleDefault