cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CB-11855) hasPhoneNumber does not work for iOS
Date Mon, 27 Nov 2017 20:19:01 GMT

    [ https://issues.apache.org/jira/browse/CB-11855?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16267416#comment-16267416
] 

ASF GitHub Bot commented on CB-11855:
-------------------------------------

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


> hasPhoneNumber does not work for iOS
> ------------------------------------
>
>                 Key: CB-11855
>                 URL: https://issues.apache.org/jira/browse/CB-11855
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: cordova-plugin-contacts (DEPRECATED)
>    Affects Versions: 6.3.0
>         Environment: osx, linux, ios
>            Reporter: Justin Ahn
>            Priority: Trivial
>              Labels: known_issue
>             Fix For: 6.3.0
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> hasPhoneNumber is an Android Only feature.  I'm proposing extending it to allow iOS to
use this feature as well



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


Mime
View raw message