You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ia...@apache.org on 2014/04/25 20:12:29 UTC
[6/6] git commit: CB-6521: Remove development branch
CB-6521: Remove development branch
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-contacts/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-contacts/commit/fc255252
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-contacts/tree/fc255252
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-contacts/diff/fc255252
Branch: refs/heads/dev
Commit: fc2552522b6465301b1787dfe0d4730f83bddd73
Parents: 55ba3f2
Author: Ian Clelland <ic...@chromium.org>
Authored: Fri Apr 25 14:09:46 2014 -0400
Committer: Ian Clelland <ic...@chromium.org>
Committed: Fri Apr 25 14:09:46 2014 -0400
----------------------------------------------------------------------
LICENSE | 202 ---
NOTICE | 5 -
README.md | 2 +
RELEASENOTES.md | 84 -
doc/index.md | 687 --------
plugin.xml | 215 ---
src/android/ContactAccessor.java | 196 ---
src/android/ContactAccessorSdk5.java | 2181 --------------------------
src/android/ContactManager.java | 122 --
src/blackberry10/ContactActivity.js | 31 -
src/blackberry10/ContactAddress.js | 35 -
src/blackberry10/ContactError.js | 35 -
src/blackberry10/ContactField.js | 32 -
src/blackberry10/ContactFindOptions.js | 55 -
src/blackberry10/ContactName.js | 44 -
src/blackberry10/ContactNews.js | 31 -
src/blackberry10/ContactOrganization.js | 27 -
src/blackberry10/ContactPhoto.js | 28 -
src/blackberry10/contactConsts.js | 225 ---
src/blackberry10/contactUtils.js | 228 ---
src/blackberry10/index.js | 374 -----
src/firefoxos/ContactsProxy.js | 464 ------
src/ios/CDVContact.h | 136 --
src/ios/CDVContact.m | 1752 ---------------------
src/ios/CDVContacts.h | 151 --
src/ios/CDVContacts.m | 604 -------
src/ubuntu/contacts.cpp | 576 -------
src/ubuntu/contacts.h | 70 -
src/windows8/ContactProxy.js | 151 --
src/wp/Contacts.cs | 693 --------
www/Contact.js | 177 ---
www/ContactAddress.js | 46 -
www/ContactError.js | 42 -
www/ContactField.js | 37 -
www/ContactFindOptions.js | 34 -
www/ContactName.js | 41 -
www/ContactOrganization.js | 44 -
www/contacts.js | 76 -
www/ios/Contact.js | 51 -
www/ios/contacts.js | 62 -
40 files changed, 2 insertions(+), 10044 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-contacts/blob/fc255252/LICENSE
----------------------------------------------------------------------
diff --git a/LICENSE b/LICENSE
deleted file mode 100644
index 7a4a3ea..0000000
--- a/LICENSE
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed 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.
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-plugin-contacts/blob/fc255252/NOTICE
----------------------------------------------------------------------
diff --git a/NOTICE b/NOTICE
deleted file mode 100644
index 8ec56a5..0000000
--- a/NOTICE
+++ /dev/null
@@ -1,5 +0,0 @@
-Apache Cordova
-Copyright 2012 The Apache Software Foundation
-
-This product includes software developed at
-The Apache Software Foundation (http://www.apache.org/).
http://git-wip-us.apache.org/repos/asf/cordova-plugin-contacts/blob/fc255252/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index 5b74138..07daee6 100644
--- a/README.md
+++ b/README.md
@@ -20,3 +20,5 @@
# org.apache.cordova.contacts
Plugin documentation: [doc/index.md](doc/index.md)
+
+This is `dev` - the deprecated development branch of this plugin; development of this plugin has moved to the `master` branch
http://git-wip-us.apache.org/repos/asf/cordova-plugin-contacts/blob/fc255252/RELEASENOTES.md
----------------------------------------------------------------------
diff --git a/RELEASENOTES.md b/RELEASENOTES.md
deleted file mode 100644
index 30f2c2f..0000000
--- a/RELEASENOTES.md
+++ /dev/null
@@ -1,84 +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.
-#
--->
-# Release Notes
-
-### 0.2.1 (Sept 5, 2013)
-* [CB-4580] Fixed up duplicate definitions of module id
-* [CB-4432] Copyright notice change
-
-### 0.2.3 (Sept 25, 2013)
-* CB-4889 bumping&resetting version
-* [BlackBerry10] removed uneeded permission tags in plugin.xml
-* [BlackBerry10] removed uneeded permission tags in plugin.xml
-* CB-4889 renaming blackberry10 reference in plugin.xml
-* CB-4888 renaming org.apache.cordova.core.contacts to org.apache.cordova.contacts
-* added contacts api for firefoxos
-* Rename CHANGELOG.md -> RELEASENOTES.md
-* [CB-4824] Fix XCode 5 contacts plugin warnings
-* [CB-4752] Incremented plugin version on dev branch.
-
-### 0.2.4 (Oct 9, 2013)
-* [CB-4950] Remove the dependence on concrete component android.webkit.WebView.
-* [CB-4915] Incremented plugin version on dev branch.
-
- ### 0.2.5 (Oct 28, 2013)
-* CB-5128: added repo + issue tags for contacts
-* [CB-5010] Incremented plugin version on dev branch.
-
-### 0.2.6 (Dec 4, 2013)
-* Fix bad commit/merge
-* CB-3035 Fix issue with windows new line char \n\r
-* wrong example given
-* docs added
-* FxOS name fields are arrays hackedSearch refactored search based on find commented out
-* search hacked via getAll
-* search added - no idea if this is working
-* createMozillaFromCordova and vice versa are used to translate contact objects from one API to another.
-* add/remove working
-* save is working
-* attempt to save is failing trying to limit the translated contact fields to name and familyName, but still failing
-* save is linked with the proxy contact.name doesn't exist www/Contact.js#Contact.prototype.save check on which side is the error
-* CB-5214 Make mobile spec tests on WP8 to run w/o user interaction + Sync with cordova-mobile-spec
-* CB-5525 WP8. Contacts Api fails in case of there is special character in contact field
-* fixed ubuntu policy error
-* [ubuntu] specify policy_group
-* add ubuntu platform
-* CB-3035 Fix issue with windows new line char \n\r
-* 1. Added amazon-fireos platform. 2. Change to use amazon-fireos as the platform if user agent string contains 'cordova-amazon-fireos'.
-* CB-5198 [BlackBerry10] Update dependencies to point to registry
-* handle null filter when fields are specified. ( long standing pull-req from @kevfromireland )
-
-### 0.2.7 (Jan 02, 2014)
-* B-5658 Add doc/index.md for Contacts plugin
-
-### 0.2.8 (Feb 05, 2014)
-* [CB-3208] FFOS docs updated
-* CB-4590 - chooseContact in CDVContacts crashes app
-
-### 0.2.9 (Feb 26, 2014)
-* CB-6086 Fix typo in ffos part of plugin.xml: Camera -> Contacts
-* CB-5994 Switch Contact ID lookup to use Raw contact id.
-
-### 0.2.10 (Apr 17, 2014)
-* CB-6126: [BlackBerry10] Update docs quirks section for fields which are supported
-* CB-6212: [iOS] fix warnings compiled under arm64 64-bit
-* CB-6460: Update license headers
-* Add NOTICE file
http://git-wip-us.apache.org/repos/asf/cordova-plugin-contacts/blob/fc255252/doc/index.md
----------------------------------------------------------------------
diff --git a/doc/index.md b/doc/index.md
deleted file mode 100644
index 83f5a30..0000000
--- a/doc/index.md
+++ /dev/null
@@ -1,687 +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.
--->
-
-# org.apache.cordova.contacts
-
-Provides access to the device contacts database.
-
-__WARNING__: Collection and use of contact data raises
-important privacy issues. Your app's privacy policy should discuss
-how the app uses contact data and whether it is shared with any other
-parties. Contact information is considered sensitive because it
-reveals the people with whom a person communicates. Therefore, in
-addition to the app's privacy policy, you should strongly consider
-providing a just-in-time notice before the app accesses or uses
-contact data, if the device operating system doesn't do so
-already. That notice should provide the same information noted above,
-as well as obtaining the user's permission (e.g., by presenting
-choices for __OK__ and __No Thanks__). Note that some app
-marketplaces may require the app to provide a just-in-time notice and
-obtain the user's permission before accessing contact data. A
-clear and easy-to-understand user experience surrounding the use of
-contact data helps avoid user confusion and perceived misuse of
-contact data. For more information, please see the Privacy Guide.
-
-## Installation
-
- cordova plugin add org.apache.cordova.contacts
-
-### Firefox OS Quirks
-
-Create __www/manifest.webapp__ as described in
-[Manifest Docs](https://developer.mozilla.org/en-US/Apps/Developing/Manifest).
-Add relevant permisions.
-There is also a need to change the webapp type to "privileged" - [Manifest Docs](https://developer.mozilla.org/en-US/Apps/Developing/Manifest#type).
-__WARNING__: All privileged apps enforce [Content Security Policy](https://developer.mozilla.org/en-US/Apps/CSP) which forbids inline script. Initialize your application in another way.
-
- "type": "privileged",
- "permissions": {
- "contacts": {
- "access": "readwrite",
- "description": "Describe why there is a need for such permission"
- }
- }
-
-## navigator.contacts
-
-### Methods
-
-- navigator.contacts.create
-- navigator.contacts.find
-
-### Objects
-
-- Contact
-- ContactName
-- ContactField
-- ContactAddress
-- ContactOrganization
-- ContactFindOptions
-- ContactError
-
-## navigator.contacts.create
-
-The `navigator.contacts.create` method is synchronous, and returns a new `Contact` object.
-
-This method does not retain the Contact object in the device contacts
-database, for which you need to invoke the `Contact.save` method.
-
-### Supported Platforms
-
-- Android
-- BlackBerry 10
-- Firefox OS
-- iOS
-- Windows Phone 7 and 8
-- Windows 8 ( Note: Windows 8 Contacts are readonly via the Cordova API
-Contacts are not queryable/searchable, you should inform the user to pick a contact as a call to contacts.find will open the 'People' app where the user must choose a contact.
-Any contacts returned are readonly, so your application cannot modify them. )
-
-### Example
-
- var myContact = navigator.contacts.create({"displayName": "Test User"});
-
-## navigator.contacts.find
-
-The `navigator.contacts.find` method executes asynchronously, querying the
-device contacts database and returning an array of `Contact` objects.
-The resulting objects are passed to the `contactSuccess` callback
-function specified by the __contactSuccess__ parameter.
-
-The __contactFields__ parameter specifies the fields to be used as a
-search qualifier, and only those results are passed to the
-__contactSuccess__ callback function. A zero-length __contactFields__
-parameter is invalid and results in
-`ContactError.INVALID_ARGUMENT_ERROR`. A __contactFields__ value of
-`"*"` returns all contact fields.
-
-The __contactFindOptions.filter__ string can be used as a search
-filter when querying the contacts database. If provided, a
-case-insensitive, partial value match is applied to each field
-specified in the __contactFields__ parameter. If there's a match for
-_any_ of the specified fields, the contact is returned.
-
-### Parameters
-
-- __contactFields__: Contact fields to use as a search qualifier. The resulting `Contact` object only features values for these fields. _(DOMString[])_ [Required]
-
-- __contactSuccess__: Success callback function invoked with the array of Contact objects returned from the database. [Required]
-
-- __contactError__: Error callback function, invoked when an error occurs. [Optional]
-
-- __contactFindOptions__: Search options to filter navigator.contacts. [Optional] Keys include:
-
-- __filter__: The search string used to find navigator.contacts. _(DOMString)_ (Default: `""`)
-
-- __multiple__: Determines if the find operation returns multiple navigator.contacts. _(Boolean)_ (Default: `false`)
-
-### Supported Platforms
-
-- Android
-- BlackBerry 10
-- Firefox OS
-- iOS
-- Windows Phone 7 and 8
-- Windows 8 ( read-only support, search requires user interaction, contactFields are ignored, only contactFindOptions.multiple is used to enable the user to select 1 or many contacts. )
-
-### Example
-
- function onSuccess(contacts) {
- alert('Found ' + contacts.length + ' contacts.');
- };
-
- function onError(contactError) {
- alert('onError!');
- };
-
- // find all contacts with 'Bob' in any name field
- var options = new ContactFindOptions();
- options.filter = "Bob";
- options.multiple = true;
- var fields = ["displayName", "name"];
- navigator.contacts.find(fields, onSuccess, onError, options);
-
-
-## Contact
-
-The `Contact` object represents a user's contact. Contacts can be
-created, stored, or removed from the device contacts database.
-Contacts can also be retrieved (individually or in bulk) from the
-database by invoking the `navigator.contacts.find` method.
-
-__NOTE__: Not all of the contact fields listed above are supported on
-every device platform. Please check each platform's _Quirks_ section
-for details.
-
-
-### Properties
-
-- __id__: A globally unique identifier. _(DOMString)_
-
-- __displayName__: The name of this Contact, suitable for display to end users. _(DOMString)_
-
-- __name__: An object containing all components of a persons name. _(ContactName)_
-
-- __nickname__: A casual name by which to address the contact. _(DOMString)_
-
-- __phoneNumbers__: An array of all the contact's phone numbers. _(ContactField[])_
-
-- __emails__: An array of all the contact's email addresses. _(ContactField[])_
-
-- __addresses__: An array of all the contact's addresses. _(ContactAddress[])_
-
-- __ims__: An array of all the contact's IM addresses. _(ContactField[])_
-
-- __organizations__: An array of all the contact's organizations. _(ContactOrganization[])_
-
-- __birthday__: The birthday of the contact. _(Date)_
-
-- __note__: A note about the contact. _(DOMString)_
-
-- __photos__: An array of the contact's photos. _(ContactField[])_
-
-- __categories__: An array of all the user-defined categories associated with the contact. _(ContactField[])_
-
-- __urls__: An array of web pages associated with the contact. _(ContactField[])_
-
-### Methods
-
-- __clone__: Returns a new `Contact` object that is a deep copy of the calling object, with the `id` property set to `null`.
-
-- __remove__: Removes the contact from the device contacts database, otherwise executes an error callback with a `ContactError` object.
-
-- __save__: Saves a new contact to the device contacts database, or updates an existing contact if a contact with the same __id__ already exists.
-
-### Supported Platforms
-
-- Amazon Fire OS
-- Android
-- BlackBerry 10
-- Firefox OS
-- iOS
-- Windows Phone 7 and 8
-
-### Save Example
-
- function onSuccess(contact) {
- alert("Save Success");
- };
-
- function onError(contactError) {
- alert("Error = " + contactError.code);
- };
-
- // create a new contact object
- var contact = navigator.contacts.create();
- contact.displayName = "Plumber";
- contact.nickname = "Plumber"; // specify both to support all devices
-
- // populate some fields
- var name = new ContactName();
- name.givenName = "Jane";
- name.familyName = "Doe";
- contact.name = name;
-
- // save to device
- contact.save(onSuccess,onError);
-
-### Clone Example
-
- // clone the contact object
- var clone = contact.clone();
- clone.name.givenName = "John";
- console.log("Original contact name = " + contact.name.givenName);
- console.log("Cloned contact name = " + clone.name.givenName);
-
-### Remove Example
-
- function onSuccess() {
- alert("Removal Success");
- };
-
- function onError(contactError) {
- alert("Error = " + contactError.code);
- };
-
- // remove the contact from the device
- contact.remove(onSuccess,onError);
-
-
-### Android 2.X Quirks
-
-- __categories__: Not supported on Android 2.X devices, returning `null`.
-
-### BlackBerry 10 Quirks
-
-- __id__: Assigned by the device when saving the contact.
-
-### FirefoxOS Quirks
-
-- __categories__: Partially supported. Fields __pref__ and __type__ are returning `null`
-
-- __ims__: Not supported
-
-- __photos__: Not supported
-
-
-### iOS Quirks
-
-- __displayName__: Not supported on iOS, returning `null` unless there is no `ContactName` specified, in which case it returns the composite name, __nickname__ or `""`, respectively.
-
-- __birthday__: Must be input as a JavaScript `Date` object, the same way it is returned.
-
-- __photos__: Returns a File URL to the image, which is stored in the application's temporary directory. Contents of the temporary directory are removed when the application exits.
-
-- __categories__: This property is currently not supported, returning `null`.
-
-### Windows Phone 7 and 8 Quirks
-
-- __displayName__: When creating a contact, the value provided for the display name parameter differs from the display name retrieved when finding the contact.
-
-- __urls__: When creating a contact, users can input and save more than one web address, but only one is available when searching the contact.
-
-- __phoneNumbers__: The _pref_ option is not supported. The _type_ is not supported in a _find_ operation. Only one `phoneNumber` is allowed for each _type_.
-
-- __emails__: The _pref_ option is not supported. Home and personal references same email entry. Only one entry is allowed for each _type_.
-
-- __addresses__: Supports only work, and home/personal _type_. The home and personal _type_ reference the same address entry. Only one entry is allowed for each _type_.
-
-- __organizations__: Only one is allowed, and does not support the _pref_, _type_, and _department_ attributes.
-
-- __note__: Not supported, returning `null`.
-
-- __ims__: Not supported, returning `null`.
-
-- __birthdays__: Not supported, returning `null`.
-
-- __categories__: Not supported, returning `null`.
-
-
-## ContactAddress
-
-The `ContactAddress` object stores the properties of a single address
-of a contact. A `Contact` object may include more than one address in
-a `ContactAddress[]` array.
-
-
-### Properties
-
-- __pref__: Set to `true` if this `ContactAddress` contains the user's preferred value. _(boolean)_
-
-- __type__: A string indicating what type of field this is, _home_ for example. _(DOMString)_
-
-- __formatted__: The full address formatted for display. _(DOMString)_
-
-- __streetAddress__: The full street address. _(DOMString)_
-
-- __locality__: The city or locality. _(DOMString)_
-
-- __region__: The state or region. _(DOMString)_
-
-- __postalCode__: The zip code or postal code. _(DOMString)_
-
-- __country__: The country name. _(DOMString)_
-
-### Supported Platforms
-
-- Amazon Fire OS
-- Android
-- BlackBerry 10
-- Firefox OS
-- iOS
-- Windows Phone 7 and 8
-- Windows 8
-
-### Example
-
- // display the address information for all contacts
-
- function onSuccess(contacts) {
- for (var i = 0; i < contacts.length; i++) {
- for (var j = 0; j < contacts[i].addresses.length; j++) {
- alert("Pref: " + contacts[i].addresses[j].pref + "\n" +
- "Type: " + contacts[i].addresses[j].type + "\n" +
- "Formatted: " + contacts[i].addresses[j].formatted + "\n" +
- "Street Address: " + contacts[i].addresses[j].streetAddress + "\n" +
- "Locality: " + contacts[i].addresses[j].locality + "\n" +
- "Region: " + contacts[i].addresses[j].region + "\n" +
- "Postal Code: " + contacts[i].addresses[j].postalCode + "\n" +
- "Country: " + contacts[i].addresses[j].country);
- }
- }
- };
-
- function onError(contactError) {
- alert('onError!');
- };
-
- // find all contacts
- var options = new ContactFindOptions();
- options.filter = "";
- var filter = ["displayName", "addresses"];
- navigator.contacts.find(filter, onSuccess, onError, options);
-
-### Android 2.X Quirks
-
-- __pref__: Not supported, returning `false` on Android 2.X devices.
-
-### BlackBerry 10 Quirks
-
-- __pref__: Not supported on BlackBerry devices, returning `false`.
-
-- __type__: Partially supported. Only one each of _Work_ and _Home_ type addresses can be stored per contact.
-
-- __formatted__: Partially supported. Returns a concatenation of all BlackBerry address fields.
-
-- __streetAddress__: Supported. Returns a concatenation of BlackBerry __address1__ and __address2__ address fields.
-
-- __locality__: Supported. Stored in BlackBerry __city__ address field.
-
-- __region__: Supported. Stored in BlackBerry __stateProvince__ address field.
-
-- __postalCode__: Supported. Stored in BlackBerry __zipPostal__ address field.
-
-- __country__: Supported.
-
-### FirefoxOS Quirks
-
-- __formatted__: Currently not supported
-
-### iOS Quirks
-
-- __pref__: Not supported on iOS devices, returning `false`.
-
-- __formatted__: Currently not supported.
-
-### Windows 8 Quirks
-
-- __pref__: Not supported
-
-
-## ContactError
-
-The `ContactError` object is returned to the user through the
-`contactError` callback function when an error occurs.
-
-### Properties
-
-- __code__: One of the predefined error codes listed below.
-
-### Constants
-
-- `ContactError.UNKNOWN_ERROR`
-- `ContactError.INVALID_ARGUMENT_ERROR`
-- `ContactError.TIMEOUT_ERROR`
-- `ContactError.PENDING_OPERATION_ERROR`
-- `ContactError.IO_ERROR`
-- `ContactError.NOT_SUPPORTED_ERROR`
-- `ContactError.PERMISSION_DENIED_ERROR`
-
-
-## ContactField
-
-The `ContactField` object is a reusable component that represents
-contact fields generically. Each `ContactField` object contains a
-`value`, `type`, and `pref` property. A `Contact` object stores
-several properties in `ContactField[]` arrays, such as phone numbers
-and email addresses.
-
-In most instances, there are no pre-determined values for a
-`ContactField` object's __type__ attribute. For example, a phone
-number can specify __type__ values of _home_, _work_, _mobile_,
-_iPhone_, or any other value that is supported by a particular device
-platform's contact database. However, for the `Contact` __photos__
-field, the __type__ field indicates the format of the returned image:
-__url__ when the __value__ attribute contains a URL to the photo
-image, or _base64_ when the __value__ contains a base64-encoded image
-string.
-
-### Properties
-
-- __type__: A string that indicates what type of field this is, _home_ for example. _(DOMString)_
-
-- __value__: The value of the field, such as a phone number or email address. _(DOMString)_
-
-- __pref__: Set to `true` if this `ContactField` contains the user's preferred value. _(boolean)_
-
-### Supported Platforms
-
-- Amazon Fire OS
-- Android
-- BlackBerry 10
-- Firefox OS
-- iOS
-- Windows Phone 7 and 8
-- Windows 8
-
-### Example
-
- // create a new contact
- var contact = navigator.contacts.create();
-
- // store contact phone numbers in ContactField[]
- var phoneNumbers = [];
- phoneNumbers[0] = new ContactField('work', '212-555-1234', false);
- phoneNumbers[1] = new ContactField('mobile', '917-555-5432', true); // preferred number
- phoneNumbers[2] = new ContactField('home', '203-555-7890', false);
- contact.phoneNumbers = phoneNumbers;
-
- // save the contact
- contact.save();
-
-### Android Quirks
-
-- __pref__: Not supported, returning `false`.
-
-### BlackBerry 10 Quirks
-
-- __type__: Partially supported. Used for phone numbers.
-
-- __value__: Supported.
-
-- __pref__: Not supported, returning `false`.
-
-### iOS Quirks
-
-- __pref__: Not supported, returning `false`.
-
-### Windows8 Quirks
-
-- __pref__: Not supported, returning `false`.
-
-
-## ContactName
-
-Contains different kinds of information about a `Contact` object's name.
-
-### Properties
-
-- __formatted__: The complete name of the contact. _(DOMString)_
-
-- __familyName__: The contact's family name. _(DOMString)_
-
-- __givenName__: The contact's given name. _(DOMString)_
-
-- __middleName__: The contact's middle name. _(DOMString)_
-
-- __honorificPrefix__: The contact's prefix (example _Mr._ or _Dr._) _(DOMString)_
-
-- __honorificSuffix__: The contact's suffix (example _Esq._). _(DOMString)_
-
-### Supported Platforms
-
-- Amazon Fire OS
-- Android 2.X
-- BlackBerry 10
-- Firefox OS
-- iOS
-- Windows Phone 7 and 8
-- Windows 8
-
-### Example
-
- function onSuccess(contacts) {
- for (var i = 0; i < contacts.length; i++) {
- alert("Formatted: " + contacts[i].name.formatted + "\n" +
- "Family Name: " + contacts[i].name.familyName + "\n" +
- "Given Name: " + contacts[i].name.givenName + "\n" +
- "Middle Name: " + contacts[i].name.middleName + "\n" +
- "Suffix: " + contacts[i].name.honorificSuffix + "\n" +
- "Prefix: " + contacts[i].name.honorificSuffix);
- }
- };
-
- function onError(contactError) {
- alert('onError!');
- };
-
- var options = new ContactFindOptions();
- options.filter = "";
- filter = ["displayName", "name"];
- navigator.contacts.find(filter, onSuccess, onError, options);
-
-### Android Quirks
-
-- __formatted__: Partially supported, and read-only. Returns a concatenation of `honorificPrefix`, `givenName`, `middleName`, `familyName`, and `honorificSuffix`.
-
-### BlackBerry 10 Quirks
-
-- __formatted__: Partially supported. Returns a concatenation of BlackBerry __firstName__ and __lastName__ fields.
-
-- __familyName__: Supported. Stored in BlackBerry __lastName__ field.
-
-- __givenName__: Supported. Stored in BlackBerry __firstName__ field.
-
-- __middleName__: Not supported, returning `null`.
-
-- __honorificPrefix__: Not supported, returning `null`.
-
-- __honorificSuffix__: Not supported, returning `null`.
-
-### FirefoxOS Quirks
-
-- __formatted__: Partially supported, and read-only. Returns a concatenation of `honorificPrefix`, `givenName`, `middleName`, `familyName`, and `honorificSuffix`.
-
-
-### iOS Quirks
-
-- __formatted__: Partially supported. Returns iOS Composite Name, but is read-only.
-
-### Windows 8 Quirks
-
-- __formatted__: This is the only name property, and is identical to `displayName`, and `nickname`
-
-- __familyName__: not supported
-
-- __givenName__: not supported
-
-- __middleName__: not supported
-
-- __honorificPrefix__: not supported
-
-- __honorificSuffix__: not supported
-
-
-## ContactOrganization
-
-The `ContactOrganization` object stores a contact's organization
-properties. A `Contact` object stores one or more
-`ContactOrganization` objects in an array.
-
-### Properties
-
-- __pref__: Set to `true` if this `ContactOrganization` contains the user's preferred value. _(boolean)_
-
-- __type__: A string that indicates what type of field this is, _home_ for example. _(DOMString)
-
-- __name__: The name of the organization. _(DOMString)_
-
-- __department__: The department the contract works for. _(DOMString)_
-
-- __title__: The contact's title at the organization. _(DOMString)_
-
-
-### Supported Platforms
-
-- Android
-- BlackBerry 10
-- Firefox OS
-- iOS
-- Windows Phone 7 and 8
-
-### Example
-
- function onSuccess(contacts) {
- for (var i = 0; i < contacts.length; i++) {
- for (var j = 0; j < contacts[i].organizations.length; j++) {
- alert("Pref: " + contacts[i].organizations[j].pref + "\n" +
- "Type: " + contacts[i].organizations[j].type + "\n" +
- "Name: " + contacts[i].organizations[j].name + "\n" +
- "Department: " + contacts[i].organizations[j].department + "\n" +
- "Title: " + contacts[i].organizations[j].title);
- }
- }
- };
-
- function onError(contactError) {
- alert('onError!');
- };
-
- var options = new ContactFindOptions();
- options.filter = "";
- filter = ["displayName", "organizations"];
- navigator.contacts.find(filter, onSuccess, onError, options);
-
-### Android 2.X Quirks
-
-- __pref__: Not supported by Android 2.X devices, returning `false`.
-
-### BlackBerry 10 Quirks
-
-- __pref__: Not supported by BlackBerry devices, returning `false`.
-
-- __type__: Not supported by BlackBerry devices, returning `null`.
-
-- __name__: Partially supported. The first organization name is stored in the BlackBerry __company__ field.
-
-- __department__: Not supported, returning `null`.
-
-- __title__: Partially supported. The first organization title is stored in the BlackBerry __jobTitle__ field.
-
-### Firefox OS Quirks
-
-- __pref__: Not supported
-
-- __type__: Not supported
-
-- __department__: Not supported
-
-- Fields __name__ and __title__ stored in __org__ and __jobTitle__.
-
-### iOS Quirks
-
-- __pref__: Not supported on iOS devices, returning `false`.
-
-- __type__: Not supported on iOS devices, returning `null`.
-
-- __name__: Partially supported. The first organization name is stored in the iOS __kABPersonOrganizationProperty__ field.
-
-- __department__: Partially supported. The first department name is stored in the iOS __kABPersonDepartmentProperty__ field.
-
-- __title__: Partially supported. The first title is stored in the iOS __kABPersonJobTitleProperty__ field.
http://git-wip-us.apache.org/repos/asf/cordova-plugin-contacts/blob/fc255252/plugin.xml
----------------------------------------------------------------------
diff --git a/plugin.xml b/plugin.xml
deleted file mode 100644
index 676ffd5..0000000
--- a/plugin.xml
+++ /dev/null
@@ -1,215 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-
-<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
- xmlns:rim="http://www.blackberry.com/ns/widgets"
- xmlns:android="http://schemas.android.com/apk/res/android"
- id="org.apache.cordova.contacts"
- version="0.2.11-dev">
-
- <name>Contacts</name>
- <description>Cordova Contacts Plugin</description>
- <license>Apache 2.0</license>
- <keywords>cordova,contacts</keywords>
- <repo>https://git-wip-us.apache.org/repos/asf/cordova-plugin-contacts.git</repo>
- <issue>https://issues.apache.org/jira/browse/CB/component/12320652</issue>
-
- <js-module src="www/contacts.js" name="contacts">
- <clobbers target="navigator.contacts" />
- </js-module>
-
- <js-module src="www/Contact.js" name="Contact">
- <clobbers target="Contact" />
- </js-module>
-
- <js-module src="www/ContactAddress.js" name="ContactAddress">
- <clobbers target="ContactAddress" />
- </js-module>
-
- <js-module src="www/ContactError.js" name="ContactError">
- <clobbers target="ContactError" />
- </js-module>
-
- <js-module src="www/ContactField.js" name="ContactField">
- <clobbers target="ContactField" />
- </js-module>
-
- <js-module src="www/ContactFindOptions.js" name="ContactFindOptions">
- <clobbers target="ContactFindOptions" />
- </js-module>
-
- <js-module src="www/ContactName.js" name="ContactName">
- <clobbers target="ContactName" />
- </js-module>
-
- <js-module src="www/ContactOrganization.js" name="ContactOrganization">
- <clobbers target="ContactOrganization" />
- </js-module>
-
-
-
-
- <!-- android -->
- <platform name="android">
- <config-file target="res/xml/config.xml" parent="/*">
- <feature name="Contacts">
- <param name="android-package" value="org.apache.cordova.contacts.ContactManager"/>
- </feature>
- </config-file>
-
- <config-file target="AndroidManifest.xml" parent="/*">
- <uses-permission android:name="android.permission.READ_CONTACTS" />
- <uses-permission android:name="android.permission.WRITE_CONTACTS" />
- <uses-permission android:name="android.permission.GET_ACCOUNTS" />
- </config-file>
-
- <source-file src="src/android/ContactAccessor.java" target-dir="src/org/apache/cordova/contacts" />
- <source-file src="src/android/ContactAccessorSdk5.java" target-dir="src/org/apache/cordova/contacts" />
- <source-file src="src/android/ContactManager.java" target-dir="src/org/apache/cordova/contacts" />
- </platform>
-
- <!-- amazon-fireos -->
- <platform name="amazon-fireos">
- <config-file target="res/xml/config.xml" parent="/*">
- <feature name="Contacts">
- <param name="android-package" value="org.apache.cordova.contacts.ContactManager"/>
- </feature>
- </config-file>
-
- <config-file target="AndroidManifest.xml" parent="/*">
- <uses-permission android:name="android.permission.READ_CONTACTS" />
- <uses-permission android:name="android.permission.WRITE_CONTACTS" />
- <uses-permission android:name="android.permission.GET_ACCOUNTS" />
- </config-file>
-
- <source-file src="src/android/ContactAccessor.java" target-dir="src/org/apache/cordova/contacts" />
- <source-file src="src/android/ContactAccessorSdk5.java" target-dir="src/org/apache/cordova/contacts" />
- <source-file src="src/android/ContactManager.java" target-dir="src/org/apache/cordova/contacts" />
- </platform>
-
- <!-- ubuntu -->
- <platform name="ubuntu">
- <config-file target="config.xml" parent="/*">
- <feature name="Contacts">
- <param policy_group="contacts" policy_version="1" />
- </feature>
- </config-file>
- <header-file src="src/ubuntu/contacts.h" />
- <source-file src="src/ubuntu/contacts.cpp" />
- </platform>
-
- <!-- ios -->
- <platform name="ios">
- <config-file target="config.xml" parent="/*">
- <feature name="Contacts">
- <param name="ios-package" value="CDVContacts"/>
- </feature>
- </config-file>
-
- <js-module src="www/ios/contacts.js" name="contacts-ios">
- <merges target="navigator.contacts" />
- </js-module>
-
- <js-module src="www/ios/Contact.js" name="Contact-iOS">
- <merges target="Contact" />
- </js-module>
-
- <header-file src="src/ios/CDVContacts.h" />
- <source-file src="src/ios/CDVContacts.m" />
- <header-file src="src/ios/CDVContact.h" />
- <source-file src="src/ios/CDVContact.m" />
-
- <framework src="AddressBook.framework" weak="true" />
- <framework src="AddressBookUI.framework" weak="true" />
- <framework src="CoreGraphics.framework" />
- </platform>
-
- <!-- blackberry10 -->
- <platform name="blackberry10">
- <config-file target="www/config.xml" parent="/widget">
- <feature name="Contacts" value="Contacts"/>
- </config-file>
- <config-file target="www/config.xml" parent="/widget/rim:permissions">
- <rim:permit>access_pimdomain_contacts</rim:permit>
- </config-file>
- <source-file src="src/blackberry10/index.js" target-dir="Contacts"></source-file>
- <source-file src="src/blackberry10/ContactActivity.js" target-dir="Contacts"></source-file>
- <source-file src="src/blackberry10/ContactAddress.js" target-dir="Contacts"></source-file>
- <source-file src="src/blackberry10/contactConsts.js" target-dir="Contacts"></source-file>
- <source-file src="src/blackberry10/ContactError.js" target-dir="Contacts"></source-file>
- <source-file src="src/blackberry10/ContactField.js" target-dir="Contacts"></source-file>
- <source-file src="src/blackberry10/ContactFindOptions.js" target-dir="Contacts"></source-file>
- <source-file src="src/blackberry10/ContactName.js" target-dir="Contacts"></source-file>
- <source-file src="src/blackberry10/ContactNews.js" target-dir="Contacts"></source-file>
- <source-file src="src/blackberry10/ContactOrganization.js" target-dir="Contacts"></source-file>
- <source-file src="src/blackberry10/ContactPhoto.js" target-dir="Contacts"></source-file>
- <source-file src="src/blackberry10/contactUtils.js" target-dir="Contacts"></source-file>
- <dependency id="com.blackberry.utils" />
- <dependency id="com.blackberry.pim.lib" />
- </platform>
-
- <!-- wp7 -->
- <platform name="wp7">
- <config-file target="config.xml" parent="/*">
- <feature name="Contacts">
- <param name="wp-package" value="Contacts"/>
- </feature>
- </config-file>
-
- <config-file target="Properties/WMAppManifest.xml" parent="/Deployment/App/Capabilities">
- <Capability Name="ID_CAP_CONTACTS" />
- </config-file>
-
- <source-file src="src/wp/Contacts.cs" />
- </platform>
-
- <!-- wp8 -->
- <platform name="wp8">
- <config-file target="config.xml" parent="/*">
- <feature name="Contacts">
- <param name="wp-package" value="Contacts"/>
- </feature>
- </config-file>
-
- <config-file target="Properties/WMAppManifest.xml" parent="/Deployment/App/Capabilities">
- <Capability Name="ID_CAP_CONTACTS" />
- </config-file>
-
- <source-file src="src/wp/Contacts.cs" />
- </platform>
-
- <!-- firefoxos -->
- <platform name="firefoxos">
- <config-file target="config.xml" parent="/*">
- <feature name="Contacts">
- <param name="firefoxos-package" value="Contacts" />
- </feature>
- </config-file>
- <js-module src="src/firefoxos/ContactsProxy.js" name="ContactsProxy">
- <runs />
- </js-module>
- </platform>
-
- <!-- wp8 -->
- <js-module src="src/windows8/ContactProxy.js" name="ContactProxy">
- <merges target="" />
- </js-module>
-
-</plugin>
http://git-wip-us.apache.org/repos/asf/cordova-plugin-contacts/blob/fc255252/src/android/ContactAccessor.java
----------------------------------------------------------------------
diff --git a/src/android/ContactAccessor.java b/src/android/ContactAccessor.java
deleted file mode 100644
index bac243e..0000000
--- a/src/android/ContactAccessor.java
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed 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.
- */
-
-package org.apache.cordova.contacts;
-
-import java.util.HashMap;
-
-import android.util.Log;
-
-import org.apache.cordova.CordovaInterface;
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-
-/**
- * This abstract class defines SDK-independent API for communication with
- * Contacts Provider. The actual implementation used by the application depends
- * on the level of API available on the device. If the API level is Cupcake or
- * Donut, we want to use the {@link ContactAccessorSdk3_4} class. If it is
- * Eclair or higher, we want to use {@link ContactAccessorSdk5}.
- */
-public abstract class ContactAccessor {
-
- protected final String LOG_TAG = "ContactsAccessor";
- protected CordovaInterface mApp;
-
- /**
- * Check to see if the data associated with the key is required to
- * be populated in the Contact object.
- * @param key
- * @param map created by running buildPopulationSet.
- * @return true if the key data is required
- */
- protected boolean isRequired(String key, HashMap<String,Boolean> map) {
- Boolean retVal = map.get(key);
- return (retVal == null) ? false : retVal.booleanValue();
- }
-
- /**
- * Create a hash map of what data needs to be populated in the Contact object
- * @param fields the list of fields to populate
- * @return the hash map of required data
- */
- protected HashMap<String,Boolean> buildPopulationSet(JSONArray fields) {
- HashMap<String,Boolean> map = new HashMap<String,Boolean>();
-
- String key;
- try {
- if (fields.length() == 1 && fields.getString(0).equals("*")) {
- map.put("displayName", true);
- map.put("name", true);
- map.put("nickname", true);
- map.put("phoneNumbers", true);
- map.put("emails", true);
- map.put("addresses", true);
- map.put("ims", true);
- map.put("organizations", true);
- map.put("birthday", true);
- map.put("note", true);
- map.put("urls", true);
- map.put("photos", true);
- map.put("categories", true);
- }
- else {
- for (int i=0; i<fields.length(); i++) {
- key = fields.getString(i);
- if (key.startsWith("displayName")) {
- map.put("displayName", true);
- }
- else if (key.startsWith("name")) {
- map.put("displayName", true);
- map.put("name", true);
- }
- else if (key.startsWith("nickname")) {
- map.put("nickname", true);
- }
- else if (key.startsWith("phoneNumbers")) {
- map.put("phoneNumbers", true);
- }
- else if (key.startsWith("emails")) {
- map.put("emails", true);
- }
- else if (key.startsWith("addresses")) {
- map.put("addresses", true);
- }
- else if (key.startsWith("ims")) {
- map.put("ims", true);
- }
- else if (key.startsWith("organizations")) {
- map.put("organizations", true);
- }
- else if (key.startsWith("birthday")) {
- map.put("birthday", true);
- }
- else if (key.startsWith("note")) {
- map.put("note", true);
- }
- else if (key.startsWith("urls")) {
- map.put("urls", true);
- }
- else if (key.startsWith("photos")) {
- map.put("photos", true);
- }
- else if (key.startsWith("categories")) {
- map.put("categories", true);
- }
- }
- }
- }
- catch (JSONException e) {
- Log.e(LOG_TAG, e.getMessage(), e);
- }
- return map;
- }
-
- /**
- * Convenience method to get a string from a JSON object. Saves a
- * lot of try/catch writing.
- * If the property is not found in the object null will be returned.
- *
- * @param obj contact object to search
- * @param property to be looked up
- * @return The value of the property
- */
- protected String getJsonString(JSONObject obj, String property) {
- String value = null;
- try {
- if (obj != null) {
- value = obj.getString(property);
- if (value.equals("null")) {
- Log.d(LOG_TAG, property + " is string called 'null'");
- value = null;
- }
- }
- }
- catch (JSONException e) {
- Log.d(LOG_TAG, "Could not get = " + e.getMessage());
- }
- return value;
- }
-
- /**
- * Handles adding a JSON Contact object into the database.
- * @return TODO
- */
- public abstract String save(JSONObject contact);
-
- /**
- * Handles searching through SDK-specific contacts API.
- */
- public abstract JSONArray search(JSONArray filter, JSONObject options);
-
- /**
- * Handles searching through SDK-specific contacts API.
- * @throws JSONException
- */
- public abstract JSONObject getContactById(String id) throws JSONException;
-
- /**
- * Handles removing a contact from the database.
- */
- public abstract boolean remove(String id);
-
- /**
- * A class that represents the where clause to be used in the database query
- */
- class WhereOptions {
- private String where;
- private String[] whereArgs;
- public void setWhere(String where) {
- this.where = where;
- }
- public String getWhere() {
- return where;
- }
- public void setWhereArgs(String[] whereArgs) {
- this.whereArgs = whereArgs;
- }
- public String[] getWhereArgs() {
- return whereArgs;
- }
- }
-}