You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by br...@apache.org on 2013/01/11 18:12:16 UTC
[1/2] ios commit: Move start page to be specified in tag.
Move start page to be specified in <content> tag.
The default is still index.html and can be overridden in AppDelegate.m
if necessary. The <content src="PAGE" /> can be a relative path into www
or a full URL with scheme.
Project: http://git-wip-us.apache.org/repos/asf/cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-ios/commit/6749c176
Tree: http://git-wip-us.apache.org/repos/asf/cordova-ios/tree/6749c176
Diff: http://git-wip-us.apache.org/repos/asf/cordova-ios/diff/6749c176
Branch: refs/heads/master
Commit: 6749c17640c5fed8a7d3a0b9cca204b89a855baa
Parents: deabeeb
Author: Braden Shepherdson <br...@chromium.org>
Authored: Thu Jan 10 14:22:58 2013 -0500
Committer: Braden Shepherdson <br...@chromium.org>
Committed: Thu Jan 10 14:22:58 2013 -0500
----------------------------------------------------------------------
CordovaLib/Classes/CDVConfigParser.h | 4 ++++
CordovaLib/Classes/CDVConfigParser.m | 12 ++++++++++++
CordovaLib/Classes/CDVViewController.m | 7 ++++---
.../project/__TESTING__/Classes/AppDelegate.m | 6 ++++--
bin/templates/project/__TESTING__/config.xml | 2 ++
5 files changed, 26 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/6749c176/CordovaLib/Classes/CDVConfigParser.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVConfigParser.h b/CordovaLib/Classes/CDVConfigParser.h
index 23cdd01..6b48aa0 100644
--- a/CordovaLib/Classes/CDVConfigParser.h
+++ b/CordovaLib/Classes/CDVConfigParser.h
@@ -18,10 +18,14 @@
*/
@interface CDVConfigParser : NSObject <NSXMLParserDelegate> {
+ @private
+ NSString* startPage;
}
@property (nonatomic, readonly, strong) NSMutableDictionary* pluginsDict;
@property (nonatomic, readonly, strong) NSMutableDictionary* settings;
@property (nonatomic, readonly, strong) NSMutableArray* whitelistHosts;
+- (NSString*)getStartPage;
+
@end
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/6749c176/CordovaLib/Classes/CDVConfigParser.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVConfigParser.m b/CordovaLib/Classes/CDVConfigParser.m
index b596c9d..2961df4 100644
--- a/CordovaLib/Classes/CDVConfigParser.m
+++ b/CordovaLib/Classes/CDVConfigParser.m
@@ -24,6 +24,7 @@
@property (nonatomic, readwrite, strong) NSMutableDictionary* pluginsDict;
@property (nonatomic, readwrite, strong) NSMutableDictionary* settings;
@property (nonatomic, readwrite, strong) NSMutableArray* whitelistHosts;
+@property (nonatomic, readwrite, strong) NSString* startPage;
@end
@@ -50,6 +51,8 @@
[pluginsDict setObject:[attributeDict objectForKey:@"value"] forKey:[attributeDict objectForKey:@"name"]];
} else if ([elementName isEqualToString:@"access"]) {
[whitelistHosts addObject:[attributeDict objectForKey:@"origin"]];
+ } else if ([elementName isEqualToString:@"content"]) {
+ self.startPage = [attributeDict objectForKey:@"src"];
}
}
@@ -58,4 +61,13 @@
NSAssert(NO, @"config.xml parse error line %d col %d", [parser lineNumber], [parser columnNumber]);
}
+- (NSString*) getStartPage
+{
+ if (self.startPage != nil) {
+ return self.startPage;
+ } else {
+ return @"index.html";
+ }
+}
+
@end
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/6749c176/CordovaLib/Classes/CDVViewController.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVViewController.m b/CordovaLib/Classes/CDVViewController.m
index 7491111..6e48102 100644
--- a/CordovaLib/Classes/CDVViewController.m
+++ b/CordovaLib/Classes/CDVViewController.m
@@ -81,9 +81,6 @@ static NSString* gOriginalUserAgent = nil;
self.supportedOrientations = [self parseInterfaceOrientations:
[[[NSBundle mainBundle] infoDictionary] objectForKey:@"UISupportedInterfaceOrientations"]];
- self.wwwFolderName = @"www";
- self.startPage = @"index.html";
-
[self printMultitaskingInfo];
[self printDeprecationNotice];
self.initialized = YES;
@@ -169,6 +166,10 @@ static NSString* gOriginalUserAgent = nil;
self.whitelist = [[CDVWhitelist alloc] initWithArray:delegate.whitelistHosts];
self.settings = delegate.settings;
+ // And the start folder/page.
+ self.wwwFolderName = @"www";
+ self.startPage = [delegate getStartPage];
+
// Initialize the plugin objects dict.
self.pluginObjects = [[NSMutableDictionary alloc] initWithCapacity:4];
}
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/6749c176/bin/templates/project/__TESTING__/Classes/AppDelegate.m
----------------------------------------------------------------------
diff --git a/bin/templates/project/__TESTING__/Classes/AppDelegate.m b/bin/templates/project/__TESTING__/Classes/AppDelegate.m
index 1ca3daf..6dc7bfc 100644
--- a/bin/templates/project/__TESTING__/Classes/AppDelegate.m
+++ b/bin/templates/project/__TESTING__/Classes/AppDelegate.m
@@ -61,8 +61,10 @@
self.viewController = [[[MainViewController alloc] init] autorelease];
self.viewController.useSplashScreen = YES;
- self.viewController.wwwFolderName = @"www";
- self.viewController.startPage = @"index.html";
+
+ // Set your app's start page by setting the <content src='foo.html' /> tag in config.xml.
+ // If necessary, uncomment the line below to override it.
+ // self.viewController.startPage = @"index.html";
// NOTE: To customize the view's frame size (which defaults to full screen), override
// [self.viewController viewWillAppear:] in your view controller.
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/6749c176/bin/templates/project/__TESTING__/config.xml
----------------------------------------------------------------------
diff --git a/bin/templates/project/__TESTING__/config.xml b/bin/templates/project/__TESTING__/config.xml
index 337d38d..7d67508 100644
--- a/bin/templates/project/__TESTING__/config.xml
+++ b/bin/templates/project/__TESTING__/config.xml
@@ -33,6 +33,8 @@
<preference name="OpenAllWhitelistURLsInWebView" value="false" />
<preference name="BackupWebStorage" value="cloud" />
+ <content src="index.html" />
+
<plugins>
<plugin name="Device" value="CDVDevice" />
<plugin name="Logger" value="CDVLogger" />