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
[21/27] Rename PhoneGap to Cordova.
http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/bcff9559/PhoneGapLib/Classes/Location.h
----------------------------------------------------------------------
diff --git a/PhoneGapLib/Classes/Location.h b/PhoneGapLib/Classes/Location.h
deleted file mode 100755
index 128025e..0000000
--- a/PhoneGapLib/Classes/Location.h
+++ /dev/null
@@ -1,91 +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>
-#import <CoreLocation/CoreLocation.h>
-#import "PGPlugin.h"
-
-enum HeadingStatus {
- HEADINGSTOPPED = 0,
- HEADINGSTARTING,
- HEADINGRUNNING,
- HEADINGERROR
-};
-typedef NSUInteger HeadingStatus;
-
-// simple object to keep track of heading information
-@interface PGHeadingData : NSObject {
- HeadingStatus headingStatus;
- BOOL headingRepeats;
- CLHeading* headingInfo;
- NSMutableArray* headingCallbacks;
- NSString* headingFilter;
-
-}
-
-@property (nonatomic, assign) HeadingStatus headingStatus;
-@property (nonatomic, assign) BOOL headingRepeats;
-@property (nonatomic, retain) CLHeading* headingInfo;
-@property (nonatomic, retain) NSMutableArray* headingCallbacks;
-@property (nonatomic, retain) NSString* headingFilter;
-
-@end
-
-@interface PGLocation : PGPlugin <CLLocationManagerDelegate> {
-
- @private BOOL __locationStarted;
- PGHeadingData* headingData;
-}
-
-@property (nonatomic, retain) CLLocationManager *locationManager;
-@property (nonatomic, retain) PGHeadingData* headingData;
-
-
-- (BOOL) hasHeadingSupport;
-
-- (void)startLocation:(NSMutableArray*)arguments
- withDict:(NSMutableDictionary*)options;
-
-- (void)stopLocation:(NSMutableArray*)arguments
- withDict:(NSMutableDictionary*)options;
-
-- (void)locationManager:(CLLocationManager *)manager
- didUpdateToLocation:(CLLocation *)newLocation
- fromLocation:(CLLocation *)oldLocation;
-
-- (void)locationManager:(CLLocationManager *)manager
- didFailWithError:(NSError *)error;
-
-- (BOOL) isLocationServicesEnabled;
-
-- (void)getCurrentHeading:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options;
-- (void)returnHeadingInfo: (NSString*) callbackId keepCallback: (BOOL) bRetain;
-
-- (void)stopHeading:(NSMutableArray*)arguments
- withDict:(NSMutableDictionary*)options;
-- (void) startHeadingWithFilter: (CLLocationDegrees) filter;
-- (void)locationManager:(CLLocationManager *)manager
- didUpdateHeading:(CLHeading *)heading;
-
-- (BOOL)locationManagerShouldDisplayHeadingCalibration:(CLLocationManager *)manager;
-
-@end
-
-
http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/bcff9559/PhoneGapLib/Classes/Location.m
----------------------------------------------------------------------
diff --git a/PhoneGapLib/Classes/Location.m b/PhoneGapLib/Classes/Location.m
deleted file mode 100755
index 05e6bac..0000000
--- a/PhoneGapLib/Classes/Location.m
+++ /dev/null
@@ -1,515 +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 "Location.h"
-#import "PGViewController.h"
-
-#pragma mark Constants
-
-#define kPGLocationErrorDomain @"kPGLocationErrorDomain"
-#define kPGLocationDesiredAccuracyKey @"desiredAccuracy"
-#define kPGLocationForcePromptKey @"forcePrompt"
-#define kPGLocationDistanceFilterKey @"distanceFilter"
-#define kPGLocationFrequencyKey @"frequency"
-
-#pragma mark -
-#pragma mark Categories
-
-@interface NSError(JSONMethods)
-
-- (NSString*) JSONRepresentation;
-
-@end
-
-@interface CLLocation(JSONMethods)
-
-- (NSString*) JSONRepresentation;
-
-@end
-
-
-@interface CLHeading(JSONMethods)
-
-- (NSString*) JSONRepresentation;
-
-@end
-
-#pragma mark -
-#pragma mark PGHeadingData
-
-@implementation PGHeadingData
-
-@synthesize headingStatus, headingRepeats, headingInfo, headingCallbacks, headingFilter;
--(PGHeadingData*) init
-{
- self = (PGHeadingData*)[super init];
- if (self)
- {
- self.headingRepeats = NO;
- self.headingStatus = HEADINGSTOPPED;
- self.headingInfo = nil;
- self.headingCallbacks = nil;
- self.headingFilter = nil;
- }
- return self;
-}
--(void) dealloc
-{
- self.headingInfo = nil;
- self.headingCallbacks = nil;
- self.headingFilter = nil;
- [super dealloc];
-}
-
-@end
-
-#pragma mark -
-#pragma mark PGLocation
-
-@implementation PGLocation
-
-@synthesize locationManager, headingData;
-
-- (PGPlugin*) initWithWebView:(UIWebView*)theWebView
-{
- self = (PGLocation*)[super initWithWebView:(UIWebView*)theWebView];
- if (self)
- {
- self.locationManager = [[[CLLocationManager alloc] init] autorelease];
- self.locationManager.delegate = self; // Tells the location manager to send updates to this object
- __locationStarted = NO;
- self.headingData = nil;
- }
- return self;
-}
-
-- (BOOL) hasHeadingSupport
-{
- BOOL headingInstancePropertyAvailable = [self.locationManager respondsToSelector:@selector(headingAvailable)]; // iOS 3.x
- BOOL headingClassPropertyAvailable = [CLLocationManager respondsToSelector:@selector(headingAvailable)]; // iOS 4.x
-
- if (headingInstancePropertyAvailable) { // iOS 3.x
- return [(id)self.locationManager headingAvailable];
- } else if (headingClassPropertyAvailable) { // iOS 4.x
- return [CLLocationManager headingAvailable];
- } else { // iOS 2.x
- return NO;
- }
-}
-
-- (BOOL) isAuthorized
-{
- BOOL authorizationStatusClassPropertyAvailable = [CLLocationManager respondsToSelector:@selector(authorizationStatus)]; // iOS 4.2+
- if (authorizationStatusClassPropertyAvailable)
- {
- NSUInteger authStatus = [CLLocationManager authorizationStatus];
- return (authStatus == kCLAuthorizationStatusAuthorized) || (authStatus == kCLAuthorizationStatusNotDetermined);
- }
-
- // by default, assume YES (for iOS < 4.2)
- return YES;
-}
-
-- (BOOL) isLocationServicesEnabled
-{
- BOOL locationServicesEnabledInstancePropertyAvailable = [self.locationManager respondsToSelector:@selector(locationServicesEnabled)]; // iOS 3.x
- BOOL locationServicesEnabledClassPropertyAvailable = [CLLocationManager respondsToSelector:@selector(locationServicesEnabled)]; // iOS 4.x
-
- if (locationServicesEnabledClassPropertyAvailable)
- { // iOS 4.x
- return [CLLocationManager locationServicesEnabled];
- }
- else if (locationServicesEnabledInstancePropertyAvailable)
- { // iOS 2.x, iOS 3.x
- return [(id)self.locationManager locationServicesEnabled];
- }
- else
- {
- return NO;
- }
-}
-
-- (void) startLocation:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options
-{
- if (![self isLocationServicesEnabled])
- {
- BOOL forcePrompt = NO;
- // if forcePrompt is true iPhone will still show the "Location Services not active." Settings | Cancel prompt.
- if ([options objectForKey:kPGLocationForcePromptKey])
- {
- forcePrompt = [[options objectForKey:kPGLocationForcePromptKey] boolValue];
- }
-
- if (!forcePrompt)
- {
- NSError* error = [NSError errorWithDomain:kPGLocationErrorDomain code:1 userInfo:
- [NSDictionary dictionaryWithObject:@"Location services is not enabled" forKey:NSLocalizedDescriptionKey]];
- NSLog(@"%@", [error JSONRepresentation]);
-
- NSString* jsCallback = [NSString stringWithFormat:@"navigator.geolocation.setError(%@);", [error JSONRepresentation]];
- [super writeJavascript:jsCallback];
-
- return;
- }
- }
- if (![self isAuthorized])
- {
- NSUInteger code = -1;
- BOOL authStatusAvailable = [CLLocationManager respondsToSelector:@selector(authorizationStatus)]; // iOS 4.2+
- if (authStatusAvailable) {
- code = [CLLocationManager authorizationStatus];
- }
-
- NSError* error = [NSError errorWithDomain:NSCocoaErrorDomain code:code userInfo:
- [NSDictionary dictionaryWithObject:@"App is not authorized for Location Services" forKey:NSLocalizedDescriptionKey]];
- NSLog(@"%@", [error JSONRepresentation]);
-
- NSString* jsCallback = [NSString stringWithFormat:@"navigator.geolocation.setError(%@);", [error JSONRepresentation]];
- [super writeJavascript:jsCallback];
-
- return;
- }
-
- // Tell the location manager to start notifying us of location updates. We
- // first stop, and then start the updating to ensure we get at least one
- // update, even if our location did not change.
- [self.locationManager stopUpdatingLocation];
- [self.locationManager startUpdatingLocation];
- __locationStarted = YES;
-
- if ([options objectForKey:kPGLocationDistanceFilterKey])
- {
- CLLocationDistance distanceFilter = [(NSString *)[options objectForKey:kPGLocationDistanceFilterKey] doubleValue];
- self.locationManager.distanceFilter = distanceFilter;
- }
-
- if ([options objectForKey:kPGLocationDesiredAccuracyKey])
- {
- int desiredAccuracy_num = [(NSString *)[options objectForKey:kPGLocationDesiredAccuracyKey] integerValue];
- CLLocationAccuracy desiredAccuracy = kCLLocationAccuracyBest;
-
- if (desiredAccuracy_num < 10) {
- desiredAccuracy = kCLLocationAccuracyBest;
- }
- else if (desiredAccuracy_num < 100) {
- desiredAccuracy = kCLLocationAccuracyNearestTenMeters;
- }
- else if (desiredAccuracy_num < 1000) {
- desiredAccuracy = kCLLocationAccuracyHundredMeters;
- }
- else if (desiredAccuracy_num < 3000) {
- desiredAccuracy = kCLLocationAccuracyKilometer;
- }
- else {
- desiredAccuracy = kCLLocationAccuracyThreeKilometers;
- }
-
- self.locationManager.desiredAccuracy = desiredAccuracy;
- }
-}
-
-- (void) stopLocation:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options
-{
- if (__locationStarted)
- {
- if (![self isLocationServicesEnabled]) {
- return;
- }
-
- [self.locationManager stopUpdatingLocation];
- __locationStarted = NO;
- }
-}
-
-- (void) locationManager:(CLLocationManager *)manager
- didUpdateToLocation:(CLLocation *)newLocation
- fromLocation:(CLLocation *)oldLocation
-{
-
- NSString* jsCallback = [NSString stringWithFormat:@"navigator.geolocation.setLocation(%@);", [newLocation JSONRepresentation]];
- [super writeJavascript:jsCallback];
-}
-// called to get the current heading
-// Will call location manager to startUpdatingHeading if necessary
-
-- (void)getCurrentHeading:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options
-{
- NSString* callbackId = [arguments objectAtIndex:0];
- NSNumber* repeats = [options valueForKey:@"repeats"]; // indicates this call will be repeated at regular intervals
-
- if ([self hasHeadingSupport] == NO)
- {
- PluginResult* result = [PluginResult resultWithStatus:PGCommandStatus_OK messageToErrorObject:20];
- [super writeJavascript:[result toErrorCallbackString:callbackId]];
- } else {
- // heading retrieval does is not affected by disabling locationServices and authorization of app for location services
- if (!self.headingData) {
- self.headingData = [[[PGHeadingData alloc] init] autorelease];
- }
- PGHeadingData* hData = self.headingData;
-
- if (repeats != nil) {
- hData.headingRepeats = YES;
- }
- if (!hData.headingCallbacks) {
- hData.headingCallbacks = [NSMutableArray arrayWithCapacity:1];
- }
- // add the callbackId into the array so we can call back when get data
- [hData.headingCallbacks addObject:callbackId];
-
- if (hData.headingStatus != HEADINGRUNNING && hData.headingStatus != HEADINGERROR) {
- // Tell the location manager to start notifying us of heading updates
- [self startHeadingWithFilter: 0.2];
- }
- else {
- [self returnHeadingInfo: callbackId keepCallback:NO];
- }
- }
-
-
-}
-// called to request heading updates when heading changes by a certain amount (filter)
-- (void)watchHeadingFilter:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options
-{
- NSString* callbackId = [arguments objectAtIndex:0];
- NSNumber* filter = [options valueForKey:@"filter"];
- PGHeadingData* hData = self.headingData;
- if ([self hasHeadingSupport] == NO) {
- PluginResult* result = [PluginResult resultWithStatus:PGCommandStatus_OK messageToErrorObject:20];
- [super writeJavascript:[result toErrorCallbackString:callbackId]];
- } else {
- if (!hData) {
- self.headingData = [[[PGHeadingData alloc] init] autorelease];
- hData = self.headingData;
- }
- if (hData.headingStatus != HEADINGRUNNING) {
- // Tell the location manager to start notifying us of heading updates
- [self startHeadingWithFilter: [filter doubleValue]];
- } else {
- // if already running check to see if due to existing watch filter
- if (hData.headingFilter && ![hData.headingFilter isEqualToString:callbackId]){
- // new watch filter being specified
- // send heading data one last time to clear old successCallback
- [self returnHeadingInfo:hData.headingFilter keepCallback: NO];
- }
-
- }
- // save the new filter callback and update the headingFilter setting
- hData.headingFilter = callbackId;
- // check if need to stop and restart in order to change value???
- self.locationManager.headingFilter = [filter doubleValue];
- }
-}
-- (void)returnHeadingInfo: (NSString*) callbackId keepCallback: (BOOL) bRetain
-{
- PluginResult* result = nil;
- NSString* jsString = nil;
- PGHeadingData* hData = self.headingData;
-
- if (hData && hData.headingStatus == HEADINGERROR) {
- // return error
- result = [PluginResult resultWithStatus:PGCommandStatus_OK messageToErrorObject:0];
- jsString = [result toErrorCallbackString:callbackId];
- } else if (hData && hData.headingStatus == HEADINGRUNNING && hData.headingInfo) {
- // if there is heading info, return it
- CLHeading* hInfo = hData.headingInfo;
- NSMutableDictionary* returnInfo = [NSMutableDictionary dictionaryWithCapacity:4];
- NSNumber* timestamp = [NSNumber numberWithDouble:([hInfo.timestamp timeIntervalSince1970]*1000)];
- [returnInfo setObject:timestamp forKey:@"timestamp"];
- [returnInfo setObject:[NSNumber numberWithDouble: hInfo.magneticHeading] forKey:@"magneticHeading"];
- id trueHeading = __locationStarted ? (id)[NSNumber numberWithDouble:hInfo.trueHeading]:(id)[NSNull null];
- [returnInfo setObject:trueHeading forKey:@"trueHeading"];
- [returnInfo setObject:[NSNumber numberWithDouble: hInfo.headingAccuracy] forKey:@"headingAccuracy"];
-
- result = [PluginResult resultWithStatus:PGCommandStatus_OK messageAsDictionary: returnInfo];
- [result setKeepCallbackAsBool:bRetain];
-
- jsString = [result toSuccessCallbackString:callbackId];
- }
- if (jsString) {
- [super writeJavascript:jsString];
- }
-
-
-}
-
-- (void) stopHeading:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options
-{
- PGHeadingData* hData = self.headingData;
- if (hData && hData.headingStatus != HEADINGSTOPPED)
- {
- if (hData.headingFilter) {
- // callback one last time to clear callback
- [self returnHeadingInfo:hData.headingFilter keepCallback:NO];
- hData.headingFilter = nil;
- }
- [self.locationManager stopUpdatingHeading];
- self.headingData = nil;
- }
-}
-
-
-// helper method to check the orientation and start updating headings
-- (void) startHeadingWithFilter: (CLLocationDegrees) filter
-{
- if ([self.locationManager respondsToSelector: @selector(headingOrientation)]) {
- UIDeviceOrientation currentOrientation = [[UIDevice currentDevice] orientation];
- if (currentOrientation != UIDeviceOrientationUnknown) {
- PGViewController* pgViewController = (PGViewController*)self.viewController;
-
- if ([pgViewController.supportedOrientations containsObject:
- [NSNumber numberWithInt:currentOrientation]]) {
-
- self.locationManager.headingOrientation = (CLDeviceOrientation)currentOrientation;
- // FYI UIDeviceOrientation and CLDeviceOrientation enums are currently the same
- }
- }
- }
- self.locationManager.headingFilter = filter;
- [self.locationManager startUpdatingHeading];
- self.headingData.headingStatus = HEADINGSTARTING;
-}
-- (BOOL)locationManagerShouldDisplayHeadingCalibration:(CLLocationManager *)manager
-{
- return YES;
-}
-
-- (void) locationManager:(CLLocationManager *)manager
- didUpdateHeading:(CLHeading *)heading
-{
- PGHeadingData* hData = self.headingData;
- // save the data for next call into getHeadingData
- hData.headingInfo = heading;
-
- if (hData.headingStatus == HEADINGSTARTING) {
- hData.headingStatus = HEADINGRUNNING; // so returnHeading info will work
- //this is the first update
- for (NSString* callbackId in hData.headingCallbacks) {
- [self returnHeadingInfo:callbackId keepCallback:NO];
- }
- [hData.headingCallbacks removeAllObjects];
- if (!hData.headingRepeats && !hData.headingFilter) {
- [self stopHeading:nil withDict:nil];
- }
- }
- if (hData.headingFilter) {
- [self returnHeadingInfo: hData.headingFilter keepCallback:YES];
- }
- hData.headingStatus = HEADINGRUNNING; // to clear any error
-
-}
-- (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error
-{
- NSLog(@"locationManager::didFailWithError %@", [error localizedFailureReason]);
- NSString* jsCallback = @"";
-
- // Compass Error
- if ([error code] == kCLErrorHeadingFailure)
- {
- PGHeadingData* hData = self.headingData;
- if (hData) {
- if (hData.headingStatus == HEADINGSTARTING) {
- // heading error during startup - report error
- for (NSString* callbackId in hData.headingCallbacks) {
- PluginResult* result = [PluginResult resultWithStatus:PGCommandStatus_OK messageToErrorObject:0];
- [super writeJavascript: [result toErrorCallbackString:callbackId]];
- }
- [hData.headingCallbacks removeAllObjects];
- } // else for frequency watches next call to getCurrentHeading will report error
- else if (hData.headingFilter) {
- PluginResult* resultFilter = [PluginResult resultWithStatus:PGCommandStatus_OK messageToErrorObject:0];
- [super writeJavascript: [resultFilter toErrorCallbackString:hData.headingFilter]];
- }
- hData.headingStatus = HEADINGERROR;
- }
- }
- // Location Error
- else
- {
- /*
- W3C PositionError
- PositionError.UNKNOWN_ERROR = 0; // equivalent to kCLErrorLocationUnknown=0
- PositionError.PERMISSION_DENIED = 1; // equivalent to kCLErrorDenied=1
- PositionError.POSITION_UNAVAILABLE = 2; // equivalent to kCLErrorNetwork=2
-
- (any other errors are translated to PositionError.UNKNOWN_ERROR)
- */
- if (error.code > kCLErrorNetwork) {
- error = [NSError errorWithDomain:error.domain code:kCLErrorLocationUnknown userInfo:error.userInfo];
- }
-
- jsCallback = [NSString stringWithFormat:@"navigator.geolocation.setError(%@);", [error JSONRepresentation]];
- }
-
- [super writeJavascript:jsCallback];
-
- [self.locationManager stopUpdatingLocation];
- __locationStarted = NO;
-}
-
-- (void) dealloc
-{
- self.locationManager.delegate = nil;
- self.locationManager = nil;
- self.headingData = nil;
- [super dealloc];
-}
-
-@end
-
-#pragma mark -
-#pragma mark CLLocation(JSONMethods)
-
-@implementation CLLocation(JSONMethods)
-
-- (NSString*) JSONRepresentation
-{
- return [NSString stringWithFormat:
- @"{ timestamp: %.00f, \
- coords: { latitude: %f, longitude: %f, altitude: %.02f, heading: %.02f, speed: %.02f, accuracy: %.02f, altitudeAccuracy: %.02f } \
- }",
- [self.timestamp timeIntervalSince1970] * 1000.0,
- self.coordinate.latitude,
- self.coordinate.longitude,
- self.altitude,
- self.course,
- self.speed,
- self.horizontalAccuracy,
- self.verticalAccuracy
- ];
-}
-
-@end
-
-
-#pragma mark NSError(JSONMethods)
-
-@implementation NSError(JSONMethods)
-
-- (NSString*) JSONRepresentation
-{
- return [NSString stringWithFormat:
- @"{ code: %d, message: '%@'}",
- self.code,
- [self localizedDescription]
- ];
-}
-
-@end
http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/bcff9559/PhoneGapLib/Classes/NSData+Base64.h
----------------------------------------------------------------------
diff --git a/PhoneGapLib/Classes/NSData+Base64.h b/PhoneGapLib/Classes/NSData+Base64.h
deleted file mode 100644
index eb1ff48..0000000
--- a/PhoneGapLib/Classes/NSData+Base64.h
+++ /dev/null
@@ -1,33 +0,0 @@
-//
-// NSData+Base64.h
-// base64
-//
-// Created by Matt Gallagher on 2009/06/03.
-// Copyright 2009 Matt Gallagher. All rights reserved.
-//
-// Permission is given to use this source code file, free of charge, in any
-// project, commercial or otherwise, entirely at your risk, with the condition
-// that any redistribution (in part or whole) of source code must retain
-// this copyright and permission notice. Attribution in compiled projects is
-// appreciated but not required.
-//
-
-#import <Foundation/Foundation.h>
-
-void *NewBase64Decode(
- const char *inputBuffer,
- size_t length,
- size_t *outputLength);
-
-char *NewBase64Encode(
- const void *inputBuffer,
- size_t length,
- bool separateLines,
- size_t *outputLength);
-
-@interface NSData (Base64)
-
-+ (NSData *)dataFromBase64String:(NSString *)aString;
-- (NSString *)base64EncodedString;
-
-@end
http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/bcff9559/PhoneGapLib/Classes/NSData+Base64.m
----------------------------------------------------------------------
diff --git a/PhoneGapLib/Classes/NSData+Base64.m b/PhoneGapLib/Classes/NSData+Base64.m
deleted file mode 100644
index 13f828d..0000000
--- a/PhoneGapLib/Classes/NSData+Base64.m
+++ /dev/null
@@ -1,299 +0,0 @@
-//
-// NSData+Base64.m
-// base64
-//
-// Created by Matt Gallagher on 2009/06/03.
-// Copyright 2009 Matt Gallagher. All rights reserved.
-//
-// Permission is given to use this source code file, free of charge, in any
-// project, commercial or otherwise, entirely at your risk, with the condition
-// that any redistribution (in part or whole) of source code must retain
-// this copyright and permission notice. Attribution in compiled projects is
-// appreciated but not required.
-//
-
-#import "NSData+Base64.h"
-
-//
-// Mapping from 6 bit pattern to ASCII character.
-//
-static unsigned char base64EncodeLookup[65] =
- "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
-
-//
-// Definition for "masked-out" areas of the base64DecodeLookup mapping
-//
-#define xx 65
-
-//
-// Mapping from ASCII character to 6 bit pattern.
-//
-static unsigned char base64DecodeLookup[256] =
-{
- xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx,
- xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx,
- xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, 62, xx, xx, xx, 63,
- 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, xx, xx, xx, xx, xx, xx,
- xx, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
- 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, xx, xx, xx, xx, xx,
- xx, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
- 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, xx, xx, xx, xx, xx,
- xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx,
- xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx,
- xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx,
- xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx,
- xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx,
- xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx,
- xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx,
- xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx,
-};
-
-//
-// Fundamental sizes of the binary and base64 encode/decode units in bytes
-//
-#define BINARY_UNIT_SIZE 3
-#define BASE64_UNIT_SIZE 4
-
-//
-// NewBase64Decode
-//
-// Decodes the base64 ASCII string in the inputBuffer to a newly malloced
-// output buffer.
-//
-// inputBuffer - the source ASCII string for the decode
-// length - the length of the string or -1 (to specify strlen should be used)
-// outputLength - if not-NULL, on output will contain the decoded length
-//
-// returns the decoded buffer. Must be free'd by caller. Length is given by
-// outputLength.
-//
-void *NewBase64Decode(
- const char *inputBuffer,
- size_t length,
- size_t *outputLength)
-{
- if (length == -1)
- {
- length = strlen(inputBuffer);
- }
-
- size_t outputBufferSize = (length / BASE64_UNIT_SIZE) * BINARY_UNIT_SIZE;
- unsigned char *outputBuffer = (unsigned char *)malloc(outputBufferSize);
-
- size_t i = 0;
- size_t j = 0;
- while (i < length)
- {
- //
- // Accumulate 4 valid characters (ignore everything else)
- //
- unsigned char accumulated[BASE64_UNIT_SIZE];
- bzero(accumulated, sizeof(unsigned char) * BASE64_UNIT_SIZE);
- size_t accumulateIndex = 0;
- while (i < length)
- {
- unsigned char decode = base64DecodeLookup[inputBuffer[i++]];
- if (decode != xx)
- {
- accumulated[accumulateIndex] = decode;
- accumulateIndex++;
-
- if (accumulateIndex == BASE64_UNIT_SIZE)
- {
- break;
- }
- }
- }
-
- //
- // Store the 6 bits from each of the 4 characters as 3 bytes
- //
- outputBuffer[j] = (accumulated[0] << 2) | (accumulated[1] >> 4);
- outputBuffer[j + 1] = (accumulated[1] << 4) | (accumulated[2] >> 2);
- outputBuffer[j + 2] = (accumulated[2] << 6) | accumulated[3];
- j += accumulateIndex - 1;
- }
-
- if (outputLength)
- {
- *outputLength = j;
- }
- return outputBuffer;
-}
-
-//
-// NewBase64Decode
-//
-// Encodes the arbitrary data in the inputBuffer as base64 into a newly malloced
-// output buffer.
-//
-// inputBuffer - the source data for the encode
-// length - the length of the input in bytes
-// separateLines - if zero, no CR/LF characters will be added. Otherwise
-// a CR/LF pair will be added every 64 encoded chars.
-// outputLength - if not-NULL, on output will contain the encoded length
-// (not including terminating 0 char)
-//
-// returns the encoded buffer. Must be free'd by caller. Length is given by
-// outputLength.
-//
-char *NewBase64Encode(
- const void *buffer,
- size_t length,
- bool separateLines,
- size_t *outputLength)
-{
- const unsigned char *inputBuffer = (const unsigned char *)buffer;
-
- #define MAX_NUM_PADDING_CHARS 2
- #define OUTPUT_LINE_LENGTH 64
- #define INPUT_LINE_LENGTH ((OUTPUT_LINE_LENGTH / BASE64_UNIT_SIZE) * BINARY_UNIT_SIZE)
- #define CR_LF_SIZE 0
-
- //
- // Byte accurate calculation of final buffer size
- //
- size_t outputBufferSize =
- ((length / BINARY_UNIT_SIZE)
- + ((length % BINARY_UNIT_SIZE) ? 1 : 0))
- * BASE64_UNIT_SIZE;
- if (separateLines)
- {
- outputBufferSize +=
- (outputBufferSize / OUTPUT_LINE_LENGTH) * CR_LF_SIZE;
- }
-
- //
- // Include space for a terminating zero
- //
- outputBufferSize += 1;
-
- //
- // Allocate the output buffer
- //
- char *outputBuffer = (char *)malloc(outputBufferSize);
- if (!outputBuffer)
- {
- return NULL;
- }
-
- size_t i = 0;
- size_t j = 0;
- const size_t lineLength = separateLines ? INPUT_LINE_LENGTH : length;
- size_t lineEnd = lineLength;
-
- while (true)
- {
- if (lineEnd > length)
- {
- lineEnd = length;
- }
-
- for (; i + BINARY_UNIT_SIZE - 1 < lineEnd; i += BINARY_UNIT_SIZE)
- {
- //
- // Inner loop: turn 48 bytes into 64 base64 characters
- //
- outputBuffer[j++] = base64EncodeLookup[(inputBuffer[i] & 0xFC) >> 2];
- outputBuffer[j++] = base64EncodeLookup[((inputBuffer[i] & 0x03) << 4)
- | ((inputBuffer[i + 1] & 0xF0) >> 4)];
- outputBuffer[j++] = base64EncodeLookup[((inputBuffer[i + 1] & 0x0F) << 2)
- | ((inputBuffer[i + 2] & 0xC0) >> 6)];
- outputBuffer[j++] = base64EncodeLookup[inputBuffer[i + 2] & 0x3F];
- }
-
- if (lineEnd == length)
- {
- break;
- }
-
- //
- // Add the newline
- //
- //outputBuffer[j++] = '\r';
- //outputBuffer[j++] = '\n';
- lineEnd += lineLength;
- }
-
- if (i + 1 < length)
- {
- //
- // Handle the single '=' case
- //
- outputBuffer[j++] = base64EncodeLookup[(inputBuffer[i] & 0xFC) >> 2];
- outputBuffer[j++] = base64EncodeLookup[((inputBuffer[i] & 0x03) << 4)
- | ((inputBuffer[i + 1] & 0xF0) >> 4)];
- outputBuffer[j++] = base64EncodeLookup[(inputBuffer[i + 1] & 0x0F) << 2];
- outputBuffer[j++] = '=';
- }
- else if (i < length)
- {
- //
- // Handle the double '=' case
- //
- outputBuffer[j++] = base64EncodeLookup[(inputBuffer[i] & 0xFC) >> 2];
- outputBuffer[j++] = base64EncodeLookup[(inputBuffer[i] & 0x03) << 4];
- outputBuffer[j++] = '=';
- outputBuffer[j++] = '=';
- }
- outputBuffer[j] = 0;
-
- //
- // Set the output length and return the buffer
- //
- if (outputLength)
- {
- *outputLength = j;
- }
- return outputBuffer;
-}
-
-@implementation NSData (Base64)
-
-//
-// dataFromBase64String:
-//
-// Creates an NSData object containing the base64 decoded representation of
-// the base64 string 'aString'
-//
-// Parameters:
-// aString - the base64 string to decode
-//
-// returns the autoreleased NSData representation of the base64 string
-//
-+ (NSData *)dataFromBase64String:(NSString *)aString
-{
- NSData *data = [aString dataUsingEncoding:NSASCIIStringEncoding];
- size_t outputLength;
- void *outputBuffer = NewBase64Decode([data bytes], [data length], &outputLength);
- NSData *result = [NSData dataWithBytes:outputBuffer length:outputLength];
- free(outputBuffer);
- return result;
-}
-
-//
-// base64EncodedString
-//
-// Creates an NSString object that contains the base 64 encoding of the
-// receiver's data. Lines are broken at 64 characters long.
-//
-// returns an autoreleased NSString being the base 64 representation of the
-// receiver.
-//
-- (NSString *)base64EncodedString
-{
- size_t outputLength;
- char *outputBuffer =
- NewBase64Encode([self bytes], [self length], true, &outputLength);
-
- NSString *result =
- [[[NSString alloc]
- initWithBytes:outputBuffer
- length:outputLength
- encoding:NSASCIIStringEncoding]
- autorelease];
- free(outputBuffer);
- return result;
-}
-
-@end
http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/bcff9559/PhoneGapLib/Classes/NSDictionary+LowercaseKeys.h
----------------------------------------------------------------------
diff --git a/PhoneGapLib/Classes/NSDictionary+LowercaseKeys.h b/PhoneGapLib/Classes/NSDictionary+LowercaseKeys.h
deleted file mode 100644
index 77e648c..0000000
--- a/PhoneGapLib/Classes/NSDictionary+LowercaseKeys.h
+++ /dev/null
@@ -1,14 +0,0 @@
-//
-// NSDictionary+LowercaseKeys.h
-// PhoneGapLib
-//
-// Created by Shazron Abdullah on 12-01-17.
-//
-
-#import <Foundation/Foundation.h>
-
-@interface NSDictionary (LowercaseKeys)
-
-- (NSDictionary*) dictionaryWithLowercaseKeys;
-
-@end
http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/bcff9559/PhoneGapLib/Classes/NSDictionary+LowercaseKeys.m
----------------------------------------------------------------------
diff --git a/PhoneGapLib/Classes/NSDictionary+LowercaseKeys.m b/PhoneGapLib/Classes/NSDictionary+LowercaseKeys.m
deleted file mode 100644
index f6bcc50..0000000
--- a/PhoneGapLib/Classes/NSDictionary+LowercaseKeys.m
+++ /dev/null
@@ -1,25 +0,0 @@
-//
-// NSDictionary+LowercaseKeys.m
-// PhoneGapLib
-//
-// Created by Shazron Abdullah on 12-01-17.
-
-#import "NSDictionary+LowercaseKeys.h"
-
-#pragma mark -
-
-@implementation NSDictionary (LowercaseKeys)
-
-- (NSDictionary*) dictionaryWithLowercaseKeys
-{
- NSMutableDictionary* result = [NSMutableDictionary dictionaryWithCapacity:self.count];
- NSString* key;
-
- for (key in self) {
- [result setObject:[self objectForKey:key] forKey:[key lowercaseString]];
- }
-
- return result;
-}
-
-@end
http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/bcff9559/PhoneGapLib/Classes/NSMutableArray+QueueAdditions.h
----------------------------------------------------------------------
diff --git a/PhoneGapLib/Classes/NSMutableArray+QueueAdditions.h b/PhoneGapLib/Classes/NSMutableArray+QueueAdditions.h
deleted file mode 100755
index e86632e..0000000
--- a/PhoneGapLib/Classes/NSMutableArray+QueueAdditions.h
+++ /dev/null
@@ -1,30 +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>
-
-
-@interface NSMutableArray (QueueAdditions)
-
-- (id) pop;
-- (id) queueHead;
-- (id) dequeue;
-- (void) enqueue:(id)obj;
-
-@end
http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/bcff9559/PhoneGapLib/Classes/NSMutableArray+QueueAdditions.m
----------------------------------------------------------------------
diff --git a/PhoneGapLib/Classes/NSMutableArray+QueueAdditions.m b/PhoneGapLib/Classes/NSMutableArray+QueueAdditions.m
deleted file mode 100755
index c2736f0..0000000
--- a/PhoneGapLib/Classes/NSMutableArray+QueueAdditions.m
+++ /dev/null
@@ -1,58 +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 "NSMutableArray+QueueAdditions.h"
-
-@implementation NSMutableArray (QueueAdditions)
-
-- (id) queueHead
-{
- if ([self count] == 0) {
- return nil;
- }
-
- return [self objectAtIndex:0];
-}
-
-- (id) dequeue
-{
- if ([self count] == 0) {
- return nil;
- }
-
- id head = [self objectAtIndex:0];
- if (head != nil) {
- [[head retain] autorelease];
- [self removeObjectAtIndex:0];
- }
-
- return head;
-}
-
-- (id) pop
-{
- return [self dequeue];
-}
-
-- (void) enqueue:(id)object
-{
- [self addObject:object];
-}
-
-@end
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/bcff9559/PhoneGapLib/Classes/Notification.h
----------------------------------------------------------------------
diff --git a/PhoneGapLib/Classes/Notification.h b/PhoneGapLib/Classes/Notification.h
deleted file mode 100644
index dd5614f..0000000
--- a/PhoneGapLib/Classes/Notification.h
+++ /dev/null
@@ -1,41 +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 <UIKit/UIKit.h>
-#import <AudioToolbox/AudioServices.h>
-#import "PGPlugin.h"
-
-@interface PGNotification : PGPlugin <UIAlertViewDelegate>{
-}
-
-- (void)alert:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options; // confirm is just a variant of alert
-- (void)vibrate:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options;
-
-@end
-
-@interface PGAlertView : UIAlertView {
- NSString* callBackId;
-}
-@property(nonatomic, retain) NSString* callbackId;
-
--(void) dealloc;
-
-@end
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/bcff9559/PhoneGapLib/Classes/Notification.m
----------------------------------------------------------------------
diff --git a/PhoneGapLib/Classes/Notification.m b/PhoneGapLib/Classes/Notification.m
deleted file mode 100644
index f04a1f4..0000000
--- a/PhoneGapLib/Classes/Notification.m
+++ /dev/null
@@ -1,117 +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 "Notification.h"
-#import "Categories.h"
-
-
-@implementation PGNotification
-
-
-- (void)alert:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options
-{
- NSString* callbackId = [arguments objectAtIndex:0];
- NSString* message = [arguments objectAtIndex:1];
- NSString* title = [options objectForKey:@"title"];
- NSString* button = [options objectForKey:@"buttonLabel"];
-
- if (!title)
- title = @"Alert";
- if (!button)
- button = @"OK";
-
- PGAlertView *alertView = [[PGAlertView alloc]
- initWithTitle:title
- message:message
- delegate:self
- cancelButtonTitle:nil
- otherButtonTitles:nil];
-
- [alertView setCallbackId:callbackId];
- NSArray* labels = [ button componentsSeparatedByString:@","];
-
- int count = [ labels count ];
-
- for(int n = 0; n < count; n++)
- {
- [ alertView addButtonWithTitle:[labels objectAtIndex:n]];
- }
-
- [alertView show];
- [alertView release];
-}
-
-
-- (void)prompt:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options
-{
- NSString* callbackId = [arguments objectAtIndex:0];
- NSString* message = [arguments objectAtIndex:1];
- NSString* title = [options objectForKey:@"title"];
- NSString* button = [options objectForKey:@"buttonLabel"];
-
- if (!title)
- title = @"Alert";
- if (!button)
- button = @"OK";
-
- PGAlertView *openURLAlert = [[PGAlertView alloc]
- initWithTitle:title
- message:message delegate:self cancelButtonTitle:button otherButtonTitles:nil];
- [openURLAlert setCallbackId: callbackId];
- [openURLAlert show];
- [openURLAlert release];
-}
-
-/**
- Callback invoked when an alert dialog's buttons are clicked.
- Passes the index + label back to JS
- */
-
-- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
-{
- //NSString *buttonLabel = [alertView buttonTitleAtIndex:buttonIndex];
-
- PGAlertView* pgAlertView = (PGAlertView*) alertView;
- PluginResult* result = [PluginResult resultWithStatus: PGCommandStatus_OK messageAsInt: ++buttonIndex];
- [self writeJavascript:[result toSuccessCallbackString: [pgAlertView callbackId]]];
- //NSString * jsCallBack = [NSString stringWithFormat:@"navigator.notification._alertCallback(%d,\"%@\");", ++buttonIndex, buttonLabel];
- //[webView stringByEvaluatingJavaScriptFromString:jsCallBack];
-}
-
-- (void)vibrate:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options
-{
- AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
-}
-
-@end
-
-@implementation PGAlertView
-@synthesize callbackId;
-
-- (void) dealloc
-{
- if (callbackId) {
- [callbackId release];
- }
-
-
- [super dealloc];
-}
-@end
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/bcff9559/PhoneGapLib/Classes/PGCommandDelegate.h
----------------------------------------------------------------------
diff --git a/PhoneGapLib/Classes/PGCommandDelegate.h b/PhoneGapLib/Classes/PGCommandDelegate.h
deleted file mode 100644
index 6d1f4e4..0000000
--- a/PhoneGapLib/Classes/PGCommandDelegate.h
+++ /dev/null
@@ -1,28 +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 "InvokedUrlCommand.h"
-
-@protocol PGCommandDelegate <NSObject>
-
-- (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/bcff9559/PhoneGapLib/Classes/PGDebug.h
----------------------------------------------------------------------
diff --git a/PhoneGapLib/Classes/PGDebug.h b/PhoneGapLib/Classes/PGDebug.h
deleted file mode 100644
index 78e7778..0000000
--- a/PhoneGapLib/Classes/PGDebug.h
+++ /dev/null
@@ -1,25 +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.
- */
-
-#ifdef DEBUG
-# define DLog(...) NSLog(__VA_ARGS__)
-#else
-# define DLog(...) /* */
-#endif
-#define ALog(...) NSLog(__VA_ARGS__)
http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/bcff9559/PhoneGapLib/Classes/PGMotion.h
----------------------------------------------------------------------
diff --git a/PhoneGapLib/Classes/PGMotion.h b/PhoneGapLib/Classes/PGMotion.h
deleted file mode 100644
index 47cc2af..0000000
--- a/PhoneGapLib/Classes/PGMotion.h
+++ /dev/null
@@ -1,36 +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 "PGPlugin.h"
-
-
-@interface PGMotion : PGPlugin {
-}
-
-@property (readonly, getter=isDeviceMotionAvailable) BOOL deviceMotionAvailable;
-@property (readonly, getter=isDeviceOrientationAvailable) BOOL deviceOrientationAvailable;
-
-
-/* Checks whether the DeviceMotionEvent is available in the UIWebView */
-- (BOOL) deviceMotionAvailable;
-/* Checks whether the DeviceOrientationEvent is available in the UIWebView */
-- (BOOL) deviceOrientationAvailable;
-
-@end
http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/bcff9559/PhoneGapLib/Classes/PGMotion.m
----------------------------------------------------------------------
diff --git a/PhoneGapLib/Classes/PGMotion.m b/PhoneGapLib/Classes/PGMotion.m
deleted file mode 100644
index 80ad9e7..0000000
--- a/PhoneGapLib/Classes/PGMotion.m
+++ /dev/null
@@ -1,78 +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 "PGMotion.h"
-
-@implementation PGMotion
-
-@synthesize deviceMotionAvailable, deviceOrientationAvailable;
-
-- (void) startDeviceMotionEvents
-{
- // TODO: all iOS devices have accelerometers. Barring a way to detect if any listeners are bound,
- // we will have to flood the UIWebView with these events
- // If !isDeviceMotionAvailable, we pump out the events
-}
-
-- (void) startDeviceOrientationEvents
-{
- // TODO: currently only iPhone 4 has support for gyro. We would only need to fill in support for iOS 4.0 and 4.1
- // (since the DeviceOrientationEvent is supported in in 4.2 for UIWebView)
- // If gyro is available (see CMMotionManagerin CoreMotion.framework) AND !isDeviceOrientationAvailable, we pump out the events
-}
-
-- (PGPlugin*) initWithWebView:(UIWebView*)theWebView
-{
- self = (PGMotion*)[super initWithWebView:theWebView];
- if (self) {
- // this class has to be created somewhere for it to pump out events,
- // perhaps in the AppDelegate
- if (self.isDeviceMotionAvailable) {
- [self startDeviceMotionEvents];
- }
- if (self.isDeviceOrientationAvailable) {
- [self startDeviceOrientationEvents];
- }
- }
- return self;
-}
-
-- (BOOL) deviceMotionAvailable
-{
- NSString* js = @"window.DeviceMotionEvent != undefined";
- NSString* result = [self.webView stringByEvaluatingJavaScriptFromString:js];
-
- return [result isEqualToString:@"true"];
-}
-
-- (BOOL) deviceOrientationAvailable
-{
- NSString* js = @"window.DeviceOrientationEvent != undefined";
- NSString* result = [self.webView stringByEvaluatingJavaScriptFromString:js];
-
- return [result isEqualToString:@"true"];
-}
-
-- (void)dealloc
-{
- [super dealloc];
-}
-
-@end
http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/bcff9559/PhoneGapLib/Classes/PGPlugin.h
----------------------------------------------------------------------
diff --git a/PhoneGapLib/Classes/PGPlugin.h b/PhoneGapLib/Classes/PGPlugin.h
deleted file mode 100644
index 652e03e..0000000
--- a/PhoneGapLib/Classes/PGPlugin.h
+++ /dev/null
@@ -1,65 +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 <UIKit/UIKit.h>
-#import "PluginResult.h"
-#import "NSMutableArray+QueueAdditions.h"
-#import "PGCommandDelegate.h"
-
-#define PGPluginHandleOpenURLNotification @"PGPluginHandleOpenURLNotification"
-
-#define VERIFY_ARGUMENTS(args, expectedCount, callbackId) if (![self verifyArguments:args withExpectedCount:expectedCount andCallbackId:callbackId \
-callerFileName:__FILE__ callerFunctionName:__PRETTY_FUNCTION__]) { return; }
-
-
-@interface PGPlugin : NSObject {
-}
-
-@property (nonatomic, retain) UIWebView* webView;
-@property (nonatomic, retain) NSDictionary* settings;
-@property (nonatomic, retain) UIViewController* viewController;
-@property (nonatomic, retain) id<PGCommandDelegate> commandDelegate;
-
-- (PGPlugin*) initWithWebView:(UIWebView*)theWebView settings:(NSDictionary*)classSettings;
-- (PGPlugin*) initWithWebView:(UIWebView*)theWebView;
-
-- (void) handleOpenURL:(NSNotification*)notification;
-- (void) onAppTerminate;
-- (void) onMemoryWarning;
-
-/*
- // see initWithWebView implementation
- - (void) onPause {}
- - (void) onResume {}
- - (void) onOrientationWillChange {}
- - (void) onOrientationDidChange {}
- */
-
-- (id) appDelegate;
-- (UIViewController*) appViewController __attribute__((deprecated)); /* just use the .viewController property in the future */
-
-- (NSString*) writeJavascript:(NSString*)javascript;
-- (NSString*) success:(PluginResult*)pluginResult callbackId:(NSString*)callbackId;
-- (NSString*) error:(PluginResult*)pluginResult callbackId:(NSString*)callbackId;
-
-- (BOOL) verifyArguments:(NSMutableArray*)arguments withExpectedCount:(NSUInteger)expectedCount andCallbackId:(NSString*)callbackId
- callerFileName:(const char*)callerFileName callerFunctionName:(const char*)callerFunctionName;
-
-@end
http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/bcff9559/PhoneGapLib/Classes/PGPlugin.m
----------------------------------------------------------------------
diff --git a/PhoneGapLib/Classes/PGPlugin.m b/PhoneGapLib/Classes/PGPlugin.m
deleted file mode 100644
index 189cd56..0000000
--- a/PhoneGapLib/Classes/PGPlugin.m
+++ /dev/null
@@ -1,161 +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 "PGPlugin.h"
-
-
-@implementation PGPlugin
-@synthesize webView, settings, viewController, commandDelegate;
-
-
-- (PGPlugin*) initWithWebView:(UIWebView*)theWebView settings:(NSDictionary*)classSettings
-{
- self = [self initWithWebView:theWebView];
- if (self) {
- self.settings = classSettings;
- }
- return self;
-}
-
-- (PGPlugin*) initWithWebView:(UIWebView*)theWebView
-{
- self = [super init];
- if (self) {
- [[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:PGPluginHandleOpenURLNotification object:nil];
-
- self.webView = theWebView;
-
- // You can listen to more app notifications, see:
- // http://developer.apple.com/library/ios/#DOCUMENTATION/UIKit/Reference/UIApplication_Class/Reference/Reference.html#//apple_ref/doc/uid/TP40006728-CH3-DontLinkElementID_4
- /*
- // NOTE: if you want to use these, make sure you uncomment the corresponding notification handler, and also the removeObserver in dealloc
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onPause) name:UIApplicationDidEnterBackgroundNotification object:nil];
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onResume) name:UIApplicationWillEnterForegroundNotification object:nil];
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onOrientationWillChange) name:UIApplicationWillChangeStatusBarOrientationNotification object:nil];
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onOrientationDidChange) name:UIApplicationDidChangeStatusBarOrientationNotification object:nil];
- */
- }
- return self;
-}
-
-/*
- The arguments passed in should not included the callbackId.
- If argument count is not as expected, it will call the error callback using PluginResult (if callbackId is available),
- or it will write to stderr using NSLog.
-
- Usage is through the VERIFY_ARGUMENTS macro.
- */
-- (BOOL) verifyArguments:(NSMutableArray*)arguments withExpectedCount:(NSUInteger)expectedCount andCallbackId:(NSString*)callbackId
- callerFileName:(const char*)callerFileName callerFunctionName:(const char*)callerFunctionName
-{
- NSUInteger argc = [arguments count];
- BOOL ok = (argc >= expectedCount); // allow for optional arguments
-
- if (!ok) {
- NSString* errorString = [NSString stringWithFormat:@"Incorrect no. of arguments for plugin: was %d, expected %d", argc, expectedCount];
- if (callbackId) {
- NSString* callbackId = [arguments objectAtIndex:0];
- PluginResult* pluginResult = [PluginResult resultWithStatus:PGCommandStatus_ERROR messageAsString:errorString];
- [self writeJavascript:[pluginResult toErrorCallbackString:callbackId]];
- } else {
- NSString* fileName = [[[[NSString alloc] initWithBytes:callerFileName length:strlen(callerFileName) encoding:NSUTF8StringEncoding] autorelease] lastPathComponent];
- NSLog(@"%@::%s - Error: %@", fileName, callerFunctionName, errorString);
- }
- }
-
- return ok;
-}
-
-/*
-// NOTE: for onPause and onResume, calls into JavaScript must not call or trigger any blocking UI, like alerts
-- (void) onPause {}
-- (void) onResume {}
-- (void) onOrientationWillChange {}
-- (void) onOrientationDidChange {}
-*/
-
-/* NOTE: calls into JavaScript must not call or trigger any blocking UI, like alerts */
-- (void) handleOpenURL:(NSNotification*)notification
-{
- // override to handle urls sent to your app
- // register your url schemes in your App-Info.plist
-
- NSURL* url = [notification object];
- if ([url isKindOfClass:[NSURL class]]) {
- /* Do your thing! */
- }
-}
-
-/* NOTE: calls into JavaScript must not call or trigger any blocking UI, like alerts */
-- (void) onAppTerminate
-{
- // override this if you need to do any cleanup on app exit
-}
-
-- (void) onMemoryWarning
-{
- // override to remove caches, etc
-}
-
-- (void) dealloc
-{
- self.settings = nil;
- self.webView = nil;
- [[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationWillTerminateNotification object:nil];
- [[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationDidReceiveMemoryWarningNotification object:nil];
- [[NSNotificationCenter defaultCenter] removeObserver:self name:PGPluginHandleOpenURLNotification object:nil];
- /*
- [[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationDidEnterBackgroundNotification object:nil];
- [[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationWillEnterForegroundNotification object:nil];
- [[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationWillChangeStatusBarOrientationNotification object:nil];
- [[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationDidChangeStatusBarOrientationNotification object:nil];
- */
- [super dealloc];
-}
-
-- (id) appDelegate
-{
- return [[UIApplication sharedApplication] delegate];
-}
-
-/* deprecated - just use the viewController property */
-- (UIViewController*) appViewController
-{
- return self.viewController;
-}
-
-- (NSString*) writeJavascript:(NSString*)javascript
-{
- return [self.webView stringByEvaluatingJavaScriptFromString:javascript];
-}
-
-- (NSString*) success:(PluginResult*)pluginResult callbackId:(NSString*)callbackId
-{
- return [self writeJavascript:[NSString stringWithFormat:@"setTimeout(function() { %@; }, 0);", [pluginResult toSuccessCallbackString:callbackId]]];
-}
-
-- (NSString*) error:(PluginResult*)pluginResult callbackId:(NSString*)callbackId
-{
- return [self writeJavascript:[NSString stringWithFormat:@"setTimeout(function() { %@; }, 0);", [pluginResult toErrorCallbackString:callbackId]]];
-}
-
-@end
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/bcff9559/PhoneGapLib/Classes/PGSplashScreen.h
----------------------------------------------------------------------
diff --git a/PhoneGapLib/Classes/PGSplashScreen.h b/PhoneGapLib/Classes/PGSplashScreen.h
deleted file mode 100644
index c072b93..0000000
--- a/PhoneGapLib/Classes/PGSplashScreen.h
+++ /dev/null
@@ -1,30 +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 "PGPlugin.h"
-
-
-@interface PGSplashScreen : PGPlugin {
-}
-
-- (void) show:(NSArray*)arguments withDict:(NSMutableDictionary*)options;
-- (void) hide:(NSArray*)arguments withDict:(NSMutableDictionary*)options;
-
-@end
http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/bcff9559/PhoneGapLib/Classes/PGSplashScreen.m
----------------------------------------------------------------------
diff --git a/PhoneGapLib/Classes/PGSplashScreen.m b/PhoneGapLib/Classes/PGSplashScreen.m
deleted file mode 100644
index 9fb571c..0000000
--- a/PhoneGapLib/Classes/PGSplashScreen.m
+++ /dev/null
@@ -1,55 +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 "PGSplashScreen.h"
-#import "PGViewController.h"
-#import "PhoneGapDelegate.h"
-
-@implementation PGSplashScreen
-
-
-- (void) __show:(BOOL)show
-{
- // Legacy support - once deprecated classes removed, clean this up
- id<UIApplicationDelegate> delegate = [[UIApplication sharedApplication] delegate];
-
- if ([delegate isKindOfClass:[PhoneGapDelegate class]]) {
- ((PhoneGapDelegate*)delegate).imageView.hidden = !show;
- ((PhoneGapDelegate*)delegate).activityView.hidden = !show;
- } else if ([delegate respondsToSelector:@selector(viewController)]) {
- id vc = [delegate performSelector:@selector(viewController)];
- if ([vc isKindOfClass:[PGViewController class]]) {
- ((PGViewController*)vc).imageView.hidden = !show;
- ((PGViewController*)vc).activityView.hidden = !show;
- }
- }
-}
-
-- (void) show:(NSArray*)arguments withDict:(NSMutableDictionary*)options
-{
- [self __show:YES];
-}
-
-- (void) hide:(NSArray*)arguments withDict:(NSMutableDictionary*)options
-{
- [self __show:NO];
-}
-
-@end
http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/bcff9559/PhoneGapLib/Classes/PGURLProtocol.h
----------------------------------------------------------------------
diff --git a/PhoneGapLib/Classes/PGURLProtocol.h b/PhoneGapLib/Classes/PGURLProtocol.h
deleted file mode 100644
index b72c8dc..0000000
--- a/PhoneGapLib/Classes/PGURLProtocol.h
+++ /dev/null
@@ -1,34 +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>
-
-@interface PGURLProtocol : NSURLProtocol {
-}
-
-+ (void) registerPGHttpURLProtocol;
-
-@end
-
-@interface PGHTTPURLResponse : NSHTTPURLResponse {
-}
-
-- (PGHTTPURLResponse*) initWithUnauthorizedURL:(NSURL*)url;
-
-@end
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/bcff9559/PhoneGapLib/Classes/PGURLProtocol.m
----------------------------------------------------------------------
diff --git a/PhoneGapLib/Classes/PGURLProtocol.m b/PhoneGapLib/Classes/PGURLProtocol.m
deleted file mode 100644
index 1ba08e6..0000000
--- a/PhoneGapLib/Classes/PGURLProtocol.m
+++ /dev/null
@@ -1,127 +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 "PGURLProtocol.h"
-#import "PGWhitelist.h"
-#import "PhoneGapDelegate.h"
-#import "PGViewController.h"
-
-static PGWhitelist* gWhitelist = nil;
-
-@implementation PGURLProtocol
-
-// Called before any use of the protocol, ensure it is only called once
-+ (void) registerPGHttpURLProtocol {
- static BOOL registered = NO;
- if (!registered) {
- [NSURLProtocol registerClass:[PGURLProtocol class]];
- registered = YES;
- }
-}
-
-+ (BOOL) canInitWithRequest:(NSURLRequest *)theRequest
-{
- NSURL* theUrl = [theRequest URL];
- NSString* theScheme = [theUrl scheme];
-
- if (gWhitelist == nil) {
- id<UIApplicationDelegate> delegate = [[UIApplication sharedApplication] delegate];
-
- if ([delegate isKindOfClass:[PhoneGapDelegate class]]) {
- gWhitelist = [((PhoneGapDelegate*)delegate).whitelist retain];
- } else if ([delegate respondsToSelector:@selector(viewController)]) {
- id vc = [delegate performSelector:@selector(viewController)];
- if ([vc isKindOfClass:[PGViewController class]]) {
- gWhitelist = [((PGViewController*)vc).whitelist retain];
- }
- }
- }
-
- // we only care about http and https connections
- if ([gWhitelist schemeIsAllowed:theScheme])
- {
- // if it FAILS the whitelist, we return TRUE, so we can fail the connection later
- return ![gWhitelist URLIsAllowed:theUrl];
- }
-
- return NO;
-}
-
-+ (NSURLRequest*) canonicalRequestForRequest:(NSURLRequest*) request
-{
- //NSLog(@"%@ received %@", self, NSStringFromSelector(_cmd));
- return request;
-}
-
-- (void) startLoading
-{
- //NSLog(@"%@ received %@ - start", self, NSStringFromSelector(_cmd));
- NSURL* url = [[self request] URL];
- NSString* body = [gWhitelist errorStringForURL:url];
-
- PGHTTPURLResponse* response = [[PGHTTPURLResponse alloc] initWithUnauthorizedURL:url];
-
- [[self client] URLProtocol:self didReceiveResponse:response cacheStoragePolicy:NSURLCacheStorageNotAllowed];
-
- [[self client] URLProtocol:self didLoadData:[body dataUsingEncoding:NSASCIIStringEncoding]];
-
- [[self client] URLProtocolDidFinishLoading:self];
-
- [response release];
-}
-
-- (void) stopLoading
-{
- // do any cleanup here
-}
-
-+ (BOOL) requestIsCacheEquivalent: (NSURLRequest*)requestA toRequest: (NSURLRequest*)requestB
-{
- return NO;
-}
-
-@end
-
-
-
-@implementation PGHTTPURLResponse
-
-- (id) initWithUnauthorizedURL:(NSURL*)url
-{
- NSInteger statusCode = 401;
- NSDictionary* headerFields = [NSDictionary dictionaryWithObject:@"Digest realm = \"PhoneGap.plist/ExternalHosts\"" forKey:@"WWW-Authenticate"];
- double requestTime = 1;
-
- SEL selector = NSSelectorFromString(@"initWithURL:statusCode:headerFields:requestTime:");
- NSMethodSignature* signature = [self methodSignatureForSelector:selector];
-
- NSInvocation* inv = [NSInvocation invocationWithMethodSignature:signature];
- [inv setTarget:self];
- [inv setSelector:selector];
- [inv setArgument:&url atIndex:2];
- [inv setArgument:&statusCode atIndex:3];
- [inv setArgument:&headerFields atIndex:4];
- [inv setArgument:&requestTime atIndex:5];
-
- [inv invoke];
-
- return self;
-}
-
-@end
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/bcff9559/PhoneGapLib/Classes/PGViewController.h
----------------------------------------------------------------------
diff --git a/PhoneGapLib/Classes/PGViewController.h b/PhoneGapLib/Classes/PGViewController.h
deleted file mode 100644
index 4ad1eed..0000000
--- a/PhoneGapLib/Classes/PGViewController.h
+++ /dev/null
@@ -1,65 +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"
-
-#import "JSONKit.h"
-#import "InvokedUrlCommand.h"
-#import "PGCommandDelegate.h"
-#import "PGWhitelist.h"
-
-
-@interface PGViewController : UIViewController<UIWebViewDelegate, PGCommandDelegate> {
-
-}
-
-@property (nonatomic, retain) IBOutlet UIGapView* webView;
-
-@property (nonatomic, readonly, retain) NSMutableDictionary* pluginObjects;
-@property (nonatomic, readonly, retain) NSDictionary* pluginsMap;
-@property (nonatomic, readonly, retain) NSDictionary* settings;
-@property (nonatomic, readonly, retain) PGWhitelist* whitelist; // readonly for public
-@property (nonatomic, readonly, retain) NSArray* supportedOrientations;
-@property (nonatomic, readonly, copy) NSString* sessionKey;
-@property (nonatomic, readonly, assign) BOOL loadFromString;
-
-@property (nonatomic, readwrite, assign) BOOL useSplashScreen;
-@property (nonatomic, readonly, retain) IBOutlet UIActivityIndicatorView* activityView;
-@property (nonatomic, readonly, retain) UIImageView *imageView;
-@property (nonatomic, readwrite, retain) id<PGCommandDelegate> commandDelegate;
-
-@property (nonatomic, readwrite, copy) NSString* wwwFolderName;
-@property (nonatomic, readwrite, copy) NSString* startPage;
-
-+ (NSDictionary*) getBundlePlist:(NSString*)plistName;
-+ (NSString*) phoneGapVersion;
-+ (NSString*) applicationDocumentsDirectory;
-
-- (void) createGapView;
-
-- (int) executeQueuedCommands;
-- (void) flushCommandQueue;
-
-- (void) javascriptAlert:(NSString*)text;
-- (NSString*) appURLScheme;
-- (NSDictionary*) deviceProperties;
-
-- (NSArray*) parseInterfaceOrientations:(NSArray*)orientations;
-
-@end