forked from organicmaps/organicmaps
[MAPSME-6024] [ios] Fixed downloader closest countries filtering issue.
This commit is contained in:
parent
994e1bee3a
commit
86a771f2cc
1 changed files with 9 additions and 2 deletions
|
@ -45,12 +45,19 @@ auto constexpr extraSection = MWMMapDownloaderDataSourceExtraSection::NearMe;
|
|||
CLLocation * lastLocation = [MWMLocationManager lastLocation];
|
||||
if (!lastLocation)
|
||||
return;
|
||||
auto & countryInfoGetter = GetFramework().GetCountryInfoGetter();
|
||||
auto & f = GetFramework();
|
||||
auto & countryInfoGetter = f.GetCountryInfoGetter();
|
||||
TCountriesVec closestCoutryIds;
|
||||
countryInfoGetter.GetRegionsCountryId(lastLocation.mercator, closestCoutryIds);
|
||||
NSMutableArray<NSString *> * nearmeCountries = [@[] mutableCopy];
|
||||
for (auto const & countryId : closestCoutryIds)
|
||||
[nearmeCountries addObject:@(countryId.c_str())];
|
||||
{
|
||||
storage::NodeStatuses nodeStatuses;
|
||||
f.GetStorage().GetNodeStatuses(countryId, nodeStatuses);
|
||||
if (nodeStatuses.m_status != NodeStatus::OnDisk)
|
||||
[nearmeCountries addObject:@(countryId.c_str())];
|
||||
}
|
||||
|
||||
self.nearmeCountries = nearmeCountries;
|
||||
if (nearmeCountries.count != 0)
|
||||
[self addExtraSection:extraSection];
|
||||
|
|
Loading…
Add table
Reference in a new issue