forked from organicmaps/organicmaps
[local_ads] review fixes
This commit is contained in:
parent
9d7092946a
commit
cb2c892088
5 changed files with 19 additions and 19 deletions
|
@ -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; });
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#include <functional>
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
@ -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<Event> && events);
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -403,29 +403,32 @@ bool LocalAdsManager::DownloadCampaign(MwmSet::MwmId const & mwmId, std::vector<
|
|||
return true;
|
||||
}
|
||||
|
||||
void LocalAdsManager::ProcessRequests(std::set<Request> const & campaignMwms)
|
||||
void LocalAdsManager::ProcessRequests(std::set<Request> 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<Request> 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -286,7 +286,7 @@ public:
|
|||
m_networkThread.PushDelayed(delay, forward<Task>(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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue