From e9f58961bbe15c60a9a56fe93e2262c7bb9392ca Mon Sep 17 00:00:00 2001 From: Joe Bowser Date: Tue, 1 Dec 2009 14:56:43 -0800 Subject: [PATCH] Fixing up contacts to match the new spec --- js/contact.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/js/contact.js b/js/contact.js index 0288d8f5..cfda327c 100644 --- a/js/contact.js +++ b/js/contact.js @@ -21,15 +21,21 @@ var ContactEmail = function() this.address = ""; } +var ContactPhoneNumber = function() +{ + this.types = []; + this.number = ""; +} + var Contacts = function() { this.records = []; } -var Contacts.prototype.find = function(obj, win, fail) +Contacts.prototype.find = function(obj, win, fail) { - if(obj.name) + if(obj.name != null) { ContactHook.search(name, "", ""); } @@ -37,7 +43,7 @@ var Contacts.prototype.find = function(obj, win, fail) this.fail = fail; } -var Contacts.prototype.droidFoundContact = function(name, npa, email) +Contacts.prototype.droidFoundContact = function(name, npa, email) { var contact = new Contact(); contact.name = new ContactName(); @@ -54,7 +60,11 @@ var Contacts.prototype.droidFoundContact = function(name, npa, email) this.records.push(contact); } -var Contacts.prototype.droidDone = function() +Contacts.prototype.droidDone = function() { this.win(this.records); } + +PhoneGap.addConstructor(function() { + if(typeof navigator.Contacts == "undefined") navigator.Contacts = new Contacts(); +});