[new downloader] add: Filter reports about changed country.

This commit is contained in:
Alexander Marchuk 2016-02-12 13:37:44 +03:00 committed by Sergey Yershov
parent 05996dcc03
commit 796a53ed97
2 changed files with 8 additions and 0 deletions

View file

@ -268,6 +268,7 @@ Framework::Framework()
: m_storage(platform::migrate::NeedMigrate() ? COUNTRIES_FILE : COUNTRIES_MIGRATE_FILE)
, m_bmManager(*this)
, m_fixedSearchResults(0)
, m_lastReportedCountry(kInvalidCountryId)
{
// Restore map style before classificator loading
int mapStyle = MapStyleLight;
@ -900,6 +901,11 @@ void Framework::OnUpdateCurrentCountry(m2::PointF const & pt, int zoomLevel)
if (zoomLevel > scales::GetUpperWorldScale())
newCountryId = m_storage.FindCountryIdByFile(m_infoGetter->GetRegionCountryId(m2::PointD(pt)));
if (newCountryId == m_lastReportedCountry)
return;
m_lastReportedCountry = newCountryId;
GetPlatform().RunOnGuiThread([this, newCountryId]()
{
if (m_currentCountryChanged != nullptr)
@ -910,6 +916,7 @@ void Framework::OnUpdateCurrentCountry(m2::PointF const & pt, int zoomLevel)
void Framework::SetCurrentCountryChangedListener(TCurrentCountryChanged const & listener)
{
m_currentCountryChanged = listener;
m_lastReportedCountry = kInvalidCountryId;
}
void Framework::UpdateUserViewportChanged()

View file

@ -354,6 +354,7 @@ private:
void OnUpdateCurrentCountry(m2::PointF const & pt, int zoomLevel);
storage::TCountryId m_lastReportedCountry;
TCurrentCountryChanged m_currentCountryChanged;
// Search query params and viewport for the latest search