You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by GitBox <gi...@apache.org> on 2017/11/27 20:18:54 UTC
[GitHub] maverickmishra closed pull request #134: CB-11855: (ios) Allow iOS to use hasPhoneNumber
maverickmishra closed pull request #134: CB-11855: (ios) Allow iOS to use hasPhoneNumber
URL: https://github.com/apache/cordova-plugin-contacts/pull/134
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/src/ios/CDVContacts.m b/src/ios/CDVContacts.m
index d5dd958..09b1e05 100644
--- a/src/ios/CDVContacts.m
+++ b/src/ios/CDVContacts.m
@@ -326,6 +326,7 @@ - (void)search:(CDVInvokedUrlCommand*)command
NSArray* foundRecords = nil;
// get the findOptions values
BOOL multiple = NO; // default is false
+ BOOL hasPhoneNumber = NO; // default is false
NSString* filter = nil;
NSArray* desiredFields = nil;
if (![findOptions isKindOfClass:[NSNull class]]) {
@@ -337,6 +338,10 @@ - (void)search:(CDVInvokedUrlCommand*)command
multiple = [(NSNumber*)value boolValue];
// NSLog(@"multiple is: %d", multiple);
}
+ value = [findOptions objectForKey:@"hasPhoneNumber"];
+ if ([value isKindOfClass:[NSNumber class]]) {
+ hasPhoneNumber = [(NSNumber*)value boolValue];
+ }
desiredFields = [findOptions objectForKey:@"desiredFields"];
// return all fields if desired fields are not explicitly defined
if (desiredFields == nil || desiredFields.count == 0) {
@@ -391,6 +396,11 @@ - (void)search:(CDVInvokedUrlCommand*)command
for (int i = 0; i < count; i++) {
CDVContact* newContact = [matches objectAtIndex:i];
NSDictionary* aContact = [newContact toDictionary:returnFields];
+ NSMutableArray *phoneNumberArray = [[NSMutableArray alloc] init];
+ phoneNumberArray = [aContact valueForKey:@"phoneNumbers"];
+ if (([phoneNumberArray isKindOfClass:[NSNull class]]) && (hasPhoneNumber)) {
+ continue;
+ }
[returnContacts addObject:aContact];
}
}
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org