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 2012/03/12 19:51:04 UTC
[1/2] ios commit: Fixed CB-306 - Remove extra template App delegate
methods
Updated Branches:
refs/heads/master c858e4944 -> 445ba37a3
Fixed CB-306 - Remove extra template App delegate methods
Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/commit/445ba37a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/tree/445ba37a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/diff/445ba37a
Branch: refs/heads/master
Commit: 445ba37a38b4ad3fe5bcb7474a682103fd1a6fd6
Parents: e4f4833
Author: Shazron Abdullah <sh...@apache.org>
Authored: Mon Mar 12 11:50:53 2012 -0700
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Mon Mar 12 11:50:53 2012 -0700
----------------------------------------------------------------------
Cordova-based Application/Classes/AppDelegate.h | 2 +-
Cordova-based Application/Classes/AppDelegate.m | 54 --------------
.../Classes/MainViewController.m | 55 +++++++++++++--
3 files changed, 51 insertions(+), 60 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/445ba37a/Cordova-based Application/Classes/AppDelegate.h
----------------------------------------------------------------------
diff --git a/Cordova-based Application/Classes/AppDelegate.h b/Cordova-based Application/Classes/AppDelegate.h
index 5530ba6..1051b49 100644
--- a/Cordova-based Application/Classes/AppDelegate.h
+++ b/Cordova-based Application/Classes/AppDelegate.h
@@ -34,7 +34,7 @@
#endif
-@interface AppDelegate : NSObject < UIApplicationDelegate, UIWebViewDelegate, CDVCommandDelegate > {
+@interface AppDelegate : NSObject < UIApplicationDelegate > {
NSString* invokeString;
}
http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/445ba37a/Cordova-based Application/Classes/AppDelegate.m
----------------------------------------------------------------------
diff --git a/Cordova-based Application/Classes/AppDelegate.m b/Cordova-based Application/Classes/AppDelegate.m
index 87062da..516f440 100644
--- a/Cordova-based Application/Classes/AppDelegate.m
+++ b/Cordova-based Application/Classes/AppDelegate.m
@@ -79,10 +79,6 @@
self.viewController.startPage = @"index.html";
self.viewController.view.frame = viewBounds;
- // over-ride delegates
- self.viewController.webView.delegate = self;
- self.viewController.commandDelegate = self;
-
// check whether the current orientation is supported: if it is, keep it, rather than forcing a rotation
BOOL forceStartupRotation = YES;
UIDeviceOrientation curDevOrientation = [[UIDevice currentDevice] orientation];
@@ -133,56 +129,6 @@
return YES;
}
-#pragma PGCommandDelegate implementation
-
-- (id) getCommandInstance:(NSString*)className
-{
- return [self.viewController getCommandInstance:className];
-}
-
-- (BOOL) execute:(CDVInvokedUrlCommand*)command
-{
- return [self.viewController execute:command];
-}
-
-- (NSString*) pathForResource:(NSString*)resourcepath;
-{
- return [self.viewController pathForResource:resourcepath];
-}
-
-#pragma UIWebDelegate implementation
-
-- (void) webViewDidFinishLoad:(UIWebView*) theWebView
-{
- // only valid if FooBar.plist specifies a protocol to handle
- if (self.invokeString)
- {
- // this is passed before the deviceready event is fired, so you can access it in js when you receive deviceready
- NSString* jsString = [NSString stringWithFormat:@"var invokeString = \"%@\";", self.invokeString];
- [theWebView stringByEvaluatingJavaScriptFromString:jsString];
- }
-
- // Black base color for background matches the native apps
- theWebView.backgroundColor = [UIColor blackColor];
-
- return [self.viewController webViewDidFinishLoad:theWebView];
-}
-
-- (void) webViewDidStartLoad:(UIWebView*)theWebView
-{
- return [self.viewController webViewDidStartLoad:theWebView];
-}
-
-- (void) webView:(UIWebView*)theWebView didFailLoadWithError:(NSError*)error
-{
- return [self.viewController webView:theWebView didFailLoadWithError:error];
-}
-
-- (BOOL) webView:(UIWebView*)theWebView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType
-{
- return [self.viewController webView:theWebView shouldStartLoadWithRequest:request navigationType:navigationType];
-}
-
- (void) dealloc
{
[super dealloc];
http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/445ba37a/Cordova-based Application/Classes/MainViewController.m
----------------------------------------------------------------------
diff --git a/Cordova-based Application/Classes/MainViewController.m b/Cordova-based Application/Classes/MainViewController.m
index 2750ae9..4aa49ad 100644
--- a/Cordova-based Application/Classes/MainViewController.m
+++ b/Cordova-based Application/Classes/MainViewController.m
@@ -29,7 +29,7 @@
@implementation MainViewController
-- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
+- (id) initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
@@ -38,7 +38,7 @@
return self;
}
-- (void)didReceiveMemoryWarning
+- (void) didReceiveMemoryWarning
{
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
@@ -48,23 +48,68 @@
#pragma mark - View lifecycle
-- (void)viewDidLoad
+- (void) viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
}
-- (void)viewDidUnload
+- (void) viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
-- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
+- (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return [super shouldAutorotateToInterfaceOrientation:interfaceOrientation];
}
+/* Comment out the block below to over-ride */
+/*
+#pragma CDVCommandDelegate implementation
+
+- (id) getCommandInstance:(NSString*)className
+{
+ return [super getCommandInstance:className];
+}
+
+- (BOOL) execute:(CDVInvokedUrlCommand*)command
+{
+ return [super execute:command];
+}
+
+- (NSString*) pathForResource:(NSString*)resourcepath;
+{
+ return [super pathForResource:resourcepath];
+}
+*/
+
+/* Comment out the block below to over-ride */
+/*
+#pragma UIWebDelegate implementation
+
+- (void) webViewDidFinishLoad:(UIWebView*) theWebView
+{
+ return [super webViewDidFinishLoad:theWebView];
+}
+
+- (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