Return-Path: X-Original-To: apmail-cordova-commits-archive@www.apache.org Delivered-To: apmail-cordova-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4EC36EA5E for ; Wed, 20 Feb 2013 19:15:40 +0000 (UTC) Received: (qmail 5270 invoked by uid 500); 20 Feb 2013 19:15:40 -0000 Delivered-To: apmail-cordova-commits-archive@cordova.apache.org Received: (qmail 5249 invoked by uid 500); 20 Feb 2013 19:15:40 -0000 Mailing-List: contact commits-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: callback-dev@cordova.apache.org Delivered-To: mailing list commits@cordova.apache.org Received: (qmail 5241 invoked by uid 99); 20 Feb 2013 19:15:40 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 20 Feb 2013 19:15:40 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id D8ABF82D478; Wed, 20 Feb 2013 19:15:39 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: agrieve@apache.org To: commits@cordova.apache.org X-Mailer: ASF-Git Admin Mailer Subject: ios commit: [CB-1547] Scope notifications to WebViews Message-Id: <20130220191539.D8ABF82D478@tyr.zones.apache.org> Date: Wed, 20 Feb 2013 19:15:39 +0000 (UTC) Updated Branches: refs/heads/master 1bfff2d16 -> 709d60786 [CB-1547] Scope notifications to WebViews Project: http://git-wip-us.apache.org/repos/asf/cordova-ios/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-ios/commit/709d6078 Tree: http://git-wip-us.apache.org/repos/asf/cordova-ios/tree/709d6078 Diff: http://git-wip-us.apache.org/repos/asf/cordova-ios/diff/709d6078 Branch: refs/heads/master Commit: 709d6078693956e7514c8f21d8b8b77f72edcd6b Parents: 1bfff2d Author: Andrew Grieve Authored: Wed Feb 20 14:15:01 2013 -0500 Committer: Andrew Grieve Committed: Wed Feb 20 14:15:01 2013 -0500 ---------------------------------------------------------------------- CordovaLib/Classes/CDVPlugin.h | 8 ++++---- CordovaLib/Classes/CDVPlugin.m | 9 +++++++-- CordovaLib/Classes/CDVSplashScreen.m | 2 +- CordovaLib/Classes/CDVViewController.m | 11 +++-------- 4 files changed, 15 insertions(+), 15 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/709d6078/CordovaLib/Classes/CDVPlugin.h ---------------------------------------------------------------------- diff --git a/CordovaLib/Classes/CDVPlugin.h b/CordovaLib/Classes/CDVPlugin.h index f5b50eb..6e25a27 100644 --- a/CordovaLib/Classes/CDVPlugin.h +++ b/CordovaLib/Classes/CDVPlugin.h @@ -23,10 +23,10 @@ #import "NSMutableArray+QueueAdditions.h" #import "CDVCommandDelegate.h" -#define CDVPageDidLoadNotification @"CDVPageDidLoadNotification" -#define CDVPluginHandleOpenURLNotification @"CDVPluginHandleOpenURLNotification" -#define CDVPluginResetNotification @"CDVPluginResetNotification" -#define CDVLocalNotification @"CDVLocalNotification" +NSString* const CDVPageDidLoadNotification; +NSString* const CDVPluginHandleOpenURLNotification; +NSString* const CDVPluginResetNotification; +NSString* const CDVLocalNotification; @interface CDVPlugin : NSObject {} http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/709d6078/CordovaLib/Classes/CDVPlugin.m ---------------------------------------------------------------------- diff --git a/CordovaLib/Classes/CDVPlugin.m b/CordovaLib/Classes/CDVPlugin.m index a42d241..8c932a0 100644 --- a/CordovaLib/Classes/CDVPlugin.m +++ b/CordovaLib/Classes/CDVPlugin.m @@ -19,6 +19,11 @@ #import "CDVPlugin.h" +NSString* const CDVPageDidLoadNotification = @"CDVPageDidLoadNotification"; +NSString* const CDVPluginHandleOpenURLNotification = @"CDVPluginHandleOpenURLNotification"; +NSString* const CDVPluginResetNotification = @"CDVPluginResetNotification"; +NSString* const CDVLocalNotification = @"CDVLocalNotification"; + @interface CDVPlugin () @property (readwrite, assign) BOOL hasPendingOperation; @@ -41,7 +46,7 @@ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onAppTerminate) name:UIApplicationWillTerminateNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onMemoryWarning) name:UIApplicationDidReceiveMemoryWarningNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleOpenURL:) name:CDVPluginHandleOpenURLNotification object:nil]; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onReset) name:CDVPluginResetNotification object:nil]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onReset) name:CDVPluginResetNotification object:theWebView]; self.webView = theWebView; } @@ -64,7 +69,7 @@ // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didReceiveLocalNotification:) name:CDVLocalNotification object:nil]; // Added in 2.5.0 - // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pageDidLoad:) name:CDVPageDidLoadNotification object:nil]; + // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pageDidLoad:) name:CDVPageDidLoadNotification object:self.webView]; } - (void)dispose http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/709d6078/CordovaLib/Classes/CDVSplashScreen.m ---------------------------------------------------------------------- diff --git a/CordovaLib/Classes/CDVSplashScreen.m b/CordovaLib/Classes/CDVSplashScreen.m index 7561609..949444e 100644 --- a/CordovaLib/Classes/CDVSplashScreen.m +++ b/CordovaLib/Classes/CDVSplashScreen.m @@ -28,7 +28,7 @@ - (void)pluginInitialize { - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pageDidLoad) name:CDVPageDidLoadNotification object:nil]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pageDidLoad) name:CDVPageDidLoadNotification object:self.webView]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onOrientationWillChange:) name:UIApplicationWillChangeStatusBarOrientationNotification object:nil]; if (self.useSplashScreen) { http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/709d6078/CordovaLib/Classes/CDVViewController.m ---------------------------------------------------------------------- diff --git a/CordovaLib/Classes/CDVViewController.m b/CordovaLib/Classes/CDVViewController.m index d625424..9bf6990 100644 --- a/CordovaLib/Classes/CDVViewController.m +++ b/CordovaLib/Classes/CDVViewController.m @@ -540,7 +540,7 @@ [self processOpenUrl]; - [[NSNotificationCenter defaultCenter] postNotification:[NSNotification notificationWithName:CDVPageDidLoadNotification object:nil]]; + [[NSNotificationCenter defaultCenter] postNotification:[NSNotification notificationWithName:CDVPageDidLoadNotification object:self.webView]]; } - (void)webView:(UIWebView*)theWebView didFailLoadWithError:(NSError*)error @@ -823,13 +823,8 @@ - (void)dealloc { [CDVURLProtocol unregisterViewController:self]; - [[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationWillTerminateNotification object:nil]; - [[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationWillResignActiveNotification object:nil]; - [[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationWillEnterForegroundNotification object:nil]; - [[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationDidBecomeActiveNotification object:nil]; - [[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationDidEnterBackgroundNotification object:nil]; - [[NSNotificationCenter defaultCenter] removeObserver:self name:NSCurrentLocaleDidChangeNotification object:nil]; - [[NSNotificationCenter defaultCenter] removeObserver:self name:CDVPluginHandleOpenURLNotification object:nil]; + [[NSNotificationCenter defaultCenter] removeObserver:self]; + self.webView.delegate = nil; self.webView = nil; [CDVUserAgentUtil releaseLock:&_userAgentLockToken];