[map] no need to migrate UGC API

This commit is contained in:
Arsentiy Milchakov 2019-03-20 17:28:12 +03:00
parent 5d9dc34447
commit b031ac73df
2 changed files with 14 additions and 17 deletions

View file

@ -368,14 +368,12 @@ void Framework::Migrate(bool keepDownloaded)
m_infoGetter.reset();
m_taxiEngine.reset();
m_cityFinder.reset();
m_ugcApi.reset();
CountriesVec existedCountries;
GetStorage().DeleteAllLocalMaps(&existedCountries);
DeregisterAllMaps();
m_model.Clear();
GetStorage().Migrate(keepDownloaded ? existedCountries : CountriesVec());
InitCountryInfoGetter();
InitUGC();
InitSearchAPI();
InitCityFinder();
InitDiscoveryManager();
@ -469,9 +467,6 @@ Framework::Framework(FrameworkParams const & params)
InitCountryInfoGetter();
LOG(LDEBUG, ("Country info getter initialized"));
InitUGC();
LOG(LDEBUG, ("UGC initialized"));
InitSearchAPI();
LOG(LDEBUG, ("Search API initialized"));
@ -548,6 +543,9 @@ Framework::Framework(FrameworkParams const & params)
m_trafficManager.SetSimplifiedColorScheme(LoadTrafficSimplifiedColors());
m_trafficManager.SetEnabled(LoadTrafficEnabled());
InitUGC();
LOG(LDEBUG, ("UGC initialized"));
m_adsEngine = make_unique<ads::Engine>();
InitTransliteration();
@ -1479,16 +1477,6 @@ void Framework::InitUGC()
ASSERT(!m_ugcApi.get(), ("InitUGC() must be called only once."));
m_ugcApi = make_unique<ugc::Api>(m_model.GetDataSource(), [this](size_t numberOfUnsynchronized) {
bool ugcStorageValidationExecuted = false;
UNUSED_VALUE(settings::Get("WasUgcStorageValidationExecuted", ugcStorageValidationExecuted));
if (!ugcStorageValidationExecuted)
{
m_ugcApi->ValidateStorage();
settings::Set("WasUgcStorageValidationExecuted", true);
}
if (numberOfUnsynchronized == 0)
return;
@ -1496,6 +1484,15 @@ void Framework::InitUGC()
"UGC_unsent", {{"num", strings::to_string(numberOfUnsynchronized)},
{"is_authenticated", strings::to_string(m_user.IsAuthenticated())}});
});
bool ugcStorageValidationExecuted = false;
UNUSED_VALUE(settings::Get("WasUgcStorageValidationExecuted", ugcStorageValidationExecuted));
if (!ugcStorageValidationExecuted)
{
m_ugcApi->ValidateStorage();
settings::Set("WasUgcStorageValidationExecuted", true);
}
}
void Framework::InitSearchAPI()

View file

@ -195,8 +195,6 @@ protected:
// search::Engine and, therefore, destroyed after search::Engine.
unique_ptr<storage::CountryInfoGetter> m_infoGetter;
unique_ptr<ugc::Api> m_ugcApi;
LocalAdsManager m_localAdsManager;
unique_ptr<SearchAPI> m_searchAPI;
@ -241,6 +239,8 @@ protected:
TrafficManager m_trafficManager;
unique_ptr<ugc::Api> m_ugcApi;
User m_user;
booking::filter::FilterProcessor m_bookingFilterProcessor;