cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mmo...@apache.org
Subject ios commit: [ios] Support startPage as URL. If wwwFolderName or startPage start with 'http://' load resource as if is NSURL
Date Thu, 29 Nov 2012 19:37:56 GMT
Updated Branches:
  refs/heads/master 2335d32ed -> a952761d0


[ios] Support startPage as URL.  If wwwFolderName or startPage start with 'http://' load resource
as if is NSURL


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

Branch: refs/heads/master
Commit: a952761d0418c6236da5bfce9c832059535e456f
Parents: 2335d32
Author: Michal Mocny <mmocny@gmail.com>
Authored: Tue Nov 27 13:40:26 2012 -0500
Committer: Michal Mocny <mmocny@gmail.com>
Committed: Thu Nov 29 14:36:06 2012 -0500

----------------------------------------------------------------------
 CordovaLib/Classes/CDVViewController.m |   20 +++++++++++++-------
 1 files changed, 13 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/a952761d/CordovaLib/Classes/CDVViewController.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVViewController.m b/CordovaLib/Classes/CDVViewController.m
index 320391f..1199984 100644
--- a/CordovaLib/Classes/CDVViewController.m
+++ b/CordovaLib/Classes/CDVViewController.m
@@ -170,17 +170,23 @@ static NSString* gOriginalUserAgent = nil;
 {
     [super viewDidLoad];
 
-    NSString* startFilePath = [_commandDelegate pathForResource:self.startPage];
     NSURL* appURL = nil;
     NSString* loadErr = nil;
 
-    if (startFilePath == nil) {
-        loadErr = [NSString stringWithFormat:@"ERROR: Start Page at '%@/%@' was not found.",
self.wwwFolderName, self.startPage];
-        NSLog(@"%@", loadErr);
-        self.loadFromString = YES;
-        appURL = nil;
+    if ([self.startPage hasPrefix:@"http://"]) {
+        appURL = [NSURL URLWithString:self.startPage];
+    } else if ([self.wwwFolderName hasPrefix:@"http://"]) {
+        appURL = [NSURL URLWithString:[NSString stringWithFormat:@"%@/%@", self.wwwFolderName,
self.startPage]];
     } else {
-        appURL = [NSURL fileURLWithPath:startFilePath];
+        NSString* startFilePath = [_commandDelegate pathForResource:self.startPage];
+        if (startFilePath == nil) {
+            loadErr = [NSString stringWithFormat:@"ERROR: Start Page at '%@/%@' was not found.",
self.wwwFolderName, self.startPage];
+            NSLog(@"%@", loadErr);
+            self.loadFromString = YES;
+            appURL = nil;
+        } else {
+            appURL = [NSURL fileURLWithPath:startFilePath];
+        }
     }
 
     // // Fix the iOS 5.1 SECURITY_ERR bug (CB-347), this must be before the webView is instantiated
////


Mime
View raw message