| 
				
			 | 
			
			
				@@ -39,8 +39,11 @@ 
			 | 
		
	
		
			
			| 
				39
			 | 
			
				39
			 | 
			
			
				     if (status == RNPStatusUndetermined) { 
			 | 
		
	
		
			
			| 
				40
			 | 
			
				40
			 | 
			
			
				         self.completionHandler = completionHandler; 
			 | 
		
	
		
			
			| 
				41
			 | 
			
				41
			 | 
			
			
				          
			 | 
		
	
		
			
			| 
				42
			 | 
			
				
			 | 
			
			
				-        self.locationManager = [[CLLocationManager alloc] init]; 
			 | 
		
	
		
			
			| 
				43
			 | 
			
				
			 | 
			
			
				-        self.locationManager.delegate = self; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				42
			 | 
			
			
				+        if (self.locationManager == nil) { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				43
			 | 
			
			
				+            self.locationManager = [[CLLocationManager alloc] init]; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				44
			 | 
			
			
				+            self.locationManager.delegate = self; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				45
			 | 
			
			
				+        } 
			 | 
		
	
		
			
			| 
				
			 | 
			
				46
			 | 
			
			
				+         
			 | 
		
	
		
			
			| 
				44
			 | 
			
				47
			 | 
			
			
				         if ([type isEqualToString:@"always"]) { 
			 | 
		
	
		
			
			| 
				45
			 | 
			
				48
			 | 
			
			
				             [self.locationManager requestAlwaysAuthorization]; 
			 | 
		
	
		
			
			| 
				46
			 | 
			
				49
			 | 
			
			
				         } else { 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -52,17 +55,19 @@ 
			 | 
		
	
		
			
			| 
				52
			 | 
			
				55
			 | 
			
			
				 } 
			 | 
		
	
		
			
			| 
				53
			 | 
			
				56
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				54
			 | 
			
				57
			 | 
			
			
				 -(void)locationManager:(CLLocationManager *)manager didChangeAuthorizationStatus:(CLAuthorizationStatus)status { 
			 | 
		
	
		
			
			| 
				55
			 | 
			
				
			 | 
			
			
				-    if (self.locationManager) { 
			 | 
		
	
		
			
			| 
				56
			 | 
			
				
			 | 
			
			
				-        self.locationManager.delegate = nil; 
			 | 
		
	
		
			
			| 
				57
			 | 
			
				
			 | 
			
			
				-        self.locationManager = nil; 
			 | 
		
	
		
			
			| 
				58
			 | 
			
				
			 | 
			
			
				-    } 
			 | 
		
	
		
			
			| 
				59
			 | 
			
				
			 | 
			
			
				-     
			 | 
		
	
		
			
			| 
				60
			 | 
			
				
			 | 
			
			
				-    if (self.completionHandler) { 
			 | 
		
	
		
			
			| 
				61
			 | 
			
				
			 | 
			
			
				-        //for some reason, checking permission right away returns denied. need to wait a tiny bit 
			 | 
		
	
		
			
			| 
				62
			 | 
			
				
			 | 
			
			
				-        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.1 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{ 
			 | 
		
	
		
			
			| 
				63
			 | 
			
				
			 | 
			
			
				-            self.completionHandler([RNPLocation getStatus]); 
			 | 
		
	
		
			
			| 
				64
			 | 
			
				
			 | 
			
			
				-            self.completionHandler = nil; 
			 | 
		
	
		
			
			| 
				65
			 | 
			
				
			 | 
			
			
				-        }); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				58
			 | 
			
			
				+    if (status != kCLAuthorizationStatusNotDetermined) { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				59
			 | 
			
			
				+        if (self.locationManager) { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				60
			 | 
			
			
				+            self.locationManager.delegate = nil; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				61
			 | 
			
			
				+            self.locationManager = nil; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				62
			 | 
			
			
				+        } 
			 | 
		
	
		
			
			| 
				
			 | 
			
				63
			 | 
			
			
				+         
			 | 
		
	
		
			
			| 
				
			 | 
			
				64
			 | 
			
			
				+        if (self.completionHandler) { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				65
			 | 
			
			
				+            //for some reason, checking permission right away returns denied. need to wait a tiny bit 
			 | 
		
	
		
			
			| 
				
			 | 
			
				66
			 | 
			
			
				+            dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.1 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				67
			 | 
			
			
				+                self.completionHandler([RNPLocation getStatus]); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				68
			 | 
			
			
				+                self.completionHandler = nil; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				69
			 | 
			
			
				+            }); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				70
			 | 
			
			
				+        }         
			 | 
		
	
		
			
			| 
				66
			 | 
			
				71
			 | 
			
			
				     } 
			 | 
		
	
		
			
			| 
				67
			 | 
			
				72
			 | 
			
			
				 } 
			 | 
		
	
		
			
			| 
				68
			 | 
			
				73
			 | 
			
			
				 @end 
			 |