Skip to content

Commit

Permalink
Keep location in Amplitude.m
Browse files Browse the repository at this point in the history
  • Loading branch information
curtisliu committed Oct 29, 2014
1 parent b5b09a2 commit 1ac90fe
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 36 deletions.
1 change: 0 additions & 1 deletion DeviceInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
@property (readonly) NSString *language;
@property (readonly) NSString *advertiserID;
@property (readonly) NSString *vendorID;
@property (readonly) NSString *mostRecentLocation;

-(NSString*) generateUUID;

Expand Down
35 changes: 0 additions & 35 deletions DeviceInfo.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

#import <Foundation/Foundation.h>
#import "AmplitudeARCMacros.h"
#import "AmplitudeLocationManagerDelegate.h"
#import <UIKit/UIKit.h>
#import "DeviceInfo.h"
#import <sys/sysctl.h>
Expand All @@ -13,10 +12,6 @@
@interface DeviceInfo ()
@end

AmplitudeLocationManagerDelegate *locationManagerDelegate;
CLLocationManager *locationManager;
CLLocation *lastKnownLocation;

@implementation DeviceInfo

@synthesize versionName = _versionName;
Expand All @@ -32,20 +27,6 @@ @implementation DeviceInfo

-(id) init {
self = [super init];
if (self) {
// CLLocationManager must be created on the main thread
dispatch_async(dispatch_get_main_queue(), ^{
Class CLLocationManager = NSClassFromString(@"CLLocationManager");
locationManager = [[CLLocationManager alloc] init];
locationManagerDelegate = [[AmplitudeLocationManagerDelegate alloc] init];
SEL setDelegate = NSSelectorFromString(@"setDelegate:");
void (*imp)(id, SEL, AmplitudeLocationManagerDelegate*) =
(void (*)(id, SEL, AmplitudeLocationManagerDelegate*))[locationManager methodForSelector:setDelegate];
if (imp) {
imp(locationManager, setDelegate, locationManagerDelegate);
}
});
}
return self;
}

Expand Down Expand Up @@ -200,22 +181,6 @@ - (NSString*)generateUUID
return result;
}

-(CLLocation*) mostRecentLocation {
return lastKnownLocation;
}

+ (void)updateLocation
{
CLLocation *location = [locationManager location];
@synchronized (locationManager) {
if (location != nil) {
(void) SAFE_ARC_RETAIN(location);
SAFE_ARC_RELEASE(lastKnownLocation);
lastKnownLocation = location;
}
}
}

+ (NSString *)getPlatformString
{
size_t size;
Expand Down

0 comments on commit 1ac90fe

Please sign in to comment.