You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by sh...@apache.org on 2016/12/08 00:56:37 UTC
[07/11] cordova-plugin-contacts git commit: CB-11975 iOS: Allow to
use numeric values in search filter
CB-11975 iOS: Allow to use numeric values in search filter
This closes #139
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/a19baba6
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-contacts/tree/a19baba6
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-contacts/diff/a19baba6
Branch: refs/heads/2.2.x
Commit: a19baba6fbba5ab6d18c27eee0db4c3a2ea94f17
Parents: 7f662d6
Author: Nikita Matrosov <ma...@gmail.com>
Authored: Mon Oct 10 12:02:17 2016 +0300
Committer: Vladimir Kotikov <v-...@microsoft.com>
Committed: Wed Nov 2 10:25:09 2016 +0300
----------------------------------------------------------------------
src/ios/CDVContacts.m | 4 +++-
tests/tests.js | 21 +++++++++++++++++++++
2 files changed, 24 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-contacts/blob/a19baba6/src/ios/CDVContacts.m
----------------------------------------------------------------------
diff --git a/src/ios/CDVContacts.m b/src/ios/CDVContacts.m
index d5dd958..14fce2c 100644
--- a/src/ios/CDVContacts.m
+++ b/src/ios/CDVContacts.m
@@ -330,7 +330,9 @@
NSArray* desiredFields = nil;
if (![findOptions isKindOfClass:[NSNull class]]) {
id value = nil;
- filter = (NSString*)[findOptions objectForKey:@"filter"];
+ id filterValue = [findOptions objectForKey:@"filter"];
+ BOOL filterValueIsNumber = [filterValue isKindOfClass:[NSNumber class]];
+ filter = filterValueIsNumber ? [filterValue stringValue] : (NSString *) filterValue;
value = [findOptions objectForKey:@"multiple"];
if ([value isKindOfClass:[NSNumber class]]) {
// multiple is a boolean that will come through as an NSNumber
http://git-wip-us.apache.org/repos/asf/cordova-plugin-contacts/blob/a19baba6/tests/tests.js
----------------------------------------------------------------------
diff --git a/tests/tests.js b/tests/tests.js
index 1f06cc4..6d0ef54 100644
--- a/tests/tests.js
+++ b/tests/tests.js
@@ -281,6 +281,27 @@ exports.defineAutoTests = function() {
};
specContext.contactObj.save(onSuccessSave, fail.bind(null, done));
});
+ it("contacts.spec.7.2 should find contact despite id isn't string ", 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);
+ done();
+ };
+ var onSuccessSave = function(savedContact) {
+ specContext.contactObj = savedContact;
+ var options = new ContactFindOptions();
+ options.filter = savedContact.id;
+ options.multiple = true;
+ navigator.contacts.find(["id"], 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