incubator-callback-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fil...@apache.org
Subject [26/29] ios commit: rewrote Location class to use cordova-js unified approach.
Date Fri, 16 Mar 2012 18:14:49 GMT
rewrote Location class to use cordova-js unified approach.


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/commit/7c7a8c49
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/tree/7c7a8c49
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/diff/7c7a8c49

Branch: refs/heads/master
Commit: 7c7a8c49659f6bafffa7020dc9bcee042eeae266
Parents: edd7467
Author: Fil Maj <maj.fil@gmail.com>
Authored: Tue Mar 6 16:14:11 2012 -0800
Committer: Fil Maj <maj.fil@gmail.com>
Committed: Fri Mar 16 10:56:49 2012 -0700

----------------------------------------------------------------------
 CordovaLib/Classes/CDVLocation.h       |   71 ++----
 CordovaLib/Classes/CDVLocation.m       |  337 ++++++---------------------
 CordovaLib/Classes/CDVViewController.m |    9 +-
 3 files changed, 92 insertions(+), 325 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/7c7a8c49/CordovaLib/Classes/CDVLocation.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVLocation.h b/CordovaLib/Classes/CDVLocation.h
index e18aef6..41e67bf 100755
--- a/CordovaLib/Classes/CDVLocation.h
+++ b/CordovaLib/Classes/CDVLocation.h
@@ -22,49 +22,35 @@
 #import <CoreLocation/CoreLocation.h>
 #import "CDVPlugin.h"
 
-enum CDVHeadingStatus {
-	HEADINGSTOPPED = 0,
-    HEADINGSTARTING,
-	HEADINGRUNNING,
-    HEADINGERROR
-};
-typedef NSUInteger CDVHeadingStatus;
-
-// simple object to keep track of heading information
-@interface CDVHeadingData : NSObject {
-    CDVHeadingStatus     headingStatus;
-    BOOL              headingRepeats;
-    CLHeading*        headingInfo;
-    NSMutableArray*   headingCallbacks;
-    NSString*         headingFilter;
-    
-}
-
-@property (nonatomic, assign) CDVHeadingStatus headingStatus;
-@property (nonatomic, assign) BOOL headingRepeats;
-@property (nonatomic, retain) CLHeading* headingInfo;
-@property (nonatomic, retain) NSMutableArray* headingCallbacks;
-@property (nonatomic, retain) NSString* headingFilter;
-
-@end
-
 @interface CDVLocation : CDVPlugin <CLLocationManagerDelegate> {
-
-    @private BOOL              __locationStarted;
-    CDVHeadingData*    headingData;
+    @private BOOL __locationStarted;
+    @private NSString *callbackId;
+    double timestamp;
+    double latitude;
+    double longitude;
+    double altitude;
+    double velocity;
+    double heading;
+    double accuracy;
+    double altitudeAccuracy;
 }
 
 @property (nonatomic, retain) CLLocationManager *locationManager;
-@property (nonatomic, retain) CDVHeadingData* headingData;
-
-
-- (BOOL) hasHeadingSupport;
-
-- (void)startLocation:(NSMutableArray*)arguments
+@property double timestamp;
+@property double latitude;
+@property double longitude;
+@property double altitude;
+@property double velocity;
+@property double heading;
+@property double accuracy;
+@property double altitudeAccuracy;
+
+- (void)getLocation:(NSMutableArray*)arguments
      withDict:(NSMutableDictionary*)options;
 
-- (void)stopLocation:(NSMutableArray*)arguments
-    withDict:(NSMutableDictionary*)options;
+- (void)startLocation;
+
+- (void)stopLocation;
 
 - (void)locationManager:(CLLocationManager *)manager
     didUpdateToLocation:(CLLocation *)newLocation
@@ -75,17 +61,6 @@ typedef NSUInteger CDVHeadingStatus;
 
 - (BOOL) isLocationServicesEnabled;
 
-- (void)getCurrentHeading:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options;
-- (void)returnHeadingInfo: (NSString*) callbackId keepCallback: (BOOL) bRetain;
-
-- (void)stopHeading:(NSMutableArray*)arguments
-		   withDict:(NSMutableDictionary*)options;
-- (void) startHeadingWithFilter: (CLLocationDegrees) filter;
-- (void)locationManager:(CLLocationManager *)manager
-	   didUpdateHeading:(CLHeading *)heading;
-
-- (BOOL)locationManagerShouldDisplayHeadingCalibration:(CLLocationManager *)manager;
-
 @end
 
 

