You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by sh...@apache.org on 2014/09/15 01:09:18 UTC
git commit: CB-7544 - [Contacts][iOS 8] Contact picker is read-only
in iOS 8
Repository: cordova-plugin-contacts
Updated Branches:
refs/heads/master 404aa16c2 -> da4962413
CB-7544 - [Contacts][iOS 8] Contact picker is read-only in iOS 8
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-contacts/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-contacts/commit/da496241
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-contacts/tree/da496241
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-contacts/diff/da496241
Branch: refs/heads/master
Commit: da4962413640e9cf92f3b03860fcb99a0f57cad0
Parents: 404aa16
Author: Shazron Abdullah <sh...@apache.org>
Authored: Sun Sep 14 16:09:10 2014 -0700
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Sun Sep 14 16:09:10 2014 -0700
----------------------------------------------------------------------
src/ios/CDVContacts.m | 60 +++++++++++++++++++++++++++-------------------
1 file changed, 36 insertions(+), 24 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-contacts/blob/da496241/src/ios/CDVContacts.m
----------------------------------------------------------------------
diff --git a/src/ios/CDVContacts.m b/src/ios/CDVContacts.m
index 7f3ef32..1f850ee 100644
--- a/src/ios/CDVContacts.m
+++ b/src/ios/CDVContacts.m
@@ -215,30 +215,7 @@
- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController*)peoplePicker
shouldContinueAfterSelectingPerson:(ABRecordRef)person
{
- CDVContactsPicker* picker = (CDVContactsPicker*)peoplePicker;
- NSNumber* pickedId = [NSNumber numberWithInt:ABRecordGetRecordID(person)];
-
- if (picker.allowsEditing) {
- ABPersonViewController* personController = [[ABPersonViewController alloc] init];
- personController.displayedPerson = person;
- personController.personViewDelegate = self;
- personController.allowsEditing = picker.allowsEditing;
- // store id so can get info in peoplePickerNavigationControllerDidCancel
- picker.pickedContactDictionary = [NSDictionary dictionaryWithObjectsAndKeys:pickedId, kW3ContactId, nil];
-
- [peoplePicker pushViewController:personController animated:YES];
- } else {
- // Retrieve and return pickedContact information
- CDVContact* pickedContact = [[CDVContact alloc] initFromABRecord:(ABRecordRef)person];
- NSArray* fields = [picker.options objectForKey:@"fields"];
- NSDictionary* returnFields = [[CDVContact class] calcReturnFields:fields];
- picker.pickedContactDictionary = [pickedContact toDictionary:returnFields];
-
- CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:picker.pickedContactDictionary];
- [self.commandDelegate sendPluginResult:result callbackId:picker.callbackId];
-
- [[picker presentingViewController] dismissViewControllerAnimated:YES completion:nil];
- }
+ [self peoplePickerNavigationController:peoplePicker didSelectPerson:person];
return NO;
}
@@ -272,6 +249,41 @@
[[peoplePicker presentingViewController] dismissViewControllerAnimated:YES completion:nil];
}
+// Called after a person has been selected by the user.
+- (void)peoplePickerNavigationController:(ABPeoplePickerNavigationController*)peoplePicker didSelectPerson:(ABRecordRef)person
+{
+ CDVContactsPicker* picker = (CDVContactsPicker*)peoplePicker;
+ NSNumber* pickedId = [NSNumber numberWithInt:ABRecordGetRecordID(person)];
+
+ if (picker.allowsEditing) {
+ ABPersonViewController* personController = [[ABPersonViewController alloc] init];
+ personController.displayedPerson = person;
+ personController.personViewDelegate = self;
+ personController.allowsEditing = picker.allowsEditing;
+ // store id so can get info in peoplePickerNavigationControllerDidCancel
+ picker.pickedContactDictionary = [NSDictionary dictionaryWithObjectsAndKeys:pickedId, kW3ContactId, nil];
+
+ [peoplePicker pushViewController:personController animated:YES];
+ } else {
+ // Retrieve and return pickedContact information
+ CDVContact* pickedContact = [[CDVContact alloc] initFromABRecord:(ABRecordRef)person];
+ NSArray* fields = [picker.options objectForKey:@"fields"];
+ NSDictionary* returnFields = [[CDVContact class] calcReturnFields:fields];
+ picker.pickedContactDictionary = [pickedContact toDictionary:returnFields];
+
+ CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:picker.pickedContactDictionary];
+ [self.commandDelegate sendPluginResult:result callbackId:picker.callbackId];
+
+ [[picker presentingViewController] dismissViewControllerAnimated:YES completion:nil];
+ }
+}
+
+// Called after a property has been selected by the user.
+- (void)peoplePickerNavigationController:(ABPeoplePickerNavigationController*)peoplePicker didSelectPerson:(ABRecordRef)person property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifier
+{
+ // not implemented
+}
+
- (void)search:(CDVInvokedUrlCommand*)command
{
NSString* callbackId = command.callbackId;