[core] Version change tracking.

This commit is contained in:
Dmitry Kunin 2013-07-23 17:25:10 +03:00 committed by Alex Zolotarev
parent caf8a3dd49
commit f14c86dea3
4 changed files with 32 additions and 0 deletions

View file

@ -1633,3 +1633,19 @@ string Framework::GenerateApiBackUrl(url_scheme::ApiPoint const & point)
}
return res;
}
bool Framework::IsDataVersionChanged()
{
int64_t version;
if (Settings::Get("DataVersion", version))
{
return version != m_storage.GetCurrentDataVersion();
}
// no key in the settings, assume new version
return true;
}
void Framework::UpdateSavedDataVersion()
{
Settings::Set("DataVersion", m_storage.GetCurrentDataVersion());
}

View file

@ -445,6 +445,8 @@ private:
void SetViewPortASync(m2::RectD const & rect);
public:
/// @name Api
//@{
void MapApiSetUriAndParse(string const & url);
bool GetMapApiPoint(m2::PointD const & pxPoint, url_scheme::ApiPoint & point);
vector<url_scheme::ApiPoint> const & GetMapApiPoints() { return m_ParsedMapApi.GetPoints(); }
@ -455,4 +457,11 @@ public:
m2::RectD GetMapApiLatLonRect() const { return m_ParsedMapApi.GetLatLonRect(); }
bool IsValidMapApi() const { return m_ParsedMapApi.IsValid(); }
string GenerateApiBackUrl(url_scheme::ApiPoint const & point);
//@}
/// @name Map updates
//@{
bool IsDataVersionChanged();
void UpdateSavedDataVersion();
//@}
};

View file

@ -463,4 +463,9 @@ namespace storage
return fListNoExt.size();
}
int64_t Storage::GetCurrentDataVersion()
{
return m_currentVersion;
}
}

View file

@ -124,5 +124,7 @@ namespace storage
/// @param list is populated with oudated countries
/// @return number of outdated countries in the list
int GetOutdatedCountries(vector<Country> & list);
int64_t GetCurrentDataVersion();
};
}