http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/7c7a8c49/CordovaLib/Classes/CDVLocation.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVLocation.m b/CordovaLib/Classes/CDVLocation.m
index fb6cdb4..772c167 100755
--- a/CordovaLib/Classes/CDVLocation.m
+++ b/CordovaLib/Classes/CDVLocation.m
@@ -35,6 +35,7 @@
 @interface NSError(JSONMethods)
 
 - (NSString*) JSONRepresentation;
+- (NSDictionary*) DictionaryRepresentation;
 
 @end
 
@@ -44,48 +45,12 @@
 
 @end
 
-
-@interface CLHeading(JSONMethods)
-
-- (NSString*) JSONRepresentation;
-
-@end
-
-#pragma mark -
-#pragma mark CDVHeadingData
-
-@implementation CDVHeadingData
-
-@synthesize headingStatus, headingRepeats, headingInfo, headingCallbacks, headingFilter;
--(CDVHeadingData*) init
-{
-    self = (CDVHeadingData*)[super init];
-    if (self) 
-	{
-        self.headingRepeats = NO;
-        self.headingStatus = HEADINGSTOPPED;
-        self.headingInfo = nil;
-        self.headingCallbacks = nil;
-        self.headingFilter = nil;
-    }
-    return self;
-}
--(void) dealloc 
-{
-    self.headingInfo = nil;
-    self.headingCallbacks = nil;
-    self.headingFilter = nil;
-    [super dealloc];  
-}
-
-@end
-
 #pragma mark -
 #pragma mark CDVLocation
 
 @implementation CDVLocation
 
-@synthesize locationManager, headingData;
+@synthesize locationManager, latitude, longitude, heading, velocity, altitude, accuracy,
altitudeAccuracy, timestamp;
 
 - (CDVPlugin*) initWithWebView:(UIWebView*)theWebView
 {
@@ -95,25 +60,18 @@
         self.locationManager = [[[CLLocationManager alloc] init] autorelease];
         self.locationManager.delegate = self; // Tells the location manager to send updates
to this object
         __locationStarted = NO;
-        self.headingData = nil;        
+        self.timestamp = 0.0;
+        self.latitude = 0.0;
+        self.longitude = 0.0;
+        self.altitude = 0.0;
+        self.accuracy = 0.0;
+        self.heading = 0.0;
+        self.velocity = 0.0;
+        self.altitudeAccuracy = 0.0;
     }
     return self;
 }
 
-- (BOOL) hasHeadingSupport
-{
-	BOOL headingInstancePropertyAvailable = [self.locationManager respondsToSelector:@selector(headingAvailable)];
// iOS 3.x
-	BOOL headingClassPropertyAvailable = [CLLocationManager respondsToSelector:@selector(headingAvailable)];
// iOS 4.x
-	
-	if (headingInstancePropertyAvailable) { // iOS 3.x
-		return [(id)self.locationManager headingAvailable];
-	} else if (headingClassPropertyAvailable) { // iOS 4.x
-		return [CLLocationManager headingAvailable];
-	} else { // iOS 2.x
-		return NO;
-	}
-}
-
 - (BOOL) isAuthorized
 {
 	BOOL authorizationStatusClassPropertyAvailable = [CLLocationManager respondsToSelector:@selector(authorizationStatus)];
// iOS 4.2+
@@ -146,28 +104,10 @@
 	}
 }
 
