diff --git a/storage/storage.cpp b/storage/storage.cpp index daa8f70b0d..4009f9c29a 100644 --- a/storage/storage.cpp +++ b/storage/storage.cpp @@ -474,7 +474,21 @@ Status Storage::CountryStatus(CountryId const & countryId) const Status Storage::CountryStatusEx(CountryId const & countryId) const { - return CountryStatusFull(countryId, CountryStatus(countryId)); + auto const status = CountryStatus(countryId); + if (status != Status::EUnknown) + return status; + + LocalFilePtr localFile = GetLatestLocalFile(countryId); + if (!localFile || !localFile->OnDisk(MapOptions::Map)) + return Status::ENotDownloaded; + + CountryFile const & countryFile = GetCountryFile(countryId); + if (GetRemoteSize(countryFile, MapOptions::Map, GetCurrentDataVersion()) == 0) + return Status::EUnknown; + + if (localFile->GetVersion() != GetCurrentDataVersion()) + return Status::EOnDiskOutOfDate; + return Status::EOnDisk; } void Storage::CountryStatusEx(CountryId const & countryId, Status & status, @@ -1084,32 +1098,6 @@ void Storage::GetOutdatedCountries(vector & countries) const } } -Status Storage::CountryStatusWithoutFailed(CountryId const & countryId) const -{ - // First, check if we already downloading this country or have in in the queue. - if (!IsCountryInQueue(countryId)) - return CountryStatusFull(countryId, Status::EUnknown); - return IsCountryFirstInQueue(countryId) ? Status::EDownloading : Status::EInQueue; -} - -Status Storage::CountryStatusFull(CountryId const & countryId, Status const status) const -{ - if (status != Status::EUnknown) - return status; - - LocalFilePtr localFile = GetLatestLocalFile(countryId); - if (!localFile || !localFile->OnDisk(MapOptions::Map)) - return Status::ENotDownloaded; - - CountryFile const & countryFile = GetCountryFile(countryId); - if (GetRemoteSize(countryFile, MapOptions::Map, GetCurrentDataVersion()) == 0) - return Status::EUnknown; - - if (localFile->GetVersion() != GetCurrentDataVersion()) - return Status::EOnDiskOutOfDate; - return Status::EOnDisk; -} - // @TODO(bykoianko) This method does nothing and should be removed. MapOptions Storage::NormalizeDeleteFileSet(MapOptions options) const { diff --git a/storage/storage.hpp b/storage/storage.hpp index 0ded5cf9c8..07a99bfd6f 100644 --- a/storage/storage.hpp +++ b/storage/storage.hpp @@ -605,9 +605,6 @@ private: void SaveDownloadQueue(); void RestoreDownloadQueue(); - Status CountryStatusWithoutFailed(CountryId const & countryId) const; - Status CountryStatusFull(CountryId const & countryId, Status const status) const; - // Modifies file set of file to deletion - always adds (marks for // removal) a routing file when map file is marked for deletion. MapOptions NormalizeDeleteFileSet(MapOptions options) const;