Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TIMOB-26046] (7_2_X) TiAPI: Remove "ti.geo" event (GDPR) #10050

Merged
merged 1 commit into from
May 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,6 @@ public class GeolocationModule extends KrollModule implements Handler.Callback,
private Context context;
private TiCompass tiCompass;
private boolean compassListenersRegistered = false;
private boolean sentAnalytics = false;
private ArrayList<LocationRuleProxy> simpleLocationRules = new ArrayList<LocationRuleProxy>();
private LocationRuleProxy simpleLocationGpsRule;
private LocationRuleProxy simpleLocationNetworkRule;
Expand Down Expand Up @@ -263,14 +262,6 @@ public boolean handleMessage(Message message)
return super.handleMessage(message);
}

private void doAnalytics(Location location)
{
if (!sentAnalytics) {
tiLocation.doAnalytics(location);
sentAnalytics = true;
}
}

/**
* Called by a registered location provider when a location update is received
*
Expand All @@ -285,7 +276,6 @@ public void onLocationChanged(Location location)
fireEvent(TiC.EVENT_LOCATION,
buildLocationEvent(location, tiLocation.locationManager.getProvider(location.getProvider())));
currentLocation = location;
doAnalytics(location);
}
}

Expand Down Expand Up @@ -583,7 +573,6 @@ protected void eventListenerAdded(String event, int count, KrollProxy proxy)
fireEvent(TiC.EVENT_LOCATION,
buildLocationEvent(lastLocation,
tiLocation.locationManager.getProvider(lastLocation.getProvider())));
doAnalytics(lastLocation);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,16 +145,6 @@ public Location getLastKnownLocation()
return latestKnownLocation;
}

public void doAnalytics(Location location)
{
long locationTime = location.getTime();
TiApplication application = TiApplication.getInstance();
if ((locationTime - lastAnalyticsTimestamp > TiAnalyticsEventFactory.MAX_GEO_ANALYTICS_FREQUENCY)
&& application.isAnalyticsEnabled() && !application.isAnalyticsFiltered("ti.geo")) {
APSAnalytics.getInstance().sendAppGeoEvent(location);
}
}

public void forwardGeocode(String address, GeocodeResponseHandler responseHandler)
{
if (address != null) {
Expand Down
29 changes: 9 additions & 20 deletions iphone/Classes/GeolocationModule.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,13 @@
#ifdef USE_TI_GEOLOCATION

#import "GeolocationModule.h"
#import "APSAnalytics.h"
#import "AnalyticsModule.h"
#import "NSData+Additions.h"
#import "TiApp.h"
#import "TiEvaluator.h"

#import <sys/utsname.h>

extern NSString *const TI_APPLICATION_GUID;
extern BOOL const TI_APPLICATION_ANALYTICS;

@interface GeolocationCallback : NSObject <APSHTTPRequestDelegate> {
id<TiEvaluator> context;
Expand Down Expand Up @@ -985,22 +982,6 @@ - (void)setPurpose:(NSString *)reason
}
}

#pragma mark Geolacation Analytics

- (void)fireApplicationAnalyticsIfNeeded:(NSArray *)locations
{
if ([AnalyticsModule isEventFiltered:@"ti.geo"]) {
return;
}
static BOOL analyticsSend = NO;
[lastLocationDict release];
lastLocationDict = [[self locationDictionary:[locations lastObject]] copy];
if (TI_APPLICATION_ANALYTICS && !analyticsSend) {
analyticsSend = YES;
[[APSAnalytics sharedInstance] sendAppGeoEvent:[locations lastObject]];
}
}

#pragma mark Delegates

- (void)locationManagerDidPauseLocationUpdates:(CLLocationManager *)manager
Expand Down Expand Up @@ -1078,7 +1059,7 @@ - (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray
[self fireEvent:@"location" withObject:event];
}

[self fireApplicationAnalyticsIfNeeded:locations];
[self updateLastLocationDictionary:locations];
[self fireSingleShotLocationIfNeeded:event stopIfNeeded:YES];
}

Expand Down Expand Up @@ -1131,12 +1112,20 @@ - (BOOL)locationManagerShouldDisplayHeadingCalibration:(CLLocationManager *)mana
return calibration;
}

#pragma mark Utilities

- (void)dismissHeadingCalibrationDisplay:(id)args
{
ENSURE_UI_THREAD(dismissHeadingCalibrationDisplay, args);
[[self locationManager] dismissHeadingCalibrationDisplay];
}

- (void)updateLastLocationDictionary:(NSArray *)locations
{
[lastLocationDict release];
lastLocationDict = [[self locationDictionary:[locations lastObject]] copy];
}

@end

#endif