Force delete old (April 2011) maps.

This commit is contained in:
vng 2012-10-04 17:21:20 +03:00 committed by Alex Zolotarev
parent c908fc6e56
commit 0c93a1dea6
3 changed files with 23 additions and 5 deletions

View file

@ -70,6 +70,8 @@ using namespace storage;
// display controller only when countries are loaded
[prevController presentModalViewController:m_navigationController animated:YES];
// We do force delete of old maps at startup from this moment.
/*
// display upgrade/delete old maps dialog if necessary
if (f.NeedToDeleteOldMaps())
{
@ -82,6 +84,7 @@ using namespace storage;
[dialog showInView:m_navigationController.view];
[dialog release];
}
*/
}
// Hides all opened settings windows
@ -93,6 +96,7 @@ using namespace storage;
[m_navigationController release], m_navigationController = nil;
}
/*
// Called from Upgrade/Delete old maps dialog
- (void) actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
@ -105,5 +109,5 @@ using namespace storage;
[self hide];
}
}
*/
@end

View file

@ -23,6 +23,8 @@
#include "../platform/preferred_languages.hpp"
#include "../platform/platform.hpp"
#include "../coding/internal/file_data.hpp"
#include "../yg/rendercontext.hpp"
#include "../yg/render_state.hpp"
@ -56,8 +58,16 @@ void Framework::AddMap(string const & file)
//threads::MutexGuard lock(m_modelSyn);
int const version = m_model.AddMap(file);
if (m_lowestMapVersion == -1 || (version != -1 && m_lowestMapVersion > version))
m_lowestMapVersion = version;
// Now we do force delete of old (April 2011) maps.
//if (m_lowestMapVersion == -1 || (version != -1 && m_lowestMapVersion > version))
// m_lowestMapVersion = version;
if (version == 0)
{
LOG(LINFO, ("Deleting old map:", file));
RemoveMap(file);
VERIFY ( my::DeleteFileX(GetPlatform().WritablePathForFile(file)), () );
}
}
void Framework::RemoveMap(string const & datFile)
@ -135,7 +145,7 @@ Framework::Framework()
m_width(0),
m_height(0),
m_informationDisplay(this),
m_lowestMapVersion(-1),
//m_lowestMapVersion(-1),
m_benchmarkEngine(0)
{
// Checking whether we should enable benchmark.
@ -1170,6 +1180,7 @@ void Framework::SetupMeasurementSystem()
Invalidate();
}
/*
// 0 - old April version which we should delete
#define MAXIMUM_VERSION_TO_DELETE 0
@ -1197,6 +1208,7 @@ void Framework::DeleteOldMaps()
}
m_lowestMapVersion = MAXIMUM_VERSION_TO_DELETE + 1;
}
*/
string Framework::GetCountryCodeByPosition(double lat, double lon) const
{

View file

@ -121,7 +121,7 @@ protected:
/// Stores lowest loaded map version
/// Holds -1 if no maps were added
/// @see feature::DataHeader::Version
int m_lowestMapVersion;
//int m_lowestMapVersion;
void DrawAdditionalInfo(shared_ptr<PaintEvent> const & e);
@ -131,12 +131,14 @@ public:
Framework();
virtual ~Framework();
/*
/// @name Used on iPhone for upgrade from April 1.0.1 version
//@{
/// @return true if client should display delete old maps dialog before using downloader
bool NeedToDeleteOldMaps() const;
void DeleteOldMaps();
//@}
*/
void AddMap(string const & file);
void RemoveMap(string const & datFile);