You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by an...@apache.org on 2016/09/28 08:07:10 UTC
cordova-plugin-contacts git commit: CB-11350 android: retrieve
displayName for contact when specified in desiredFields
Repository: cordova-plugin-contacts
Updated Branches:
refs/heads/master d7d49634f -> e0600ee7f
CB-11350 android: retrieve displayName for contact when specified in desiredFields
displayName wasn't being retrieved because of wrong condition in populateContactArray
This closes #135
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/e0600ee7
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-contacts/tree/e0600ee7
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-contacts/diff/e0600ee7
Branch: refs/heads/master
Commit: e0600ee7fbe8d42b3dda2038de46738d1e323fc9
Parents: d7d4963
Author: Nikita Matrosov <ma...@gmail.com>
Authored: Mon Sep 26 11:42:56 2016 +0300
Committer: Vladimir Kotikov <v-...@microsoft.com>
Committed: Wed Sep 28 11:06:50 2016 +0300
----------------------------------------------------------------------
src/android/ContactAccessorSdk5.java | 2 +-
tests/tests.js | 29 +++++++++++++++++++++++++++++
2 files changed, 30 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-contacts/blob/e0600ee7/src/android/ContactAccessorSdk5.java
----------------------------------------------------------------------
diff --git a/src/android/ContactAccessorSdk5.java b/src/android/ContactAccessorSdk5.java
index 35d7d88..1ef0e6c 100644
--- a/src/android/ContactAccessorSdk5.java
+++ b/src/android/ContactAccessorSdk5.java
@@ -406,7 +406,7 @@ public class ContactAccessorSdk5 extends ContactAccessor {
// Grab the mimetype of the current row as it will be used in a lot of comparisons
mimetype = c.getString(colMimetype);
- if (mimetype.equals(CommonDataKinds.StructuredName.CONTENT_ITEM_TYPE) && isRequired("name", populate)) {
+ if (mimetype.equals(CommonDataKinds.StructuredName.CONTENT_ITEM_TYPE) && isRequired("displayName", populate)) {
contact.put("displayName", c.getString(colDisplayName));
}
http://git-wip-us.apache.org/repos/asf/cordova-plugin-contacts/blob/e0600ee7/tests/tests.js
----------------------------------------------------------------------
diff --git a/tests/tests.js b/tests/tests.js
index 14621a7..1f06cc4 100644
--- a/tests/tests.js
+++ b/tests/tests.js
@@ -252,6 +252,35 @@ exports.defineAutoTests = function() {
specContext.contactObj.save(test, fail.bind(null, done));
});
+
+ it("contacts.spec.7.1 should contain displayName if specified in desiredFields", function(done) {
+ if (isWindows || isWindowsPhone8 || isIOSPermissionBlocked) {
+ pending();
+ }
+ var testDisplayName = "testContact";
+ var specContext = this;
+ specContext.contactObj = new Contact();
+ specContext.contactObj.displayName = testDisplayName;
+
+ var win = function(contactResult) {
+ expect(contactResult.length > 0).toBe(true);
+ var namesDisplayed = contactResult.every(function(contact, index) {
+ return contact.displayName !== null;
+ });
+ expect(namesDisplayed).toBe(true);
+ done();
+ };
+
+ var onSuccessSave = function(savedContact) {
+ specContext.contactObj = savedContact;
+ var options = new ContactFindOptions();
+ options.filter = testDisplayName;
+ options.multiple = true;
+ options.desiredFields = [navigator.contacts.fieldType.displayName];
+ navigator.contacts.find(["displayName", "nickname"], win, fail.bind(null, done), options);
+ };
+ specContext.contactObj.save(onSuccessSave, fail.bind(null, done));
+ });
});
});
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org