diff options
author | Sergey Yershov <syershov@maps.me> | 2017-02-02 14:03:47 +0300 |
---|---|---|
committer | Sergey Yershov <syershov@maps.me> | 2017-02-02 15:22:25 +0300 |
commit | 00efcf85aa4325bb4012fa56b56f533c660079b7 (patch) | |
tree | 3e2527b533078a1e809ed9ffd517da2535b68900 /iphone | |
parent | 79c0ce5180521a58284514a5a7332492d486f0ed (diff) |
Fixed calculation of size in downloader
Diffstat (limited to 'iphone')
-rw-r--r-- | iphone/Maps/UI/Downloader/Cells/MWMMapDownloaderTableViewCell.mm | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/iphone/Maps/UI/Downloader/Cells/MWMMapDownloaderTableViewCell.mm b/iphone/Maps/UI/Downloader/Cells/MWMMapDownloaderTableViewCell.mm index d8772760e6..4178aab7d3 100644 --- a/iphone/Maps/UI/Downloader/Cells/MWMMapDownloaderTableViewCell.mm +++ b/iphone/Maps/UI/Downloader/Cells/MWMMapDownloaderTableViewCell.mm @@ -61,9 +61,30 @@ self.title.attributedText = [self matchedString:@(nodeAttrs.m_nodeLocalName.c_str()) selectedAttrs:selectedTitleAttrs unselectedAttrs:unselectedTitleAttrs]; - TMwmSize const size = self.mode == mwm::DownloaderMode::Downloaded - ? nodeAttrs.m_downloadingMwmSize + + TMwmSize size = nodeAttrs.m_mwmSize; + bool const isModeDownloaded = self.mode == mwm::DownloaderMode::Downloaded; + + switch (nodeAttrs.m_status) + { + case storage::NodeStatus::Error: + case storage::NodeStatus::Undefined: + case storage::NodeStatus::NotDownloaded: + case storage::NodeStatus::OnDiskOutOfDate: + size = isModeDownloaded ? nodeAttrs.m_localMwmSize : nodeAttrs.m_mwmSize; + break; + case storage::NodeStatus::Downloading: + size = isModeDownloaded ? nodeAttrs.m_downloadingMwmSize + : nodeAttrs.m_mwmSize - nodeAttrs.m_downloadingMwmSize; + break; + case storage::NodeStatus::InQueue: + case storage::NodeStatus::Partly: + size = isModeDownloaded ? nodeAttrs.m_localMwmSize : nodeAttrs.m_mwmSize - nodeAttrs.m_localMwmSize; + break; + case storage::NodeStatus::OnDisk: size = isModeDownloaded ? nodeAttrs.m_mwmSize : 0; break; + } + self.downloadSize.text = formattedSize(size); self.downloadSize.hidden = (size == 0); } |