cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fil...@apache.org
Subject [04/52] [partial] start of lazy loading: axe all vendored-in libs
Date Tue, 11 Jun 2013 00:03:40 GMT
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/91c74886/lib/cordova-ios/CordovaLib/Classes/CDVInAppBrowser.m
----------------------------------------------------------------------
diff --git a/lib/cordova-ios/CordovaLib/Classes/CDVInAppBrowser.m b/lib/cordova-ios/CordovaLib/Classes/CDVInAppBrowser.m
deleted file mode 100644
index d5f06ec..0000000
--- a/lib/cordova-ios/CordovaLib/Classes/CDVInAppBrowser.m
+++ /dev/null
@@ -1,809 +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 "CDVInAppBrowser.h"
-#import "CDVPluginResult.h"
-#import "CDVUserAgentUtil.h"
-#import "CDVJSON.h"
-
-#define    kInAppBrowserTargetSelf @"_self"
-#define    kInAppBrowserTargetSystem @"_system"
-#define    kInAppBrowserTargetBlank @"_blank"
-
-#define    TOOLBAR_HEIGHT 44.0
-#define    LOCATIONBAR_HEIGHT 21.0
-#define    FOOTER_HEIGHT ((TOOLBAR_HEIGHT) + (LOCATIONBAR_HEIGHT))
-
-#pragma mark CDVInAppBrowser
-
-@implementation CDVInAppBrowser
-
-- (CDVInAppBrowser*)initWithWebView:(UIWebView*)theWebView
-{
-    self = [super initWithWebView:theWebView];
-    if (self != nil) {
-        // your initialization here
-    }
-
-    return self;
-}
-
-- (void)onReset
-{
-    [self close:nil];
-}
-
-- (void)close:(CDVInvokedUrlCommand*)command
-{
-    if (self.inAppBrowserViewController != nil) {
-        [self.inAppBrowserViewController close];
-        self.inAppBrowserViewController = nil;
-    }
-
-    self.callbackId = nil;
-}
-
-- (void)open:(CDVInvokedUrlCommand*)command
-{
-    CDVPluginResult* pluginResult;
-
-    NSString* url = [command argumentAtIndex:0];
-    NSString* target = [command argumentAtIndex:1 withDefault:kInAppBrowserTargetSelf];
-    NSString* options = [command argumentAtIndex:2 withDefault:@"" andClass:[NSString class]];
-
-    self.callbackId = command.callbackId;
-
-    if (url != nil) {
-        NSURL* baseUrl = [self.webView.request URL];
-        NSURL* absoluteUrl = [[NSURL URLWithString:url relativeToURL:baseUrl] absoluteURL];
-        if ([target isEqualToString:kInAppBrowserTargetSelf]) {
-            [self openInCordovaWebView:absoluteUrl withOptions:options];
-        } else if ([target isEqualToString:kInAppBrowserTargetSystem]) {
-            [self openInSystem:absoluteUrl];
-        } else { // _blank or anything else
-            [self openInInAppBrowser:absoluteUrl withOptions:options];
-        }
-
-        pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
-    } else {
-        pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"incorrect number of arguments"];
-    }
-
-    [pluginResult setKeepCallback:[NSNumber numberWithBool:YES]];
-    [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
-}
-
-- (void)openInInAppBrowser:(NSURL*)url withOptions:(NSString*)options
-{
-    if (self.inAppBrowserViewController == nil) {
-        NSString* originalUA = [CDVUserAgentUtil originalUserAgent];
-        self.inAppBrowserViewController = [[CDVInAppBrowserViewController alloc] initWithUserAgent:originalUA prevUserAgent:[self.commandDelegate userAgent]];
-        self.inAppBrowserViewController.navigationDelegate = self;
-
-        if ([self.viewController conformsToProtocol:@protocol(CDVScreenOrientationDelegate)]) {
-            self.inAppBrowserViewController.orientationDelegate = (UIViewController <CDVScreenOrientationDelegate>*)self.viewController;
-        }
-    }
-
-    CDVInAppBrowserOptions* browserOptions = [CDVInAppBrowserOptions parseOptions:options];
-    [self.inAppBrowserViewController showLocationBar:browserOptions.location];
-    [self.inAppBrowserViewController showToolBar:browserOptions.toolbar];
-    if (browserOptions.closebuttoncaption != nil) {
-        [self.inAppBrowserViewController setCloseButtonTitle:browserOptions.closebuttoncaption];
-    }
-
-    // Set Presentation Style
-    UIModalPresentationStyle presentationStyle = UIModalPresentationFullScreen; // default
-    if (browserOptions.presentationstyle != nil) {
-        if ([[browserOptions.presentationstyle lowercaseString] isEqualToString:@"pagesheet"]) {
-            presentationStyle = UIModalPresentationPageSheet;
-        } else if ([[browserOptions.presentationstyle lowercaseString] isEqualToString:@"formsheet"]) {
-            presentationStyle = UIModalPresentationFormSheet;
-        }
-    }
-    self.inAppBrowserViewController.modalPresentationStyle = presentationStyle;
-
-    // Set Transition Style
-    UIModalTransitionStyle transitionStyle = UIModalTransitionStyleCoverVertical; // default
-    if (browserOptions.transitionstyle != nil) {
-        if ([[browserOptions.transitionstyle lowercaseString] isEqualToString:@"fliphorizontal"]) {
-            transitionStyle = UIModalTransitionStyleFlipHorizontal;
-        } else if ([[browserOptions.transitionstyle lowercaseString] isEqualToString:@"crossdissolve"]) {
-            transitionStyle = UIModalTransitionStyleCrossDissolve;
-        }
-    }
-    self.inAppBrowserViewController.modalTransitionStyle = transitionStyle;
-
-    // UIWebView options
-    self.inAppBrowserViewController.webView.scalesPageToFit = browserOptions.enableviewportscale;
-    self.inAppBrowserViewController.webView.mediaPlaybackRequiresUserAction = browserOptions.mediaplaybackrequiresuseraction;
-    self.inAppBrowserViewController.webView.allowsInlineMediaPlayback = browserOptions.allowinlinemediaplayback;
-    if (IsAtLeastiOSVersion(@"6.0")) {
-        self.inAppBrowserViewController.webView.keyboardDisplayRequiresUserAction = browserOptions.keyboarddisplayrequiresuseraction;
-        self.inAppBrowserViewController.webView.suppressesIncrementalRendering = browserOptions.suppressesincrementalrendering;
-    }
-
-    if (self.viewController.modalViewController != self.inAppBrowserViewController) {
-        [self.viewController presentModalViewController:self.inAppBrowserViewController animated:YES];
-    }
-    [self.inAppBrowserViewController navigateTo:url];
-}
-
-- (void)openInCordovaWebView:(NSURL*)url withOptions:(NSString*)options
-{
-    if ([self.commandDelegate URLIsWhitelisted:url]) {
-        NSURLRequest* request = [NSURLRequest requestWithURL:url];
-        [self.webView loadRequest:request];
-    } else { // this assumes the InAppBrowser can be excepted from the white-list
-        [self openInInAppBrowser:url withOptions:options];
-    }
-}
-
-- (void)openInSystem:(NSURL*)url
-{
-    if ([[UIApplication sharedApplication] canOpenURL:url]) {
-        [[UIApplication sharedApplication] openURL:url];
-    } else { // handle any custom schemes to plugins
-        [[NSNotificationCenter defaultCenter] postNotification:[NSNotification notificationWithName:CDVPluginHandleOpenURLNotification object:url]];
-    }
-}
-
-// This is a helper method for the inject{Script|Style}{Code|File} API calls, which
-// provides a consistent method for injecting JavaScript code into the document.
-//
-// If a wrapper string is supplied, then the source string will be JSON-encoded (adding
-// quotes) and wrapped using string formatting. (The wrapper string should have a single
-// '%@' marker).
-//
-// If no wrapper is supplied, then the source string is executed directly.
-
-- (void)injectDeferredObject:(NSString*)source withWrapper:(NSString*)jsWrapper
-{
-    if (!_injectedIframeBridge) {
-        _injectedIframeBridge = YES;
-        // Create an iframe bridge in the new document to communicate with the CDVInAppBrowserViewController
-        [self.inAppBrowserViewController.webView stringByEvaluatingJavaScriptFromString:@"(function(d){var e = _cdvIframeBridge = d.createElement('iframe');e.style.display='none';d.body.appendChild(e);})(document)"];
-    }
-
-    if (jsWrapper != nil) {
-        NSString* sourceArrayString = [@[source] JSONString];
-        if (sourceArrayString) {
-            NSString* sourceString = [sourceArrayString substringWithRange:NSMakeRange(1, [sourceArrayString length] - 2)];
-            NSString* jsToInject = [NSString stringWithFormat:jsWrapper, sourceString];
-            [self.inAppBrowserViewController.webView stringByEvaluatingJavaScriptFromString:jsToInject];
-        }
-    } else {
-        [self.inAppBrowserViewController.webView stringByEvaluatingJavaScriptFromString:source];
-    }
-}
-
-- (void)injectScriptCode:(CDVInvokedUrlCommand*)command
-{
-    NSString* jsWrapper = nil;
-
-    if ((command.callbackId != nil) && ![command.callbackId isEqualToString:@"INVALID"]) {
-        jsWrapper = [NSString stringWithFormat:@"_cdvIframeBridge.src='gap-iab://%@/'+window.escape(JSON.stringify([eval(%%@)]));", command.callbackId];
-    }
-    [self injectDeferredObject:[command argumentAtIndex:0] withWrapper:jsWrapper];
-}
-
-- (void)injectScriptFile:(CDVInvokedUrlCommand*)command
-{
-    NSString* jsWrapper;
-
-    if ((command.callbackId != nil) && ![command.callbackId isEqualToString:@"INVALID"]) {
-        jsWrapper = [NSString stringWithFormat:@"(function(d) { var c = d.createElement('script'); c.src = %%@; c.onload = function() { _cdvIframeBridge.src='gap-iab://%@'; }; d.body.appendChild(c); })(document)", command.callbackId];
-    } else {
-        jsWrapper = @"(function(d) { var c = d.createElement('script'); c.src = %@; d.body.appendChild(c); })(document)";
-    }
-    [self injectDeferredObject:[command argumentAtIndex:0] withWrapper:jsWrapper];
-}
-
-- (void)injectStyleCode:(CDVInvokedUrlCommand*)command
-{
-    NSString* jsWrapper;
-
-    if ((command.callbackId != nil) && ![command.callbackId isEqualToString:@"INVALID"]) {
-        jsWrapper = [NSString stringWithFormat:@"(function(d) { var c = d.createElement('style'); c.innerHTML = %%@; c.onload = function() { _cdvIframeBridge.src='gap-iab://%@'; }; d.body.appendChild(c); })(document)", command.callbackId];
-    } else {
-        jsWrapper = @"(function(d) { var c = d.createElement('style'); c.innerHTML = %@; d.body.appendChild(c); })(document)";
-    }
-    [self injectDeferredObject:[command argumentAtIndex:0] withWrapper:jsWrapper];
-}
-
-- (void)injectStyleFile:(CDVInvokedUrlCommand*)command
-{
-    NSString* jsWrapper;
-
-    if ((command.callbackId != nil) && ![command.callbackId isEqualToString:@"INVALID"]) {
-        jsWrapper = [NSString stringWithFormat:@"(function(d) { var c = d.createElement('link'); c.rel='stylesheet'; c.type='text/css'; c.href = %%@; c.onload = function() { _cdvIframeBridge.src='gap-iab://%@'; }; d.body.appendChild(c); })(document)", command.callbackId];
-    } else {
-        jsWrapper = @"(function(d) { var c = d.createElement('link'); c.rel='stylesheet', c.type='text/css'; c.href = %@; d.body.appendChild(c); })(document)";
-    }
-    [self injectDeferredObject:[command argumentAtIndex:0] withWrapper:jsWrapper];
-}
-
-/**
- * The iframe bridge provided for the InAppBrowser is capable of executing any oustanding callback belonging
- * to the InAppBrowser plugin. Care has been taken that other callbacks cannot be triggered, and that no
- * other code execution is possible.
- *
- * To trigger the bridge, the iframe (or any other resource) should attempt to load a url of the form:
- *
- * gap-iab://<callbackId>/<arguments>
- *
- * where <callbackId> is the string id of the callback to trigger (something like "InAppBrowser0123456789")
- *
- * If present, the path component of the special gap-iab:// url is expected to be a URL-escaped JSON-encoded
- * value to pass to the callback. [NSURL path] should take care of the URL-unescaping, and a JSON_EXCEPTION
- * is returned if the JSON is invalid.
- */
-- (BOOL)webView:(UIWebView*)theWebView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType
-{
-    NSURL* url = request.URL;
-    BOOL isTopLevelNavigation = [request.URL isEqual:[request mainDocumentURL]];
-
-    // See if the url uses the 'gap-iab' protocol. If so, the host should be the id of a callback to execute,
-    // and the path, if present, should be a JSON-encoded value to pass to the callback.
-    if ([[url scheme] isEqualToString:@"gap-iab"]) {
-        NSString* scriptCallbackId = [url host];
-        CDVPluginResult* pluginResult = nil;
-
-        if ([scriptCallbackId hasPrefix:@"InAppBrowser"]) {
-            NSString* scriptResult = [url path];
-            NSError* __autoreleasing error = nil;
-
-            // The message should be a JSON-encoded array of the result of the script which executed.
-            if ((scriptResult != nil) && ([scriptResult length] > 1)) {
-                scriptResult = [scriptResult substringFromIndex:1];
-                NSData* decodedResult = [NSJSONSerialization JSONObjectWithData:[scriptResult dataUsingEncoding:NSUTF8StringEncoding] options:kNilOptions error:&error];
-                if ((error == nil) && [decodedResult isKindOfClass:[NSArray class]]) {
-                    pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsArray:(NSArray*)decodedResult];
-                } else {
-                    pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_JSON_EXCEPTION];
-                }
-            } else {
-                pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsArray:@[]];
-            }
-            [self.commandDelegate sendPluginResult:pluginResult callbackId:scriptCallbackId];
-            return NO;
-        }
-    } else if ((self.callbackId != nil) && isTopLevelNavigation) {
-        // Send a loadstart event for each top-level navigation (includes redirects).
-        CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK
-                                                      messageAsDictionary:@{@"type":@"loadstart", @"url":[url absoluteString]}];
-        [pluginResult setKeepCallback:[NSNumber numberWithBool:YES]];
-
-        [self.commandDelegate sendPluginResult:pluginResult callbackId:self.callbackId];
-    }
-
-    return YES;
-}
-
-- (void)webViewDidStartLoad:(UIWebView*)theWebView
-{
-    _injectedIframeBridge = NO;
-}
-
-- (void)webViewDidFinishLoad:(UIWebView*)theWebView
-{
-    if (self.callbackId != nil) {
-        // TODO: It would be more useful to return the URL the page is actually on (e.g. if it's been redirected).
-        NSString* url = [self.inAppBrowserViewController.currentURL absoluteString];
-        CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK
-                                                      messageAsDictionary:@{@"type":@"loadstop", @"url":url}];
-        [pluginResult setKeepCallback:[NSNumber numberWithBool:YES]];
-
-        [self.commandDelegate sendPluginResult:pluginResult callbackId:self.callbackId];
-    }
-}
-
-- (void)webView:(UIWebView*)theWebView didFailLoadWithError:(NSError*)error
-{
-    if (self.callbackId != nil) {
-        NSString* url = [self.inAppBrowserViewController.currentURL absoluteString];
-        CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR
-                                                      messageAsDictionary:@{@"type":@"loaderror", @"url":url, @"code": [NSNumber numberWithInt:error.code], @"message": error.localizedDescription}];
-        [pluginResult setKeepCallback:[NSNumber numberWithBool:YES]];
-
-        [self.commandDelegate sendPluginResult:pluginResult callbackId:self.callbackId];
-    }
-}
-
-- (void)browserExit
-{
-    if (self.callbackId != nil) {
-        CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK
-                                                      messageAsDictionary:@{@"type":@"exit"}];
-        [pluginResult setKeepCallback:[NSNumber numberWithBool:YES]];
-
-        [self.commandDelegate sendPluginResult:pluginResult callbackId:self.callbackId];
-    }
-    // Don't recycle the ViewController since it may be consuming a lot of memory.
-    // Also - this is required for the PDF/User-Agent bug work-around.
-    self.inAppBrowserViewController = nil;
-}
-
-@end
-
-#pragma mark CDVInAppBrowserViewController
-
-@implementation CDVInAppBrowserViewController
-
-@synthesize currentURL;
-
-- (id)initWithUserAgent:(NSString*)userAgent prevUserAgent:(NSString*)prevUserAgent
-{
-    self = [super init];
-    if (self != nil) {
-        _userAgent = userAgent;
-        _prevUserAgent = prevUserAgent;
-        _webViewDelegate = [[CDVWebViewDelegate alloc] initWithDelegate:self];
-        [self createViews];
-    }
-
-    return self;
-}
-
-- (void)createViews
-{
-    // We create the views in code for primarily for ease of upgrades and not requiring an external .xib to be included
-
-    CGRect webViewBounds = self.view.bounds;
-
-    webViewBounds.size.height -= FOOTER_HEIGHT;
-
-    self.webView = [[UIWebView alloc] initWithFrame:webViewBounds];
-    self.webView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
-
-    [self.view addSubview:self.webView];
-    [self.view sendSubviewToBack:self.webView];
-
-    self.webView.delegate = _webViewDelegate;
-    self.webView.backgroundColor = [UIColor whiteColor];
-
-    self.webView.clearsContextBeforeDrawing = YES;
-    self.webView.clipsToBounds = YES;
-    self.webView.contentMode = UIViewContentModeScaleToFill;
-    self.webView.contentStretch = CGRectFromString(@"{{0, 0}, {1, 1}}");
-    self.webView.multipleTouchEnabled = YES;
-    self.webView.opaque = YES;
-    self.webView.scalesPageToFit = NO;
-    self.webView.userInteractionEnabled = YES;
-
-    self.spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];
-    self.spinner.alpha = 1.000;
-    self.spinner.autoresizesSubviews = YES;
-    self.spinner.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleTopMargin;
-    self.spinner.clearsContextBeforeDrawing = NO;
-    self.spinner.clipsToBounds = NO;
-    self.spinner.contentMode = UIViewContentModeScaleToFill;
-    self.spinner.contentStretch = CGRectFromString(@"{{0, 0}, {1, 1}}");
-    self.spinner.frame = CGRectMake(454.0, 231.0, 20.0, 20.0);
-    self.spinner.hidden = YES;
-    self.spinner.hidesWhenStopped = YES;
-    self.spinner.multipleTouchEnabled = NO;
-    self.spinner.opaque = NO;
-    self.spinner.userInteractionEnabled = NO;
-    [self.spinner stopAnimating];
-
-    self.closeButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(close)];
-    self.closeButton.enabled = YES;
-
-    UIBarButtonItem* flexibleSpaceButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
-
-    UIBarButtonItem* fixedSpaceButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];
-    fixedSpaceButton.width = 20;
-
-    self.toolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0.0, (self.view.bounds.size.height - TOOLBAR_HEIGHT), self.view.bounds.size.width, TOOLBAR_HEIGHT)];
-    self.toolbar.alpha = 1.000;
-    self.toolbar.autoresizesSubviews = YES;
-    self.toolbar.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin;
-    self.toolbar.barStyle = UIBarStyleBlackOpaque;
-    self.toolbar.clearsContextBeforeDrawing = NO;
-    self.toolbar.clipsToBounds = NO;
-    self.toolbar.contentMode = UIViewContentModeScaleToFill;
-    self.toolbar.contentStretch = CGRectFromString(@"{{0, 0}, {1, 1}}");
-    self.toolbar.hidden = NO;
-    self.toolbar.multipleTouchEnabled = NO;
-    self.toolbar.opaque = NO;
-    self.toolbar.userInteractionEnabled = YES;
-
-    CGFloat labelInset = 5.0;
-    self.addressLabel = [[UILabel alloc] initWithFrame:CGRectMake(labelInset, (self.view.bounds.size.height - FOOTER_HEIGHT), self.view.bounds.size.width - labelInset, LOCATIONBAR_HEIGHT)];
-    self.addressLabel.adjustsFontSizeToFitWidth = NO;
-    self.addressLabel.alpha = 1.000;
-    self.addressLabel.autoresizesSubviews = YES;
-    self.addressLabel.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleTopMargin;
-    self.addressLabel.backgroundColor = [UIColor clearColor];
-    self.addressLabel.baselineAdjustment = UIBaselineAdjustmentAlignCenters;
-    self.addressLabel.clearsContextBeforeDrawing = YES;
-    self.addressLabel.clipsToBounds = YES;
-    self.addressLabel.contentMode = UIViewContentModeScaleToFill;
-    self.addressLabel.contentStretch = CGRectFromString(@"{{0, 0}, {1, 1}}");
-    self.addressLabel.enabled = YES;
-    self.addressLabel.hidden = NO;
-    self.addressLabel.lineBreakMode = UILineBreakModeTailTruncation;
-    self.addressLabel.minimumFontSize = 10.000;
-    self.addressLabel.multipleTouchEnabled = NO;
-    self.addressLabel.numberOfLines = 1;
-    self.addressLabel.opaque = NO;
-    self.addressLabel.shadowOffset = CGSizeMake(0.0, -1.0);
-    self.addressLabel.text = @"Loading...";
-    self.addressLabel.textAlignment = UITextAlignmentLeft;
-    self.addressLabel.textColor = [UIColor colorWithWhite:1.000 alpha:1.000];
-    self.addressLabel.userInteractionEnabled = NO;
-
-    NSString* frontArrowString = @"►"; // create arrow from Unicode char
-    self.forwardButton = [[UIBarButtonItem alloc] initWithTitle:frontArrowString style:UIBarButtonItemStylePlain target:self action:@selector(goForward:)];
-    self.forwardButton.enabled = YES;
-    self.forwardButton.imageInsets = UIEdgeInsetsZero;
-
-    NSString* backArrowString = @"◄"; // create arrow from Unicode char
-    self.backButton = [[UIBarButtonItem alloc] initWithTitle:backArrowString style:UIBarButtonItemStylePlain target:self action:@selector(goBack:)];
-    self.backButton.enabled = YES;
-    self.backButton.imageInsets = UIEdgeInsetsZero;
-
-    [self.toolbar setItems:@[self.closeButton, flexibleSpaceButton, self.backButton, fixedSpaceButton, self.forwardButton]];
-
-    self.view.backgroundColor = [UIColor grayColor];
-    [self.view addSubview:self.toolbar];
-    [self.view addSubview:self.addressLabel];
-    [self.view addSubview:self.spinner];
-}
-
-- (void)setCloseButtonTitle:(NSString*)title
-{
-    // the advantage of using UIBarButtonSystemItemDone is the system will localize it for you automatically
-    // but, if you want to set this yourself, knock yourself out (we can't set the title for a system Done button, so we have to create a new one)
-    self.closeButton = nil;
-    self.closeButton = [[UIBarButtonItem alloc] initWithTitle:title style:UIBarButtonItemStyleBordered target:self action:@selector(close)];
-    self.closeButton.enabled = YES;
-    self.closeButton.tintColor = [UIColor colorWithRed:60.0 / 255.0 green:136.0 / 255.0 blue:230.0 / 255.0 alpha:1];
-
-    NSMutableArray* items = [self.toolbar.items mutableCopy];
-    [items replaceObjectAtIndex:0 withObject:self.closeButton];
-    [self.toolbar setItems:items];
-}
-
-- (void)showLocationBar:(BOOL)show
-{
-    CGRect locationbarFrame = self.addressLabel.frame;
-
-    BOOL toolbarVisible = !self.toolbar.hidden;
-
-    // prevent double show/hide
-    if (show == !(self.addressLabel.hidden)) {
-        return;
-    }
-
-    if (show) {
-        self.addressLabel.hidden = NO;
-
-        if (toolbarVisible) {
-            // toolBar at the bottom, leave as is
-            // put locationBar on top of the toolBar
-
-            CGRect webViewBounds = self.view.bounds;
-            webViewBounds.size.height -= FOOTER_HEIGHT;
-            self.webView.frame = webViewBounds;
-
-            locationbarFrame.origin.y = webViewBounds.size.height;
-            self.addressLabel.frame = locationbarFrame;
-        } else {
-            // no toolBar, so put locationBar at the bottom
-
-            CGRect webViewBounds = self.view.bounds;
-            webViewBounds.size.height -= LOCATIONBAR_HEIGHT;
-            self.webView.frame = webViewBounds;
-
-            locationbarFrame.origin.y = webViewBounds.size.height;
-            self.addressLabel.frame = locationbarFrame;
-        }
-    } else {
-        self.addressLabel.hidden = YES;
-
-        if (toolbarVisible) {
-            // locationBar is on top of toolBar, hide locationBar
-
-            // webView take up whole height less toolBar height
-            CGRect webViewBounds = self.view.bounds;
-            webViewBounds.size.height -= TOOLBAR_HEIGHT;
-            self.webView.frame = webViewBounds;
-        } else {
-            // no toolBar, expand webView to screen dimensions
-
-            CGRect webViewBounds = self.view.bounds;
-            self.webView.frame = webViewBounds;
-        }
-    }
-}
-
-- (void)showToolBar:(BOOL)show
-{
-    CGRect toolbarFrame = self.toolbar.frame;
-    CGRect locationbarFrame = self.addressLabel.frame;
-
-    BOOL locationbarVisible = !self.addressLabel.hidden;
-
-    // prevent double show/hide
-    if (show == !(self.toolbar.hidden)) {
-        return;
-    }
-
-    if (show) {
-        self.toolbar.hidden = NO;
-
-        if (locationbarVisible) {
-            // locationBar at the bottom, move locationBar up
-            // put toolBar at the bottom
-
-            CGRect webViewBounds = self.view.bounds;
-            webViewBounds.size.height -= FOOTER_HEIGHT;
-            self.webView.frame = webViewBounds;
-
-            locationbarFrame.origin.y = webViewBounds.size.height;
-            self.addressLabel.frame = locationbarFrame;
-
-            toolbarFrame.origin.y = (webViewBounds.size.height + LOCATIONBAR_HEIGHT);
-            self.toolbar.frame = toolbarFrame;
-        } else {
-            // no locationBar, so put toolBar at the bottom
-
-            CGRect webViewBounds = self.view.bounds;
-            webViewBounds.size.height -= TOOLBAR_HEIGHT;
-            self.webView.frame = webViewBounds;
-
-            toolbarFrame.origin.y = webViewBounds.size.height;
-            self.toolbar.frame = toolbarFrame;
-        }
-    } else {
-        self.toolbar.hidden = YES;
-
-        if (locationbarVisible) {
-            // locationBar is on top of toolBar, hide toolBar
-            // put locationBar at the bottom
-
-            // webView take up whole height less locationBar height
-            CGRect webViewBounds = self.view.bounds;
-            webViewBounds.size.height -= LOCATIONBAR_HEIGHT;
-            self.webView.frame = webViewBounds;
-
-            // move locationBar down
-            locationbarFrame.origin.y = webViewBounds.size.height;
-            self.addressLabel.frame = locationbarFrame;
-        } else {
-            // no locationBar, expand webView to screen dimensions
-
-            CGRect webViewBounds = self.view.bounds;
-            self.webView.frame = webViewBounds;
-        }
-    }
-}
-
-- (void)viewDidLoad
-{
-    [super viewDidLoad];
-}
-
-- (void)viewDidUnload
-{
-    [self.webView loadHTMLString:nil baseURL:nil];
-    [CDVUserAgentUtil releaseLock:&_userAgentLockToken];
-    [super viewDidUnload];
-}
-
-- (void)close
-{
-    [CDVUserAgentUtil releaseLock:&_userAgentLockToken];
-
-    if ([self respondsToSelector:@selector(presentingViewController)]) {
-        [[self presentingViewController] dismissViewControllerAnimated:YES completion:nil];
-    } else {
-        [[self parentViewController] dismissModalViewControllerAnimated:YES];
-    }
-
-    self.currentURL = nil;
-
-    if ((self.navigationDelegate != nil) && [self.navigationDelegate respondsToSelector:@selector(browserExit)]) {
-        [self.navigationDelegate browserExit];
-    }
-}
-
-- (void)navigateTo:(NSURL*)url
-{
-    NSURLRequest* request = [NSURLRequest requestWithURL:url];
-
-    if (_userAgentLockToken != 0) {
-        [self.webView loadRequest:request];
-    } else {
-        [CDVUserAgentUtil acquireLock:^(NSInteger lockToken) {
-            _userAgentLockToken = lockToken;
-            [CDVUserAgentUtil setUserAgent:_userAgent lockToken:lockToken];
-            [self.webView loadRequest:request];
-        }];
-    }
-}
-
-- (void)goBack:(id)sender
-{
-    [self.webView goBack];
-}
-
-- (void)goForward:(id)sender
-{
-    [self.webView goForward];
-}
-
-#pragma mark UIWebViewDelegate
-
-- (void)webViewDidStartLoad:(UIWebView*)theWebView
-{
-    // loading url, start spinner, update back/forward
-
-    self.addressLabel.text = @"Loading...";
-    self.backButton.enabled = theWebView.canGoBack;
-    self.forwardButton.enabled = theWebView.canGoForward;
-
-    [self.spinner startAnimating];
-
-    return [self.navigationDelegate webViewDidStartLoad:theWebView];
-}
-
-- (BOOL)webView:(UIWebView*)theWebView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType
-{
-    BOOL isTopLevelNavigation = [request.URL isEqual:[request mainDocumentURL]];
-
-    if (isTopLevelNavigation) {
-        self.currentURL = request.URL;
-    }
-    return [self.navigationDelegate webView:theWebView shouldStartLoadWithRequest:request navigationType:navigationType];
-}
-
-- (void)webViewDidFinishLoad:(UIWebView*)theWebView
-{
-    // update url, stop spinner, update back/forward
-
-    self.addressLabel.text = [self.currentURL absoluteString];
-    self.backButton.enabled = theWebView.canGoBack;
-    self.forwardButton.enabled = theWebView.canGoForward;
-
-    [self.spinner stopAnimating];
-
-    // Work around a bug where the first time a PDF is opened, all UIWebViews
-    // reload their User-Agent from NSUserDefaults.
-    // This work-around makes the following assumptions:
-    // 1. The app has only a single Cordova Webview. If not, then the app should
-    //    take it upon themselves to load a PDF in the background as a part of
-    //    their start-up flow.
-    // 2. That the PDF does not require any additional network requests. We change
-    //    the user-agent here back to that of the CDVViewController, so requests
-    //    from it must pass through its white-list. This *does* break PDFs that
-    //    contain links to other remote PDF/websites.
-    // More info at https://issues.apache.org/jira/browse/CB-2225
-    BOOL isPDF = [@"true" isEqualToString :[theWebView stringByEvaluatingJavaScriptFromString:@"document.body==null"]];
-    if (isPDF) {
-        [CDVUserAgentUtil setUserAgent:_prevUserAgent lockToken:_userAgentLockToken];
-    }
-
-    [self.navigationDelegate webViewDidFinishLoad:theWebView];
-}
-
-- (void)webView:(UIWebView*)theWebView didFailLoadWithError:(NSError*)error
-{
-    // log fail message, stop spinner, update back/forward
-    NSLog(@"webView:didFailLoadWithError - %@", [error localizedDescription]);
-
-    self.backButton.enabled = theWebView.canGoBack;
-    self.forwardButton.enabled = theWebView.canGoForward;
-    [self.spinner stopAnimating];
-
-    self.addressLabel.text = @"Load Error";
-
-    [self.navigationDelegate webView:theWebView didFailLoadWithError:error];
-}
-
-#pragma mark CDVScreenOrientationDelegate
-
-- (BOOL)shouldAutorotate
-{
-    if ((self.orientationDelegate != nil) && [self.orientationDelegate respondsToSelector:@selector(shouldAutorotate)]) {
-        return [self.orientationDelegate shouldAutorotate];
-    }
-    return YES;
-}
-
-- (NSUInteger)supportedInterfaceOrientations
-{
-    if ((self.orientationDelegate != nil) && [self.orientationDelegate respondsToSelector:@selector(supportedInterfaceOrientations)]) {
-        return [self.orientationDelegate supportedInterfaceOrientations];
-    }
-
-    return 1 << UIInterfaceOrientationPortrait;
-}
-
-- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
-{
-    if ((self.orientationDelegate != nil) && [self.orientationDelegate respondsToSelector:@selector(shouldAutorotateToInterfaceOrientation:)]) {
-        return [self.orientationDelegate shouldAutorotateToInterfaceOrientation:interfaceOrientation];
-    }
-
-    return YES;
-}
-
-@end
-
-@implementation CDVInAppBrowserOptions
-
-- (id)init
-{
-    if (self = [super init]) {
-        // default values
-        self.location = YES;
-        self.toolbar = YES;
-        self.closebuttoncaption = nil;
-
-        self.enableviewportscale = NO;
-        self.mediaplaybackrequiresuseraction = NO;
-        self.allowinlinemediaplayback = NO;
-        self.keyboarddisplayrequiresuseraction = YES;
-        self.suppressesincrementalrendering = NO;
-    }
-
-    return self;
-}
-
-+ (CDVInAppBrowserOptions*)parseOptions:(NSString*)options
-{
-    CDVInAppBrowserOptions* obj = [[CDVInAppBrowserOptions alloc] init];
-
-    // NOTE: this parsing does not handle quotes within values
-    NSArray* pairs = [options componentsSeparatedByString:@","];
-
-    // parse keys and values, set the properties
-    for (NSString* pair in pairs) {
-        NSArray* keyvalue = [pair componentsSeparatedByString:@"="];
-
-        if ([keyvalue count] == 2) {
-            NSString* key = [[keyvalue objectAtIndex:0] lowercaseString];
-            NSString* value = [keyvalue objectAtIndex:1];
-            NSString* value_lc = [value lowercaseString];
-
-            BOOL isBoolean = [value_lc isEqualToString:@"yes"] || [value_lc isEqualToString:@"no"];
-            NSNumberFormatter* numberFormatter = [[NSNumberFormatter alloc] init];
-            [numberFormatter setAllowsFloats:YES];
-            BOOL isNumber = [numberFormatter numberFromString:value_lc] != nil;
-
-            // set the property according to the key name
-            if ([obj respondsToSelector:NSSelectorFromString(key)]) {
-                if (isNumber) {
-                    [obj setValue:[numberFormatter numberFromString:value_lc] forKey:key];
-                } else if (isBoolean) {
-                    [obj setValue:[NSNumber numberWithBool:[value_lc isEqualToString:@"yes"]] forKey:key];
-                } else {
-                    [obj setValue:value forKey:key];
-                }
-            }
-        }
-    }
-
-    return obj;
-}
-
-@end

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/91c74886/lib/cordova-ios/CordovaLib/Classes/CDVInvokedUrlCommand.h
----------------------------------------------------------------------
diff --git a/lib/cordova-ios/CordovaLib/Classes/CDVInvokedUrlCommand.h b/lib/cordova-ios/CordovaLib/Classes/CDVInvokedUrlCommand.h
deleted file mode 100644
index 7be8884..0000000
--- a/lib/cordova-ios/CordovaLib/Classes/CDVInvokedUrlCommand.h
+++ /dev/null
@@ -1,57 +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 CDVInvokedUrlCommand : NSObject {
-    NSString* _callbackId;
-    NSString* _className;
-    NSString* _methodName;
-    NSArray* _arguments;
-}
-
-@property (nonatomic, readonly) NSArray* arguments;
-@property (nonatomic, readonly) NSString* callbackId;
-@property (nonatomic, readonly) NSString* className;
-@property (nonatomic, readonly) NSString* methodName;
-
-+ (CDVInvokedUrlCommand*)commandFromJson:(NSArray*)jsonEntry;
-
-- (id)initWithArguments:(NSArray*)arguments
-             callbackId:(NSString*)callbackId
-              className:(NSString*)className
-             methodName:(NSString*)methodName;
-
-- (id)initFromJson:(NSArray*)jsonEntry;
-
-// The first NSDictionary found in the arguments will be returned in legacyDict.
-// The arguments array with be prepended with the callbackId and have the first
-// dict removed from it.
-- (void)legacyArguments:(NSMutableArray**)legacyArguments andDict:(NSMutableDictionary**)legacyDict;
-
-// Returns the argument at the given index.
-// If index >= the number of arguments, returns nil.
-// If the argument at the given index is NSNull, returns nil.
-- (id)argumentAtIndex:(NSUInteger)index;
-// Same as above, but returns defaultValue instead of nil.
-- (id)argumentAtIndex:(NSUInteger)index withDefault:(id)defaultValue;
-// Same as above, but returns defaultValue instead of nil, and if the argument is not of the expected class, returns defaultValue
-- (id)argumentAtIndex:(NSUInteger)index withDefault:(id)defaultValue andClass:(Class)aClass;
-
-@end

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/91c74886/lib/cordova-ios/CordovaLib/Classes/CDVInvokedUrlCommand.m
----------------------------------------------------------------------
diff --git a/lib/cordova-ios/CordovaLib/Classes/CDVInvokedUrlCommand.m b/lib/cordova-ios/CordovaLib/Classes/CDVInvokedUrlCommand.m
deleted file mode 100644
index 6c7a856..0000000
--- a/lib/cordova-ios/CordovaLib/Classes/CDVInvokedUrlCommand.m
+++ /dev/null
@@ -1,140 +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 "CDVInvokedUrlCommand.h"
-#import "CDVJSON.h"
-#import "NSData+Base64.h"
-
-@implementation CDVInvokedUrlCommand
-
-@synthesize arguments = _arguments;
-@synthesize callbackId = _callbackId;
-@synthesize className = _className;
-@synthesize methodName = _methodName;
-
-+ (CDVInvokedUrlCommand*)commandFromJson:(NSArray*)jsonEntry
-{
-    return [[CDVInvokedUrlCommand alloc] initFromJson:jsonEntry];
-}
-
-- (id)initFromJson:(NSArray*)jsonEntry
-{
-    id tmp = [jsonEntry objectAtIndex:0];
-    NSString* callbackId = tmp == [NSNull null] ? nil : tmp;
-    NSString* className = [jsonEntry objectAtIndex:1];
-    NSString* methodName = [jsonEntry objectAtIndex:2];
-    NSMutableArray* arguments = [jsonEntry objectAtIndex:3];
-
-    return [self initWithArguments:arguments
-                        callbackId:callbackId
-                         className:className
-                        methodName:methodName];
-}
-
-- (id)initWithArguments:(NSArray*)arguments
-             callbackId:(NSString*)callbackId
-              className:(NSString*)className
-             methodName:(NSString*)methodName
-{
-    self = [super init];
-    if (self != nil) {
-        _arguments = arguments;
-        _callbackId = callbackId;
-        _className = className;
-        _methodName = methodName;
-    }
-    [self massageArguments];
-    return self;
-}
-
-- (void)massageArguments
-{
-    NSMutableArray* newArgs = nil;
-
-    for (NSUInteger i = 0, count = [_arguments count]; i < count; ++i) {
-        id arg = [_arguments objectAtIndex:i];
-        if (![arg isKindOfClass:[NSDictionary class]]) {
-            continue;
-        }
-        NSDictionary* dict = arg;
-        NSString* type = [dict objectForKey:@"CDVType"];
-        if (!type || ![type isEqualToString:@"ArrayBuffer"]) {
-            continue;
-        }
-        NSString* data = [dict objectForKey:@"data"];
-        if (!data) {
-            continue;
-        }
-        if (newArgs == nil) {
-            newArgs = [NSMutableArray arrayWithArray:_arguments];
-            _arguments = newArgs;
-        }
-        [newArgs replaceObjectAtIndex:i withObject:[NSData dataFromBase64String:data]];
-    }
-}
-
-- (void)legacyArguments:(NSMutableArray**)legacyArguments andDict:(NSMutableDictionary**)legacyDict
-{
-    NSMutableArray* newArguments = [NSMutableArray arrayWithArray:_arguments];
-
-    for (NSUInteger i = 0; i < [newArguments count]; ++i) {
-        if ([[newArguments objectAtIndex:i] isKindOfClass:[NSDictionary class]]) {
-            if (legacyDict != NULL) {
-                *legacyDict = [newArguments objectAtIndex:i];
-            }
-            [newArguments removeObjectAtIndex:i];
-            break;
-        }
-    }
-
-    // Legacy (two versions back) has no callbackId.
-    if (_callbackId != nil) {
-        [newArguments insertObject:_callbackId atIndex:0];
-    }
-    if (legacyArguments != NULL) {
-        *legacyArguments = newArguments;
-    }
-}
-
-- (id)argumentAtIndex:(NSUInteger)index
-{
-    return [self argumentAtIndex:index withDefault:nil];
-}
-
-- (id)argumentAtIndex:(NSUInteger)index withDefault:(id)defaultValue
-{
-    return [self argumentAtIndex:index withDefault:defaultValue andClass:nil];
-}
-
-- (id)argumentAtIndex:(NSUInteger)index withDefault:(id)defaultValue andClass:(Class)aClass
-{
-    if (index >= [_arguments count]) {
-        return defaultValue;
-    }
-    id ret = [_arguments objectAtIndex:index];
-    if (ret == [NSNull null]) {
-        ret = defaultValue;
-    }
-    if ((aClass != nil) && ![ret isKindOfClass:aClass]) {
-        ret = defaultValue;
-    }
-    return ret;
-}
-
-@end

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/91c74886/lib/cordova-ios/CordovaLib/Classes/CDVJSON.h
----------------------------------------------------------------------
diff --git a/lib/cordova-ios/CordovaLib/Classes/CDVJSON.h b/lib/cordova-ios/CordovaLib/Classes/CDVJSON.h
deleted file mode 100644
index eaa895e..0000000
--- a/lib/cordova-ios/CordovaLib/Classes/CDVJSON.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.
- */
-
-@interface NSArray (CDVJSONSerializing)
-- (NSString*)JSONString;
-@end
-
-@interface NSDictionary (CDVJSONSerializing)
-- (NSString*)JSONString;
-@end
-
-@interface NSString (CDVJSONSerializing)
-- (id)JSONObject;
-@end

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/91c74886/lib/cordova-ios/CordovaLib/Classes/CDVJSON.m
----------------------------------------------------------------------
diff --git a/lib/cordova-ios/CordovaLib/Classes/CDVJSON.m b/lib/cordova-ios/CordovaLib/Classes/CDVJSON.m
deleted file mode 100644
index 78267e5..0000000
--- a/lib/cordova-ios/CordovaLib/Classes/CDVJSON.m
+++ /dev/null
@@ -1,77 +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 "CDVJSON.h"
-#import <Foundation/NSJSONSerialization.h>
-
-@implementation NSArray (CDVJSONSerializing)
-
-- (NSString*)JSONString
-{
-    NSError* error = nil;
-    NSData* jsonData = [NSJSONSerialization dataWithJSONObject:self
-                                                       options:NSJSONWritingPrettyPrinted
-                                                         error:&error];
-
-    if (error != nil) {
-        NSLog(@"NSArray JSONString error: %@", [error localizedDescription]);
-        return nil;
-    } else {
-        return [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
-    }
-}
-
-@end
-
-@implementation NSDictionary (CDVJSONSerializing)
-
-- (NSString*)JSONString
-{
-    NSError* error = nil;
-    NSData* jsonData = [NSJSONSerialization dataWithJSONObject:self
-                                                       options:NSJSONWritingPrettyPrinted
-                                                         error:&error];
-
-    if (error != nil) {
-        NSLog(@"NSDictionary JSONString error: %@", [error localizedDescription]);
-        return nil;
-    } else {
-        return [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
-    }
-}
-
-@end
-
-@implementation NSString (CDVJSONSerializing)
-
-- (id)JSONObject
-{
-    NSError* error = nil;
-    id object = [NSJSONSerialization JSONObjectWithData:[self dataUsingEncoding:NSUTF8StringEncoding]
-                                                options:kNilOptions
-                                                  error:&error];
-
-    if (error != nil) {
-        NSLog(@"NSString JSONObject error: %@", [error localizedDescription]);
-    }
-
-    return object;
-}
-
-@end

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/91c74886/lib/cordova-ios/CordovaLib/Classes/CDVJpegHeaderWriter.h
----------------------------------------------------------------------
diff --git a/lib/cordova-ios/CordovaLib/Classes/CDVJpegHeaderWriter.h b/lib/cordova-ios/CordovaLib/Classes/CDVJpegHeaderWriter.h
deleted file mode 100644
index 3b43ef0..0000000
--- a/lib/cordova-ios/CordovaLib/Classes/CDVJpegHeaderWriter.h
+++ /dev/null
@@ -1,62 +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 CDVJpegHeaderWriter : NSObject {
-    NSDictionary * SubIFDTagFormatDict;
-    NSDictionary * IFD0TagFormatDict;
-}
-
-- (NSData*) spliceExifBlockIntoJpeg: (NSData*) jpegdata
-                      withExifBlock: (NSString*) exifstr;
-- (NSString*) createExifAPP1 : (NSDictionary*) datadict;
-- (NSString*) formattedHexStringFromDecimalNumber: (NSNumber*) numb 
-                                       withPlaces: (NSNumber*) width;
-- (NSString*) formatNumberWithLeadingZeroes: (NSNumber*) numb 
-                                 withPlaces: (NSNumber*) places;
-- (NSString*) decimalToUnsignedRational: (NSNumber*) numb
-                    withResultNumerator: (NSNumber**) numerator
-                  withResultDenominator: (NSNumber**) denominator;
-- (void) continuedFraction: (double) val
-          withFractionList: (NSMutableArray*) fractionlist 
-               withHorizon: (int) horizon;
-//- (void) expandContinuedFraction: (NSArray*) fractionlist;
-- (void) splitDouble: (double) val 
-         withIntComponent: (int*) rightside 
-         withFloatRemainder: (double*) leftside;
-- (NSString*) formatRationalWithNumerator: (NSNumber*) numerator
-                          withDenominator: (NSNumber*) denominator
-                               asSigned: (Boolean) signedFlag;
-- (NSString*) hexStringFromData : (NSData*) data;
-- (NSNumber*) numericFromHexString : (NSString *) hexstring;
-
-/*
-- (void) readExifMetaData : (NSData*) imgdata;
-- (void) spliceImageData : (NSData*) imgdata withExifData: (NSDictionary*) exifdata;
-- (void) locateExifMetaData : (NSData*) imgdata;
-- (NSString*) createExifAPP1 : (NSDictionary*) datadict;
-- (void) createExifDataString : (NSDictionary*) datadict;
-- (NSString*) createDataElement : (NSString*) element
-              withElementData: (NSString*) data
-              withExternalDataBlock: (NSDictionary*) memblock;
-- (NSString*) hexStringFromData : (NSData*) data;
-- (NSNumber*) numericFromHexString : (NSString *) hexstring;
-*/
-@end

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/91c74886/lib/cordova-ios/CordovaLib/Classes/CDVJpegHeaderWriter.m
----------------------------------------------------------------------
diff --git a/lib/cordova-ios/CordovaLib/Classes/CDVJpegHeaderWriter.m b/lib/cordova-ios/CordovaLib/Classes/CDVJpegHeaderWriter.m
deleted file mode 100644
index 93cafb8..0000000
--- a/lib/cordova-ios/CordovaLib/Classes/CDVJpegHeaderWriter.m
+++ /dev/null
@@ -1,547 +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 "CDVJpegHeaderWriter.h"
-#include "CDVExif.h"
-
-/* macros for tag info shorthand:
-   tagno        : tag number
-   typecode     : data type
-   components   : number of components
-   appendString (TAGINF_W_APPEND only) : string to append to data
-      Exif date data format include an extra 0x00 to the end of the data
- */
-#define TAGINF(tagno, typecode, components) [NSArray arrayWithObjects: tagno, typecode, components, nil]
-#define TAGINF_W_APPEND(tagno, typecode, components, appendString) [NSArray arrayWithObjects: tagno, typecode, components, appendString, nil]
-
-const uint mJpegId = 0xffd8; // JPEG format marker
-const uint mExifMarker = 0xffe1; // APP1 jpeg header marker
-const uint mExif = 0x45786966; // ASCII 'Exif', first characters of valid exif header after size
-const uint mMotorallaByteAlign = 0x4d4d; // 'MM', motorola byte align, msb first or 'sane'
-const uint mIntelByteAlgin = 0x4949; // 'II', Intel byte align, lsb first or 'batshit crazy reverso world'
-const uint mTiffLength = 0x2a; // after byte align bits, next to bits are 0x002a(MM) or 0x2a00(II), tiff version number
-
-
-@implementation CDVJpegHeaderWriter
-
-- (id) init {    
-    self = [super init];
-    // supported tags for exif IFD
-    IFD0TagFormatDict = [[NSDictionary alloc] initWithObjectsAndKeys:
-                  //      TAGINF(@"010e", [NSNumber numberWithInt:EDT_ASCII_STRING], @0), @"ImageDescription",
-                        TAGINF_W_APPEND(@"0132", [NSNumber numberWithInt:EDT_ASCII_STRING], @20, @"00"), @"DateTime",
-                        TAGINF(@"010f", [NSNumber numberWithInt:EDT_ASCII_STRING], @0), @"Make",
-                        TAGINF(@"0110", [NSNumber numberWithInt:EDT_ASCII_STRING], @0), @"Model",
-                        TAGINF(@"0131", [NSNumber numberWithInt:EDT_ASCII_STRING], @0), @"Software",
-                        TAGINF(@"011a", [NSNumber numberWithInt:EDT_URATIONAL], @1), @"XResolution",
-                        TAGINF(@"011b", [NSNumber numberWithInt:EDT_URATIONAL], @1), @"YResolution",
-                        // currently supplied outside of Exif data block by UIImagePickerControllerMediaMetadata, this is set manually in CDVCamera.m
-    /*                    TAGINF(@"0112", [NSNumber numberWithInt:EDT_USHORT], @1), @"Orientation",
-                       
-                        // rest of the tags are supported by exif spec, but are not specified by UIImagePickerControllerMediaMedadata
-                        // should camera hardware supply these values in future versions, or if they can be derived, ImageHeaderWriter will include them gracefully
-                        TAGINF(@"0128", [NSNumber numberWithInt:EDT_USHORT], @1), @"ResolutionUnit",
-                        TAGINF(@"013e", [NSNumber numberWithInt:EDT_URATIONAL], @2), @"WhitePoint",
-                        TAGINF(@"013f", [NSNumber numberWithInt:EDT_URATIONAL], @6), @"PrimaryChromaticities",
-                        TAGINF(@"0211", [NSNumber numberWithInt:EDT_URATIONAL], @3), @"YCbCrCoefficients",
-                        TAGINF(@"0213", [NSNumber numberWithInt:EDT_USHORT], @1), @"YCbCrPositioning",
-                        TAGINF(@"0214", [NSNumber numberWithInt:EDT_URATIONAL], @6), @"ReferenceBlackWhite",
-                        TAGINF(@"8298", [NSNumber numberWithInt:EDT_URATIONAL], @0), @"Copyright",
-                         
-                        // offset to exif subifd, we determine this dynamically based on the size of the main exif IFD
-                        TAGINF(@"8769", [NSNumber numberWithInt:EDT_ULONG], @1), @"ExifOffset",*/
-                        nil];
-
-
-    // supported tages for exif subIFD
-    SubIFDTagFormatDict = [[NSDictionary alloc] initWithObjectsAndKeys:
-                           //TAGINF(@"9000", [NSNumber numberWithInt:], @), @"ExifVersion",
-                           //TAGINF(@"9202",[NSNumber numberWithInt:EDT_URATIONAL],@1), @"ApertureValue",
-                           //TAGINF(@"9203",[NSNumber numberWithInt:EDT_SRATIONAL],@1), @"BrightnessValue",
-                           TAGINF(@"a001",[NSNumber numberWithInt:EDT_USHORT],@1), @"ColorSpace",
-                           TAGINF_W_APPEND(@"9004",[NSNumber numberWithInt:EDT_ASCII_STRING],@20,@"00"), @"DateTimeDigitized",
-                           TAGINF_W_APPEND(@"9003",[NSNumber numberWithInt:EDT_ASCII_STRING],@20,@"00"), @"DateTimeOriginal",
-                           TAGINF(@"a402", [NSNumber numberWithInt:EDT_USHORT], @1), @"ExposureMode",
-                           TAGINF(@"8822", [NSNumber numberWithInt:EDT_USHORT], @1), @"ExposureProgram",
-                           //TAGINF(@"829a", [NSNumber numberWithInt:EDT_URATIONAL], @1), @"ExposureTime",
-                           //TAGINF(@"829d", [NSNumber numberWithInt:EDT_URATIONAL], @1), @"FNumber",
-                           TAGINF(@"9209", [NSNumber numberWithInt:EDT_USHORT], @1), @"Flash",
-                           // FocalLengthIn35mmFilm
-                           TAGINF(@"a405", [NSNumber numberWithInt:EDT_USHORT], @1), @"FocalLenIn35mmFilm",
-                           //TAGINF(@"920a", [NSNumber numberWithInt:EDT_URATIONAL], @1), @"FocalLength",
-                           //TAGINF(@"8827", [NSNumber numberWithInt:EDT_USHORT], @2), @"ISOSpeedRatings",
-                           TAGINF(@"9207", [NSNumber numberWithInt:EDT_USHORT],@1), @"MeteringMode",
-                           // specific to compressed data
-                           TAGINF(@"a002", [NSNumber numberWithInt:EDT_ULONG],@1), @"PixelXDimension",
-                           TAGINF(@"a003", [NSNumber numberWithInt:EDT_ULONG],@1), @"PixelYDimension",
-                           // data type undefined, but this is a DSC camera, so value is always 1, treat as ushort
-                           TAGINF(@"a301", [NSNumber numberWithInt:EDT_USHORT],@1), @"SceneType",
-                           TAGINF(@"a217",[NSNumber numberWithInt:EDT_USHORT],@1), @"SensingMethod",
-                           //TAGINF(@"9201", [NSNumber numberWithInt:EDT_SRATIONAL], @1), @"ShutterSpeedValue",
-                           // specifies location of main subject in scene (x,y,wdith,height) expressed before rotation processing
-                           //TAGINF(@"9214", [NSNumber numberWithInt:EDT_USHORT], @4), @"SubjectArea",
-                           TAGINF(@"a403", [NSNumber numberWithInt:EDT_USHORT], @1), @"WhiteBalance",
-                           nil];
-    return self;
-}
-
-- (NSData*) spliceExifBlockIntoJpeg: (NSData*) jpegdata withExifBlock: (NSString*) exifstr {
-    
-    CDVJpegHeaderWriter * exifWriter = [[CDVJpegHeaderWriter alloc] init];
-    
-    NSMutableData * exifdata = [NSMutableData dataWithCapacity: [exifstr length]/2];
-    int idx;
-    for (idx = 0; idx+1 < [exifstr length]; idx+=2) {
-        NSRange range = NSMakeRange(idx, 2);
-        NSString* hexStr = [exifstr substringWithRange:range];
-        NSScanner* scanner = [NSScanner scannerWithString:hexStr];
-        unsigned int intValue;
-        [scanner scanHexInt:&intValue];
-        [exifdata appendBytes:&intValue length:1];
-    }
-    
-    NSMutableData * ddata = [NSMutableData dataWithCapacity: [jpegdata length]];
-    NSMakeRange(0,4);
-    int loc = 0;
-    bool done = false;
-    // read the jpeg data until we encounter the app1==0xFFE1 marker
-    while (loc+1 < [jpegdata length]) {
-        NSData * blag = [jpegdata subdataWithRange: NSMakeRange(loc,2)];
-        if( [[blag description] isEqualToString : @"<ffe1>"]) {
-            // read the APP1 block size bits
-            NSString * the = [exifWriter hexStringFromData:[jpegdata subdataWithRange: NSMakeRange(loc+2,2)]];
-            NSNumber * app1width = [exifWriter numericFromHexString:the];
-            //consume the original app1 block
-            [ddata appendData:exifdata];
-            // advance our loc marker past app1
-            loc += [app1width intValue] + 2;
-            done = true;
-        } else {
-            if(!done) {
-                [ddata appendData:blag];
-                loc += 2;
-            } else {
-                break;
-            }
-        }
-    }
-    // copy the remaining data
-    [ddata appendData:[jpegdata subdataWithRange: NSMakeRange(loc,[jpegdata length]-loc)]];
-    return ddata;
-}
-
-
-
-/**
- * Create the Exif data block as a hex string
- *   jpeg uses Application Markers (APP's) as markers for application data
- *   APP1 is the application marker reserved for exif data
- *
- *   (NSDictionary*) datadict - with subdictionaries marked '{TIFF}' and '{EXIF}' as returned by imagePickerController with a valid
- *                              didFinishPickingMediaWithInfo data dict, under key @"UIImagePickerControllerMediaMetadata"
- *
- *   the following constructs a hex string to Exif specifications, and is therefore brittle
- *   altering the order of arguments to the string constructors, modifying field sizes or formats,
- *   and any other minor change will likely prevent the exif data from being read
- */
-- (NSString*) createExifAPP1 : (NSDictionary*) datadict {
-    NSMutableString * app1; // holds finalized product
-    NSString * exifIFD; // exif information file directory
-    NSString * subExifIFD; // subexif information file directory
-    
-    // FFE1 is the hex APP1 marker code, and will allow client apps to read the data
-    NSString * app1marker = @"ffe1";
-    // SSSS size, to be determined
-    // EXIF ascii characters followed by 2bytes of zeros
-    NSString * exifmarker = @"457869660000";
-    // Tiff header: 4d4d is motorolla byte align (big endian), 002a is hex for 42
-    NSString * tiffheader = @"4d4d002a";
-    //first IFD offset from the Tiff header to IFD0. Since we are writing it, we know it's address 0x08
-    NSString * ifd0offset = @"00000008";
-    // current offset to next data area
-    int currentDataOffset = 0;
-    
-    //data labeled as TIFF in UIImagePickerControllerMediaMetaData is part of the EXIF IFD0 portion of APP1
-    exifIFD = [self createExifIFDFromDict: [datadict objectForKey:@"{TIFF}"] withFormatDict: IFD0TagFormatDict isIFD0:YES currentDataOffset:&currentDataOffset];
-
-    //data labeled as EXIF in UIImagePickerControllerMediaMetaData is part of the EXIF Sub IFD portion of APP1
-    subExifIFD = [self createExifIFDFromDict: [datadict objectForKey:@"{Exif}"] withFormatDict: SubIFDTagFormatDict isIFD0:NO currentDataOffset:&currentDataOffset];
-    /*
-    NSLog(@"SUB EXIF IFD %@  WITH SIZE: %d",exifIFD,[exifIFD length]);
-    
-    NSLog(@"SUB EXIF IFD %@  WITH SIZE: %d",subExifIFD,[subExifIFD length]);
-    */
-    // construct the complete app1 data block
-    app1 = [[NSMutableString alloc] initWithFormat: @"%@%04x%@%@%@%@%@",
-            app1marker,
-            16 + ([exifIFD length]/2) + ([subExifIFD length]/2) /*16+[exifIFD length]/2*/,
-            exifmarker,
-            tiffheader,
-            ifd0offset,
-            exifIFD,
-            subExifIFD];
-     
-    return app1;
-}
-
-// returns hex string representing a valid exif information file directory constructed from the datadict and formatdict
-- (NSString*) createExifIFDFromDict : (NSDictionary*) datadict
-                     withFormatDict : (NSDictionary*) formatdict
-                             isIFD0 : (BOOL) ifd0flag
-                  currentDataOffset : (int*) dataoffset {
-    NSArray * datakeys = [datadict allKeys]; // all known data keys
-    NSArray * knownkeys = [formatdict  allKeys]; // only keys in knowkeys are considered for entry in this IFD
-    NSMutableArray * ifdblock = [[NSMutableArray alloc] initWithCapacity: [datadict count]]; // all ifd entries
-    NSMutableArray * ifddatablock = [[NSMutableArray alloc] initWithCapacity: [datadict count]]; // data block entries
- //   ifd0flag = NO; // ifd0 requires a special flag and has offset to next ifd appended to end
-    
-    // iterate through known provided data keys
-    for (int i = 0; i < [datakeys count]; i++) {
-        NSString * key = [datakeys objectAtIndex:i];
-        // don't muck about with unknown keys
-        if ([knownkeys indexOfObject: key] != NSNotFound) {
-            // create new IFD entry
-            NSString * entry = [self  createIFDElement: key
-                                            withFormat: [formatdict objectForKey:key]
-                                      withElementData: [datadict objectForKey:key]];
-            // create the IFD entry's data block
-            NSString * data = [self createIFDElementDataWithFormat: [formatdict objectForKey:key]
-                                                   withData: [datadict objectForKey:key]];
-            if (entry) {
-                [ifdblock addObject:entry];
-                if(!data) {
-                    [ifdblock addObject:@""];
-                } else {
-                    [ifddatablock addObject:data];
-                }
-            }
-        }
-    }
-    
-    NSMutableString * exifstr = [[NSMutableString alloc] initWithCapacity: [ifdblock count] * 24];
-    NSMutableString * dbstr = [[NSMutableString alloc] initWithCapacity: 100];
-    
-    int addr=*dataoffset; // current offset/address in datablock
-    if (ifd0flag) {
-        // calculate offset to datablock based on ifd file entry count
-        addr += 14+(12*([ifddatablock count]+1)); // +1 for tag 0x8769, exifsubifd offset
-    } else {
-        // current offset + numSubIFDs (2-bytes) + 12*numSubIFDs + endMarker (4-bytes)
-        addr += 2+(12*[ifddatablock count])+4;
-    }
-    
-    for (int i = 0; i < [ifdblock count]; i++) {
-        NSString * entry = [ifdblock objectAtIndex:i];
-        NSString * data = [ifddatablock objectAtIndex:i];
-        
-        // check if the data fits into 4 bytes
-        if( [data length] <= 8) {
-            // concatenate the entry and the (4byte) data entry into the final IFD entry and append to exif ifd string
-            [exifstr appendFormat : @"%@%@", entry, data];
-        } else {
-            [exifstr appendFormat : @"%@%08x", entry, addr];
-            [dbstr appendFormat: @"%@", data];
-            addr+= [data length] / 2;
-            /*
-            NSLog(@"=====data-length[%i]=======",[data length]);
-            NSLog(@"addr-offset[%i]",addr);
-            NSLog(@"entry[%@]",entry);
-            NSLog(@"data[%@]",data);
-             */
-        }
-    }
-    
-    // calculate IFD0 terminal offset tags, currently ExifSubIFD
-    int entrycount = [ifdblock count];
-    if (ifd0flag) {
-        // 18 accounts for 8769's width + offset to next ifd, 8 accounts for start of header
-        NSNumber * offset = [NSNumber numberWithInt:[exifstr length] / 2 + [dbstr length] / 2 + 18+8];
-        
-        [self appendExifOffsetTagTo: exifstr
-                        withOffset : offset];
-        entrycount++;
-    }
-    *dataoffset = addr;
-    return [[NSString alloc] initWithFormat: @"%04x%@%@%@",
-            entrycount,
-            exifstr,
-            @"00000000", // offset to next IFD, 0 since there is none
-            dbstr]; // lastly, the datablock
-}
-
-// Creates an exif formatted exif information file directory entry
-- (NSString*) createIFDElement: (NSString*) elementName withFormat: (NSArray*) formtemplate withElementData: (NSString*) data  {
-    //NSArray * fielddata = [formatdict objectForKey: elementName];// format data of desired field
-    if (formtemplate) {
-        // format string @"%@%@%@%@", tag number, data format, components, value
-        NSNumber * dataformat = [formtemplate objectAtIndex:1];
-        NSNumber * components = [formtemplate objectAtIndex:2];
-        if([components intValue] == 0) {
-            components = [NSNumber numberWithInt: [data length] * DataTypeToWidth[[dataformat intValue]-1]];            
-        }
-
-        return [[NSString alloc] initWithFormat: @"%@%@%08x",
-                                                [formtemplate objectAtIndex:0], // the field code
-                                                [self formatNumberWithLeadingZeroes: dataformat withPlaces: @4], // the data type code
-                                                [components intValue]]; // number of components
-    }
-    return NULL;
-}
-
-/**
- * appends exif IFD0 tag 8769 "ExifOffset" to the string provided
- * (NSMutableString*) str - string you wish to append the 8769 tag to: APP1 or IFD0 hex data string 
- *  //  TAGINF(@"8769", [NSNumber numberWithInt:EDT_ULONG], @1), @"ExifOffset",
- */
-- (void) appendExifOffsetTagTo: (NSMutableString*) str withOffset : (NSNumber*) offset {
-    NSArray * format = TAGINF(@"8769", [NSNumber numberWithInt:EDT_ULONG], @1);
-    
-    NSString * entry = [self  createIFDElement: @"ExifOffset"
-                                withFormat: format
-                               withElementData: [offset stringValue]];
-    
-    NSString * data = [self createIFDElementDataWithFormat: format
-                                                  withData: [offset stringValue]];
-    [str appendFormat:@"%@%@", entry, data];
-}
-
-// formats the Information File Directory Data to exif format
-- (NSString*) createIFDElementDataWithFormat: (NSArray*) dataformat withData: (NSString*) data {
-    NSMutableString * datastr = nil;
-    NSNumber * tmp = nil;
-    NSNumber * formatcode = [dataformat objectAtIndex:1];
-    NSUInteger formatItemsCount = [dataformat count];
-    NSNumber * num = @0;
-    NSNumber * denom = @0;
-    
-    switch ([formatcode intValue]) {
-        case EDT_UBYTE:
-            break;
-        case EDT_ASCII_STRING:
-            datastr = [[NSMutableString alloc] init];
-            for (int i = 0; i < [data length]; i++) {
-                [datastr appendFormat:@"%02x",[data characterAtIndex:i]];
-            }
-            if (formatItemsCount > 3) {
-                // We have additional data to append.
-                // currently used by Date format to append final 0x00 but can be used by other data types as well in the future
-                [datastr appendString:[dataformat objectAtIndex:3]];
-            }
-            if ([datastr length] < 8) {
-                NSString * format = [NSString stringWithFormat:@"%%0%dd", 8 - [datastr length]];
-                [datastr appendFormat:format,0];
-            }
-            return datastr;
-        case EDT_USHORT:
-            return [[NSString alloc] initWithFormat : @"%@%@",
-                    [self formattedHexStringFromDecimalNumber: [NSNumber numberWithInt: [data intValue]] withPlaces: @4],
-                    @"0000"];
-        case EDT_ULONG:
-            tmp = [NSNumber numberWithUnsignedLong:[data intValue]];
-            return [NSString stringWithFormat : @"%@",
-                    [self formattedHexStringFromDecimalNumber: tmp withPlaces: @8]];
-        case EDT_URATIONAL:
-            return [self decimalToUnsignedRational: [NSNumber numberWithDouble:[data doubleValue]]
-                               withResultNumerator: &num
-                             withResultDenominator: &denom];
-        case EDT_SBYTE:
-            
-            break;
-        case EDT_UNDEFINED:
-            break;     // 8 bits
-        case EDT_SSHORT:
-            break;
-        case EDT_SLONG:
-            break;          // 32bit signed integer (2's complement)
-        case EDT_SRATIONAL:
-            break;     // 2 SLONGS, first long is numerator, second is denominator
-        case EDT_SINGLEFLOAT:
-            break;
-        case EDT_DOUBLEFLOAT:
-            break;
-    }
-    return datastr;
-}
-
-//======================================================================================================================
-// Utility Methods
-//======================================================================================================================
-
-// creates a formatted little endian hex string from a number and width specifier
-- (NSString*) formattedHexStringFromDecimalNumber: (NSNumber*) numb withPlaces: (NSNumber*) width {
-    NSMutableString * str = [[NSMutableString alloc] initWithCapacity:[width intValue]];
-    NSString * formatstr = [[NSString alloc] initWithFormat: @"%%%@%dx", @"0", [width intValue]];
-    [str appendFormat:formatstr, [numb intValue]];
-    return str;
-}
-
-// format number as string with leading 0's
-- (NSString*) formatNumberWithLeadingZeroes: (NSNumber *) numb withPlaces: (NSNumber *) places { 
-    NSNumberFormatter * formatter = [[NSNumberFormatter alloc] init];
-    NSString *formatstr = [@"" stringByPaddingToLength:[places unsignedIntegerValue] withString:@"0" startingAtIndex:0];
-    [formatter setPositiveFormat:formatstr];
-    return [formatter stringFromNumber:numb];
-}
-
-// approximate a decimal with a rational by method of continued fraction
-// can be collasped into decimalToUnsignedRational after testing
-- (void) decimalToRational: (NSNumber *) numb
-       withResultNumerator: (NSNumber**) numerator
-     withResultDenominator: (NSNumber**) denominator {
-    NSMutableArray * fractionlist = [[NSMutableArray alloc] initWithCapacity:8];
-    
-    [self continuedFraction: [numb doubleValue]
-           withFractionList: fractionlist
-                withHorizon: 8];
-    
-    // simplify complex fraction represented by partial fraction list
-    [self expandContinuedFraction: fractionlist
-              withResultNumerator: numerator
-            withResultDenominator: denominator];
-
-}
-
-// approximate a decimal with an unsigned rational by method of continued fraction
-- (NSString*) decimalToUnsignedRational: (NSNumber *) numb
-                          withResultNumerator: (NSNumber**) numerator
-                        withResultDenominator: (NSNumber**) denominator {
-    NSMutableArray * fractionlist = [[NSMutableArray alloc] initWithCapacity:8];
-    
-    // generate partial fraction list
-    [self continuedFraction: [numb doubleValue]
-           withFractionList: fractionlist
-                withHorizon: 8];
-    
-    // simplify complex fraction represented by partial fraction list
-    [self expandContinuedFraction: fractionlist
-              withResultNumerator: numerator
-            withResultDenominator: denominator];
-    
-    return [self formatFractionList: fractionlist];
-}
-
-// recursive implementation of decimal approximation by continued fraction
-- (void) continuedFraction: (double) val
-          withFractionList: (NSMutableArray*) fractionlist
-               withHorizon: (int) horizon {
-    int whole;
-    double remainder;
-    // 1. split term
-    [self splitDouble: val withIntComponent: &whole withFloatRemainder: &remainder];
-    [fractionlist addObject: [NSNumber numberWithInt:whole]];
-    
-    // 2. calculate reciprocal of remainder
-    if (!remainder) return; // early exit, exact fraction found, avoids recip/0
-    double recip = 1 / remainder;
-
-    // 3. exit condition
-    if ([fractionlist count] > horizon) {
-        return;
-    }
-    
-    // 4. recurse
-    [self continuedFraction:recip withFractionList: fractionlist withHorizon: horizon];
-    
-}
-
-// expand continued fraction list, creating a single level rational approximation
--(void) expandContinuedFraction: (NSArray*) fractionlist
-                  withResultNumerator: (NSNumber**) numerator
-                withResultDenominator: (NSNumber**) denominator {
-    int i = 0;
-    int den = 0;
-    int num = 0;
-    if ([fractionlist count] == 1) {
-        *numerator = [NSNumber numberWithInt:[[fractionlist objectAtIndex:0] intValue]];
-        *denominator = @1;
-        return;
-    }
-    
-    //begin at the end of the list
-    i = [fractionlist count] - 1;
-    num = 1;
-    den = [[fractionlist objectAtIndex:i] intValue];
-    
-    while (i > 0) {
-        int t = [[fractionlist objectAtIndex: i-1] intValue];
-        num = t * den + num;
-        if (i==1) {
-            break;
-        } else {
-            t = num;
-            num = den;
-            den = t;
-        }
-        i--;
-    }
-    // set result parameters values
-    *numerator = [NSNumber numberWithInt: num];
-    *denominator = [NSNumber numberWithInt: den];
-}
-
-// formats expanded fraction list to string matching exif specification
-- (NSString*) formatFractionList: (NSArray *) fractionlist {
-    NSMutableString * str = [[NSMutableString alloc] initWithCapacity:16];
-    
-    if ([fractionlist count] == 1){
-        [str appendFormat: @"%08x00000001", [[fractionlist objectAtIndex:0] intValue]];
-    }
-    return str;
-}
-
-// format rational as
-- (NSString*) formatRationalWithNumerator: (NSNumber*) numerator withDenominator: (NSNumber*) denominator asSigned: (Boolean) signedFlag {
-    NSMutableString * str = [[NSMutableString alloc] initWithCapacity:16];
-    if (signedFlag) {
-        long num = [numerator longValue];
-        long den = [denominator longValue];
-        [str appendFormat: @"%08lx%08lx", num >= 0 ? num : ~ABS(num) + 1, num >= 0 ? den : ~ABS(den) + 1];
-    } else {
-        [str appendFormat: @"%08lx%08lx", [numerator unsignedLongValue], [denominator unsignedLongValue]];
-    }
-    return str;
-}
-
-// split a floating point number into two integer values representing the left and right side of the decimal
-- (void) splitDouble: (double) val withIntComponent: (int*) rightside withFloatRemainder: (double*) leftside {
-    *rightside = val; // convert numb to int representation, which truncates the decimal portion
-    *leftside = val - *rightside;
-}
-
-
-//
-- (NSString*) hexStringFromData : (NSData*) data {
-    //overflow detection
-    const unsigned char *dataBuffer = [data bytes];
-    return [[NSString alloc] initWithFormat: @"%02x%02x",
-            (unsigned char)dataBuffer[0],
-            (unsigned char)dataBuffer[1]];
-}
-
-// convert a hex string to a number
-- (NSNumber*) numericFromHexString : (NSString *) hexstring {
-    NSScanner * scan = NULL;
-    unsigned int numbuf= 0;
-    
-    scan = [NSScanner scannerWithString:hexstring];
-    [scan scanHexInt:&numbuf];
-    return [NSNumber numberWithInt:numbuf];
-}
-
-@end

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/91c74886/lib/cordova-ios/CordovaLib/Classes/CDVLocalStorage.h
----------------------------------------------------------------------
diff --git a/lib/cordova-ios/CordovaLib/Classes/CDVLocalStorage.h b/lib/cordova-ios/CordovaLib/Classes/CDVLocalStorage.h
deleted file mode 100644
index dec6ab3..0000000
--- a/lib/cordova-ios/CordovaLib/Classes/CDVLocalStorage.h
+++ /dev/null
@@ -1,50 +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 "CDVPlugin.h"
-
-#define kCDVLocalStorageErrorDomain @"kCDVLocalStorageErrorDomain"
-#define kCDVLocalStorageFileOperationError 1
-
-@interface CDVLocalStorage : CDVPlugin
-
-@property (nonatomic, readonly, strong) NSMutableArray* backupInfo;
-
-- (BOOL)shouldBackup;
-- (BOOL)shouldRestore;
-- (void)backup:(CDVInvokedUrlCommand*)command;
-- (void)restore:(CDVInvokedUrlCommand*)command;
-
-+ (void)__fixupDatabaseLocationsWithBackupType:(NSString*)backupType;
-// Visible for testing.
-+ (BOOL)__verifyAndFixDatabaseLocationsWithAppPlistDict:(NSMutableDictionary*)appPlistDict
-                                             bundlePath:(NSString*)bundlePath
-                                            fileManager:(NSFileManager*)fileManager;
-@end
-
-@interface CDVBackupInfo : NSObject
-
-@property (nonatomic, copy) NSString* original;
-@property (nonatomic, copy) NSString* backup;
-@property (nonatomic, copy) NSString* label;
-
-- (BOOL)shouldBackup;
-- (BOOL)shouldRestore;
-
-@end


Mime
View raw message