[Old map downloader] Fix bug with fast migrate

This commit is contained in:
Sergey Yershov 2016-01-25 12:35:01 +03:00
parent 12b2911271
commit fc55aef503
3 changed files with 13 additions and 9 deletions

View file

@ -529,8 +529,17 @@ void Framework::RegisterAllMaps()
m_storage.RegisterAllLocalMaps();
// Fast migrate if possible.
if(platform::migrate::NeedMigrate())
m_storage.FastMigrateIfPossible();
{
bool disableFastMigrate = false;
Settings::Get("DisableFastMigrate", disableFastMigrate);
if(!disableFastMigrate && m_storage.HaveDownloadedCountries())
{
Migrate();
return;
}
}
int minFormat = numeric_limits<int>::max();

View file

@ -106,14 +106,9 @@ void Storage::Clear()
m_localFilesForFakeCountries.clear();
}
void Storage::FastMigrateIfPossible()
bool Storage::HaveDownloadedCountries()
{
bool disableFastMigrate = false;
Settings::Get("DisableFastMigrate", disableFastMigrate);
if(!disableFastMigrate && platform::migrate::NeedMigrate() && m_localFiles.empty())
{
Migrate();
}
return !m_localFiles.empty();
}
void Storage::Migrate()

View file

@ -112,7 +112,7 @@ public:
/// Switch on new storage version, remove old mwm
/// and add required mwm's into download queue.
void Migrate();
void FastMigrateIfPossible();
bool HaveDownloadedCountries();
void DeleteAllLocalMaps(vector<TIndex> * existedCountries = nullptr);
// Clears local files registry and downloader's queue.