cordova-plugin-contacts-phone-numbers icon indicating copy to clipboard operation
cordova-plugin-contacts-phone-numbers copied to clipboard

Request for some filters for Fetching

Open natanraj opened this issue 10 years ago • 11 comments

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)

natanraj avatar Jun 23 '15 06:06 natanraj

as usual, I am ok with new features if it does not impact the performances on android. feel free to open a PR.

dbaq avatar Jun 23 '15 06:06 dbaq

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.

natanraj avatar Jun 26 '15 05:06 natanraj

Which filter do you need exactly? what is the use case?

dbaq avatar Jun 30 '15 16:06 dbaq

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

natanraj avatar Jul 01 '15 06:07 natanraj

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?

dbaq avatar Jul 19 '15 18:07 dbaq

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 .

natanraj avatar Jul 20 '15 15:07 natanraj

Hello @dbaq,

Do you think it's possible to add also the photos values ?

ronycohen avatar Sep 26 '15 11:09 ronycohen

there is another issue for the photos. see #11.

dbaq avatar Sep 27 '15 04:09 dbaq

ok thank you.

ronycohen avatar Sep 27 '15 11:09 ronycohen

is this feature implemented?

kodeine avatar May 25 '17 18:05 kodeine

@kodeine not yet, but any contribution is welcomed :)

dbaq avatar May 25 '17 18:05 dbaq