Updated Branches:
  refs/heads/master b39229a00 -> ddf3adf1f

Merge iOS only contact apis

*Contact.display to display contact in iOS UI
*contacts.chooseContact to select contact via UI and return id
*contacts.newContactUI to create contact via iOS UI


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/commit/ddf3adf1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/tree/ddf3adf1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/diff/ddf3adf1

Branch: refs/heads/master
Commit: ddf3adf1fb12b88ef5a227873069d311711ac56a
Parents: b39229a
Author: Becky Gibson <becka...@apache.org>
Authored: Wed Mar 28 16:14:23 2012 -0400
Committer: Becky Gibson <becka...@apache.org>
Committed: Wed Mar 28 16:58:45 2012 -0400

----------------------------------------------------------------------
 lib/ios/platform.js            |    6 ++++++
 lib/ios/plugin/ios/Contact.js  |   30 ++++++++++++++++++++++++++++++
 lib/ios/plugin/ios/contacts.js |   31 +++++++++++++++++++++++++++++++
 3 files changed, 67 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/ddf3adf1/lib/ios/platform.js
----------------------------------------------------------------------
diff --git a/lib/ios/platform.js b/lib/ios/platform.js
index e68b52e..5c032c7 100644
--- a/lib/ios/platform.js
+++ b/lib/ios/platform.js
@@ -24,6 +24,9 @@ module.exports = {
         }
     },
     merges:{
+       Contact:{
+               path: "cordova/plugin/ios/Contact"
+       },
         Entry:{
             path: "cordova/plugin/ios/Entry"
         },
@@ -34,6 +37,9 @@ module.exports = {
             children:{
                 notification:{
                     path:"cordova/plugin/ios/notification"
+                },
+                contacts:{
+                       path:"cordova/plugin/ios/contacts"
                 }
             }
         }

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/ddf3adf1/lib/ios/plugin/ios/Contact.js
----------------------------------------------------------------------
diff --git a/lib/ios/plugin/ios/Contact.js b/lib/ios/plugin/ios/Contact.js
new file mode 100644
index 0000000..676fd46
--- /dev/null
+++ b/lib/ios/plugin/ios/Contact.js
@@ -0,0 +1,30 @@
+var exec = require('cordova/exec'),
+       ContactError = require('cordova/plugin/ContactError');
+
+/**
+ * Provides iOS Contact.display API.
+ */
+module.exports = {
+       display : function(errorCB, options) { 
+               /* 
+                *      Display a contact using the iOS Contact Picker UI
+                *      NOT part of W3C spec so no official documentation
+                *
+                *      @param errorCB error callback
+                *      @param options object
+                *      allowsEditing: boolean AS STRING
+                *              "true" to allow editing the contact
+                *              "false" (default) display contact
+                */
+
+               if (this.id == null) {
+               if (typeof errorCB === "function") {
+                       var errorObj = new 
ContactError(ContactError.UNKNOWN_ERROR);
+                       errorCB(errorObj);
+                       }
+       }
+       else {
+               exec(null, errorCB, "Contacts","displayContact", [this.id, 
options]);
+       }
+       }
+};
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/ddf3adf1/lib/ios/plugin/ios/contacts.js
----------------------------------------------------------------------
diff --git a/lib/ios/plugin/ios/contacts.js b/lib/ios/plugin/ios/contacts.js
new file mode 100644
index 0000000..f3affec
--- /dev/null
+++ b/lib/ios/plugin/ios/contacts.js
@@ -0,0 +1,31 @@
+var exec = require('cordova/exec');
+
+/**
+ * Provides iOS enhanced contacts API.
+ */
+module.exports = {
+       newContactUI : function(successCallback) { 
+               /* 
+                *      Create a contact using the iOS Contact Picker UI
+                *      NOT part of W3C spec so no official documentation
+                *
+                * returns:  the id of the created contact as param to 
successCallback
+                */
+       exec(successCallback, null, "Contacts","newContact", []);
+       },
+       chooseContact : function(successCallback, options) {
+               /* 
+                *      Select a contact using the iOS Contact Picker UI
+                *      NOT part of W3C spec so no official documentation
+                *
+                *      @param errorCB error callback
+                *      @param options object
+                *      allowsEditing: boolean AS STRING
+                *              "true" to allow editing the contact
+                *              "false" (default) display contact
+                *
+                * returns:  the id of the selected contact as param to 
successCallback
+                */
+       exec(successCallback, null, "Contacts","chooseContact", [options]);
+       }
+};
\ No newline at end of file

Reply via email to