-- (void) startLocation:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options
+- (void) startLocation
 {
     if (![self isLocationServicesEnabled])
 	{
-		BOOL forcePrompt = NO;
-		// if forcePrompt is true iPhone will still show the "Location Services not active." Settings
| Cancel prompt.
-		if ([options objectForKey:kPGLocationForcePromptKey]) 
-		{
-			forcePrompt = [[options objectForKey:kPGLocationForcePromptKey] boolValue];
-		}
-        
-		if (!forcePrompt)
-		{
-            NSError* error = [NSError errorWithDomain:kPGLocationErrorDomain code:1 userInfo:
-                              [NSDictionary dictionaryWithObject:@"Location services is not
enabled" forKey:NSLocalizedDescriptionKey]];
-            NSLog(@"%@", [error JSONRepresentation]);
-            
-			NSString* jsCallback = [NSString stringWithFormat:@"navigator.geolocation.setError(%@);",
[error JSONRepresentation]]; 
-			[super writeJavascript:jsCallback];
-            
-			return;
-		}
     }
     if (![self isAuthorized]) 
     {
@@ -177,12 +117,18 @@
             code = [CLLocationManager authorizationStatus];
         }
         
+        CDVPluginResult* result = nil;
+        NSString* jsString = nil;
+        
         NSError* error = [NSError errorWithDomain:NSCocoaErrorDomain code:code userInfo:
                           [NSDictionary dictionaryWithObject:@"App is not authorized for
Location Services" forKey:NSLocalizedDescriptionKey]];
+
         NSLog(@"%@", [error JSONRepresentation]);
+        
+        result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ILLEGAL_ACCESS_EXCEPTION
messageAsDictionary:[error DictionaryRepresentation]];
+        jsString = [result toErrorCallbackString:callbackId];
 
-        NSString* jsCallback = [NSString stringWithFormat:@"navigator.geolocation.setError(%@);",
[error JSONRepresentation]];
-        [super writeJavascript:jsCallback];
+        [super writeJavascript:jsString];
         
         return;
     }
@@ -193,7 +139,8 @@
     [self.locationManager stopUpdatingLocation];
     [self.locationManager startUpdatingLocation];
     __locationStarted = YES;
-
+    // TODO: what should we do about all this stuff?
+    /*
     if ([options objectForKey:kPGLocationDistanceFilterKey]) 
 	{
         CLLocationDistance distanceFilter = [(NSString *)[options objectForKey:kPGLocationDistanceFilterKey]
doubleValue];
@@ -223,9 +170,10 @@
         
         self.locationManager.desiredAccuracy = desiredAccuracy;
     }
+     */
 }
 
-- (void) stopLocation:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options
+- (void) stopLocation
 {
     if (__locationStarted)
 	{
@@ -238,210 +186,52 @@
 	}
 }
 
-- (void) locationManager:(CLLocationManager *)manager
-							didUpdateToLocation:(CLLocation *)newLocation
-							fromLocation:(CLLocation *)oldLocation
-{
-	
-    NSString* jsCallback = [NSString stringWithFormat:@"navigator.geolocation.setLocation(%@);",
[newLocation JSONRepresentation]];
-    [super writeJavascript:jsCallback];
-}
-// called to get the current heading
-// Will call location manager to startUpdatingHeading if necessary
-
-- (void)getCurrentHeading:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options
-{
-    NSString* callbackId = [arguments objectAtIndex:0];
-    NSNumber* repeats = [options valueForKey:@"repeats"];  // indicates this call will be
repeated at regular intervals
-    
-    if ([self hasHeadingSupport] == NO) 
-    {
-        CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageToErrorObject:20];
-        [super writeJavascript:[result toErrorCallbackString:callbackId]];
-    } else {
-       // heading retrieval does is not affected by disabling locationServices and authorization
of app for location services
-        if (!self.headingData) {
-            self.headingData = [[[CDVHeadingData alloc] init] autorelease];
-        }
-        CDVHeadingData* hData = self.headingData;
-        
-        if (repeats != nil) {
-            hData.headingRepeats = YES;
-        }
-        if (!hData.headingCallbacks) {
-            hData.headingCallbacks = [NSMutableArray arrayWithCapacity:1];
-        }
-        // add the callbackId into the array so we can call back when get data
-        [hData.headingCallbacks addObject:callbackId]; 
-        
-        if (hData.headingStatus != HEADINGRUNNING && hData.headingStatus != HEADINGERROR)
{
-            // Tell the location manager to start notifying us of heading updates
-            [self startHeadingWithFilter: 0.2];
-        }
-        else {
-            [self returnHeadingInfo: callbackId keepCallback:NO]; 
-        }
-    }
-  
-          
-} 
-// called to request heading updates when heading changes by a certain amount (filter)
-- (void)watchHeadingFilter:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options
-{
-    NSString* callbackId = [arguments objectAtIndex:0];
-    NSNumber* filter = [options valueForKey:@"filter"];
-    CDVHeadingData* hData = self.headingData;
-    if ([self hasHeadingSupport] == NO) {
-        CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageToErrorObject:20];
-        [super writeJavascript:[result toErrorCallbackString:callbackId]];
-    } else {
-        if (!hData) {
-            self.headingData = [[[CDVHeadingData alloc] init] autorelease];
-            hData = self.headingData;
-        }
-        if (hData.headingStatus != HEADINGRUNNING) {
-            // Tell the location manager to start notifying us of heading updates
-            [self startHeadingWithFilter: [filter doubleValue]];
-        } else {
-            // if already running check to see if due to existing watch filter
-            if (hData.headingFilter && ![hData.headingFilter isEqualToString:callbackId]){
-                // new watch filter being specified
-                // send heading data one last time to clear old successCallback
-                [self returnHeadingInfo:hData.headingFilter keepCallback: NO];
-            } 
-            
-        }
-        // save the new filter callback and update the headingFilter setting
-        hData.headingFilter = callbackId;
-        // check if need to stop and restart in order to change value???
-        self.locationManager.headingFilter = [filter doubleValue];
-    } 
-}
-- (void)returnHeadingInfo: (NSString*) callbackId keepCallback: (BOOL) bRetain
+- (void) getLocation:(NSMutableArray *)arguments withDict:(NSMutableDictionary *)options
 {
     CDVPluginResult* result = nil;
     NSString* jsString = nil;
-    CDVHeadingData* hData = self.headingData;
+	callbackId = [arguments objectAtIndex:0];
     
-    if (hData && hData.headingStatus == HEADINGERROR) {
-        // return error
-        result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageToErrorObject:0];
-        jsString = [result toErrorCallbackString:callbackId];
-    } else if (hData && hData.headingStatus == HEADINGRUNNING && hData.headingInfo)
{
-        // if there is heading info, return it
-        CLHeading* hInfo = hData.headingInfo;
-        NSMutableDictionary* returnInfo = [NSMutableDictionary dictionaryWithCapacity:4];
-        NSNumber* timestamp = [NSNumber numberWithDouble:([hInfo.timestamp timeIntervalSince1970]*1000)];
-        [returnInfo setObject:timestamp forKey:@"timestamp"];
-        [returnInfo setObject:[NSNumber numberWithDouble: hInfo.magneticHeading] forKey:@"magneticHeading"];
-        id trueHeading = __locationStarted ? (id)[NSNumber numberWithDouble:hInfo.trueHeading]:(id)[NSNull
null];
-        [returnInfo setObject:trueHeading forKey:@"trueHeading"];
-        [returnInfo setObject:[NSNumber numberWithDouble: hInfo.headingAccuracy] forKey:@"headingAccuracy"];
-        
-        result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:
returnInfo];
-        [result setKeepCallbackAsBool:bRetain];
-
-        jsString = [result toSuccessCallbackString:callbackId];
-    }
-    if (jsString) {
-        [super writeJavascript:jsString];
+    if (!__locationStarted)
+    {
+        [self startLocation];
     }
     
-    
-}
-
-- (void) stopHeading:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options
-{
-    CDVHeadingData* hData = self.headingData;
-    if (hData && hData.headingStatus != HEADINGSTOPPED)
-	{
-		if (hData.headingFilter) {
-            // callback one last time to clear callback
-            [self returnHeadingInfo:hData.headingFilter keepCallback:NO];
-            hData.headingFilter = nil;
-        }
-        [self.locationManager stopUpdatingHeading];		
-        self.headingData = nil;
-	}
-}	
-
-
-// helper method to check the orientation and start updating headings
-- (void) startHeadingWithFilter: (CLLocationDegrees) filter
-{
-    if ([self.locationManager respondsToSelector: @selector(headingOrientation)]) {
-        UIDeviceOrientation currentOrientation = [[UIDevice currentDevice] orientation];
-        if (currentOrientation != UIDeviceOrientationUnknown) {
-            CDVViewController* pgViewController = (CDVViewController*)self.viewController;
-            
-            if ([pgViewController.supportedOrientations containsObject:
-                 [NSNumber numberWithInt:currentOrientation]]) {
-                
-                self.locationManager.headingOrientation = (CLDeviceOrientation)currentOrientation;
-                // FYI UIDeviceOrientation and CLDeviceOrientation enums are currently the
same
-            }   
-        }
-    }
-    self.locationManager.headingFilter = filter;
-    [self.locationManager startUpdatingHeading];
-    self.headingData.headingStatus = HEADINGSTARTING;
-}
-- (BOOL)locationManagerShouldDisplayHeadingCalibration:(CLLocationManager *)manager
-{
-	return YES;
+    NSMutableDictionary *currentLocation = [NSMutableDictionary dictionaryWithCapacity:8];
+    [currentLocation setValue:[NSNumber numberWithDouble:self.timestamp] forKey:@"timestamp"];
+    [currentLocation setValue:[NSNumber numberWithDouble:self.latitude] forKey:@"latitude"];
+    [currentLocation setValue:[NSNumber numberWithDouble:self.longitude] forKey:@"longitude"];
+    [currentLocation setValue:[NSNumber numberWithDouble:self.altitude] forKey:@"altitude"];
+    [currentLocation setValue:[NSNumber numberWithDouble:self.heading] forKey:@"heading"];
+    [currentLocation setValue:[NSNumber numberWithDouble:self.accuracy] forKey:@"accuracy"];
+    [currentLocation setValue:[NSNumber numberWithDouble:self.velocity] forKey:@"velocity"];
+    [currentLocation setValue:[NSNumber numberWithDouble:self.altitudeAccuracy] forKey:@"altitudeAccuracy"];
+
+    result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:currentLocation];
+    jsString = [result toSuccessCallbackString:callbackId];
+    [self writeJavascript:jsString];
 }
 
 - (void) locationManager:(CLLocationManager *)manager
