diff options
author | Aleksandr Zatsepin <alexzatsepin@users.noreply.github.com> | 2016-12-09 16:09:11 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-09 16:09:11 +0300 |
commit | db122bb5a28340d64e8eb5d93d0695e93d6d3ad6 (patch) | |
tree | c7654b20ea4e0be164508c28ced18f9fb1491c2a /iphone/Maps | |
parent | f262e293935d23b2e167579735b5b5c1a16224d8 (diff) | |
parent | 2ffb3c9fb7817976bf2dc8290a61d91a258fda2e (diff) |
Merge pull request #4938 from igrechuhin/adForbidden
[adForbidden] [ios] Added «show offers» switch to settings.
Diffstat (limited to 'iphone/Maps')
-rw-r--r-- | iphone/Maps/MWMSettings.h | 1 | ||||
-rw-r--r-- | iphone/Maps/MWMSettings.mm | 5 | ||||
-rw-r--r-- | iphone/Maps/Settings.storyboard | 60 | ||||
-rw-r--r-- | iphone/Maps/Settings/MWMSettingsViewController.mm | 10 |
4 files changed, 69 insertions, 7 deletions
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<bool>(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 @@ <outlet property="titleLabel" destination="Xqo-QZ-3fd" id="W1h-0a-CQ2"/> </connections> </tableViewCell> - <tableViewCell contentMode="scaleToFill" selectionStyle="none" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="SwitchCell" id="NOt-bc-7ls" customClass="SwitchCell"> + <tableViewCell contentMode="scaleToFill" selectionStyle="none" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="SwitchCell" id="F1Y-qu-HAo" customClass="SwitchCell"> <rect key="frame" x="0.0" y="443" width="375" height="44"/> <autoresizingMask key="autoresizingMask"/> + <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="F1Y-qu-HAo" id="59j-Py-CGY"> + <rect key="frame" x="0.0" y="0.0" width="375" height="43"/> + <autoresizingMask key="autoresizingMask"/> + <subviews> + <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Показывать предложения" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="13" translatesAutoresizingMaskIntoConstraints="NO" id="g5e-wH-Cqs"> + <rect key="frame" x="16" y="11" width="286" height="21"/> + <inset key="insetFor6xAndEarlier" minX="0.0" minY="0.0" maxX="-25" maxY="0.0"/> + <fontDescription key="fontDescription" type="system" pointSize="17"/> + <color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> + <nil key="highlightedColor"/> + <userDefinedRuntimeAttributes> + <userDefinedRuntimeAttribute type="string" keyPath="colorName" value="blackPrimaryText"/> + <userDefinedRuntimeAttribute type="string" keyPath="fontName" value="regular17"/> + <userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="showcase_settings_title"/> + </userDefinedRuntimeAttributes> + </label> + <switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="fDF-O1-urS"> + <rect key="frame" x="310" y="6" width="51" height="31"/> + <inset key="insetFor6xAndEarlier" minX="3" minY="-2" maxX="-3" maxY="2"/> + <color key="onTintColor" red="0.1176470588" green="0.58823529409999997" blue="0.94117647059999998" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> + <userDefinedRuntimeAttributes> + <userDefinedRuntimeAttribute type="string" keyPath="onTintColorName" value="linkBlue"/> + </userDefinedRuntimeAttributes> + </switch> + </subviews> + <constraints> + <constraint firstAttribute="trailingMargin" secondItem="fDF-O1-urS" secondAttribute="trailing" constant="8" id="2Dc-iL-dEP"/> + <constraint firstItem="g5e-wH-Cqs" firstAttribute="leading" secondItem="59j-Py-CGY" secondAttribute="leadingMargin" constant="8" id="3vv-zc-VzA"/> + <constraint firstAttribute="bottomMargin" secondItem="g5e-wH-Cqs" secondAttribute="bottom" constant="3.5" id="ByH-QR-Xvz"/> + <constraint firstItem="g5e-wH-Cqs" firstAttribute="top" secondItem="59j-Py-CGY" secondAttribute="topMargin" constant="3" id="GPk-Kh-Nkn"/> + <constraint firstItem="fDF-O1-urS" firstAttribute="leading" secondItem="g5e-wH-Cqs" secondAttribute="trailing" constant="8" id="azD-PN-ple"/> + <constraint firstItem="fDF-O1-urS" firstAttribute="centerY" secondItem="59j-Py-CGY" secondAttribute="centerY" id="zFW-en-N73"/> + </constraints> + </tableViewCellContentView> + <userDefinedRuntimeAttributes> + <userDefinedRuntimeAttribute type="string" keyPath="backgroundColorName" value="white"/> + </userDefinedRuntimeAttributes> + <connections> + <outlet property="switchButton" destination="fDF-O1-urS" id="u77-6w-0Fv"/> + <outlet property="titleLabel" destination="g5e-wH-Cqs" id="p9Q-lw-L34"/> + </connections> + </tableViewCell> + <tableViewCell contentMode="scaleToFill" selectionStyle="none" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="SwitchCell" id="NOt-bc-7ls" customClass="SwitchCell"> + <rect key="frame" x="0.0" y="487" width="375" height="44"/> + <autoresizingMask key="autoresizingMask"/> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="NOt-bc-7ls" id="xdj-y5-zpk"> <rect key="frame" x="0.0" y="0.0" width="375" height="43"/> <autoresizingMask key="autoresizingMask"/> @@ -443,7 +488,7 @@ <tableViewSection headerTitle="НАВИГАЦИЯ" id="E4E-hs-9xW"> <cells> <tableViewCell contentMode="scaleToFill" selectionStyle="default" accessoryType="disclosureIndicator" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="LinkCell" id="QNt-XC-xma" customClass="LinkCell"> - <rect key="frame" x="0.0" y="572" width="375" height="44"/> + <rect key="frame" x="0.0" y="616" width="375" height="44"/> <autoresizingMask key="autoresizingMask"/> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="QNt-XC-xma" id="fBV-aJ-Mo8"> <rect key="frame" x="0.0" y="0.0" width="342" height="43"/> @@ -490,7 +535,7 @@ </connections> </tableViewCell> <tableViewCell contentMode="scaleToFill" selectionStyle="none" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="SwitchCell" id="X5R-fv-yd7" customClass="SwitchCell"> - <rect key="frame" x="0.0" y="616" width="375" height="44"/> + <rect key="frame" x="0.0" y="660" width="375" height="44"/> <autoresizingMask key="autoresizingMask"/> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="X5R-fv-yd7" id="s7y-Nu-Y01"> <rect key="frame" x="0.0" y="0.0" width="375" height="43"/> @@ -535,7 +580,7 @@ </connections> </tableViewCell> <tableViewCell contentMode="scaleToFill" selectionStyle="none" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="SwitchCell" id="veW-Fm-2Hl" customClass="SwitchCell"> - <rect key="frame" x="0.0" y="660" width="375" height="44"/> + <rect key="frame" x="0.0" y="704" width="375" height="44"/> <autoresizingMask key="autoresizingMask"/> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="veW-Fm-2Hl" id="AP7-jd-F4b"> <rect key="frame" x="0.0" y="0.0" width="375" height="43"/> @@ -580,7 +625,7 @@ </connections> </tableViewCell> <tableViewCell contentMode="scaleToFill" selectionStyle="default" accessoryType="disclosureIndicator" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="LinkCell" id="nED-2n-gN6" customClass="LinkCell"> - <rect key="frame" x="0.0" y="704" width="375" height="44"/> + <rect key="frame" x="0.0" y="748" width="375" height="44"/> <autoresizingMask key="autoresizingMask"/> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="nED-2n-gN6" id="2oQ-0g-poj"> <rect key="frame" x="0.0" y="0.0" width="342" height="43"/> @@ -631,7 +676,7 @@ <tableViewSection headerTitle="ИНФОРМАЦИЯ" id="i4H-WV-BaS"> <cells> <tableViewCell contentMode="scaleToFill" selectionStyle="default" accessoryType="disclosureIndicator" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="LinkCell" id="JTZ-K9-RVv" customClass="LinkCell"> - <rect key="frame" x="0.0" y="797" width="375" height="44"/> + <rect key="frame" x="0.0" y="841" width="375" height="44"/> <autoresizingMask key="autoresizingMask"/> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="JTZ-K9-RVv" id="mHA-wn-hse"> <rect key="frame" x="0.0" y="0.0" width="342" height="43"/> @@ -664,7 +709,7 @@ </connections> </tableViewCell> <tableViewCell contentMode="scaleToFill" selectionStyle="default" accessoryType="disclosureIndicator" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="LinkCell" id="Kv3-pO-jV5" customClass="LinkCell"> - <rect key="frame" x="0.0" y="841" width="375" height="44"/> + <rect key="frame" x="0.0" y="885" width="375" height="44"/> <autoresizingMask key="autoresizingMask"/> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="Kv3-pO-jV5" id="8mJ-wm-9uJ"> <rect key="frame" x="0.0" y="0.0" width="342" height="43"/> @@ -718,6 +763,7 @@ <outlet property="perspectiveViewCell" destination="X5R-fv-yd7" id="hCe-Sv-pxD"/> <outlet property="profileCell" destination="yh8-cr-14c" id="nzT-Um-BHL"/> <outlet property="recentTrackCell" destination="VyW-Wh-2QX" id="zXx-a3-FBg"/> + <outlet property="showOffersCell" destination="F1Y-qu-HAo" id="poJ-lN-MJ2"/> <outlet property="statisticsCell" destination="NOt-bc-7ls" id="OeS-uK-O2Q"/> <outlet property="unitsCell" destination="Igk-BI-aHN" id="wc7-AI-ZlZ"/> <outlet property="voiceInstructionsCell" destination="nED-2n-gN6" id="AOZ-0Q-2TH"/> 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) |