New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

cordova-plugin-camera

Package Overview
Dependencies
Maintainers
18
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cordova-plugin-camera - npm Package Compare versions

Comparing version 6.0.0 to 7.0.0

17

package.json
{
"name": "cordova-plugin-camera",
"version": "6.0.0",
"version": "7.0.0",
"description": "Cordova Camera Plugin",

@@ -11,5 +11,3 @@ "types": "./types/index.d.ts",

"ios",
"browser",
"windows",
"osx"
"browser"
]

@@ -25,5 +23,3 @@ },

"cordova-ios",
"cordova-browser",
"cordova-windows",
"cordova-osx"
"cordova-browser"
],

@@ -61,2 +57,7 @@ "scripts": {

"7.0.0": {
"cordova-android": ">=12.0.0",
"cordova-ios": ">=5.1.0",
"cordova": ">=9.0.0"
},
"8.0.0": {
"cordova": ">100"

@@ -67,4 +68,4 @@ }

"devDependencies": {
"@cordova/eslint-config": "^3.0.0"
"@cordova/eslint-config": "^5.0.0"
}
}

@@ -24,8 +24,6 @@ ---

|AppVeyor|Travis CI|
|:-:|:-:|
|[![Build status](https://ci.appveyor.com/api/projects/status/github/apache/cordova-plugin-camera?branch=master)](https://ci.appveyor.com/project/ApacheSoftwareFoundation/cordova-plugin-camera)|[![Build Status](https://travis-ci.org/apache/cordova-plugin-camera.svg?branch=master)](https://travis-ci.org/apache/cordova-plugin-camera)|
# cordova-plugin-camera
[![Android Testsuite](https://github.com/apache/cordova-plugin-camera/actions/workflows/android.yml/badge.svg)](https://github.com/apache/cordova-plugin-camera/actions/workflows/android.yml) [![Chrome Testsuite](https://github.com/apache/cordova-plugin-camera/actions/workflows/chrome.yml/badge.svg)](https://github.com/apache/cordova-plugin-camera/actions/workflows/chrome.yml) [![iOS Testsuite](https://github.com/apache/cordova-plugin-camera/actions/workflows/ios.yml/badge.svg)](https://github.com/apache/cordova-plugin-camera/actions/workflows/ios.yml) [![Lint Test](https://github.com/apache/cordova-plugin-camera/actions/workflows/lint.yml/badge.svg)](https://github.com/apache/cordova-plugin-camera/actions/workflows/lint.yml)
This plugin defines a global `navigator.camera` object, which provides an API for taking pictures and for choosing images from

@@ -44,8 +42,4 @@ the system's image library.

This requires cordova 5.0+
cordova plugin add cordova-plugin-camera
Older versions of cordova can still install via the __deprecated__ id
cordova plugin add org.apache.cordova.camera
It is also possible to install via repo url directly ( unstable )

@@ -55,3 +49,11 @@

## Plugin variables
The plugin uses the `ANDROIDX_CORE_VERSION` variable to configure `androidx.core:core` dependency. This allows to avoid conflicts with other plugins that have the dependency hardcoded.
If no value is passed, it will use `1.6.+` as the default value.
The variable is configured on install time
cordova plugin add cordova-plugin-camera --variable ANDROIDX_CORE_VERSION=1.8.0
## How to Contribute

@@ -176,4 +178,2 @@

- iOS
- Windows
- OSX

@@ -481,12 +481,2 @@ More examples [here](#camera-getPicture-examples). Quirks [here](#camera-getPicture-quirks).

#### Windows quirks
On Windows Phone 8.1 using `SAVEDPHOTOALBUM` or `PHOTOLIBRARY` as a source type causes application to suspend until file picker returns the selected image and
then restore with start page as defined in app's `config.xml`. In case when `camera.getPicture` was called from different page, this will lead to reloading
start page from scratch and success and error callbacks will never be called.
To avoid this we suggest using SPA pattern or call `camera.getPicture` only from your app's start page.
More information about Windows Phone 8.1 picker APIs is here: [How to continue your Windows Phone app after calling a file picker](https://msdn.microsoft.com/en-us/library/windows/apps/dn720490.aspx)
## `CameraOptions` Errata <a name="CameraOptions-quirks"></a>

@@ -577,8 +567,2 @@

To display the image on some platforms, you might need to include the main part of the URI in the Content-Security-Policy `<meta>` element in index.html. For example, on Windows 10, you can include `ms-appdata:` in your `<meta>` element. Here is an example.
```html
<meta http-equiv="Content-Security-Policy" content="default-src 'self' data: gap: ms-appdata: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *">
```
## Take a Picture and Return Thumbnails (Resize the Picture) <a name="getThumbnails"></a>

@@ -585,0 +569,0 @@

@@ -23,2 +23,37 @@ <!--

### 7.0.0 (Sep 06, 2023)
**Breaking Changes:**
* [GH-848](https://github.com/apache/cordova-plugin-camera/pull/848) fix!: remove deprecated platforms
* [GH-844](https://github.com/apache/cordova-plugin-camera/pull/844) feat(android)!: Android 13 support
**Fixes:**
* [GH-827](https://github.com/apache/cordova-plugin-camera/pull/827) fix(android): set `applicationId`
* [GH-810](https://github.com/apache/cordova-plugin-camera/pull/810) fix(browser): use `navigator.mediaDevices.getUserMedia`
* [GH-712](https://github.com/apache/cordova-plugin-camera/pull/712) fix(ios): preserving `EXIF` data
* [GH-780](https://github.com/apache/cordova-plugin-camera/pull/780) fix(android): update queries in `plugin.xml`
**Chores, Dependencies, Docs:**
* [GH-850](https://github.com/apache/cordova-plugin-camera/pull/850) chore: remove windows/osx from `plugin.xml`
* [GH-849](https://github.com/apache/cordova-plugin-camera/pull/849) chore: Update `SUPPORT_QUESTION.md` template
* [GH-831](https://github.com/apache/cordova-plugin-camera/pull/831) chore(android): Cleanup obsolete `BuildConfig` comments
* [GH-846](https://github.com/apache/cordova-plugin-camera/pull/846) dep(dev)!: bump `@cordova/eslint-config@5.0`
* [GH-800](https://github.com/apache/cordova-plugin-camera/pull/800) dep(npm): bump package-lock v2 w/ rebuild
* [GH-808](https://github.com/apache/cordova-plugin-camera/pull/808) docs(README): Document `ANDROIDX_CORE_VERSION` variable
**CI:**
* [GH-851](https://github.com/apache/cordova-plugin-camera/pull/851) ci(gh-action): sync with `paramedic` configs
* [GH-835](https://github.com/apache/cordova-plugin-camera/pull/835) ci(android): Drop API 22 & 31. Added API 24 & 33
* [GH-804](https://github.com/apache/cordova-plugin-camera/pull/804) ci: sync workflow with `paramedic`
* [GH-798](https://github.com/apache/cordova-plugin-camera/pull/798) ci(android): update java requirement for `cordova-android@11`
* [GH-770](https://github.com/apache/cordova-plugin-camera/pull/770) ci(ios): update workflow w/ iOS 15
* [GH-766](https://github.com/apache/cordova-plugin-camera/pull/766) ci: remove old ci workflow
* [GH-765](https://github.com/apache/cordova-plugin-camera/pull/765) ci: add action-badge
* [GH-764](https://github.com/apache/cordova-plugin-camera/pull/764) ci: remove `travis` & `appveyor`
* [GH-762](https://github.com/apache/cordova-plugin-camera/pull/762) ci: add `gh-actions` workflows
### 6.0.0 (Aug 19, 2021)

@@ -25,0 +60,0 @@

@@ -22,3 +22,3 @@ /*

var HIGHEST_POSSIBLE_Z_INDEX = 2147483647;
const HIGHEST_POSSIBLE_Z_INDEX = 2147483647;

@@ -29,3 +29,3 @@ function takePicture (success, error, opts) {

} else {
var input = document.createElement('input');
const input = document.createElement('input');
input.style.position = 'relative';

@@ -38,7 +38,7 @@ input.style.zIndex = HIGHEST_POSSIBLE_Z_INDEX;

input.onchange = function (inputEvent) {
var reader = new FileReader(); /* eslint no-undef : 0 */
const reader = new FileReader(); /* eslint no-undef : 0 */
reader.onload = function (readerEvent) {
input.parentNode.removeChild(input);
var imageData = readerEvent.target.result;
const imageData = readerEvent.target.result;

@@ -56,5 +56,5 @@ return success(imageData.substr(imageData.indexOf(',') + 1));

function capture (success, errorCallback, opts) {
var localMediaStream;
var targetWidth = opts[3];
var targetHeight = opts[4];
let localMediaStream;
let targetWidth = opts[3];
let targetHeight = opts[4];

@@ -64,5 +64,5 @@ targetWidth = targetWidth === -1 ? 320 : targetWidth;

var video = document.createElement('video');
var button = document.createElement('button');
var parent = document.createElement('div');
const video = document.createElement('video');
const button = document.createElement('button');
const parent = document.createElement('div');
parent.style.position = 'relative';

@@ -80,3 +80,3 @@ parent.style.zIndex = HIGHEST_POSSIBLE_Z_INDEX;

// create a canvas and capture a frame from video stream
var canvas = document.createElement('canvas');
const canvas = document.createElement('canvas');
canvas.width = targetWidth;

@@ -87,3 +87,3 @@ canvas.height = targetHeight;

// convert image stored in canvas to base64 encoded image
var imageData = canvas.toDataURL('image/png');
let imageData = canvas.toDataURL('image/png');
imageData = imageData.replace('data:image/png;base64,', '');

@@ -110,3 +110,3 @@

var successCallback = function (stream) {
const successCallback = function (stream) {
localMediaStream = stream;

@@ -122,3 +122,7 @@ if ('srcObject' in video) {

if (navigator.getUserMedia) {
if (navigator.mediaDevices.getUserMedia) {
navigator.mediaDevices.getUserMedia({ video: true, audio: false })
.then(successCallback)
.catch(errorCallback);
} else if (navigator.getUserMedia) {
navigator.getUserMedia({ video: true, audio: false }, successCallback, errorCallback);

@@ -131,3 +135,3 @@ } else {

module.exports = {
takePicture: takePicture,
takePicture,
cleanup: function () {}

@@ -134,0 +138,0 @@ };

@@ -22,5 +22,5 @@ /*

var argscheck = require('cordova/argscheck');
var exec = require('cordova/exec');
var Camera = require('./Camera');
const argscheck = require('cordova/argscheck');
const exec = require('cordova/exec');
const Camera = require('./Camera');
// XXX: commented out

@@ -36,6 +36,6 @@ // CameraPopoverHandle = require('./CameraPopoverHandle');

*/
var cameraExport = {};
const cameraExport = {};
// Tack on the Camera Constants to the base camera plugin.
for (var key in Camera) {
for (const key in Camera) {
cameraExport[key] = Camera[key];

@@ -119,10 +119,4 @@ }

* - Android
* - BlackBerry
* - Browser
* - Firefox
* - FireOS
* - iOS
* - Windows
* - WP8
* - Ubuntu
*

@@ -140,18 +134,18 @@ * More examples [here](#camera-getPicture-examples). Quirks [here](#camera-getPicture-quirks).

options = options || {};
var getValue = argscheck.getValue;
const getValue = argscheck.getValue;
var quality = getValue(options.quality, 50);
var destinationType = getValue(options.destinationType, Camera.DestinationType.FILE_URI);
var sourceType = getValue(options.sourceType, Camera.PictureSourceType.CAMERA);
var targetWidth = getValue(options.targetWidth, -1);
var targetHeight = getValue(options.targetHeight, -1);
var encodingType = getValue(options.encodingType, Camera.EncodingType.JPEG);
var mediaType = getValue(options.mediaType, Camera.MediaType.PICTURE);
var allowEdit = !!options.allowEdit;
var correctOrientation = !!options.correctOrientation;
var saveToPhotoAlbum = !!options.saveToPhotoAlbum;
var popoverOptions = getValue(options.popoverOptions, null);
var cameraDirection = getValue(options.cameraDirection, Camera.Direction.BACK);
const quality = getValue(options.quality, 50);
const destinationType = getValue(options.destinationType, Camera.DestinationType.FILE_URI);
const sourceType = getValue(options.sourceType, Camera.PictureSourceType.CAMERA);
const targetWidth = getValue(options.targetWidth, -1);
const targetHeight = getValue(options.targetHeight, -1);
const encodingType = getValue(options.encodingType, Camera.EncodingType.JPEG);
const mediaType = getValue(options.mediaType, Camera.MediaType.PICTURE);
const allowEdit = !!options.allowEdit;
const correctOrientation = !!options.correctOrientation;
const saveToPhotoAlbum = !!options.saveToPhotoAlbum;
const popoverOptions = getValue(options.popoverOptions, null);
const cameraDirection = getValue(options.cameraDirection, Camera.Direction.BACK);
var args = [quality, destinationType, sourceType, targetWidth, targetHeight, encodingType,
const args = [quality, destinationType, sourceType, targetWidth, targetHeight, encodingType,
mediaType, allowEdit, correctOrientation, saveToPhotoAlbum, popoverOptions, cameraDirection];

@@ -158,0 +152,0 @@

@@ -26,3 +26,3 @@ /*

*/
var CameraPopoverHandle = function () {
const CameraPopoverHandle = function () {
this.setPosition = function (popoverOptions) {

@@ -29,0 +29,0 @@ console.log('CameraPopoverHandle.setPosition is only supported on iOS.');

@@ -22,3 +22,3 @@ /*

var Camera = require('./Camera');
const Camera = require('./Camera');

@@ -46,3 +46,3 @@ /**

*/
var CameraPopoverOptions = function (x, y, width, height, arrowDir, popoverWidth, popoverHeight) {
const CameraPopoverOptions = function (x, y, width, height, arrowDir, popoverWidth, popoverHeight) {
// information of rectangle that popover should be anchored to

@@ -49,0 +49,0 @@ this.x = x || 0;

@@ -22,3 +22,3 @@ /*

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

@@ -52,3 +52,3 @@ /**

*/
var CameraPopoverHandle = function () {
const CameraPopoverHandle = function () {
/**

@@ -63,3 +63,3 @@ * Can be used to reposition the image selection dialog,

this.setPosition = function (popoverOptions) {
var args = [popoverOptions];
const args = [popoverOptions];
exec(null, null, 'Camera', 'repositionPopover', args);

@@ -66,0 +66,0 @@ };

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc