Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVlad Mihaylenko <vxmihaylenko@gmail.com>2017-02-02 17:51:29 +0300
committerGitHub <noreply@github.com>2017-02-02 17:51:29 +0300
commit5e7fd698e42f72a7c7c9dfac46620c77235c78f7 (patch)
tree5a008c7031ebdc3acae392275e430a020b38d699
parent0eb8e8e9d7b0ddc5b3848008ad6ad1dc6cda08ff (diff)
parent00efcf85aa4325bb4012fa56b56f533c660079b7 (diff)
Merge pull request #5342 from syershov/MAPSME-3753beta-606
Fixed calculation of size in downloader
-rw-r--r--iphone/Maps/UI/Downloader/Cells/MWMMapDownloaderTableViewCell.mm25
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);
}