diff --git a/android/jni/com/mapswithme/maps/DownloadResourcesActivity.cpp b/android/jni/com/mapswithme/maps/DownloadResourcesActivity.cpp index 6e59d7699a..b5b0098e93 100644 --- a/android/jni/com/mapswithme/maps/DownloadResourcesActivity.cpp +++ b/android/jni/com/mapswithme/maps/DownloadResourcesActivity.cpp @@ -186,7 +186,7 @@ extern "C" GetServerListFromRequest(req, curFile.m_urls); - storage::Storage const & storage = g_framework->Storage(); + 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); diff --git a/android/jni/com/mapswithme/maps/Framework.cpp b/android/jni/com/mapswithme/maps/Framework.cpp index 4e11713605..5ca65fb13c 100644 --- a/android/jni/com/mapswithme/maps/Framework.cpp +++ b/android/jni/com/mapswithme/maps/Framework.cpp @@ -232,16 +232,16 @@ bool Framework::GetChoosePositionMode() return m_isChoosePositionMode; } -Storage & Framework::Storage() +Storage & Framework::GetStorage() { - return m_work.Storage(); + return m_work.GetStorage(); } void Framework::ShowNode(TCountryId const & idx, bool zoomToDownloadButton) { if (zoomToDownloadButton) { - m2::RectD const rect = CalcLimitRect(idx, m_work.Storage(), m_work.CountryInfoGetter()); + m2::RectD const rect = CalcLimitRect(idx, m_work.GetStorage(), m_work.GetCountryInfoGetter()); m_work.SetViewportCenter(rect.Center(), 10); } else @@ -352,7 +352,7 @@ void Framework::DeactivatePopup() string Framework::GetOutdatedCountriesString() { vector countries; - class Storage const & storage = Storage(); + class Storage const & storage = GetStorage(); storage.GetOutdatedCountries(countries); string res; @@ -487,17 +487,17 @@ storage::TCountryId Framework::PreMigrate(ms::LatLon const & position, Storage:: bool Framework::IsAutoRetryDownloadFailed() { - return m_work.DownloadingPolicy().IsAutoRetryDownloadFailed(); + return m_work.GetDownloadingPolicy().IsAutoRetryDownloadFailed(); } bool Framework::IsDownloadOn3gEnabled() { - return m_work.DownloadingPolicy().IsCellularDownloadEnabled(); + return m_work.GetDownloadingPolicy().IsCellularDownloadEnabled(); } void Framework::EnableDownloadOn3g() { - m_work.DownloadingPolicy().EnableCellularDownload(true); + m_work.GetDownloadingPolicy().EnableCellularDownload(true); } @@ -1098,7 +1098,7 @@ JNIEXPORT jboolean JNICALL Java_com_mapswithme_maps_Framework_nativeIsDownloadedMapAtScreenCenter(JNIEnv *, jclass) { ::Framework * fr = frm(); - return storage::IsPointCoveredByDownloadedMaps(fr->GetViewportCenter(), fr->Storage(), fr->CountryInfoGetter()); + return storage::IsPointCoveredByDownloadedMaps(fr->GetViewportCenter(), fr->GetStorage(), fr->GetCountryInfoGetter()); } JNIEXPORT jstring JNICALL diff --git a/android/jni/com/mapswithme/maps/Framework.hpp b/android/jni/com/mapswithme/maps/Framework.hpp index a9b719a4f4..a832382ba4 100644 --- a/android/jni/com/mapswithme/maps/Framework.hpp +++ b/android/jni/com/mapswithme/maps/Framework.hpp @@ -61,7 +61,7 @@ namespace android public: Framework(); - storage::Storage & Storage(); + storage::Storage & GetStorage(); void ShowNode(storage::TCountryId const & countryId, bool zoomToDownloadButton); diff --git a/android/jni/com/mapswithme/maps/MapManager.cpp b/android/jni/com/mapswithme/maps/MapManager.cpp index 6889012c1e..f5f3b17bfe 100644 --- a/android/jni/com/mapswithme/maps/MapManager.cpp +++ b/android/jni/com/mapswithme/maps/MapManager.cpp @@ -54,7 +54,7 @@ bool g_isBatched; Storage & GetStorage() { - return g_framework->Storage(); + return g_framework->GetStorage(); } void PrepareClassRefs(JNIEnv * env) @@ -372,7 +372,7 @@ Java_com_mapswithme_maps_downloader_MapManager_nativeListItems(JNIEnv * env, jcl if (hasLocation && !myMapsMode) { TCountriesVec near; - g_framework->NativeFramework()->CountryInfoGetter().GetRegionsCountryId(MercatorBounds::FromLatLon(lat, lon), near); + g_framework->NativeFramework()->GetCountryInfoGetter().GetRegionsCountryId(MercatorBounds::FromLatLon(lat, lon), near); PutItemsToList(env, result, near, ItemCategory::NEAR_ME, [](TCountryId const & countryId, NodeAttrs const & attrs) -> bool { return !attrs.m_present; @@ -432,7 +432,7 @@ Java_com_mapswithme_maps_downloader_MapManager_nativeGetName(JNIEnv * env, jclas JNIEXPORT jstring JNICALL Java_com_mapswithme_maps_downloader_MapManager_nativeFindCountry(JNIEnv * env, jclass clazz, jdouble lat, jdouble lon) { - return jni::ToJavaString(env, g_framework->NativeFramework()->CountryInfoGetter().GetRegionCountryId(MercatorBounds::FromLatLon(lat, lon))); + return jni::ToJavaString(env, g_framework->NativeFramework()->GetCountryInfoGetter().GetRegionCountryId(MercatorBounds::FromLatLon(lat, lon))); } // static boolean nativeIsDownloading(); diff --git a/iphone/Maps/Classes/CustomAlert/DownloadTransitMapsAlert/MWMDownloadTransitMapAlert.mm b/iphone/Maps/Classes/CustomAlert/DownloadTransitMapsAlert/MWMDownloadTransitMapAlert.mm index 78c421ef10..48b6491790 100644 --- a/iphone/Maps/Classes/CustomAlert/DownloadTransitMapsAlert/MWMDownloadTransitMapAlert.mm +++ b/iphone/Maps/Classes/CustomAlert/DownloadTransitMapsAlert/MWMDownloadTransitMapAlert.mm @@ -98,7 +98,7 @@ CGFloat const kAnimationDuration = .05; NSMutableArray * titles = [@[] mutableCopy]; TMwmSize totalSize = 0; - auto const & s = GetFramework().Storage(); + auto const & s = GetFramework().GetStorage(); for (auto const & countryId : countries) { storage::NodeAttrs attrs; @@ -134,8 +134,8 @@ CGFloat const kAnimationDuration = .05; - (void)processCountryEvent:(TCountryId const &)countryId { - auto const & s = GetFramework().Storage(); - auto const & p = GetFramework().DownloadingPolicy(); + auto const & s = GetFramework().GetStorage(); + auto const & p = GetFramework().GetDownloadingPolicy(); if (s.CheckFailedCountries(m_countries)) { if (p.IsAutoRetryDownloadFailed()) @@ -153,7 +153,7 @@ CGFloat const kAnimationDuration = .05; - (void)processCountry:(TCountryId const &)countryId progress:(MapFilesDownloader::TProgress const &)progress { - auto const overallProgress = GetFramework().Storage().GetOverallProgress(m_countries); + auto const overallProgress = GetFramework().GetStorage().GetOverallProgress(m_countries); CGFloat const progressValue = static_cast(overallProgress.first) / overallProgress.second; self.progress.progress = progressValue; self.titleLabel.text = [NSString stringWithFormat:@"%@%@%%", L(@"downloading"), @(floor(progressValue * 100))]; diff --git a/iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuView.mm b/iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuView.mm index d6c87bec49..c3d3250795 100644 --- a/iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuView.mm +++ b/iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuView.mm @@ -483,7 +483,7 @@ CGFloat constexpr kTimeWidthRegular = 128; self.downloadBadge.hidden = YES; return; } - auto & s = GetFramework().Storage(); + auto & s = GetFramework().GetStorage(); storage::Storage::UpdateInfo updateInfo{}; s.GetUpdateInfo(s.GetRootId(), updateInfo); self.downloadBadge.hidden = diff --git a/iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuViewController.mm b/iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuViewController.mm index cf9d4e74d2..48292de5d5 100644 --- a/iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuViewController.mm +++ b/iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuViewController.mm @@ -289,7 +289,7 @@ typedef NS_ENUM(NSUInteger, MWMBottomMenuViewCell) { } case MWMBottomMenuViewCellDownload: { - auto & s = GetFramework().Storage(); + auto & s = GetFramework().GetStorage(); storage::Storage::UpdateInfo updateInfo{}; s.GetUpdateInfo(s.GetRootId(), updateInfo); [cell configureWithImageName:@"ic_menu_download" diff --git a/iphone/Maps/Classes/CustomViews/MapViewControls/MWMMapViewControlsManager.mm b/iphone/Maps/Classes/CustomViews/MapViewControls/MWMMapViewControlsManager.mm index 098351ba17..d39037b845 100644 --- a/iphone/Maps/Classes/CustomViews/MapViewControls/MWMMapViewControlsManager.mm +++ b/iphone/Maps/Classes/CustomViews/MapViewControls/MWMMapViewControlsManager.mm @@ -268,8 +268,8 @@ extern NSString * const kAlohalyticsTapEventKey; doneBlock:^{ auto & f = GetFramework(); - if (IsPointCoveredByDownloadedMaps(f.GetViewportCenter(), f.Storage(), - f.CountryInfoGetter())) + if (IsPointCoveredByDownloadedMaps(f.GetViewportCenter(), f.GetStorage(), + f.GetCountryInfoGetter())) [self.ownerController performSegueWithIdentifier:kMapToCategorySelectorSegue sender:nil]; else [self.ownerController.alertController presentIncorrectFeauturePositionAlert]; diff --git a/iphone/Maps/Classes/CustomViews/MapViewControls/Search/MWMSearchManager.mm b/iphone/Maps/Classes/CustomViews/MapViewControls/Search/MWMSearchManager.mm index 19c3ee0d61..72794aac61 100644 --- a/iphone/Maps/Classes/CustomViews/MapViewControls/Search/MWMSearchManager.mm +++ b/iphone/Maps/Classes/CustomViews/MapViewControls/Search/MWMSearchManager.mm @@ -211,7 +211,7 @@ extern NSString * const kSearchStateKey = @"SearchStateKey"; { using namespace storage; NodeStatuses nodeStatuses{}; - GetFramework().Storage().GetNodeStatuses(countryId, nodeStatuses); + GetFramework().GetStorage().GetNodeStatuses(countryId, nodeStatuses); if (nodeStatuses.m_status != NodeStatus::OnDisk) return; [self updateTopController]; @@ -303,7 +303,7 @@ extern NSString * const kSearchStateKey = @"SearchStateKey"; - (UIViewController *)topController { if (self.state == MWMSearchManagerStateHidden || - GetFramework().Storage().HaveDownloadedCountries()) + GetFramework().GetStorage().HaveDownloadedCountries()) { return self.tabbedController; } diff --git a/iphone/Maps/Classes/Framework/MWMFrameworkListener.mm b/iphone/Maps/Classes/Framework/MWMFrameworkListener.mm index 665f2c3e80..2789fc2aba 100644 --- a/iphone/Maps/Classes/Framework/MWMFrameworkListener.mm +++ b/iphone/Maps/Classes/Framework/MWMFrameworkListener.mm @@ -127,7 +127,7 @@ void loopWrappers(TObservers * observers, TLoopBlock block) - (void)registerStorageObserver { TObservers * observers = self.storageObservers; - auto & s = GetFramework().Storage(); + auto & s = GetFramework().GetStorage(); s.Subscribe([observers](TCountryId const & countryId) { for (TStorageObserver observer in observers) diff --git a/iphone/Maps/Classes/LocalNotificationManager.mm b/iphone/Maps/Classes/LocalNotificationManager.mm index 81cc9231d4..505c4ee0b6 100644 --- a/iphone/Maps/Classes/LocalNotificationManager.mm +++ b/iphone/Maps/Classes/LocalNotificationManager.mm @@ -172,8 +172,8 @@ using namespace storage; CLLocation * lastLocation = [locations lastObject]; auto const & mercator = lastLocation.mercator; auto & f = GetFramework(); - auto const & countryInfoGetter = f.CountryInfoGetter(); - if (!IsPointCoveredByDownloadedMaps(mercator, f.Storage(), countryInfoGetter)) + auto const & countryInfoGetter = f.GetCountryInfoGetter(); + if (!IsPointCoveredByDownloadedMaps(mercator, f.GetStorage(), countryInfoGetter)) { NSString * countryId = @(countryInfoGetter.GetRegionCountryId(mercator).c_str()); if ([self shouldShowNotificationForCountryId:countryId]) diff --git a/iphone/Maps/Classes/MWMBasePlacePageView.mm b/iphone/Maps/Classes/MWMBasePlacePageView.mm index e9bcc5d0f5..643ebcbe71 100644 --- a/iphone/Maps/Classes/MWMBasePlacePageView.mm +++ b/iphone/Maps/Classes/MWMBasePlacePageView.mm @@ -285,7 +285,7 @@ using namespace storage; self.downloadProgressView.hidden = NO; [self setNeedsLayout]; NodeAttrs nodeAttrs; - GetFramework().Storage().GetNodeAttrs(countryId, nodeAttrs); + GetFramework().GetStorage().GetNodeAttrs(countryId, nodeAttrs); MWMCircularProgress * progress = self.mapDownloadProgress; self.downloadMapSize = nodeAttrs.m_mwmSize - nodeAttrs.m_localMwmSize; switch (nodeAttrs.m_status) @@ -762,7 +762,7 @@ using namespace storage; { TCountryId const & countryId = self.entity.countryId; NodeAttrs nodeAttrs; - GetFramework().Storage().GetNodeAttrs(countryId, nodeAttrs); + GetFramework().GetStorage().GetNodeAttrs(countryId, nodeAttrs); MWMAlertViewController * avc = self.ownerPlacePage.manager.ownerViewController.alertController; switch (nodeAttrs.m_status) { diff --git a/iphone/Maps/Classes/MWMPlacePageButtonCell.mm b/iphone/Maps/Classes/MWMPlacePageButtonCell.mm index 18148619b1..0e856522be 100644 --- a/iphone/Maps/Classes/MWMPlacePageButtonCell.mm +++ b/iphone/Maps/Classes/MWMPlacePageButtonCell.mm @@ -16,7 +16,7 @@ - (void)config:(MWMPlacePageViewManager *)manager forType:(MWMPlacePageCellType)type { - self.countryId = GetFramework().CountryInfoGetter().GetRegionCountryId(manager.entity.mercator); + self.countryId = GetFramework().GetCountryInfoGetter().GetRegionCountryId(manager.entity.mercator); self.manager = manager; self.type = type; [self refreshButtonEnabledState]; @@ -42,7 +42,7 @@ return; } NodeStatuses nodeStatuses; - GetFramework().Storage().GetNodeStatuses(self.countryId, nodeStatuses); + GetFramework().GetStorage().GetNodeStatuses(self.countryId, nodeStatuses); auto const & status = nodeStatuses.m_status; self.titleButton.enabled = status == NodeStatus::OnDisk || status == NodeStatus::OnDiskOutOfDate; } diff --git a/iphone/Maps/Classes/MapDownloader/Cells/MWMMapDownloaderPlaceTableViewCell.mm b/iphone/Maps/Classes/MapDownloader/Cells/MWMMapDownloaderPlaceTableViewCell.mm index 3b389aa2e3..e3bc0a4d6b 100644 --- a/iphone/Maps/Classes/MapDownloader/Cells/MWMMapDownloaderPlaceTableViewCell.mm +++ b/iphone/Maps/Classes/MapDownloader/Cells/MWMMapDownloaderPlaceTableViewCell.mm @@ -43,7 +43,7 @@ if (self.needDisplayArea && nodeAttrs.m_topmostParentInfo.size() == 1) { string const & areaName = nodeAttrs.m_topmostParentInfo[0].m_localName; - isDescriptionVisible = (areaName != GetFramework().Storage().GetRootId()); + isDescriptionVisible = (areaName != GetFramework().GetStorage().GetRootId()); if (isDescriptionVisible) self.descriptionLabel.attributedText = [self matchedString:@(areaName.c_str()) selectedAttrs:selectedAreaAttrs diff --git a/iphone/Maps/Classes/MapDownloader/Cells/MWMMapDownloaderTableViewCell.mm b/iphone/Maps/Classes/MapDownloader/Cells/MWMMapDownloaderTableViewCell.mm index 12ea4e5ed2..fa6112d52e 100644 --- a/iphone/Maps/Classes/MapDownloader/Cells/MWMMapDownloaderTableViewCell.mm +++ b/iphone/Maps/Classes/MapDownloader/Cells/MWMMapDownloaderTableViewCell.mm @@ -129,7 +129,7 @@ if (countryId != m_countryId) return; storage::NodeAttrs nodeAttrs; - GetFramework().Storage().GetNodeAttrs(m_countryId, nodeAttrs); + GetFramework().GetStorage().GetNodeAttrs(m_countryId, nodeAttrs); [self config:nodeAttrs]; } @@ -146,7 +146,7 @@ - (void)progressButtonPressed:(nonnull MWMCircularProgress *)progress { storage::NodeAttrs nodeAttrs; - GetFramework().Storage().GetNodeAttrs(m_countryId, nodeAttrs); + GetFramework().GetStorage().GetNodeAttrs(m_countryId, nodeAttrs); switch (nodeAttrs.m_status) { case NodeStatus::NotDownloaded: @@ -174,7 +174,7 @@ self.searchQuery = query; m_countryId = countryId.UTF8String; storage::NodeAttrs nodeAttrs; - GetFramework().Storage().GetNodeAttrs(m_countryId, nodeAttrs); + GetFramework().GetStorage().GetNodeAttrs(m_countryId, nodeAttrs); [self config:nodeAttrs]; } diff --git a/iphone/Maps/Classes/MapDownloader/DataSources/MWMMapDownloaderDefaultDataSource.mm b/iphone/Maps/Classes/MapDownloader/DataSources/MWMMapDownloaderDefaultDataSource.mm index 82bb661942..c68ff06912 100644 --- a/iphone/Maps/Classes/MapDownloader/DataSources/MWMMapDownloaderDefaultDataSource.mm +++ b/iphone/Maps/Classes/MapDownloader/DataSources/MWMMapDownloaderDefaultDataSource.mm @@ -21,7 +21,7 @@ auto compareStrings = ^NSComparisonResult(NSString * s1, NSString * s2) auto compareLocalNames = ^NSComparisonResult(NSString * s1, NSString * s2) { - auto const & s = GetFramework().Storage(); + auto const & s = GetFramework().GetStorage(); string const l1 = s.GetNodeLocalName(s1.UTF8String); string const l2 = s.GetNodeLocalName(s2.UTF8String); return compareStrings(@(l1.c_str()), @(l2.c_str())); @@ -52,7 +52,7 @@ using namespace mwm; if (self) { m_parentId = countryId.UTF8String; - _isParentRoot = (m_parentId == GetFramework().Storage().GetRootId()); + _isParentRoot = (m_parentId == GetFramework().GetStorage().GetRootId()); [self load]; } return self; @@ -60,7 +60,7 @@ using namespace mwm; - (void)load { - auto const & s = GetFramework().Storage(); + auto const & s = GetFramework().GetStorage(); TCountriesVec downloadedChildren; TCountriesVec availableChildren; s.GetChildrenInGroups(m_parentId, downloadedChildren, availableChildren, true /* keepAvailableChildren */); @@ -82,7 +82,7 @@ using namespace mwm; NSMutableSet * indexSet = [NSMutableSet setWithCapacity:availableChildren.size()]; NSMutableDictionary *> * availableCountries = [@{} mutableCopy]; BOOL const isParentRoot = self.isParentRoot; - auto const & s = GetFramework().Storage(); + auto const & s = GetFramework().GetStorage(); for (auto const & countryId : availableChildren) { NSString * nsCountryId = @(countryId.c_str()); @@ -163,7 +163,7 @@ using namespace mwm; if ([self isButtonCell:section]) return @""; NodeAttrs nodeAttrs; - GetFramework().Storage().GetNodeAttrs(m_parentId, nodeAttrs); + GetFramework().GetStorage().GetNodeAttrs(m_parentId, nodeAttrs); if (nodeAttrs.m_localMwmSize == 0) return [NSString stringWithFormat:@"%@", L(@"downloader_downloaded_subtitle")]; else @@ -182,7 +182,7 @@ using namespace mwm; if ([self isButtonCell:indexPath.section]) return NO; NodeAttrs nodeAttrs; - GetFramework().Storage().GetNodeAttrs([self countryIdForIndexPath:indexPath].UTF8String, nodeAttrs); + GetFramework().GetStorage().GetNodeAttrs([self countryIdForIndexPath:indexPath].UTF8String, nodeAttrs); NodeStatus const status = nodeAttrs.m_status; return (status == NodeStatus::OnDisk || status == NodeStatus::OnDiskOutOfDate || nodeAttrs.m_localMwmCounter != 0); } @@ -208,7 +208,7 @@ using namespace mwm; - (NSString *)cellIdentifierForIndexPath:(NSIndexPath *)indexPath { - auto const & s = GetFramework().Storage(); + auto const & s = GetFramework().GetStorage(); TCountriesVec children; s.GetChildren([self countryIdForIndexPath:indexPath].UTF8String, children); BOOL const haveChildren = !children.empty(); diff --git a/iphone/Maps/Classes/MapDownloader/DataSources/MWMMapDownloaderExtendedDataSource.mm b/iphone/Maps/Classes/MapDownloader/DataSources/MWMMapDownloaderExtendedDataSource.mm index 6e9acd67cb..6d5b9cf2cb 100644 --- a/iphone/Maps/Classes/MapDownloader/DataSources/MWMMapDownloaderExtendedDataSource.mm +++ b/iphone/Maps/Classes/MapDownloader/DataSources/MWMMapDownloaderExtendedDataSource.mm @@ -34,7 +34,7 @@ using namespace storage; CLLocation * lastLocation = [MWMLocationManager lastLocation]; if (!lastLocation) return; - auto & countryInfoGetter = GetFramework().CountryInfoGetter(); + auto & countryInfoGetter = GetFramework().GetCountryInfoGetter(); TCountriesVec closestCoutryIds; countryInfoGetter.GetRegionsCountryId(lastLocation.mercator, closestCoutryIds); NSMutableArray * nearmeCountries = [@[] mutableCopy]; diff --git a/iphone/Maps/Classes/MapDownloader/DataSources/MWMMapDownloaderSearchDataSource.mm b/iphone/Maps/Classes/MapDownloader/DataSources/MWMMapDownloaderSearchDataSource.mm index 0a179b3cfa..8c851d49f4 100644 --- a/iphone/Maps/Classes/MapDownloader/DataSources/MWMMapDownloaderSearchDataSource.mm +++ b/iphone/Maps/Classes/MapDownloader/DataSources/MWMMapDownloaderSearchDataSource.mm @@ -56,7 +56,7 @@ extern NSString * const kLargeCountryCellIdentifier; - (NSString *)parentCountryId { - return @(GetFramework().Storage().GetRootId().c_str()); + return @(GetFramework().GetStorage().GetRootId().c_str()); } - (NSString *)countryIdForIndexPath:(NSIndexPath *)indexPath @@ -68,7 +68,7 @@ extern NSString * const kLargeCountryCellIdentifier; - (NSString *)cellIdentifierForIndexPath:(NSIndexPath *)indexPath { - auto const & s = GetFramework().Storage(); + auto const & s = GetFramework().GetStorage(); NSString * countryId = [self countryIdForIndexPath:indexPath]; TCountriesVec children; s.GetChildren(countryId.UTF8String, children); diff --git a/iphone/Maps/Classes/MapDownloader/MWMBaseMapDownloaderViewController.mm b/iphone/Maps/Classes/MapDownloader/MWMBaseMapDownloaderViewController.mm index b1f9ab2b52..42da9ede8b 100644 --- a/iphone/Maps/Classes/MapDownloader/MWMBaseMapDownloaderViewController.mm +++ b/iphone/Maps/Classes/MapDownloader/MWMBaseMapDownloaderViewController.mm @@ -142,7 +142,7 @@ using namespace mwm; else { NodeAttrs nodeAttrs; - GetFramework().Storage().GetNodeAttrs(self.parentCountryId.UTF8String, nodeAttrs); + GetFramework().GetStorage().GetNodeAttrs(self.parentCountryId.UTF8String, nodeAttrs); self.title = @(nodeAttrs.m_nodeLocalName.c_str()); } @@ -187,7 +187,7 @@ using namespace mwm; } BOOL needReload = NO; - auto const & s = GetFramework().Storage(); + auto const & s = GetFramework().GetStorage(); s.ForEachInSubtree(self.parentCountryId.UTF8String, [&needReload, &countryId](TCountryId const & descendantId, bool groupNode) { @@ -264,7 +264,7 @@ using namespace mwm; - (void)configAllMapsView { - auto const & s = GetFramework().Storage(); + auto const & s = GetFramework().GetStorage(); TCountryId const parentCountryId = self.parentCountryId.UTF8String; if (self.dataSource != self.defaultDataSource) { @@ -487,7 +487,7 @@ using namespace mwm; - (void)showActionSheetForRowAtIndexPath:(NSIndexPath *)indexPath { - auto const & s = GetFramework().Storage(); + auto const & s = GetFramework().GetStorage(); NodeAttrs nodeAttrs; NSAssert(self.dataSource != nil, @"Datasource is nil."); NSString * countyId = [self.dataSource countryIdForIndexPath:indexPath]; @@ -585,7 +585,7 @@ using namespace mwm; [alertController addAction:action]; } - auto const & s = GetFramework().Storage(); + auto const & s = GetFramework().GetStorage(); if (buttons & DownloadAction) { NodeAttrs nodeAttrs; @@ -688,7 +688,7 @@ using namespace mwm; - (void)openAvailableMaps { - BOOL const isParentRoot = [self.parentCountryId isEqualToString:@(GetFramework().Storage().GetRootId().c_str())]; + BOOL const isParentRoot = [self.parentCountryId isEqualToString:@(GetFramework().GetStorage().GetRootId().c_str())]; NSString * identifier = isParentRoot ? kControllerIdentifier : kBaseControllerIdentifier; MWMBaseMapDownloaderViewController * vc = [self.storyboard instantiateViewControllerWithIdentifier:identifier]; [vc setParentCountryId:self.parentCountryId mode:DownloaderMode::Available]; diff --git a/iphone/Maps/Classes/MapDownloader/MWMMapDownloaderViewController.mm b/iphone/Maps/Classes/MapDownloader/MWMMapDownloaderViewController.mm index a1040ea817..d7e2c1cd9e 100644 --- a/iphone/Maps/Classes/MapDownloader/MWMMapDownloaderViewController.mm +++ b/iphone/Maps/Classes/MapDownloader/MWMMapDownloaderViewController.mm @@ -78,7 +78,7 @@ using namespace storage; - (void)checkAndConfigNoMapsView { - auto const & s = GetFramework().Storage(); + auto const & s = GetFramework().GetStorage(); if (![self.parentCountryId isEqualToString:@(s.GetRootId().c_str())]) return; if (self.mode == mwm::DownloaderMode::Available || self.dataSource == self.searchDataSource || diff --git a/iphone/Maps/Classes/MapViewController.mm b/iphone/Maps/Classes/MapViewController.mm index 8318fa41a6..e8740f4154 100644 --- a/iphone/Maps/Classes/MapViewController.mm +++ b/iphone/Maps/Classes/MapViewController.mm @@ -488,7 +488,7 @@ BOOL gIsFirstMyPositionMode = YES; - (void)processCountryEvent:(TCountryId const &)countryId { NodeStatuses nodeStatuses{}; - GetFramework().Storage().GetNodeStatuses(countryId, nodeStatuses); + GetFramework().GetStorage().GetNodeStatuses(countryId, nodeStatuses); if (nodeStatuses.m_status != NodeStatus::Error) return; switch (nodeStatuses.m_error) @@ -614,7 +614,7 @@ BOOL gIsFirstMyPositionMode = YES; { MWMMapDownloaderViewController * dvc = segue.destinationViewController; NSNumber * mode = sender; - [dvc setParentCountryId:@(GetFramework().Storage().GetRootId().c_str()) + [dvc setParentCountryId:@(GetFramework().GetStorage().GetRootId().c_str()) mode:static_cast(mode.integerValue)]; } else if ([segue.identifier isEqualToString:kMap2FBLoginSegue]) diff --git a/iphone/Maps/Classes/MapsAppDelegate.mm b/iphone/Maps/Classes/MapsAppDelegate.mm index f0868a26e8..e50177fd84 100644 --- a/iphone/Maps/Classes/MapsAppDelegate.mm +++ b/iphone/Maps/Classes/MapsAppDelegate.mm @@ -865,7 +865,7 @@ using namespace osm_auth_ios; - (void)updateApplicationIconBadgeNumber { - auto & s = GetFramework().Storage(); + auto & s = GetFramework().GetStorage(); storage::Storage::UpdateInfo updateInfo{}; s.GetUpdateInfo(s.GetRootId(), updateInfo); [UIApplication sharedApplication].applicationIconBadgeNumber = diff --git a/iphone/Maps/Classes/Migration/MWMMigrationViewController.mm b/iphone/Maps/Classes/Migration/MWMMigrationViewController.mm index 1f6c261eca..68a214bf02 100644 --- a/iphone/Maps/Classes/Migration/MWMMigrationViewController.mm +++ b/iphone/Maps/Classes/Migration/MWMMigrationViewController.mm @@ -82,7 +82,7 @@ using namespace storage; if (m_countryId == kInvalidCountryId || m_countryId != countryId) return; auto & f = GetFramework(); - auto s = f.Storage().GetPrefetchStorage(); + auto s = f.GetStorage().GetPrefetchStorage(); NodeStatuses nodeStatuses{}; s->GetNodeStatuses(countryId, nodeStatuses); switch (nodeStatuses.m_status) @@ -121,12 +121,12 @@ using namespace storage; MWMAlertViewController * avc = self.alertController; auto const retryBlock = ^ { - GetFramework().Storage().GetPrefetchStorage()->RetryDownloadNode(self->m_countryId); + GetFramework().GetStorage().GetPrefetchStorage()->RetryDownloadNode(self->m_countryId); [self setState:MWMMigrationViewState::Processing]; }; auto const cancelBlock = ^ { - GetFramework().Storage().GetPrefetchStorage()->CancelDownloadNode(self->m_countryId); + GetFramework().GetStorage().GetPrefetchStorage()->CancelDownloadNode(self->m_countryId); }; switch (errorCode) { @@ -154,7 +154,7 @@ using namespace storage; if (state == MWMMigrationViewState::Processing) { NodeAttrs nodeAttrs; - GetFramework().Storage().GetPrefetchStorage()->GetNodeAttrs(m_countryId, nodeAttrs); + GetFramework().GetStorage().GetPrefetchStorage()->GetNodeAttrs(m_countryId, nodeAttrs); migrationView.nodeLocalName = @(nodeAttrs.m_nodeLocalName.c_str()); self.navigationItem.leftBarButtonItem.enabled = NO; } @@ -169,7 +169,7 @@ using namespace storage; - (void)progressButtonPressed:(MWMCircularProgress *)progress { - GetFramework().Storage().GetPrefetchStorage()->CancelDownloadNode(m_countryId); + GetFramework().GetStorage().GetPrefetchStorage()->CancelDownloadNode(m_countryId); [self setState:MWMMigrationViewState::Default]; } @@ -180,7 +180,7 @@ using namespace storage; if ([segue.identifier isEqualToString:kDownloaderSegue]) { MWMMapDownloaderViewController * dvc = segue.destinationViewController; - [dvc setParentCountryId:@(GetFramework().Storage().GetRootId().c_str()) mode:mwm::DownloaderMode::Downloaded]; + [dvc setParentCountryId:@(GetFramework().GetStorage().GetRootId().c_str()) mode:mwm::DownloaderMode::Downloaded]; } } diff --git a/iphone/Maps/Classes/Storage/MWMStorage.mm b/iphone/Maps/Classes/Storage/MWMStorage.mm index 7fa7c3c887..d8e445b114 100644 --- a/iphone/Maps/Classes/Storage/MWMStorage.mm +++ b/iphone/Maps/Classes/Storage/MWMStorage.mm @@ -15,11 +15,11 @@ using namespace storage; alertController:(MWMAlertViewController *)alertController onSuccess:(TMWMVoidBlock)onSuccess { - if (IsEnoughSpaceForDownload(countryId, GetFramework().Storage())) + if (IsEnoughSpaceForDownload(countryId, GetFramework().GetStorage())) { [self checkConnectionAndPerformAction:[countryId, onSuccess] { - GetFramework().Storage().DownloadNode(countryId); + GetFramework().GetStorage().DownloadNode(countryId); if (onSuccess) onSuccess(); } alertController:alertController]; @@ -32,17 +32,17 @@ using namespace storage; + (void)retryDownloadNode:(TCountryId const &)countryId { - GetFramework().Storage().RetryDownloadNode(countryId); + GetFramework().GetStorage().RetryDownloadNode(countryId); } + (void)updateNode:(TCountryId const &)countryId alertController:(MWMAlertViewController *)alertController { - if (IsEnoughSpaceForUpdate(countryId, GetFramework().Storage())) + if (IsEnoughSpaceForUpdate(countryId, GetFramework().GetStorage())) { [self checkConnectionAndPerformAction:[countryId] { - GetFramework().Storage().UpdateNode(countryId); + GetFramework().GetStorage().UpdateNode(countryId); } alertController:alertController]; } else @@ -64,18 +64,18 @@ using namespace storage; { [alertController presentUnsavedEditsAlertWithOkBlock:[countryId] { - GetFramework().Storage().DeleteNode(countryId); + GetFramework().GetStorage().DeleteNode(countryId); }]; } else { - f.Storage().DeleteNode(countryId); + f.GetStorage().DeleteNode(countryId); } } + (void)cancelDownloadNode:(TCountryId const &)countryId { - GetFramework().Storage().CancelDownloadNode(countryId); + GetFramework().GetStorage().CancelDownloadNode(countryId); } + (void)showNode:(TCountryId const &)countryId @@ -91,14 +91,14 @@ using namespace storage; [](size_t const & size, TCountryId const & countryId) { NodeAttrs nodeAttrs; - GetFramework().Storage().GetNodeAttrs(countryId, nodeAttrs); + GetFramework().GetStorage().GetNodeAttrs(countryId, nodeAttrs); return size + nodeAttrs.m_mwmSize - nodeAttrs.m_localMwmSize; }); if (GetPlatform().GetWritableStorageStatus(requiredSize) == Platform::TStorageStatus::STORAGE_OK) { [self checkConnectionAndPerformAction:[countryIds, onSuccess] { - auto & s = GetFramework().Storage(); + auto & s = GetFramework().GetStorage(); for (auto const & countryId : countryIds) s.DownloadNode(countryId); if (onSuccess) @@ -124,11 +124,11 @@ using namespace storage; break; case Platform::EConnectionType::CONNECTION_WWAN: { - if (!GetFramework().DownloadingPolicy().IsCellularDownloadEnabled()) + if (!GetFramework().GetDownloadingPolicy().IsCellularDownloadEnabled()) { [alertController presentNoWiFiAlertWithOkBlock:[action] { - GetFramework().DownloadingPolicy().EnableCellularDownload(true); + GetFramework().GetDownloadingPolicy().EnableCellularDownload(true); action(); }]; } diff --git a/iphone/Maps/Classes/Widgets/MWMMapDownloadDialog.mm b/iphone/Maps/Classes/Widgets/MWMMapDownloadDialog.mm index 6edb6ead63..3e27cd82ae 100644 --- a/iphone/Maps/Classes/Widgets/MWMMapDownloadDialog.mm +++ b/iphone/Maps/Classes/Widgets/MWMMapDownloadDialog.mm @@ -32,7 +32,7 @@ BOOL canAutoDownload(TCountryId const & countryId) CLLocation * lastLocation = [MWMLocationManager lastLocation]; if (!lastLocation) return NO; - auto const & countryInfoGetter = GetFramework().CountryInfoGetter(); + auto const & countryInfoGetter = GetFramework().GetCountryInfoGetter(); if (countryId != countryInfoGetter.GetRegionCountryId(lastLocation.mercator)) return NO; return !platform::migrate::NeedMigrate(); @@ -101,8 +101,8 @@ using namespace storage; - (void)configDialog { auto & f = GetFramework(); - auto const & s = f.Storage(); - auto const & p = f.DownloadingPolicy(); + auto const & s = f.GetStorage(); + auto const & p = f.GetDownloadingPolicy(); NodeAttrs nodeAttrs; s.GetNodeAttrs(m_countryId, nodeAttrs); diff --git a/iphone/Maps/Statistics/MWMCustomFacebookEvents.mm b/iphone/Maps/Statistics/MWMCustomFacebookEvents.mm index 6fce50515b..f7e179cd65 100644 --- a/iphone/Maps/Statistics/MWMCustomFacebookEvents.mm +++ b/iphone/Maps/Statistics/MWMCustomFacebookEvents.mm @@ -75,16 +75,16 @@ static int gStorageSubscriptionId = kNotSubscribed; { if (gStorageSubscriptionId == kNotSubscribed) { - gStorageSubscriptionId = GetFramework().Storage().Subscribe([](storage::TCountryId const &) + gStorageSubscriptionId = GetFramework().GetStorage().Subscribe([](storage::TCountryId const &) { - if (GetFramework().Storage().GetDownloadedFilesCount() >= 2) + if (GetFramework().GetStorage().GetDownloadedFilesCount() >= 2) { [FBSDKAppEvents logEvent:kDownloadedSecondMapEvent]; [MWMCustomFacebookEvents markEventAsAlreadyFired:kDownloadedSecondMapEvent]; // We can't unsubscribe from this callback immediately now, it will crash Storage's observers notification. dispatch_async(dispatch_get_main_queue(), ^{ - GetFramework().Storage().Unsubscribe(gStorageSubscriptionId); + GetFramework().GetStorage().Unsubscribe(gStorageSubscriptionId); gStorageSubscriptionId = kNotSubscribed; }); [Alohalytics logEvent:kDownloadedSecondMapEvent]; diff --git a/map/framework.cpp b/map/framework.cpp index 3080d4cf8b..430f63239e 100644 --- a/map/framework.cpp +++ b/map/framework.cpp @@ -268,7 +268,7 @@ TCountryId Framework::PreMigrate(ms::LatLon const & position, Storage::TChangeCountryFunction const & change, Storage::TProgressFunction const & progress) { - Storage().PrefetchMigrateData(); + GetStorage().PrefetchMigrateData(); auto const infoGetter = CountryInfoReader::CreateCountryInfoReaderOneComponentMwms(GetPlatform()); @@ -279,8 +279,8 @@ TCountryId Framework::PreMigrate(ms::LatLon const & position, if (currentCountryId == kInvalidCountryId) return kInvalidCountryId; - Storage().GetPrefetchStorage()->Subscribe(change, progress); - Storage().GetPrefetchStorage()->DownloadNode(currentCountryId); + GetStorage().GetPrefetchStorage()->Subscribe(change, progress); + GetStorage().GetPrefetchStorage()->DownloadNode(currentCountryId); return currentCountryId; } @@ -296,10 +296,10 @@ void Framework::Migrate(bool keepDownloaded) m_searchEngine.reset(); m_infoGetter.reset(); TCountriesVec existedCountries; - Storage().DeleteAllLocalMaps(&existedCountries); + GetStorage().DeleteAllLocalMaps(&existedCountries); DeregisterAllMaps(); m_model.Clear(); - Storage().Migrate(keepDownloaded ? existedCountries : TCountriesVec()); + GetStorage().Migrate(keepDownloaded ? existedCountries : TCountriesVec()); InitCountryInfoGetter(); InitSearchEngine(); RegisterAllMaps(); @@ -483,7 +483,7 @@ void Framework::ShowNode(storage::TCountryId const & countryId) { StopLocationFollow(); - ShowRect(CalcLimitRect(countryId, Storage(), CountryInfoGetter())); + ShowRect(CalcLimitRect(countryId, GetStorage(), GetCountryInfoGetter())); } void Framework::OnCountryFileDownloaded(storage::TCountryId const & countryId, storage::Storage::TLocalFilePtr const localFile) @@ -556,7 +556,7 @@ bool Framework::HasUnsavedEdits(storage::TCountryId const & countryId) hasUnsavedChanges |= osm::Editor::Instance().HaveMapEditsToUpload( m_model.GetIndex().GetMwmIdByCountryFile(platform::CountryFile(fileName))); }; - Storage().ForEachInSubtree(countryId, forEachInSubtree); + GetStorage().ForEachInSubtree(countryId, forEachInSubtree); return hasUnsavedChanges; } @@ -575,7 +575,7 @@ void Framework::RegisterAllMaps() settings::Get("DisableFastMigrate", disableFastMigrate); if (!disableFastMigrate && !m_storage.HaveDownloadedCountries()) { - Storage().PrefetchMigrateData(); + GetStorage().PrefetchMigrateData(); Migrate(); return; } @@ -717,7 +717,7 @@ void Framework::FillFeatureInfo(FeatureID const & fid, place_page::Info & info) { size_t const level = isState ? 1 : 0; TCountriesVec countries; - Storage().GetTopmostNodesFor(info.m_countryId, countries, level); + GetStorage().GetTopmostNodesFor(info.m_countryId, countries, level); if (countries.size() == 1) info.m_countryId = countries.front(); } @@ -1144,8 +1144,7 @@ bool Framework::SearchInDownloader(DownloaderSearchParams const & params) p.SetMode(search::Mode::Downloader); p.SetSuggestsEnabled(false); p.SetForceSearch(true); - p.m_onResults = search::DownloaderSearchCallback(m_model.GetIndex(), CountryInfoGetter(), - params); + p.m_onResults = search::DownloaderSearchCallback(m_model.GetIndex(), GetCountryInfoGetter(), GetStorage(), params); return Search(p); } diff --git a/map/framework.hpp b/map/framework.hpp index 51b7f35dcf..44738886a3 100644 --- a/map/framework.hpp +++ b/map/framework.hpp @@ -237,10 +237,10 @@ public: string GetCountryName(m2::PointD const & pt) const; //@} - storage::Storage & Storage() { return m_storage; } - storage::Storage const & Storage() const { return m_storage; } - storage::CountryInfoGetter & CountryInfoGetter() { return *m_infoGetter; } - StorageDownloadingPolicy & DownloadingPolicy() { return m_storageDownloadingPolicy; } + storage::Storage & GetStorage() { return m_storage; } + storage::Storage const & GetStorage() const { return m_storage; } + storage::CountryInfoGetter & GetCountryInfoGetter() { return *m_infoGetter; } + StorageDownloadingPolicy & GetDownloadingPolicy() { return m_storageDownloadingPolicy; } /// @name Bookmarks, Tracks and other UserMarks //@{ diff --git a/qt/draw_widget.cpp b/qt/draw_widget.cpp index 9c649fb0e5..4c3b9717ed 100644 --- a/qt/draw_widget.cpp +++ b/qt/draw_widget.cpp @@ -124,14 +124,14 @@ void DrawWidget::UpdateCountryStatus(storage::TCountryId const & countryId) if (m_currentCountryChanged != nullptr) { string countryName = countryId; - auto status = m_framework->Storage().CountryStatusEx(countryId); + auto status = m_framework->GetStorage().CountryStatusEx(countryId); uint8_t progressInPercentage = 0; storage::MapFilesDownloader::TProgress progressInByte = make_pair(0, 0); if (!countryId.empty()) { storage::NodeAttrs nodeAttrs; - m_framework->Storage().GetNodeAttrs(countryId, nodeAttrs); + m_framework->GetStorage().GetNodeAttrs(countryId, nodeAttrs); progressInByte = nodeAttrs.m_downloadingProgress; if (progressInByte.second != 0) progressInPercentage = static_cast(100 * progressInByte.first / progressInByte.second); @@ -155,7 +155,7 @@ void DrawWidget::SetCurrentCountryChangedListener(DrawWidget::TCurrentCountryCha void DrawWidget::DownloadCountry(storage::TCountryId const & countryId) { - m_framework->Storage().DownloadNode(countryId); + m_framework->GetStorage().DownloadNode(countryId); if (!m_countryId.empty()) UpdateCountryStatus(m_countryId); } diff --git a/qt/search_panel.cpp b/qt/search_panel.cpp index 6cf1654c12..bee34ae791 100644 --- a/qt/search_panel.cpp +++ b/qt/search_panel.cpp @@ -219,7 +219,7 @@ bool SearchPanel::TryMigrate(QString const & str) auto const stateChanged = [&](storage::TCountryId const & id) { - storage::Status const nextStatus = m_pDrawWidget->GetFramework().Storage().GetPrefetchStorage()->CountryStatusEx(id); + storage::Status const nextStatus = m_pDrawWidget->GetFramework().GetStorage().GetPrefetchStorage()->CountryStatusEx(id); LOG_SHORT(LINFO, (id, "status :", nextStatus)); if (nextStatus == storage::Status::EOnDisk) { diff --git a/qt/update_dialog.cpp b/qt/update_dialog.cpp index 8d4743c10c..0449738eba 100644 --- a/qt/update_dialog.cpp +++ b/qt/update_dialog.cpp @@ -402,7 +402,7 @@ namespace qt m_tree->setSortingEnabled(false); m_tree->clear(); - TCountryId const rootId = m_framework.Storage().GetRootId(); + TCountryId const rootId = m_framework.GetStorage().GetRootId(); FillTreeImpl(nullptr /* parent */, rootId, filter); // Expand the root. diff --git a/qt/update_dialog.hpp b/qt/update_dialog.hpp index 275c8b5f6b..bcc03b3b43 100644 --- a/qt/update_dialog.hpp +++ b/qt/update_dialog.hpp @@ -55,7 +55,7 @@ namespace qt storage::TCountryId GetCountryIdByTreeItem(QTreeWidgetItem *); private: - inline storage::Storage & GetStorage() const { return m_framework.Storage(); } + inline storage::Storage & GetStorage() const { return m_framework.GetStorage(); } QTreeWidget * m_tree; Framework & m_framework; diff --git a/search/downloader_search_callback.cpp b/search/downloader_search_callback.cpp index 894b6f695a..daab4d63e4 100644 --- a/search/downloader_search_callback.cpp +++ b/search/downloader_search_callback.cpp @@ -11,7 +11,8 @@ namespace { -bool GetGroupCountryIdFromFeature(FeatureType const & ft, string & name) +bool GetGroupCountryIdFromFeature(storage::Storage const & storage, FeatureType const & ft, + string & name) { int8_t langIndices[] = {StringUtf8Multilang::kEnglishCode, StringUtf8Multilang::kDefaultCode, StringUtf8Multilang::kInternationalCode}; @@ -20,7 +21,7 @@ bool GetGroupCountryIdFromFeature(FeatureType const & ft, string & name) { if (!ft.GetName(langIndex, name)) continue; - if (storage::Storage().IsCoutryIdCountryTreeInnerNode(name)) + if (storage.IsCoutryIdCountryTreeInnerNode(name)) return true; } return false; @@ -31,8 +32,9 @@ namespace search { DownloaderSearchCallback::DownloaderSearchCallback(Index const & index, storage::CountryInfoGetter const & infoGetter, + storage::Storage const & storage, storage::DownloaderSearchParams params) - : m_index(index), m_infoGetter(infoGetter), m_params(move(params)) + : m_index(index), m_infoGetter(infoGetter), m_storage(storage), m_params(move(params)) { } @@ -61,7 +63,7 @@ void DownloaderSearchCallback::operator()(search::Results const & results) if (type == ftypes::COUNTRY || type == ftypes::STATE) { string groupFeatureName; - if (GetGroupCountryIdFromFeature(ft, groupFeatureName)) + if (GetGroupCountryIdFromFeature(m_storage, ft, groupFeatureName)) { storage::DownloaderSearchResult downloaderResult(groupFeatureName, result.GetString() /* m_matchedName */); @@ -94,8 +96,9 @@ void DownloaderSearchCallback::operator()(search::Results const & results) if (m_params.m_onResults) { + auto onResults = m_params.m_onResults; GetPlatform().RunOnGuiThread( - [this, downloaderSearchResults]() { m_params.m_onResults(downloaderSearchResults); }); + [onResults, downloaderSearchResults]() { onResults(downloaderSearchResults); }); } } } // namespace search diff --git a/search/downloader_search_callback.hpp b/search/downloader_search_callback.hpp index 86c6e6d161..b60181e981 100644 --- a/search/downloader_search_callback.hpp +++ b/search/downloader_search_callback.hpp @@ -10,11 +10,9 @@ class Index; namespace storage { class CountryInfoGetter; +class Storage; } // namespace storage -// todo(@m) -// add tests - namespace search { class Results; @@ -28,6 +26,7 @@ public: using TOnResults = storage::DownloaderSearchParams::TOnResults; DownloaderSearchCallback(Index const & index, storage::CountryInfoGetter const & infoGetter, + storage::Storage const & storage, storage::DownloaderSearchParams params); void operator()(search::Results const & results); @@ -37,6 +36,7 @@ private: Index const & m_index; storage::CountryInfoGetter const & m_infoGetter; + storage::Storage const & m_storage; storage::DownloaderSearchParams m_params; }; } // namespace search diff --git a/storage/storage_integration_tests/migrate_tests.cpp b/storage/storage_integration_tests/migrate_tests.cpp index a836daf037..8fa928b53d 100644 --- a/storage/storage_integration_tests/migrate_tests.cpp +++ b/storage/storage_integration_tests/migrate_tests.cpp @@ -25,7 +25,7 @@ UNIT_TEST(StorageFastMigrationTests) WritableDirChanger writableDirChanger(kMapTestDir); Framework f; - auto & s = f.Storage(); + auto & s = f.GetStorage(); uint32_t version; TEST(settings::Get("LastMigration", version), ("LastMigration didn't set")); @@ -44,13 +44,13 @@ UNIT_TEST(StorageMigrationTests) settings::Set("DisableFastMigrate", true); Framework f; - auto & s = f.Storage(); + auto & s = f.GetStorage(); auto statePrefetchChanged = [&](TCountryId const & id) { - Status const nextStatus = f.Storage().GetPrefetchStorage()->CountryStatusEx(id); + Status const nextStatus = f.GetStorage().GetPrefetchStorage()->CountryStatusEx(id); LOG_SHORT(LINFO, (id, "status :", nextStatus)); - if (!f.Storage().GetPrefetchStorage()->IsDownloadInProgress()) + if (!f.GetStorage().GetPrefetchStorage()->IsDownloadInProgress()) { LOG_SHORT(LINFO, ("All prefetched. Ready to migrate.")); testing::StopEventLoop(); @@ -59,7 +59,7 @@ UNIT_TEST(StorageMigrationTests) auto stateChanged = [&](TCountryId const & id) { - if (!f.Storage().IsDownloadInProgress()) + if (!f.GetStorage().IsDownloadInProgress()) { LOG_SHORT(LINFO, ("All downloaded. Check consistency.")); testing::StopEventLoop(); @@ -87,7 +87,7 @@ UNIT_TEST(StorageMigrationTests) TEST(s.IsNodeDownloaded(countryId), (countryId)); TEST_NOT_EQUAL(f.PreMigrate(curPos, statePrefetchChanged, progressChanged), kInvalidCountryId, ()); - TEST(f.Storage().GetPrefetchStorage()->IsDownloadInProgress(), ("Empty queue")); + TEST(f.GetStorage().GetPrefetchStorage()->IsDownloadInProgress(), ("Empty queue")); // Wait for downloading complete. testing::RunEventLoop(); diff --git a/storage/storage_integration_tests/storage_3levels_tests.cpp b/storage/storage_integration_tests/storage_3levels_tests.cpp index 4c575a66bd..6da1b1b1b0 100644 --- a/storage/storage_integration_tests/storage_3levels_tests.cpp +++ b/storage/storage_integration_tests/storage_3levels_tests.cpp @@ -40,7 +40,7 @@ UNIT_TEST(SmallMwms_3levels_Test) Platform & platform = GetPlatform(); Framework f; - auto & storage = f.Storage(); + auto & storage = f.GetStorage(); string const version = strings::to_string(storage.GetCurrentDataVersion()); TEST(version::IsSingleMwm(storage.GetCurrentDataVersion()), ()); diff --git a/storage/storage_integration_tests/storage_update_tests.cpp b/storage/storage_integration_tests/storage_update_tests.cpp index c587340508..6aa2339076 100644 --- a/storage/storage_integration_tests/storage_update_tests.cpp +++ b/storage/storage_integration_tests/storage_update_tests.cpp @@ -88,7 +88,7 @@ UNIT_TEST(SmallMwms_Update_Test) { Framework f; - auto & storage = f.Storage(); + auto & storage = f.GetStorage(); string const version = strings::to_string(storage.GetCurrentDataVersion()); TEST(version::IsSingleMwm(storage.GetCurrentDataVersion()), ()); TEST_EQUAL(version, kMwmVersion1, ()); @@ -126,7 +126,7 @@ UNIT_TEST(SmallMwms_Update_Test) { Framework f; - auto & storage = f.Storage(); + auto & storage = f.GetStorage(); string const version = strings::to_string(storage.GetCurrentDataVersion()); TEST(version::IsSingleMwm(storage.GetCurrentDataVersion()), ()); TEST_EQUAL(version, kMwmVersion2, ());