Merge pull request #1791 from VladiMihaylenko/vm-master

[ios] Logging
This commit is contained in:
igrechuhin 2016-02-03 15:25:54 +03:00
commit 6bd0d00702
3 changed files with 25 additions and 8 deletions

View file

@ -1,6 +1,7 @@
#import "MapsAppDelegate.h"
#import "MWMNightModeController.h"
#import "SelectableCell.h"
#import "Statistics.h"
#import "UIColor+MapsMeColor.h"
#include "Framework.h"
@ -52,6 +53,7 @@
_selectedCell = cell;
auto & f = GetFramework();
auto const style = f.GetMapStyle();
NSString * statValue = nil;
if ([cell isEqual:self.on])
{
[MapsAppDelegate setAutoNightModeOff:YES];
@ -60,6 +62,7 @@
f.SetMapStyle(MapStyleDark);
[UIColor setNightMode:YES];
[self refresh];
statValue = kStatOn;
}
else if ([cell isEqual:self.off])
{
@ -69,6 +72,7 @@
f.SetMapStyle(MapStyleClear);
[UIColor setNightMode:NO];
[self refresh];
statValue = kStatOff;
}
else if ([cell isEqual:self.autoSwitch])
{
@ -79,7 +83,11 @@
[UIColor setNightMode:NO];
f.SetMapStyle(MapStyleClear);
[self refresh];
statValue = kStatValue;
}
[[Statistics instance] logEvent:kStatNightMode
withParameters:@{kStatValue : statValue}];
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath

View file

@ -1,5 +1,6 @@
#import "MWMRecentTrackSettingsController.h"
#import "SelectableCell.h"
#import "Statistics.h"
#include "Framework.h"
@ -68,29 +69,36 @@ typedef NS_ENUM(NSUInteger, DurationInHours)
{
_selectedCell = selectedCell;
auto & f = GetFramework();
auto & tracker = GpsTracker::Instance();
NSString * statValue = nil;
if ([selectedCell isEqual:self.none])
{
f.DisconnectFromGpsTracker();
GpsTracker::Instance().SetEnabled(false);
tracker.SetEnabled(false);
statValue = kStatOff;
}
else
{
if (!GpsTracker::Instance().IsEnabled())
GpsTracker::Instance().SetEnabled(true);
if (!tracker.IsEnabled())
tracker.SetEnabled(true);
f.ConnectToGpsTracker();
if ([selectedCell isEqual:self.oneHour])
GpsTracker::Instance().SetDuration(hours(One));
tracker.SetDuration(hours(One));
else if ([selectedCell isEqual:self.twoHours])
GpsTracker::Instance().SetDuration(hours(Two));
tracker.SetDuration(hours(Two));
else if ([selectedCell isEqual:self.sixHours])
GpsTracker::Instance().SetDuration(hours(Six));
tracker.SetDuration(hours(Six));
else if ([selectedCell isEqual:self.twelveHours])
GpsTracker::Instance().SetDuration(hours(Twelve));
tracker.SetDuration(hours(Twelve));
else
GpsTracker::Instance().SetDuration(hours(Day));
tracker.SetDuration(hours(Day));
statValue = [NSString stringWithFormat:@"%@ hour(s)", @(tracker.GetDuration().count())];
}
selectedCell.accessoryType = UITableViewCellAccessoryCheckmark;
[[Statistics instance] logEvent:kStatChangeRecentTrack
withParameters:@{kStatValue : statValue}];
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath

View file

@ -10,6 +10,7 @@ static NSString * const kStatAdd = @"Add";
static NSString * const kStatAlert = @"Alert";
static NSString * const kStatApplication = @"Application";
static NSString * const kStatApply = @"Apply";
static NSString * const kStatAuto = @"Auto";
static NSString * const kStatBack = @"Back";
static NSString * const kStatBannerDescription = @"Banner description";
static NSString * const kStatBannerTitle = @"Banner title";