diff options
author | VladiMihaylenko <vxmihaylenko@gmail.com> | 2016-03-18 10:43:15 +0300 |
---|---|---|
committer | Sergey Yershov <yershov@corp.mail.ru> | 2016-03-23 16:56:54 +0300 |
commit | 74eaf00cde32902a82c9aa15b5b45dff9bb48341 (patch) | |
tree | c24cc75c251861e3a8ec622970abf86dd8a38b16 | |
parent | cbd17be9704c6a322388b47442875384ce458090 (diff) |
[ios] Added logging to viral alert.
-rw-r--r-- | iphone/Maps/Classes/CustomAlert/MWMEditorViralAlert.mm | 20 | ||||
-rw-r--r-- | iphone/Maps/Statistics/StatisticsStrings.h | 2 |
2 files changed, 17 insertions, 5 deletions
diff --git a/iphone/Maps/Classes/CustomAlert/MWMEditorViralAlert.mm b/iphone/Maps/Classes/CustomAlert/MWMEditorViralAlert.mm index ddcc47947f..530d71ed4c 100644 --- a/iphone/Maps/Classes/CustomAlert/MWMEditorViralAlert.mm +++ b/iphone/Maps/Classes/CustomAlert/MWMEditorViralAlert.mm @@ -1,10 +1,13 @@ #import "MWMEditorViralAlert.h" +#import "Statistics.h" + +#include "indexer/osm_editor.hpp" #include <array> namespace { - array<NSString *, 3> const messages {{L(@"editor_done_dialog_1"), L(@"editor_done_dialog_2"), L(@"editor_done_dialog_3")}}; + array<NSString *, 3> const kMessages {{L(@"editor_done_dialog_1"), L(@"editor_done_dialog_2"), L(@"editor_done_dialog_3")}}; } // namespace @interface MWMEditorViralAlert () @@ -21,22 +24,29 @@ namespace MWMEditorViralAlert * alert = [[[NSBundle mainBundle] loadNibNamed:[MWMEditorViralAlert className] owner:nil options:nil] firstObject]; NSAssert(share, @"Share block can't be nil!"); alert.share = share; - int const index = rand() % messages.size(); - NSString * message = messages[index]; + int const index = rand() % kMessages.size(); + NSString * message = kMessages[index]; + if (index == 1) + { + auto const edits = osm::Editor::Instance().GetStats().m_edits.size(); + int const ratingValue = (rand() % 1000) + 1000; + int const rating = ceil(ratingValue / (ceil(edits / 10))); + message = [NSString stringWithFormat:message, edits, rating]; + } alert.message.text = message; + [[Statistics instance] logEvent:kStatEditorSecondTimeShareShow withParameters:@{kStatValue : message}]; return alert; } - (IBAction)shareTap { - //TODO(Vlad): Determine which message we have to show and log it. + [[Statistics instance] logEvent:kStatEditorSecondTimeShareClick withParameters:@{kStatValue : self.message.text}]; self.share(); [self close]; } - (IBAction)cancelTap { - //TODO(Vlad): Determine which message we have to show and log it. [self close]; } diff --git a/iphone/Maps/Statistics/StatisticsStrings.h b/iphone/Maps/Statistics/StatisticsStrings.h index 2249c74421..5acec0cb1b 100644 --- a/iphone/Maps/Statistics/StatisticsStrings.h +++ b/iphone/Maps/Statistics/StatisticsStrings.h @@ -64,6 +64,8 @@ static NSString * const kStatDownloaderMigrationDialogue = @"Downloader_Migratio static NSString * const kStatDownloaderMigrationError = @"Downloader_Migration_error"; static NSString * const kStatDownloaderMigrationStarted = @"Downloader_Migration_started"; static NSString * const kStatEdit = @"Edit"; +static NSString * const kStatEditorSecondTimeShareClick = @"Editor_SecondTimeShare_click"; +static NSString * const kStatEditorSecondTimeShareShow = @"Editor_SecondTimeShare_show"; static NSString * const kStatEditTime = @"Edit time"; static NSString * const kStatError = @"Error"; static NSString * const kStatExpand = @"Expand"; |