You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by sh...@apache.org on 2015/06/25 03:09:09 UTC
[21/50] ios commit: Moved UIWebDelegate code in CDVViewController
into the CDVUIWebViewEngine internal core plugin.
Moved UIWebDelegate code in CDVViewController into the CDVUIWebViewEngine internal core plugin.
Project: http://git-wip-us.apache.org/repos/asf/cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-ios/commit/5162e1df
Tree: http://git-wip-us.apache.org/repos/asf/cordova-ios/tree/5162e1df
Diff: http://git-wip-us.apache.org/repos/asf/cordova-ios/diff/5162e1df
Branch: refs/heads/master
Commit: 5162e1dfe82ba0ae7c6cb38a073c3c7acd8cd010
Parents: 952b569
Author: Shazron Abdullah <sh...@apache.org>
Authored: Tue Apr 21 17:37:41 2015 -0700
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Tue Apr 21 17:37:41 2015 -0700
----------------------------------------------------------------------
.../CDVUIWebViewEngine/CDVUIWebViewEngine.m | 6 +
.../CDVUIWebViewNavigationDelegate.h | 29 ++++
.../CDVUIWebViewNavigationDelegate.m | 161 +++++++++++++++++++
CordovaLib/Classes/Public/CDVViewController.h | 17 +-
CordovaLib/Classes/Public/CDVViewController.m | 143 ++--------------
CordovaLib/CordovaLib.xcodeproj/project.pbxproj | 8 +
.../Classes/MainViewController.m | 30 ----
7 files changed, 227 insertions(+), 167 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/5162e1df/CordovaLib/Classes/Private/Plugins/CDVUIWebViewEngine/CDVUIWebViewEngine.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/Private/Plugins/CDVUIWebViewEngine/CDVUIWebViewEngine.m b/CordovaLib/Classes/Private/Plugins/CDVUIWebViewEngine/CDVUIWebViewEngine.m
index 3e01b08..57df822 100644
--- a/CordovaLib/Classes/Private/Plugins/CDVUIWebViewEngine/CDVUIWebViewEngine.m
+++ b/CordovaLib/Classes/Private/Plugins/CDVUIWebViewEngine/CDVUIWebViewEngine.m
@@ -19,6 +19,7 @@
#import "CDVUIWebViewEngine.h"
#import "CDVUIWebViewDelegate.h"
+#import "CDVUIWebViewNavigationDelegate.h"
#import "NSDictionary+CordovaPreferences.h"
#import <objc/message.h>
@@ -27,6 +28,7 @@
@property (nonatomic, strong, readwrite) UIView* engineWebView;
@property (nonatomic, strong, readwrite) id <UIWebViewDelegate> uiWebViewDelegate;
+@property (nonatomic, strong, readwrite) CDVUIWebViewNavigationDelegate* navWebViewDelegate;
@end
@@ -54,6 +56,10 @@
if ([self.viewController conformsToProtocol:@protocol(UIWebViewDelegate)]) {
self.uiWebViewDelegate = [[CDVUIWebViewDelegate alloc] initWithDelegate:(id <UIWebViewDelegate>)self.viewController];
uiWebView.delegate = self.uiWebViewDelegate;
+ } else {
+ self.navWebViewDelegate = [[CDVUIWebViewNavigationDelegate alloc] initWithEnginePlugin:self];
+ self.uiWebViewDelegate = [[CDVUIWebViewDelegate alloc] initWithDelegate:self.navWebViewDelegate];
+ uiWebView.delegate = self.uiWebViewDelegate;
}
[self updateSettings:self.commandDelegate.settings];
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/5162e1df/CordovaLib/Classes/Private/Plugins/CDVUIWebViewEngine/CDVUIWebViewNavigationDelegate.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/Private/Plugins/CDVUIWebViewEngine/CDVUIWebViewNavigationDelegate.h b/CordovaLib/Classes/Private/Plugins/CDVUIWebViewEngine/CDVUIWebViewNavigationDelegate.h
new file mode 100644
index 0000000..9138deb
--- /dev/null
+++ b/CordovaLib/Classes/Private/Plugins/CDVUIWebViewEngine/CDVUIWebViewNavigationDelegate.h
@@ -0,0 +1,29 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ */
+
+#import <UIKit/UIKit.h>
+#import "CDVUIWebViewEngine.h"
+
+@interface CDVUIWebViewNavigationDelegate : NSObject <UIWebViewDelegate>
+
+@property (nonatomic, weak) CDVPlugin* enginePlugin;
+
+- (instancetype)initWithEnginePlugin:(CDVPlugin*)enginePlugin;
+
+@end
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/5162e1df/CordovaLib/Classes/Private/Plugins/CDVUIWebViewEngine/CDVUIWebViewNavigationDelegate.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/Private/Plugins/CDVUIWebViewEngine/CDVUIWebViewNavigationDelegate.m b/CordovaLib/Classes/Private/Plugins/CDVUIWebViewEngine/CDVUIWebViewNavigationDelegate.m
new file mode 100644
index 0000000..b660638
--- /dev/null
+++ b/CordovaLib/Classes/Private/Plugins/CDVUIWebViewEngine/CDVUIWebViewNavigationDelegate.m
@@ -0,0 +1,161 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ */
+
+#import "CDVUIWebViewNavigationDelegate.h"
+#import <Cordova/CDVViewController.h>
+#import <Cordova/CDVCommandDelegateImpl.h>
+#import <Cordova/CDVUserAgentUtil.h>
+#import <objc/message.h>
+
+@implementation CDVUIWebViewNavigationDelegate
+
+- (instancetype)initWithEnginePlugin:(CDVPlugin*)theEnginePlugin
+{
+ self = [super init];
+ if (self) {
+ self.enginePlugin = theEnginePlugin;
+ }
+
+ return self;
+}
+
+/**
+ When web application loads Add stuff to the DOM, mainly the user-defined settings from the Settings.plist file, and
+ the device's data such as device ID, platform version, etc.
+ */
+- (void)webViewDidStartLoad:(UIWebView*)theWebView
+{
+ NSLog(@"Resetting plugins due to page load.");
+ CDVViewController* vc = (CDVViewController*)self.enginePlugin.viewController;
+
+ [vc.commandQueue resetRequestId];
+ [[NSNotificationCenter defaultCenter] postNotification:[NSNotification notificationWithName:CDVPluginResetNotification object:self.enginePlugin.webView]];
+}
+
+/**
+ Called when the webview finishes loading. This stops the activity view.
+ */
+- (void)webViewDidFinishLoad:(UIWebView*)theWebView
+{
+ NSLog(@"Finished load of: %@", theWebView.request.URL);
+ CDVViewController* vc = (CDVViewController*)self.enginePlugin.viewController;
+
+ // It's safe to release the lock even if this is just a sub-frame that's finished loading.
+ [CDVUserAgentUtil releaseLock:vc.userAgentLockToken];
+
+ /*
+ * Hide the Top Activity THROBBER in the Battery Bar
+ */
+ [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];
+
+ [[NSNotificationCenter defaultCenter] postNotification:[NSNotification notificationWithName:CDVPageDidLoadNotification object:self.enginePlugin.webView]];
+}
+
+- (void)webView:(UIWebView*)theWebView didFailLoadWithError:(NSError*)error
+{
+ CDVViewController* vc = (CDVViewController*)self.enginePlugin.viewController;
+
+ [CDVUserAgentUtil releaseLock:vc.userAgentLockToken];
+
+ NSString* message = [NSString stringWithFormat:@"Failed to load webpage with error: %@", [error localizedDescription]];
+ NSLog(@"%@", message);
+
+ NSURL* errorUrl = vc.errorURL;
+ if (errorUrl) {
+ errorUrl = [NSURL URLWithString:[NSString stringWithFormat:@"?error=%@", [message stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]] relativeToURL:errorUrl];
+ NSLog(@"%@", [errorUrl absoluteString]);
+ [theWebView loadRequest:[NSURLRequest requestWithURL:errorUrl]];
+ }
+}
+
+- (BOOL)webView:(UIWebView*)theWebView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType
+{
+ NSURL* url = [request URL];
+ CDVViewController* vc = (CDVViewController*)self.enginePlugin.viewController;
+
+ /*
+ * Execute any commands queued with cordova.exec() on the JS side.
+ * The part of the URL after gap:// is irrelevant.
+ */
+ if ([[url scheme] isEqualToString:@"gap"]) {
+ [vc.commandQueue fetchCommandsFromJs];
+ // The delegate is called asynchronously in this case, so we don't have to use
+ // flushCommandQueueWithDelayedJs (setTimeout(0)) as we do with hash changes.
+ [vc.commandQueue executePending];
+ return NO;
+ }
+
+ if ([[url fragment] hasPrefix:@"%01"] || [[url fragment] hasPrefix:@"%02"]) {
+ // Delegate is called *immediately* for hash changes. This means that any
+ // calls to stringByEvaluatingJavascriptFromString will occur in the middle
+ // of an existing (paused) call stack. This doesn't cause errors, but may
+ // be unexpected to callers (exec callbacks will be called before exec() even
+ // returns). To avoid this, we do not do any synchronous JS evals by using
+ // flushCommandQueueWithDelayedJs.
+ NSString* inlineCommands = [[url fragment] substringFromIndex:3];
+ if ([inlineCommands length] == 0) {
+ // Reach in right away since the WebCore / Main thread are already synchronized.
+ [vc.commandQueue fetchCommandsFromJs];
+ } else {
+ inlineCommands = [inlineCommands stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
+ [vc.commandQueue enqueueCommandBatch:inlineCommands];
+ }
+ // Switch these for minor performance improvements, and to really live on the wild side.
+ // Callbacks will occur in the middle of the location.hash = ... statement!
+ [(CDVCommandDelegateImpl*)self.enginePlugin.commandDelegate flushCommandQueueWithDelayedJs];
+ // [_commandQueue executePending];
+
+ // Although we return NO, the hash change does end up taking effect.
+ return NO;
+ }
+
+ /*
+ * Give plugins the chance to handle the url
+ */
+ for (NSString* pluginName in vc.pluginObjects) {
+ CDVPlugin* plugin = [vc.pluginObjects objectForKey:pluginName];
+ SEL selector = NSSelectorFromString(@"shouldOverrideLoadWithRequest:navigationType:");
+ if ([plugin respondsToSelector:selector]) {
+ if (((BOOL (*)(id, SEL, id, int))objc_msgSend)(plugin, selector, request, navigationType)) {
+ return NO;
+ }
+ }
+ }
+
+ /*
+ * Handle all other types of urls (tel:, sms:), and requests to load a url in the main webview.
+ */
+ BOOL shouldAllowNavigation = [vc shouldAllowNavigationToURL:url];
+ if (shouldAllowNavigation) {
+ return YES;
+ } else {
+ BOOL shouldOpenExternalURL = [vc shouldOpenExternalURL:url];
+ if (shouldOpenExternalURL) {
+ if ([[UIApplication sharedApplication] canOpenURL:url]) {
+ [[UIApplication sharedApplication] openURL:url];
+ } else { // handle any custom schemes to plugins
+ [[NSNotificationCenter defaultCenter] postNotification:[NSNotification notificationWithName:CDVPluginHandleOpenURLNotification object:url]];
+ }
+ }
+ }
+
+ return NO;
+}
+
+@end
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/5162e1df/CordovaLib/Classes/Public/CDVViewController.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/Public/CDVViewController.h b/CordovaLib/Classes/Public/CDVViewController.h
index 8492a6b..6d3262b 100644
--- a/CordovaLib/Classes/Public/CDVViewController.h
+++ b/CordovaLib/Classes/Public/CDVViewController.h
@@ -27,7 +27,7 @@
#import "CDVPlugin.h"
#import "CDVWebViewEngineProtocol.h"
-@interface CDVViewController : UIViewController <UIWebViewDelegate, CDVScreenOrientationDelegate>{
+@interface CDVViewController : UIViewController <CDVScreenOrientationDelegate>{
@protected
id <CDVWebViewEngineProtocol> _webViewEngine;
@protected
@@ -63,11 +63,17 @@
*/
@property (nonatomic, readwrite, copy) NSString* baseUserAgent;
+/**
+ The address of the lock token used for controlling access to setting the user-agent
+ */
+@property (nonatomic, readonly) NSInteger* userAgentLockToken;
+
- (void)printMultitaskingInfo;
- (void)createGapView;
- (UIView*)newCordovaViewWithFrame:(CGRect)bounds;
- (NSString*)appURLScheme;
+- (NSURL*)errorURL;
- (NSArray*)parseInterfaceOrientations:(NSArray*)orientations;
- (BOOL)supportsOrientation:(UIInterfaceOrientation)orientation;
@@ -77,10 +83,11 @@
- (void)registerPlugin:(CDVPlugin*)plugin withPluginName:(NSString*)pluginName;
- (BOOL)URLisAllowed:(NSURL*)url __attribute__((deprecated("Scheduled for removal in 5.0. Use shouldAllowRequestForURL, shouldAllowNavigationToURL or shouldOpenExternalURL instead.")));
-- (BOOL)shouldAllowRequestForURL:(NSURL *)url;
-- (BOOL)shouldAllowNavigationToURL:(NSURL *)url;
-- (BOOL)shouldOpenExternalURL:(NSURL *)url;
-- (void)parseSettingsWithParser:(NSObject<NSXMLParserDelegate> *)delegate;
+- (BOOL)shouldAllowRequestForURL:(NSURL*)url;
+- (BOOL)shouldAllowNavigationToURL:(NSURL*)url;
+- (BOOL)shouldOpenExternalURL:(NSURL*)url;
+
+- (void)parseSettingsWithParser:(NSObject <NSXMLParserDelegate>*)delegate;
@end
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/5162e1df/CordovaLib/Classes/Public/CDVViewController.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/Public/CDVViewController.m b/CordovaLib/Classes/Public/CDVViewController.m
index f323710..1027c78 100644
--- a/CordovaLib/Classes/Public/CDVViewController.m
+++ b/CordovaLib/Classes/Public/CDVViewController.m
@@ -220,26 +220,26 @@
return appURL;
}
-- (NSURL*)errorUrl
+- (NSURL*)errorURL
{
- NSURL* errorURL = nil;
+ NSURL* errorUrl = nil;
id setting = [self.settings cordovaSettingForKey:@"ErrorUrl"];
if (setting) {
NSString* errorUrlString = (NSString*)setting;
if ([errorUrlString rangeOfString:@"://"].location != NSNotFound) {
- errorURL = [NSURL URLWithString:errorUrlString];
+ errorUrl = [NSURL URLWithString:errorUrlString];
} else {
NSURL* url = [NSURL URLWithString:(NSString*)setting];
NSString* errorFilePath = [self.commandDelegate pathForResource:[url path]];
if (errorFilePath) {
- errorURL = [NSURL fileURLWithPath:errorFilePath];
+ errorUrl = [NSURL fileURLWithPath:errorFilePath];
}
}
}
- return errorURL;
+ return errorUrl;
}
- (UIView*)webView
@@ -311,7 +311,7 @@
NSString* loadErr = [NSString stringWithFormat:@"ERROR: Start Page at '%@/%@' was not found.", self.wwwFolderName, self.startPage];
NSLog(@"%@", loadErr);
- NSURL* errorUrl = [self errorUrl];
+ NSURL* errorUrl = [self errorURL];
if (errorUrl) {
errorUrl = [NSURL URLWithString:[NSString stringWithFormat:@"?error=%@", [loadErr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]] relativeToURL:errorUrl];
NSLog(@"%@", [errorUrl absoluteString]);
@@ -473,132 +473,6 @@
[super viewDidUnload];
}
-#pragma mark UIWebViewDelegate
-
-/**
- When web application loads Add stuff to the DOM, mainly the user-defined settings from the Settings.plist file, and
- the device's data such as device ID, platform version, etc.
- */
-- (void)webViewDidStartLoad:(UIWebView*)theWebView
-{
- NSLog(@"Resetting plugins due to page load.");
- [_commandQueue resetRequestId];
- [[NSNotificationCenter defaultCenter] postNotification:[NSNotification notificationWithName:CDVPluginResetNotification object:self.webView]];
-}
-
-/**
- Called when the webview finishes loading. This stops the activity view.
- */
-- (void)webViewDidFinishLoad:(UIWebView*)theWebView
-{
- NSLog(@"Finished load of: %@", theWebView.request.URL);
- // It's safe to release the lock even if this is just a sub-frame that's finished loading.
- [CDVUserAgentUtil releaseLock:&_userAgentLockToken];
-
- /*
- * Hide the Top Activity THROBBER in the Battery Bar
- */
- [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];
-
- [[NSNotificationCenter defaultCenter] postNotification:[NSNotification notificationWithName:CDVPageDidLoadNotification object:self.webView]];
-}
-
-- (void)webView:(UIWebView*)theWebView didFailLoadWithError:(NSError*)error
-{
- [CDVUserAgentUtil releaseLock:&_userAgentLockToken];
-
- NSString* message = [NSString stringWithFormat:@"Failed to load webpage with error: %@", [error localizedDescription]];
- NSLog(@"%@", message);
-
- NSURL* errorUrl = [self errorUrl];
- if (errorUrl) {
- errorUrl = [NSURL URLWithString:[NSString stringWithFormat:@"?error=%@", [message stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]] relativeToURL:errorUrl];
- NSLog(@"%@", [errorUrl absoluteString]);
- [theWebView loadRequest:[NSURLRequest requestWithURL:errorUrl]];
- }
-}
-
-- (BOOL)webView:(UIWebView*)theWebView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType
-{
- NSURL* url = [request URL];
-
- /*
- * Execute any commands queued with cordova.exec() on the JS side.
- * The part of the URL after gap:// is irrelevant.
- */
- if ([[url scheme] isEqualToString:@"gap"]) {
- [_commandQueue fetchCommandsFromJs];
- // The delegate is called asynchronously in this case, so we don't have to use
- // flushCommandQueueWithDelayedJs (setTimeout(0)) as we do with hash changes.
- [_commandQueue executePending];
- return NO;
- }
-
- if ([[url fragment] hasPrefix:@"%01"] || [[url fragment] hasPrefix:@"%02"]) {
- // Delegate is called *immediately* for hash changes. This means that any
- // calls to stringByEvaluatingJavascriptFromString will occur in the middle
- // of an existing (paused) call stack. This doesn't cause errors, but may
- // be unexpected to callers (exec callbacks will be called before exec() even
- // returns). To avoid this, we do not do any synchronous JS evals by using
- // flushCommandQueueWithDelayedJs.
- NSString* inlineCommands = [[url fragment] substringFromIndex:3];
- if ([inlineCommands length] == 0) {
- // Reach in right away since the WebCore / Main thread are already synchronized.
- [_commandQueue fetchCommandsFromJs];
- } else {
- inlineCommands = [inlineCommands stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
- [_commandQueue enqueueCommandBatch:inlineCommands];
- }
- // Switch these for minor performance improvements, and to really live on the wild side.
- // Callbacks will occur in the middle of the location.hash = ... statement!
- [(CDVCommandDelegateImpl*)_commandDelegate flushCommandQueueWithDelayedJs];
- // [_commandQueue executePending];
-
- // Although we return NO, the hash change does end up taking effect.
- return NO;
- }
-
- /*
- * Give plugins the chance to handle the url
- */
- for (NSString* pluginName in pluginObjects) {
- CDVPlugin* plugin = [pluginObjects objectForKey:pluginName];
- SEL selector = NSSelectorFromString(@"shouldOverrideLoadWithRequest:navigationType:");
- if ([plugin respondsToSelector:selector]) {
- if (((BOOL (*)(id, SEL, id, int))objc_msgSend)(plugin, selector, request, navigationType)) {
- return NO;
- }
- }
- }
-
- /*
- * If we loaded the HTML from a string, we let the app handle it
- */
- if (self.loadFromString) {
- self.loadFromString = NO;
- return YES;
- }
-
- /*
- * Handle all other types of urls (tel:, sms:), and requests to load a url in the main webview.
- */
- BOOL shouldAllowNavigation = [self shouldAllowNavigationToURL:url];
- if (shouldAllowNavigation) {
- return YES;
- } else {
- BOOL shouldOpenExternalURL = [self shouldOpenExternalURL:url];
- if (shouldOpenExternalURL) {
- if ([[UIApplication sharedApplication] canOpenURL:url]) {
- [[UIApplication sharedApplication] openURL:url];
- } else { // handle any custom schemes to plugins
- [[NSNotificationCenter defaultCenter] postNotification:[NSNotification notificationWithName:CDVPluginHandleOpenURLNotification object:url]];
- }
- }
- }
-
- return NO;
-}
-
#pragma mark Network Policy Plugin (Whitelist) hooks
/* This implements the default policy for resource loading and navigation, if there
@@ -864,4 +738,9 @@
[[self.pluginObjects allValues] makeObjectsPerformSelector:@selector(dispose)];
}
+- (NSInteger*)userAgentLockToken
+{
+ return &_userAgentLockToken;
+}
+
@end
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/5162e1df/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
----------------------------------------------------------------------
diff --git a/CordovaLib/CordovaLib.xcodeproj/project.pbxproj b/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
index 6cae2fd..63e9762 100644
--- a/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
+++ b/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
@@ -7,6 +7,8 @@
objects = {
/* Begin PBXBuildFile section */
+ 30193A501AE6350A0069A75F /* CDVUIWebViewNavigationDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 30193A4E1AE6350A0069A75F /* CDVUIWebViewNavigationDelegate.m */; };
+ 30193A511AE6350A0069A75F /* CDVUIWebViewNavigationDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 30193A4F1AE6350A0069A75F /* CDVUIWebViewNavigationDelegate.h */; };
7E7F69B61ABA35D8007546F4 /* CDVLocalStorage.h in Headers */ = {isa = PBXBuildFile; fileRef = 7ED95CFB1AB9028C008C4574 /* CDVLocalStorage.h */; };
7E7F69B81ABA368F007546F4 /* CDVUIWebViewEngine.h in Headers */ = {isa = PBXBuildFile; fileRef = 7ED95D001AB9028C008C4574 /* CDVUIWebViewEngine.h */; };
7E7F69B91ABA3692007546F4 /* CDVHandleOpenURL.h in Headers */ = {isa = PBXBuildFile; fileRef = 7ED95CF81AB9028C008C4574 /* CDVHandleOpenURL.h */; };
@@ -58,6 +60,8 @@
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
+ 30193A4E1AE6350A0069A75F /* CDVUIWebViewNavigationDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDVUIWebViewNavigationDelegate.m; sourceTree = "<group>"; };
+ 30193A4F1AE6350A0069A75F /* CDVUIWebViewNavigationDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVUIWebViewNavigationDelegate.h; sourceTree = "<group>"; };
30325A0B136B343700982B63 /* VERSION */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = VERSION; sourceTree = "<group>"; };
68A32D7114102E1C006B237C /* libCordova.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libCordova.a; sourceTree = BUILT_PRODUCTS_DIR; };
7ED95CF21AB9028C008C4574 /* CDVDebug.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVDebug.h; sourceTree = "<group>"; };
@@ -186,6 +190,8 @@
7ED95CFD1AB9028C008C4574 /* CDVUIWebViewEngine */ = {
isa = PBXGroup;
children = (
+ 30193A4E1AE6350A0069A75F /* CDVUIWebViewNavigationDelegate.m */,
+ 30193A4F1AE6350A0069A75F /* CDVUIWebViewNavigationDelegate.h */,
7ED95CFE1AB9028C008C4574 /* CDVUIWebViewDelegate.h */,
7ED95CFF1AB9028C008C4574 /* CDVUIWebViewDelegate.m */,
7ED95D001AB9028C008C4574 /* CDVUIWebViewEngine.h */,
@@ -273,6 +279,7 @@
7E7F69B61ABA35D8007546F4 /* CDVLocalStorage.h in Headers */,
7E7F69B81ABA368F007546F4 /* CDVUIWebViewEngine.h in Headers */,
7E7F69B91ABA3692007546F4 /* CDVHandleOpenURL.h in Headers */,
+ 30193A511AE6350A0069A75F /* CDVUIWebViewNavigationDelegate.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -342,6 +349,7 @@
7ED95D4F1AB9029B008C4574 /* CDVUserAgentUtil.m in Sources */,
7ED95D401AB9029B008C4574 /* CDVConfigParser.m in Sources */,
7ED95D071AB9028C008C4574 /* CDVHandleOpenURL.m in Sources */,
+ 30193A501AE6350A0069A75F /* CDVUIWebViewNavigationDelegate.m in Sources */,
7ED95D5A1AB9029B008C4574 /* NSMutableArray+QueueAdditions.m in Sources */,
7ED95D3E1AB9029B008C4574 /* CDVCommandQueue.m in Sources */,
7ED95D481AB9029B008C4574 /* CDVPluginResult.m in Sources */,
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/5162e1df/bin/templates/project/__PROJECT_NAME__/Classes/MainViewController.m
----------------------------------------------------------------------
diff --git a/bin/templates/project/__PROJECT_NAME__/Classes/MainViewController.m b/bin/templates/project/__PROJECT_NAME__/Classes/MainViewController.m
index 4a41014..212e998 100644
--- a/bin/templates/project/__PROJECT_NAME__/Classes/MainViewController.m
+++ b/bin/templates/project/__PROJECT_NAME__/Classes/MainViewController.m
@@ -99,36 +99,6 @@
}
*/
-#pragma mark UIWebDelegate implementation
-
-- (void)webViewDidFinishLoad:(UIWebView*)theWebView
-{
- // Black base color for background matches the native apps
- theWebView.backgroundColor = [UIColor blackColor];
-
- return [super webViewDidFinishLoad:theWebView];
-}
-
-/* Comment out the block below to over-ride */
-
-/*
-
-- (void) webViewDidStartLoad:(UIWebView*)theWebView
-{
- return [super webViewDidStartLoad:theWebView];
-}
-
-- (void) webView:(UIWebView*)theWebView didFailLoadWithError:(NSError*)error
-{
- return [super webView:theWebView didFailLoadWithError:error];
-}
-
-- (BOOL) webView:(UIWebView*)theWebView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType
-{
- return [super webView:theWebView shouldStartLoadWithRequest:request navigationType:navigationType];
-}
-*/
-
@end
@implementation MainCommandDelegate
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org