cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agri...@apache.org
Subject [19/50] [abbrv] removed native plugin files for various plugins
Date Fri, 28 Jun 2013 15:07:27 GMT
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/eb64bf3c/CordovaLib/Classes/CDVContacts.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVContacts.m b/CordovaLib/Classes/CDVContacts.m
deleted file mode 100644
index 6cb9f08..0000000
--- a/CordovaLib/Classes/CDVContacts.m
+++ /dev/null
@@ -1,593 +0,0 @@
-/*
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements.  See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership.  The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License.  You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied.  See the License for the
- specific language governing permissions and limitations
- under the License.
- */
-
-#import "CDVContacts.h"
-#import <UIKit/UIKit.h>
-#import "NSArray+Comparisons.h"
-#import "NSDictionary+Extensions.h"
-#import "CDVNotification.h"
-
-@implementation CDVContactsPicker
-
-@synthesize allowsEditing;
-@synthesize callbackId;
-@synthesize options;
-@synthesize pickedContactDictionary;
-
-@end
-@implementation CDVNewContactsController
-
-@synthesize callbackId;
-
-@end
-
-@implementation CDVContacts
-
-// no longer used since code gets AddressBook for each operation.
-// If address book changes during save or remove operation, may get error but not much we can do about it
-// If address book changes during UI creation, display or edit, we don't control any saves so no need for callback
-
-/*void addressBookChanged(ABAddressBookRef addressBook, CFDictionaryRef info, void* context)
-{
-    // note that this function is only called when another AddressBook instance modifies
-    // the address book, not the current one. For example, through an OTA MobileMe sync
-    Contacts* contacts = (Contacts*)context;
-    [contacts addressBookDirty];
-}*/
-
-- (CDVPlugin*)initWithWebView:(UIWebView*)theWebView
-{
-    self = (CDVContacts*)[super initWithWebView:(UIWebView*)theWebView];
-
-    /*if (self) {
-        addressBook = ABAddressBookCreate();
-        ABAddressBookRegisterExternalChangeCallback(addressBook, addressBookChanged, self);
-    }*/
-
-    return self;
-}
-
-// overridden to clean up Contact statics
-- (void)onAppTerminate
-{
-    // NSLog(@"Contacts::onAppTerminate");
-}
-
-// iPhone only method to create a new contact through the GUI
-- (void)newContact:(CDVInvokedUrlCommand*)command
-{
-    NSString* callbackId = command.callbackId;
-
-    CDVAddressBookHelper* abHelper = [[CDVAddressBookHelper alloc] init];
-    CDVContacts* __weak weakSelf = self;  // play it safe to avoid retain cycles
-
-    [abHelper createAddressBook: ^(ABAddressBookRef addrBook, CDVAddressBookAccessError* errCode) {
-        if (addrBook == NULL) {
-            // permission was denied or other error just return (no error callback)
-            return;
-        }
-        CDVNewContactsController* npController = [[CDVNewContactsController alloc] init];
-        npController.addressBook = addrBook;     // a CF retaining assign
-        CFRelease(addrBook);
-
-        npController.newPersonViewDelegate = self;
-        npController.callbackId = callbackId;
-
-        UINavigationController* navController = [[UINavigationController alloc] initWithRootViewController:npController];
-
-        if ([weakSelf.viewController respondsToSelector:@selector(presentViewController:::)]) {
-            [weakSelf.viewController presentViewController:navController animated:YES completion:nil];
-        } else {
-            [weakSelf.viewController presentModalViewController:navController animated:YES];
-        }
-    }];
-}
-
-- (void)newPersonViewController:(ABNewPersonViewController*)newPersonViewController didCompleteWithNewPerson:(ABRecordRef)person
-{
-    ABRecordID recordId = kABRecordInvalidID;
-    CDVNewContactsController* newCP = (CDVNewContactsController*)newPersonViewController;
-    NSString* callbackId = newCP.callbackId;
-
-    if (person != NULL) {
-        // return the contact id
-        recordId = ABRecordGetRecordID(person);
-    }
-
-    if ([newPersonViewController respondsToSelector:@selector(presentingViewController)]) {
-        [[newPersonViewController presentingViewController] dismissViewControllerAnimated:YES completion:nil];
-    } else {
-        [[newPersonViewController parentViewController] dismissModalViewControllerAnimated:YES];
-    }
-
-    CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsInt:recordId];
-    [self.commandDelegate sendPluginResult:result callbackId:callbackId];
-}
-
-- (void)displayContact:(CDVInvokedUrlCommand*)command
-{
-    NSString* callbackId = command.callbackId;
-    ABRecordID recordID = [[command.arguments objectAtIndex:0] intValue];
-    NSDictionary* options = [command.arguments objectAtIndex:1 withDefault:[NSNull null]];
-    bool bEdit = [options isKindOfClass:[NSNull class]] ? false : [options existsValue:@"true" forKey:@"allowsEditing"];
-
-    CDVAddressBookHelper* abHelper = [[CDVAddressBookHelper alloc] init];
-    CDVContacts* __weak weakSelf = self;  // play it safe to avoid retain cycles
-
-    [abHelper createAddressBook: ^(ABAddressBookRef addrBook, CDVAddressBookAccessError* errCode) {
-        if (addrBook == NULL) {
-            // permission was denied or other error - return error
-            CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageToErrorObject:errCode ? errCode.errorCode:UNKNOWN_ERROR];
-            [weakSelf.commandDelegate sendPluginResult:result callbackId:callbackId];
-            return;
-        }
-        ABRecordRef rec = ABAddressBookGetPersonWithRecordID(addrBook, recordID);
-
-        if (rec) {
-            CDVDisplayContactViewController* personController = [[CDVDisplayContactViewController alloc] init];
-            personController.displayedPerson = rec;
-            personController.personViewDelegate = self;
-            personController.allowsEditing = NO;
-
-            // create this so DisplayContactViewController will have a "back" button.
-            UIViewController* parentController = [[UIViewController alloc] init];
-            UINavigationController* navController = [[UINavigationController alloc] initWithRootViewController:parentController];
-
-            [navController pushViewController:personController animated:YES];
-
-            if ([self.viewController respondsToSelector:@selector(presentViewController:::)]) {
-                [self.viewController presentViewController:navController animated:YES completion:nil];
-            } else {
-                [self.viewController presentModalViewController:navController animated:YES];
-            }
-
-            if (bEdit) {
-                // create the editing controller and push it onto the stack
-                ABPersonViewController* editPersonController = [[ABPersonViewController alloc] init];
-                editPersonController.displayedPerson = rec;
-                editPersonController.personViewDelegate = self;
-                editPersonController.allowsEditing = YES;
-                [navController pushViewController:editPersonController animated:YES];
-            }
-        } else {
-            // no record, return error
-            CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsInt:UNKNOWN_ERROR];
-            [weakSelf.commandDelegate sendPluginResult:result callbackId:callbackId];
-        }
-        CFRelease(addrBook);
-    }];
-}
-
-- (BOOL)personViewController:(ABPersonViewController*)personViewController shouldPerformDefaultActionForPerson:(ABRecordRef)person
-                    property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifierForValue
-{
-    return YES;
-}
-
-- (void)chooseContact:(CDVInvokedUrlCommand*)command
-{
-    NSString* callbackId = command.callbackId;
-    NSDictionary* options = [command.arguments objectAtIndex:0 withDefault:[NSNull null]];
-
-    CDVContactsPicker* pickerController = [[CDVContactsPicker alloc] init];
-
-    pickerController.peoplePickerDelegate = self;
-    pickerController.callbackId = callbackId;
-    pickerController.options = options;
-    pickerController.pickedContactDictionary = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithInt:kABRecordInvalidID], kW3ContactId, nil];
-    pickerController.allowsEditing = (BOOL)[options existsValue : @"true" forKey : @"allowsEditing"];
-
-    if ([self.viewController respondsToSelector:@selector(presentViewController:::)]) {
-        [self.viewController presentViewController:pickerController animated:YES completion:nil];
-    } else {
-        [self.viewController presentModalViewController:pickerController animated:YES];
-    }
-}
-
-- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController*)peoplePicker
-      shouldContinueAfterSelectingPerson:(ABRecordRef)person
-{
-    CDVContactsPicker* picker = (CDVContactsPicker*)peoplePicker;
-    NSNumber* pickedId = [NSNumber numberWithInt:ABRecordGetRecordID(person)];
-
-    if (picker.allowsEditing) {
-        ABPersonViewController* personController = [[ABPersonViewController alloc] init];
-        personController.displayedPerson = person;
-        personController.personViewDelegate = self;
-        personController.allowsEditing = picker.allowsEditing;
-        // store id so can get info in peoplePickerNavigationControllerDidCancel
-        picker.pickedContactDictionary = [NSDictionary dictionaryWithObjectsAndKeys:pickedId, kW3ContactId, nil];
-
-        [peoplePicker pushViewController:personController animated:YES];
-    } else {
-        // Retrieve and return pickedContact information
-        CDVContact* pickedContact = [[CDVContact alloc] initFromABRecord:(ABRecordRef)person];
-        NSArray* fields = [picker.options objectForKey:@"fields"];
-        NSDictionary* returnFields = [[CDVContact class] calcReturnFields:fields];
-        picker.pickedContactDictionary = [pickedContact toDictionary:returnFields];
-
-        CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:picker.pickedContactDictionary];
-        [self.commandDelegate sendPluginResult:result callbackId:picker.callbackId];
-
-        if ([picker respondsToSelector:@selector(presentingViewController)]) {
-            [[picker presentingViewController] dismissViewControllerAnimated:YES completion:nil];
-        } else {
-            [[picker parentViewController] dismissModalViewControllerAnimated:YES];
-        }
-    }
-    return NO;
-}
-
-- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController*)peoplePicker
-      shouldContinueAfterSelectingPerson:(ABRecordRef)person property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifier
-{
-    return YES;
-}
-
-- (void)peoplePickerNavigationControllerDidCancel:(ABPeoplePickerNavigationController*)peoplePicker
-{
-    // return contactId or invalid if none picked
-    CDVContactsPicker* picker = (CDVContactsPicker*)peoplePicker;
-
-    if (picker.allowsEditing) {
-        // get the info after possible edit
-        // if we got this far, user has already approved/ disapproved addressBook access
-        ABAddressBookRef addrBook = nil;
-#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 60000
-            if (&ABAddressBookCreateWithOptions != NULL) {
-                addrBook = ABAddressBookCreateWithOptions(NULL, NULL);
-            } else
-#endif
-        {
-            // iOS 4 & 5
-            addrBook = ABAddressBookCreate();
-        }
-        ABRecordRef person = ABAddressBookGetPersonWithRecordID(addrBook, [[picker.pickedContactDictionary objectForKey:kW3ContactId] integerValue]);
-        if (person) {
-            CDVContact* pickedContact = [[CDVContact alloc] initFromABRecord:(ABRecordRef)person];
-            NSArray* fields = [picker.options objectForKey:@"fields"];
-            NSDictionary* returnFields = [[CDVContact class] calcReturnFields:fields];
-            picker.pickedContactDictionary = [pickedContact toDictionary:returnFields];
-        }
-        CFRelease(addrBook);
-    }
-    CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:picker.pickedContactDictionary];
-    [self.commandDelegate sendPluginResult:result callbackId:picker.callbackId];
-
-    if ([peoplePicker respondsToSelector:@selector(presentingViewController)]) {
-        [[peoplePicker presentingViewController] dismissViewControllerAnimated:YES completion:nil];
-    } else {
-        [[peoplePicker parentViewController] dismissModalViewControllerAnimated:YES];
-    }
-}
-
-- (void)search:(CDVInvokedUrlCommand*)command
-{
-    NSString* callbackId = command.callbackId;
-    NSArray* fields = [command.arguments objectAtIndex:0];
-    NSDictionary* findOptions = [command.arguments objectAtIndex:1 withDefault:[NSNull null]];
-
-    [self.commandDelegate runInBackground:^{
-        // from Apple:  Important You must ensure that an instance of ABAddressBookRef is used by only one thread.
-        // which is why address book is created within the dispatch queue.
-        // more details here: http: //blog.byadrian.net/2012/05/05/ios-addressbook-framework-and-gcd/
-        CDVAddressBookHelper* abHelper = [[CDVAddressBookHelper alloc] init];
-        CDVContacts* __weak weakSelf = self;     // play it safe to avoid retain cycles
-        // it gets uglier, block within block.....
-        [abHelper createAddressBook: ^(ABAddressBookRef addrBook, CDVAddressBookAccessError* errCode) {
-            if (addrBook == NULL) {
-                // permission was denied or other error - return error
-                CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageToErrorObject:errCode ? errCode.errorCode:UNKNOWN_ERROR];
-                [weakSelf.commandDelegate sendPluginResult:result callbackId:callbackId];
-                return;
-            }
-
-            NSArray* foundRecords = nil;
-            // get the findOptions values
-            BOOL multiple = NO;         // default is false
-            NSString* filter = nil;
-            if (![findOptions isKindOfClass:[NSNull class]]) {
-                id value = nil;
-                filter = (NSString*)[findOptions objectForKey:@"filter"];
-                value = [findOptions objectForKey:@"multiple"];
-                if ([value isKindOfClass:[NSNumber class]]) {
-                    // multiple is a boolean that will come through as an NSNumber
-                    multiple = [(NSNumber*)value boolValue];
-                    // NSLog(@"multiple is: %d", multiple);
-                }
-            }
-
-            NSDictionary* returnFields = [[CDVContact class] calcReturnFields:fields];
-
-            NSMutableArray* matches = nil;
-            if (!filter || [filter isEqualToString:@""]) {
-                // get all records
-                foundRecords = (__bridge_transfer NSArray*)ABAddressBookCopyArrayOfAllPeople(addrBook);
-                if (foundRecords && ([foundRecords count] > 0)) {
-                    // create Contacts and put into matches array
-                    // doesn't make sense to ask for all records when multiple == NO but better check
-                    int xferCount = multiple == YES ? [foundRecords count] : 1;
-                    matches = [NSMutableArray arrayWithCapacity:xferCount];
-
-                    for (int k = 0; k < xferCount; k++) {
-                        CDVContact* xferContact = [[CDVContact alloc] initFromABRecord:(__bridge ABRecordRef)[foundRecords objectAtIndex:k]];
-                        [matches addObject:xferContact];
-                        xferContact = nil;
-                    }
-                }
-            } else {
-                foundRecords = (__bridge_transfer NSArray*)ABAddressBookCopyArrayOfAllPeople(addrBook);
-                matches = [NSMutableArray arrayWithCapacity:1];
-                BOOL bFound = NO;
-                int testCount = [foundRecords count];
-
-                for (int j = 0; j < testCount; j++) {
-                    CDVContact* testContact = [[CDVContact alloc] initFromABRecord:(__bridge ABRecordRef)[foundRecords objectAtIndex:j]];
-                    if (testContact) {
-                        bFound = [testContact foundValue:filter inFields:returnFields];
-                        if (bFound) {
-                            [matches addObject:testContact];
-                        }
-                        testContact = nil;
-                    }
-                }
-            }
-            NSMutableArray* returnContacts = [NSMutableArray arrayWithCapacity:1];
-
-            if ((matches != nil) && ([matches count] > 0)) {
-                // convert to JS Contacts format and return in callback
-                // - returnFields  determines what properties to return
-                @autoreleasepool {
-                    int count = multiple == YES ? [matches count] : 1;
-
-                    for (int i = 0; i < count; i++) {
-                        CDVContact* newContact = [matches objectAtIndex:i];
-                        NSDictionary* aContact = [newContact toDictionary:returnFields];
-                        [returnContacts addObject:aContact];
-                    }
-                }
-            }
-            // return found contacts (array is empty if no contacts found)
-            CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsArray:returnContacts];
-            [weakSelf.commandDelegate sendPluginResult:result callbackId:callbackId];
-            // NSLog(@"findCallback string: %@", jsString);
-
-            if (addrBook) {
-                CFRelease(addrBook);
-            }
-        }];
-    }];     // end of workQueue block
-
-    return;
-}
-
-- (void)save:(CDVInvokedUrlCommand*)command
-{
-    NSString* callbackId = command.callbackId;
-    NSDictionary* contactDict = [command.arguments objectAtIndex:0];
-
-    [self.commandDelegate runInBackground:^{
-        CDVAddressBookHelper* abHelper = [[CDVAddressBookHelper alloc] init];
-        CDVContacts* __weak weakSelf = self;     // play it safe to avoid retain cycles
-
-        [abHelper createAddressBook: ^(ABAddressBookRef addrBook, CDVAddressBookAccessError* errorCode) {
-            CDVPluginResult* result = nil;
-            if (addrBook == NULL) {
-                // permission was denied or other error - return error
-                result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsInt:errorCode ? errorCode.errorCode:UNKNOWN_ERROR];
-                [weakSelf.commandDelegate sendPluginResult:result callbackId:callbackId];
-                return;
-            }
-
-            bool bIsError = FALSE, bSuccess = FALSE;
-            BOOL bUpdate = NO;
-            CDVContactError errCode = UNKNOWN_ERROR;
-            CFErrorRef error;
-            NSNumber* cId = [contactDict valueForKey:kW3ContactId];
-            CDVContact* aContact = nil;
-            ABRecordRef rec = nil;
-            if (cId && ![cId isKindOfClass:[NSNull class]]) {
-                rec = ABAddressBookGetPersonWithRecordID(addrBook, [cId intValue]);
-                if (rec) {
-                    aContact = [[CDVContact alloc] initFromABRecord:rec];
-                    bUpdate = YES;
-                }
-            }
-            if (!aContact) {
-                aContact = [[CDVContact alloc] init];
-            }
-
-            bSuccess = [aContact setFromContactDict:contactDict asUpdate:bUpdate];
-            if (bSuccess) {
-                if (!bUpdate) {
-                    bSuccess = ABAddressBookAddRecord(addrBook, [aContact record], &error);
-                }
-                if (bSuccess) {
-                    bSuccess = ABAddressBookSave(addrBook, &error);
-                }
-                if (!bSuccess) {         // need to provide error codes
-                    bIsError = TRUE;
-                    errCode = IO_ERROR;
-                } else {
-                    // give original dictionary back?  If generate dictionary from saved contact, have no returnFields specified
-                    // so would give back all fields (which W3C spec. indicates is not desired)
-                    // for now (while testing) give back saved, full contact
-                    NSDictionary* newContact = [aContact toDictionary:[CDVContact defaultFields]];
-                    // NSString* contactStr = [newContact JSONRepresentation];
-                    result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:newContact];
-                }
-            } else {
-                bIsError = TRUE;
-                errCode = IO_ERROR;
-            }
-            CFRelease(addrBook);
-
-            if (bIsError) {
-                result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsInt:errCode];
-            }
-
-            if (result) {
-                [weakSelf.commandDelegate sendPluginResult:result callbackId:callbackId];
-            }
-        }];
-    }];     // end of  queue
-}
-
-- (void)remove:(CDVInvokedUrlCommand*)command
-{
-    NSString* callbackId = command.callbackId;
-    NSNumber* cId = [command.arguments objectAtIndex:0];
-
-    CDVAddressBookHelper* abHelper = [[CDVAddressBookHelper alloc] init];
-    CDVContacts* __weak weakSelf = self;  // play it safe to avoid retain cycles
-
-    [abHelper createAddressBook: ^(ABAddressBookRef addrBook, CDVAddressBookAccessError* errorCode) {
-        CDVPluginResult* result = nil;
-        if (addrBook == NULL) {
-            // permission was denied or other error - return error
-            result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsInt:errorCode ? errorCode.errorCode:UNKNOWN_ERROR];
-            [weakSelf.commandDelegate sendPluginResult:result callbackId:callbackId];
-            return;
-        }
-
-        bool bIsError = FALSE, bSuccess = FALSE;
-        CDVContactError errCode = UNKNOWN_ERROR;
-        CFErrorRef error;
-        ABRecordRef rec = nil;
-        if (cId && ![cId isKindOfClass:[NSNull class]] && ([cId intValue] != kABRecordInvalidID)) {
-            rec = ABAddressBookGetPersonWithRecordID(addrBook, [cId intValue]);
-            if (rec) {
-                bSuccess = ABAddressBookRemoveRecord(addrBook, rec, &error);
-                if (!bSuccess) {
-                    bIsError = TRUE;
-                    errCode = IO_ERROR;
-                } else {
-                    bSuccess = ABAddressBookSave(addrBook, &error);
-                    if (!bSuccess) {
-                        bIsError = TRUE;
-                        errCode = IO_ERROR;
-                    } else {
-                        // set id to null
-                        // [contactDict setObject:[NSNull null] forKey:kW3ContactId];
-                        // result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary: contactDict];
-                        result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
-                        // NSString* contactStr = [contactDict JSONRepresentation];
-                    }
-                }
-            } else {
-                // no record found return error
-                bIsError = TRUE;
-                errCode = UNKNOWN_ERROR;
-            }
-        } else {
-            // invalid contact id provided
-            bIsError = TRUE;
-            errCode = INVALID_ARGUMENT_ERROR;
-        }
-
-        if (addrBook) {
-            CFRelease(addrBook);
-        }
-        if (bIsError) {
-            result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsInt:errCode];
-        }
-        if (result) {
-            [weakSelf.commandDelegate sendPluginResult:result callbackId:callbackId];
-        }
-    }];
-    return;
-}
-
-@end
-
-/* ABPersonViewController does not have any UI to dismiss.  Adding navigationItems to it does not work properly
- * The navigationItems are lost when the app goes into the background.  The solution was to create an empty
- * NavController in front of the ABPersonViewController. This will cause the ABPersonViewController to have a back button. By subclassing the ABPersonViewController, we can override viewDidDisappear and take down the entire NavigationController.
- */
-@implementation CDVDisplayContactViewController
-@synthesize contactsPlugin;
-
-- (void)viewWillDisappear:(BOOL)animated
-{
-    [super viewWillDisappear:animated];
-
-    if ([self respondsToSelector:@selector(presentingViewController)]) {
-        [[self presentingViewController] dismissViewControllerAnimated:YES completion:nil];
-    } else {
-        [[self parentViewController] dismissModalViewControllerAnimated:YES];
-    }
-}
-
-@end
-@implementation CDVAddressBookAccessError
-
-@synthesize errorCode;
-
-- (CDVAddressBookAccessError*)initWithCode:(CDVContactError)code
-{
-    self = [super init];
-    if (self) {
-        self.errorCode = code;
-    }
-    return self;
-}
-
-@end
-
-@implementation CDVAddressBookHelper
-
-/**
- * NOTE: workerBlock is responsible for releasing the addressBook that is passed to it
- */
-- (void)createAddressBook:(CDVAddressBookWorkerBlock)workerBlock
-{
-    // TODO: this probably should be reworked - seems like the workerBlock can just create and release its own AddressBook,
-    // and also this important warning from (http://developer.apple.com/library/ios/#documentation/ContactData/Conceptual/AddressBookProgrammingGuideforiPhone/Chapters/BasicObjects.html):
-    // "Important: Instances of ABAddressBookRef cannot be used by multiple threads. Each thread must make its own instance."
-    ABAddressBookRef addressBook;
-
-#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 60000
-        if (&ABAddressBookCreateWithOptions != NULL) {
-            CFErrorRef error = nil;
-            // CFIndex status = ABAddressBookGetAuthorizationStatus();
-            addressBook = ABAddressBookCreateWithOptions(NULL, &error);
-            // NSLog(@"addressBook access: %lu", status);
-            ABAddressBookRequestAccessWithCompletion(addressBook, ^(bool granted, CFErrorRef error) {
-                    // callback can occur in background, address book must be accessed on thread it was created on
-                    dispatch_sync(dispatch_get_main_queue(), ^{
-                        if (error) {
-                            workerBlock(NULL, [[CDVAddressBookAccessError alloc] initWithCode:UNKNOWN_ERROR]);
-                        } else if (!granted) {
-                            workerBlock(NULL, [[CDVAddressBookAccessError alloc] initWithCode:PERMISSION_DENIED_ERROR]);
-                        } else {
-                            // access granted
-                            workerBlock(addressBook, [[CDVAddressBookAccessError alloc] initWithCode:UNKNOWN_ERROR]);
-                        }
-                    });
-                });
-        } else
-#endif
-    {
-        // iOS 4 or 5 no checks needed
-        addressBook = ABAddressBookCreate();
-        workerBlock(addressBook, NULL);
-    }
-}
-
-@end

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/eb64bf3c/CordovaLib/Classes/CDVGlobalization.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVGlobalization.h b/CordovaLib/Classes/CDVGlobalization.h
deleted file mode 100644
index 0384656..0000000
--- a/CordovaLib/Classes/CDVGlobalization.h
+++ /dev/null
@@ -1,150 +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 "CDVPlugin.h"
-
-#define CDV_FORMAT_SHORT 0
-#define CDV_FORMAT_MEDIUM 1
-#define CDV_FORMAT_LONG 2
-#define CDV_FORMAT_FULL 3
-#define CDV_SELECTOR_MONTHS 0
-#define CDV_SELECTOR_DAYS 1
-
-enum CDVGlobalizationError {
-    CDV_UNKNOWN_ERROR = 0,
-    CDV_FORMATTING_ERROR = 1,
-    CDV_PARSING_ERROR = 2,
-    CDV_PATTERN_ERROR = 3,
-};
-typedef NSUInteger CDVGlobalizationError;
-
-@interface CDVGlobalization : CDVPlugin {
-    CFLocaleRef currentLocale;
-}
-
-- (void)getPreferredLanguage:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options;
-
-/**
- * Returns the string identifier for the clients current locale setting.
- * It returns the locale identifier string to the successCB callback with a
- * properties object as a parameter. If there is an error getting the locale,
- * then the errorCB callback is invoked.
- */
-- (void)getLocaleName:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options;
-
-/**
- * Returns a date formatted as a string according to the clients user preferences and
- * calendar using the time zone of the client. It returns the formatted date string to the
- * successCB callback with a properties object as a parameter. If there is an error
- * formatting the date, then the errorCB callback is invoked.
- *
- * options: "date" contains the number of milliseconds that represents the JavaScript date
- */
-- (void)dateToString:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options;
-
-/**
- * Parses a date formatted as a string according to the clients user
- * preferences and calendar using the time zone of the client and returns
- * the corresponding date object. It returns the date to the successCB
- * callback with a properties object as a parameter. If there is an error
- * parsing the date string, then the errorCB callback is invoked.
- *
- * options: "dateString" contains the JavaScript string to parse for a date
- */
-- (void)stringToDate:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options;
-
-/**
- * Returns a pattern string for formatting and parsing dates according to the clients
- * user preferences. It returns the pattern to the successCB callback with a
- * properties object as a parameter. If there is an error obtaining the pattern,
- * then the errorCB callback is invoked.
- *
- */
-- (void)getDatePattern:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options;
-
-/**
- * Returns an array of either the names of the months or days of the week
- * according to the clients user preferences and calendar. It returns the array of names to the
- * successCB callback with a properties object as a parameter. If there is an error obtaining the
- * names, then the errorCB callback is invoked.
- *
- */
-- (void)getDateNames:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options;
-
-/**
- * Returns whether daylight savings time is in effect for a given date using the clients
- * time zone and calendar. It returns whether or not daylight savings time is in effect
- * to the successCB callback with a properties object as a parameter. If there is an error
- * reading the date, then the errorCB callback is invoked.
- *
- * options: "date" contains the number of milliseconds that represents the JavaScript date
- *
- */
-- (void)isDayLightSavingsTime:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options;
-
-/**
- * Returns the first day of the week according to the clients user preferences and calendar.
- * The days of the week are numbered starting from 1 where 1 is considered to be Sunday.
- * It returns the day to the successCB callback with a properties object as a parameter.
- * If there is an error obtaining the pattern, then the errorCB callback is invoked.
- *
- */
-- (void)getFirstDayOfWeek:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options;
-
-/**
- * Returns a number formatted as a string according to the clients user preferences.
- * It returns the formatted number string to the successCB callback with a properties object as a
- * parameter. If there is an error formatting the number, then the errorCB callback is invoked.
- *
- * options: "number" contains the JavaScript number to format
- *
- */
-- (void)numberToString:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options;
-
-/**
- * Parses a number formatted as a string according to the clients user preferences and
- * returns the corresponding number. It returns the number to the successCB callback with a
- * properties object as a parameter. If there is an error parsing the number string, then
- * the errorCB callback is invoked.
- *
- * options: "numberString" contains the JavaScript string to parse for a number
- *
- */
-- (void)stringToNumber:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options;
-
-/**
- * Returns a pattern string for formatting and parsing numbers according to the clients user
- * preferences. It returns the pattern to the successCB callback with a properties object as a
- * parameter. If there is an error obtaining the pattern, then the errorCB callback is invoked.
- *
- */
-- (void)getNumberPattern:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options;
-
-/**
- * Returns a pattern string for formatting and parsing currency values according to the clients
- * user preferences and ISO 4217 currency code. It returns the pattern to the successCB callback with a
- * properties object as a parameter. If there is an error obtaining the pattern, then the errorCB
- * callback is invoked.
- *
- * options: "currencyCode" contains the ISO currency code from JavaScript
- */
-- (void)getCurrencyPattern:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options;
-
-@end

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/eb64bf3c/CordovaLib/Classes/CDVGlobalization.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVGlobalization.m b/CordovaLib/Classes/CDVGlobalization.m
deleted file mode 100644
index 9eb9721..0000000
--- a/CordovaLib/Classes/CDVGlobalization.m
+++ /dev/null
@@ -1,790 +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 "CDVGlobalization.h"
-
-@implementation CDVGlobalization
-
-- (id)initWithWebView:(UIWebView*)theWebView
-{
-    self = (CDVGlobalization*)[super initWithWebView:theWebView];
-    if (self) {
-        currentLocale = CFLocaleCopyCurrent();
-    }
-    return self;
-}
-
-- (void)getPreferredLanguage:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options
-{
-    NSString* callbackId = [arguments objectAtIndex:0];
-    CDVPluginResult* result = nil;
-
-    NSLog(@"log1");
-    // Source: http://stackoverflow.com/questions/3910244/getting-current-device-language-in-ios
-    // (should be OK)
-    NSString* language = [[NSLocale preferredLanguages] objectAtIndex:0];
-
-    if (language) {
-        NSDictionary* dictionary = [NSDictionary dictionaryWithObject:language forKey:@"value"];
-
-        result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK
-                               messageAsDictionary:dictionary];
-    } else {
-        // TBD is this ever expected to happen?
-        NSMutableDictionary* dictionary = [NSMutableDictionary dictionaryWithCapacity:2];
-        [dictionary setValue:[NSNumber numberWithInt:CDV_UNKNOWN_ERROR] forKey:@"code"];
-        [dictionary setValue:@"Unknown error" forKey:@"message"];
-        result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsDictionary:dictionary];
-    }
-
-    [self.commandDelegate sendPluginResult:result callbackId:callbackId];
-}
-
-- (void)getLocaleName:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options
-{
-    CDVPluginResult* result = nil;
-    NSString* callbackId = [arguments objectAtIndex:0];
-    NSDictionary* dictionary = nil;
-
-    NSLocale* locale = [NSLocale currentLocale];
-
-    if (locale) {
-        dictionary = [NSDictionary dictionaryWithObject:[locale localeIdentifier] forKey:@"value"];
-
-        result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:dictionary];
-    } else {
-        NSMutableDictionary* dictionary = [NSMutableDictionary dictionaryWithCapacity:2];
-        [dictionary setValue:[NSNumber numberWithInt:CDV_UNKNOWN_ERROR] forKey:@"code"];
-        [dictionary setValue:@"Unknown error" forKey:@"message"];
-        result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsDictionary:dictionary];
-    }
-
-    [self.commandDelegate sendPluginResult:result callbackId:callbackId];
-}
-
-- (void)dateToString:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options
-{
-    CFDateFormatterStyle style = kCFDateFormatterShortStyle;
-    CFDateFormatterStyle dateStyle = kCFDateFormatterShortStyle;
-    CFDateFormatterStyle timeStyle = kCFDateFormatterShortStyle;
-    NSDate* date = nil;
-    NSString* dateString = nil;
-    CDVPluginResult* result = nil;
-    NSString* callBackId = [arguments objectAtIndex:0];
-
-    id milliseconds = [options valueForKey:@"date"];
-
-    if (milliseconds && [milliseconds isKindOfClass:[NSNumber class]]) {
-        // get the number of seconds since 1970 and create the date object
-        date = [NSDate dateWithTimeIntervalSince1970:[milliseconds doubleValue] / 1000];
-    }
-
-    // see if any options have been specified
-    id items = [options valueForKey:@"options"];
-    if (items && [items isKindOfClass:[NSMutableDictionary class]]) {
-        NSEnumerator* enumerator = [items keyEnumerator];
-        id key;
-
-        // iterate through all the options
-        while ((key = [enumerator nextObject])) {
-            id item = [items valueForKey:key];
-
-            // make sure that only string values are present
-            if ([item isKindOfClass:[NSString class]]) {
-                // get the desired format length
-                if ([key isEqualToString:@"formatLength"]) {
-                    if ([item isEqualToString:@"short"]) {
-                        style = kCFDateFormatterShortStyle;
-                    } else if ([item isEqualToString:@"medium"]) {
-                        style = kCFDateFormatterMediumStyle;
-                    } else if ([item isEqualToString:@"long"]) {
-                        style = kCFDateFormatterLongStyle;
-                    } else if ([item isEqualToString:@"full"]) {
-                        style = kCFDateFormatterFullStyle;
-                    }
-                }
-                // get the type of date and time to generate
-                else if ([key isEqualToString:@"selector"]) {
-                    if ([item isEqualToString:@"date"]) {
-                        dateStyle = style;
-                        timeStyle = kCFDateFormatterNoStyle;
-                    } else if ([item isEqualToString:@"time"]) {
-                        dateStyle = kCFDateFormatterNoStyle;
-                        timeStyle = style;
-                    } else if ([item isEqualToString:@"date and time"]) {
-                        dateStyle = style;
-                        timeStyle = style;
-                    }
-                }
-            }
-        }
-    }
-
-    // create the formatter using the user's current default locale and formats for dates and times
-    CFDateFormatterRef formatter = CFDateFormatterCreate(kCFAllocatorDefault,
-            currentLocale,
-            dateStyle,
-            timeStyle);
-    // if we have a valid date object then call the formatter
-    if (date) {
-        dateString = (__bridge_transfer NSString*)CFDateFormatterCreateStringWithDate(kCFAllocatorDefault,
-                formatter,
-                (__bridge CFDateRef)date);
-    }
-
-    // if the date was converted to a string successfully then return the result
-    if (dateString) {
-        NSDictionary* dictionary = [NSDictionary dictionaryWithObject:dateString forKey:@"value"];
-        result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:dictionary];
-    }
-    // error
-    else {
-        // DLog(@"GlobalizationCommand dateToString unable to format %@", [date description]);
-        NSMutableDictionary* dictionary = [NSMutableDictionary dictionaryWithCapacity:2];
-        [dictionary setValue:[NSNumber numberWithInt:CDV_FORMATTING_ERROR] forKey:@"code"];
-        [dictionary setValue:@"Formatting error" forKey:@"message"];
-        result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsDictionary:dictionary];
-    }
-
-    [self.commandDelegate sendPluginResult:result callbackId:callBackId];
-
-    CFRelease(formatter);
-}
-
-- (void)stringToDate:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options
-{
-    CFDateFormatterStyle style = kCFDateFormatterShortStyle;
-    CFDateFormatterStyle dateStyle = kCFDateFormatterShortStyle;
-    CFDateFormatterStyle timeStyle = kCFDateFormatterShortStyle;
-    CDVPluginResult* result = nil;
-    NSString* callBackId = [arguments objectAtIndex:0];
-    NSString* dateString = nil;
-    NSDateComponents* comps = nil;
-
-    // get the string that is to be parsed for a date
-    id ms = [options valueForKey:@"dateString"];
-
-    if (ms && [ms isKindOfClass:[NSString class]]) {
-        dateString = ms;
-    }
-
-    // see if any options have been specified
-    id items = [options valueForKey:@"options"];
-    if (items && [items isKindOfClass:[NSMutableDictionary class]]) {
-        NSEnumerator* enumerator = [items keyEnumerator];
-        id key;
-
-        // iterate through all the options
-        while ((key = [enumerator nextObject])) {
-            id item = [items valueForKey:key];
-
-            // make sure that only string values are present
-            if ([item isKindOfClass:[NSString class]]) {
-                // get the desired format length
-                if ([key isEqualToString:@"formatLength"]) {
-                    if ([item isEqualToString:@"short"]) {
-                        style = kCFDateFormatterShortStyle;
-                    } else if ([item isEqualToString:@"medium"]) {
-                        style = kCFDateFormatterMediumStyle;
-                    } else if ([item isEqualToString:@"long"]) {
-                        style = kCFDateFormatterLongStyle;
-                    } else if ([item isEqualToString:@"full"]) {
-                        style = kCFDateFormatterFullStyle;
-                    }
-                }
-                // get the type of date and time to generate
-                else if ([key isEqualToString:@"selector"]) {
-                    if ([item isEqualToString:@"date"]) {
-                        dateStyle = style;
-                        timeStyle = kCFDateFormatterNoStyle;
-                    } else if ([item isEqualToString:@"time"]) {
-                        dateStyle = kCFDateFormatterNoStyle;
-                        timeStyle = style;
-                    } else if ([item isEqualToString:@"date and time"]) {
-                        dateStyle = style;
-                        timeStyle = style;
-                    }
-                }
-            }
-        }
-    }
-
-    // get the user's default settings for date and time formats
-    CFDateFormatterRef formatter = CFDateFormatterCreate(kCFAllocatorDefault,
-            currentLocale,
-            dateStyle,
-            timeStyle);
-
-    // set the parsing to be more lenient
-    CFDateFormatterSetProperty(formatter, kCFDateFormatterIsLenient, kCFBooleanTrue);
-
-    // parse tha date and time string
-    CFDateRef date = CFDateFormatterCreateDateFromString(kCFAllocatorDefault,
-            formatter,
-            (__bridge CFStringRef)dateString,
-            NULL);
-
-    // if we were able to parse the date then get the date and time components
-    if (date != NULL) {
-        NSCalendar* calendar = [NSCalendar currentCalendar];
-
-        unsigned unitFlags = NSYearCalendarUnit |
-            NSMonthCalendarUnit |
-            NSDayCalendarUnit |
-            NSHourCalendarUnit |
-            NSMinuteCalendarUnit |
-            NSSecondCalendarUnit;
-
-        comps = [calendar components:unitFlags fromDate:(__bridge NSDate*)date];
-        CFRelease(date);
-    }
-
-    // put the various elements of the date and time into a dictionary
-    if (comps != nil) {
-        NSArray* keys = [NSArray arrayWithObjects:@"year", @"month", @"day", @"hour", @"minute", @"second", @"millisecond", nil];
-        NSArray* values = [NSArray arrayWithObjects:[NSNumber numberWithInt:[comps year]],
-            [NSNumber numberWithInt:[comps month] - 1],
-            [NSNumber numberWithInt:[comps day]],
-            [NSNumber numberWithInt:[comps hour]],
-            [NSNumber numberWithInt:[comps minute]],
-            [NSNumber numberWithInt:[comps second]],
-            [NSNumber numberWithInt:0],                /* iOS does not provide milliseconds */
-            nil];
-
-        NSDictionary* dictionary = [NSDictionary dictionaryWithObjects:values forKeys:keys];
-        result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:dictionary];
-    }
-    // error
-    else {
-        // Dlog(@"GlobalizationCommand stringToDate unable to parse %@", dateString);
-        NSMutableDictionary* dictionary = [NSMutableDictionary dictionaryWithCapacity:2];
-        [dictionary setValue:[NSNumber numberWithInt:CDV_PARSING_ERROR] forKey:@"code"];
-        [dictionary setValue:@"unable to parse" forKey:@"message"];
-        result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsDictionary:dictionary];
-    }
-
-    [self.commandDelegate sendPluginResult:result callbackId:callBackId];
-
-    CFRelease(formatter);
-}
-
-- (void)getDatePattern:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options
-{
-    CFDateFormatterStyle style = kCFDateFormatterShortStyle;
-    CFDateFormatterStyle dateStyle = kCFDateFormatterShortStyle;
-    CFDateFormatterStyle timeStyle = kCFDateFormatterShortStyle;
-    CDVPluginResult* result = nil;
-    NSString* callBackId = [arguments objectAtIndex:0];
-
-    // see if any options have been specified
-    id items = [options valueForKey:@"options"];
-
-    if (items && [items isKindOfClass:[NSMutableDictionary class]]) {
-        NSEnumerator* enumerator = [items keyEnumerator];
-        id key;
-
-        // iterate through all the options
-        while ((key = [enumerator nextObject])) {
-            id item = [items valueForKey:key];
-
-            // make sure that only string values are present
-            if ([item isKindOfClass:[NSString class]]) {
-                // get the desired format length
-                if ([key isEqualToString:@"formatLength"]) {
-                    if ([item isEqualToString:@"short"]) {
-                        style = kCFDateFormatterShortStyle;
-                    } else if ([item isEqualToString:@"medium"]) {
-                        style = kCFDateFormatterMediumStyle;
-                    } else if ([item isEqualToString:@"long"]) {
-                        style = kCFDateFormatterLongStyle;
-                    } else if ([item isEqualToString:@"full"]) {
-                        style = kCFDateFormatterFullStyle;
-                    }
-                }
-                // get the type of date and time to generate
-                else if ([key isEqualToString:@"selector"]) {
-                    if ([item isEqualToString:@"date"]) {
-                        dateStyle = style;
-                        timeStyle = kCFDateFormatterNoStyle;
-                    } else if ([item isEqualToString:@"time"]) {
-                        dateStyle = kCFDateFormatterNoStyle;
-                        timeStyle = style;
-                    } else if ([item isEqualToString:@"date and time"]) {
-                        dateStyle = style;
-                        timeStyle = style;
-                    }
-                }
-            }
-        }
-    }
-
-    // get the user's default settings for date and time formats
-    CFDateFormatterRef formatter = CFDateFormatterCreate(kCFAllocatorDefault,
-            currentLocale,
-            dateStyle,
-            timeStyle);
-
-    // get the date pattern to apply when formatting and parsing
-    CFStringRef datePattern = CFDateFormatterGetFormat(formatter);
-    // get the user's current time zone information
-    CFTimeZoneRef timezone = (CFTimeZoneRef)CFDateFormatterCopyProperty(formatter, kCFDateFormatterTimeZone);
-
-    // put the pattern and time zone information into the dictionary
-    if ((datePattern != nil) && (timezone != nil)) {
-        NSArray* keys = [NSArray arrayWithObjects:@"pattern", @"timezone", @"utc_offset", @"dst_offset", nil];
-        NSArray* values = [NSArray arrayWithObjects:((__bridge NSString*)datePattern),
-            [((__bridge NSTimeZone*)timezone)abbreviation],
-            [NSNumber numberWithLong:[((__bridge NSTimeZone*)timezone)secondsFromGMT]],
-            [NSNumber numberWithDouble:[((__bridge NSTimeZone*)timezone)daylightSavingTimeOffset]],
-            nil];
-
-        NSDictionary* dictionary = [NSDictionary dictionaryWithObjects:values forKeys:keys];
-        result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:dictionary];
-    }
-    // error
-    else {
-        NSMutableDictionary* dictionary = [NSMutableDictionary dictionaryWithCapacity:2];
-        [dictionary setValue:[NSNumber numberWithInt:CDV_PATTERN_ERROR] forKey:@"code"];
-        [dictionary setValue:@"Pattern error" forKey:@"message"];
-        result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsDictionary:dictionary];
-    }
-
-    [self.commandDelegate sendPluginResult:result callbackId:callBackId];
-
-    if (timezone) {
-        CFRelease(timezone);
-    }
-    CFRelease(formatter);
-}
-
-- (void)getDateNames:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options
-{
-    int style = CDV_FORMAT_LONG;
-    int selector = CDV_SELECTOR_MONTHS;
-    CFStringRef dataStyle = kCFDateFormatterMonthSymbols;
-    CDVPluginResult* result = nil;
-    NSString* callBackId = [arguments objectAtIndex:0];
-
-    // see if any options have been specified
-    id items = [options valueForKey:@"options"];
-
-    if (items && [items isKindOfClass:[NSMutableDictionary class]]) {
-        NSEnumerator* enumerator = [items keyEnumerator];
-        id key;
-
-        // iterate through all the options
-        while ((key = [enumerator nextObject])) {
-            id item = [items valueForKey:key];
-
-            // make sure that only string values are present
-            if ([item isKindOfClass:[NSString class]]) {
-                // get the desired type of name
-                if ([key isEqualToString:@"type"]) {
-                    if ([item isEqualToString:@"narrow"]) {
-                        style = CDV_FORMAT_SHORT;
-                    } else if ([item isEqualToString:@"wide"]) {
-                        style = CDV_FORMAT_LONG;
-                    }
-                }
-                // determine if months or days are needed
-                else if ([key isEqualToString:@"item"]) {
-                    if ([item isEqualToString:@"months"]) {
-                        selector = CDV_SELECTOR_MONTHS;
-                    } else if ([item isEqualToString:@"days"]) {
-                        selector = CDV_SELECTOR_DAYS;
-                    }
-                }
-            }
-        }
-    }
-
-    CFDateFormatterRef formatter = CFDateFormatterCreate(kCFAllocatorDefault,
-            currentLocale,
-            kCFDateFormatterFullStyle,
-            kCFDateFormatterFullStyle);
-
-    if ((selector == CDV_SELECTOR_MONTHS) && (style == CDV_FORMAT_LONG)) {
-        dataStyle = kCFDateFormatterMonthSymbols;
-    } else if ((selector == CDV_SELECTOR_MONTHS) && (style == CDV_FORMAT_SHORT)) {
-        dataStyle = kCFDateFormatterShortMonthSymbols;
-    } else if ((selector == CDV_SELECTOR_DAYS) && (style == CDV_FORMAT_LONG)) {
-        dataStyle = kCFDateFormatterWeekdaySymbols;
-    } else if ((selector == CDV_SELECTOR_DAYS) && (style == CDV_FORMAT_SHORT)) {
-        dataStyle = kCFDateFormatterShortWeekdaySymbols;
-    }
-
-    CFArrayRef names = (CFArrayRef)CFDateFormatterCopyProperty(formatter, dataStyle);
-
-    if (names) {
-        NSDictionary* dictionary = [NSDictionary dictionaryWithObject:((__bridge NSArray*)names) forKey:@"value"];
-        result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:dictionary];
-        CFRelease(names);
-    }
-    // error
-    else {
-        NSMutableDictionary* dictionary = [NSMutableDictionary dictionaryWithCapacity:2];
-        [dictionary setValue:[NSNumber numberWithInt:CDV_UNKNOWN_ERROR] forKey:@"code"];
-        [dictionary setValue:@"Unknown error" forKey:@"message"];
-        result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsDictionary:dictionary];
-    }
-
-    [self.commandDelegate sendPluginResult:result callbackId:callBackId];
-
-    CFRelease(formatter);
-}
-
-- (void)isDayLightSavingsTime:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options
-{
-    NSDate* date = nil;
-    CDVPluginResult* result = nil;
-    NSString* callBackId = [arguments objectAtIndex:0];
-
-    id milliseconds = [options valueForKey:@"date"];
-
-    if (milliseconds && [milliseconds isKindOfClass:[NSNumber class]]) {
-        // get the number of seconds since 1970 and create the date object
-        date = [NSDate dateWithTimeIntervalSince1970:[milliseconds doubleValue] / 1000];
-    }
-
-    if (date) {
-        // get the current calendar for the user and check if the date is using DST
-        NSCalendar* calendar = [NSCalendar currentCalendar];
-        NSTimeZone* timezone = [calendar timeZone];
-        NSNumber* dst = [NSNumber numberWithBool:[timezone isDaylightSavingTimeForDate:date]];
-
-        NSDictionary* dictionary = [NSDictionary dictionaryWithObject:dst forKey:@"dst"];
-        result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:dictionary];
-    }
-    // error
-    else {
-        NSMutableDictionary* dictionary = [NSMutableDictionary dictionaryWithCapacity:2];
-        [dictionary setValue:[NSNumber numberWithInt:CDV_UNKNOWN_ERROR] forKey:@"code"];
-        [dictionary setValue:@"Unknown error" forKey:@"message"];
-        result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsDictionary:dictionary];
-    }
-    [self.commandDelegate sendPluginResult:result callbackId:callBackId];
-}
-
-- (void)getFirstDayOfWeek:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options
-{
-    CDVPluginResult* result = nil;
-    NSString* callBackId = [arguments objectAtIndex:0];
-
-    NSCalendar* calendar = [NSCalendar autoupdatingCurrentCalendar];
-
-    NSNumber* day = [NSNumber numberWithInt:[calendar firstWeekday]];
-
-    if (day) {
-        NSDictionary* dictionary = [NSDictionary dictionaryWithObject:day forKey:@"value"];
-        result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:dictionary];
-    }
-    // error
-    else {
-        NSMutableDictionary* dictionary = [NSMutableDictionary dictionaryWithCapacity:2];
-        [dictionary setValue:[NSNumber numberWithInt:CDV_UNKNOWN_ERROR] forKey:@"code"];
-        [dictionary setValue:@"Unknown error" forKey:@"message"];
-        result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsDictionary:dictionary];
-    }
-
-    [self.commandDelegate sendPluginResult:result callbackId:callBackId];
-}
-
-- (void)numberToString:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options
-{
-    CDVPluginResult* result = nil;
-    NSString* callBackId = [arguments objectAtIndex:0];
-    CFNumberFormatterStyle style = kCFNumberFormatterDecimalStyle;
-    NSNumber* number = nil;
-
-    id value = [options valueForKey:@"number"];
-
-    if (value && [value isKindOfClass:[NSNumber class]]) {
-        number = (NSNumber*)value;
-    }
-
-    // see if any options have been specified
-    id items = [options valueForKey:@"options"];
-    if (items && [items isKindOfClass:[NSMutableDictionary class]]) {
-        NSEnumerator* enumerator = [items keyEnumerator];
-        id key;
-
-        // iterate through all the options
-        while ((key = [enumerator nextObject])) {
-            id item = [items valueForKey:key];
-
-            // make sure that only string values are present
-            if ([item isKindOfClass:[NSString class]]) {
-                // get the desired style of formatting
-                if ([key isEqualToString:@"type"]) {
-                    if ([item isEqualToString:@"percent"]) {
-                        style = kCFNumberFormatterPercentStyle;
-                    } else if ([item isEqualToString:@"currency"]) {
-                        style = kCFNumberFormatterCurrencyStyle;
-                    } else if ([item isEqualToString:@"decimal"]) {
-                        style = kCFNumberFormatterDecimalStyle;
-                    }
-                }
-            }
-        }
-    }
-
-    CFNumberFormatterRef formatter = CFNumberFormatterCreate(kCFAllocatorDefault,
-            currentLocale,
-            style);
-
-    // get the localized string based upon the locale and user preferences
-    NSString* numberString = (__bridge_transfer NSString*)CFNumberFormatterCreateStringWithNumber(kCFAllocatorDefault,
-            formatter,
-            (__bridge CFNumberRef)number);
-
-    if (numberString) {
-        NSDictionary* dictionary = [NSDictionary dictionaryWithObject:numberString forKey:@"value"];
-        result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:dictionary];
-    }
-    // error
-    else {
-        // DLog(@"GlobalizationCommand numberToString unable to format %@", [number stringValue]);
-        NSMutableDictionary* dictionary = [NSMutableDictionary dictionaryWithCapacity:2];
-        [dictionary setValue:[NSNumber numberWithInt:CDV_FORMATTING_ERROR] forKey:@"code"];
-        [dictionary setValue:@"Unable to format" forKey:@"message"];
-        result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsDictionary:dictionary];
-    }
-
-    [self.commandDelegate sendPluginResult:result callbackId:callBackId];
-
-    CFRelease(formatter);
-}
-
-- (void)stringToNumber:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options
-{
-    CDVPluginResult* result = nil;
-    NSString* callBackId = [arguments objectAtIndex:0];
-    CFNumberFormatterStyle style = kCFNumberFormatterDecimalStyle;
-    NSString* numberString = nil;
-    double doubleValue;
-
-    id value = [options valueForKey:@"numberString"];
-
-    if (value && [value isKindOfClass:[NSString class]]) {
-        numberString = (NSString*)value;
-    }
-
-    // see if any options have been specified
-    id items = [options valueForKey:@"options"];
-    if (items && [items isKindOfClass:[NSMutableDictionary class]]) {
-        NSEnumerator* enumerator = [items keyEnumerator];
-        id key;
-
-        // iterate through all the options
-        while ((key = [enumerator nextObject])) {
-            id item = [items valueForKey:key];
-
-            // make sure that only string values are present
-            if ([item isKindOfClass:[NSString class]]) {
-                // get the desired style of formatting
-                if ([key isEqualToString:@"type"]) {
-                    if ([item isEqualToString:@"percent"]) {
-                        style = kCFNumberFormatterPercentStyle;
-                    } else if ([item isEqualToString:@"currency"]) {
-                        style = kCFNumberFormatterCurrencyStyle;
-                    } else if ([item isEqualToString:@"decimal"]) {
-                        style = kCFNumberFormatterDecimalStyle;
-                    }
-                }
-            }
-        }
-    }
-
-    CFNumberFormatterRef formatter = CFNumberFormatterCreate(kCFAllocatorDefault,
-            currentLocale,
-            style);
-
-    // we need to make this lenient so as to avoid problems with parsing currencies that have non-breaking space characters
-    if (style == kCFNumberFormatterCurrencyStyle) {
-        CFNumberFormatterSetProperty(formatter, kCFNumberFormatterIsLenient, kCFBooleanTrue);
-    }
-
-    // parse againist the largest type to avoid data loss
-    Boolean rc = CFNumberFormatterGetValueFromString(formatter,
-            (__bridge CFStringRef)numberString,
-            NULL,
-            kCFNumberDoubleType,
-            &doubleValue);
-
-    if (rc) {
-        NSDictionary* dictionary = [NSDictionary dictionaryWithObject:[NSNumber numberWithDouble:doubleValue] forKey:@"value"];
-        result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:dictionary];
-    }
-    // error
-    else {
-        // DLog(@"GlobalizationCommand stringToNumber unable to parse %@", numberString);
-        NSMutableDictionary* dictionary = [NSMutableDictionary dictionaryWithCapacity:2];
-        [dictionary setValue:[NSNumber numberWithInt:CDV_PARSING_ERROR] forKey:@"code"];
-        [dictionary setValue:@"Unable to parse" forKey:@"message"];
-        result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsDictionary:dictionary];
-    }
-
-    [self.commandDelegate sendPluginResult:result callbackId:callBackId];
-
-    CFRelease(formatter);
-}
-
-- (void)getNumberPattern:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options
-{
-    CDVPluginResult* result = nil;
-    NSString* callBackId = [arguments objectAtIndex:0];
-    CFNumberFormatterStyle style = kCFNumberFormatterDecimalStyle;
-    CFStringRef symbolType = NULL;
-    NSString* symbol = @"";
-
-    // see if any options have been specified
-    id items = [options valueForKey:@"options"];
-
-    if (items && [items isKindOfClass:[NSMutableDictionary class]]) {
-        NSEnumerator* enumerator = [items keyEnumerator];
-        id key;
-
-        // iterate through all the options
-        while ((key = [enumerator nextObject])) {
-            id item = [items valueForKey:key];
-
-            // make sure that only string values are present
-            if ([item isKindOfClass:[NSString class]]) {
-                // get the desired style of formatting
-                if ([key isEqualToString:@"type"]) {
-                    if ([item isEqualToString:@"percent"]) {
-                        style = kCFNumberFormatterPercentStyle;
-                    } else if ([item isEqualToString:@"currency"]) {
-                        style = kCFNumberFormatterCurrencyStyle;
-                    } else if ([item isEqualToString:@"decimal"]) {
-                        style = kCFNumberFormatterDecimalStyle;
-                    }
-                }
-            }
-        }
-    }
-
-    CFNumberFormatterRef formatter = CFNumberFormatterCreate(kCFAllocatorDefault,
-            currentLocale,
-            style);
-
-    NSString* numberPattern = (__bridge NSString*)CFNumberFormatterGetFormat(formatter);
-
-    if (style == kCFNumberFormatterCurrencyStyle) {
-        symbolType = kCFNumberFormatterCurrencySymbol;
-    } else if (style == kCFNumberFormatterPercentStyle) {
-        symbolType = kCFNumberFormatterPercentSymbol;
-    }
-
-    if (symbolType) {
-        symbol = (__bridge_transfer NSString*)CFNumberFormatterCopyProperty(formatter, symbolType);
-    }
-
-    NSString* decimal = (__bridge_transfer NSString*)CFNumberFormatterCopyProperty(formatter, kCFNumberFormatterDecimalSeparator);
-    NSString* grouping = (__bridge_transfer NSString*)CFNumberFormatterCopyProperty(formatter, kCFNumberFormatterGroupingSeparator);
-    NSString* posSign = (__bridge_transfer NSString*)CFNumberFormatterCopyProperty(formatter, kCFNumberFormatterPlusSign);
-    NSString* negSign = (__bridge_transfer NSString*)CFNumberFormatterCopyProperty(formatter, kCFNumberFormatterMinusSign);
-    NSNumber* fracDigits = (__bridge_transfer NSNumber*)CFNumberFormatterCopyProperty(formatter, kCFNumberFormatterMinFractionDigits);
-    NSNumber* roundingDigits = (__bridge_transfer NSNumber*)CFNumberFormatterCopyProperty(formatter, kCFNumberFormatterRoundingIncrement);
-
-    // put the pattern information into the dictionary
-    if (numberPattern != nil) {
-        NSArray* keys = [NSArray arrayWithObjects:@"pattern", @"symbol", @"fraction", @"rounding",
-            @"positive", @"negative", @"decimal", @"grouping", nil];
-        NSArray* values = [NSArray arrayWithObjects:numberPattern, symbol, fracDigits, roundingDigits,
-            posSign, negSign, decimal, grouping, nil];
-        NSDictionary* dictionary = [NSDictionary dictionaryWithObjects:values forKeys:keys];
-        result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:dictionary];
-    }
-    // error
-    else {
-        NSMutableDictionary* dictionary = [NSMutableDictionary dictionaryWithCapacity:2];
-        [dictionary setValue:[NSNumber numberWithInt:CDV_PATTERN_ERROR] forKey:@"code"];
-        [dictionary setValue:@"Pattern error" forKey:@"message"];
-        result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsDictionary:dictionary];
-    }
-
-    [self.commandDelegate sendPluginResult:result callbackId:callBackId];
-
-    CFRelease(formatter);
-}
-
-- (void)getCurrencyPattern:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options
-{
-    CDVPluginResult* result = nil;
-    NSString* callBackId = [arguments objectAtIndex:0];
-    NSString* currencyCode = nil;
-    NSString* numberPattern = nil;
-    NSString* decimal = nil;
-    NSString* grouping = nil;
-    int32_t defaultFractionDigits;
-    double roundingIncrement;
-    Boolean rc;
-
-    id value = [options valueForKey:@"currencyCode"];
-
-    if (value && [value isKindOfClass:[NSString class]]) {
-        currencyCode = (NSString*)value;
-    }
-
-    // first see if there is base currency info available and fill in the currency_info structure
-    rc = CFNumberFormatterGetDecimalInfoForCurrencyCode((__bridge CFStringRef)currencyCode, &defaultFractionDigits, &roundingIncrement);
-
-    // now set the currency code in the formatter
-    if (rc) {
-        CFNumberFormatterRef formatter = CFNumberFormatterCreate(kCFAllocatorDefault,
-                currentLocale,
-                kCFNumberFormatterCurrencyStyle);
-
-        CFNumberFormatterSetProperty(formatter, kCFNumberFormatterCurrencyCode, (__bridge CFStringRef)currencyCode);
-        CFNumberFormatterSetProperty(formatter, kCFNumberFormatterInternationalCurrencySymbol, (__bridge CFStringRef)currencyCode);
-
-        numberPattern = (__bridge NSString*)CFNumberFormatterGetFormat(formatter);
-        decimal = (__bridge_transfer NSString*)CFNumberFormatterCopyProperty(formatter, kCFNumberFormatterCurrencyDecimalSeparator);
-        grouping = (__bridge_transfer NSString*)CFNumberFormatterCopyProperty(formatter, kCFNumberFormatterCurrencyGroupingSeparator);
-
-        NSArray* keys = [NSArray arrayWithObjects:@"pattern", @"code", @"fraction", @"rounding",
-            @"decimal", @"grouping", nil];
-        NSArray* values = [NSArray arrayWithObjects:numberPattern, currencyCode, [NSNumber numberWithInt:defaultFractionDigits],
-            [NSNumber numberWithDouble:roundingIncrement], decimal, grouping, nil];
-        NSDictionary* dictionary = [NSDictionary dictionaryWithObjects:values forKeys:keys];
-        result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:dictionary];
-        CFRelease(formatter);
-    }
-    // error
-    else {
-        // DLog(@"GlobalizationCommand getCurrencyPattern unable to get pattern for %@", currencyCode);
-        NSMutableDictionary* dictionary = [NSMutableDictionary dictionaryWithCapacity:2];
-        [dictionary setValue:[NSNumber numberWithInt:CDV_PATTERN_ERROR] forKey:@"code"];
-        [dictionary setValue:@"Unable to get pattern" forKey:@"message"];
-        result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsDictionary:dictionary];
-    }
-
-    [self.commandDelegate sendPluginResult:result callbackId:callBackId];
-}
-
-- (void)dealloc
-{
-    if (currentLocale) {
-        CFRelease(currentLocale);
-        currentLocale = nil;
-    }
-}
-
-@end

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/eb64bf3c/CordovaLib/Classes/CDVInAppBrowser.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVInAppBrowser.h b/CordovaLib/Classes/CDVInAppBrowser.h
deleted file mode 100644
index 248274a..0000000
--- a/CordovaLib/Classes/CDVInAppBrowser.h
+++ /dev/null
@@ -1,89 +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"
-#import "CDVInvokedUrlCommand.h"
-#import "CDVScreenOrientationDelegate.h"
-#import "CDVWebViewDelegate.h"
-
-@class CDVInAppBrowserViewController;
-
-@interface CDVInAppBrowser : CDVPlugin {
-    BOOL _injectedIframeBridge;
-}
-
-@property (nonatomic, retain) CDVInAppBrowserViewController* inAppBrowserViewController;
-@property (nonatomic, copy) NSString* callbackId;
-
-- (void)open:(CDVInvokedUrlCommand*)command;
-- (void)close:(CDVInvokedUrlCommand*)command;
-- (void)injectScriptCode:(CDVInvokedUrlCommand*)command;
-- (void)show:(CDVInvokedUrlCommand*)command;
-
-@end
-
-@interface CDVInAppBrowserViewController : UIViewController <UIWebViewDelegate>{
-    @private
-    NSString* _userAgent;
-    NSString* _prevUserAgent;
-    NSInteger _userAgentLockToken;
-    CDVWebViewDelegate* _webViewDelegate;
-}
-
-@property (nonatomic, strong) IBOutlet UIWebView* webView;
-@property (nonatomic, strong) IBOutlet UIBarButtonItem* closeButton;
-@property (nonatomic, strong) IBOutlet UILabel* addressLabel;
-@property (nonatomic, strong) IBOutlet UIBarButtonItem* backButton;
-@property (nonatomic, strong) IBOutlet UIBarButtonItem* forwardButton;
-@property (nonatomic, strong) IBOutlet UIActivityIndicatorView* spinner;
-@property (nonatomic, strong) IBOutlet UIToolbar* toolbar;
-
-@property (nonatomic, weak) id <CDVScreenOrientationDelegate> orientationDelegate;
-@property (nonatomic, weak) CDVInAppBrowser* navigationDelegate;
-@property (nonatomic) NSURL* currentURL;
-
-- (void)close;
-- (void)navigateTo:(NSURL*)url;
-- (void)showLocationBar:(BOOL)show;
-- (void)showToolBar:(BOOL)show;
-- (void)setCloseButtonTitle:(NSString*)title;
-
-- (id)initWithUserAgent:(NSString*)userAgent prevUserAgent:(NSString*)prevUserAgent;
-
-@end
-
-@interface CDVInAppBrowserOptions : NSObject {}
-
-@property (nonatomic, assign) BOOL location;
-@property (nonatomic, assign) BOOL toolbar;
-@property (nonatomic, copy) NSString* closebuttoncaption;
-
-@property (nonatomic, copy) NSString* presentationstyle;
-@property (nonatomic, copy) NSString* transitionstyle;
-
-@property (nonatomic, assign) BOOL enableviewportscale;
-@property (nonatomic, assign) BOOL mediaplaybackrequiresuseraction;
-@property (nonatomic, assign) BOOL allowinlinemediaplayback;
-@property (nonatomic, assign) BOOL keyboarddisplayrequiresuseraction;
-@property (nonatomic, assign) BOOL suppressesincrementalrendering;
-@property (nonatomic, assign) BOOL hidden;
-
-+ (CDVInAppBrowserOptions*)parseOptions:(NSString*)options;
-
-@end


Mime
View raw message