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/02/17 02:38:49 UTC

[23/27] Rename PhoneGap to Cordova.

http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/bcff9559/PhoneGapLib/Classes/PhoneGapViewController.m
----------------------------------------------------------------------
diff --git a/PhoneGapLib/Classes/PhoneGapViewController.m b/PhoneGapLib/Classes/PhoneGapViewController.m
deleted file mode 100755
index 8dee206..0000000
--- a/PhoneGapLib/Classes/PhoneGapViewController.m
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- 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 "PhoneGapViewController.h"
-#import "PhoneGapDelegate.h" 
-
-@implementation PhoneGapViewController
-
-@synthesize supportedOrientations, webView;
-
-- (id) init
-{
-    if (self = [super init]) {
-		// do other init here
-	}
-	
-	return self;
-}
-
-
-- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation 
-{
-	// First ask the webview via JS if it wants to support the new orientation -jm
-	int i = 0;
-	
-	switch (interfaceOrientation){
-
-		case UIInterfaceOrientationPortraitUpsideDown:
-			i = 180;
-			break;
-		case UIInterfaceOrientationLandscapeLeft:
-			i = -90;
-			break;
-		case UIInterfaceOrientationLandscapeRight:
-			i = 90;
-			break;
-		default:
-		case UIInterfaceOrientationPortrait:
-			// noop
-			break;
-	}
-	
-	NSString* jsCall = [ NSString stringWithFormat:@"shouldRotateToOrientation(%d);",i];
-	NSString* res = [webView stringByEvaluatingJavaScriptFromString:jsCall];
-	
-	if([res length] > 0)
-	{
-		return [res boolValue];
-	}
-	
-	// if js did not handle the new orientation ( no return value ) we will look it up in the plist -jm
-	
-	BOOL autoRotate = [self.supportedOrientations count] > 0; // autorotate if only more than 1 orientation supported
-	if (autoRotate)
-	{
-		if ([self.supportedOrientations containsObject:
-			 [NSNumber numberWithInt:interfaceOrientation]]) {
-			return YES;
-		}
-    }
-	
-	// default return value is NO! -jm
-	
-	return NO;
-}
-
-/**
- Called by UIKit when the device starts to rotate to a new orientation.  This fires the \c setOrientation
- method on the Orientation object in JavaScript.  Look at the JavaScript documentation for more information.
- */
-- (void)didRotateFromInterfaceOrientation: (UIInterfaceOrientation)fromInterfaceOrientation
-{
-	int i = 0;
-	
-	switch (self.interfaceOrientation){
-		case UIInterfaceOrientationPortrait:
-			i = 0;
-			break;
-		case UIInterfaceOrientationPortraitUpsideDown:
-			i = 180;
-			break;
-		case UIInterfaceOrientationLandscapeLeft:
-			i = -90;
-			break;
-		case UIInterfaceOrientationLandscapeRight:
-			i = 90;
-			break;
-	}
-	
-	NSString* jsCallback = [NSString stringWithFormat:@"window.__defineGetter__('orientation',function(){ return %d; }); PhoneGap.fireEvent('orientationchange', window);",i];
-	[webView stringByEvaluatingJavaScriptFromString:jsCallback];
-	 
-}
-
-- (void) dealloc
-{
-    self.supportedOrientations = nil;
-    self.webView = nil;
-    
-    [super dealloc];
-}
-
-@end
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/bcff9559/PhoneGapLib/Classes/PluginResult.h
----------------------------------------------------------------------
diff --git a/PhoneGapLib/Classes/PluginResult.h b/PhoneGapLib/Classes/PluginResult.h
deleted file mode 100644
index 0cec738..0000000
--- a/PhoneGapLib/Classes/PluginResult.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- 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 <Foundation/Foundation.h>
-
-typedef enum {
-	PGCommandStatus_NO_RESULT = 0,
-	PGCommandStatus_OK,
-	PGCommandStatus_CLASS_NOT_FOUND_EXCEPTION,
-	PGCommandStatus_ILLEGAL_ACCESS_EXCEPTION,
-	PGCommandStatus_INSTANTIATION_EXCEPTION,
-	PGCommandStatus_MALFORMED_URL_EXCEPTION,
-	PGCommandStatus_IO_EXCEPTION,
-	PGCommandStatus_INVALID_ACTION,
-	PGCommandStatus_JSON_EXCEPTION,
-	PGCommandStatus_ERROR
-} PGCommandStatus;
-	
-@interface PluginResult : NSObject {
-	NSNumber* status;
-	id message;
-	NSNumber* keepCallback;
-	NSString* cast;
-	
-}
-
-@property (nonatomic, retain, readonly) NSNumber* status;
-@property (nonatomic, retain, readonly) id message;
-@property (nonatomic, retain)			NSNumber* keepCallback;
-@property (nonatomic, retain, readonly) NSString* cast;
-
--(PluginResult*) init;
-+(void) releaseStatus;
-+(PluginResult*) resultWithStatus: (PGCommandStatus) statusOrdinal;
-+(PluginResult*) resultWithStatus: (PGCommandStatus) statusOrdinal messageAsString: (NSString*) theMessage;
-+(PluginResult*) resultWithStatus: (PGCommandStatus) statusOrdinal messageAsArray: (NSArray*) theMessage;
-+(PluginResult*) resultWithStatus: (PGCommandStatus) statusOrdinal messageAsInt: (int) theMessage;
-+(PluginResult*) resultWithStatus: (PGCommandStatus) statusOrdinal messageAsDouble: (double) theMessage;
-+(PluginResult*) resultWithStatus: (PGCommandStatus) statusOrdinal messageAsDictionary: (NSDictionary*) theMessage;
-+(PluginResult*) resultWithStatus: (PGCommandStatus) statusOrdinal messageAsString: (NSString*) theMessage cast: (NSString*) theCast;
-+(PluginResult*) resultWithStatus: (PGCommandStatus) statusOrdinal messageAsArray: (NSArray*) theMessage cast: (NSString*) theCast;
-+(PluginResult*) resultWithStatus: (PGCommandStatus) statusOrdinal messageAsInt: (int) theMessage cast: (NSString*) theCast;
-+(PluginResult*) resultWithStatus: (PGCommandStatus) statusOrdinal messageAsDouble: (double) theMessage cast: (NSString*) theCast;
-+(PluginResult*) resultWithStatus: (PGCommandStatus) statusOrdinal messageAsDictionary: (NSDictionary*) theMessage cast: (NSString*) theCast;
-+(PluginResult*) resultWithStatus: (PGCommandStatus) statusOrdinal messageToErrorObject: (int) errorCode;
-
-
- 
--(void) setKeepCallbackAsBool: (BOOL) bKeepCallback;
-
-
--(NSString*) toJSONString;
--(NSString*) toSuccessCallbackString: (NSString*) callbackId;
--(NSString*) toErrorCallbackString: (NSString*) callbackId;
-
--(void) dealloc;
-@end

