diff --git a/storage/storage.cpp b/storage/storage.cpp index 37f45219e2..bcdf159f94 100644 --- a/storage/storage.cpp +++ b/storage/storage.cpp @@ -184,6 +184,7 @@ void Storage::PrefetchMigrateData() ASSERT_THREAD_CHECKER(m_threadChecker, ()); m_prefetchStorage.reset(new Storage(COUNTRIES_FILE, "migrate")); + m_prefetchStorage->EnableKeepDownloadingQueue(false); m_prefetchStorage->Init([](LocalCountryFile const &){}); if (!m_downloadingUrlsForTesting.empty()) m_prefetchStorage->SetDownloadingUrlsForTesting(m_downloadingUrlsForTesting); @@ -432,6 +433,9 @@ void Storage::SaveDownloadQueue() { ASSERT_THREAD_CHECKER(m_threadChecker, ()); + if (!m_keepDownloadingQueue) + return; + stringstream ss; for (auto const & item : m_queue) ss << (ss.str().empty() ? "" : ";") << item.GetCountryId(); @@ -440,6 +444,9 @@ void Storage::SaveDownloadQueue() void Storage::RestoreDownloadQueue() { + if (!m_keepDownloadingQueue) + return; + string queue; if (!Settings::Get("DownloadQueue", queue)) return; diff --git a/storage/storage.hpp b/storage/storage.hpp index 95468ac3a5..0d0687ee18 100644 --- a/storage/storage.hpp +++ b/storage/storage.hpp @@ -106,6 +106,10 @@ private: /// can call all the methods from a single thread using /// RunOnUIThread. If not, at least use a syncronization object. TQueue m_queue; + + // Keep downloading queue between application restarts. + bool m_keepDownloadingQueue = true; + /// Set of mwm files which have been downloaded recently. /// When a mwm file is downloaded it's moved from |m_queue| to |m_justDownloaded|. /// When a new mwm file is added to |m_queue| |m_justDownloaded| is cleared. @@ -402,6 +406,7 @@ public: bool IsDownloadInProgress() const; TCountryId GetCurrentDownloadingCountryId() const; + void EnableKeepDownloadingQueue(bool enable) {m_keepDownloadingQueue = enable;} /// get download url by countryId & options(first search file name by countryId, then format url) string GetFileDownloadUrl(string const & baseUrl, TCountryId const & countryId, MapOptions file) const;