forked from organicmaps/organicmaps
[ios] Fixed extra section duplication. (#4573)
[ios] Fixed extra section duplication.
This commit is contained in:
parent
b52a46094e
commit
94c92f8708
2 changed files with 15 additions and 1 deletions
|
@ -39,6 +39,7 @@ auto constexpr extraSection = MWMMapDownloaderDataSourceExtraSection::NearMe;
|
|||
|
||||
- (void)configNearMeSection
|
||||
{
|
||||
[self removeExtraSection:extraSection];
|
||||
CLLocation * lastLocation = [MWMLocationManager lastLocation];
|
||||
if (!lastLocation)
|
||||
return;
|
||||
|
@ -55,7 +56,18 @@ auto constexpr extraSection = MWMMapDownloaderDataSourceExtraSection::NearMe;
|
|||
|
||||
- (void)addExtraSection:(MWMMapDownloaderDataSourceExtraSection)extraSection
|
||||
{
|
||||
m_extraSections.push_back(extraSection);
|
||||
auto const endIt = m_extraSections.end();
|
||||
auto const findIt = find(m_extraSections.begin(), endIt, extraSection);
|
||||
if (findIt == endIt)
|
||||
{
|
||||
m_extraSections.emplace_back(extraSection);
|
||||
sort(m_extraSections.begin(), m_extraSections.end());
|
||||
}
|
||||
}
|
||||
|
||||
- (void)removeExtraSection:(MWMMapDownloaderDataSourceExtraSection)extraSection
|
||||
{
|
||||
m_extraSections.erase(remove(m_extraSections.begin(), m_extraSections.end(), extraSection), m_extraSections.end());
|
||||
}
|
||||
|
||||
- (BOOL)isExtraSection:(MWMMapDownloaderDataSourceExtraSection)extraSection
|
||||
|
|
|
@ -17,6 +17,7 @@ auto constexpr extraSection = MWMMapDownloaderDataSourceExtraSection::Ads;
|
|||
|
||||
- (void)load;
|
||||
- (void)addExtraSection:(MWMMapDownloaderDataSourceExtraSection)extraSection;
|
||||
- (void)removeExtraSection:(MWMMapDownloaderDataSourceExtraSection)extraSection;
|
||||
- (BOOL)isExtraSection:(MWMMapDownloaderDataSourceExtraSection)extraSection
|
||||
atIndex:(NSInteger)sectionIndex;
|
||||
|
||||
|
@ -33,6 +34,7 @@ auto constexpr extraSection = MWMMapDownloaderDataSourceExtraSection::Ads;
|
|||
|
||||
- (void)configAdsSection
|
||||
{
|
||||
[self removeExtraSection:extraSection];
|
||||
if ([UIColor isNightMode] || !GetFramework().GetStorage().HaveDownloadedCountries())
|
||||
return;
|
||||
if ([MWMMyTarget manager].bannersCount != 0)
|
||||
|
|
Loading…
Add table
Reference in a new issue