Return-Path: X-Original-To: apmail-incubator-callback-dev-archive@minotaur.apache.org Delivered-To: apmail-incubator-callback-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A61B0C241 for ; Thu, 26 Apr 2012 22:31:10 +0000 (UTC) Received: (qmail 36340 invoked by uid 500); 26 Apr 2012 22:31:10 -0000 Delivered-To: apmail-incubator-callback-dev-archive@incubator.apache.org Received: (qmail 36305 invoked by uid 500); 26 Apr 2012 22:31:10 -0000 Mailing-List: contact callback-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: callback-dev@incubator.apache.org Delivered-To: mailing list callback-dev@incubator.apache.org Received: (qmail 36253 invoked by uid 99); 26 Apr 2012 22:31:10 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 26 Apr 2012 22:31:10 +0000 X-ASF-Spam-Status: No, hits=-1.3 required=5.0 tests=FRT_ADOBE2,RCVD_IN_DNSWL_MED,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of fil@adobe.com designates 64.18.1.187 as permitted sender) Received: from [64.18.1.187] (HELO exprod6og104.obsmtp.com) (64.18.1.187) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 26 Apr 2012 22:31:03 +0000 Received: from outbound-smtp-2.corp.adobe.com ([193.104.215.16]) by exprod6ob104.postini.com ([64.18.5.12]) with SMTP ID DSNKT5nMkRryjZYS+Olgu3+ug4sto7S1gRCn@postini.com; Thu, 26 Apr 2012 15:30:42 PDT Received: from inner-relay-1.corp.adobe.com (inner-relay-1.adobe.com [153.32.1.51]) by outbound-smtp-2.corp.adobe.com (8.12.10/8.12.10) with ESMTP id q3QMUcsp021669 for ; Thu, 26 Apr 2012 15:30:38 -0700 (PDT) Received: from nahub02.corp.adobe.com (nahub02.corp.adobe.com [10.8.189.98]) by inner-relay-1.corp.adobe.com (8.12.10/8.12.10) with ESMTP id q3QMUbvm003148 for ; Thu, 26 Apr 2012 15:30:37 -0700 (PDT) Received: from nambxv01a.corp.adobe.com ([10.8.189.95]) by nahub02.corp.adobe.com ([10.8.189.98]) with mapi; Thu, 26 Apr 2012 15:30:37 -0700 From: Filip Maj To: "callback-dev@incubator.apache.org" Date: Thu, 26 Apr 2012 15:33:10 -0700 Subject: Re: ContactField Thread-Topic: ContactField Thread-Index: Ac0j/DNFu4ULNlvcQ3SFSMKoc63S+A== Message-ID: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: user-agent: Microsoft-MacOutlook/14.2.0.120402 acceptlanguage: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Just patch it dude! On 4/26/12 3:25 PM, "Shazron" wrote: >Thanks Fil, >I guess this could be a documentation issue but I'd rather coerce the >values into strings. I'll send pull requests for cordova-js and >mobile-spec. > >On Thu, Apr 26, 2012 at 3:04 PM, Filip Maj wrote: >> Looks to me like Android assumes a string for a phone number's "value" >> property [1]. >> >> BlackBerry uses WebWorks' PIM javascript API which I think handles >> number/string conversion on its own, but the API reference says phone >> numbers are supposed to be strings [2]. >> >> Looks to me like WP7 assumes strings as well [3] (where the ContactField >> generic object has value properties of type string). Also the WP7 SDK >> native example documentation [4] clearly assigns strings to phone >>numbers. >> >> Finally: the W3C spec of the contacts API says that phone numbers should >> be an array of ContactField objects, and the ContactField object's value >> property is always a string [5]. >> >> I say: force people to use a string. There's a lot of stuff in there too >> that can't be mapped as a number. What if you have a dash, a space, a #, >> parentheses for area codes, etc. >> >> We could easily coerce everything passed into Contact Field values as >> strings (as per your suggestion). >> >> [1] >>=20 >>https://github.com/apache/incubator-cordova-android/blob/master/framework >>/s >> rc/org/apache/cordova/ContactAccessorSdk5.java#L1355 >> [2] >>=20 >>https://bdsc.webapps.blackberry.com/html5/apis/blackberry.pim.Contact.htm >>l# >> homePhone >> [3] >>=20 >>https://github.com/apache/incubator-cordova-wp7/blob/master/framework/Cor >>do >> va/Commands/Contacts.cs#L140 >> [4] http://msdn.microsoft.com/en-us/library/hh394013(v=3Dvs.92).aspx >> [5] http://www.w3.org/TR/contacts-api/#contactfield-interface >> >> On 4/26/12 2:48 PM, "Shazron" wrote: >> >>>Ah it' short-circuit evaluation: >>>http://en.wikipedia.org/wiki/Short-circuit_evaluation >>> >>>On Thu, Apr 26, 2012 at 2:41 PM, Shazron wrote: >>>> I'm attempting to fix: https://issues.apache.org/jira/browse/CB-567 >>>> >>>> These lines: >>>>https://github.com/apache/incubator-cordova-js/blob/master/lib/common/p >>>>lu >>>>gin/ContactField.js#L11-12 >>>> >>>> The problem is, in iOS some users are passing in the type and value >>>> properties as numbers but not strings. These are passed in to Obj-C as >>>> the same type (NSNumber) and are passed directly to the underlying >>>> AddressBook framework untouched (it will require code to filter and >>>> test for these props, and I'd rather not touch working code at this >>>> point, and it's a lot of code if you look at it) but it will throw an >>>> exception because it didn't expect a NSNumber. I know, it's really a >>>> bug in their implementation but I'm asking for suggestions on how best >>>> to fix this. >>>> >>>> I'm thinking that I could just .toString() the properties and this >>>> does solve the problem, but since this is common code I'm wondering >>>> what the side effects are for the other platforms. Or should we punt >>>> this and just say "don't do that!" for the problem? >>>> >>>> As an aside, this is what I propose for the fix for example: >>>> >>>> this.type =3D (type && type.toString()) || null; >>>> >>>> It seems to work from my tests but I'm not exactly sure why (type && >>>> type.toString()) evaluates to a String (where it will evaluate that >>>> expression when type is anything non-null) - something for wtfjs? >>