From 8dc46e89b2292e605b71c7fa82ad4d87d8f5e391 Mon Sep 17 00:00:00 2001 From: VladiMihaylenko Date: Thu, 7 Sep 2017 12:23:22 +0300 Subject: Fixed android obb download. --- storage/storage.cpp | 18 +++++++++--------- storage/storage.hpp | 3 +-- 2 files changed, 10 insertions(+), 11 deletions(-) (limited to 'storage') 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 & countries) const; -- cgit v1.2.3