Changing navigator.contacts to navigator.service.contacts

This commit is contained in:
macdonst 2010-09-13 16:14:33 -04:00
parent b78896e5f0
commit 3f24c63fc5
5 changed files with 15 additions and 13 deletions

View File

@ -105,7 +105,7 @@
var name = new ContactName();
name.givenName = '';
obj.name = name;
navigator.contacts.find(obj, count_contacts, fail);
navigator.service.contacts.find(obj, count_contacts, fail);
}
function count_contacts(contacts)

View File

@ -152,5 +152,6 @@ ContactError.TIMEOUT_ERROR = 6;
ContactError.UNKNOWN_ERROR = 7;
PhoneGap.addConstructor(function() {
if(typeof navigator.contacts == "undefined") navigator.contacts = new Contacts();
if(typeof navigator.service == "undefined") navigator.service = new Object();
if(typeof navigator.service.contacts == "undefined") navigator.service.contacts = new Contacts();
});

View File

@ -1081,7 +1081,8 @@ ContactError.TIMEOUT_ERROR = 6;
ContactError.UNKNOWN_ERROR = 7;
PhoneGap.addConstructor(function() {
if(typeof navigator.contacts == "undefined") navigator.contacts = new Contacts();
if(typeof navigator.service == "undefined") navigator.service = new Object();
if(typeof navigator.service.contacts == "undefined") navigator.service.contacts = new Contacts();
});
com.phonegap.CryptoHandlerProxy = function() {
this.className = "com.phonegap.CryptoHandler";

View File

@ -159,22 +159,22 @@ public class ContactAccessorSdk3_4 extends ContactAccessor {
// Code for backwards compatibility with the OLD Contacts API
if (all)
mView.loadUrl("javascript:navigator.ContactManager.droidAddContact('" + name + "','" + phoneNumber + "','" + email +"')");
mView.loadUrl("javascript:navigator.service.ContactManager.droidAddContact('" + name + "','" + phoneNumber + "','" + email +"')");
else
mView.loadUrl("javascript:navigator.contacts.droidFoundContact('" + name + "','" + phoneNumber + "','" + email +"')");
mView.loadUrl("javascript:navigator.service.contacts.droidFoundContact('" + name + "','" + phoneNumber + "','" + email +"')");
} while (cur.moveToNext());
if (all)
mView.loadUrl("javascript:navigator.ContactManager.droidDone()");
mView.loadUrl("javascript:navigator.service.ContactManager.droidDone()");
else
mView.loadUrl("javascript:navigator.contacts.droidDone();");
mView.loadUrl("javascript:navigator.service.contacts.droidDone();");
}
else
{
if(all)
mView.loadUrl("javascript:navigator.ContactManager.fail()");
mView.loadUrl("javascript:navigator.service.ContactManager.fail()");
else
mView.loadUrl("javascript:navigator.contacts.fail('None found!')");
mView.loadUrl("javascript:navigator.service.contacts.fail('None found!')");
}
}
@ -197,10 +197,10 @@ public class ContactAccessorSdk3_4 extends ContactAccessor {
if(data != null)
{
data.email = email;
mView.loadUrl("javascript:navigator.Contacts.droidFoundContact('" + data.name + "','" + data.phone + "','" + data.email +"')");
mView.loadUrl("javascript:navigator.service.Contacts.droidFoundContact('" + data.name + "','" + data.phone + "','" + data.email +"')");
}
} while (cur.moveToNext());
mView.loadUrl("javascript:navigator.contacts.droidDoneContacts();");
mView.loadUrl("javascript:navigator.service.contacts.droidDoneContacts();");
}
}

View File

@ -98,11 +98,11 @@ public class ContactAccessorSdk5 extends ContactAccessor {
emailAddress = "'" + emails.getString(emails.getColumnIndex(ContactsContract.CommonDataKinds.Email.DATA)).replace('\'', '`') + "'";
}
emails.close();
String contactAddJS = "javascript:navigator.contacts.droidFoundContact('" + contactName.replace('\'', '`') + "'," + phoneNumber + "," + emailAddress +")";
String contactAddJS = "javascript:navigator.service.contacts.droidFoundContact('" + contactName.replace('\'', '`') + "'," + phoneNumber + "," + emailAddress +")";
mView.loadUrl(contactAddJS);
}
cursor.close();
mView.loadUrl("javascript:navigator.contacts.droidDone();");
mView.loadUrl("javascript:navigator.service.contacts.droidDone();");
}
}