You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by sh...@apache.org on 2012/05/28 11:05:21 UTC

ios commit: Fixes CB-835 - watchPosition callbacks are not being called

Updated Branches:
  refs/heads/master 2746f4d37 -> 56decbd08


Fixes CB-835 - watchPosition callbacks are not being called


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/56decbd0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/tree/56decbd0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/diff/56decbd0

Branch: refs/heads/master
Commit: 56decbd085eeb14818ee2cd5c9ee4e3bef893b0e
Parents: 2746f4d
Author: Shazron Abdullah <sh...@apache.org>
Authored: Mon May 28 01:58:10 2012 -0700
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Mon May 28 01:58:10 2012 -0700

----------------------------------------------------------------------
 CordovaLib/Classes/CDVLocation.h |    2 +-
 CordovaLib/Classes/CDVLocation.m |   10 +++++-----
 2 files changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/56decbd0/CordovaLib/Classes/CDVLocation.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVLocation.h b/CordovaLib/Classes/CDVLocation.h
index 9e5977e..212eba2 100755
--- a/CordovaLib/Classes/CDVLocation.h
+++ b/CordovaLib/Classes/CDVLocation.h
@@ -81,7 +81,7 @@ typedef NSUInteger CDVLocationStatus;
 - (void) getLocation:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options;
 - (void) addWatch:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options;
 - (void) clearWatch:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options;
-- (void) returnLocationInfo: (NSString*) callbackId;
+- (void)returnLocationInfo: (NSString*) callbackId andKeepCallback:(BOOL)keepCallback;
 - (void) returnLocationError: (NSUInteger) errorCode withMessage: (NSString*) message;
 - (void) startLocation: (BOOL) enableHighAccuracy;
 

http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/56decbd0/CordovaLib/Classes/CDVLocation.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVLocation.m b/CordovaLib/Classes/CDVLocation.m
index e893771..2d82372 100755
--- a/CordovaLib/Classes/CDVLocation.m
+++ b/CordovaLib/Classes/CDVLocation.m
@@ -242,13 +242,13 @@
     cData.locationInfo = newLocation;
     if (self.locationData.locationCallbacks.count > 0) {
         for (NSString *callbackId in self.locationData.locationCallbacks) {
-            [self returnLocationInfo:callbackId];
+            [self returnLocationInfo:callbackId andKeepCallback:NO];
         }
         [self.locationData.locationCallbacks removeAllObjects];
     }
     if (self.locationData.watchCallbacks.count > 0) {
         for (NSString *timerId in self.locationData.watchCallbacks) {
-            [self returnLocationInfo:[self.locationData.watchCallbacks objectForKey: timerId ]];
+            [self returnLocationInfo:[self.locationData.watchCallbacks objectForKey: timerId ] andKeepCallback:YES];
         }
     } else {
         // No callbacks waiting on us anymore, turn off listening.
@@ -285,7 +285,7 @@
             [self startLocation: enableHighAccuracy];
         }
         else {
-            [self returnLocationInfo: callbackId]; 
+            [self returnLocationInfo: callbackId andKeepCallback:NO]; 
         }
     }
 }
@@ -335,7 +335,7 @@
     [self _stopLocation];
 }
 
-- (void)returnLocationInfo: (NSString*) callbackId
+- (void)returnLocationInfo: (NSString*) callbackId andKeepCallback:(BOOL)keepCallback
 {
     CDVPluginResult* result = nil;
     NSString* jsString = nil;
@@ -359,7 +359,7 @@
         [returnInfo setObject:[NSNumber numberWithDouble: lInfo.coordinate.longitude] forKey:@"longitude"];
         
         result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary: returnInfo];
-        [result setKeepCallbackAsBool:NO];
+        [result setKeepCallbackAsBool:keepCallback];
         
         jsString = [result toSuccessCallbackString:callbackId];
     }