http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/bcff9559/PhoneGapLib/Classes/PluginResult.m
----------------------------------------------------------------------
diff --git a/PhoneGapLib/Classes/PluginResult.m b/PhoneGapLib/Classes/PluginResult.m
deleted file mode 100644
index 8e08585..0000000
--- a/PhoneGapLib/Classes/PluginResult.m
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- 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 "PluginResult.h"
-#import "JSONKit.h"
-#import "PGDebug.h"
-
-@interface PluginResult()
-
--(PluginResult*) initWithStatus:(PGCommandStatus)statusOrdinal message: (id) theMessage cast: (NSString*) theCast;
-
-@end
-
-
-@implementation PluginResult
-@synthesize status, message, keepCallback, cast;
-
-static NSArray* com_phonegap_CommandStatusMsgs;
-
-+(void) initialize
-{
-	com_phonegap_CommandStatusMsgs = [[NSArray alloc] initWithObjects: @"No result",
-									  @"OK",
-									  @"Class not found",
-									  @"Illegal access",
-									  @"Instantiation error",
-									  @"Malformed url",
-									  @"IO error",
-									  @"Invalid action",
-									  @"JSON error",
-									  @"Error",
-									  nil];
-}
-+(void) releaseStatus
-{
-	if (com_phonegap_CommandStatusMsgs != nil){
-		[com_phonegap_CommandStatusMsgs release];
-		com_phonegap_CommandStatusMsgs = nil;
-	}
-}
-		
--(PluginResult*) init
-{
-	return [self initWithStatus: PGCommandStatus_NO_RESULT message: nil cast: nil];
-}
--(PluginResult*) initWithStatus:(PGCommandStatus)statusOrdinal message: (id) theMessage cast: (NSString*) theCast{
-	self = [super init];
-	if(self) {
-		status = [NSNumber numberWithInt: statusOrdinal];
-		message = theMessage;
-		cast = theCast;
-		keepCallback = [NSNumber numberWithBool: NO];
-	}
-	return self;
-}		
-	
-+(PluginResult*) resultWithStatus: (PGCommandStatus) statusOrdinal
-{
-	return [[[self alloc] initWithStatus: statusOrdinal message: [com_phonegap_CommandStatusMsgs objectAtIndex: statusOrdinal] cast: nil] autorelease];
-}
-+(PluginResult*) resultWithStatus: (PGCommandStatus) statusOrdinal messageAsString: (NSString*) theMessage
-{
-	return [[[self alloc] initWithStatus: statusOrdinal message: theMessage cast:nil] autorelease];
-}
-+(PluginResult*) resultWithStatus: (PGCommandStatus) statusOrdinal messageAsArray: (NSArray*) theMessage
-{
-	return [[[self alloc] initWithStatus: statusOrdinal message: theMessage cast:nil] autorelease];
-}
-+(PluginResult*) resultWithStatus: (PGCommandStatus) statusOrdinal messageAsInt: (int) theMessage
-{
-	return [[[self alloc] initWithStatus: statusOrdinal message: [NSNumber numberWithInt: theMessage] cast:nil] autorelease];
-}
-+(PluginResult*) resultWithStatus: (PGCommandStatus) statusOrdinal messageAsDouble: (double) theMessage
-{
-	return [[[self alloc] initWithStatus: statusOrdinal message: [NSNumber numberWithDouble: theMessage] cast:nil] autorelease];
-}
-
-+(PluginResult*) resultWithStatus: (PGCommandStatus) statusOrdinal messageAsDictionary: (NSDictionary*) theMessage
-{
-	return [[[self alloc] initWithStatus: statusOrdinal message: theMessage cast:nil] autorelease];
-}
-+(PluginResult*) resultWithStatus: (PGCommandStatus) statusOrdinal messageAsString: (NSString*) theMessage cast: (NSString*) theCast
-{
-	return [[[self alloc] initWithStatus: statusOrdinal message: theMessage cast:theCast] autorelease];
-}
-+(PluginResult*) resultWithStatus: (PGCommandStatus) statusOrdinal messageAsArray: (NSArray*) theMessage cast: (NSString*) theCast
-{
-	return [[[self alloc] initWithStatus: statusOrdinal message: theMessage cast:theCast] autorelease];
-}
-
-+(PluginResult*) resultWithStatus: (PGCommandStatus) statusOrdinal messageAsInt: (int) theMessage cast: (NSString*) theCast
-{
-	return [[[self alloc] initWithStatus: statusOrdinal message: [NSNumber numberWithInt: theMessage] cast:theCast] autorelease];
-}
-+(PluginResult*) resultWithStatus: (PGCommandStatus) statusOrdinal messageAsDouble: (double) theMessage cast: (NSString*) theCast
-{
-	return [[[self alloc] initWithStatus: statusOrdinal message: [NSNumber numberWithDouble: theMessage] cast:theCast] autorelease];
-}
-+(PluginResult*) resultWithStatus: (PGCommandStatus) statusOrdinal messageAsDictionary: (NSDictionary*) theMessage cast: (NSString*) theCast
-{
-	return [[[self alloc] initWithStatus: statusOrdinal message: theMessage cast:theCast] autorelease];
-}
-+(PluginResult*) resultWithStatus: (PGCommandStatus) statusOrdinal messageToErrorObject: (int) errorCode 
-{
-    NSDictionary* errDict = [NSDictionary dictionaryWithObject:[NSNumber numberWithInt:errorCode] forKey:@"code"];
-	return [[[self alloc] initWithStatus: statusOrdinal message: errDict cast:nil] autorelease];
-}
-
-
--(void) setKeepCallbackAsBool:(BOOL)bKeepCallback
-{
-	[self setKeepCallback: [NSNumber numberWithBool:bKeepCallback]];
-}
-
--(NSString*) toJSONString{
-    NSString* resultString = [[NSDictionary dictionaryWithObjectsAndKeys:
-                               self.status, @"status",
-                               self.message ? self.message : [NSNull null], @"message",
-                               self.keepCallback, @"keepCallback",
-                               nil] JSONString];
-	DLog(@"PluginResult:toJSONString - %@", resultString);
-	return resultString;
-}
--(NSString*) toSuccessCallbackString: (NSString*) callbackId
-{
-	NSString* successCB;
-	
-	if ([self cast] != nil) {
-		successCB = [NSString stringWithFormat: @"var temp = %@(%@);\nPhoneGap.callbackSuccess('%@',temp);", self.cast, [self toJSONString], callbackId];
-	}
-	else {
-		successCB = [NSString stringWithFormat:@"PhoneGap.callbackSuccess('%@',%@);", callbackId, [self toJSONString]];			
-	}
-	DLog(@"PluginResult toSuccessCallbackString: %@", successCB);
-	return successCB;
-}
--(NSString*) toErrorCallbackString: (NSString*) callbackId
-{
-	NSString* errorCB = nil;
-	
-	if ([self cast] != nil) {
-		errorCB = [NSString stringWithFormat: @"var temp = %@(%@);\nPhoneGap.callbackError('%@',temp);", self.cast, [self toJSONString], callbackId];
-	}
-	else {
-		errorCB = [NSString stringWithFormat:@"PhoneGap.callbackError('%@',%@);", callbackId, [self toJSONString]];
-	}
-	DLog(@"PluginResult toErrorCallbackString: %@", errorCB);
-	return errorCB;
-}	
-										 
--(void) dealloc
-{
-	status = nil;
-	message = nil;
-	keepCallback = nil;
-	cast = nil;
-	
-	[super dealloc];
-}
-@end

