incubator-callback-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shazron Abdullah (Commented) (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CB-58) Feature request: contacts.find API too slow for autocomplete. provide max contact objects option.
Date Mon, 28 Nov 2011 22:49:40 GMT

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

Shazron Abdullah commented on CB-58:
------------------------------------

by: http://github.com/ttopholm

Why don’t you preload the contacts into a object or array, and use that.....

by: Philip C (on lighthouseapp.com)

A person could have thousands of contacts. I think that caching all of them is wasteful and
time consuming. Can you think of a way to cache that wouldn’t use too much memory? Do you
normally cache that much?

I wait to autocomplete until the person has typed 2 or 3 letters and then start the process
of auto-completing and showing 3-10 contacts. I think it is reasonable to be able to call
contacts.find and get a response back with up to 10 contacts quickly as you would with a native
app.

by: http://github.com/ttopholm

Hi Philip

I’m not saying it should be a permanent solution, but just until they approve the feature
request.

But you can easily do it on startup, have splash screen, telling the user that the app is
loading... and prefetch the contacts, and save them in a sql,lawnchair etc.... and the you
could have a hash to check if there are new contacts on each startup....

But the best solution, is to make the solution yourself if you can, and publish it.

by: http://github.com/becka11y

Not sure what to say as we are following the W3C Contacts specification (http://www.w3.org/TR/contacts-api/)
from December, 2010 and it does not include a limit option.  However, it previously did, so
there is commented out code in Contacts.m that could use a limit parameter if it was provided
in options.  If you want to modify the objective C code in your version of PhoneGapLib you
could get this feature.   

I would ask you to submit this request for a limit parameter to the W3C Device API's working
group that is working on this specification:   public-device-apis@w3.org.  

-becky
                
> Feature request: contacts.find API too slow for autocomplete. provide max contact objects
option.
> -------------------------------------------------------------------------------------------------
>
>                 Key: CB-58
>                 URL: https://issues.apache.org/jira/browse/CB-58
>             Project: Apache Callback
>          Issue Type: New Feature
>          Components: iOS
>            Reporter: Shazron Abdullah
>
> reported at: https://github.com/phonegap/phonegap-iphone/issues/56
> by: https://github.com/hardeep
> I am trying to use the contacts.find api to fill in an autocomplete box. It is too slow
to be useful in this context.
> Please provide a way to limit the number of contact objects returned from the contacts.find
api.
> Possibly add a new option to contactFindOptions, something like "maxContacts". For example:
>   maxContacts: Determines how many contact objects the find operation should return.
(Integer) (Default: 1000)
> Here is a code snippet of what I am trying to do:
>     $(&rsquo;#contacts input:last&rsquo;).autocomplete({source: function (request,
response) {
>       options = new ContactFindOptions();
>       options.filter = request.term;
>       options.multiple = true; 
>       fields = ["displayName", "phoneNumbers", "emails"];
>       navigator.service.contacts.find(fields,
>         function (contacts) {
>           var responseList = [];
>           console.log(&rsquo;contacts found for &rsquo; + request.term + &rsquo;:
&rsquo; + contacts.length);
>           $.each(contacts, function (index, contact) {
>             //console.log(contact);
>             // limit to 10 autocomplete contacts
>             // note: the contacts.find api takes a long time to return when there are
>             // many contacts that match the options.filter
>             if (index > 10) {
>               return false;  // break
>             }
> [Original LightHouse ticket](http://phonegap.lighthouseapp.com/projects/20116/tickets/146)
>  This ticket has 0 attachment(s).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

Mime
View raw message