Skip to content

Commit

Permalink
[IOS] [COMMON] Added a handle to camera popovers. [CB-2411]
Browse files Browse the repository at this point in the history
This is returned by Camera.getPicture.  Developers can use this to reposition the popover.
CameraPopoverHandle.setPosition is a no-op on non-iOS platforms.
  • Loading branch information
mwoghiren authored and Becky Gibson committed Feb 21, 2013
1 parent 64a70f9 commit 73b6ece
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/common/plugin/Camera.js
Expand Up @@ -21,7 +21,8 @@

var argscheck = require('cordova/argscheck'),
exec = require('cordova/exec'),
Camera = require('cordova/plugin/CameraConstants');
Camera = require('cordova/plugin/CameraConstants'),
CameraPopoverHandle = require('cordova/plugin/CameraPopoverHandle');

var cameraExport = {};

Expand Down Expand Up @@ -61,6 +62,7 @@ cameraExport.getPicture = function(successCallback, errorCallback, options) {
mediaType, allowEdit, correctOrientation, saveToPhotoAlbum, popoverOptions];

exec(successCallback, errorCallback, "Camera", "takePicture", args);
return new CameraPopoverHandle();
};

cameraExport.cleanup = function(successCallback, errorCallback) {
Expand Down
33 changes: 33 additions & 0 deletions lib/common/plugin/CameraPopoverHandle.js
@@ -0,0 +1,33 @@
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/

var exec = require('cordova/exec');

/**
* A handle to an image picker popover.
*/
var CameraPopoverHandle = function() {
this.setPosition = function(popoverOptions) {
console.log('CameraPopoverHandle.setPosition is only supported on iOS.');
};
};

module.exports = CameraPopoverHandle;
34 changes: 34 additions & 0 deletions lib/ios/plugin/CameraPopoverHandle.js
@@ -0,0 +1,34 @@
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/

var exec = require('cordova/exec');

/**
* A handle to an image picker popover.
*/
var CameraPopoverHandle = function() {
this.setPosition = function(popoverOptions) {
var args = [ popoverOptions ];
exec(null, null, "Camera", "repositionPopover", args);
};
};

module.exports = CameraPopoverHandle;

0 comments on commit 73b6ece

Please sign in to comment.