http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/bcff9559/PhoneGapLib/Classes/Reachability.h
----------------------------------------------------------------------
diff --git a/PhoneGapLib/Classes/Reachability.h b/PhoneGapLib/Classes/Reachability.h
deleted file mode 100644
index 9141297..0000000
--- a/PhoneGapLib/Classes/Reachability.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- 
- File: Reachability.h
- Abstract: Basic demonstration of how to use the SystemConfiguration Reachablity APIs.
- 
- Version: 2.2
- 
- Disclaimer: IMPORTANT:  This Apple software is supplied to you by Apple Inc.
- ("Apple") in consideration of your agreement to the following terms, and your
- use, installation, modification or redistribution of this Apple software
- constitutes acceptance of these terms.  If you do not agree with these terms,
- please do not use, install, modify or redistribute this Apple software.
- 
- In consideration of your agreement to abide by the following terms, and subject
- to these terms, Apple grants you a personal, non-exclusive license, under
- Apple's copyrights in this original Apple software (the "Apple Software"), to
- use, reproduce, modify and redistribute the Apple Software, with or without
- modifications, in source and/or binary forms; provided that if you redistribute
- the Apple Software in its entirety and without modifications, you must retain
- this notice and the following text and disclaimers in all such redistributions
- of the Apple Software.
- Neither the name, trademarks, service marks or logos of Apple Inc. may be used
- to endorse or promote products derived from the Apple Software without specific
- prior written permission from Apple.  Except as expressly stated in this notice,
- no other rights or licenses, express or implied, are granted by Apple herein,
- including but not limited to any patent rights that may be infringed by your
- derivative works or by other works in which the Apple Software may be
- incorporated.
- 
- The Apple Software is provided by Apple on an "AS IS" basis.  APPLE MAKES NO
- WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED
- WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN
- COMBINATION WITH YOUR PRODUCTS.
- 
- IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR
- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
- GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR
- DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF
- CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
- APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- 
- Copyright (C) 2010 Apple Inc. All Rights Reserved.
- 
-*/
-
-
-#import <Foundation/Foundation.h>
-#import <SystemConfiguration/SystemConfiguration.h>
-#import <netinet/in.h>
-
-typedef enum {
-	NotReachable = 0,
-	ReachableViaWWAN, // this value has been swapped with ReachableViaWiFi for PhoneGap backwards compat. reasons
-	ReachableViaWiFi  // this value has been swapped with ReachableViaWWAN for PhoneGap backwards compat. reasons
-} NetworkStatus;
-#define kReachabilityChangedNotification @"kNetworkReachabilityChangedNotification"
-
-@interface PGReachability: NSObject
-{
-	BOOL localWiFiRef;
-	SCNetworkReachabilityRef reachabilityRef;
-}
-
-//reachabilityWithHostName- Use to check the reachability of a particular host name. 
-+ (PGReachability*) reachabilityWithHostName: (NSString*) hostName;
-
-//reachabilityWithAddress- Use to check the reachability of a particular IP address. 
-+ (PGReachability*) reachabilityWithAddress: (const struct sockaddr_in*) hostAddress;
-
-//reachabilityForInternetConnection- checks whether the default route is available.  
-//  Should be used by applications that do not connect to a particular host
-+ (PGReachability*) reachabilityForInternetConnection;
-
-//reachabilityForLocalWiFi- checks whether a local wifi connection is available.
-+ (PGReachability*) reachabilityForLocalWiFi;
-
-//Start listening for reachability notifications on the current run loop
-- (BOOL) startNotifier;
-- (void) stopNotifier;
-
-- (NetworkStatus) currentReachabilityStatus;
-//WWAN may be available, but not active until a connection has been established.
-//WiFi may require a connection for VPN on Demand.
-- (BOOL) connectionRequired;
-@end
-
-

