From b882d628e71c03d4e583f0e00998bf129c432ea1 Mon Sep 17 00:00:00 2001 From: Vladimir Byko-Ianko Date: Wed, 24 Feb 2016 11:56:01 +0300 Subject: [PATCH] [new downloader] Review fixes. --- android/jni/com/mapswithme/maps/MapManager.cpp | 4 ++-- storage/storage.cpp | 2 +- storage/storage.hpp | 7 ++++--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/android/jni/com/mapswithme/maps/MapManager.cpp b/android/jni/com/mapswithme/maps/MapManager.cpp index 727adbf2e6..c67a0c0b8a 100644 --- a/android/jni/com/mapswithme/maps/MapManager.cpp +++ b/android/jni/com/mapswithme/maps/MapManager.cpp @@ -197,8 +197,8 @@ Java_com_mapswithme_maps_downloader_MapManager_nativeListItems(JNIEnv * env, jcl PutItemsToList(env, result, downloaded, parentId, ItemCategory::DOWNLOADED); // All - TCountriesVec children; - storage.GetChildren(parentId, children); + TCountriesVec children(downloaded.begin(), downloaded.end()); + children.insert(children.end(), available.begin(), available.end()); PutItemsToList(env, result, children, parentId, ItemCategory::ALL); } } diff --git a/storage/storage.cpp b/storage/storage.cpp index b0b2091ba7..fe0c0af488 100644 --- a/storage/storage.cpp +++ b/storage/storage.cpp @@ -1166,7 +1166,7 @@ void Storage::GetChildrenInGroups(TCountryId const & parent, child.ForEachDescendant([&](TCountriesContainer const & descendant) { TCountryId const & countryId = descendant.Value().Name(); - if (HasCountryId(localMaps, countryId)) + if (!hasDownloadedDescendant && HasCountryId(localMaps, countryId)) hasDownloadedDescendant = true; }); if (hasDownloadedDescendant == true) diff --git a/storage/storage.hpp b/storage/storage.hpp index 20db221ea1..cb66e33dcd 100644 --- a/storage/storage.hpp +++ b/storage/storage.hpp @@ -252,9 +252,10 @@ public: /// If not, the mwm id the child will not be added to |availChildren|. /// \param parent is a parent acoording to countries.txt or cournties_migrate.txt. /// \param downloadedChildren children partly or fully downloaded. - /// \param availChildren fully available children. No of its mwms have been downloaded. - /// \note. This method puts to localChildren only real maps which have been written in coutries.txt or cournties_migrate.txt. - /// It means the method does not put to localChildren neither custom maps generated by user + /// \param availChildren fully available children. None of its files have been downloaded. + /// \note. This method puts to |downloadedChildren| and |availChildren| only real maps (and its ancestors) + /// which have been written in coutries.txt or cournties_migrate.txt. + /// It means the method does not put to its params neither custom maps generated by user /// nor World.mwm and WorldCoasts.mwm. void GetChildrenInGroups(TCountryId const & parent, TCountriesVec & downloadedChildren, TCountriesVec & availChildren) const;