From e85947e86262ae943b42f9047b20a214bfcafbbc Mon Sep 17 00:00:00 2001 From: Ilya Grechuhin Date: Thu, 18 Feb 2016 12:53:41 +0300 Subject: [PATCH] [new downloader] Added reduced migration ability. --- map/framework.cpp | 10 +++++++--- map/framework.hpp | 4 ++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/map/framework.cpp b/map/framework.cpp index 2bda4bdaa9..9f3418c25e 100644 --- a/map/framework.cpp +++ b/map/framework.cpp @@ -240,7 +240,7 @@ bool Framework::IsEnoughSpaceForMigrate() const return GetPlatform().GetWritableStorageStatus(kSpaceSize) == Platform::TStorageStatus::STORAGE_OK; } -void Framework::PreMigrate(ms::LatLon const & position, +bool Framework::PreMigrate(ms::LatLon const & position, storage::Storage::TChangeCountryFunction const & change, storage::Storage::TProgressFunction const & progress) { @@ -251,11 +251,15 @@ void Framework::PreMigrate(ms::LatLon const & position, TCountryId currentCountryId = infoGetter.GetRegionCountryId(MercatorBounds::FromLatLon(position)); + if (currentCountryId == kInvalidCountryId) + return false; + Storage().m_prefetchStorage->Subscribe(change, progress); Storage().m_prefetchStorage->DownloadNode(currentCountryId); + return true; } -void Framework::Migrate() +void Framework::Migrate(bool keepDownloaded) { m_searchEngine.reset(); m_infoGetter.reset(); @@ -263,7 +267,7 @@ void Framework::Migrate() Storage().DeleteAllLocalMaps(&existedCountries); DeregisterAllMaps(); m_model.Clear(); - Storage().Migrate(existedCountries); + Storage().Migrate(keepDownloaded ? existedCountries : TCountriesVec()); InitCountryInfoGetter(); InitSearchEngine(); RegisterAllMaps(); diff --git a/map/framework.hpp b/map/framework.hpp index cb358f7571..796e618084 100644 --- a/map/framework.hpp +++ b/map/framework.hpp @@ -144,9 +144,9 @@ public: /// Migrate to new version of very different data. bool IsEnoughSpaceForMigrate() const; - void PreMigrate(ms::LatLon const & position, storage::Storage::TChangeCountryFunction const & change, + bool PreMigrate(ms::LatLon const & position, storage::Storage::TChangeCountryFunction const & change, storage::Storage::TProgressFunction const & progress); - void Migrate(); + void Migrate(bool keepDownloaded = true); void InitWatchFrameRenderer(float visualScale);