http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/bcff9559/PhoneGapLib/Classes/Reachability.m
----------------------------------------------------------------------
diff --git a/PhoneGapLib/Classes/Reachability.m b/PhoneGapLib/Classes/Reachability.m
deleted file mode 100644
index 2d7b530..0000000
--- a/PhoneGapLib/Classes/Reachability.m
+++ /dev/null
@@ -1,285 +0,0 @@
-/*
- 
- File: Reachability.m
- Abstract: Basic demonstration of how to use the SystemConfiguration Reachablity APIs.
- 
- Version: 2.2
- 
- Disclaimer: IMPORTANT:  This Apple software is supplied to you by Apple Inc.
- ("Apple") in consideration of your agreement to the following terms, and your
- use, installation, modification or redistribution of this Apple software
- constitutes acceptance of these terms.  If you do not agree with these terms,
- please do not use, install, modify or redistribute this Apple software.
- 
- In consideration of your agreement to abide by the following terms, and subject
- to these terms, Apple grants you a personal, non-exclusive license, under
- Apple's copyrights in this original Apple software (the "Apple Software"), to
- use, reproduce, modify and redistribute the Apple Software, with or without
- modifications, in source and/or binary forms; provided that if you redistribute
- the Apple Software in its entirety and without modifications, you must retain
- this notice and the following text and disclaimers in all such redistributions
- of the Apple Software.
- Neither the name, trademarks, service marks or logos of Apple Inc. may be used
- to endorse or promote products derived from the Apple Software without specific
- prior written permission from Apple.  Except as expressly stated in this notice,
- no other rights or licenses, express or implied, are granted by Apple herein,
- including but not limited to any patent rights that may be infringed by your
- derivative works or by other works in which the Apple Software may be
- incorporated.
- 
- The Apple Software is provided by Apple on an "AS IS" basis.  APPLE MAKES NO
- WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED
- WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN
- COMBINATION WITH YOUR PRODUCTS.
- 
- IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR
- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
- GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR
- DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF
- CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
- APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- 
- Copyright (C) 2010 Apple Inc. All Rights Reserved.
- 
-*/
-
-#import <sys/socket.h>
-#import <netinet/in.h>
-#import <netinet6/in6.h>
-#import <arpa/inet.h>
-#import <ifaddrs.h>
-#import <netdb.h>
-
-#import <CoreFoundation/CoreFoundation.h>
-
-#import "Reachability.h"
-
-#define kShouldPrintReachabilityFlags 0
-
-static void PrintReachabilityFlags(SCNetworkReachabilityFlags    flags, const char* comment)
-{
-#if kShouldPrintReachabilityFlags
-	
-    NSLog(@"Reachability Flag Status: %c%c %c%c%c%c%c%c%c %s\n",
-			(flags & kSCNetworkReachabilityFlagsIsWWAN)				  ? 'W' : '-',
-			(flags & kSCNetworkReachabilityFlagsReachable)            ? 'R' : '-',
-			
-			(flags & kSCNetworkReachabilityFlagsTransientConnection)  ? 't' : '-',
-			(flags & kSCNetworkReachabilityFlagsConnectionRequired)   ? 'c' : '-',
-			(flags & kSCNetworkReachabilityFlagsConnectionOnTraffic)  ? 'C' : '-',
-			(flags & kSCNetworkReachabilityFlagsInterventionRequired) ? 'i' : '-',
-			(flags & kSCNetworkReachabilityFlagsConnectionOnDemand)   ? 'D' : '-',
-			(flags & kSCNetworkReachabilityFlagsIsLocalAddress)       ? 'l' : '-',
-			(flags & kSCNetworkReachabilityFlagsIsDirect)             ? 'd' : '-',
-			comment
-			);
-#endif
-}
-
-
-@implementation PGReachability
-
-static void ReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkReachabilityFlags flags, void* info)
-{
-	#pragma unused (target, flags)
-//	NSCAssert(info != NULL, @"info was NULL in ReachabilityCallback");
-//	NSCAssert([(NSObject*) info isKindOfClass: [Reachability class]], @"info was wrong class in ReachabilityCallback");
-    
-    // Converted the asserts above to conditionals, with safe return from the function
-    if (info == NULL) {
-        NSLog(@"info was NULL in ReachabilityCallback");
-        return;
-    }
-    
-    if (![(NSObject*) info isKindOfClass: [PGReachability class]]) {
-        NSLog(@"info was wrong class in ReachabilityCallback");
-        return;
-    }
-
-	//We're on the main RunLoop, so an NSAutoreleasePool is not necessary, but is added defensively
-	// in case someon uses the Reachablity object in a different thread.
-	NSAutoreleasePool* myPool = [[NSAutoreleasePool alloc] init];
-	
-	PGReachability* noteObject = (PGReachability*) info;
-	// Post a notification to notify the client that the network reachability changed.
-	[[NSNotificationCenter defaultCenter] postNotificationName: kReachabilityChangedNotification object: noteObject];
-	
-	[myPool release];
-}
-
-- (BOOL) startNotifier
-{
-	BOOL retVal = NO;
-	SCNetworkReachabilityContext	context = {0, self, NULL, NULL, NULL};
-	if(SCNetworkReachabilitySetCallback(reachabilityRef, ReachabilityCallback, &context))
-	{
-		if(SCNetworkReachabilityScheduleWithRunLoop(reachabilityRef, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode))
-		{
-			retVal = YES;
-		}
-	}
-	return retVal;
-}
-
-- (void) stopNotifier
-{
-	if(reachabilityRef!= NULL)
-	{
-		SCNetworkReachabilityUnscheduleFromRunLoop(reachabilityRef, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);
-	}
-}
-
-- (void) dealloc
-{
-	[self stopNotifier];
-	if(reachabilityRef!= NULL)
-	{
-		CFRelease(reachabilityRef);
-	}
-	[super dealloc];
-}
-
-+ (PGReachability*) reachabilityWithHostName: (NSString*) hostName;
-{
-	PGReachability* retVal = NULL;
-	SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithName(NULL, [hostName UTF8String]);
-	if(reachability!= NULL)
-	{
-		retVal= [[[self alloc] init] autorelease];
-		if(retVal!= NULL)
-		{
-			retVal->reachabilityRef = reachability;
-			retVal->localWiFiRef = NO;
-		}
-	}
-	return retVal;
-}
-
-+ (PGReachability*) reachabilityWithAddress: (const struct sockaddr_in*) hostAddress;
-{
-	SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithAddress(kCFAllocatorDefault, (const struct sockaddr*)hostAddress);
-	PGReachability* retVal = NULL;
-	if(reachability!= NULL)
-	{
-		retVal= [[[self alloc] init] autorelease];
-		if(retVal!= NULL)
-		{
-			retVal->reachabilityRef = reachability;
-			retVal->localWiFiRef = NO;
-		}
-	}
-	return retVal;
-}
-
-+ (PGReachability*) reachabilityForInternetConnection;
-{
-	struct sockaddr_in zeroAddress;
-	bzero(&zeroAddress, sizeof(zeroAddress));
-	zeroAddress.sin_len = sizeof(zeroAddress);
-	zeroAddress.sin_family = AF_INET;
-	return [self reachabilityWithAddress: &zeroAddress];
-}
-
-+ (PGReachability*) reachabilityForLocalWiFi;
-{
-	struct sockaddr_in localWifiAddress;
-	bzero(&localWifiAddress, sizeof(localWifiAddress));
-	localWifiAddress.sin_len = sizeof(localWifiAddress);
-	localWifiAddress.sin_family = AF_INET;
-	// IN_LINKLOCALNETNUM is defined in <netinet/in.h> as 169.254.0.0
-	localWifiAddress.sin_addr.s_addr = htonl(IN_LINKLOCALNETNUM);
-	PGReachability* retVal = [self reachabilityWithAddress: &localWifiAddress];
-	if(retVal!= NULL)
-	{
-		retVal->localWiFiRef = YES;
-	}
-	return retVal;
-}
-
-#pragma mark Network Flag Handling
-
-- (NetworkStatus) localWiFiStatusForFlags: (SCNetworkReachabilityFlags) flags
-{
-	PrintReachabilityFlags(flags, "localWiFiStatusForFlags");
-
-	BOOL retVal = NotReachable;
-	if((flags & kSCNetworkReachabilityFlagsReachable) && (flags & kSCNetworkReachabilityFlagsIsDirect))
-	{
-		retVal = ReachableViaWiFi;	
-	}
-	return retVal;
-}
-
-- (NetworkStatus) networkStatusForFlags: (SCNetworkReachabilityFlags) flags
-{
-	PrintReachabilityFlags(flags, "networkStatusForFlags");
-	if ((flags & kSCNetworkReachabilityFlagsReachable) == 0)
-	{
-		// if target host is not reachable
-		return NotReachable;
-	}
-
-	BOOL retVal = NotReachable;
-	
-	if ((flags & kSCNetworkReachabilityFlagsConnectionRequired) == 0)
-	{
-		// if target host is reachable and no connection is required
-		//  then we'll assume (for now) that your on Wi-Fi
-		retVal = ReachableViaWiFi;
-	}
-	
-	
-	if ((((flags & kSCNetworkReachabilityFlagsConnectionOnDemand ) != 0) ||
-		(flags & kSCNetworkReachabilityFlagsConnectionOnTraffic) != 0))
-	{
-			// ... and the connection is on-demand (or on-traffic) if the
-			//     calling application is using the CFSocketStream or higher APIs
-
-			if ((flags & kSCNetworkReachabilityFlagsInterventionRequired) == 0)
-			{
-				// ... and no [user] intervention is needed
-				retVal = ReachableViaWiFi;
-			}
-		}
-	
-	if ((flags & kSCNetworkReachabilityFlagsIsWWAN) == kSCNetworkReachabilityFlagsIsWWAN)
-	{
-		// ... but WWAN connections are OK if the calling application
-		//     is using the CFNetwork (CFSocketStream?) APIs.
-		retVal = ReachableViaWWAN;
-	}
-	return retVal;
-}
-
-- (BOOL) connectionRequired;
-{
-	NSAssert(reachabilityRef != NULL, @"connectionRequired called with NULL reachabilityRef");
-	SCNetworkReachabilityFlags flags;
-	if (SCNetworkReachabilityGetFlags(reachabilityRef, &flags))
-	{
-		return (flags & kSCNetworkReachabilityFlagsConnectionRequired);
-	}
-	return NO;
-}
-
-- (NetworkStatus) currentReachabilityStatus
-{
-	NSAssert(reachabilityRef != NULL, @"currentNetworkStatus called with NULL reachabilityRef");
-	NetworkStatus retVal = NotReachable;
-	SCNetworkReachabilityFlags flags;
-	if (SCNetworkReachabilityGetFlags(reachabilityRef, &flags))
-	{
-		if(localWiFiRef)
-		{
-			retVal = [self localWiFiStatusForFlags: flags];
-		}
-		else
-		{
-			retVal = [self networkStatusForFlags: flags];
-		}
-	}
-	return retVal;
-}
-@end

