diff options
-rw-r--r-- | android/jni/com/mapswithme/maps/DownloadResourcesLegacyActivity.cpp | 2 | ||||
-rw-r--r-- | storage/storage.cpp | 18 | ||||
-rw-r--r-- | storage/storage.hpp | 3 |
3 files changed, 11 insertions, 12 deletions
diff --git a/android/jni/com/mapswithme/maps/DownloadResourcesLegacyActivity.cpp b/android/jni/com/mapswithme/maps/DownloadResourcesLegacyActivity.cpp index f84970bd2d..c6e700fd00 100644 --- a/android/jni/com/mapswithme/maps/DownloadResourcesLegacyActivity.cpp +++ b/android/jni/com/mapswithme/maps/DownloadResourcesLegacyActivity.cpp @@ -189,7 +189,7 @@ extern "C" storage::Storage const & storage = g_framework->GetStorage(); for (size_t i = 0; i < curFile.m_urls.size(); ++i) { - curFile.m_urls[i] = storage.GetFileDownloadUrl(curFile.m_urls[i], curFile.m_fileName, MapOptions::Map); + curFile.m_urls[i] = storage.GetFileDownloadUrl(curFile.m_urls[i], curFile.m_fileName); LOG(LDEBUG, (curFile.m_urls[i])); } diff --git a/storage/storage.cpp b/storage/storage.cpp index d862e4df3a..10247ebdd7 100644 --- a/storage/storage.cpp +++ b/storage/storage.cpp @@ -925,17 +925,11 @@ void Storage::OnMapDownloadFinished(TCountryId const & countryId, bool success, string Storage::GetFileDownloadUrl(string const & baseUrl, QueuedCountry const & queuedCountry) const { - return GetFileDownloadUrl(baseUrl, queuedCountry.GetCountryId(), - queuedCountry.GetCurrentFileOptions()); -} - -string Storage::GetFileDownloadUrl(string const & baseUrl, TCountryId const & countryId, - MapOptions options) const -{ + auto const & countryId = queuedCountry.GetCountryId(); + auto const options = queuedCountry.GetCurrentFileOptions(); CountryFile const & countryFile = GetCountryFile(countryId); - string const fileName = - GetFileName(countryFile.GetName(), options, GetCurrentDataVersion()); + string const fileName = GetFileName(countryFile.GetName(), options, GetCurrentDataVersion()); ostringstream url; url << baseUrl; @@ -949,6 +943,12 @@ string Storage::GetFileDownloadUrl(string const & baseUrl, TCountryId const & co return url.str(); } +string Storage::GetFileDownloadUrl(string const & baseUrl, string const & fileName) const +{ + return baseUrl + OMIM_OS_NAME "/" + strings::to_string(GetCurrentDataVersion()) + "/" + + UrlEncode(fileName); +} + TCountryId Storage::FindCountryIdByFile(string const & name) const { // @TODO(bykoianko) Probably it's worth to check here if name represent a node in the tree. diff --git a/storage/storage.hpp b/storage/storage.hpp index c1beaa2eee..527e083fb0 100644 --- a/storage/storage.hpp +++ b/storage/storage.hpp @@ -536,8 +536,7 @@ public: void EnableKeepDownloadingQueue(bool enable) {m_keepDownloadingQueue = enable;} /// get download url by base url & queued country string GetFileDownloadUrl(string const & baseUrl, QueuedCountry const & queuedCountry) const; - string GetFileDownloadUrl(string const & baseUrl, TCountryId const & countryId, - MapOptions options) const; + string GetFileDownloadUrl(string const & baseUrl, string const & fileName) const; /// @param[out] res Populated with oudated countries. void GetOutdatedCountries(vector<Country const *> & countries) const; |