diff --git a/android/src/com/mapswithme/maps/downloader/DownloaderActivity.java b/android/src/com/mapswithme/maps/downloader/DownloaderActivity.java index 4925e78182..7477a98173 100644 --- a/android/src/com/mapswithme/maps/downloader/DownloaderActivity.java +++ b/android/src/com/mapswithme/maps/downloader/DownloaderActivity.java @@ -12,7 +12,7 @@ public class DownloaderActivity extends BaseMwmFragmentActivity @Override protected Class getFragmentClass() { - return (DownloaderFragment.class); + return DownloaderFragment.class; } @Override diff --git a/android/src/com/mapswithme/maps/downloader/OnmapDownloader.java b/android/src/com/mapswithme/maps/downloader/OnmapDownloader.java index 32beeeb4eb..24eb6ad0c5 100644 --- a/android/src/com/mapswithme/maps/downloader/OnmapDownloader.java +++ b/android/src/com/mapswithme/maps/downloader/OnmapDownloader.java @@ -144,7 +144,7 @@ public class OnmapDownloader implements MwmActivity.LeftAnimationTrackListener } else { - sizeText = (StringUtils.getFileSizeString(mCurrentCountry.totalSize)); + sizeText = StringUtils.getFileSizeString(mCurrentCountry.totalSize); if (shouldAutoDownload && Config.isAutodownloadEnabled() && diff --git a/android/src/com/mapswithme/maps/routing/BaseRoutingErrorDialogFragment.java b/android/src/com/mapswithme/maps/routing/BaseRoutingErrorDialogFragment.java index 61f54ce6d1..07eff365f3 100644 --- a/android/src/com/mapswithme/maps/routing/BaseRoutingErrorDialogFragment.java +++ b/android/src/com/mapswithme/maps/routing/BaseRoutingErrorDialogFragment.java @@ -167,7 +167,7 @@ abstract class BaseRoutingErrorDialogFragment extends BaseMwmDialogFragment Map group = new HashMap<>(); group.put(GROUP_NAME, getString(R.string.maps) + " (" + mMissingMaps.size() + ") "); - group.put(GROUP_SIZE, (StringUtils.getFileSizeString(size))); + group.put(GROUP_SIZE, StringUtils.getFileSizeString(size)); List> groups = new ArrayList<>(); groups.add(group); diff --git a/map/framework.cpp b/map/framework.cpp index 79887143ab..1a5a58232a 100644 --- a/map/framework.cpp +++ b/map/framework.cpp @@ -516,6 +516,11 @@ Framework::Framework(FrameworkParams const & params) m_promoApi->SetDelegate(make_unique(m_featuresFetcher.GetDataSource(), *m_cityFinder)); eye::Eye::Instance().Subscribe(m_promoApi.get()); + + // Clean the no longer used key from old devices. + // Remove this line after April 2020 (assuming the majority of devices + // will have updated by then). + GetPlatform().RunTask(Platform::Thread::Gui, [] { settings::Delete("LastMigration"); }); } Framework::~Framework() diff --git a/platform/local_country_file.hpp b/platform/local_country_file.hpp index 0f4c6883c5..a691bd4641 100644 --- a/platform/local_country_file.hpp +++ b/platform/local_country_file.hpp @@ -40,9 +40,7 @@ public: // The directory must contain a full path to the country file. LocalCountryFile(std::string const & directory, CountryFile const & countryFile, int64_t version); - // Syncs internal state like availability of map and routing files, - // their sizes etc. with disk. - // In case of one component (single) mwm this method assumed the every mwm has a routing section. + // Syncs internal state like availability of files, their sizes etc. with disk. // Generality speaking it's not always true. To know it for sure it's necessary to read a mwm in // this method but it's not implemented by performance reasons. This check is done on // building routes stage. diff --git a/platform/mwm_version.hpp b/platform/mwm_version.hpp index 8e418fc03c..3da53f23d6 100644 --- a/platform/mwm_version.hpp +++ b/platform/mwm_version.hpp @@ -75,8 +75,8 @@ bool IsSingleMwm(int64_t version); /// Returns MwmType (SeparateMwms/SingleMwm/Unknown) on the basis of mwm version and format. MwmType GetMwmType(MwmVersion const & version); -/// \brief This enum sets constants which are used for writing test to set a version of mwm -/// which should be processed as either single or two components (mwm and routing) mwms. +/// \brief This enum sets constants which are used for +/// writing test to set a version of mwm which should be processed. enum ForTesting { FOR_TESTING_MWM1 = 991215, diff --git a/platform/platform_tests/local_country_file_tests.cpp b/platform/platform_tests/local_country_file_tests.cpp index 3ca8ace791..44264194d9 100644 --- a/platform/platform_tests/local_country_file_tests.cpp +++ b/platform/platform_tests/local_country_file_tests.cpp @@ -121,6 +121,45 @@ UNIT_TEST(LocalCountryFile_DiskFiles) } } +UNIT_TEST(LocalCountryFile_CleanupMapFiles) +{ + Platform & platform = GetPlatform(); + string const mapsDir = platform.WritableDir(); + + // Two fake directories for test country files and indexes. + ScopedDir dir3("3"); + ScopedDir dir4("4"); + + ScopedDir absentCountryIndexesDir(dir4, "Absent"); + ScopedDir irelandIndexesDir(dir4, "Ireland"); + + CountryFile irelandFile("Ireland"); + + LocalCountryFile irelandLocalFile(dir4.GetFullPath(), irelandFile, 4 /* version */); + ScopedFile irelandMapFile(dir4, irelandFile, MapFileType::Map); + + // Check FindAllLocalMaps() + vector localFiles; + FindAllLocalMapsAndCleanup(4 /* latestVersion */, localFiles); + TEST(Contains(localFiles, irelandLocalFile), (irelandLocalFile, localFiles)); + + irelandLocalFile.SyncWithDisk(); + TEST(irelandLocalFile.OnDisk(MapFileType::Map), ()); + irelandLocalFile.DeleteFromDisk(MapFileType::Map); + TEST(!irelandMapFile.Exists(), (irelandMapFile)); + irelandMapFile.Reset(); + + TEST(!dir3.Exists(), ("Empty directory", dir3, "wasn't removed.")); + dir3.Reset(); + + TEST(dir4.Exists(), ()); + + TEST(!absentCountryIndexesDir.Exists(), ("Indexes for absent country weren't deleted.")); + absentCountryIndexesDir.Reset(); + + TEST(irelandIndexesDir.Exists(), ()); +} + UNIT_TEST(LocalCountryFile_CleanupPartiallyDownloadedFiles) { ScopedDir oldDir("101009"); diff --git a/storage/country_tree.cpp b/storage/country_tree.cpp index 16e54802ec..f412eb8070 100644 --- a/storage/country_tree.cpp +++ b/storage/country_tree.cpp @@ -326,7 +326,7 @@ CountryTree::Node const * const CountryTree::FindFirstLeaf(CountryId const & key } MwmSubtreeAttrs LoadGroupImpl(size_t depth, json_t * node, CountryId const & parent, - StoreInterface & store) + StoreInterface & store) { CountryId id; FromJSONObject(node, "id", id); @@ -336,7 +336,6 @@ MwmSubtreeAttrs LoadGroupImpl(size_t depth, json_t * node, CountryId const & par for (auto const & synonym : countryNameSynonyms) store.InsertCountryNameSynonym(id, synonym); - // Mapping affiliations to one component (small) mwms. vector affiliations; FromJSONObjectOptionalField(node, "affiliations", affiliations); for (auto const & affilationValue : affiliations)