http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/bcff9559/PhoneGapLib/Classes/Sound.h
----------------------------------------------------------------------
diff --git a/PhoneGapLib/Classes/Sound.h b/PhoneGapLib/Classes/Sound.h
deleted file mode 100755
index 3f1335a..0000000
--- a/PhoneGapLib/Classes/Sound.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- 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 <Foundation/Foundation.h>
-#import <AudioToolbox/AudioServices.h>
-#import <AVFoundation/AVFoundation.h>
-
-#import "PGPlugin.h"
-
-
-
-
-enum MediaError {
-	MEDIA_ERR_ABORTED = 1,
-	MEDIA_ERR_NETWORK = 2,
-	MEDIA_ERR_DECODE = 3,
-	MEDIA_ERR_NONE_SUPPORTED = 4
-};
-typedef NSUInteger MediaError;
-
-enum MediaStates {
-	MEDIA_NONE = 0,
-	MEDIA_STARTING = 1,
-	MEDIA_RUNNING = 2,
-	MEDIA_PAUSED = 3,
-	MEDIA_STOPPED = 4
-};
-typedef NSUInteger MediaStates;
-
-enum MediaMsg {
-	MEDIA_STATE = 1,
-	MEDIA_DURATION = 2,
-    MEDIA_POSITION = 3,
-	MEDIA_ERROR = 9
-};
-typedef NSUInteger MediaMsg;
-
-@interface AudioPlayer : AVAudioPlayer
-{
-	NSString* mediaId;
-}
-@property (nonatomic,copy) NSString* mediaId;
-@end
-
-#ifdef __IPHONE_3_0
-@interface AudioRecorder : AVAudioRecorder
-{
-	NSString* mediaId;
-}
-@property (nonatomic,copy) NSString* mediaId;
-@end
-#endif
-	
-@interface PGAudioFile : NSObject
-{
-	NSString* resourcePath;
-	NSURL* resourceURL;
-	AudioPlayer* player;
-#ifdef __IPHONE_3_0
-	AudioRecorder* recorder;
-#endif
-}
-
-@property (nonatomic, retain) NSString* resourcePath;
-@property (nonatomic, retain) NSURL* resourceURL;
-@property (nonatomic, retain) AudioPlayer* player;
-
-#ifdef __IPHONE_3_0
-@property (nonatomic, retain) AudioRecorder* recorder;
-#endif
-
-@end
-
-@interface PGSound : PGPlugin <AVAudioPlayerDelegate, AVAudioRecorderDelegate>
-{
-	NSMutableDictionary* soundCache;
-    AVAudioSession* avSession;
-}
-@property (nonatomic, retain) NSMutableDictionary* soundCache;
-@property (nonatomic, retain) AVAudioSession* avSession;
-
-- (void) play:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options;
-- (void) pause:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options;
-- (void) stop:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options;
-- (void) release:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options;
-- (void) getCurrentPosition:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options;
-- (void) prepare:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options;
-- (BOOL) hasAudioSession;
-
-// helper methods
-- (PGAudioFile*) audioFileForResource:(NSString*) resourcePath withId: (NSString*)mediaId;
-- (BOOL) prepareToPlay: (PGAudioFile*) audioFile withId: (NSString*)mediaId;
-- (NSString*) createMediaErrorWithCode: (MediaError) code message: (NSString*) message;
-
-- (void) startAudioRecord:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options;
-- (void) stopAudioRecord:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options;
-
-@end

