incubator-callback-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From becka...@apache.org
Subject ios commit: Fixes CB-961
Date Thu, 28 Jun 2012 20:04:17 GMT
Updated Branches:
  refs/heads/master 116049e54 -> b6f02dea2


Fixes CB-961

Remove checking for non-empty array when calling setMultiValueStrings and setMultiValueDict
when updating phone numbers, ims, emails, urls, addresses and photos. This bug was introduced
in the UnifiedJS conversion.


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/commit/b6f02dea
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/tree/b6f02dea
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/diff/b6f02dea

Branch: refs/heads/master
Commit: b6f02dea27a41d0607990c8d612913d63786d9d2
Parents: 116049e
Author: Becky Gibson <becka11y@apache.org>
Authored: Wed Jun 27 18:16:35 2012 -0400
Committer: Becky Gibson <becka11y@apache.org>
Committed: Thu Jun 28 08:59:33 2012 -0400

----------------------------------------------------------------------
 CordovaLib/Classes/CDVContact.m |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/b6f02dea/CordovaLib/Classes/CDVContact.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVContact.m b/CordovaLib/Classes/CDVContact.m
index 50974cd..e7cdbfc 100644
--- a/CordovaLib/Classes/CDVContact.m
+++ b/CordovaLib/Classes/CDVContact.m
@@ -279,19 +279,19 @@ static NSDictionary*	org_apache_cordova_contacts_defaultFields = nil;
 	// set phoneNumbers
 	//NSLog(@"setting phoneNumbers");
 	NSArray* array = [aContact valueForKey:kW3ContactPhoneNumbers];
-	if ([array isKindOfClass:[NSArray class]] && [array count] > 0){
+	if ([array isKindOfClass:[NSArray class]]){
 		[self setMultiValueStrings: array forProperty: kABPersonPhoneProperty inRecord: person
asUpdate: bUpdate];
 	}
 	// set Emails
 	//NSLog(@"setting emails");
 	array = [aContact valueForKey:kW3ContactEmails];
-	if ([array isKindOfClass:[NSArray class]] && [array count] > 0){
+	if ([array isKindOfClass:[NSArray class]]){
 		[self setMultiValueStrings: array forProperty: kABPersonEmailProperty inRecord: person
asUpdate: bUpdate];
 	}
 	// set Urls
 	//NSLog(@"setting urls");
 	array = [aContact valueForKey:kW3ContactUrls];
-	if ([array isKindOfClass:[NSArray class]] && [array count] > 0){
+	if ([array isKindOfClass:[NSArray class]]){
 		[self setMultiValueStrings: array forProperty: kABPersonURLProperty inRecord: person asUpdate:
bUpdate];
 	}
 	
@@ -302,13 +302,13 @@ static NSDictionary*	org_apache_cordova_contacts_defaultFields = nil;
 	//NSLog(@"setting addresses");
 	error = nil;
 	array = [aContact valueForKey:kW3ContactAddresses];
-	if ([array isKindOfClass:[NSArray class]] && [array count] > 0){
+	if ([array isKindOfClass:[NSArray class]]){
 		[self setMultiValueDictionary: array forProperty: kABPersonAddressProperty inRecord: person
asUpdate: bUpdate];
 	}
 	//ims
 	//NSLog(@"setting ims");
 	array = [aContact valueForKey:kW3ContactIms];
-	if ([array isKindOfClass:[NSArray class]] && [array count] > 0){
+	if ([array isKindOfClass:[NSArray class]]){
 		[self setMultiValueDictionary: array forProperty: kABPersonInstantMessageProperty inRecord:
person asUpdate: bUpdate];
 	}
 	
@@ -316,8 +316,9 @@ static NSDictionary*	org_apache_cordova_contacts_defaultFields = nil;
 	// W3C ContactOrganization has pref, type, name, title, department
 	// iOS only supports name, title, department
 	//NSLog(@"setting organizations");
+    // TODO this may need work - should Organization information be removed when array is
empty??
 	array = [aContact valueForKey:kW3ContactOrganizations];  // iOS only supports one organization
- use first one
-	if ([array isKindOfClass:[NSArray class]] && [array count] > 0){
+	if ([array isKindOfClass:[NSArray class]]){
 		NSDictionary* dict = [array objectAtIndex:0];
 		if ([dict isKindOfClass:[NSDictionary class]]){
 			[self setValue: [dict valueForKey:@"name"] forProperty: kABPersonOrganizationProperty
inRecord: person asUpdate: bUpdate];
@@ -356,7 +357,7 @@ static NSDictionary*	org_apache_cordova_contacts_defaultFields = nil;
 	
 	// photo
 	array = [aContact valueForKey: kW3ContactPhotos];
-	if ([array isKindOfClass:[NSArray class]] && [array count] > 0){
+	if ([array isKindOfClass:[NSArray class]]){
 		if (bUpdate && [array count] == 0){
 			// remove photo
 			bSuccess = ABPersonRemoveImageData(person, &error);


Mime
View raw message