You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by sn...@apache.org on 2014/03/31 20:21:35 UTC

[33/52] [abbrv] [partial] fix api-url issue

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/7eb23f2c/portal/dist/appsvc-ui/2.0.2/bower_components/usergrid-portal/portal/dist/appsvc-ui/2.0.1/bower_components/apigee-sdk/samples/push/ios/CordovaLib/Classes/CDVCamera.m
----------------------------------------------------------------------
diff --git a/portal/dist/appsvc-ui/2.0.2/bower_components/usergrid-portal/portal/dist/appsvc-ui/2.0.1/bower_components/apigee-sdk/samples/push/ios/CordovaLib/Classes/CDVCamera.m b/portal/dist/appsvc-ui/2.0.2/bower_components/usergrid-portal/portal/dist/appsvc-ui/2.0.1/bower_components/apigee-sdk/samples/push/ios/CordovaLib/Classes/CDVCamera.m
deleted file mode 100644
index 823fde9..0000000
--- a/portal/dist/appsvc-ui/2.0.2/bower_components/usergrid-portal/portal/dist/appsvc-ui/2.0.1/bower_components/apigee-sdk/samples/push/ios/CordovaLib/Classes/CDVCamera.m
+++ /dev/null
@@ -1,570 +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 "CDVCamera.h"
-#import "CDVJpegHeaderWriter.h"
-#import "NSArray+Comparisons.h"
-#import "NSData+Base64.h"
-#import "NSDictionary+Extensions.h"
-#import <MobileCoreServices/UTCoreTypes.h>
-
-#define CDV_PHOTO_PREFIX @"cdv_photo_"
-
-static NSSet* org_apache_cordova_validArrowDirections;
-
-@interface CDVCamera ()
-
-@property (readwrite, assign) BOOL hasPendingOperation;
-
-@end
-
-@implementation CDVCamera
-
-+ (void)initialize
-{
-    org_apache_cordova_validArrowDirections = [[NSSet alloc] initWithObjects:[NSNumber numberWithInt:UIPopoverArrowDirectionUp], [NSNumber numberWithInt:UIPopoverArrowDirectionDown], [NSNumber numberWithInt:UIPopoverArrowDirectionLeft], [NSNumber numberWithInt:UIPopoverArrowDirectionRight], [NSNumber numberWithInt:UIPopoverArrowDirectionAny], nil];
-}
-
-@synthesize hasPendingOperation, pickerController;
-
-- (BOOL)popoverSupported
-{
-    return (NSClassFromString(@"UIPopoverController") != nil) &&
-           (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad);
-}
-
-/*  takePicture arguments:
- * INDEX   ARGUMENT
- *  0       quality
- *  1       destination type
- *  2       source type
- *  3       targetWidth
- *  4       targetHeight
- *  5       encodingType
- *  6       mediaType
- *  7       allowsEdit
- *  8       correctOrientation
- *  9       saveToPhotoAlbum
- *  10      popoverOptions
- *  11      cameraDirection
- */
-- (void)takePicture:(CDVInvokedUrlCommand*)command
-{
-    NSString* callbackId = command.callbackId;
-    NSArray* arguments = command.arguments;
-
-    self.hasPendingOperation = NO;
-
-    NSString* sourceTypeString = [arguments objectAtIndex:2];
-    UIImagePickerControllerSourceType sourceType = UIImagePickerControllerSourceTypeCamera; // default
-    if (sourceTypeString != nil) {
-        sourceType = (UIImagePickerControllerSourceType)[sourceTypeString intValue];
-    }
-
-    bool hasCamera = [UIImagePickerController isSourceTypeAvailable:sourceType];
-    if (!hasCamera) {
-        NSLog(@"Camera.getPicture: source type %d not available.", sourceType);
-        CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"no camera available"];
-        [self.commandDelegate sendPluginResult:result callbackId:callbackId];
-        return;
-    }
-
-    bool allowEdit = [[arguments objectAtIndex:7] boolValue];
-    NSNumber* targetWidth = [arguments objectAtIndex:3];
-    NSNumber* targetHeight = [arguments objectAtIndex:4];
-    NSNumber* mediaValue = [arguments objectAtIndex:6];
-    CDVMediaType mediaType = (mediaValue) ? [mediaValue intValue] : MediaTypePicture;
-
-    CGSize targetSize = CGSizeMake(0, 0);
-    if ((targetWidth != nil) && (targetHeight != nil)) {
-        targetSize = CGSizeMake([targetWidth floatValue], [targetHeight floatValue]);
-    }
-
-    // If a popover is already open, close it; we only want one at a time.
-    if (([[self pickerController] popoverController] != nil) && [[[self pickerController] popoverController] isPopoverVisible]) {
-        [[[self pickerController] popoverController] dismissPopoverAnimated:YES];
-        [[[self pickerController] popoverController] setDelegate:nil];
-        [[self pickerController] setPopoverController:nil];
-    }
-
-    CDVCameraPicker* cameraPicker = [[CDVCameraPicker alloc] init];
-    self.pickerController = cameraPicker;
-
-    cameraPicker.delegate = self;
-    cameraPicker.sourceType = sourceType;
-    cameraPicker.allowsEditing = allowEdit; // THIS IS ALL IT TAKES FOR CROPPING - jm
-    cameraPicker.callbackId = callbackId;
-    cameraPicker.targetSize = targetSize;
-    cameraPicker.cropToSize = NO;
-    // we need to capture this state for memory warnings that dealloc this object
-    cameraPicker.webView = self.webView;
-    cameraPicker.popoverSupported = [self popoverSupported];
-
-    cameraPicker.correctOrientation = [[arguments objectAtIndex:8] boolValue];
-    cameraPicker.saveToPhotoAlbum = [[arguments objectAtIndex:9] boolValue];
-
-    cameraPicker.encodingType = ([arguments objectAtIndex:5]) ? [[arguments objectAtIndex:5] intValue] : EncodingTypeJPEG;
-
-    cameraPicker.quality = ([arguments objectAtIndex:0]) ? [[arguments objectAtIndex:0] intValue] : 50;
-    cameraPicker.returnType = ([arguments objectAtIndex:1]) ? [[arguments objectAtIndex:1] intValue] : DestinationTypeFileUri;
-
-    if (sourceType == UIImagePickerControllerSourceTypeCamera) {
-        // We only allow taking pictures (no video) in this API.
-        cameraPicker.mediaTypes = [NSArray arrayWithObjects:(NSString*)kUTTypeImage, nil];
-
-        // We can only set the camera device if we're actually using the camera.
-        NSNumber* cameraDirection = [command argumentAtIndex:11 withDefault:[NSNumber numberWithInteger:UIImagePickerControllerCameraDeviceRear]];
-        cameraPicker.cameraDevice = (UIImagePickerControllerCameraDevice)[cameraDirection intValue];
-    } else if (mediaType == MediaTypeAll) {
-        cameraPicker.mediaTypes = [UIImagePickerController availableMediaTypesForSourceType:sourceType];
-    } else {
-        NSArray* mediaArray = [NSArray arrayWithObjects:(NSString*)(mediaType == MediaTypeVideo ? kUTTypeMovie : kUTTypeImage), nil];
-        cameraPicker.mediaTypes = mediaArray;
-    }
-
-    if ([self popoverSupported] && (sourceType != UIImagePickerControllerSourceTypeCamera)) {
-        if (cameraPicker.popoverController == nil) {
-            cameraPicker.popoverController = [[NSClassFromString(@"UIPopoverController")alloc] initWithContentViewController:cameraPicker];
-        }
-        NSDictionary* options = [command.arguments objectAtIndex:10 withDefault:nil];
-        [self displayPopover:options];
-    } else {
-        if ([self.viewController respondsToSelector:@selector(presentViewController:::)]) {
-            [self.viewController presentViewController:cameraPicker animated:YES completion:nil];
-        } else {
-            [self.viewController presentModalViewController:cameraPicker animated:YES];
-        }
-    }
-    self.hasPendingOperation = YES;
-}
-
-- (void)repositionPopover:(CDVInvokedUrlCommand*)command
-{
-    NSDictionary* options = [command.arguments objectAtIndex:0 withDefault:nil];
-
-    [self displayPopover:options];
-}
-
-- (void)displayPopover:(NSDictionary*)options
-{
-    int x = 0;
-    int y = 32;
-    int width = 320;
-    int height = 480;
-    UIPopoverArrowDirection arrowDirection = UIPopoverArrowDirectionAny;
-
-    if (options) {
-        x = [options integerValueForKey:@"x" defaultValue:0];
-        y = [options integerValueForKey:@"y" defaultValue:32];
-        width = [options integerValueForKey:@"width" defaultValue:320];
-        height = [options integerValueForKey:@"height" defaultValue:480];
-        arrowDirection = [options integerValueForKey:@"arrowDir" defaultValue:UIPopoverArrowDirectionAny];
-        if (![org_apache_cordova_validArrowDirections containsObject:[NSNumber numberWithInt:arrowDirection]]) {
-            arrowDirection = UIPopoverArrowDirectionAny;
-        }
-    }
-
-    [[[self pickerController] popoverController] setDelegate:self];
-    [[[self pickerController] popoverController] presentPopoverFromRect:CGRectMake(x, y, width, height)
-                                                                 inView:[self.webView superview]
-                                               permittedArrowDirections:arrowDirection
-                                                               animated:YES];
-}
-
-- (void)cleanup:(CDVInvokedUrlCommand*)command
-{
-    // empty the tmp directory
-    NSFileManager* fileMgr = [[NSFileManager alloc] init];
-    NSError* err = nil;
-    BOOL hasErrors = NO;
-
-    // clear contents of NSTemporaryDirectory
-    NSString* tempDirectoryPath = NSTemporaryDirectory();
-    NSDirectoryEnumerator* directoryEnumerator = [fileMgr enumeratorAtPath:tempDirectoryPath];
-    NSString* fileName = nil;
-    BOOL result;
-
-    while ((fileName = [directoryEnumerator nextObject])) {
-        // only delete the files we created
-        if (![fileName hasPrefix:CDV_PHOTO_PREFIX]) {
-            continue;
-        }
-        NSString* filePath = [tempDirectoryPath stringByAppendingPathComponent:fileName];
-        result = [fileMgr removeItemAtPath:filePath error:&err];
-        if (!result && err) {
-            NSLog(@"Failed to delete: %@ (error: %@)", filePath, err);
-            hasErrors = YES;
-        }
-    }
-
-    CDVPluginResult* pluginResult;
-    if (hasErrors) {
-        pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_IO_EXCEPTION messageAsString:@"One or more files failed to be deleted."];
-    } else {
-        pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
-    }
-    [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
-}
-
-- (void)popoverControllerDidDismissPopover:(id)popoverController
-{
-    // [ self imagePickerControllerDidCancel:self.pickerController ];	'
-    UIPopoverController* pc = (UIPopoverController*)popoverController;
-
-    [pc dismissPopoverAnimated:YES];
-    pc.delegate = nil;
-    if (self.pickerController && self.pickerController.callbackId && self.pickerController.popoverController) {
-        self.pickerController.popoverController = nil;
-        NSString* callbackId = self.pickerController.callbackId;
-        CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"no image selected"];   // error callback expects string ATM
-        [self.commandDelegate sendPluginResult:result callbackId:callbackId];
-    }
-    self.hasPendingOperation = NO;
-}
-
-- (void)imagePickerController:(UIImagePickerController*)picker didFinishPickingMediaWithInfo:(NSDictionary*)info
-{
-    CDVCameraPicker* cameraPicker = (CDVCameraPicker*)picker;
-
-    if (cameraPicker.popoverSupported && (cameraPicker.popoverController != nil)) {
-        [cameraPicker.popoverController dismissPopoverAnimated:YES];
-        cameraPicker.popoverController.delegate = nil;
-        cameraPicker.popoverController = nil;
-    } else {
-        if ([cameraPicker respondsToSelector:@selector(presentingViewController)]) {
-            [[cameraPicker presentingViewController] dismissModalViewControllerAnimated:YES];
-        } else {
-            [[cameraPicker parentViewController] dismissModalViewControllerAnimated:YES];
-        }
-    }
-
-    CDVPluginResult* result = nil;
-
-    NSString* mediaType = [info objectForKey:UIImagePickerControllerMediaType];
-    // IMAGE TYPE
-    if ([mediaType isEqualToString:(NSString*)kUTTypeImage]) {
-        if (cameraPicker.returnType == DestinationTypeNativeUri) {
-            NSString* nativeUri = [(NSURL*)[info objectForKey:UIImagePickerControllerReferenceURL] absoluteString];
-            result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:nativeUri];
-        } else {
-            // get the image
-            UIImage* image = nil;
-            if (cameraPicker.allowsEditing && [info objectForKey:UIImagePickerControllerEditedImage]) {
-                image = [info objectForKey:UIImagePickerControllerEditedImage];
-            } else {
-                image = [info objectForKey:UIImagePickerControllerOriginalImage];
-            }
-
-            if (cameraPicker.saveToPhotoAlbum) {
-                UIImageWriteToSavedPhotosAlbum(image, nil, nil, nil);
-            }
-
-            if (cameraPicker.correctOrientation) {
-                image = [self imageCorrectedForCaptureOrientation:image];
-            }
-
-            UIImage* scaledImage = nil;
-
-            if ((cameraPicker.targetSize.width > 0) && (cameraPicker.targetSize.height > 0)) {
-                // if cropToSize, resize image and crop to target size, otherwise resize to fit target without cropping
-                if (cameraPicker.cropToSize) {
-                    scaledImage = [self imageByScalingAndCroppingForSize:image toSize:cameraPicker.targetSize];
-                } else {
-                    scaledImage = [self imageByScalingNotCroppingForSize:image toSize:cameraPicker.targetSize];
-                }
-            }
-
-            NSData* data = nil;
-
-            if (cameraPicker.encodingType == EncodingTypePNG) {
-                data = UIImagePNGRepresentation(scaledImage == nil ? image : scaledImage);
-            } else {
-                data = UIImageJPEGRepresentation(scaledImage == nil ? image : scaledImage, cameraPicker.quality / 100.0f);
-
-                /* splice loc */
-                CDVJpegHeaderWriter* exifWriter = [[CDVJpegHeaderWriter alloc] init];
-                NSString* headerstring = [exifWriter createExifAPP1:[info objectForKey:@"UIImagePickerControllerMediaMetadata"]];
-                data = [exifWriter spliceExifBlockIntoJpeg:data withExifBlock:headerstring];
-            }
-
-            if (cameraPicker.returnType == DestinationTypeFileUri) {
-                // write to temp directory and return URI
-                // get the temp directory path
-                NSString* docsPath = [NSTemporaryDirectory()stringByStandardizingPath];
-                NSError* err = nil;
-                NSFileManager* fileMgr = [[NSFileManager alloc] init]; // recommended by apple (vs [NSFileManager defaultManager]) to be threadsafe
-                // generate unique file name
-                NSString* filePath;
-
-                int i = 1;
-                do {
-                    filePath = [NSString stringWithFormat:@"%@/%@%03d.%@", docsPath, CDV_PHOTO_PREFIX, i++, cameraPicker.encodingType == EncodingTypePNG ? @"png":@"jpg"];
-                } while ([fileMgr fileExistsAtPath:filePath]);
-
-                // save file
-                if (![data writeToFile:filePath options:NSAtomicWrite error:&err]) {
-                    result = [CDVPluginResult resultWithStatus:CDVCommandStatus_IO_EXCEPTION messageAsString:[err localizedDescription]];
-                } else {
-                    result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:[[NSURL fileURLWithPath:filePath] absoluteString]];
-                }
-            } else {
-                result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:[data base64EncodedString]];
-            }
-        }
-    }
-    // NOT IMAGE TYPE (MOVIE)
-    else {
-        NSString* moviePath = [[info objectForKey:UIImagePickerControllerMediaURL] absoluteString];
-        result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:moviePath];
-    }
-
-    if (result) {
-        [self.commandDelegate sendPluginResult:result callbackId:cameraPicker.callbackId];
-    }
-
-    self.hasPendingOperation = NO;
-    self.pickerController = nil;
-}
-
-// older api calls newer didFinishPickingMediaWithInfo
-- (void)imagePickerController:(UIImagePickerController*)picker didFinishPickingImage:(UIImage*)image editingInfo:(NSDictionary*)editingInfo
-{
-    NSDictionary* imageInfo = [NSDictionary dictionaryWithObject:image forKey:UIImagePickerControllerOriginalImage];
-
-    [self imagePickerController:picker didFinishPickingMediaWithInfo:imageInfo];
-}
-
-- (void)imagePickerControllerDidCancel:(UIImagePickerController*)picker
-{
-    CDVCameraPicker* cameraPicker = (CDVCameraPicker*)picker;
-
-    if ([cameraPicker respondsToSelector:@selector(presentingViewController)]) {
-        [[cameraPicker presentingViewController] dismissModalViewControllerAnimated:YES];
-    } else {
-        [[cameraPicker parentViewController] dismissModalViewControllerAnimated:YES];
-    }
-    // popoverControllerDidDismissPopover:(id)popoverController is called if popover is cancelled
-
-    CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"no image selected"];   // error callback expects string ATM
-    [self.commandDelegate sendPluginResult:result callbackId:cameraPicker.callbackId];
-
-    self.hasPendingOperation = NO;
-    self.pickerController = nil;
-}
-
-- (UIImage*)imageByScalingAndCroppingForSize:(UIImage*)anImage toSize:(CGSize)targetSize
-{
-    UIImage* sourceImage = anImage;
-    UIImage* newImage = nil;
-    CGSize imageSize = sourceImage.size;
-    CGFloat width = imageSize.width;
-    CGFloat height = imageSize.height;
-    CGFloat targetWidth = targetSize.width;
-    CGFloat targetHeight = targetSize.height;
-    CGFloat scaleFactor = 0.0;
-    CGFloat scaledWidth = targetWidth;
-    CGFloat scaledHeight = targetHeight;
-    CGPoint thumbnailPoint = CGPointMake(0.0, 0.0);
-
-    if (CGSizeEqualToSize(imageSize, targetSize) == NO) {
-        CGFloat widthFactor = targetWidth / width;
-        CGFloat heightFactor = targetHeight / height;
-
-        if (widthFactor > heightFactor) {
-            scaleFactor = widthFactor; // scale to fit height
-        } else {
-            scaleFactor = heightFactor; // scale to fit width
-        }
-        scaledWidth = width * scaleFactor;
-        scaledHeight = height * scaleFactor;
-
-        // center the image
-        if (widthFactor > heightFactor) {
-            thumbnailPoint.y = (targetHeight - scaledHeight) * 0.5;
-        } else if (widthFactor < heightFactor) {
-            thumbnailPoint.x = (targetWidth - scaledWidth) * 0.5;
-        }
-    }
-
-    UIGraphicsBeginImageContext(targetSize); // this will crop
-
-    CGRect thumbnailRect = CGRectZero;
-    thumbnailRect.origin = thumbnailPoint;
-    thumbnailRect.size.width = scaledWidth;
-    thumbnailRect.size.height = scaledHeight;
-
-    [sourceImage drawInRect:thumbnailRect];
-
-    newImage = UIGraphicsGetImageFromCurrentImageContext();
-    if (newImage == nil) {
-        NSLog(@"could not scale image");
-    }
-
-    // pop the context to get back to the default
-    UIGraphicsEndImageContext();
-    return newImage;
-}
-
-- (UIImage*)imageCorrectedForCaptureOrientation:(UIImage*)anImage
-{
-    float rotation_radians = 0;
-    bool perpendicular = false;
-
-    switch ([anImage imageOrientation]) {
-        case UIImageOrientationUp :
-            rotation_radians = 0.0;
-            break;
-
-        case UIImageOrientationDown:
-            rotation_radians = M_PI; // don't be scared of radians, if you're reading this, you're good at math
-            break;
-
-        case UIImageOrientationRight:
-            rotation_radians = M_PI_2;
-            perpendicular = true;
-            break;
-
-        case UIImageOrientationLeft:
-            rotation_radians = -M_PI_2;
-            perpendicular = true;
-            break;
-
-        default:
-            break;
-    }
-
-    UIGraphicsBeginImageContext(CGSizeMake(anImage.size.width, anImage.size.height));
-    CGContextRef context = UIGraphicsGetCurrentContext();
-
-    // Rotate around the center point
-    CGContextTranslateCTM(context, anImage.size.width / 2, anImage.size.height / 2);
-    CGContextRotateCTM(context, rotation_radians);
-
-    CGContextScaleCTM(context, 1.0, -1.0);
-    float width = perpendicular ? anImage.size.height : anImage.size.width;
-    float height = perpendicular ? anImage.size.width : anImage.size.height;
-    CGContextDrawImage(context, CGRectMake(-width / 2, -height / 2, width, height), [anImage CGImage]);
-
-    // Move the origin back since the rotation might've change it (if its 90 degrees)
-    if (perpendicular) {
-        CGContextTranslateCTM(context, -anImage.size.height / 2, -anImage.size.width / 2);
-    }
-
-    UIImage* newImage = UIGraphicsGetImageFromCurrentImageContext();
-    UIGraphicsEndImageContext();
-    return newImage;
-}
-
-- (UIImage*)imageByScalingNotCroppingForSize:(UIImage*)anImage toSize:(CGSize)frameSize
-{
-    UIImage* sourceImage = anImage;
-    UIImage* newImage = nil;
-    CGSize imageSize = sourceImage.size;
-    CGFloat width = imageSize.width;
-    CGFloat height = imageSize.height;
-    CGFloat targetWidth = frameSize.width;
-    CGFloat targetHeight = frameSize.height;
-    CGFloat scaleFactor = 0.0;
-    CGSize scaledSize = frameSize;
-
-    if (CGSizeEqualToSize(imageSize, frameSize) == NO) {
-        CGFloat widthFactor = targetWidth / width;
-        CGFloat heightFactor = targetHeight / height;
-
-        // opposite comparison to imageByScalingAndCroppingForSize in order to contain the image within the given bounds
-        if (widthFactor > heightFactor) {
-            scaleFactor = heightFactor; // scale to fit height
-        } else {
-            scaleFactor = widthFactor; // scale to fit width
-        }
-        scaledSize = CGSizeMake(MIN(width * scaleFactor, targetWidth), MIN(height * scaleFactor, targetHeight));
-    }
-
-    UIGraphicsBeginImageContext(scaledSize); // this will resize
-
-    [sourceImage drawInRect:CGRectMake(0, 0, scaledSize.width, scaledSize.height)];
-
-    newImage = UIGraphicsGetImageFromCurrentImageContext();
-    if (newImage == nil) {
-        NSLog(@"could not scale image");
-    }
-
-    // pop the context to get back to the default
-    UIGraphicsEndImageContext();
-    return newImage;
-}
-
-- (void)postImage:(UIImage*)anImage withFilename:(NSString*)filename toUrl:(NSURL*)url
-{
-    self.hasPendingOperation = YES;
-
-    NSString* boundary = @"----BOUNDARY_IS_I";
-
-    NSMutableURLRequest* req = [NSMutableURLRequest requestWithURL:url];
-    [req setHTTPMethod:@"POST"];
-
-    NSString* contentType = [NSString stringWithFormat:@"multipart/form-data; boundary=%@", boundary];
-    [req setValue:contentType forHTTPHeaderField:@"Content-type"];
-
-    NSData* imageData = UIImagePNGRepresentation(anImage);
-
-    // adding the body
-    NSMutableData* postBody = [NSMutableData data];
-
-    // first parameter an image
-    [postBody appendData:[[NSString stringWithFormat:@"\r\n--%@\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]];
-    [postBody appendData:[[NSString stringWithFormat:@"Content-Disposition: form-data; name=\"upload\"; filename=\"%@\"\r\n", filename] dataUsingEncoding:NSUTF8StringEncoding]];
-    [postBody appendData:[@"Content-Type: image/png\r\n\r\n" dataUsingEncoding : NSUTF8StringEncoding]];
-    [postBody appendData:imageData];
-
-    //	// second parameter information
-    //	[postBody appendData:[[NSString stringWithFormat:@"\r\n--%@\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]];
-    //	[postBody appendData:[@"Content-Disposition: form-data; name=\"some_other_name\"\r\n\r\n" dataUsingEncoding:NSUTF8StringEncoding]];
-    //	[postBody appendData:[@"some_other_value" dataUsingEncoding:NSUTF8StringEncoding]];
-    //	[postBody appendData:[[NSString stringWithFormat:@"\r\n--%@--\r \n",boundary] dataUsingEncoding:NSUTF8StringEncoding]];
-
-    [req setHTTPBody:postBody];
-
-    NSURLResponse* response;
-    NSError* error;
-    [NSURLConnection sendSynchronousRequest:req returningResponse:&response error:&error];
-
-    //  NSData* result = [NSURLConnection sendSynchronousRequest:req returningResponse:&response error:&error];
-    //	NSString * resultStr =  [[[NSString alloc] initWithData:result encoding:NSUTF8StringEncoding] autorelease];
-
-    self.hasPendingOperation = NO;
-}
-
-@end
-
-@implementation CDVCameraPicker
-
-@synthesize quality, postUrl;
-@synthesize returnType;
-@synthesize callbackId;
-@synthesize popoverController;
-@synthesize targetSize;
-@synthesize correctOrientation;
-@synthesize saveToPhotoAlbum;
-@synthesize encodingType;
-@synthesize cropToSize;
-@synthesize webView;
-@synthesize popoverSupported;
-
-@end

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/7eb23f2c/portal/dist/appsvc-ui/2.0.2/bower_components/usergrid-portal/portal/dist/appsvc-ui/2.0.1/bower_components/apigee-sdk/samples/push/ios/CordovaLib/Classes/CDVCapture.h
----------------------------------------------------------------------
diff --git a/portal/dist/appsvc-ui/2.0.2/bower_components/usergrid-portal/portal/dist/appsvc-ui/2.0.1/bower_components/apigee-sdk/samples/push/ios/CordovaLib/Classes/CDVCapture.h b/portal/dist/appsvc-ui/2.0.2/bower_components/usergrid-portal/portal/dist/appsvc-ui/2.0.1/bower_components/apigee-sdk/samples/push/ios/CordovaLib/Classes/CDVCapture.h
deleted file mode 100644
index afb82b4..0000000
--- a/portal/dist/appsvc-ui/2.0.2/bower_components/usergrid-portal/portal/dist/appsvc-ui/2.0.1/bower_components/apigee-sdk/samples/push/ios/CordovaLib/Classes/CDVCapture.h
+++ /dev/null
@@ -1,118 +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 <MobileCoreServices/MobileCoreServices.h>
-#import <AVFoundation/AVFoundation.h>
-#import "CDVPlugin.h"
-#import "CDVFile.h"
-
-enum CDVCaptureError {
-    CAPTURE_INTERNAL_ERR = 0,
-    CAPTURE_APPLICATION_BUSY = 1,
-    CAPTURE_INVALID_ARGUMENT = 2,
-    CAPTURE_NO_MEDIA_FILES = 3,
-    CAPTURE_NOT_SUPPORTED = 20
-};
-typedef NSUInteger CDVCaptureError;
-
-@interface CDVImagePicker : UIImagePickerController
-{
-    NSString* callbackid;
-    NSInteger quality;
-    NSString* mimeType;
-}
-@property (assign) NSInteger quality;
-@property (copy)   NSString* callbackId;
-@property (copy)   NSString* mimeType;
-
-@end
-
-@interface CDVCapture : CDVPlugin <UIImagePickerControllerDelegate, UINavigationControllerDelegate>
-{
-    CDVImagePicker* pickerController;
-    BOOL inUse;
-}
-@property BOOL inUse;
-- (void)captureAudio:(CDVInvokedUrlCommand*)command;
-- (void)captureImage:(CDVInvokedUrlCommand*)command;
-- (CDVPluginResult*)processImage:(UIImage*)image type:(NSString*)mimeType forCallbackId:(NSString*)callbackId;
-- (void)captureVideo:(CDVInvokedUrlCommand*)command;
-- (CDVPluginResult*)processVideo:(NSString*)moviePath forCallbackId:(NSString*)callbackId;
-- (void)getMediaModes:(CDVInvokedUrlCommand*)command;
-- (void)getFormatData:(CDVInvokedUrlCommand*)command;
-- (NSDictionary*)getMediaDictionaryFromPath:(NSString*)fullPath ofType:(NSString*)type;
-- (void)imagePickerController:(UIImagePickerController*)picker didFinishPickingMediaWithInfo:(NSDictionary*)info;
-- (void)imagePickerController:(UIImagePickerController*)picker didFinishPickingImage:(UIImage*)image editingInfo:(NSDictionary*)editingInfo;
-- (void)imagePickerControllerDidCancel:(UIImagePickerController*)picker;
-
-@end
-
-@interface CDVAudioNavigationController : UINavigationController
-
-@end
-
-/* AudioRecorderViewController is used to create a simple view for audio recording.
- *  It is created from [Capture captureAudio].  It creates a very simple interface for
- *  recording by presenting just a record/stop button and a Done button to close the view.
- *  The recording time is displayed and recording for a specified duration is supported. When duration
- *  is specified there is no UI to the user - recording just stops when the specified
- *  duration is reached.  The UI has been minimized to avoid localization.
- */
-@interface CDVAudioRecorderViewController : UIViewController <AVAudioRecorderDelegate>
-{
-    CDVCaptureError errorCode;
-    NSString* callbackId;
-    NSNumber* duration;
-    CDVCapture* captureCommand;
-    UIBarButtonItem* doneButton;
-    UIView* recordingView;
-    UIButton* recordButton;
-    UIImage* recordImage;
-    UIImage* stopRecordImage;
-    UILabel* timerLabel;
-    AVAudioRecorder* avRecorder;
-    AVAudioSession* avSession;
-    CDVPluginResult* pluginResult;
-    NSTimer* timer;
-    BOOL isTimed;
-}
-@property (nonatomic) CDVCaptureError errorCode;
-@property (nonatomic, copy) NSString* callbackId;
-@property (nonatomic, copy) NSNumber* duration;
-@property (nonatomic, strong) CDVCapture* captureCommand;
-@property (nonatomic, strong) UIBarButtonItem* doneButton;
-@property (nonatomic, strong) UIView* recordingView;
-@property (nonatomic, strong) UIButton* recordButton;
-@property (nonatomic, strong) UIImage* recordImage;
-@property (nonatomic, strong) UIImage* stopRecordImage;
-@property (nonatomic, strong) UILabel* timerLabel;
-@property (nonatomic, strong) AVAudioRecorder* avRecorder;
-@property (nonatomic, strong) AVAudioSession* avSession;
-@property (nonatomic, strong) CDVPluginResult* pluginResult;
-@property (nonatomic, strong) NSTimer* timer;
-@property (nonatomic) BOOL isTimed;
-
-- (id)initWithCommand:(CDVPlugin*)theCommand duration:(NSNumber*)theDuration callbackId:(NSString*)theCallbackId;
-- (void)processButton:(id)sender;
-- (void)stopRecordingCleanup;
-- (void)dismissAudioView:(id)sender;
-- (NSString*)formatTime:(int)interval;
-- (void)updateTime;
-@end

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/7eb23f2c/portal/dist/appsvc-ui/2.0.2/bower_components/usergrid-portal/portal/dist/appsvc-ui/2.0.1/bower_components/apigee-sdk/samples/push/ios/CordovaLib/Classes/CDVCapture.m
----------------------------------------------------------------------
diff --git a/portal/dist/appsvc-ui/2.0.2/bower_components/usergrid-portal/portal/dist/appsvc-ui/2.0.1/bower_components/apigee-sdk/samples/push/ios/CordovaLib/Classes/CDVCapture.m b/portal/dist/appsvc-ui/2.0.2/bower_components/usergrid-portal/portal/dist/appsvc-ui/2.0.1/bower_components/apigee-sdk/samples/push/ios/CordovaLib/Classes/CDVCapture.m
deleted file mode 100644
index d89e3d3..0000000
--- a/portal/dist/appsvc-ui/2.0.2/bower_components/usergrid-portal/portal/dist/appsvc-ui/2.0.1/bower_components/apigee-sdk/samples/push/ios/CordovaLib/Classes/CDVCapture.m
+++ /dev/null
@@ -1,847 +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 "CDVCapture.h"
-#import "CDVJSON.h"
-#import "CDVAvailability.h"
-
-#define kW3CMediaFormatHeight @"height"
-#define kW3CMediaFormatWidth @"width"
-#define kW3CMediaFormatCodecs @"codecs"
-#define kW3CMediaFormatBitrate @"bitrate"
-#define kW3CMediaFormatDuration @"duration"
-#define kW3CMediaModeType @"type"
-
-@implementation CDVImagePicker
-
-@synthesize quality;
-@synthesize callbackId;
-@synthesize mimeType;
-
-- (uint64_t)accessibilityTraits
-{
-    NSString* systemVersion = [[UIDevice currentDevice] systemVersion];
-
-    if (([systemVersion compare:@"4.0" options:NSNumericSearch] != NSOrderedAscending)) { // this means system version is not less than 4.0
-        return UIAccessibilityTraitStartsMediaSession;
-    }
-
-    return UIAccessibilityTraitNone;
-}
-
-@end
-
-@implementation CDVCapture
-@synthesize inUse;
-
-- (id)initWithWebView:(UIWebView*)theWebView
-{
-    self = (CDVCapture*)[super initWithWebView:theWebView];
-    if (self) {
-        self.inUse = NO;
-    }
-    return self;
-}
-
-- (void)captureAudio:(CDVInvokedUrlCommand*)command
-{
-    NSString* callbackId = command.callbackId;
-    NSDictionary* options = [command.arguments objectAtIndex:0];
-
-    if ([options isKindOfClass:[NSNull class]]) {
-        options = [NSDictionary dictionary];
-    }
-
-    NSNumber* duration = [options objectForKey:@"duration"];
-    // the default value of duration is 0 so use nil (no duration) if default value
-    if (duration) {
-        duration = [duration doubleValue] == 0 ? nil : duration;
-    }
-    CDVPluginResult* result = nil;
-
-    if (NSClassFromString(@"AVAudioRecorder") == nil) {
-        result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageToErrorObject:CAPTURE_NOT_SUPPORTED];
-    } else if (self.inUse == YES) {
-        result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageToErrorObject:CAPTURE_APPLICATION_BUSY];
-    } else {
-        // all the work occurs here
-        CDVAudioRecorderViewController* audioViewController = [[CDVAudioRecorderViewController alloc] initWithCommand:self duration:duration callbackId:callbackId];
-
-        // Now create a nav controller and display the view...
-        CDVAudioNavigationController* navController = [[CDVAudioNavigationController alloc] initWithRootViewController:audioViewController];
-
-        self.inUse = YES;
-
-        if ([self.viewController respondsToSelector:@selector(presentViewController:::)]) {
-            [self.viewController presentViewController:navController animated:YES completion:nil];
-        } else {
-            [self.viewController presentModalViewController:navController animated:YES];
-        }
-    }
-
-    if (result) {
-        [self.commandDelegate sendPluginResult:result callbackId:callbackId];
-    }
-}
-
-- (void)captureImage:(CDVInvokedUrlCommand*)command
-{
-    NSString* callbackId = command.callbackId;
-    NSDictionary* options = [command.arguments objectAtIndex:0];
-
-    if ([options isKindOfClass:[NSNull class]]) {
-        options = [NSDictionary dictionary];
-    }
-    NSString* mode = [options objectForKey:@"mode"];
-
-    // options could contain limit and mode neither of which are supported at this time
-    // taking more than one picture (limit) is only supported if provide own controls via cameraOverlayView property
-    // can support mode in OS
-
-    if (![UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
-        NSLog(@"Capture.imageCapture: camera not available.");
-        CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageToErrorObject:CAPTURE_NOT_SUPPORTED];
-        [self.commandDelegate sendPluginResult:result callbackId:callbackId];
-    } else {
-        if (pickerController == nil) {
-            pickerController = [[CDVImagePicker alloc] init];
-        }
-
-        pickerController.delegate = self;
-        pickerController.sourceType = UIImagePickerControllerSourceTypeCamera;
-        pickerController.allowsEditing = NO;
-        if ([pickerController respondsToSelector:@selector(mediaTypes)]) {
-            // iOS 3.0
-            pickerController.mediaTypes = [NSArray arrayWithObjects:(NSString*)kUTTypeImage, nil];
-        }
-
-        /*if ([pickerController respondsToSelector:@selector(cameraCaptureMode)]){
-            // iOS 4.0
-            pickerController.cameraCaptureMode = UIImagePickerControllerCameraCaptureModePhoto;
-            pickerController.cameraDevice = UIImagePickerControllerCameraDeviceRear;
-            pickerController.cameraFlashMode = UIImagePickerControllerCameraFlashModeAuto;
-        }*/
-        // CDVImagePicker specific property
-        pickerController.callbackId = callbackId;
-        pickerController.mimeType = mode;
-
-        if ([self.viewController respondsToSelector:@selector(presentViewController:::)]) {
-            [self.viewController presentViewController:pickerController animated:YES completion:nil];
-        } else {
-            [self.viewController presentModalViewController:pickerController animated:YES];
-        }
-    }
-}
-
-/* Process a still image from the camera.
- * IN:
- *  UIImage* image - the UIImage data returned from the camera
- *  NSString* callbackId
- */
-- (CDVPluginResult*)processImage:(UIImage*)image type:(NSString*)mimeType forCallbackId:(NSString*)callbackId
-{
-    CDVPluginResult* result = nil;
-
-    // save the image to photo album
-    UIImageWriteToSavedPhotosAlbum(image, nil, nil, nil);
-
-    NSData* data = nil;
-    if (mimeType && [mimeType isEqualToString:@"image/png"]) {
-        data = UIImagePNGRepresentation(image);
-    } else {
-        data = UIImageJPEGRepresentation(image, 0.5);
-    }
-
-    // write to temp directory and return URI
-    NSString* docsPath = [NSTemporaryDirectory()stringByStandardizingPath];   // use file system temporary directory
-    NSError* err = nil;
-    NSFileManager* fileMgr = [[NSFileManager alloc] init];
-
-    // generate unique file name
-    NSString* filePath;
-    int i = 1;
-    do {
-        filePath = [NSString stringWithFormat:@"%@/photo_%03d.jpg", docsPath, i++];
-    } while ([fileMgr fileExistsAtPath:filePath]);
-
-    if (![data writeToFile:filePath options:NSAtomicWrite error:&err]) {
-        result = [CDVPluginResult resultWithStatus:CDVCommandStatus_IO_EXCEPTION messageToErrorObject:CAPTURE_INTERNAL_ERR];
-        if (err) {
-            NSLog(@"Error saving image: %@", [err localizedDescription]);
-        }
-    } else {
-        // create MediaFile object
-
-        NSDictionary* fileDict = [self getMediaDictionaryFromPath:filePath ofType:mimeType];
-        NSArray* fileArray = [NSArray arrayWithObject:fileDict];
-
-        result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsArray:fileArray];
-    }
-
-    return result;
-}
-
-- (void)captureVideo:(CDVInvokedUrlCommand*)command
-{
-    NSString* callbackId = command.callbackId;
-    NSDictionary* options = [command.arguments objectAtIndex:0];
-
-    if ([options isKindOfClass:[NSNull class]]) {
-        options = [NSDictionary dictionary];
-    }
-
-    // options could contain limit, duration and mode, only duration is supported (but is not due to apple bug)
-    // taking more than one video (limit) is only supported if provide own controls via cameraOverlayView property
-    // NSNumber* duration = [options objectForKey:@"duration"];
-    NSString* mediaType = nil;
-
-    if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
-        // there is a camera, it is available, make sure it can do movies
-        pickerController = [[CDVImagePicker alloc] init];
-
-        NSArray* types = nil;
-        if ([UIImagePickerController respondsToSelector:@selector(availableMediaTypesForSourceType:)]) {
-            types = [UIImagePickerController availableMediaTypesForSourceType:UIImagePickerControllerSourceTypeCamera];
-            // NSLog(@"MediaTypes: %@", [types description]);
-
-            if ([types containsObject:(NSString*)kUTTypeMovie]) {
-                mediaType = (NSString*)kUTTypeMovie;
-            } else if ([types containsObject:(NSString*)kUTTypeVideo]) {
-                mediaType = (NSString*)kUTTypeVideo;
-            }
-        }
-    }
-    if (!mediaType) {
-        // don't have video camera return error
-        NSLog(@"Capture.captureVideo: video mode not available.");
-        CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageToErrorObject:CAPTURE_NOT_SUPPORTED];
-        [self.commandDelegate sendPluginResult:result callbackId:callbackId];
-        pickerController = nil;
-    } else {
-        pickerController.delegate = self;
-        pickerController.sourceType = UIImagePickerControllerSourceTypeCamera;
-        pickerController.allowsEditing = NO;
-        // iOS 3.0
-        pickerController.mediaTypes = [NSArray arrayWithObjects:mediaType, nil];
-
-        /*if ([mediaType isEqualToString:(NSString*)kUTTypeMovie]){
-            if (duration) {
-                pickerController.videoMaximumDuration = [duration doubleValue];
-            }
-            //NSLog(@"pickerController.videoMaximumDuration = %f", pickerController.videoMaximumDuration);
-        }*/
-
-        // iOS 4.0
-        if ([pickerController respondsToSelector:@selector(cameraCaptureMode)]) {
-            pickerController.cameraCaptureMode = UIImagePickerControllerCameraCaptureModeVideo;
-            // pickerController.videoQuality = UIImagePickerControllerQualityTypeHigh;
-            // pickerController.cameraDevice = UIImagePickerControllerCameraDeviceRear;
-            // pickerController.cameraFlashMode = UIImagePickerControllerCameraFlashModeAuto;
-        }
-        // CDVImagePicker specific property
-        pickerController.callbackId = callbackId;
-
-        if ([self.viewController respondsToSelector:@selector(presentViewController:::)]) {
-            [self.viewController presentViewController:pickerController animated:YES completion:nil];
-        } else {
-            [self.viewController presentModalViewController:pickerController animated:YES];
-        }
-    }
-}
-
-- (CDVPluginResult*)processVideo:(NSString*)moviePath forCallbackId:(NSString*)callbackId
-{
-    // save the movie to photo album (only avail as of iOS 3.1)
-
-    /* don't need, it should automatically get saved
-     NSLog(@"can save %@: %d ?", moviePath, UIVideoAtPathIsCompatibleWithSavedPhotosAlbum(moviePath));
-    if (&UIVideoAtPathIsCompatibleWithSavedPhotosAlbum != NULL && UIVideoAtPathIsCompatibleWithSavedPhotosAlbum(moviePath) == YES) {
-        NSLog(@"try to save movie");
-        UISaveVideoAtPathToSavedPhotosAlbum(moviePath, nil, nil, nil);
-        NSLog(@"finished saving movie");
-    }*/
-    // create MediaFile object
-    NSDictionary* fileDict = [self getMediaDictionaryFromPath:moviePath ofType:nil];
-    NSArray* fileArray = [NSArray arrayWithObject:fileDict];
-
-    return [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsArray:fileArray];
-}
-
-- (void)getMediaModes:(CDVInvokedUrlCommand*)command
-{
-    // NSString* callbackId = [arguments objectAtIndex:0];
-    // NSMutableDictionary* imageModes = nil;
-    NSArray* imageArray = nil;
-    NSArray* movieArray = nil;
-    NSArray* audioArray = nil;
-
-    if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
-        // there is a camera, find the modes
-        // can get image/jpeg or image/png from camera
-
-        /* can't find a way to get the default height and width and other info
-         * for images/movies taken with UIImagePickerController
-         */
-        NSDictionary* jpg = [NSDictionary dictionaryWithObjectsAndKeys:
-            [NSNumber numberWithInt:0], kW3CMediaFormatHeight,
-            [NSNumber numberWithInt:0], kW3CMediaFormatWidth,
-            @"image/jpeg", kW3CMediaModeType,
-            nil];
-        NSDictionary* png = [NSDictionary dictionaryWithObjectsAndKeys:
-            [NSNumber numberWithInt:0], kW3CMediaFormatHeight,
-            [NSNumber numberWithInt:0], kW3CMediaFormatWidth,
-            @"image/png", kW3CMediaModeType,
-            nil];
-        imageArray = [NSArray arrayWithObjects:jpg, png, nil];
-
-        if ([UIImagePickerController respondsToSelector:@selector(availableMediaTypesForSourceType:)]) {
-            NSArray* types = [UIImagePickerController availableMediaTypesForSourceType:UIImagePickerControllerSourceTypeCamera];
-
-            if ([types containsObject:(NSString*)kUTTypeMovie]) {
-                NSDictionary* mov = [NSDictionary dictionaryWithObjectsAndKeys:
-                    [NSNumber numberWithInt:0], kW3CMediaFormatHeight,
-                    [NSNumber numberWithInt:0], kW3CMediaFormatWidth,
-                    @"video/quicktime", kW3CMediaModeType,
-                    nil];
-                movieArray = [NSArray arrayWithObject:mov];
-            }
-        }
-    }
-    NSDictionary* modes = [NSDictionary dictionaryWithObjectsAndKeys:
-        imageArray ? (NSObject*)                          imageArray:[NSNull null], @"image",
-        movieArray ? (NSObject*)                          movieArray:[NSNull null], @"video",
-        audioArray ? (NSObject*)                          audioArray:[NSNull null], @"audio",
-        nil];
-    NSString* jsString = [NSString stringWithFormat:@"navigator.device.capture.setSupportedModes(%@);", [modes JSONString]];
-    [self.commandDelegate evalJs:jsString];
-}
-
-- (void)getFormatData:(CDVInvokedUrlCommand*)command
-{
-    NSString* callbackId = command.callbackId;
-    // existence of fullPath checked on JS side
-    NSString* fullPath = [command.arguments objectAtIndex:0];
-    // mimeType could be null
-    NSString* mimeType = nil;
-
-    if ([command.arguments count] > 1) {
-        mimeType = [command.arguments objectAtIndex:1];
-    }
-    BOOL bError = NO;
-    CDVCaptureError errorCode = CAPTURE_INTERNAL_ERR;
-    CDVPluginResult* result = nil;
-
-    if (!mimeType || [mimeType isKindOfClass:[NSNull class]]) {
-        // try to determine mime type if not provided
-        id command = [self.commandDelegate getCommandInstance:@"File"];
-        bError = !([command isKindOfClass:[CDVFile class]]);
-        if (!bError) {
-            CDVFile* cdvFile = (CDVFile*)command;
-            mimeType = [cdvFile getMimeTypeFromPath:fullPath];
-            if (!mimeType) {
-                // can't do much without mimeType, return error
-                bError = YES;
-                errorCode = CAPTURE_INVALID_ARGUMENT;
-            }
-        }
-    }
-    if (!bError) {
-        // create and initialize return dictionary
-        NSMutableDictionary* formatData = [NSMutableDictionary dictionaryWithCapacity:5];
-        [formatData setObject:[NSNull null] forKey:kW3CMediaFormatCodecs];
-        [formatData setObject:[NSNumber numberWithInt:0] forKey:kW3CMediaFormatBitrate];
-        [formatData setObject:[NSNumber numberWithInt:0] forKey:kW3CMediaFormatHeight];
-        [formatData setObject:[NSNumber numberWithInt:0] forKey:kW3CMediaFormatWidth];
-        [formatData setObject:[NSNumber numberWithInt:0] forKey:kW3CMediaFormatDuration];
-
-        if ([mimeType rangeOfString:@"image/"].location != NSNotFound) {
-            UIImage* image = [UIImage imageWithContentsOfFile:fullPath];
-            if (image) {
-                CGSize imgSize = [image size];
-                [formatData setObject:[NSNumber numberWithInteger:imgSize.width] forKey:kW3CMediaFormatWidth];
-                [formatData setObject:[NSNumber numberWithInteger:imgSize.height] forKey:kW3CMediaFormatHeight];
-            }
-        } else if (([mimeType rangeOfString:@"video/"].location != NSNotFound) && (NSClassFromString(@"AVURLAsset") != nil)) {
-            NSURL* movieURL = [NSURL fileURLWithPath:fullPath];
-            AVURLAsset* movieAsset = [[AVURLAsset alloc] initWithURL:movieURL options:nil];
-            CMTime duration = [movieAsset duration];
-            [formatData setObject:[NSNumber numberWithFloat:CMTimeGetSeconds(duration)]  forKey:kW3CMediaFormatDuration];
-
-            NSArray* allVideoTracks = [movieAsset tracksWithMediaType:AVMediaTypeVideo];
-            if ([allVideoTracks count] > 0) {
-                AVAssetTrack* track = [[movieAsset tracksWithMediaType:AVMediaTypeVideo] objectAtIndex:0];
-                CGSize size = [track naturalSize];
-
-                [formatData setObject:[NSNumber numberWithFloat:size.height] forKey:kW3CMediaFormatHeight];
-                [formatData setObject:[NSNumber numberWithFloat:size.width] forKey:kW3CMediaFormatWidth];
-                // not sure how to get codecs or bitrate???
-                // AVMetadataItem
-                // AudioFile
-            } else {
-                NSLog(@"No video tracks found for %@", fullPath);
-            }
-        } else if ([mimeType rangeOfString:@"audio/"].location != NSNotFound) {
-            if (NSClassFromString(@"AVAudioPlayer") != nil) {
-                NSURL* fileURL = [NSURL fileURLWithPath:fullPath];
-                NSError* err = nil;
-
-                AVAudioPlayer* avPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:fileURL error:&err];
-                if (!err) {
-                    // get the data
-                    [formatData setObject:[NSNumber numberWithDouble:[avPlayer duration]] forKey:kW3CMediaFormatDuration];
-                    if ([avPlayer respondsToSelector:@selector(settings)]) {
-                        NSDictionary* info = [avPlayer settings];
-                        NSNumber* bitRate = [info objectForKey:AVEncoderBitRateKey];
-                        if (bitRate) {
-                            [formatData setObject:bitRate forKey:kW3CMediaFormatBitrate];
-                        }
-                    }
-                } // else leave data init'ed to 0
-            }
-        }
-        result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:formatData];
-        // NSLog(@"getFormatData: %@", [formatData description]);
-    }
-    if (bError) {
-        result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageToErrorObject:errorCode];
-    }
-    if (result) {
-        [self.commandDelegate sendPluginResult:result callbackId:callbackId];
-    }
-}
-
-- (NSDictionary*)getMediaDictionaryFromPath:(NSString*)fullPath ofType:(NSString*)type
-{
-    NSFileManager* fileMgr = [[NSFileManager alloc] init];
-    NSMutableDictionary* fileDict = [NSMutableDictionary dictionaryWithCapacity:5];
-
-    [fileDict setObject:[fullPath lastPathComponent] forKey:@"name"];
-    [fileDict setObject:fullPath forKey:@"fullPath"];
-    // determine type
-    if (!type) {
-        id command = [self.commandDelegate getCommandInstance:@"File"];
-        if ([command isKindOfClass:[CDVFile class]]) {
-            CDVFile* cdvFile = (CDVFile*)command;
-            NSString* mimeType = [cdvFile getMimeTypeFromPath:fullPath];
-            [fileDict setObject:(mimeType != nil ? (NSObject*)mimeType : [NSNull null]) forKey:@"type"];
-        }
-    }
-    NSDictionary* fileAttrs = [fileMgr attributesOfItemAtPath:fullPath error:nil];
-    [fileDict setObject:[NSNumber numberWithUnsignedLongLong:[fileAttrs fileSize]] forKey:@"size"];
-    NSDate* modDate = [fileAttrs fileModificationDate];
-    NSNumber* msDate = [NSNumber numberWithDouble:[modDate timeIntervalSince1970] * 1000];
-    [fileDict setObject:msDate forKey:@"lastModifiedDate"];
-
-    return fileDict;
-}
-
-- (void)imagePickerController:(UIImagePickerController*)picker didFinishPickingImage:(UIImage*)image editingInfo:(NSDictionary*)editingInfo
-{
-    // older api calls new one
-    [self imagePickerController:picker didFinishPickingMediaWithInfo:editingInfo];
-}
-
-/* Called when image/movie is finished recording.
- * Calls success or error code as appropriate
- * if successful, result  contains an array (with just one entry since can only get one image unless build own camera UI) of MediaFile object representing the image
- *      name
- *      fullPath
- *      type
- *      lastModifiedDate
- *      size
- */
-- (void)imagePickerController:(UIImagePickerController*)picker didFinishPickingMediaWithInfo:(NSDictionary*)info
-{
-    CDVImagePicker* cameraPicker = (CDVImagePicker*)picker;
-    NSString* callbackId = cameraPicker.callbackId;
-
-    if ([picker respondsToSelector:@selector(presentingViewController)]) {
-        [[picker presentingViewController] dismissModalViewControllerAnimated:YES];
-    } else {
-        [[picker parentViewController] dismissModalViewControllerAnimated:YES];
-    }
-
-    CDVPluginResult* result = nil;
-
-    UIImage* image = nil;
-    NSString* mediaType = [info objectForKey:UIImagePickerControllerMediaType];
-    if (!mediaType || [mediaType isEqualToString:(NSString*)kUTTypeImage]) {
-        // mediaType is nil then only option is UIImagePickerControllerOriginalImage
-        if ([UIImagePickerController respondsToSelector:@selector(allowsEditing)] &&
-            (cameraPicker.allowsEditing && [info objectForKey:UIImagePickerControllerEditedImage])) {
-            image = [info objectForKey:UIImagePickerControllerEditedImage];
-        } else {
-            image = [info objectForKey:UIImagePickerControllerOriginalImage];
-        }
-    }
-    if (image != nil) {
-        // mediaType was image
-        result = [self processImage:image type:cameraPicker.mimeType forCallbackId:callbackId];
-    } else if ([mediaType isEqualToString:(NSString*)kUTTypeMovie]) {
-        // process video
-        NSString* moviePath = [[info objectForKey:UIImagePickerControllerMediaURL] path];
-        if (moviePath) {
-            result = [self processVideo:moviePath forCallbackId:callbackId];
-        }
-    }
-    if (!result) {
-        result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageToErrorObject:CAPTURE_INTERNAL_ERR];
-    }
-    [self.commandDelegate sendPluginResult:result callbackId:callbackId];
-    pickerController = nil;
-}
-
-- (void)imagePickerControllerDidCancel:(UIImagePickerController*)picker
-{
-    CDVImagePicker* cameraPicker = (CDVImagePicker*)picker;
-    NSString* callbackId = cameraPicker.callbackId;
-
-    if ([picker respondsToSelector:@selector(presentingViewController)]) {
-        [[picker presentingViewController] dismissModalViewControllerAnimated:YES];
-    } else {
-        [[picker parentViewController] dismissModalViewControllerAnimated:YES];
-    }
-
-    CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageToErrorObject:CAPTURE_NO_MEDIA_FILES];
-    [self.commandDelegate sendPluginResult:result callbackId:callbackId];
-    pickerController = nil;
-}
-
-@end
-
-@implementation CDVAudioNavigationController
-
-#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 60000
-    - (NSUInteger)supportedInterfaceOrientations
-    {
-        // delegate to CVDAudioRecorderViewController
-        return [self.topViewController supportedInterfaceOrientations];
-    }
-#endif
-
-@end
-
-@implementation CDVAudioRecorderViewController
-@synthesize errorCode, callbackId, duration, captureCommand, doneButton, recordingView, recordButton, recordImage, stopRecordImage, timerLabel, avRecorder, avSession, pluginResult, timer, isTimed;
-
-- (NSString*)resolveImageResource:(NSString*)resource
-{
-    NSString* systemVersion = [[UIDevice currentDevice] systemVersion];
-    BOOL isLessThaniOS4 = ([systemVersion compare:@"4.0" options:NSNumericSearch] == NSOrderedAscending);
-
-    // the iPad image (nor retina) differentiation code was not in 3.x, and we have to explicitly set the path
-    // if user wants iPhone only app to run on iPad they must remove *~ipad.* images from capture.bundle
-    if (isLessThaniOS4) {
-        NSString* iPadResource = [NSString stringWithFormat:@"%@~ipad.png", resource];
-        if (CDV_IsIPad() && [UIImage imageNamed:iPadResource]) {
-            return iPadResource;
-        } else {
-            return [NSString stringWithFormat:@"%@.png", resource];
-        }
-    }
-
-    return resource;
-}
-
-- (id)initWithCommand:(CDVCapture*)theCommand duration:(NSNumber*)theDuration callbackId:(NSString*)theCallbackId
-{
-    if ((self = [super init])) {
-        self.captureCommand = theCommand;
-        self.duration = theDuration;
-        self.callbackId = theCallbackId;
-        self.errorCode = CAPTURE_NO_MEDIA_FILES;
-        self.isTimed = self.duration != nil;
-
-        return self;
-    }
-
-    return nil;
-}
-
-- (void)loadView
-{
-    // create view and display
-    CGRect viewRect = [[UIScreen mainScreen] applicationFrame];
-    UIView* tmp = [[UIView alloc] initWithFrame:viewRect];
-
-    // make backgrounds
-    NSString* microphoneResource = @"Capture.bundle/microphone";
-
-    if (CDV_IsIPhone5()) {
-        microphoneResource = @"Capture.bundle/microphone-568h";
-    }
-
-    UIImage* microphone = [UIImage imageNamed:[self resolveImageResource:microphoneResource]];
-    UIView* microphoneView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, viewRect.size.width, microphone.size.height)];
-    [microphoneView setBackgroundColor:[UIColor colorWithPatternImage:microphone]];
-    [microphoneView setUserInteractionEnabled:NO];
-    [microphoneView setIsAccessibilityElement:NO];
-    [tmp addSubview:microphoneView];
-
-    // add bottom bar view
-    UIImage* grayBkg = [UIImage imageNamed:[self resolveImageResource:@"Capture.bundle/controls_bg"]];
-    UIView* controls = [[UIView alloc] initWithFrame:CGRectMake(0, microphone.size.height, viewRect.size.width, grayBkg.size.height)];
-    [controls setBackgroundColor:[UIColor colorWithPatternImage:grayBkg]];
-    [controls setUserInteractionEnabled:NO];
-    [controls setIsAccessibilityElement:NO];
-    [tmp addSubview:controls];
-
-    // make red recording background view
-    UIImage* recordingBkg = [UIImage imageNamed:[self resolveImageResource:@"Capture.bundle/recording_bg"]];
-    UIColor* background = [UIColor colorWithPatternImage:recordingBkg];
-    self.recordingView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, viewRect.size.width, recordingBkg.size.height)];
-    [self.recordingView setBackgroundColor:background];
-    [self.recordingView setHidden:YES];
-    [self.recordingView setUserInteractionEnabled:NO];
-    [self.recordingView setIsAccessibilityElement:NO];
-    [tmp addSubview:self.recordingView];
-
-    // add label
-    self.timerLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, viewRect.size.width, recordingBkg.size.height)];
-    // timerLabel.autoresizingMask = reSizeMask;
-    [self.timerLabel setBackgroundColor:[UIColor clearColor]];
-    [self.timerLabel setTextColor:[UIColor whiteColor]];
-    [self.timerLabel setTextAlignment:UITextAlignmentCenter];
-    [self.timerLabel setText:@"0:00"];
-    [self.timerLabel setAccessibilityHint:NSLocalizedString(@"recorded time in minutes and seconds", nil)];
-    self.timerLabel.accessibilityTraits |= UIAccessibilityTraitUpdatesFrequently;
-    self.timerLabel.accessibilityTraits &= ~UIAccessibilityTraitStaticText;
-    [tmp addSubview:self.timerLabel];
-
-    // Add record button
-
-    self.recordImage = [UIImage imageNamed:[self resolveImageResource:@"Capture.bundle/record_button"]];
-    self.stopRecordImage = [UIImage imageNamed:[self resolveImageResource:@"Capture.bundle/stop_button"]];
-    self.recordButton.accessibilityTraits |= [self accessibilityTraits];
-    self.recordButton = [[UIButton alloc] initWithFrame:CGRectMake((viewRect.size.width - recordImage.size.width) / 2, (microphone.size.height + (grayBkg.size.height - recordImage.size.height) / 2), recordImage.size.width, recordImage.size.height)];
-    [self.recordButton setAccessibilityLabel:NSLocalizedString(@"toggle audio recording", nil)];
-    [self.recordButton setImage:recordImage forState:UIControlStateNormal];
-    [self.recordButton addTarget:self action:@selector(processButton:) forControlEvents:UIControlEventTouchUpInside];
-    [tmp addSubview:recordButton];
-
-    // make and add done button to navigation bar
-    self.doneButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(dismissAudioView:)];
-    [self.doneButton setStyle:UIBarButtonItemStyleDone];
-    self.navigationItem.rightBarButtonItem = self.doneButton;
-
-    [self setView:tmp];
-}
-
-- (void)viewDidLoad
-{
-    [super viewDidLoad];
-    UIAccessibilityPostNotification(UIAccessibilityScreenChangedNotification, nil);
-    NSError* error = nil;
-
-    if (self.avSession == nil) {
-        // create audio session
-        self.avSession = [AVAudioSession sharedInstance];
-        if (error) {
-            // return error if can't create recording audio session
-            NSLog(@"error creating audio session: %@", [[error userInfo] description]);
-            self.errorCode = CAPTURE_INTERNAL_ERR;
-            [self dismissAudioView:nil];
-        }
-    }
-
-    // create file to record to in temporary dir
-
-    NSString* docsPath = [NSTemporaryDirectory()stringByStandardizingPath];   // use file system temporary directory
-    NSError* err = nil;
-    NSFileManager* fileMgr = [[NSFileManager alloc] init];
-
-    // generate unique file name
-    NSString* filePath;
-    int i = 1;
-    do {
-        filePath = [NSString stringWithFormat:@"%@/audio_%03d.wav", docsPath, i++];
-    } while ([fileMgr fileExistsAtPath:filePath]);
-
-    NSURL* fileURL = [NSURL fileURLWithPath:filePath isDirectory:NO];
-
-    // create AVAudioPlayer
-    self.avRecorder = [[AVAudioRecorder alloc] initWithURL:fileURL settings:nil error:&err];
-    if (err) {
-        NSLog(@"Failed to initialize AVAudioRecorder: %@\n", [err localizedDescription]);
-        self.avRecorder = nil;
-        // return error
-        self.errorCode = CAPTURE_INTERNAL_ERR;
-        [self dismissAudioView:nil];
-    } else {
-        self.avRecorder.delegate = self;
-        [self.avRecorder prepareToRecord];
-        self.recordButton.enabled = YES;
-        self.doneButton.enabled = YES;
-    }
-}
-
-#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 60000
-    - (NSUInteger)supportedInterfaceOrientations
-    {
-        NSUInteger orientation = UIInterfaceOrientationMaskPortrait; // must support portrait
-        NSUInteger supported = [captureCommand.viewController supportedInterfaceOrientations];
-
-        orientation = orientation | (supported & UIInterfaceOrientationMaskPortraitUpsideDown);
-        return orientation;
-    }
-#endif
-
-- (void)viewDidUnload
-{
-    [self setView:nil];
-    [self.captureCommand setInUse:NO];
-}
-
-- (void)processButton:(id)sender
-{
-    if (self.avRecorder.recording) {
-        // stop recording
-        [self.avRecorder stop];
-        self.isTimed = NO;  // recording was stopped via button so reset isTimed
-        // view cleanup will occur in audioRecordingDidFinishRecording
-    } else {
-        // begin recording
-        [self.recordButton setImage:stopRecordImage forState:UIControlStateNormal];
-        self.recordButton.accessibilityTraits &= ~[self accessibilityTraits];
-        [self.recordingView setHidden:NO];
-        NSError* error = nil;
-        [self.avSession setCategory:AVAudioSessionCategoryRecord error:&error];
-        [self.avSession setActive:YES error:&error];
-        if (error) {
-            // can't continue without active audio session
-            self.errorCode = CAPTURE_INTERNAL_ERR;
-            [self dismissAudioView:nil];
-        } else {
-            if (self.duration) {
-                self.isTimed = true;
-                [self.avRecorder recordForDuration:[duration doubleValue]];
-            } else {
-                [self.avRecorder record];
-            }
-            [self.timerLabel setText:@"0.00"];
-            self.timer = [NSTimer scheduledTimerWithTimeInterval:0.5f target:self selector:@selector(updateTime) userInfo:nil repeats:YES];
-            self.doneButton.enabled = NO;
-        }
-        UIAccessibilityPostNotification(UIAccessibilityLayoutChangedNotification, nil);
-    }
-}
-
-/*
- * helper method to clean up when stop recording
- */
-- (void)stopRecordingCleanup
-{
-    if (self.avRecorder.recording) {
-        [self.avRecorder stop];
-    }
-    [self.recordButton setImage:recordImage forState:UIControlStateNormal];
-    self.recordButton.accessibilityTraits |= [self accessibilityTraits];
-    [self.recordingView setHidden:YES];
-    self.doneButton.enabled = YES;
-    if (self.avSession) {
-        // deactivate session so sounds can come through
-        [self.avSession setCategory:AVAudioSessionCategoryPlayAndRecord error:nil];
-        [self.avSession setActive:NO error:nil];
-    }
-    if (self.duration && self.isTimed) {
-        // VoiceOver announcement so user knows timed recording has finished
-        BOOL isUIAccessibilityAnnouncementNotification = (&UIAccessibilityAnnouncementNotification != NULL);
-        if (isUIAccessibilityAnnouncementNotification) {
-            dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 500ull * NSEC_PER_MSEC), dispatch_get_main_queue(), ^{
-                    UIAccessibilityPostNotification(UIAccessibilityAnnouncementNotification, NSLocalizedString(@"timed recording complete", nil));
-                });
-        }
-    } else {
-        // issue a layout notification change so that VO will reannounce the button label when recording completes
-        UIAccessibilityPostNotification(UIAccessibilityLayoutChangedNotification, nil);
-    }
-}
-
-- (void)dismissAudioView:(id)sender
-{
-    // called when done button pressed or when error condition to do cleanup and remove view
-    if ([self.captureCommand.viewController.modalViewController respondsToSelector:@selector(presentingViewController)]) {
-        [[self.captureCommand.viewController.modalViewController presentingViewController] dismissModalViewControllerAnimated:YES];
-    } else {
-        [[self.captureCommand.viewController.modalViewController parentViewController] dismissModalViewControllerAnimated:YES];
-    }
-
-    if (!self.pluginResult) {
-        // return error
-        self.pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageToErrorObject:self.errorCode];
-    }
-
-    self.avRecorder = nil;
-    [self.avSession setCategory:AVAudioSessionCategoryPlayAndRecord error:nil];
-    [self.avSession setActive:NO error:nil];
-    [self.captureCommand setInUse:NO];
-    UIAccessibilityPostNotification(UIAccessibilityScreenChangedNotification, nil);
-    // return result
-    [self.captureCommand.commandDelegate sendPluginResult:pluginResult callbackId:callbackId];
-}
-
-- (void)updateTime
-{
-    // update the label with the elapsed time
-    [self.timerLabel setText:[self formatTime:self.avRecorder.currentTime]];
-}
-
-- (NSString*)formatTime:(int)interval
-{
-    // is this format universal?
-    int secs = interval % 60;
-    int min = interval / 60;
-
-    if (interval < 60) {
-        return [NSString stringWithFormat:@"0:%02d", interval];
-    } else {
-        return [NSString stringWithFormat:@"%d:%02d", min, secs];
-    }
-}
-
-- (void)audioRecorderDidFinishRecording:(AVAudioRecorder*)recorder successfully:(BOOL)flag
-{
-    // may be called when timed audio finishes - need to stop time and reset buttons
-    [self.timer invalidate];
-    [self stopRecordingCleanup];
-
-    // generate success result
-    if (flag) {
-        NSString* filePath = [avRecorder.url path];
-        // NSLog(@"filePath: %@", filePath);
-        NSDictionary* fileDict = [captureCommand getMediaDictionaryFromPath:filePath ofType:@"audio/wav"];
-        NSArray* fileArray = [NSArray arrayWithObject:fileDict];
-
-        self.pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsArray:fileArray];
-    } else {
-        self.pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_IO_EXCEPTION messageToErrorObject:CAPTURE_INTERNAL_ERR];
-    }
-}
-
-- (void)audioRecorderEncodeErrorDidOccur:(AVAudioRecorder*)recorder error:(NSError*)error
-{
-    [self.timer invalidate];
-    [self stopRecordingCleanup];
-
-    NSLog(@"error recording audio");
-    self.pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_IO_EXCEPTION messageToErrorObject:CAPTURE_INTERNAL_ERR];
-    [self dismissAudioView:nil];
-}
-
-@end

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/7eb23f2c/portal/dist/appsvc-ui/2.0.2/bower_components/usergrid-portal/portal/dist/appsvc-ui/2.0.1/bower_components/apigee-sdk/samples/push/ios/CordovaLib/Classes/CDVCommandDelegate.h
----------------------------------------------------------------------
diff --git a/portal/dist/appsvc-ui/2.0.2/bower_components/usergrid-portal/portal/dist/appsvc-ui/2.0.1/bower_components/apigee-sdk/samples/push/ios/CordovaLib/Classes/CDVCommandDelegate.h b/portal/dist/appsvc-ui/2.0.2/bower_components/usergrid-portal/portal/dist/appsvc-ui/2.0.1/bower_components/apigee-sdk/samples/push/ios/CordovaLib/Classes/CDVCommandDelegate.h
deleted file mode 100644
index 0401136..0000000
--- a/portal/dist/appsvc-ui/2.0.2/bower_components/usergrid-portal/portal/dist/appsvc-ui/2.0.1/bower_components/apigee-sdk/samples/push/ios/CordovaLib/Classes/CDVCommandDelegate.h
+++ /dev/null
@@ -1,54 +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 "CDVAvailability.h"
-#import "CDVInvokedUrlCommand.h"
-
-@class CDVPlugin;
-@class CDVPluginResult;
-@class CDVWhitelist;
-
-@protocol CDVCommandDelegate <NSObject>
-
-@property (nonatomic, readonly) NSDictionary* settings;
-
-- (NSString*)pathForResource:(NSString*)resourcepath;
-- (id)getCommandInstance:(NSString*)pluginName;
-
-// Plugins should not be using this interface to call other plugins since it
-// will result in bogus callbacks being made.
-- (BOOL)execute:(CDVInvokedUrlCommand*)command CDV_DEPRECATED(2.2, "Use direct method calls instead.");
-
-// Sends a plugin result to the JS. This is thread-safe.
-- (void)sendPluginResult:(CDVPluginResult*)result callbackId:(NSString*)callbackId;
-// Evaluates the given JS. This is thread-safe.
-- (void)evalJs:(NSString*)js;
-// Can be used to evaluate JS right away instead of scheduling it on the run-loop.
-// This is required for dispatch resign and pause events, but should not be used
-// without reason. Without the run-loop delay, alerts used in JS callbacks may result
-// in dead-lock. This method must be called from the UI thread.
-- (void)evalJs:(NSString*)js scheduledOnRunLoop:(BOOL)scheduledOnRunLoop;
-// Runs the given block on a background thread using a shared thread-pool.
-- (void)runInBackground:(void (^)())block;
-// Returns the User-Agent of the associated UIWebView.
-- (NSString*)userAgent;
-// Returns whether the given URL passes the white-list.
-- (BOOL)URLIsWhitelisted:(NSURL*)url;
-
-@end

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/7eb23f2c/portal/dist/appsvc-ui/2.0.2/bower_components/usergrid-portal/portal/dist/appsvc-ui/2.0.1/bower_components/apigee-sdk/samples/push/ios/CordovaLib/Classes/CDVCommandDelegateImpl.h
----------------------------------------------------------------------
diff --git a/portal/dist/appsvc-ui/2.0.2/bower_components/usergrid-portal/portal/dist/appsvc-ui/2.0.1/bower_components/apigee-sdk/samples/push/ios/CordovaLib/Classes/CDVCommandDelegateImpl.h b/portal/dist/appsvc-ui/2.0.2/bower_components/usergrid-portal/portal/dist/appsvc-ui/2.0.1/bower_components/apigee-sdk/samples/push/ios/CordovaLib/Classes/CDVCommandDelegateImpl.h
deleted file mode 100644
index 6735136..0000000
--- a/portal/dist/appsvc-ui/2.0.2/bower_components/usergrid-portal/portal/dist/appsvc-ui/2.0.1/bower_components/apigee-sdk/samples/push/ios/CordovaLib/Classes/CDVCommandDelegateImpl.h
+++ /dev/null
@@ -1,33 +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 "CDVCommandDelegate.h"
-
-@class CDVViewController;
-@class CDVCommandQueue;
-
-@interface CDVCommandDelegateImpl : NSObject <CDVCommandDelegate>{
-    @private
-    __weak CDVViewController* _viewController;
-    @protected
-    __weak CDVCommandQueue* _commandQueue;
-}
-- (id)initWithViewController:(CDVViewController*)viewController;
-@end

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/7eb23f2c/portal/dist/appsvc-ui/2.0.2/bower_components/usergrid-portal/portal/dist/appsvc-ui/2.0.1/bower_components/apigee-sdk/samples/push/ios/CordovaLib/Classes/CDVCommandDelegateImpl.m
----------------------------------------------------------------------
diff --git a/portal/dist/appsvc-ui/2.0.2/bower_components/usergrid-portal/portal/dist/appsvc-ui/2.0.1/bower_components/apigee-sdk/samples/push/ios/CordovaLib/Classes/CDVCommandDelegateImpl.m b/portal/dist/appsvc-ui/2.0.2/bower_components/usergrid-portal/portal/dist/appsvc-ui/2.0.1/bower_components/apigee-sdk/samples/push/ios/CordovaLib/Classes/CDVCommandDelegateImpl.m
deleted file mode 100644
index fa0e5e0..0000000
--- a/portal/dist/appsvc-ui/2.0.2/bower_components/usergrid-portal/portal/dist/appsvc-ui/2.0.1/bower_components/apigee-sdk/samples/push/ios/CordovaLib/Classes/CDVCommandDelegateImpl.m
+++ /dev/null
@@ -1,145 +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 "CDVCommandDelegateImpl.h"
-#import "CDVJSON.h"
-#import "CDVCommandQueue.h"
-#import "CDVPluginResult.h"
-#import "CDVViewController.h"
-
-@implementation CDVCommandDelegateImpl
-
-- (id)initWithViewController:(CDVViewController*)viewController
-{
-    self = [super init];
-    if (self != nil) {
-        _viewController = viewController;
-        _commandQueue = _viewController.commandQueue;
-    }
-    return self;
-}
-
-- (NSString*)pathForResource:(NSString*)resourcepath
-{
-    NSBundle* mainBundle = [NSBundle mainBundle];
-    NSMutableArray* directoryParts = [NSMutableArray arrayWithArray:[resourcepath componentsSeparatedByString:@"/"]];
-    NSString* filename = [directoryParts lastObject];
-
-    [directoryParts removeLastObject];
-
-    NSString* directoryPartsJoined = [directoryParts componentsJoinedByString:@"/"];
-    NSString* directoryStr = _viewController.wwwFolderName;
-
-    if ([directoryPartsJoined length] > 0) {
-        directoryStr = [NSString stringWithFormat:@"%@/%@", _viewController.wwwFolderName, [directoryParts componentsJoinedByString:@"/"]];
-    }
-
-    return [mainBundle pathForResource:filename ofType:@"" inDirectory:directoryStr];
-}
-
-- (void)evalJsHelper2:(NSString*)js
-{
-    CDV_EXEC_LOG(@"Exec: evalling: %@", [js substringToIndex:MIN([js length], 160)]);
-    NSString* commandsJSON = [_viewController.webView stringByEvaluatingJavaScriptFromString:js];
-    if ([commandsJSON length] > 0) {
-        CDV_EXEC_LOG(@"Exec: Retrieved new exec messages by chaining.");
-    }
-
-    [_commandQueue enqueCommandBatch:commandsJSON];
-}
-
-- (void)evalJsHelper:(NSString*)js
-{
-    // Cycle the run-loop before executing the JS.
-    // This works around a bug where sometimes alerts() within callbacks can cause
-    // dead-lock.
-    // If the commandQueue is currently executing, then we know that it is safe to
-    // execute the callback immediately.
-    // Using    (dispatch_get_main_queue()) does *not* fix deadlocks for some reaon,
-    // but performSelectorOnMainThread: does.
-    if (![NSThread isMainThread] || !_commandQueue.currentlyExecuting) {
-        [self performSelectorOnMainThread:@selector(evalJsHelper2:) withObject:js waitUntilDone:NO];
-    } else {
-        [self evalJsHelper2:js];
-    }
-}
-
-- (void)sendPluginResult:(CDVPluginResult*)result callbackId:(NSString*)callbackId
-{
-    CDV_EXEC_LOG(@"Exec(%@): Sending result. Status=%@", callbackId, result.status);
-    // This occurs when there is are no win/fail callbacks for the call.
-    if ([@"INVALID" isEqualToString : callbackId]) {
-        return;
-    }
-    int status = [result.status intValue];
-    BOOL keepCallback = [result.keepCallback boolValue];
-    NSString* argumentsAsJSON = [result argumentsAsJSON];
-
-    NSString* js = [NSString stringWithFormat:@"cordova.require('cordova/exec').nativeCallback('%@',%d,%@,%d)", callbackId, status, argumentsAsJSON, keepCallback];
-
-    [self evalJsHelper:js];
-}
-
-- (void)evalJs:(NSString*)js
-{
-    [self evalJs:js scheduledOnRunLoop:YES];
-}
-
-- (void)evalJs:(NSString*)js scheduledOnRunLoop:(BOOL)scheduledOnRunLoop
-{
-    js = [NSString stringWithFormat:@"cordova.require('cordova/exec').nativeEvalAndFetch(function(){%@})", js];
-    if (scheduledOnRunLoop) {
-        [self evalJsHelper:js];
-    } else {
-        [self evalJsHelper2:js];
-    }
-}
-
-- (BOOL)execute:(CDVInvokedUrlCommand*)command
-{
-    return [_commandQueue execute:command];
-}
-
-- (id)getCommandInstance:(NSString*)pluginName
-{
-    return [_viewController getCommandInstance:pluginName];
-}
-
-- (void)runInBackground:(void (^)())block
-{
-    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), block);
-}
-
-- (NSString*)userAgent
-{
-    return [_viewController userAgent];
-}
-
-- (BOOL)URLIsWhitelisted:(NSURL*)url
-{
-    return ![_viewController.whitelist schemeIsAllowed:[url scheme]] ||
-           [_viewController.whitelist URLIsAllowed:url];
-}
-
-- (NSDictionary*)settings
-{
-    return _viewController.settings;
-}
-
-@end

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/7eb23f2c/portal/dist/appsvc-ui/2.0.2/bower_components/usergrid-portal/portal/dist/appsvc-ui/2.0.1/bower_components/apigee-sdk/samples/push/ios/CordovaLib/Classes/CDVCommandQueue.h
----------------------------------------------------------------------
diff --git a/portal/dist/appsvc-ui/2.0.2/bower_components/usergrid-portal/portal/dist/appsvc-ui/2.0.1/bower_components/apigee-sdk/samples/push/ios/CordovaLib/Classes/CDVCommandQueue.h b/portal/dist/appsvc-ui/2.0.2/bower_components/usergrid-portal/portal/dist/appsvc-ui/2.0.1/bower_components/apigee-sdk/samples/push/ios/CordovaLib/Classes/CDVCommandQueue.h
deleted file mode 100644
index 27c47b5..0000000
--- a/portal/dist/appsvc-ui/2.0.2/bower_components/usergrid-portal/portal/dist/appsvc-ui/2.0.1/bower_components/apigee-sdk/samples/push/ios/CordovaLib/Classes/CDVCommandQueue.h
+++ /dev/null
@@ -1,40 +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>
-
-@class CDVInvokedUrlCommand;
-@class CDVViewController;
-
-@interface CDVCommandQueue : NSObject
-
-@property (nonatomic, readonly) BOOL currentlyExecuting;
-
-- (id)initWithViewController:(CDVViewController*)viewController;
-- (void)dispose;
-
-- (void)resetRequestId;
-- (void)enqueCommandBatch:(NSString*)batchJSON;
-
-- (void)maybeFetchCommandsFromJs:(NSNumber*)requestId;
-- (void)fetchCommandsFromJs;
-- (void)executePending;
-- (BOOL)execute:(CDVInvokedUrlCommand*)command;
-
-@end

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/7eb23f2c/portal/dist/appsvc-ui/2.0.2/bower_components/usergrid-portal/portal/dist/appsvc-ui/2.0.1/bower_components/apigee-sdk/samples/push/ios/CordovaLib/Classes/CDVCommandQueue.m
----------------------------------------------------------------------
diff --git a/portal/dist/appsvc-ui/2.0.2/bower_components/usergrid-portal/portal/dist/appsvc-ui/2.0.1/bower_components/apigee-sdk/samples/push/ios/CordovaLib/Classes/CDVCommandQueue.m b/portal/dist/appsvc-ui/2.0.2/bower_components/usergrid-portal/portal/dist/appsvc-ui/2.0.1/bower_components/apigee-sdk/samples/push/ios/CordovaLib/Classes/CDVCommandQueue.m
deleted file mode 100644
index 1a0dfa0..0000000
--- a/portal/dist/appsvc-ui/2.0.2/bower_components/usergrid-portal/portal/dist/appsvc-ui/2.0.1/bower_components/apigee-sdk/samples/push/ios/CordovaLib/Classes/CDVCommandQueue.m
+++ /dev/null
@@ -1,169 +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.
- */
-
-#include <objc/message.h>
-#import "CDV.h"
-#import "CDVCommandQueue.h"
-#import "CDVViewController.h"
-#import "CDVCommandDelegateImpl.h"
-
-@interface CDVCommandQueue () {
-    NSInteger _lastCommandQueueFlushRequestId;
-    __weak CDVViewController* _viewController;
-    NSMutableArray* _queue;
-    BOOL _currentlyExecuting;
-}
-@end
-
-@implementation CDVCommandQueue
-
-@synthesize currentlyExecuting = _currentlyExecuting;
-
-- (id)initWithViewController:(CDVViewController*)viewController
-{
-    self = [super init];
-    if (self != nil) {
-        _viewController = viewController;
-        _queue = [[NSMutableArray alloc] init];
-    }
-    return self;
-}
-
-- (void)dispose
-{
-    // TODO(agrieve): Make this a zeroing weak ref once we drop support for 4.3.
-    _viewController = nil;
-}
-
-- (void)resetRequestId
-{
-    _lastCommandQueueFlushRequestId = 0;
-}
-
-- (void)enqueCommandBatch:(NSString*)batchJSON
-{
-    if ([batchJSON length] > 0) {
-        [_queue addObject:batchJSON];
-        [self executePending];
-    }
-}
-
-- (void)maybeFetchCommandsFromJs:(NSNumber*)requestId
-{
-    // Use the request ID to determine if we've already flushed for this request.
-    // This is required only because the NSURLProtocol enqueues the same request
-    // multiple times.
-    if ([requestId integerValue] > _lastCommandQueueFlushRequestId) {
-        _lastCommandQueueFlushRequestId = [requestId integerValue];
-        [self fetchCommandsFromJs];
-    }
-}
-
-- (void)fetchCommandsFromJs
-{
-    // Grab all the queued commands from the JS side.
-    NSString* queuedCommandsJSON = [_viewController.webView stringByEvaluatingJavaScriptFromString:
-        @"cordova.require('cordova/exec').nativeFetchMessages()"];
-
-    [self enqueCommandBatch:queuedCommandsJSON];
-    if ([queuedCommandsJSON length] > 0) {
-        CDV_EXEC_LOG(@"Exec: Retrieved new exec messages by request.");
-    }
-}
-
-- (void)executePending
-{
-    // Make us re-entrant-safe.
-    if (_currentlyExecuting) {
-        return;
-    }
-    @try {
-        _currentlyExecuting = YES;
-
-        for (NSUInteger i = 0; i < [_queue count]; ++i) {
-            // Parse the returned JSON array.
-            NSArray* commandBatch = [[_queue objectAtIndex:i] JSONObject];
-
-            // Iterate over and execute all of the commands.
-            for (NSArray* jsonEntry in commandBatch) {
-                CDVInvokedUrlCommand* command = [CDVInvokedUrlCommand commandFromJson:jsonEntry];
-                CDV_EXEC_LOG(@"Exec(%@): Calling %@.%@", command.callbackId, command.className, command.methodName);
-
-                if (![self execute:command]) {
-#ifdef DEBUG
-                        NSString* commandJson = [jsonEntry JSONString];
-                        static NSUInteger maxLogLength = 1024;
-                        NSString* commandString = ([commandJson length] > maxLogLength) ?
-                            [NSString stringWithFormat:@"%@[...]", [commandJson substringToIndex:maxLogLength]] :
-                            commandJson;
-
-                        DLog(@"FAILED pluginJSON = %@", commandString);
-#endif
-                }
-            }
-        }
-
-        [_queue removeAllObjects];
-    } @finally
-    {
-        _currentlyExecuting = NO;
-    }
-}
-
-- (BOOL)execute:(CDVInvokedUrlCommand*)command
-{
-    if ((command.className == nil) || (command.methodName == nil)) {
-        NSLog(@"ERROR: Classname and/or methodName not found for command.");
-        return NO;
-    }
-
-    // Fetch an instance of this class
-    CDVPlugin* obj = [_viewController.commandDelegate getCommandInstance:command.className];
-
-    if (!([obj isKindOfClass:[CDVPlugin class]])) {
-        NSLog(@"ERROR: Plugin '%@' not found, or is not a CDVPlugin. Check your plugin mapping in config.xml.", command.className);
-        return NO;
-    }
-    BOOL retVal = YES;
-
-    // Find the proper selector to call.
-    NSString* methodName = [NSString stringWithFormat:@"%@:", command.methodName];
-    NSString* methodNameWithDict = [NSString stringWithFormat:@"%@:withDict:", command.methodName];
-    SEL normalSelector = NSSelectorFromString(methodName);
-    SEL legacySelector = NSSelectorFromString(methodNameWithDict);
-    // Test for the legacy selector first in case they both exist.
-    if ([obj respondsToSelector:legacySelector]) {
-        NSMutableArray* arguments = nil;
-        NSMutableDictionary* dict = nil;
-        [command legacyArguments:&arguments andDict:&dict];
-        // [obj performSelector:legacySelector withObject:arguments withObject:dict];
-        objc_msgSend(obj, legacySelector, arguments, dict);
-    } else if ([obj respondsToSelector:normalSelector]) {
-        // [obj performSelector:normalSelector withObject:command];
-        objc_msgSend(obj, normalSelector, command);
-    } else {
-        // There's no method to call, so throw an error.
-        NSLog(@"ERROR: Method '%@' not defined in Plugin '%@'", methodName, command.className);
-        retVal = NO;
-    }
-
-    return retVal;
-}
-
-@end