cordova-plugin-contacts-phone-numbers
                                
                                 cordova-plugin-contacts-phone-numbers copied to clipboard
                                
                                    cordova-plugin-contacts-phone-numbers copied to clipboard
                            
                            
                            
                        Request for some filters for Fetching
Hi Can we add one small flexibility of passing some few parameters further to filter the Contacts. (Something like DisplayName having some pattern or Ph Numbers have some ISD code etc)
as usual, I am ok with new features if it does not impact the performances on android. feel free to open a PR.
dbaq, I am sorry about my request description. I am requesting this feature on this plugin. I am not a developer to make these changes on my own on this source code.
Which filter do you need exactly? what is the use case?
Use case : Currently it fetches all the Contacts with mobile numbers present. If i need to get contacts only having some phonenumbers with isd code (say +1 for US, +44 for UK) or having DisplayName starting with 'natan'.. etc. In short a filter applied on numbers and displayName fields at the SQL Fetch itself, than processed at JS layer.
Thanks
It makes sense, after looking at the code, it should be doable. I was thinking about something like:
navigator.contactsPhoneNumbers.list(function(contacts) {}, function(error) {}, {
    filters: [{
        field: 'displayName',
        type: 'startsWith', //endsWith, contains
        values: ['a', 'b'] // startsWith a OR b
    }, {
        field: 'lastName',
        type: 'contains', //endsWith, startsWith
        values: ['z']
    }, {
        field: 'number',
        type: 'startsWith', //endsWith, contains
        values: ['415']
    }]
});
I have a doubt about the case sensitivity though. What do you think @natanraj?
Looks good. It has to be case insensitive like Cordova plugin. On 20-Jul-2015 12:11 AM, "Didier Baquier" [email protected] wrote:
It makes sense, after looking at the code, it should be doable. I was thinking about something like:
navigator.contactsPhoneNumbers.list(function(contacts) {}, function(error) {}, { filters: [{ field: 'displayName', type: 'startsWith', //endsWith, contains values: ['a', 'b'] // startsWith a OR b }, { field: 'lastName', type: 'contains', //endsWith, startsWith values: ['z'] }, { field: 'number', type: 'startsWith', //endsWith, contains values: ['415'] }] });```
I have a doubt about the case sensitivity though. What do you think @natanraj?
— Reply to this email directly or view it on GitHub https://github.com/dbaq/cordova-plugin-contacts-phone-numbers/issues/13#issuecomment-122694451 .
Hello @dbaq,
Do you think it's possible to add also the photos values ?
there is another issue for the photos. see #11.
ok thank you.
is this feature implemented?
@kodeine not yet, but any contribution is welcomed :)