Re: Question for Contact Writer API

Hi Simon,

To provide some background, the Contacts Writer specification was split from
the Contacts API precisely because we had issues with finding a write back
paradigm that works in the current design.

The Contacts Writer API should be treated as instable in its current state
and I'd discourage any implementation of the recommendations contained
therein. It has not even been published as a working draft to date.

I'd suggest that focusing on reading contacts and, if necessary, allowing
the saving of contacts to be done as new contacts (i.e. any call to the
save() operation always saves a *new* contact rather than editing an
existing contact) would be the way to go in your current scenario.
Preferably, the API would remain read-only at this stage.

I welcome your feedback on improving the Contacts Writer specification. Let
us know if you have any input that works for your use cases and we will see
if we can incorporate it in to the design.

Thanks,

Rich

[1] http://lists.w3.org/Archives/Public/public-device-apis/2010Nov/0002.html

On Wed, Nov 3, 2010 at 6:58 PM, Simon MacDonald
<simon.macdonald@gmail.com>wrote:

> Hi all,
>
> I've finally gotten my Android device and I can now implement the
> contact.save() functionality.  I've run into what I think is a real problem
> which is best described by illustrating the situation.
>
> Let's say I do a navigator.service.contacts.find(["displayName,
> phoneNumbers"], success, fail, obj).  Then I get the first contact in the
> returned array and delete all the phone numbers from the contact.  Then if I
> do a contact.save() I'm assuming that the contacts phone numbers should be
> deleted from the devices database.
>
> But how would that be different from doing
> a navigator.service.contacts.find(["displayName"], success, fail, obj) and
> then a contact.save().  In both cases there are no phone numbers so they
> would be deleted again.
>

> I guess the problem is how can one tell of a property has been deleted
> versus not being requested as part of a find operation?
>
> My current thinking on how to resolve this problem is to add a new method
> to the ContactWriter interface to delete contact properties specified in the
> method call.
>
> PendingOp delete (in DOMString[] fields, in SuccessCB successCB, in
> optional ErrorCB? errorCB);
>
> This way the programmer could delete individual fields from the contact.
>  If they want to delete the entire contact then they would call the remove
> method.  However, this doesn't fix the problem when the programmer wants to
> delete 1 of the users 3 phoneNumbers.
>
> Simon Mac Donald
> http://hi.im/simonmacdonald
>

Received on Wednesday, 3 November 2010 23:15:49 UTC