cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shaz...@apache.org
Subject git commit: CB-7772 - [Contacts] Cancelling pickContact should call the error callback, not the success callback
Date Tue, 14 Oct 2014 19:57:14 GMT
Repository: cordova-plugin-contacts
Updated Branches:
  refs/heads/master 15d1f9698 -> e8fa35f44


CB-7772 - [Contacts] Cancelling pickContact should call the error callback, not the success
callback


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/e8fa35f4
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-contacts/tree/e8fa35f4
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-contacts/diff/e8fa35f4

Branch: refs/heads/master
Commit: e8fa35f44d165cae13605c416ecc484b0790671e
Parents: 15d1f96
Author: Shazron Abdullah <shazron@apache.org>
Authored: Tue Oct 14 12:57:05 2014 -0700
Committer: Shazron Abdullah <shazron@apache.org>
Committed: Tue Oct 14 12:57:05 2014 -0700

----------------------------------------------------------------------
 src/ios/CDVContacts.m | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-contacts/blob/e8fa35f4/src/ios/CDVContacts.m
----------------------------------------------------------------------
diff --git a/src/ios/CDVContacts.m b/src/ios/CDVContacts.m
index f7fb99d..719b070 100644
--- a/src/ios/CDVContacts.m
+++ b/src/ios/CDVContacts.m
@@ -243,7 +243,16 @@
         }
         CFRelease(addrBook);
     }
-    CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:picker.pickedContactDictionary];
+    
+    CDVPluginResult* result = nil;
+    NSNumber* recordId = picker.pickedContactDictionary[kW3ContactId];
+    
+    if ([recordId isEqualToNumber:[NSNumber numberWithInt:kABRecordInvalidID]]) {
+        result = [CDVPluginResult resultWithStatus:CDVCommandStatus_NO_RESULT];
+    } else {
+        result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:picker.pickedContactDictionary];
+    }
+    
     [self.commandDelegate sendPluginResult:result callbackId:picker.callbackId];
 
     [[peoplePicker presentingViewController] dismissViewControllerAnimated:YES completion:nil];


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


Mime
View raw message