http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/bcff9559/PhoneGapLib/Classes/Sound.m
----------------------------------------------------------------------
diff --git a/PhoneGapLib/Classes/Sound.m b/PhoneGapLib/Classes/Sound.m
deleted file mode 100644
index e96349a..0000000
--- a/PhoneGapLib/Classes/Sound.m
+++ /dev/null
@@ -1,593 +0,0 @@
-/*
- 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 "Sound.h"
-#import "PGViewController.h"
-
-#define DOCUMENTS_SCHEME_PREFIX		@"documents://"
-#define HTTP_SCHEME_PREFIX			@"http://"
-
-@implementation PGSound
-
-@synthesize soundCache, avSession;
-
-// Maps a url for a resource path
-// "Naked" resource paths are assumed to be from the www folder as its base
-- (NSURL*) urlForResource:(NSString*)resourcePath
-{
-	NSURL* resourceURL = nil;
-    NSString* filePath = nil;
-	
-    // first try to find HTTP:// or Documents:// resources
-    
-    if ([resourcePath hasPrefix:HTTP_SCHEME_PREFIX]){
-        // if it is a http url, use it
-        NSLog(@"Will use resource '%@' from the Internet.", resourcePath);
-        resourceURL = [NSURL URLWithString:resourcePath];
-    } else if ([resourcePath hasPrefix:DOCUMENTS_SCHEME_PREFIX]) {
-        filePath = [resourcePath stringByReplacingOccurrencesOfString:DOCUMENTS_SCHEME_PREFIX withString:[NSString stringWithFormat:@"%@/",[PGViewController applicationDocumentsDirectory]]];
-       NSLog(@"Will use resource '%@' from the documents folder with path = %@", resourcePath, filePath);
-    } else {
-        // attempt to find file path in www directory
-        filePath = [self.commandDelegate pathForResource:resourcePath];
-        if (filePath != nil) {
-            NSLog(@"Found resource '%@' in the web folder.", filePath);
-        }else {
-            filePath = resourcePath;
-            NSLog(@"Will attempt to use file resource '%@'", filePath);
-            
-        }
-
-    }
-    // check that file exists for all but HTTP_SHEME_PREFIX
-    if(filePath != nil) {
-        // try to access file
-        NSFileManager* fMgr = [[NSFileManager alloc] init];
-        if (![fMgr fileExistsAtPath:filePath]) {
-            resourceURL = nil;
-            NSLog(@"Unknown resource '%@'", resourcePath);
-        } else {
-            // it's a valid file url, use it
-            resourceURL = [NSURL fileURLWithPath:filePath];
-        }
-        [fMgr release];
-    }     
-	return resourceURL;
-}
-
-// Creates or gets the cached audio file resource object
-- (PGAudioFile*) audioFileForResource:(NSString*) resourcePath withId: (NSString*)mediaId
-{
-	BOOL bError = NO;
-	MediaError errcode = MEDIA_ERR_NONE_SUPPORTED;
-    NSString* errMsg = @"";
-	NSString* jsString = nil;
-	PGAudioFile* audioFile = nil;
-	NSURL* resourceURL = nil;
-	
-	if ([self soundCache] == nil) {
-		[self setSoundCache: [NSMutableDictionary dictionaryWithCapacity:1]];
-	}else {
-		audioFile = [[self soundCache] objectForKey: mediaId];
-	}
-	if (audioFile == nil){
-		// validate resourcePath and create
-	
-		if (resourcePath == nil || ![resourcePath isKindOfClass:[NSString class]] || [resourcePath isEqualToString:@""]){
-			bError = YES;
-			errcode = MEDIA_ERR_ABORTED;
-			errMsg = @"invalid media src argument";
-		} else {
-			resourceURL = [self urlForResource:resourcePath];
-		}
-
-		if (resourceURL == nil) {
-			bError = YES;
-			errcode = MEDIA_ERR_ABORTED;
-			errMsg = [NSString stringWithFormat: @"Cannot use audio file from resource '%@'", resourcePath];
-		}
-		if (bError) {
-			jsString = [NSString stringWithFormat: @"%@(\"%@\",%d,%@);", @"PhoneGap.Media.onStatus", mediaId, MEDIA_ERROR, [self createMediaErrorWithCode: errcode message: errMsg]];
-			[super writeJavascript:jsString];
-		} else {
-			audioFile = [[[PGAudioFile alloc] init] autorelease];
-			audioFile.resourcePath = resourcePath;
-			audioFile.resourceURL = resourceURL;
-			[[self soundCache] setObject:audioFile forKey: mediaId];
-		}
-	}
-	return audioFile;
-}
-// returns whether or not audioSession is available - creates it if necessary 
-- (BOOL) hasAudioSession
-{
-    BOOL bSession = YES;
-    if (!self.avSession) {
-        NSError* error = nil;
-        
-        self.avSession = [AVAudioSession sharedInstance];
-        if (error) {
-            // is not fatal if can't get AVAudioSession , just log the error
-            NSLog(@"error creating audio session: %@", [[error userInfo] description]);
-            self.avSession = nil;
-            bSession = NO;
-        }
-    }
-    return bSession;
-}
-// helper function to create a error object string
-- (NSString*) createMediaErrorWithCode: (MediaError) code message: (NSString*) message
-{
-    NSMutableDictionary* errorDict = [NSMutableDictionary dictionaryWithCapacity:2];
-    [errorDict setObject: [NSNumber numberWithUnsignedInt: code] forKey:@"code"];
-    [errorDict setObject: message ? message : @"" forKey: @"message"];
-    return [errorDict JSONString];
-    
-}
-
-- (void) play:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options
-{
-
-	NSString* callbackId = [arguments objectAtIndex:0];
-#pragma unused(callbackId)
-	
-	NSString* mediaId = [arguments objectAtIndex:1];
-	BOOL bError = NO;
-	NSString* jsString = nil;
-	
-	PGAudioFile* audioFile = [self audioFileForResource:[arguments objectAtIndex:2] withId: mediaId];
-	
-	if (audioFile != nil) {
-		if (audioFile.player == nil){
-            bError = [self prepareToPlay:audioFile withId:mediaId];
-		}	
-		if (!bError){
-			// audioFile.player != nil  or player was sucessfully created
-            // get the audioSession and set the category to allow Playing when device is locked or ring/silent switch engaged
-            if ([self hasAudioSession]) {
-                NSError* err = nil;
-                [self.avSession setCategory:AVAudioSessionCategoryPlayback error:nil];
-                if (![self.avSession  setActive: YES error: &err]){
-                    // other audio with higher priority that does not allow mixing could cause this to fail
-                    NSLog(@"Unable to play audio: %@", [err localizedFailureReason]);
-                    bError = YES;
-                }
-            }
-            if (!bError) {
-                NSLog(@"Playing audio sample '%@'", audioFile.resourcePath);
-                NSNumber* loopOption = [options objectForKey:@"numberOfLoops"];
-                NSInteger numberOfLoops = 0;
-                if (loopOption != nil) { 
-                    numberOfLoops = [loopOption intValue] - 1;
-                }
-                audioFile.player.numberOfLoops = numberOfLoops;
-                
-                if(audioFile.player.isPlaying){
-                    [audioFile.player stop];
-                    audioFile.player.currentTime = 0;
-                }
-                [audioFile.player play];
-                double position = round(audioFile.player.duration * 1000)/1000;
-                jsString = [NSString stringWithFormat: @"%@(\"%@\",%d,%.3f);\n%@(\"%@\",%d,%d);", @"PhoneGap.Media.onStatus", mediaId, MEDIA_DURATION, position, @"PhoneGap.Media.onStatus", mediaId, MEDIA_STATE, MEDIA_RUNNING];
-                [super writeJavascript:jsString];
-                
-            }
-        }
-        if (bError) {
-			/*  I don't see a problem playing previously recorded audio so removing this section - BG
-			NSError* error;
-			// try loading it one more time, in case the file was recorded previously
-			audioFile.player = [[ AVAudioPlayer alloc ] initWithContentsOfURL:audioFile.resourceURL error:&error];
-			if (error != nil) {
-				NSLog(@"Failed to initialize AVAudioPlayer: %@\n", error);
-				audioFile.player = nil;
-			} else {
-				NSLog(@"Playing audio sample '%@'", audioFile.resourcePath);
-				audioFile.player.numberOfLoops = numberOfLoops;
-				[audioFile.player play];
-			} */
-			// error creating the session or player
-			jsString = [NSString stringWithFormat: @"%@(\"%@\",%d,%@);", @"PhoneGap.Media.onStatus", mediaId, MEDIA_ERROR, [self createMediaErrorWithCode: MEDIA_ERR_NONE_SUPPORTED message: nil]];
-			[super writeJavascript:jsString];
-		}
-	}
-	// else audioFile was nil - error already returned from audioFile for resource
-	return;
-}
-- (BOOL) prepareToPlay: (PGAudioFile*) audioFile withId: (NSString*) mediaId
-{
-    BOOL bError = NO;
-    NSError* playerError = nil;
-    
-    // create the player
-    NSURL* resourceURL = audioFile.resourceURL;
-    if ([resourceURL isFileURL]) {
-        audioFile.player = [[[ AudioPlayer alloc ] initWithContentsOfURL:resourceURL error:&playerError] autorelease];
-    } else {
-        NSURLRequest *request = [NSURLRequest requestWithURL:resourceURL];
-        NSURLResponse *response = nil;
-        NSData *data = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&playerError];
-        if (playerError) {
-            NSLog(@"Unable to download audio from: %@", [resourceURL absoluteString]);
-        } else {
-            audioFile.player = [[[ AudioPlayer alloc ] initWithData:data error:&playerError] autorelease];
-        }
-    }
-    
-    if (playerError != nil) {
-        NSLog(@"Failed to initialize AVAudioPlayer: %@\n", [playerError localizedFailureReason]);
-        audioFile.player = nil;
-        if (self.avSession) {
-            [self.avSession setActive:NO error:nil];
-        }
-        bError = YES;
-    } else {
-        audioFile.player.mediaId = mediaId;
-        audioFile.player.delegate = self;
-        bError = ![audioFile.player prepareToPlay];
-    }
-    return bError;
-}
-
-// if no errors sets status to starting and calls successCallback with no parameters
-// Calls the success call back immediately as there is no mechanism to determine that the file is loaded
-// other than the return from prepareToPlay.  Thus, IMHO not really worth calling
-- (void) prepare:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options
-{
-	NSString* callbackId = [arguments objectAtIndex:0]; 
-    
-    NSString* mediaId = [arguments objectAtIndex:1];
-    BOOL bError = NO;
-    MediaStates state = MEDIA_STARTING;
-    NSString* jsString = nil;
-    
-	PGAudioFile* audioFile = [[self soundCache] objectForKey: mediaId];
-    if (audioFile == nil) {
-        // did not already exist, try to create
-        audioFile = [self audioFileForResource:[arguments objectAtIndex:2] withId: mediaId];
-        if (audioFile == nil) {
-            // create failed
-            bError = YES;
-        } else {
-            bError = [self prepareToPlay:audioFile withId:mediaId];
-        }
-    } else {
-        // audioFile already existed in the cache no need to prepare it again, indicate state
-        if (audioFile.player && [audioFile.player isPlaying]) {
-            state = MEDIA_RUNNING;
-        }
-    }
-    
-    if (!bError) {
-        
-        // NSLog(@"Prepared audio sample '%@' for playback.", audioFile.resourcePath);
-        PluginResult* result = [PluginResult resultWithStatus:PGCommandStatus_OK];
-        jsString = [NSString stringWithFormat: @"%@(\"%@\",%d,%d);\n%@", @"PhoneGap.Media.onStatus", mediaId, MEDIA_STATE, state, [result toSuccessCallbackString:callbackId]];
-        
-	} else {
-        jsString = [NSString stringWithFormat: @"%@(\"%@\",%d,%@);", @"PhoneGap.Media.onStatus", mediaId, MEDIA_ERROR, [self createMediaErrorWithCode: MEDIA_ERR_NONE_SUPPORTED message: nil]];   
-    }
-    if (jsString) {
-        [super writeJavascript:jsString];
-    }
-	
-}
-
-
-
-- (void) stop:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options
-{
-	NSString* callbackId = [arguments objectAtIndex:0];
-#pragma unused(callbackId)
-	NSString* mediaId = [arguments objectAtIndex:1];
-    PGAudioFile* audioFile = [[self soundCache] objectForKey: mediaId];
-	NSString* jsString = nil;
-
-	if (audioFile != nil && audioFile.player!= nil) {
-        NSLog(@"Stopped playing audio sample '%@'", audioFile.resourcePath);
-        [audioFile.player stop];
-        audioFile.player.currentTime = 0;
-        jsString = [NSString stringWithFormat: @"%@(\"%@\",%d,%d);", @"PhoneGap.Media.onStatus", mediaId, MEDIA_STATE, MEDIA_STOPPED];
-	}  // ignore if no media playing 
-    if (jsString){
-        [super writeJavascript: jsString];
-    }
-}
-
-- (void) pause:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options
-{
-	NSString* callbackId = [arguments objectAtIndex:0];
-#pragma unused(callbackId)
-	NSString* mediaId = [arguments objectAtIndex:1];
-    NSString* jsString = nil;
-	PGAudioFile* audioFile = [[self soundCache] objectForKey: mediaId];
-	
-	if (audioFile != nil && audioFile.player != nil) {
-            NSLog(@"Paused playing audio sample '%@'", audioFile.resourcePath);
-			[audioFile.player pause];
-            jsString = [NSString stringWithFormat: @"%@(\"%@\",%d,%d);", @"PhoneGap.Media.onStatus", mediaId, MEDIA_STATE, MEDIA_PAUSED];
-	} 
-    // ignore if no media playing
-      
-    
-    if (jsString){
-        [super writeJavascript: jsString];
-    }
-
-
-}
-- (void) seekTo:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options
-{
-	//args:
-	// 0 = callbackId
-    // 1 = Media id
-    // 2 = path to resource
-    // 3 = seek to location in milliseconds
-	
-	NSString* callbackId = [arguments objectAtIndex:0];
-#pragma unused(callbackId)
-	NSString* mediaId = [arguments objectAtIndex:1];
-
-	PGAudioFile* audioFile = [[self soundCache] objectForKey: mediaId];
-    double position = [[arguments objectAtIndex:3 ] doubleValue];
-	
-    if (audioFile != nil && audioFile.player != nil && position){
-        double posInSeconds = position/1000;
-        audioFile.player.currentTime = posInSeconds;
-        NSString* jsString = [NSString stringWithFormat: @"%@(\"%@\",%d,%f);", @"PhoneGap.Media.onStatus", mediaId, MEDIA_POSITION, posInSeconds];
-
-        [super writeJavascript: jsString];
-        
-    }
-    
-	return;
-    
-}
-
-- (void) release:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options
-{
-	NSString* callbackId = [arguments objectAtIndex:0];
-#pragma unused(callbackId)
-    NSString* mediaId = [arguments objectAtIndex:1];
-
-	if (mediaId != nil){
-		PGAudioFile* audioFile = [[self soundCache] objectForKey: mediaId];
-		if (audioFile != nil){
-			if (audioFile.player && [audioFile.player isPlaying]){
-				[audioFile.player stop];
-			}
-			if(audioFile.recorder && [audioFile.recorder isRecording]){
-				[audioFile.recorder stop];
-			}
-            if (self.avSession) {
-                [self.avSession setActive:NO error: nil];
-                self.avSession = nil;
-            }
-			[[self soundCache] removeObjectForKey: mediaId];
-			NSLog(@"Media with id %@ released", mediaId);
-		}
-	}
-}
-
-- (void) getCurrentPosition:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options
-{
-	//args:
-	// 0 = callbackId
-    // 1 = Media id
-	
-	NSString* callbackId = [arguments objectAtIndex:0];
-	NSString* mediaId = [arguments objectAtIndex:1];
-#pragma unused(mediaId)
-	PGAudioFile* audioFile = [[self soundCache] objectForKey: mediaId];
-    double position = -1;
-	
-    if (audioFile != nil && audioFile.player != nil && [audioFile.player isPlaying]){ 
-            position = round(audioFile.player.currentTime *1000)/1000;
-    }
-    PluginResult* result = [PluginResult resultWithStatus:PGCommandStatus_OK messageAsDouble: position];
-	NSString* jsString = [NSString stringWithFormat: @"%@(\"%@\",%d,%.3f);\n%@", @"PhoneGap.Media.onStatus", mediaId, MEDIA_POSITION, position, [result toSuccessCallbackString:callbackId]];
-    [super writeJavascript:jsString];
-    
-	return;
-		
-}
-
-- (void) startAudioRecord:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options
-{
-	NSString* callbackId = [arguments objectAtIndex:0];
-#pragma unused(callbackId)
-	
-	NSString* mediaId = [arguments objectAtIndex:1];
-	PGAudioFile* audioFile = [self audioFileForResource:[arguments objectAtIndex:2] withId: mediaId];
-    NSString* jsString = nil;
-    NSString* errorMsg = @"";
-    
-	if (audioFile != nil) {
-		
-		NSError* error = nil;
-
-		if (audioFile.recorder != nil) {
-			[audioFile.recorder stop];
-			audioFile.recorder = nil;
-		}
-        // get the audioSession and set the category to allow recording when device is locked or ring/silent switch engaged
-        if ([self hasAudioSession]) {
-            [self.avSession setCategory:AVAudioSessionCategoryRecord error:nil];
-            if (![self.avSession  setActive: YES error: &error]){
-                // other audio with higher priority that does not allow mixing could cause this to fail
-                errorMsg = [NSString stringWithFormat: @"Unable to record audio: %@", [error localizedFailureReason]];
-                jsString = [NSString stringWithFormat: @"%@(\"%@\",%d,%@);", @"PhoneGap.Media.onStatus", mediaId, MEDIA_ERROR, [self createMediaErrorWithCode: MEDIA_ERR_ABORTED message: errorMsg] ];
-                [super writeJavascript:jsString];
-                return;
-            }
-        }
-        
-        // create a new recorder for each start record 
-        audioFile.recorder = [[[AudioRecorder alloc] initWithURL:audioFile.resourceURL settings:nil error:&error] autorelease];
-        
-		if (error != nil) {
-			errorMsg = [NSString stringWithFormat: @"Failed to initialize AVAudioRecorder: %@\n", [error  localizedFailureReason]];
-			audioFile.recorder = nil;
-            if (self.avSession) {
-                [self.avSession setActive:NO error:nil];
-            }
-			jsString = [NSString stringWithFormat: @"%@(\"%@\",%d,%@);", @"PhoneGap.Media.onStatus", mediaId, MEDIA_ERROR, [self createMediaErrorWithCode: MEDIA_ERR_ABORTED message: errorMsg]];
-			
-		} else {
-			audioFile.recorder.delegate = self;
-			audioFile.recorder.mediaId = mediaId;
-			[audioFile.recorder record];
-			NSLog(@"Started recording audio sample '%@'", audioFile.resourcePath);
-            jsString = [NSString stringWithFormat: @"%@(\"%@\",%d,%d);", @"PhoneGap.Media.onStatus", mediaId, MEDIA_STATE, MEDIA_RUNNING];
-		}
-	}
-    if (jsString) {
-       [super writeJavascript:jsString]; 
-    }
-	return;
-}
-
-- (void) stopAudioRecord:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options
-{
-	NSString* callbackId = [arguments objectAtIndex:0];
-#pragma unused(callbackId)
-	NSString* mediaId = [arguments objectAtIndex:1];
-
-	PGAudioFile* audioFile = [[self soundCache] objectForKey: mediaId];
-    NSString* jsString = nil;
-	
-	if (audioFile != nil && audioFile.recorder != nil) {
-		NSLog(@"Stopped recording audio sample '%@'", audioFile.resourcePath);
-		[audioFile.recorder stop];
-        // no callback - that will happen in audioRecorderDidFinishRecording
-	} 
-    // ignore if no media recording
-    if (jsString) {
-        [super writeJavascript:jsString]; 
-    }}
-
-- (void)audioRecorderDidFinishRecording:(AVAudioRecorder*)recorder successfully:(BOOL)flag
-{
-
-	AudioRecorder* aRecorder = (AudioRecorder*)recorder;
-	NSString* mediaId = aRecorder.mediaId;
-	PGAudioFile* audioFile = [[self soundCache] objectForKey: mediaId];
-	NSString* jsString = nil;
-
-	
-	if (audioFile != nil) {
-		NSLog(@"Finished recording audio sample '%@'", audioFile.resourcePath);
-    }
-    if (flag){
-        jsString = [NSString stringWithFormat: @"%@(\"%@\",%d,%d);", @"PhoneGap.Media.onStatus", mediaId, MEDIA_STATE, MEDIA_STOPPED];
-    } else {
-        jsString = [NSString stringWithFormat: @"%@(\"%@\",%d,%@);", @"PhoneGap.Media.onStatus", mediaId, MEDIA_ERROR, [self createMediaErrorWithCode: MEDIA_ERR_DECODE message:nil]];
-    }
-    if (self.avSession) {
-        [self.avSession setActive:NO error:nil];
-    }
-    [super writeJavascript:jsString];
-	
-}
-
-- (void)audioPlayerDidFinishPlaying:(AVAudioPlayer*)player successfully:(BOOL)flag 
-{
-	AudioPlayer* aPlayer = (AudioPlayer*)player;
-	NSString* mediaId = aPlayer.mediaId;
-	PGAudioFile* audioFile = [[self soundCache] objectForKey: mediaId];
-    NSString* jsString = nil;
-		
-	if (audioFile != nil) {
-		NSLog(@"Finished playing audio sample '%@'", audioFile.resourcePath);
-    }
-    if (flag){
-        jsString = [NSString stringWithFormat: @"%@(\"%@\",%d,%d);", @"PhoneGap.Media.onStatus", mediaId, MEDIA_STATE, MEDIA_STOPPED];
-        
-    } else {
-        jsString = [NSString stringWithFormat: @"%@(\"%@\",%d,%@);", @"PhoneGap.Media.onStatus", mediaId, MEDIA_ERROR, [self createMediaErrorWithCode: MEDIA_ERR_DECODE message:nil]];
-        
-    }
-    if (self.avSession) {
-        [self.avSession setActive:NO error:nil];
-    }
-    [super writeJavascript: jsString];
-	
-}
-
-- (void) onMemoryWarning
-{
-	[[self soundCache] removeAllObjects];
-	[self setSoundCache: nil];
-    [self setAvSession: nil];
-	
-	[super onMemoryWarning];
-}
-- (void) dealloc
-{
-    [[self soundCache] removeAllObjects];
-	[self setSoundCache: nil];
-    [self setAvSession: nil];
-    
-    [super dealloc];
-}
-@end
-
-@implementation PGAudioFile
-
-@synthesize resourcePath;
-@synthesize resourceURL;
-@synthesize player;
-#ifdef __IPHONE_3_0
-@synthesize recorder;
-#endif
-
-- (void) dealloc
-{
-	self.resourcePath = nil;
-    self.resourceURL = nil;
-    self.player = nil;
-    self.recorder = nil;
-    
-	[super dealloc];
-}
-
-@end
-@implementation AudioPlayer
-@synthesize mediaId;
-- (void) dealloc
-{
-    self.mediaId = nil;
-	
-	[super dealloc];
-}
-
-@end
-
-@implementation AudioRecorder
-@synthesize mediaId;
-- (void) dealloc
-{
-    self.mediaId = nil;
-	
-	[super dealloc];
-}
-
-@end
-

