W3C home > Mailing lists > Public > public-device-apis@w3.org > November 2010

Question for Contact Writer API

From: Simon MacDonald <simon.macdonald@gmail.com>
Date: Wed, 3 Nov 2010 13:58:18 -0400
Message-ID: <AANLkTi=8Nekk+FeboTDCNo9F0JNUjy=FT=ypq+vNkikG@mail.gmail.com>
To: "public-device-apis@w3.org WG" <public-device-apis@w3.org>
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
Received on Wednesday, 3 November 2010 19:37:29 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 19:32:24 UTC