You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by pu...@apache.org on 2015/11/18 01:57:46 UTC
[1/2] cordova-plugin-camera git commit: CB-8863 correct block usage
for async calls
Repository: cordova-plugin-camera
Updated Branches:
refs/heads/master 036cdfdeb -> 63ac782b3
CB-8863 correct block usage for async calls
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/commit/7f3a0a54
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/tree/7f3a0a54
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/diff/7f3a0a54
Branch: refs/heads/master
Commit: 7f3a0a5483322a76e9121bda18f36ec84566aeab
Parents: 036cdfd
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Tue Nov 17 16:37:45 2015 -0800
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Tue Nov 17 16:37:45 2015 -0800
----------------------------------------------------------------------
src/ios/CDVCamera.m | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/blob/7f3a0a54/src/ios/CDVCamera.m
----------------------------------------------------------------------
diff --git a/src/ios/CDVCamera.m b/src/ios/CDVCamera.m
index ce40b0b..d5d3ba4 100644
--- a/src/ios/CDVCamera.m
+++ b/src/ios/CDVCamera.m
@@ -109,12 +109,14 @@ static NSString* toBase64(NSData* data) {
- (NSURL*) urlTransformer:(NSURL*)url
{
NSURL* urlToTransform = url;
+ __weak CDVCamera* weakSelf = self;
// for backwards compatibility - we check if this property is there
SEL sel = NSSelectorFromString(@"urlTransformer");
if ([self.commandDelegate respondsToSelector:sel]) {
+
// grab the block from the commandDelegate
- NSURL* (^urlTransformer)(NSURL*) = ((id(*)(id, SEL))objc_msgSend)(self.commandDelegate, sel);
+ NSURL* (^urlTransformer)(NSURL*) = ((id(*)(id, SEL))objc_msgSend)(weakSelf.commandDelegate, sel);
// if block is not null, we call it
if (urlTransformer) {
urlToTransform = urlTransformer(url);
@@ -172,7 +174,7 @@ static NSString* toBase64(NSData* data) {
[[[UIAlertView alloc] initWithTitle:[[NSBundle mainBundle]
objectForInfoDictionaryKey:@"CFBundleDisplayName"]
message:NSLocalizedString(@"Access to the camera has been prohibited; please enable it in the Settings app to continue.", nil)
- delegate:self
+ delegate:weakSelf
cancelButtonTitle:NSLocalizedString(@"OK", nil)
otherButtonTitles:settingsButton, nil] show];
});
@@ -511,14 +513,14 @@ static NSString* toBase64(NSData* data) {
NSString* mediaType = [info objectForKey:UIImagePickerControllerMediaType];
if ([mediaType isEqualToString:(NSString*)kUTTypeImage]) {
- [self resultForImage:cameraPicker.pictureOptions info:info completion:^(CDVPluginResult* res) {
+ [weakSelf resultForImage:cameraPicker.pictureOptions info:info completion:^(CDVPluginResult* res) {
[weakSelf.commandDelegate sendPluginResult:res callbackId:cameraPicker.callbackId];
weakSelf.hasPendingOperation = NO;
weakSelf.pickerController = nil;
}];
}
else {
- result = [self resultForVideo:info];
+ result = [weakSelf resultForVideo:info];
[weakSelf.commandDelegate sendPluginResult:result callbackId:cameraPicker.callbackId];
weakSelf.hasPendingOperation = NO;
weakSelf.pickerController = nil;
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[2/2] cordova-plugin-camera git commit: remove unneeded weakness
Posted by pu...@apache.org.
remove unneeded weakness
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/commit/63ac782b
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/tree/63ac782b
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/diff/63ac782b
Branch: refs/heads/master
Commit: 63ac782b323fe63da16f38de1999e0ba87c2e975
Parents: 7f3a0a5
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Tue Nov 17 16:56:35 2015 -0800
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Tue Nov 17 16:56:35 2015 -0800
----------------------------------------------------------------------
src/ios/CDVCamera.m | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/blob/63ac782b/src/ios/CDVCamera.m
----------------------------------------------------------------------
diff --git a/src/ios/CDVCamera.m b/src/ios/CDVCamera.m
index d5d3ba4..57f4924 100644
--- a/src/ios/CDVCamera.m
+++ b/src/ios/CDVCamera.m
@@ -109,14 +109,12 @@ static NSString* toBase64(NSData* data) {
- (NSURL*) urlTransformer:(NSURL*)url
{
NSURL* urlToTransform = url;
- __weak CDVCamera* weakSelf = self;
// for backwards compatibility - we check if this property is there
SEL sel = NSSelectorFromString(@"urlTransformer");
if ([self.commandDelegate respondsToSelector:sel]) {
-
// grab the block from the commandDelegate
- NSURL* (^urlTransformer)(NSURL*) = ((id(*)(id, SEL))objc_msgSend)(weakSelf.commandDelegate, sel);
+ NSURL* (^urlTransformer)(NSURL*) = ((id(*)(id, SEL))objc_msgSend)(self.commandDelegate, sel);
// if block is not null, we call it
if (urlTransformer) {
urlToTransform = urlTransformer(url);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org