[cleanup] [ios] Updated Flurry support.

This commit is contained in:
Ilya Grechuhin 2018-01-23 14:43:10 +03:00 committed by Roman Kuznetsov
parent 0f1d116d6b
commit 21260955c1
4 changed files with 3 additions and 14 deletions

View file

@ -7,7 +7,6 @@
// Should be called from the same method in AppDelegate.
- (void)applicationDidBecomeActive;
- (void)logApiUsage:(NSString *)programName;
- (void)logLocation:(CLLocation *)location;
+ (instancetype)instance;
+ (void)logEvent:(NSString *)eventName;

View file

@ -57,18 +57,6 @@ void checkFlurryLogStatus(FlurryEventRecordStatus status)
return [[FBSDKApplicationDelegate sharedInstance] application:application didFinishLaunchingWithOptions:launchOptions];
}
- (void)logLocation:(CLLocation *)location
{
if (![MWMSettings statisticsEnabled])
return;
if (!_lastLocationLogTimestamp || [[NSDate date] timeIntervalSinceDate:_lastLocationLogTimestamp] > (60 * 60 * 3))
{
_lastLocationLogTimestamp = [NSDate date];
CLLocationCoordinate2D const coord = location.coordinate;
[Flurry setLatitude:coord.latitude longitude:coord.longitude horizontalAccuracy:location.horizontalAccuracy verticalAccuracy:location.verticalAccuracy];
}
}
- (void)logEvent:(NSString *)eventName withParameters:(NSDictionary *)parameters
{
if (![MWMSettings statisticsEnabled])

View file

@ -447,7 +447,6 @@ void setPermissionRequested()
self.lastLocationStatus = location::TLocationError::ENoError;
self.locationSource = location::EAppleNative;
[self processLocationUpdate:location];
[[Statistics instance] logLocation:location];
}
- (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error

View file

@ -3,6 +3,7 @@
#import "MWMMapViewControlsManager.h"
#import "SwiftBridge.h"
#import "3party/Alohalytics/src/alohalytics_objc.h"
#import "Flurry.h"
#include "Framework.h"
@ -112,11 +113,13 @@ NSString * const kSpotlightLocaleLanguageId = @"SpotlightLocaleLanguageId";
if (statisticsEnabled)
{
[Alohalytics enable];
[Flurry trackPreciseLocation:YES];
}
else
{
[Alohalytics logEvent:@"statisticsDisabled"];
[Alohalytics disable];
[Flurry trackPreciseLocation:NO];
}
settings::Set(kStatisticsEnabledSettingsKey, static_cast<bool>(statisticsEnabled));
}