diff --git a/local_ads/statistics.cpp b/local_ads/statistics.cpp index ae1e4e98f7..f60782684c 100644 --- a/local_ads/statistics.cpp +++ b/local_ads/statistics.cpp @@ -167,8 +167,9 @@ void Statistics::Startup() SendToServer(); }; - auto const recursiveAsyncTask = [asyncTask] + auto const recursiveAsyncTask = [this, asyncTask] { + IndexMetadata(); asyncTask(); GetPlatform().RunDelayedTask(Platform::Thread::File, kSendingTimeout, asyncTask); }; @@ -494,7 +495,7 @@ void Statistics::CleanupAfterTesting() GetPlatform().RmDirRecursively(statsFolder); } -void Statistics::SetCustomServerSerializer(ServerSerializer && serializer) +void Statistics::SetCustomServerSerializer(ServerSerializer const & serializer) { GetPlatform().RunTask(Platform::Thread::File, [this, serializer] { m_serverSerializer = serializer; }); diff --git a/local_ads/statistics.hpp b/local_ads/statistics.hpp index f5a71353f0..0e870362e5 100644 --- a/local_ads/statistics.hpp +++ b/local_ads/statistics.hpp @@ -9,7 +9,6 @@ #include #include #include -#include #include #include @@ -38,7 +37,7 @@ public: void SetUserId(std::string const & userId); - void SetCustomServerSerializer(ServerSerializer && serializer); + void SetCustomServerSerializer(ServerSerializer const & serializer); void RegisterEvent(Event && event); void RegisterEvents(std::list && events); diff --git a/map/framework.cpp b/map/framework.cpp index 6a594715d6..828010e86a 100644 --- a/map/framework.cpp +++ b/map/framework.cpp @@ -472,9 +472,7 @@ Framework::Framework(FrameworkParams const & params) // Local ads manager should be initialized after storage initialization. if (params.m_enableLocalAds) - { m_localAdsManager.Startup(m_bmManager.get()); - } m_routingManager.SetRouterImpl(RouterType::Vehicle); @@ -1834,8 +1832,7 @@ void Framework::DestroyDrapeEngine() m_trafficManager.SetDrapeEngine(nullptr); m_localAdsManager.SetDrapeEngine(nullptr); m_searchMarks.SetDrapeEngine(nullptr); - m_bmManager.SetDrapeEngine(nullptr); - m_localAdsManager.SetDrapeEngine(nullptr); + GetBookmarkManager().SetDrapeEngine(nullptr); m_trafficManager.Teardown(); GpsTracker::Instance().Disconnect(); diff --git a/map/local_ads_manager.cpp b/map/local_ads_manager.cpp index c141c90655..07d38c0e39 100644 --- a/map/local_ads_manager.cpp +++ b/map/local_ads_manager.cpp @@ -403,29 +403,32 @@ bool LocalAdsManager::DownloadCampaign(MwmSet::MwmId const & mwmId, std::vector< return true; } -void LocalAdsManager::ProcessRequests(std::set const & campaignMwms) +void LocalAdsManager::ProcessRequests(std::set const & requests) { std::string const campaignFile = GetPath(kCampaignFile); - for (auto const & mwm : campaignMwms) + for (auto const & request : requests) { - if (!mwm.first.IsAlive()) + auto const & mwm = request.first; + auto const & type = request.second; + + if (!mwm.IsAlive()) continue; - std::string const countryName = mwm.first.GetInfo()->GetCountryName(); - if (mwm.second == RequestType::Download) + std::string const countryName = mwm.GetInfo()->GetCountryName(); + if (type == RequestType::Download) { // Download campaign data from server. CampaignInfo info; info.m_created = local_ads::Clock::now(); - if (!DownloadCampaign(mwm.first, info.m_data)) + if (!DownloadCampaign(mwm, info.m_data)) continue; // Parse data and recreate marks. - ClearLocalAdsForMwm(mwm.first); + ClearLocalAdsForMwm(mwm); if (!info.m_data.empty()) { - auto campaignData = ParseCampaign(std::move(info.m_data), mwm.first, info.m_created); + auto campaignData = ParseCampaign(std::move(info.m_data), mwm, info.m_created); if (!campaignData.empty()) { UpdateFeaturesCache(ReadCampaignFeatures(m_readFeaturesFn, campaignData)); @@ -436,11 +439,11 @@ void LocalAdsManager::ProcessRequests(std::set const & campaignMwms) m_campaigns[countryName] = true; m_info[countryName] = info; } - else if (mwm.second == RequestType::Delete) + else if (type == RequestType::Delete) { m_campaigns.erase(countryName); m_info.erase(countryName); - ClearLocalAdsForMwm(mwm.first); + ClearLocalAdsForMwm(mwm); } } diff --git a/platform/platform.hpp b/platform/platform.hpp index 1685c613b2..a9209e0155 100644 --- a/platform/platform.hpp +++ b/platform/platform.hpp @@ -286,7 +286,7 @@ public: m_networkThread.PushDelayed(delay, forward(task)); break; case Thread::Gui: - ASSERT(false, ("Delayed tasks for gui thread are not supported yet")); + CHECK(false, ("Delayed tasks for gui thread are not supported yet")); break; } }