| 40 | } |
| 41 | |
| 42 | bool IsEnoughSpaceForUpdate(CountryId const & countryId, Storage const & storage) |
| 43 | { |
| 44 | Storage::UpdateInfo updateInfo; |
| 45 | storage.GetUpdateInfo(countryId, updateInfo); |
| 46 | |
| 47 | /// @todo Review this logic when Storage::ApplyDiff will be restored. |
| 48 | |
| 49 | // 1. For unlimited concurrent downloading process with "download and apply diff" strategy: |
| 50 | // - download and save all MWMs or Diffs = m_totalDownloadSizeInBytes |
| 51 | // - max MWM file size to apply diff patch (patches are applying one-by-one) = m_maxFileSizeInBytes |
| 52 | // - final size difference between old and new MWMs = m_sizeDifference |
| 53 | |
| 54 | [[maybe_unused]] MwmSize const diff = updateInfo.m_sizeDifference > 0 ? updateInfo.m_sizeDifference : 0; |
| 55 | // return IsEnoughSpaceForDownload(std::max(diff, updateInfo.m_totalDownloadSizeInBytes) + |
| 56 | // updateInfo.m_maxFileSizeInBytes); |
| 57 | |
| 58 | // 2. For the current "download and replace" strategy: |
| 59 | // - Android and Desktop has 1 simultaneous download |
| 60 | // - iOS has unlimited simultaneous downloads |
| 61 | #ifdef OMIM_OS_IPHONE |
| 62 | return IsEnoughSpaceForDownload(updateInfo.m_totalDownloadSizeInBytes); |
| 63 | #else |
| 64 | return IsEnoughSpaceForDownload(diff + updateInfo.m_maxFileSizeInBytes); |
| 65 | #endif // OMIM_OS_IPHONE |
| 66 | } |
| 67 | |
| 68 | m2::RectD CalcLimitRect(CountryId const & countryId, Storage const & storage, |
| 69 | CountryInfoGetter const & countryInfoGetter) |
no test coverage detected