[ios] Correct update size calculation.

This commit is contained in:
VladiMihaylenko 2017-05-10 14:49:30 +03:00 committed by r.kuznetsov
parent 065452ad43
commit abeba9a93c
3 changed files with 5 additions and 6 deletions

View file

@ -86,9 +86,9 @@ using namespace storage;
{
NodeAttrs nodeAttrs;
GetFramework().GetStorage().GetNodeAttrs(countryId, nodeAttrs);
return size + nodeAttrs.m_mwmSize - nodeAttrs.m_localMwmSize;
return size + nodeAttrs.m_mwmSize;
});
if (GetPlatform().GetWritableStorageStatus(requiredSize) == Platform::TStorageStatus::STORAGE_OK)
if (storage::IsEnoughSpaceForDownload(requiredSize))
{
[self checkConnectionAndPerformAction:[countryIds, onSuccess] {
auto & s = GetFramework().GetStorage();

View file

@ -80,7 +80,7 @@
case storage::NodeStatus::InQueue:
case storage::NodeStatus::Partly:
size = isModeDownloaded ? nodeAttrs.m_localMwmSize
: nodeAttrs.m_mwmSize - nodeAttrs.m_localMwmSize;
: nodeAttrs.m_mwmSize;
break;
case storage::NodeStatus::OnDisk: size = isModeDownloaded ? nodeAttrs.m_mwmSize : 0; break;
}

View file

@ -292,8 +292,7 @@ using namespace mwm;
self.allMapsButton.hidden = NO;
[self.allMapsButton
setTitle:[NSString stringWithFormat:kAllMapsLabelFormat, kDownloadAllActionTitle,
formattedSize(nodeAttrs.m_mwmSize -
nodeAttrs.m_localMwmSize)]
formattedSize(nodeAttrs.m_mwmSize)]
forState:UIControlStateNormal];
self.allMapsCancelButton.hidden = YES;
}
@ -570,7 +569,7 @@ using namespace mwm;
s.GetNodeAttrs(m_actionSheetId, nodeAttrs);
NSString * prefix = nodeAttrs.m_mwmCounter == 1 ? kDownloadActionTitle : kDownloadAllActionTitle;
NSString * title = [NSString stringWithFormat:kAllMapsLabelFormat, prefix,
formattedSize(nodeAttrs.m_mwmSize - nodeAttrs.m_localMwmSize)];
formattedSize(nodeAttrs.m_mwmSize)];
UIAlertAction * action = [UIAlertAction actionWithTitle:title
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action)