You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by an...@apache.org on 2013/05/10 01:00:42 UTC

[40/43] git commit: [CB-3238] Update cordova-ios to 2.7.0

[CB-3238] Update cordova-ios to 2.7.0


Project: http://git-wip-us.apache.org/repos/asf/cordova-cli/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-cli/commit/0f619a72
Tree: http://git-wip-us.apache.org/repos/asf/cordova-cli/tree/0f619a72
Diff: http://git-wip-us.apache.org/repos/asf/cordova-cli/diff/0f619a72

Branch: refs/heads/master
Commit: 0f619a723bd8d7553cfbcd56f48c9bb679caf89c
Parents: dac8583
Author: Michael Brooks <mi...@michaelbrooks.ca>
Authored: Tue Apr 30 13:23:40 2013 -0700
Committer: Anis Kadri <an...@gmail.com>
Committed: Thu May 9 15:56:00 2013 -0700

----------------------------------------------------------------------
 .../CordovaLib/Classes/CDVInAppBrowser.h           |    2 +-
 .../CordovaLib/Classes/CDVInAppBrowser.m           |   34 +++++++++------
 lib/cordova-ios/CordovaLib/VERSION                 |    2 +-
 lib/cordova-ios/CordovaLib/cordova.ios.js          |   24 +++++++---
 lib/cordova-ios/RELEASENOTES.md                    |    2 +
 .../screen/ios/screen-iphone-portrait-568h-2x.png  |  Bin 0 -> 34225 bytes
 6 files changed, 40 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/0f619a72/lib/cordova-ios/CordovaLib/Classes/CDVInAppBrowser.h
----------------------------------------------------------------------
diff --git a/lib/cordova-ios/CordovaLib/Classes/CDVInAppBrowser.h b/lib/cordova-ios/CordovaLib/Classes/CDVInAppBrowser.h
index 343f40d..765326a 100644
--- a/lib/cordova-ios/CordovaLib/Classes/CDVInAppBrowser.h
+++ b/lib/cordova-ios/CordovaLib/Classes/CDVInAppBrowser.h
@@ -55,7 +55,7 @@
 
 @property (nonatomic, weak) id <CDVScreenOrientationDelegate> orientationDelegate;
 @property (nonatomic, weak) CDVInAppBrowser* navigationDelegate;
-@property (nonatomic) NSURL* requestedURL;
+@property (nonatomic) NSURL* currentURL;
 
 - (void)close;
 - (void)navigateTo:(NSURL*)url;

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/0f619a72/lib/cordova-ios/CordovaLib/Classes/CDVInAppBrowser.m
----------------------------------------------------------------------
diff --git a/lib/cordova-ios/CordovaLib/Classes/CDVInAppBrowser.m b/lib/cordova-ios/CordovaLib/Classes/CDVInAppBrowser.m
index f366bd8..b03d1fe 100644
--- a/lib/cordova-ios/CordovaLib/Classes/CDVInAppBrowser.m
+++ b/lib/cordova-ios/CordovaLib/Classes/CDVInAppBrowser.m
@@ -253,6 +253,7 @@
 - (BOOL)webView:(UIWebView*)theWebView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType
 {
     NSURL* url = request.URL;
+    BOOL isTopLevelNavigation = [request.URL isEqual:[request mainDocumentURL]];
 
     // See if the url uses the 'gap-iab' protocol. If so, the host should be the id of a callback to execute,
     // and the path, if present, should be a JSON-encoded value to pass to the callback.
@@ -279,28 +280,28 @@
             [self.commandDelegate sendPluginResult:pluginResult callbackId:scriptCallbackId];
             return NO;
         }
+    } else if ((self.callbackId != nil) && isTopLevelNavigation) {
+        // Send a loadstart event for each top-level navigation (includes redirects).
+        CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK
+                                                      messageAsDictionary:@{@"type":@"loadstart", @"url":[url absoluteString]}];
+        [pluginResult setKeepCallback:[NSNumber numberWithBool:YES]];
+
+        [self.commandDelegate sendPluginResult:pluginResult callbackId:self.callbackId];
     }
