forked from organicmaps/organicmaps
Merge pull request #5196 from VladiMihaylenko/master
[ios] Removed fake message from viral alert.
This commit is contained in:
commit
0480c514ed
2 changed files with 30 additions and 56 deletions
|
@ -5,20 +5,9 @@
|
|||
#import "MWMEditorViralAlert.h"
|
||||
#import "Statistics.h"
|
||||
|
||||
#include "indexer/osm_editor.hpp"
|
||||
|
||||
#include "std/array.hpp"
|
||||
|
||||
namespace
|
||||
{
|
||||
array<NSString *, 2> const kMessages {{L(@"editor_done_dialog_1"), L(@"editor_done_dialog_2")}};
|
||||
} // namespace
|
||||
|
||||
@interface MWMEditorViralAlert ()
|
||||
|
||||
@property (weak, nonatomic) IBOutlet UILabel * message;
|
||||
@property (weak, nonatomic) IBOutlet UIButton * shareButton;
|
||||
@property (nonatomic) int indexOfMessage;
|
||||
@property(weak, nonatomic) IBOutlet UIButton * shareButton;
|
||||
|
||||
@end
|
||||
|
||||
|
@ -26,27 +15,12 @@ namespace
|
|||
|
||||
+ (nonnull instancetype)alert
|
||||
{
|
||||
MWMEditorViralAlert * alert = [[[NSBundle mainBundle] loadNibNamed:[self className] owner:nil options:nil] firstObject];
|
||||
alert.indexOfMessage = rand() % kMessages.size();
|
||||
NSString * message = kMessages[alert.indexOfMessage];
|
||||
if (alert.indexOfMessage == 1)
|
||||
{
|
||||
int const ratingValue = (rand() % 1000) + 1000;
|
||||
message = [NSString stringWithFormat:message, ratingValue];
|
||||
}
|
||||
alert.message.text = message;
|
||||
NSMutableDictionary <NSString *, NSString *> * info = [@{kStatValue : alert.statMessage} mutableCopy];
|
||||
NSString * un = osm_auth_ios::OSMUserName();
|
||||
if (un)
|
||||
info[kStatOSMUserName] = un;
|
||||
|
||||
[Statistics logEvent:kStatEditorSecondTimeShareShow withParameters:info];
|
||||
return alert;
|
||||
return [[[NSBundle mainBundle] loadNibNamed:[self className] owner:nil options:nil] firstObject];
|
||||
}
|
||||
|
||||
- (IBAction)shareTap
|
||||
{
|
||||
[Statistics logEvent:kStatEditorSecondTimeShareClick withParameters:@{kStatValue : self.statMessage}];
|
||||
[Statistics logEvent:kStatEditorSecondTimeShareClick];
|
||||
[self close:^{
|
||||
MWMActivityViewController * shareVC = [MWMActivityViewController shareControllerForEditorViral];
|
||||
[shareVC presentInParentViewController:self.alertController.ownerViewController
|
||||
|
@ -54,14 +28,6 @@ namespace
|
|||
}];
|
||||
}
|
||||
|
||||
- (IBAction)cancelTap
|
||||
{
|
||||
[self close:nil];
|
||||
}
|
||||
|
||||
- (NSString *)statMessage
|
||||
{
|
||||
return self.indexOfMessage ? @"change" : @"rating";
|
||||
}
|
||||
- (IBAction)cancelTap { [self close:nil]; }
|
||||
|
||||
@end
|
||||
|
|
|
@ -1,24 +1,27 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="10116" systemVersion="15D21" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES">
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11762" systemVersion="16C67" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" colorMatched="YES">
|
||||
<device id="retina4_7" orientation="portrait">
|
||||
<adaptation id="fullscreen"/>
|
||||
</device>
|
||||
<dependencies>
|
||||
<deployment version="2048" identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<customFonts key="customFonts">
|
||||
<mutableArray key="HelveticaNeue.ttc">
|
||||
<array key="HelveticaNeue.ttc">
|
||||
<string>HelveticaNeue-Medium</string>
|
||||
<string>HelveticaNeue-Medium</string>
|
||||
</mutableArray>
|
||||
</array>
|
||||
</customFonts>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<view contentMode="scaleToFill" id="wbZ-na-kON" customClass="MWMEditorViralAlert">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="rDD-mO-naE" userLabel="ContainerView">
|
||||
<rect key="frame" x="20" y="104" width="280" height="359"/>
|
||||
<rect key="frame" x="47.5" y="154" width="280" height="359"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Title" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="3wz-0B-pzw" userLabel="Title">
|
||||
<rect key="frame" x="20" y="20" width="240" height="21"/>
|
||||
|
@ -27,7 +30,7 @@
|
|||
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="20" id="CmO-EK-KSV"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" name="HelveticaNeue-Medium" family="Helvetica Neue" pointSize="18"/>
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<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"/>
|
||||
|
@ -49,16 +52,17 @@
|
|||
<constraint firstAttribute="width" constant="240" id="t4I-mS-iNs"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" name="HelveticaNeue" family="Helvetica Neue" pointSize="14"/>
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="0.54000000000000004" colorSpace="calibratedRGB"/>
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="0.54000000000000004" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="colorName" value="blackSecondaryText"/>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="fontName" value="regular14"/>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="editor_done_dialog_1"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</label>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="G21-zf-Val" userLabel="hDivider">
|
||||
<rect key="frame" x="0.0" y="269" width="280" height="1"/>
|
||||
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.12" colorSpace="calibratedRGB"/>
|
||||
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.12" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="1" id="3gT-zA-0eH"/>
|
||||
</constraints>
|
||||
|
@ -73,8 +77,8 @@
|
|||
</constraints>
|
||||
<fontDescription key="fontDescription" name="HelveticaNeue-Medium" family="Helvetica Neue" pointSize="17"/>
|
||||
<state key="normal" title="right">
|
||||
<color key="titleColor" red="0.090196078430000007" green="0.61960784310000006" blue="0.30196078430000001" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<color key="titleColor" red="0.090196078430000007" green="0.61960784310000006" blue="0.30196078430000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</state>
|
||||
<state key="highlighted" backgroundImage="dialog_btn_press"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
|
@ -88,7 +92,7 @@
|
|||
</button>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="esF-hg-RBd" userLabel="hDivider">
|
||||
<rect key="frame" x="0.0" y="315" width="280" height="1"/>
|
||||
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.12" colorSpace="calibratedRGB"/>
|
||||
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.12" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="280" id="3KO-Rx-bS3"/>
|
||||
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="1" id="Fgf-2O-WXp"/>
|
||||
|
@ -105,8 +109,8 @@
|
|||
</constraints>
|
||||
<fontDescription key="fontDescription" name="HelveticaNeue" family="Helvetica Neue" pointSize="17"/>
|
||||
<state key="normal" title="left">
|
||||
<color key="titleColor" red="0.090196078430000007" green="0.61960784310000006" blue="0.30196078430000001" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<color key="titleColor" red="0.090196078430000007" green="0.61960784310000006" blue="0.30196078430000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</state>
|
||||
<state key="highlighted" backgroundImage="dialog_btn_press"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
|
@ -148,13 +152,12 @@
|
|||
</userDefinedRuntimeAttributes>
|
||||
</view>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
|
||||
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="centerX" secondItem="rDD-mO-naE" secondAttribute="centerX" id="FVV-SA-5CF"/>
|
||||
<constraint firstAttribute="centerY" secondItem="rDD-mO-naE" secondAttribute="centerY" id="xa9-v7-cH9"/>
|
||||
</constraints>
|
||||
<connections>
|
||||
<outlet property="message" destination="ffp-Nm-vdI" id="bXH-zX-hr6"/>
|
||||
<outlet property="shareButton" destination="Xcl-gD-T7R" id="1Dr-cC-7Ah"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="305" y="172"/>
|
||||
|
@ -164,4 +167,9 @@
|
|||
<image name="dialog_btn_press" width="280" height="44"/>
|
||||
<image name="img_socializing" width="160" height="160"/>
|
||||
</resources>
|
||||
<simulatedMetricsContainer key="defaultSimulatedMetrics">
|
||||
<simulatedStatusBarMetrics key="statusBar"/>
|
||||
<simulatedOrientationMetrics key="orientation"/>
|
||||
<simulatedScreenMetrics key="destination" type="retina4_7.fullscreen"/>
|
||||
</simulatedMetricsContainer>
|
||||
</document>
|
||||
|
|
Loading…
Add table
Reference in a new issue