Return-Path: X-Original-To: apmail-incubator-callback-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-callback-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 9B591B558 for ; Sat, 21 Jan 2012 00:58:32 +0000 (UTC) Received: (qmail 38719 invoked by uid 500); 21 Jan 2012 00:58:32 -0000 Delivered-To: apmail-incubator-callback-commits-archive@incubator.apache.org Received: (qmail 38681 invoked by uid 500); 21 Jan 2012 00:58:32 -0000 Mailing-List: contact callback-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: callback-dev@incubator.apache.org Delivered-To: mailing list callback-commits@incubator.apache.org Received: (qmail 38674 invoked by uid 99); 21 Jan 2012 00:58:32 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 21 Jan 2012 00:58:32 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.114] (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 21 Jan 2012 00:58:30 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 08222318B51; Sat, 21 Jan 2012 00:58:10 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: shazron@apache.org To: callback-commits@incubator.apache.org X-Mailer: ASF-Git Admin Mailer Subject: git commit: Fixes for legacy support of deprecated PhoneGapDelegate - in core plugins. Message-Id: <20120121005810.08222318B51@tyr.zones.apache.org> Date: Sat, 21 Jan 2012 00:58:10 +0000 (UTC) Updated Branches: refs/heads/master 7d03c8f0e -> 0b70b14a7 Fixes for legacy support of deprecated PhoneGapDelegate - in core plugins. 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/0b70b14a Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/tree/0b70b14a Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/diff/0b70b14a Branch: refs/heads/master Commit: 0b70b14a7c4f41db999415586ee1aaebe999a956 Parents: 7d03c8f Author: Shazron Abdullah Authored: Fri Jan 20 16:57:59 2012 -0800 Committer: Shazron Abdullah Committed: Fri Jan 20 16:57:59 2012 -0800 ---------------------------------------------------------------------- PhoneGapLib/Classes/Capture.m | 6 +-- PhoneGapLib/Classes/PGCommandDelegate.h | 28 ++++++++++++++++ PhoneGapLib/Classes/PGPlugin.h | 2 + PhoneGapLib/Classes/PGPlugin.m | 2 +- PhoneGapLib/Classes/PGSplashScreen.m | 18 ++++++---- PhoneGapLib/Classes/PGViewController.h | 18 +--------- PhoneGapLib/Classes/PGViewController.m | 4 ++ PhoneGapLib/Classes/PhoneGapDelegate.h | 6 +-- PhoneGapLib/Classes/PhoneGapDelegate.m | 4 ++ PhoneGapLib/Classes/Sound.m | 2 +- PhoneGapLib/PhoneGapLib.xcodeproj/project.pbxproj | 6 +++ 11 files changed, 63 insertions(+), 33 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/0b70b14a/PhoneGapLib/Classes/Capture.m ---------------------------------------------------------------------- diff --git a/PhoneGapLib/Classes/Capture.m b/PhoneGapLib/Classes/Capture.m index 2cbd68e..4f9d1e2 100644 --- a/PhoneGapLib/Classes/Capture.m +++ b/PhoneGapLib/Classes/Capture.m @@ -362,8 +362,7 @@ if (!mimeType){ // try to determine mime type if not provided - PGViewController* vc = (PGViewController*)self.viewController; - id command = [vc getCommandInstance: @"com.phonegap.file"]; + id command = [self.commandDelegate getCommandInstance: @"com.phonegap.file"]; bError = !([command isKindOfClass:[PGFile class]]); if (!bError) { PGFile* pgFile = (PGFile*)command; @@ -450,8 +449,7 @@ [fileDict setObject: fullPath forKey:@"fullPath"]; // determine type if(!type) { - PGViewController* vc = (PGViewController*)self.viewController; - id command = [vc getCommandInstance: @"com.phonegap.file"]; + id command = [self.commandDelegate getCommandInstance: @"com.phonegap.file"]; if([command isKindOfClass:[PGFile class]]) { PGFile* pgFile = (PGFile*)command; NSString* mimeType = [pgFile getMimeTypeFromPath:fullPath]; http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/0b70b14a/PhoneGapLib/Classes/PGCommandDelegate.h ---------------------------------------------------------------------- diff --git a/PhoneGapLib/Classes/PGCommandDelegate.h b/PhoneGapLib/Classes/PGCommandDelegate.h new file mode 100644 index 0000000..6d1f4e4 --- /dev/null +++ b/PhoneGapLib/Classes/PGCommandDelegate.h @@ -0,0 +1,28 @@ +/* + 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 "InvokedUrlCommand.h" + +@protocol PGCommandDelegate + +- (NSString*) pathForResource:(NSString*)resourcepath; +- (id) getCommandInstance:(NSString*)pluginName; +- (BOOL) execute:(InvokedUrlCommand*)command; + +@end http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/0b70b14a/PhoneGapLib/Classes/PGPlugin.h ---------------------------------------------------------------------- diff --git a/PhoneGapLib/Classes/PGPlugin.h b/PhoneGapLib/Classes/PGPlugin.h index 3964170..652e03e 100644 --- a/PhoneGapLib/Classes/PGPlugin.h +++ b/PhoneGapLib/Classes/PGPlugin.h @@ -21,6 +21,7 @@ #import #import "PluginResult.h" #import "NSMutableArray+QueueAdditions.h" +#import "PGCommandDelegate.h" #define PGPluginHandleOpenURLNotification @"PGPluginHandleOpenURLNotification" @@ -34,6 +35,7 @@ callerFileName:__FILE__ callerFunctionName:__PRETTY_FUNCTION__]) { return; } @property (nonatomic, retain) UIWebView* webView; @property (nonatomic, retain) NSDictionary* settings; @property (nonatomic, retain) UIViewController* viewController; +@property (nonatomic, retain) id commandDelegate; - (PGPlugin*) initWithWebView:(UIWebView*)theWebView settings:(NSDictionary*)classSettings; - (PGPlugin*) initWithWebView:(UIWebView*)theWebView; http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/0b70b14a/PhoneGapLib/Classes/PGPlugin.m ---------------------------------------------------------------------- diff --git a/PhoneGapLib/Classes/PGPlugin.m b/PhoneGapLib/Classes/PGPlugin.m index e8c539b..65fec10 100644 --- a/PhoneGapLib/Classes/PGPlugin.m +++ b/PhoneGapLib/Classes/PGPlugin.m @@ -23,7 +23,7 @@ @implementation PGPlugin -@synthesize webView, settings, viewController; +@synthesize webView, settings, viewController, commandDelegate; - (PGPlugin*) initWithWebView:(UIWebView*)theWebView settings:(NSDictionary*)classSettings http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/0b70b14a/PhoneGapLib/Classes/PGSplashScreen.m ---------------------------------------------------------------------- diff --git a/PhoneGapLib/Classes/PGSplashScreen.m b/PhoneGapLib/Classes/PGSplashScreen.m index 939ea0d..c4097c6 100644 --- a/PhoneGapLib/Classes/PGSplashScreen.m +++ b/PhoneGapLib/Classes/PGSplashScreen.m @@ -21,19 +21,23 @@ #import "PGSplashScreen.h" #import "PGAppDelegate.h" #import "PGViewController.h" +#import "PhoneGapDelegate.h" @implementation PGSplashScreen - (void) __show:(BOOL)show { - PGViewController* vc = (PGViewController*)self.viewController; - if (vc.imageView) { - return; - } - - vc.imageView.hidden = !show; - vc.activityView.hidden = !show; + // Legacy support - once deprecated classes removed, clean this up + id delg = [self appDelegate]; + + if ([delg isKindOfClass:[PGAppDelegate class]]) { + ((PGAppDelegate*)delg).viewController.imageView.hidden = !show; + ((PGAppDelegate*)delg).viewController.activityView.hidden = !show; + } if ([delg isKindOfClass:[PhoneGapDelegate class]]) { + ((PhoneGapDelegate*)delg).imageView.hidden = !show; + ((PhoneGapDelegate*)delg).activityView.hidden = !show; + } } - (void) show:(NSArray*)arguments withDict:(NSMutableDictionary*)options http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/0b70b14a/PhoneGapLib/Classes/PGViewController.h ---------------------------------------------------------------------- diff --git a/PhoneGapLib/Classes/PGViewController.h b/PhoneGapLib/Classes/PGViewController.h index 198c519..4ad1eed 100644 --- a/PhoneGapLib/Classes/PGViewController.h +++ b/PhoneGapLib/Classes/PGViewController.h @@ -21,21 +21,10 @@ #import "JSONKit.h" #import "InvokedUrlCommand.h" - +#import "PGCommandDelegate.h" #import "PGWhitelist.h" -/* PGCommandDelegate */ - -@protocol PGCommandDelegate - -- (id) getCommandInstance:(NSString*)pluginName; -- (BOOL) execute:(InvokedUrlCommand*)command; - -@end - -/* PGViewController */ - @interface PGViewController : UIViewController { } @@ -53,7 +42,7 @@ @property (nonatomic, readwrite, assign) BOOL useSplashScreen; @property (nonatomic, readonly, retain) IBOutlet UIActivityIndicatorView* activityView; @property (nonatomic, readonly, retain) UIImageView *imageView; -@property (nonatomic, readwrite, assign) id commandDelegate; +@property (nonatomic, readwrite, retain) id commandDelegate; @property (nonatomic, readwrite, copy) NSString* wwwFolderName; @property (nonatomic, readwrite, copy) NSString* startPage; @@ -67,10 +56,7 @@ - (int) executeQueuedCommands; - (void) flushCommandQueue; -- (NSString*) pathForResource:(NSString*)resourcepath; -- (id) getCommandInstance:(NSString*)pluginName; - (void) javascriptAlert:(NSString*)text; -- (BOOL) execute:(InvokedUrlCommand*)command; - (NSString*) appURLScheme; - (NSDictionary*) deviceProperties; http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/0b70b14a/PhoneGapLib/Classes/PGViewController.m ---------------------------------------------------------------------- diff --git a/PhoneGapLib/Classes/PGViewController.m b/PhoneGapLib/Classes/PGViewController.m index 44abb89..b07ed4f 100644 --- a/PhoneGapLib/Classes/PGViewController.m +++ b/PhoneGapLib/Classes/PGViewController.m @@ -713,6 +713,10 @@ BOOL gSplashScreenShown = NO; [obj setViewController:self]; } + if ([obj isKindOfClass:[PGPlugin class]] && [obj respondsToSelector:@selector(setCommandDelegate:)]) { + [obj setCommandDelegate:self.commandDelegate]; + } + if (obj != nil) { [self.pluginObjects setObject:obj forKey:className]; [obj release]; http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/0b70b14a/PhoneGapLib/Classes/PhoneGapDelegate.h ---------------------------------------------------------------------- diff --git a/PhoneGapLib/Classes/PhoneGapDelegate.h b/PhoneGapLib/Classes/PhoneGapDelegate.h index d1f491c..0476a25 100755 --- a/PhoneGapLib/Classes/PhoneGapDelegate.h +++ b/PhoneGapLib/Classes/PhoneGapDelegate.h @@ -19,6 +19,7 @@ #import #import "JSONKit.h" +#import "PGCommandDelegate.h" @class InvokedUrlCommand; @class PhoneGapViewController; @@ -27,7 +28,7 @@ @class Console; @class PGWhitelist; -__attribute__((deprecated)) @interface PhoneGapDelegate : NSObject +__attribute__((deprecated)) @interface PhoneGapDelegate : NSObject { } @@ -43,7 +44,6 @@ __attribute__((deprecated)) @interface PhoneGapDelegate : NSObject