forked from organicmaps/organicmaps-tmp
[ios] Added logging to viral alert.
This commit is contained in:
parent
cbd17be970
commit
74eaf00cde
2 changed files with 17 additions and 5 deletions
|
@ -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];
|
||||
}
|
||||
|
||||
|
|
|
@ -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";
|
||||
|
|
Loading…
Add table
Reference in a new issue