mirror of
https://github.com/apache/cordova-android.git
synced 2025-01-19 15:12:51 +08:00
Changing navigator.contacts to navigator.service.contacts
This commit is contained in:
parent
b78896e5f0
commit
3f24c63fc5
@ -105,7 +105,7 @@
|
|||||||
var name = new ContactName();
|
var name = new ContactName();
|
||||||
name.givenName = '';
|
name.givenName = '';
|
||||||
obj.name = name;
|
obj.name = name;
|
||||||
navigator.contacts.find(obj, count_contacts, fail);
|
navigator.service.contacts.find(obj, count_contacts, fail);
|
||||||
}
|
}
|
||||||
|
|
||||||
function count_contacts(contacts)
|
function count_contacts(contacts)
|
||||||
|
@ -152,5 +152,6 @@ ContactError.TIMEOUT_ERROR = 6;
|
|||||||
ContactError.UNKNOWN_ERROR = 7;
|
ContactError.UNKNOWN_ERROR = 7;
|
||||||
|
|
||||||
PhoneGap.addConstructor(function() {
|
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();
|
||||||
});
|
});
|
||||||
|
@ -1081,7 +1081,8 @@ ContactError.TIMEOUT_ERROR = 6;
|
|||||||
ContactError.UNKNOWN_ERROR = 7;
|
ContactError.UNKNOWN_ERROR = 7;
|
||||||
|
|
||||||
PhoneGap.addConstructor(function() {
|
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() {
|
com.phonegap.CryptoHandlerProxy = function() {
|
||||||
this.className = "com.phonegap.CryptoHandler";
|
this.className = "com.phonegap.CryptoHandler";
|
||||||
|
@ -159,22 +159,22 @@ public class ContactAccessorSdk3_4 extends ContactAccessor {
|
|||||||
|
|
||||||
// Code for backwards compatibility with the OLD Contacts API
|
// Code for backwards compatibility with the OLD Contacts API
|
||||||
if (all)
|
if (all)
|
||||||
mView.loadUrl("javascript:navigator.ContactManager.droidAddContact('" + name + "','" + phoneNumber + "','" + email +"')");
|
mView.loadUrl("javascript:navigator.service.ContactManager.droidAddContact('" + name + "','" + phoneNumber + "','" + email +"')");
|
||||||
else
|
else
|
||||||
mView.loadUrl("javascript:navigator.contacts.droidFoundContact('" + name + "','" + phoneNumber + "','" + email +"')");
|
mView.loadUrl("javascript:navigator.service.contacts.droidFoundContact('" + name + "','" + phoneNumber + "','" + email +"')");
|
||||||
|
|
||||||
} while (cur.moveToNext());
|
} while (cur.moveToNext());
|
||||||
if (all)
|
if (all)
|
||||||
mView.loadUrl("javascript:navigator.ContactManager.droidDone()");
|
mView.loadUrl("javascript:navigator.service.ContactManager.droidDone()");
|
||||||
else
|
else
|
||||||
mView.loadUrl("javascript:navigator.contacts.droidDone();");
|
mView.loadUrl("javascript:navigator.service.contacts.droidDone();");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(all)
|
if(all)
|
||||||
mView.loadUrl("javascript:navigator.ContactManager.fail()");
|
mView.loadUrl("javascript:navigator.service.ContactManager.fail()");
|
||||||
else
|
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)
|
if(data != null)
|
||||||
{
|
{
|
||||||
data.email = email;
|
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());
|
} while (cur.moveToNext());
|
||||||
mView.loadUrl("javascript:navigator.contacts.droidDoneContacts();");
|
mView.loadUrl("javascript:navigator.service.contacts.droidDoneContacts();");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,11 +98,11 @@ public class ContactAccessorSdk5 extends ContactAccessor {
|
|||||||
emailAddress = "'" + emails.getString(emails.getColumnIndex(ContactsContract.CommonDataKinds.Email.DATA)).replace('\'', '`') + "'";
|
emailAddress = "'" + emails.getString(emails.getColumnIndex(ContactsContract.CommonDataKinds.Email.DATA)).replace('\'', '`') + "'";
|
||||||
}
|
}
|
||||||
emails.close();
|
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);
|
mView.loadUrl(contactAddJS);
|
||||||
}
|
}
|
||||||
cursor.close();
|
cursor.close();
|
||||||
mView.loadUrl("javascript:navigator.contacts.droidDone();");
|
mView.loadUrl("javascript:navigator.service.contacts.droidDone();");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user