diff --git a/iphone/Maps/MWMSettings.h b/iphone/Maps/MWMSettings.h index 777628c2d3..f2d612c6db 100644 --- a/iphone/Maps/MWMSettings.h +++ b/iphone/Maps/MWMSettings.h @@ -6,6 +6,7 @@ + (void)setAdServerForbidden:(BOOL)adServerForbidden; + (BOOL)adForbidden; ++ (void)setAdForbidden:(BOOL)adForbidden; + (BOOL)autoDownloadEnabled; + (void)setAutoDownloadEnabled:(BOOL)autoDownloadEnabled; diff --git a/iphone/Maps/MWMSettings.mm b/iphone/Maps/MWMSettings.mm index 7066547a39..bcb055a62b 100644 --- a/iphone/Maps/MWMSettings.mm +++ b/iphone/Maps/MWMSettings.mm @@ -42,6 +42,11 @@ NSString * const kSpotlightLocaleLanguageId = @"SpotlightLocaleLanguageId"; return adForbidden; } ++ (void)setAdForbidden:(BOOL)adForbidden +{ + settings::Set(kAdForbiddenSettingsKey, static_cast(adForbidden)); +} + + (BOOL)autoDownloadEnabled { bool autoDownloadEnabled = true; diff --git a/iphone/Maps/Settings.storyboard b/iphone/Maps/Settings.storyboard index 58a7300318..674d23df9a 100644 --- a/iphone/Maps/Settings.storyboard +++ b/iphone/Maps/Settings.storyboard @@ -393,9 +393,54 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -443,7 +488,7 @@ - + @@ -490,7 +535,7 @@ - + @@ -535,7 +580,7 @@ - + @@ -580,7 +625,7 @@ - + @@ -631,7 +676,7 @@ - + @@ -664,7 +709,7 @@ - + @@ -718,6 +763,7 @@ + diff --git a/iphone/Maps/Settings/MWMSettingsViewController.mm b/iphone/Maps/Settings/MWMSettingsViewController.mm index 440a394cdc..881db9ec5d 100644 --- a/iphone/Maps/Settings/MWMSettingsViewController.mm +++ b/iphone/Maps/Settings/MWMSettingsViewController.mm @@ -28,6 +28,7 @@ extern NSString * const kAlohalyticsTapEventKey; @property(weak, nonatomic) IBOutlet LinkCell * mobileInternetCell; @property(weak, nonatomic) IBOutlet LinkCell * recentTrackCell; @property(weak, nonatomic) IBOutlet SwitchCell * compassCalibrationCell; +@property(weak, nonatomic) IBOutlet SwitchCell * showOffersCell; @property(weak, nonatomic) IBOutlet SwitchCell * statisticsCell; @property(weak, nonatomic) IBOutlet LinkCell * nightModeCell; @@ -116,6 +117,9 @@ extern NSString * const kAlohalyticsTapEventKey; self.compassCalibrationCell.switchButton.on = [MWMSettings compassCalibrationEnabled]; self.compassCalibrationCell.delegate = self; + self.showOffersCell.switchButton.on = ![MWMSettings adForbidden]; + self.showOffersCell.delegate = self; + self.statisticsCell.switchButton.on = [MWMSettings statisticsEnabled]; self.statisticsCell.delegate = self; } @@ -196,6 +200,12 @@ extern NSString * const kAlohalyticsTapEventKey; withParameters:@{kStatValue : (value ? kStatOn : kStatOff)}]; [MWMSettings setCompassCalibrationEnabled:value]; } + else if (cell == self.showOffersCell) + { + [Statistics logEvent:kStatEventName(kStatSettings, kStatAd) + withParameters:@{kStatAction : kStatAd, kStatValue : (value ? kStatOn : kStatOff)}]; + [MWMSettings setAdForbidden:!value]; + } else if (cell == self.statisticsCell) { [Statistics logEvent:kStatEventName(kStatSettings, kStatToggleStatistics) diff --git a/map/place_page_info.cpp b/map/place_page_info.cpp index 972205f32b..cc153fe4a2 100644 --- a/map/place_page_info.cpp +++ b/map/place_page_info.cpp @@ -6,6 +6,7 @@ #include "platform/measurement_utils.hpp" #include "platform/preferred_languages.hpp" +#include "platform/settings.hpp" namespace place_page { @@ -39,7 +40,9 @@ bool Info::HasWifi() const { return GetInternet() == osm::Internet::Wlan; } bool Info::HasBanner() const { - return !m_banner.IsEmpty() && m_banner.IsActive(); + bool adForbidden = false; + UNUSED_VALUE(settings::Get("AdForbidden", adForbidden)); + return !adForbidden && !m_banner.IsEmpty() && m_banner.IsActive(); } string Info::FormatNewBookmarkName() const