http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/bcff9559/PhoneGapLib/Classes/UIGapView.h
----------------------------------------------------------------------
diff --git a/PhoneGapLib/Classes/UIGapView.h b/PhoneGapLib/Classes/UIGapView.h
deleted file mode 100644
index 5cdfa4f..0000000
--- a/PhoneGapLib/Classes/UIGapView.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- 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>
-
-
-@interface UIGapView : UIWebView {
-	
-
-}
-
-
-@end

http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/bcff9559/PhoneGapLib/Classes/UIGapView.m
----------------------------------------------------------------------
diff --git a/PhoneGapLib/Classes/UIGapView.m b/PhoneGapLib/Classes/UIGapView.m
deleted file mode 100644
index 2ed7f42..0000000
--- a/PhoneGapLib/Classes/UIGapView.m
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- 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 "UIGapView.h"
-
-
-@implementation UIGapView
-
-
-- (void)loadRequest:(NSURLRequest *)request
-{
-	[super loadRequest:request];
-}
-
-/*
-// Only override drawRect: if you perform custom drawing.
-// An empty implementation adversely affects performance during animation.
-- (void)drawRect:(CGRect)rect {
-    // Drawing code.
-}
-*/
-
-
-
-
-- (void)dealloc {
-    [super dealloc];
-}
-
-
-@end

