From 2c48d826ee6d944c211c8acabd5eddefcbd80b48 Mon Sep 17 00:00:00 2001 From: Ilya Grechuhin Date: Thu, 27 Aug 2015 12:09:27 +0300 Subject: [PATCH] [ios] Fixed Flurry duplicate events. --- .../Classes/CustomAlert/DefaultAlert/MWMDefaultAlert.mm | 8 ++++---- iphone/Maps/Classes/MapViewController.mm | 6 ++++-- iphone/Maps/DownloaderParentVC.mm | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/iphone/Maps/Classes/CustomAlert/DefaultAlert/MWMDefaultAlert.mm b/iphone/Maps/Classes/CustomAlert/DefaultAlert/MWMDefaultAlert.mm index d336e95185..7b7d20f7c0 100644 --- a/iphone/Maps/Classes/CustomAlert/DefaultAlert/MWMDefaultAlert.mm +++ b/iphone/Maps/Classes/CustomAlert/DefaultAlert/MWMDefaultAlert.mm @@ -66,8 +66,9 @@ 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]; + [Statistics.instance logEvent:@"No WiFi Alert - open" withParameters:@{@"map_name" : name}]; + NSString * title = [NSString stringWithFormat:L(@"no_wifi_ask_cellular_download"), name]; + MWMDefaultAlert * alert = [self defaultAlertWithTitle:title message:nil rightButtonTitle:@"use_cellular_data" leftButtonTitle:@"cancel" rightButtonAction:block]; [alert setNeedsCloseAlertAfterEnterBackground]; return alert; } @@ -97,7 +98,7 @@ static NSString * const kDefaultAlertNibName = @"MWMDefaultAlert"; { [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]; + return [self defaultAlertWithTitle:@"dialog_routing_check_gps" message:message rightButtonTitle:@"ok" leftButtonTitle:nil rightButtonAction:nil]; } + (instancetype)disabledLocationAlert @@ -118,7 +119,6 @@ static NSString * const kDefaultAlertNibName = @"MWMDefaultAlert"; + (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; diff --git a/iphone/Maps/Classes/MapViewController.mm b/iphone/Maps/Classes/MapViewController.mm index 9efc6c841a..ba130adc5a 100644 --- a/iphone/Maps/Classes/MapViewController.mm +++ b/iphone/Maps/Classes/MapViewController.mm @@ -658,8 +658,10 @@ typedef NS_OPTIONS(NSUInteger, MapInfoView) { if (connection == Platform::EConnectionType::CONNECTION_WWAN && sizeToDownload > 50 * MB) { - NSString * title = [NSString stringWithFormat:L(@"no_wifi_ask_cellular_download"), name]; - [self.alertController presentnoWiFiAlertWithName:title downloadBlock:^{layout.DownloadMap(idx, static_cast(opt));}]; + [self.alertController presentnoWiFiAlertWithName:name downloadBlock:^ + { + layout.DownloadMap(idx, static_cast(opt)); + }]; return; } } diff --git a/iphone/Maps/DownloaderParentVC.mm b/iphone/Maps/DownloaderParentVC.mm index 272c153438..b90d3b3bf5 100644 --- a/iphone/Maps/DownloaderParentVC.mm +++ b/iphone/Maps/DownloaderParentVC.mm @@ -75,7 +75,7 @@ if (connection != Platform::EConnectionType::CONNECTION_NONE) { if (connection == Platform::EConnectionType::CONNECTION_WWAN && size > 50 * MB) - [alert presentnoWiFiAlertWithName:[NSString stringWithFormat:L(@"no_wifi_ask_cellular_download"), name] downloadBlock:^{[self download];}]; + [alert presentnoWiFiAlertWithName:name downloadBlock:^{[self download];}]; else return YES; }