-						didUpdateHeading:(CLHeading *)heading
+							didUpdateToLocation:(CLLocation *)newLocation
+							fromLocation:(CLLocation *)oldLocation
 {
-    CDVHeadingData* hData = self.headingData;
-    // save the data for next call into getHeadingData
-    hData.headingInfo = heading;
-    
-    if (hData.headingStatus == HEADINGSTARTING) {
-        hData.headingStatus = HEADINGRUNNING; // so returnHeading info will work
-        //this is the first update
-        for (NSString* callbackId in hData.headingCallbacks) {
-            [self returnHeadingInfo:callbackId keepCallback:NO];
-        }
-        [hData.headingCallbacks removeAllObjects];
-        if (!hData.headingRepeats && !hData.headingFilter) {
-            [self stopHeading:nil withDict:nil];
-        }
-    }
-    if (hData.headingFilter) {
-        [self returnHeadingInfo: hData.headingFilter keepCallback:YES];
-    }
-    hData.headingStatus = HEADINGRUNNING;  // to clear any error
-
+    self.timestamp = [newLocation.timestamp timeIntervalSince1970] * 1000.0;
+    self.latitude = newLocation.coordinate.latitude;
+    self.longitude = newLocation.coordinate.longitude;
+    self.altitude = newLocation.altitude;
+    self.heading = newLocation.course;
+    self.velocity = newLocation.speed;
+    self.accuracy = newLocation.horizontalAccuracy;
+    self.altitudeAccuracy = newLocation.verticalAccuracy;
 }
