aboutsummaryrefslogtreecommitdiffstats
path: root/iPhone/CordovaLib/Classes/CDVCommandDelegateImpl.m
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2013-03-25 15:57:26 +0000
committerStruan Donald <struan@exo.org.uk>2013-03-25 17:13:56 +0000
commit73e3d5d4077636487f07be1beff3b2714ee2b276 (patch)
tree4b4529f36ab68ec7c2a9e51bcfafbd57d9336cc8 /iPhone/CordovaLib/Classes/CDVCommandDelegateImpl.m
parente5d7b3b62be5025f31c39b50ea3955398bc7cf40 (diff)
upgrade to phonegap 2.5 for ios
Diffstat (limited to 'iPhone/CordovaLib/Classes/CDVCommandDelegateImpl.m')
-rwxr-xr-xiPhone/CordovaLib/Classes/CDVCommandDelegateImpl.m24
1 files changed, 22 insertions, 2 deletions
diff --git a/iPhone/CordovaLib/Classes/CDVCommandDelegateImpl.m b/iPhone/CordovaLib/Classes/CDVCommandDelegateImpl.m
index 76413bd..e399289 100755
--- a/iPhone/CordovaLib/Classes/CDVCommandDelegateImpl.m
+++ b/iPhone/CordovaLib/Classes/CDVCommandDelegateImpl.m
@@ -18,7 +18,7 @@
*/
#import "CDVCommandDelegateImpl.h"
-
+#import "CDVJSON.h"
#import "CDVCommandQueue.h"
#import "CDVPluginResult.h"
#import "CDVViewController.h"
@@ -78,13 +78,17 @@
- (void)sendPluginResult:(CDVPluginResult*)result callbackId:(NSString*)callbackId
{
+ // This occurs when there is are no win/fail callbacks for the call.
+ if ([@"INVALID" isEqualToString:callbackId]) {
+ return;
+ }
int status = [result.status intValue];
BOOL keepCallback = [result.keepCallback boolValue];
id message = result.message == nil ? [NSNull null] : result.message;
// Use an array to encode the message as JSON.
message = [NSArray arrayWithObject:message];
- NSString* encodedMessage = [message cdvjk_JSONString];
+ NSString* encodedMessage = [message JSONString];
// And then strip off the outer []s.
encodedMessage = [encodedMessage substringWithRange:NSMakeRange(1, [encodedMessage length] - 2)];
NSString* js = [NSString stringWithFormat:@"cordova.require('cordova/exec').nativeCallback('%@',%d,%@,%d)",
@@ -128,4 +132,20 @@
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), block);
}
+- (NSString*)userAgent
+{
+ return [_viewController userAgent];
+}
+
+- (BOOL)URLIsWhitelisted:(NSURL*)url
+{
+ return ![_viewController.whitelist schemeIsAllowed:[url scheme]] ||
+ [_viewController.whitelist URLIsAllowed:url];
+}
+
+- (NSDictionary*)settings
+{
+ return _viewController.settings;
+}
+
@end