[ios] Added flurry logging to dialogs.

This commit is contained in:
Ilya Grechuhin 2015-08-10 19:10:43 +03:00 committed by Alex Zolotarev
parent f8deb26569
commit fdbb4b5154
10 changed files with 60 additions and 10 deletions

View file

@ -17,6 +17,7 @@
#import "MWMPedestrianShareAlert.h"
#import "MWMRateAlert.h"
#import "MWMRoutingDisclaimerAlert.h"
#import "Statistics.h"
@implementation MWMAlert

View file

@ -12,6 +12,7 @@
#import "MWMAlertViewController.h"
#import "MWMDefaultAlert.h"
#import "MWMPlacePageViewManager.h"
#import "Statistics.h"
#import "UIButton+RuntimeAttributes.h"
#import "UIKitCategories.h"
#import "UILabel+RuntimeAttributes.h"
@ -38,22 +39,26 @@ static NSString * const kDefaultAlertNibName = @"MWMDefaultAlert";
+ (instancetype)routeFileNotExistAlert
{
[Statistics.instance logEvent:@"Route File Not Exist Alert - open"];
return [self defaultAlertWithTitle:@"dialog_routing_download_files" message:@"dialog_routing_download_and_update_all" rightButtonTitle:@"ok" leftButtonTitle:nil rightButtonAction:nil];
}
+ (instancetype)routeNotFoundAlert
{
[Statistics.instance logEvent:@"Route Not Found Alert - open"];
NSString * message = [NSString stringWithFormat:@"%@\n\n%@", L(@"dialog_routing_cant_build_route"), L(@"dialog_routing_change_start_or_end")];
return [self defaultAlertWithTitle:@"dialog_routing_unable_locate_route" message:message rightButtonTitle:@"ok" leftButtonTitle:nil rightButtonAction:nil];
}
+ (instancetype)locationServiceNotSupportedAlert
{
[Statistics.instance logEvent:@"Location Service Not Supported Alert - open"];
return [self defaultAlertWithTitle:@"device_doesnot_support_location_services" message:nil rightButtonTitle:@"ok" leftButtonTitle:nil rightButtonAction:nil];
}
+ (instancetype)noConnectionAlert
{
[Statistics.instance logEvent:@"No Connection Alert - open"];
MWMDefaultAlert * alert = [self defaultAlertWithTitle:@"no_internet_connection_detected" message:nil rightButtonTitle:@"ok" leftButtonTitle:nil rightButtonAction:nil];
[alert setNeedsCloseAlertAfterEnterBackground];
return alert;
@ -61,6 +66,7 @@ static NSString * const kDefaultAlertNibName = @"MWMDefaultAlert";
+ (instancetype)noWiFiAlertWithName:(NSString *)name downloadBlock:(RightButtonAction)block
{
[Statistics.instance logEvent:@"No WiFi Alert - open"];
MWMDefaultAlert * alert = [self defaultAlertWithTitle:name message:nil rightButtonTitle:@"use_cellular_data" leftButtonTitle:@"cancel" rightButtonAction:block];
[alert setNeedsCloseAlertAfterEnterBackground];
return alert;
@ -68,30 +74,35 @@ static NSString * const kDefaultAlertNibName = @"MWMDefaultAlert";
+ (instancetype)endPointNotFoundAlert
{
[Statistics.instance logEvent:@"End Point Not Found Alert - open"];
NSString * message = [NSString stringWithFormat:@"%@\n\n%@", L(@"dialog_routing_end_not_determined"), L(@"dialog_routing_select_closer_end")];
return [self defaultAlertWithTitle:@"dialog_routing_change_end" message:message rightButtonTitle:@"ok" leftButtonTitle:nil rightButtonAction:nil];
}
+ (instancetype)startPointNotFoundAlert
{
[Statistics.instance logEvent:@"Start Point Not Found Alert - open"];
NSString * message = [NSString stringWithFormat:@"%@\n\n%@", L(@"dialog_routing_start_not_determined"), L(@"dialog_routing_select_closer_start")];
return [self defaultAlertWithTitle:@"dialog_routing_change_start" message:message rightButtonTitle:@"ok" leftButtonTitle:nil rightButtonAction:nil];
}
+ (instancetype)internalErrorAlert
{
[Statistics.instance logEvent:@"Internal Error Alert - open"];
NSString * message = [NSString stringWithFormat:@"%@\n\n%@", L(@"dialog_routing_application_error"), L(@"dialog_routing_try_again")];
return [self defaultAlertWithTitle:@"dialog_routing_system_error" message:message rightButtonTitle:@"ok" leftButtonTitle:nil rightButtonAction:nil];
}
+ (instancetype)noCurrentPositionAlert
{
[Statistics.instance logEvent:@"No Current Position Alert - open"];
NSString * message = [NSString stringWithFormat:@"%@\n\n%@", L(@"dialog_routing_error_location_not_found"), L(@"dialog_routing_location_turn_wifi")];
return [self defaultAlertWithTitle:@"dialog_routing_check_gps" message:message rightButtonTitle:@"OK" leftButtonTitle:nil rightButtonAction:nil];
}
+ (instancetype)disabledLocationAlert
{
[Statistics.instance logEvent:@"Disabled Location Alert - open"];
RightButtonAction action = ^
{
GetFramework().GetLocationState()->SwitchToNextMode();
@ -101,11 +112,13 @@ static NSString * const kDefaultAlertNibName = @"MWMDefaultAlert";
+ (instancetype)pointsInDifferentMWMAlert
{
[Statistics.instance logEvent:@"Points In Different MWM Alert - open"];
return [self defaultAlertWithTitle:@"routing_failed_cross_mwm_building" message:nil rightButtonTitle:@"ok" leftButtonTitle:nil rightButtonAction:nil];
}
+ (instancetype)defaultAlertWithTitle:(nonnull NSString *)title message:(nullable NSString *)message rightButtonTitle:(nonnull NSString *)rightButtonTitle leftButtonTitle:(nullable NSString *)leftButtonTitle rightButtonAction:(nullable RightButtonAction)action
{
[Statistics.instance logEvent:[NSString stringWithFormat:@"Default Alert With Title:%@ - %@", title, @"open"]];
MWMDefaultAlert * alert = [[[NSBundle mainBundle] loadNibNamed:kDefaultAlertNibName owner:self options:nil] firstObject];
alert.titleLabel.localizedText = title;
alert.messageLabel.localizedText = message;
@ -132,6 +145,7 @@ static NSString * const kDefaultAlertNibName = @"MWMDefaultAlert";
- (IBAction)rightButtonTap
{
[Statistics.instance logEvent:@"Default Alert - rightButtonTap"];
if (self.rightButtonAction)
self.rightButtonAction();
[self close];
@ -139,6 +153,7 @@ static NSString * const kDefaultAlertNibName = @"MWMDefaultAlert";
- (IBAction)leftButtonTap
{
[Statistics.instance logEvent:@"Default Alert - leftButtonTap"];
[self close];
}

View file

@ -12,6 +12,7 @@
#import "MWMDownloaderDialogCell.h"
#import "MWMDownloaderDialogHeader.h"
#import "MWMDownloadTransitMapAlert.h"
#import "Statistics.h"
#import "UIColor+MapsMeColor.h"
#import "UIKitCategories.h"
#import "UILabel+RuntimeAttributes.h"
@ -67,6 +68,8 @@ static CGFloat const kHeaderHeight = 43.;
static CGFloat const kHeaderAndFooterHeight = 44.;
static CGFloat const kMinimumOffset = 20.;
static NSString * const kStatisticsEvent = @"Map download Alert";
@interface MWMDownloadTransitMapAlert ()
{
vector<storage::TIndex> maps;
@ -95,6 +98,7 @@ static CGFloat const kMinimumOffset = 20.;
routes:(vector<storage::TIndex> const &)routes
code:(routing::IRouter::ResultCode)code
{
[Statistics.instance logEvent:[NSString stringWithFormat:@"%@ - %@", kStatisticsEvent, @"open"]];
MWMDownloadTransitMapAlert * alert = [self alertWithMaps:maps routes:routes];
switch (code)
{
@ -161,11 +165,13 @@ static CGFloat const kMinimumOffset = 20.;
- (IBAction)notNowButtonTap:(id)sender
{
[Statistics.instance logEvent:[NSString stringWithFormat:@"%@ - %@", kStatisticsEvent, @"notNowButtonTap"]];
[self close];
}
- (IBAction)downloadButtonTap:(id)sender
{
[Statistics.instance logEvent:[NSString stringWithFormat:@"%@ - %@", kStatisticsEvent, @"downloadButtonTap"]];
[self downloadMaps];
}

View file

@ -6,11 +6,11 @@
// Copyright (c) 2015 MapsWithMe. All rights reserved.
//
#import "MWMFacebookAlert.h"
#import "MWMAlertViewController.h"
#import "MWMFacebookAlert.h"
#import "Statistics.h"
#import <FBSDKShareKit/FBSDKShareKit.h>
#import "Statistics.h"
#import "3party/Alohalytics/src/alohalytics_objc.h"
static NSString * const kFacebookAlertNibName = @"MWMFacebookAlert";
@ -25,6 +25,7 @@ extern NSString * const kUDAlreadySharedKey;
+ (MWMFacebookAlert *)alert
{
[Statistics.instance logEvent:[NSString stringWithFormat:@"%@ - %@", kFacebookInviteEventName, @"open"]];
MWMFacebookAlert * alert = [[[NSBundle mainBundle] loadNibNamed:kFacebookAlertNibName owner:self options:nil] firstObject];
return alert;
}

View file

@ -6,12 +6,15 @@
// Copyright (c) 2015 MapsWithMe. All rights reserved.
//
#import "MWMFeedbackAlert.h"
#import "MWMAlertViewController.h"
#import <MessageUI/MFMailComposeViewController.h>
#import "UIKitCategories.h"
#import "AppInfo.h"
#import "MWMAlertViewController.h"
#import "MWMFeedbackAlert.h"
#import "Statistics.h"
#import "UIKitCategories.h"
#import <MessageUI/MFMailComposeViewController.h>
#import <sys/utsname.h>
#import "3party/Alohalytics/src/alohalytics_objc.h"
#include "platform/platform.hpp"
@ -32,6 +35,7 @@ extern NSString * const kRateAlertEventName;
+ (instancetype)alertWithStarsCount:(NSUInteger)starsCount
{
[Statistics.instance logEvent:[NSString stringWithFormat:@"%@ - %@", kRateAlertEventName, @"open"]];
MWMFeedbackAlert * alert = [[[NSBundle mainBundle] loadNibNamed:kFeedbackAlertNibName owner:self options:nil] firstObject];
alert.starsCount = starsCount;
return alert;
@ -48,6 +52,7 @@ extern NSString * const kRateAlertEventName;
- (IBAction)writeFeedbackButtonTap:(id)sender
{
[Alohalytics logEvent:kRateAlertEventName withValue:@"feedbackWriteTap"];
[Statistics.instance logEvent:[NSString stringWithFormat:@"%@ - %@", kRateAlertEventName, @"feedbackWriteTap"]];
self.alpha = 0.;
self.alertController.view.alpha = 0.;
if ([MFMailComposeViewController canSendMail])
@ -82,8 +87,10 @@ extern NSString * const kRateAlertEventName;
#pragma mark - MFMailComposeViewControllerDelegate
- (void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error {
[Statistics.instance logEvent:[NSString stringWithFormat:@"%@ - %@", kRateAlertEventName, @"mailComposeController"]];
[self.alertController.ownerViewController dismissViewControllerAnimated:YES completion:^
{
[Statistics.instance logEvent:[NSString stringWithFormat:@"%@ - %@", kRateAlertEventName, @"close"]];
[self close];
}];
}

View file

@ -8,13 +8,16 @@
#import "MWMLocationAlert.h"
#import "MWMAlertViewController.h"
#import "Statistics.h"
static NSString * const kLocationAlertNibName = @"MWMLocationAlert";
static NSString * const kStatisticsEvent = @"Location Alert";
@implementation MWMLocationAlert
+ (instancetype)alert
{
[Statistics.instance logEvent:[NSString stringWithFormat:@"%@ - %@", kStatisticsEvent, @"open"]];
MWMLocationAlert * alert = [[[NSBundle mainBundle] loadNibNamed:kLocationAlertNibName owner:nil options:nil] firstObject];
[alert setNeedsCloseAlertAfterEnterBackground];
return alert;
@ -22,12 +25,14 @@ static NSString * const kLocationAlertNibName = @"MWMLocationAlert";
- (IBAction)settingsTap
{
[Statistics.instance logEvent:[NSString stringWithFormat:@"%@ - %@", kStatisticsEvent, @"settingsTap"]];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
[self close];
}
- (IBAction)closeTap
{
[Statistics.instance logEvent:[NSString stringWithFormat:@"%@ - %@", kStatisticsEvent, @"closeTap"]];
[self close];
}

View file

@ -11,10 +11,10 @@
#import "MWMActivityViewController.h"
#import "MWMAlertViewController.h"
#import "MWMPedestrianShareAlert.h"
#import "UIColor+MapsMeColor.h"
#import "UIButton+RuntimeAttributes.h"
#import "Statistics.h"
#import "UIButton+RuntimeAttributes.h"
#import "UIColor+MapsMeColor.h"
#import "3party/Alohalytics/src/alohalytics_objc.h"
static NSString * const kShareEventName = @"pedestrianShareEvent";
@ -35,6 +35,7 @@ static NSString * const kShareEventName = @"pedestrianShareEvent";
+ (MWMPedestrianShareAlert *)alert:(BOOL)isFirstLaunch
{
[Statistics.instance logEvent:[NSString stringWithFormat:@"%@ - %@", kShareEventName, @"open"]];
MWMPedestrianShareAlert * view = [NSBundle.mainBundle loadNibNamed:NSStringFromClass(self.class) owner:self
options:nil].firstObject;
view.isFirstLaunch = isFirstLaunch;

View file

@ -6,9 +6,11 @@
// Copyright (c) 2015 MapsWithMe. All rights reserved.
//
#import "MWMRateAlert.h"
#import "MWMAlertViewController.h"
#import "MWMRateAlert.h"
#import "Statistics.h"
#import "UIKitCategories.h"
#import "3party/Alohalytics/src/alohalytics_objc.h"
extern NSString * const kUDAlreadyRatedKey;
@ -40,6 +42,7 @@ static NSString * const kRateAlertNibName = @"MWMRateAlert";
+ (instancetype)alert
{
[Statistics.instance logEvent:[NSString stringWithFormat:@"%@ - %@", kRateAlertEventName, @"open"]];
MWMRateAlert * alert = [[[NSBundle mainBundle] loadNibNamed:kRateAlertNibName owner:self options:nil] firstObject];
return alert;
}
@ -48,6 +51,7 @@ static NSString * const kRateAlertNibName = @"MWMRateAlert";
- (IBAction)oneStarTap:(UILongPressGestureRecognizer *)sender
{
[Statistics.instance logEvent:[NSString stringWithFormat:@"%@ - %@", kRateAlertEventName, @"oneStarTap"]];
[UIView animateWithDuration:0.15 animations:^
{
self.oneStarPushImageView.alpha = 1.;
@ -68,6 +72,7 @@ static NSString * const kRateAlertNibName = @"MWMRateAlert";
- (IBAction)twoStarTap:(UILongPressGestureRecognizer *)sender
{
[Statistics.instance logEvent:[NSString stringWithFormat:@"%@ - %@", kRateAlertEventName, @"twoStarTap"]];
[UIView animateWithDuration:0.15 animations:^
{
self.twoStarPushImageView.alpha = 1.;
@ -89,6 +94,7 @@ static NSString * const kRateAlertNibName = @"MWMRateAlert";
- (IBAction)threeStarTap:(UILongPressGestureRecognizer *)sender
{
[Statistics.instance logEvent:[NSString stringWithFormat:@"%@ - %@", kRateAlertEventName, @"threeStarTap"]];
[UIView animateWithDuration:0.15 animations:^
{
self.threeStarPushImageView.alpha = 1.;
@ -111,6 +117,7 @@ static NSString * const kRateAlertNibName = @"MWMRateAlert";
- (IBAction)fourStarTap:(UILongPressGestureRecognizer *)sender
{
[Statistics.instance logEvent:[NSString stringWithFormat:@"%@ - %@", kRateAlertEventName, @"fourStarTap"]];
[UIView animateWithDuration:0.15 animations:^
{
self.fourStarPushImageView.alpha = 1.;
@ -134,6 +141,7 @@ static NSString * const kRateAlertNibName = @"MWMRateAlert";
- (IBAction)fiveStarTap:(UILongPressGestureRecognizer *)sender
{
[Statistics.instance logEvent:[NSString stringWithFormat:@"%@ - %@", kRateAlertEventName, @"fiveStarTap"]];
[Alohalytics logEvent:kRateAlertEventName withValue:@"fiveStar"];
[UIView animateWithDuration:0.15 animations:^
{
@ -161,6 +169,7 @@ static NSString * const kRateAlertNibName = @"MWMRateAlert";
- (IBAction)notNowTap
{
[Statistics.instance logEvent:[NSString stringWithFormat:@"%@ - %@", kRateAlertEventName, @"notNowTap"]];
[Alohalytics logEvent:kRateAlertEventName withValue:@"notNowTap"];
[self close];
}

View file

@ -12,8 +12,10 @@
#import "UIColor+MapsMeColor.h"
#import "UIFont+MapsMeFonts.h"
#import "UIKitCategories.h"
#import "Statistics.h"
static CGFloat const kMinimumOffset = 20.;
static NSString * const kStatisticsEvent = @"Routing Disclaimer Alert";
@interface MWMRoutingDisclaimerAlert ()
@ -26,6 +28,7 @@ static CGFloat const kMinimumOffset = 20.;
+ (instancetype)alertWithInitialOrientation:(UIInterfaceOrientation)orientation
{
[Statistics.instance logEvent:[NSString stringWithFormat:@"%@ - %@", kStatisticsEvent, @"open"]];
MWMRoutingDisclaimerAlert * alert = [[[NSBundle mainBundle] loadNibNamed:[MWMRoutingDisclaimerAlert className]
owner:nil
options:nil] firstObject];
@ -50,6 +53,7 @@ static CGFloat const kMinimumOffset = 20.;
- (IBAction)okTap
{
[Statistics.instance logEvent:[NSString stringWithFormat:@"%@ - %@", kStatisticsEvent, @"okTap"]];
[self close];
}

View file

@ -152,6 +152,7 @@ void InitLocalizedStrings()
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler
{
[Statistics.instance logEvent:@"Push received" withParameters:userInfo];
[PFPush handlePush:userInfo];
completionHandler(UIBackgroundFetchResultNoData);
}