+
 - (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error
 {
     NSLog(@"locationManager::didFailWithError %@", [error localizedFailureReason]);
-	NSString* jsCallback = @"";
 	
-    // Compass Error
-	if ([error code] == kCLErrorHeadingFailure)
-	{
-		CDVHeadingData* hData = self.headingData;
-        if (hData) {
-            if (hData.headingStatus == HEADINGSTARTING) {
-                // heading error during startup - report error
-                for (NSString* callbackId in hData.headingCallbacks) {
-                    CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK
messageToErrorObject:0];
-                    [super writeJavascript: [result toErrorCallbackString:callbackId]];
-                }
-                [hData.headingCallbacks removeAllObjects];
-            } // else for frequency watches next call to getCurrentHeading will report error
-            else if (hData.headingFilter) {
-                CDVPluginResult* resultFilter = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK
messageToErrorObject:0];
-                [super writeJavascript: [resultFilter toErrorCallbackString:hData.headingFilter]];
-            }
-            hData.headingStatus = HEADINGERROR;
-        }
-	} 
     // Location Error
-	else 
+	if ([error code] != kCLErrorHeadingFailure)
 	{
 		/*
 			W3C PositionError
@@ -454,21 +244,18 @@
 		if (error.code > kCLErrorNetwork) {
             error = [NSError errorWithDomain:error.domain code:kCLErrorLocationUnknown userInfo:error.userInfo];
 		}
-		
-		jsCallback = [NSString stringWithFormat:@"navigator.geolocation.setError(%@);", [error
JSONRepresentation]];
+        CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:[error
DictionaryRepresentation]];
+        NSString* jsString = [result toErrorCallbackString:callbackId];
+        [self writeJavascript:jsString];
 	}
-	
-    [super writeJavascript:jsCallback];
     
-	[self.locationManager stopUpdatingLocation];
-    __locationStarted = NO;
+    [self stopLocation];
 }
 
 - (void) dealloc 
 {
 	self.locationManager.delegate = nil;
 	self.locationManager = nil;
-    self.headingData = nil;
 	[super dealloc];
 }
 
@@ -483,7 +270,7 @@
 {
 	return [NSString stringWithFormat:
             @"{ timestamp: %.00f, \
-                coords: { latitude: %f, longitude: %f, altitude: %.02f, heading: %.02f, speed:
%.02f, accuracy: %.02f, altitudeAccuracy: %.02f } \
+                latitude: %f, longitude: %f, altitude: %.02f, heading: %.02f, velocity: %.02f,
accuracy: %.02f, altitudeAccuracy: %.02f \
               }",
             [self.timestamp timeIntervalSince1970] * 1000.0,
             self.coordinate.latitude,
@@ -511,5 +298,13 @@
 			[self localizedDescription]
             ];
 }
+- (NSDictionary*) DictionaryRepresentation
+{
+    NSMutableDictionary *error = [NSMutableDictionary dictionaryWithCapacity:2];
+    [error setValue:[NSNumber numberWithInteger:self.code] forKey:@"code"];
+    [error setValue:[self localizedDescription] forKey:@"message"];
+    
+    return error;
+}
 
 @end

http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/7c7a8c49/CordovaLib/Classes/CDVViewController.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVViewController.m b/CordovaLib/Classes/CDVViewController.m
index 82bcd30..c5c0153 100644
--- a/CordovaLib/Classes/CDVViewController.m
+++ b/CordovaLib/Classes/CDVViewController.m
@@ -166,8 +166,7 @@
      */
     
     if ([enableLocation boolValue]) {
-        // TODO: change this package name
-        [[self.commandDelegate getCommandInstance:@"org.apache.cordova.geolocation"] startLocation:nil
withDict:nil];
+        [[self.commandDelegate getCommandInstance:@"Geolocation"] startLocation];
     }
     
     /*
@@ -207,6 +206,7 @@
     }
     
 	self.commandDelegate = self;
+
 }
 
 - (NSArray*) parseInterfaceOrientations:(NSArray*)orientations
@@ -353,7 +353,6 @@
  */
 - (void) webViewDidStartLoad:(UIWebView*)theWebView 
 {
-    
 }
 
 /**
@@ -817,7 +816,7 @@ BOOL gSplashScreenShown = NO;
     [devProps setObject:[device systemVersion] forKey:@"version"];
     [devProps setObject:[device uniqueIdentifier] forKey:@"uuid"];
     [devProps setObject:[device name] forKey:@"name"];
-    [devProps setObject:[[self class] cordovaVersion ] forKey:@"gap"];
+    //[devProps setObject:[[self class] cordovaVersion ] forKey:@"gap"];
     
     NSDictionary *devReturn = [NSDictionary dictionaryWithDictionary:devProps];
     return devReturn;
@@ -880,7 +879,6 @@ static NSString* cdvVersion;
         cdvVersion = [first_line retain];
     }
 #endif
-    
     return cdvVersion;
 }
 
@@ -893,7 +891,6 @@ static NSString* cdvVersion;
  */
 - (void) onAppWillTerminate:(NSNotification*)notification
 {
-    NSLog(@"applicationWillTerminate");
     
     // empty the tmp directory
     NSFileManager* fileMgr = [[NSFileManager alloc] init];


Mime
View raw message