http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/bcff9559/PhoneGapLib/Makefile
----------------------------------------------------------------------
diff --git a/PhoneGapLib/Makefile b/PhoneGapLib/Makefile
deleted file mode 100644
index e86225e..0000000
--- a/PhoneGapLib/Makefile
+++ /dev/null
@@ -1,70 +0,0 @@
-#
-# 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.
-#
-
-SHELL = /bin/sh
-CHMOD = chmod
-CP = cp
-MV = mv
-NOOP = $(SHELL) -c true
-RM_F = rm -f
-RM_IR = rm -iR
-RM_RF = rm -rf
-TEST_F = test -f
-TOUCH = touch
-UMASK_NULL = umask 0
-DEV_NULL = > /dev/null 2>&1
-MKPATH = mkdir -p
-CAT = cat
-MAKE = make
-OPEN = open
-JAVA = java
-ECHO = echo
-ECHO_N = echo -n
-PG_JS_CORE = javascripts/core
-pgver = $(shell head -1 VERSION)
-
-all :: javascripts/phonegap-$(pgver).js
-
-javascripts/phonegap-$(pgver).js: clean $(PG_JS_CORE)/license.js $(PG_JS_CORE)/phonegap.js.base $(PG_JS_CORE)/acceleration.js $(PG_JS_CORE)/accelerometer.js $(PG_JS_CORE)/battery.js $(PG_JS_CORE)/camera.js $(PG_JS_CORE)/capture.js $(PG_JS_CORE)/contact.js $(PG_JS_CORE)/debugconsole.js $(PG_JS_CORE)/device.js $(PG_JS_CORE)/file.js $(PG_JS_CORE)/filetransfer.js $(PG_JS_CORE)/geolocation.js $(PG_JS_CORE)/compass.js $(PG_JS_CORE)/media.js $(PG_JS_CORE)/notification.js $(PG_JS_CORE)/orientation.js $(PG_JS_CORE)/position.js $(PG_JS_CORE)/sms.js $(PG_JS_CORE)/telephony.js $(PG_JS_CORE)/network.js $(PG_JS_CORE)/splashscreen.js
-	$(RM_F) $@
-	$(CAT) $(PG_JS_CORE)/license.js | sed 's/{VERSION}/$(pgver)/' >> $@
-	$(CAT) $(PG_JS_CORE)/phonegap.js.base >> $@
-	$(CAT) $(PG_JS_CORE)/debugconsole.js >> $@
-	$(CAT) $(PG_JS_CORE)/position.js >> $@
-	$(CAT) $(PG_JS_CORE)/acceleration.js >> $@
-	$(CAT) $(PG_JS_CORE)/accelerometer.js >> $@
-	$(CAT) $(PG_JS_CORE)/battery.js >> $@
-	$(CAT) $(PG_JS_CORE)/camera.js >> $@
-	$(CAT) $(PG_JS_CORE)/device.js >> $@
-	$(CAT) $(PG_JS_CORE)/capture.js >> $@
-	$(CAT) $(PG_JS_CORE)/contact.js >> $@
-	$(CAT) $(PG_JS_CORE)/file.js >> $@
-	$(CAT) $(PG_JS_CORE)/filetransfer.js >> $@
-	$(CAT) $(PG_JS_CORE)/geolocation.js >> $@
-	$(CAT) $(PG_JS_CORE)/compass.js >> $@
-	$(CAT) $(PG_JS_CORE)/media.js >> $@
-	$(CAT) $(PG_JS_CORE)/notification.js >> $@
-	$(CAT) $(PG_JS_CORE)/orientation.js >> $@
-	$(CAT) $(PG_JS_CORE)/sms.js >> $@
-	$(CAT) $(PG_JS_CORE)/telephony.js >> $@
-	$(CAT) $(PG_JS_CORE)/network.js >> $@
-	$(CAT) $(PG_JS_CORE)/splashscreen.js >> $@
-	
-clean:
-	$(RM_F) javascripts/phonegap-*.js
\ No newline at end of file