From 53aca94a7aed32c9e54e91975b0d503bddf7cf0a Mon Sep 17 00:00:00 2001 From: Sergey Yershov Date: Mon, 16 May 2016 11:55:39 +0300 Subject: [PATCH 1/4] [downloader] Hide zero sizes for downloaded nodes --- .../MapDownloader/Cells/MWMMapDownloaderTableViewCell.mm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/iphone/Maps/Classes/MapDownloader/Cells/MWMMapDownloaderTableViewCell.mm b/iphone/Maps/Classes/MapDownloader/Cells/MWMMapDownloaderTableViewCell.mm index 38f245a7dc..ba96079ed0 100644 --- a/iphone/Maps/Classes/MapDownloader/Cells/MWMMapDownloaderTableViewCell.mm +++ b/iphone/Maps/Classes/MapDownloader/Cells/MWMMapDownloaderTableViewCell.mm @@ -80,8 +80,9 @@ namespace unselectedAttrs:kUnselectedTitleAttrs]; TMwmSize const size = self.mode == mwm::DownloaderMode::Downloaded ? nodeAttrs.m_downloadingMwmSize - : nodeAttrs.m_mwmSize - nodeAttrs.m_downloadingMwmSize; + : nodeAttrs.m_mwmSize - nodeAttrs.m_localMwmSize; self.downloadSize.text = formattedSize(size); + self.downloadSize.hidden = (size == 0); } - (void)configProgress:(storage::NodeAttrs const &)nodeAttrs From 60d31564956b5e32ed1b5fe0504e227f3b9b0a82 Mon Sep 17 00:00:00 2001 From: Sergey Yershov Date: Mon, 16 May 2016 14:02:07 +0300 Subject: [PATCH 2/4] [downloader] Fix integration tests --- storage/storage_integration_tests/storage_http_tests.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage/storage_integration_tests/storage_http_tests.cpp b/storage/storage_integration_tests/storage_http_tests.cpp index 3df357b072..0e15bc889a 100644 --- a/storage/storage_integration_tests/storage_http_tests.cpp +++ b/storage/storage_integration_tests/storage_http_tests.cpp @@ -173,7 +173,7 @@ UNIT_CLASS_TEST(StorageHttpTest, StorageDownloadAndDeleteDisputedNode) TCountriesVec const expectedDownloadedChildren = {"Argentina", kDisputedCountryId2, kDisputedCountryId1}; TEST_EQUAL(downloadedChildren, expectedDownloadedChildren, ()); - TEST_EQUAL(availChildren.size(), 224, ()); + TEST_EQUAL(availChildren.size(), 223, ()); m_storage.DeleteNode(kDisputedCountryId1); m_storage.DeleteNode(kDisputedCountryId2); From 9806335ed9fe0819edc15bc40632f180327075c0 Mon Sep 17 00:00:00 2001 From: Sergey Yershov Date: Mon, 16 May 2016 14:08:27 +0300 Subject: [PATCH 3/4] [downloader] Set correct status if downloading failed --- storage/storage.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/storage/storage.cpp b/storage/storage.cpp index 79f2b55fea..4a6e889ada 100644 --- a/storage/storage.cpp +++ b/storage/storage.cpp @@ -397,6 +397,10 @@ Storage::TLocalFilePtr Storage::GetLatestLocalFile(TCountryId const & countryId) Status Storage::CountryStatus(TCountryId const & countryId) const { + // Check if this country has failed while downloading. + if (m_failedCountries.count(countryId) > 0) + return Status::EDownloadFailed; + // Check if we already downloading this country or have it in the queue if (IsCountryInQueue(countryId)) { @@ -406,10 +410,6 @@ Status Storage::CountryStatus(TCountryId const & countryId) const return Status::EInQueue; } - // Check if this country has failed while downloading. - if (m_failedCountries.count(countryId) > 0) - return Status::EDownloadFailed; - return Status::EUnknown; } From daba2c2673f195c9feffbb64a017796a863174cf Mon Sep 17 00:00:00 2001 From: Sergey Yershov Date: Mon, 16 May 2016 14:11:58 +0300 Subject: [PATCH 4/4] [downloader] Consider failed mwm as available for downloading --- storage/storage.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage/storage.cpp b/storage/storage.cpp index 4a6e889ada..0d4aee5c56 100644 --- a/storage/storage.cpp +++ b/storage/storage.cpp @@ -1198,7 +1198,7 @@ void Storage::GetChildrenInGroups(TCountryId const & parent, for (auto const & disputed : disputedTerritoriesAndStatus) allDisputedTerritories.push_back(disputed.first); - if (childStatus.status == NodeStatus::NotDownloaded) + if (childStatus.status == NodeStatus::NotDownloaded || childStatus.status == NodeStatus::Error) { availChildren.push_back(childValue); for (auto const & disputed : disputedTerritoriesAndStatus)