+
     return YES;
 }
 
 - (void)webViewDidStartLoad:(UIWebView*)theWebView
 {
     _injectedIframeBridge = NO;
-    if (self.callbackId != nil) {
-        NSString* url = [[self.inAppBrowserViewController requestedURL] absoluteString];
-        CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK
-                                                      messageAsDictionary:@{@"type":@"loadstart", @"url":url}];
-        [pluginResult setKeepCallback:[NSNumber numberWithBool:YES]];
-
-        [self.commandDelegate sendPluginResult:pluginResult callbackId:self.callbackId];
-    }
 }
 
 - (void)webViewDidFinishLoad:(UIWebView*)theWebView
 {
     if (self.callbackId != nil) {
         // TODO: It would be more useful to return the URL the page is actually on (e.g. if it's been redirected).
-        NSString* url = [[self.inAppBrowserViewController requestedURL] absoluteString];
+        NSString* url = [self.inAppBrowserViewController.currentURL absoluteString];
         CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK
                                                       messageAsDictionary:@{@"type":@"loadstop", @"url":url}];
         [pluginResult setKeepCallback:[NSNumber numberWithBool:YES]];
@@ -312,7 +313,7 @@
 - (void)webView:(UIWebView*)theWebView didFailLoadWithError:(NSError*)error
 {
     if (self.callbackId != nil) {
-        NSString* url = [[self.inAppBrowserViewController requestedURL] absoluteString];
+        NSString* url = [self.inAppBrowserViewController.currentURL absoluteString];
         CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR
                                                       messageAsDictionary:@{@"type":@"loaderror", @"url":url, @"code": [NSNumber numberWithInt:error.code], @"message": error.localizedDescription}];
         [pluginResult setKeepCallback:[NSNumber numberWithBool:YES]];
@@ -341,7 +342,7 @@
 
 @implementation CDVInAppBrowserViewController
 
-@synthesize requestedURL = _requestedURL;
+@synthesize currentURL;
 
 - (id)initWithUserAgent:(NSString*)userAgent prevUserAgent:(NSString*)prevUserAgent
 {
@@ -517,6 +518,8 @@
         [[self parentViewController] dismissModalViewControllerAnimated:YES];
     }
 
+    self.currentURL = nil;
+
     if ((self.navigationDelegate != nil) && [self.navigationDelegate respondsToSelector:@selector(browserExit)]) {
         [self.navigationDelegate browserExit];
     }
@@ -526,8 +529,6 @@
 {
     NSURLRequest* request = [NSURLRequest requestWithURL:url];
 
-    _requestedURL = url;
-
     if (_userAgentLockToken != 0) {
         [self.webView loadRequest:request];
     } else {
@@ -566,6 +567,11 @@
 
 - (BOOL)webView:(UIWebView*)theWebView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType
 {
+    BOOL isTopLevelNavigation = [request.URL isEqual:[request mainDocumentURL]];
+
+    if (isTopLevelNavigation) {
+        self.currentURL = request.URL;
+    }
     return [self.navigationDelegate webView:theWebView shouldStartLoadWithRequest:request navigationType:navigationType];
 }
 
@@ -573,7 +579,7 @@
 {
     // update url, stop spinner, update back/forward
 
-    self.addressLabel.text = theWebView.request.URL.absoluteString;
+    self.addressLabel.text = [self.currentURL absoluteString];
     self.backButton.enabled = theWebView.canGoBack;
     self.forwardButton.enabled = theWebView.canGoForward;
 

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/0f619a72/lib/cordova-ios/CordovaLib/VERSION
----------------------------------------------------------------------
diff --git a/lib/cordova-ios/CordovaLib/VERSION b/lib/cordova-ios/CordovaLib/VERSION
index 59b7056..24ba9a3 100644
--- a/lib/cordova-ios/CordovaLib/VERSION
+++ b/lib/cordova-ios/CordovaLib/VERSION
@@ -1 +1 @@
-2.7.0rc1
+2.7.0

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/0f619a72/lib/cordova-ios/CordovaLib/cordova.ios.js
----------------------------------------------------------------------
diff --git a/lib/cordova-ios/CordovaLib/cordova.ios.js b/lib/cordova-ios/CordovaLib/cordova.ios.js
index 844816f..b716939 100644
--- a/lib/cordova-ios/CordovaLib/cordova.ios.js
+++ b/lib/cordova-ios/CordovaLib/cordova.ios.js
@@ -1,8 +1,8 @@
 // Platform: ios
 
-// commit 360bd3e65c33ce4f01e2efb82d641a565ef3c333
+// commit cd29cf0f224ccf25e9d422a33fd02ef67d3a78f4
 
-// File generated at :: Fri Apr 19 2013 18:36:09 GMT-0700 (PDT)
+// File generated at :: Mon Apr 29 2013 16:14:47 GMT-0700 (PDT)
 
 /*
  Licensed to the Apache Software Foundation (ASF) under one
@@ -909,11 +909,19 @@ function iOSExec() {
         // an invalid callbackId and passes it even if no callbacks were given.
         callbackId = 'INVALID';
     } else {
-        // FORMAT TWO
-        splitCommand = arguments[0].split(".");
-        action = splitCommand.pop();
-        service = splitCommand.join(".");
-        actionArgs = Array.prototype.splice.call(arguments, 1);
+        // FORMAT TWO, REMOVED
+       try {
+           splitCommand = arguments[0].split(".");
+           action = splitCommand.pop();
+           service = splitCommand.join(".");
+           actionArgs = Array.prototype.splice.call(arguments, 1);
+
+           console.log('The old format of this exec call has been removed (deprecated since 2.1). Change to: ' +
+                       "cordova.exec(null, null, \"" + service + "\", " + action + "\"," + JSON.stringify(actionArgs) + ");"
+                       );
+           return;
+       } catch (e) {
+       }
     }
 
     // Register the callbacks and add the callbackId to the positional
@@ -6388,7 +6396,7 @@ require('cordova/channel').onNativeReady.fire();
         xhr.onload = function() {
             // If the response is a JSON string which composes an array, call handlePluginsObject.
             // If the request fails, or the response is not a JSON array, just call finishPluginLoading.
-            var obj = JSON.parse(this.responseText);
+            var obj = this.responseText && JSON.parse(this.responseText);
             if (obj && obj instanceof Array && obj.length > 0) {
                 handlePluginsObject(obj);
             } else {

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/0f619a72/lib/cordova-ios/RELEASENOTES.md
----------------------------------------------------------------------
diff --git a/lib/cordova-ios/RELEASENOTES.md b/lib/cordova-ios/RELEASENOTES.md
index ffe0c0b..3c2031a 100644
--- a/lib/cordova-ios/RELEASENOTES.md
+++ b/lib/cordova-ios/RELEASENOTES.md
@@ -58,6 +58,8 @@
 * [CB-2896] split writing of working tags off here, multipart tags not supported
 * [CB-2896] fixed error in exif subifd offset calculation for tag 8769
 * [CB-2902] re-added long/short tags to template dict, fixed subExifIFD offset
+* [CB-2698] Fix load detection when pages have redirects.
+* [CB-3295] Send InAppBrowser loadstart events when redirects occur
 
 <br />
 

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/0f619a72/lib/cordova-ios/bin/templates/project/www/res/screen/ios/screen-iphone-portrait-568h-2x.png
----------------------------------------------------------------------
diff --git a/lib/cordova-ios/bin/templates/project/www/res/screen/ios/screen-iphone-portrait-568h-2x.png b/lib/cordova-ios/bin/templates/project/www/res/screen/ios/screen-iphone-portrait-568h-2x.png
new file mode 100644
index 0000000..10ed683
Binary files /dev/null and b/lib/cordova-ios/bin/templates/project/www/res/screen/ios/screen-iphone-portrait-568h-2x.png differ