forked from organicmaps/organicmaps
[iOS] Tips and Tricks Statistic events
This commit is contained in:
parent
4dbe386f5e
commit
fc10ea1a45
3 changed files with 54 additions and 17 deletions
|
@ -445,6 +445,7 @@ extern NSString * const kAlohalyticsTapEventKey;
|
|||
if (!self.tutorialViewContoller)
|
||||
return;
|
||||
|
||||
[self logTutorialEvent:kStatTipsTricksShow additionalOptions:nil];
|
||||
self.hidden = NO;
|
||||
[ownerController addChildViewController:self.tutorialViewContoller];
|
||||
self.tutorialViewContoller.view.frame = ownerController.view.bounds;
|
||||
|
@ -453,9 +454,23 @@ extern NSString * const kAlohalyticsTapEventKey;
|
|||
[self.tutorialViewContoller didMoveToParentViewController:ownerController];
|
||||
}
|
||||
|
||||
- (void)didPressCancel:(MWMTutorialViewController *)viewController
|
||||
{
|
||||
- (void)didPressCancel:(MWMTutorialViewController *)viewController {
|
||||
[self logTutorialEvent:kStatTipsTricksClose additionalOptions:@{kStatOption: kStatGotIt}];
|
||||
[MWMEye tipClickedWithType:self.tutorialType event:MWMTipEventGotIt];
|
||||
[self fadeOutTutorial:viewController];
|
||||
}
|
||||
|
||||
- (void)didPressTarget:(MWMTutorialViewController *)viewController {
|
||||
[self logTutorialEvent:kStatTipsTricksClick additionalOptions:nil];
|
||||
[MWMEye tipClickedWithType:self.tutorialType event:MWMTipEventAction];
|
||||
[self fadeOutTutorial:viewController];
|
||||
}
|
||||
|
||||
- (void)didPressOnScreen:(MWMTutorialViewController *)viewController {
|
||||
[self logTutorialEvent:kStatTipsTricksClose additionalOptions:@{kStatOption: kStatOffscreen}];
|
||||
}
|
||||
|
||||
- (void)fadeOutTutorial:(MWMTutorialViewController *)viewController {
|
||||
[viewController fadeOutWithCompletion:^{
|
||||
[viewController willMoveToParentViewController:nil];
|
||||
[viewController.view removeFromSuperview];
|
||||
|
@ -464,15 +479,34 @@ extern NSString * const kAlohalyticsTapEventKey;
|
|||
self.tutorialViewContoller = nil;
|
||||
}
|
||||
|
||||
- (void)didPressTarget:(MWMTutorialViewController *)viewController
|
||||
{
|
||||
[MWMEye tipClickedWithType:self.tutorialType event:MWMTipEventAction];
|
||||
[viewController fadeOutWithCompletion:^{
|
||||
[viewController willMoveToParentViewController:nil];
|
||||
[viewController.view removeFromSuperview];
|
||||
[viewController removeFromParentViewController];
|
||||
}];
|
||||
self.tutorialViewContoller = nil;
|
||||
- (void)logTutorialEvent:(NSString *)eventName additionalOptions:(NSDictionary<NSString *, NSString *> *)options {
|
||||
MWMTip type = self.tutorialType;
|
||||
if (!type) return;
|
||||
|
||||
NSNumber *statTutorialType;
|
||||
switch (type)
|
||||
{
|
||||
case MWMTipSearch:
|
||||
statTutorialType = @1;
|
||||
break;
|
||||
case MWMTipDiscovery:
|
||||
statTutorialType = @2;
|
||||
break;
|
||||
case MWMTipBookmarks:
|
||||
statTutorialType = @0;
|
||||
break;
|
||||
case MWMTipSubway:
|
||||
statTutorialType = @3;
|
||||
break;
|
||||
case MWMTipNone:
|
||||
return;
|
||||
}
|
||||
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObject:statTutorialType
|
||||
forKey:kStatType];
|
||||
if (options != nil) {
|
||||
[params addEntriesFromDictionary:options];
|
||||
}
|
||||
[Statistics logEvent:eventName withParameters:params];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -164,6 +164,7 @@ static NSString * const kStatFromLocation = @"from_location";
|
|||
static NSString * const kStatFromMyPosition = @"From my position";
|
||||
static NSString * const kStatGo = @"Go";
|
||||
static NSString * const kStatGoogle = @"Google";
|
||||
static NSString * const kStatGotIt = @"Got_it";
|
||||
static NSString * const kStatGuestHouse = @"guestHouse";
|
||||
static NSString * const kStatHasAuthorization = @"has_auth";
|
||||
static NSString * const kStatHelp = @"Help";
|
||||
|
@ -240,6 +241,7 @@ static NSString * const kStatObjectLat = @"object_lat";
|
|||
static NSString * const kStatObjectLon = @"object_lon";
|
||||
static NSString * const kStatOff = @"Off";
|
||||
static NSString * const kStatOffline = @"offline";
|
||||
static NSString * const kStatOffscreen = @"Offscreen";
|
||||
static NSString * const kStatOn = @"On";
|
||||
static NSString * const kStatOnline = @"online";
|
||||
static NSString * const kStatOpen = @"Open";
|
||||
|
@ -385,6 +387,9 @@ static NSString * const kStatTable = @"Table";
|
|||
static NSString * const kStatTags = @"tags";
|
||||
static NSString * const kStatTaxi = @"Taxi";
|
||||
static NSString * const kStatThingsToDo = @"Things to do";
|
||||
static NSString * const kStatTipsTricksClick = @"TipsTricks_click";
|
||||
static NSString * const kStatTipsTricksClose = @"TipsTricks_close";
|
||||
static NSString * const kStatTipsTricksShow = @"TipsTricks_show";
|
||||
static NSString * const kStatToLocation = @"to_location";
|
||||
static NSString * const kStatToMyPosition = @"To my position";
|
||||
static NSString * const kStatToday = @"Today";
|
||||
|
|
|
@ -10,6 +10,7 @@ enum TutorialType: Int {
|
|||
protocol TutorialViewControllerDelegate: AnyObject {
|
||||
func didPressTarget(_ viewController: TutorialViewController)
|
||||
func didPressCancel(_ viewController: TutorialViewController)
|
||||
func didPressOnScreen(_ viewController: TutorialViewController)
|
||||
}
|
||||
|
||||
fileprivate struct TargetAction {
|
||||
|
@ -54,7 +55,9 @@ class TutorialViewController: UIViewController {
|
|||
|
||||
override func touchesMoved(_ touches: Set<UITouch>, with event: UIEvent?) { }
|
||||
|
||||
override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) { }
|
||||
override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {
|
||||
delegate?.didPressOnScreen(self)
|
||||
}
|
||||
|
||||
func fadeOut(withCompletion completion: (() -> Void)?) {
|
||||
tutorialView.animateFadeOut(kDefaultAnimationDuration) {
|
||||
|
@ -102,18 +105,13 @@ extension TutorialViewController {
|
|||
switch type {
|
||||
case .search:
|
||||
result = searchTutorialBlur()
|
||||
break
|
||||
case .discovery:
|
||||
result = discoveryTutorialBlur()
|
||||
break
|
||||
case .subway:
|
||||
result = subwayTutorialBlur()
|
||||
break
|
||||
case .bookmarks:
|
||||
result = bookmarksTutorialBlur()
|
||||
break
|
||||
}
|
||||
|
||||
result.targetView = target
|
||||
result.delegate = delegate
|
||||
return result
|
||||
|
|
Loading…
Add table
Reference in a new issue