mirror of
https://github.com/apache/cordova-plugin-camera.git
synced 2026-02-03 00:06:46 +08:00
Compare commits
22 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
799ed580d3 | ||
|
|
80b0048384 | ||
|
|
2ead6335c9 | ||
|
|
2a0735d551 | ||
|
|
4f056f0a73 | ||
|
|
376bec2b96 | ||
|
|
482f2ac2cc | ||
|
|
35c653d24d | ||
|
|
3ab650bdc9 | ||
|
|
2045e0a644 | ||
|
|
032531ae77 | ||
|
|
fb4cff9cc0 | ||
|
|
0d389857cf | ||
|
|
8b8db828f6 | ||
|
|
03fade661e | ||
|
|
c06ae46485 | ||
|
|
dbe33a44ff | ||
|
|
021743f20e | ||
|
|
53e42fc97b | ||
|
|
7413c1bcb2 | ||
|
|
860fedece4 | ||
|
|
9adc39ca2c |
@@ -147,3 +147,22 @@
|
||||
* Renamed test dir, added nested plugin.xml
|
||||
* CB-6958 added manual tests
|
||||
* CB-6958 Port camera tests to plugin-test-framework
|
||||
|
||||
### 0.3.3 (Oct 03, 2014)
|
||||
* CB-7600 Adds informative message to error callback in manual test.
|
||||
|
||||
### 0.3.4 (Dec 02, 2014)
|
||||
* CB-7977 Mention `deviceready` in plugin docs
|
||||
* CB-7979 Each plugin doc should have a ## Installation section
|
||||
* Fix memory leak of image data in `imagePickerControllerReturnImageResult`
|
||||
* Pass uri to crop instead of pulling the low resolution image out of the intent return (close #43)
|
||||
* Add orientation support for PNG to Android (closes #45)
|
||||
* CB-7700 cordova-plugin-camera documentation translation: cordova-plugin-camera
|
||||
|
||||
### 0.3.5 (Feb 04, 2015)
|
||||
* CB-8351 ios: Stop using now-deprecated [NSData base64EncodedString]
|
||||
* CB-8351 ios: Stop using now-deprecated integerValueForKey: class extension
|
||||
* CB-8351 ios: Use argumentForIndex rather than NSArray extension
|
||||
* CB-8032 ios: Add nativeURL external method support for CDVFileSystem->makeEntryForPath:isDirectory:
|
||||
* CB-7938 ios: Added XCTest unit tests project, with stubs (adapted from SplashScreen unit test setup)
|
||||
* CB-7937 ios: Re-factor iOS Camera plugin so that it is testable
|
||||
|
||||
@@ -78,7 +78,7 @@ Sie können tun, was Sie wollen, mit dem codierten Bildes oder URI, zum Beispiel
|
||||
|
||||
Amazon Fire OS verwendet Absichten zum Starten von der Kamera-Aktivität auf dem Gerät, um Bilder zu erfassen und auf Handys mit wenig Speicher, Cordova Tätigkeit getötet werden kann. In diesem Szenario kann das Bild nicht angezeigt, wenn die Aktivität von Cordova wiederhergestellt wird.
|
||||
|
||||
### Android Macken
|
||||
### Android Eigenarten
|
||||
|
||||
Android verwendet Absichten zum Starten von der Kamera-Aktivität auf dem Gerät, um Bilder zu erfassen und auf Handys mit wenig Speicher, Cordova Tätigkeit getötet werden kann. In diesem Szenario kann das Bild nicht angezeigt, wenn die Aktivität von Cordova wiederhergestellt wird.
|
||||
|
||||
@@ -214,7 +214,7 @@ Optionale Parameter die Kameraeinstellungen anpassen.
|
||||
|
||||
* `Camera.PictureSourceType.PHOTOLIBRARY`und `Camera.PictureSourceType.SAVEDPHOTOALBUM` beide das gleiche Fotoalbum anzuzeigen.
|
||||
|
||||
### Android Macken
|
||||
### Android Eigenarten
|
||||
|
||||
* `cameraDirection`Ergebnisse in einem hinten gerichteter Foto Wert.
|
||||
|
||||
@@ -266,7 +266,7 @@ Optionale Parameter die Kameraeinstellungen anpassen.
|
||||
|
||||
* gibt immer einen Datei-URI
|
||||
|
||||
### Windows Phone 7 und 8 Macken
|
||||
### Windows Phone 7 und 8 Eigenarten
|
||||
|
||||
* Ignoriert die `allowEdit` Parameter.
|
||||
|
||||
|
||||
@@ -26,38 +26,38 @@ Este plugin proporciona una API para tomar fotografías y por elegir imágenes d
|
||||
|
||||
## navigator.camera.getPicture
|
||||
|
||||
Toma una foto con la cámara, o recupera una foto de Galería de imágenes del dispositivo. La imagen se pasa a la devolución de llamada de éxito como un codificado en base64 `String` , o como el URI para el archivo de imagen. El método se devuelve un `CameraPopoverHandle` objeto que puede utilizarse para volver a colocar el popover de selección de archivo.
|
||||
Toma una foto con la cámara, u obtiene una foto de la galería de imágenes del dispositivo. La imagen es retornada como un objeto `String` codificada en base64 o como la URI de esta. El método devuelve un objeto `CameraPopoverHandle` que puede usarse para reposicionar el diálogo de selección de archivo.
|
||||
|
||||
navigator.camera.getPicture( cameraSuccess, cameraError, cameraOptions );
|
||||
|
||||
|
||||
### Descripción
|
||||
|
||||
El `camera.getPicture` función abre la aplicación de cámara predeterminada del dispositivo que permite a los usuarios ajustar imágenes. Este comportamiento se produce de forma predeterminada, cuando `Camera.sourceType` es igual a `Camera.PictureSourceType.CAMERA` . Una vez que el usuario ajusta la foto, una aplicación de cámara se cierra y se restablecerá la aplicación.
|
||||
La función `camera.getPicture` abre la aplicación predeterminada de cámara del dispositivo que permite a los usuarios tomar fotografías. Este comportamiento es el predeterminado, cuando `Camera.sourceType` es igual a `Camera.PictureSourceType.CAMERA`. Una vez que el usuario toma la foto, la aplicación de la cámara se cierra y se restablece la aplicación.
|
||||
|
||||
Si `Camera.sourceType` es `Camera.PictureSourceType.PHOTOLIBRARY` o `Camera.PictureSourceType.SAVEDPHOTOALBUM` , entonces una muestra de diálogo que permite a los usuarios seleccionar una imagen existente. El `camera.getPicture` función devuelve un `CameraPopoverHandle` objeto, que puede utilizarse para volver a colocar el diálogo de selección de imagen, por ejemplo, cuando cambia la orientación del dispositivo.
|
||||
Si `Camera.sourceType` es `Camera.PictureSourceType.PHOTOLIBRARY` o `Camera.PictureSourceType.SAVEDPHOTOALBUM`, entonces aperece un cuadro de diálogo que permite a los usuarios seleccionar una imagen existente. La función `camera.getPicture` devuelve un objeto `CameraPopoverHandle`, que puede utilizarse para reposicionar el diálogo de selección de imagen, por ejemplo, cuando cambia la orientación del dispositivo.
|
||||
|
||||
El valor devuelto es enviado a la `cameraSuccess` función de callback, en uno de los formatos siguientes, dependiendo del objeto `cameraOptions` :
|
||||
El valor devuelto es enviado a la función `cameraSuccess`, en uno de los formatos siguientes, dependiendo de `cameraOptions` especificadas:
|
||||
|
||||
* A `String` que contiene la imagen codificada en base64.
|
||||
* Una `String` que contiene la imagen codificada en base64.
|
||||
|
||||
* A `String` que representa la ubicación del archivo de imagen de almacenamiento local (por defecto).
|
||||
* Una `String` que representa la ubicación del archivo de imagen en almacenamiento local (por defecto).
|
||||
|
||||
Puedes hacer lo que quieras con la imagen codificada o URI, por ejemplo:
|
||||
|
||||
* Utilidad de la imagen en un `<img>` etiqueta, como en el ejemplo siguiente
|
||||
* Representar la imagen en una etiqueta de `<img>`, como en el ejemplo siguiente
|
||||
|
||||
* Guardar los datos localmente ( `LocalStorage` , [Lawnchair][1], etc..)
|
||||
* Guardar los datos localmente (`LocalStorage`, [Lawnchair][1], etc.)
|
||||
|
||||
* Enviar los datos a un servidor remoto
|
||||
|
||||
[1]: http://brianleroux.github.com/lawnchair/
|
||||
|
||||
**Nota**: resolución de la foto en los nuevos dispositivos es bastante bueno. Fotos seleccionadas de la Galería del dispositivo no son degradadas a una calidad más baja, incluso si un `quality` se especifica el parámetro. Para evitar problemas con la memoria común, establezca `Camera.destinationType` a `FILE_URI` en lugar de`DATA_URL`.
|
||||
**Nota**: resolución de la foto en los nuevos dispositivos es bastante bueno. Fotos seleccionadas de la Galería del dispositivo no son degradadas a una calidad más baja, incluso si se especifica un parámetro de `quality`. Para evitar problemas comunes de memoria, establezca `Camera.destinationType` como `FILE_URI` en lugar de `DATA_URL`.
|
||||
|
||||
### Plataformas soportadas
|
||||
|
||||
* Amazon fuego OS
|
||||
* Amazon fire OS
|
||||
* Android
|
||||
* BlackBerry 10
|
||||
* Explorador
|
||||
@@ -76,11 +76,11 @@ Puedes hacer lo que quieras con la imagen codificada o URI, por ejemplo:
|
||||
|
||||
### Amazon fuego OS rarezas
|
||||
|
||||
Amazon fuego OS utiliza los intentos para poner en marcha la actividad de la cámara del dispositivo para capturar imágenes y en teléfonos con poca memoria, puede matar la actividad Cordova. En este escenario, la imagen no aparezca cuando se restaura la actividad cordova.
|
||||
Amazon fuego OS utiliza los intentos para poner en marcha la actividad de la cámara del dispositivo para capturar imágenes y en teléfonos con poca memoria, puede matar la actividad Cordova. En este escenario, la imagen puede que no aparezca cuando se restaura la actividad de cordova.
|
||||
|
||||
### Rarezas Android
|
||||
|
||||
Android utiliza los intentos para iniciar la actividad de la cámara del dispositivo para capturar imágenes, y en los teléfonos con poca memoria, puede matar la actividad Cordova. En este escenario, la imagen no aparezca cuando se restaura la actividad Cordova.
|
||||
Android utiliza los intents para iniciar la actividad de la cámara del dispositivo para capturar imágenes y en teléfonos con poca memoria, la actividad de Cordova puede ser terminada. En este escenario, la imagen no aparezca cuando se restaura la actividad Cordova.
|
||||
|
||||
### Navegador rarezas
|
||||
|
||||
@@ -94,7 +94,7 @@ Cámara plugin actualmente se implementa mediante [Actividades Web][2].
|
||||
|
||||
### iOS rarezas
|
||||
|
||||
Incluyendo un JavaScript `alert()` en cualquiera de la devolución de llamada funciones pueden causar problemas. Envuelva la alerta dentro de un `setTimeout()` para permitir que el selector de imagen iOS o popover cerrar completamente antes de la alerta se muestra:
|
||||
Incluyendo un JavaScript `alert()` en cualquiera de las funciones de devolución de llamada puede causar problemas. Envolver la alerta dentro un `setTimeout()` para permitir el iOS image picker o popover cerrar completamente antes de Mostrar la alerta:
|
||||
|
||||
setTimeout(function() {
|
||||
// do your thing here!
|
||||
@@ -107,7 +107,7 @@ Invocando la aplicación de cámara nativa mientras el dispositivo está conecta
|
||||
|
||||
### Rarezas Tizen
|
||||
|
||||
Tizen sólo es compatible con un `destinationType` de `Camera.DestinationType.FILE_URI` y un `sourceType` de`Camera.PictureSourceType.PHOTOLIBRARY`.
|
||||
Tizen sólo admite un `destinationType` de `Camera.DestinationType.FILE_URI` y un `sourceType` de `Camera.PictureSourceType.PHOTOLIBRARY`.
|
||||
|
||||
### Ejemplo
|
||||
|
||||
@@ -218,19 +218,19 @@ Parámetros opcionales para personalizar la configuración de la cámara.
|
||||
|
||||
### Amazon fuego OS rarezas
|
||||
|
||||
* Cualquier `cameraDirection` valor resultados en una foto orientada hacia atrás.
|
||||
* Cualquier valor de `cameraDirection` da como resultado una foto orientada hacia atrás.
|
||||
|
||||
* Ignora el `allowEdit` parámetro.
|
||||
|
||||
* `Camera.PictureSourceType.PHOTOLIBRARY`y `Camera.PictureSourceType.SAVEDPHOTOALBUM` ambas muestran el mismo álbum de fotos.
|
||||
* `Camera.PictureSourceType.PHOTOLIBRARY` y `Camera.PictureSourceType.SAVEDPHOTOALBUM` Mostrar el mismo álbum de fotos.
|
||||
|
||||
### Rarezas Android
|
||||
|
||||
* Cualquier `cameraDirection` valor resultados en una foto orientada hacia atrás.
|
||||
* Cualquier valor de `cameraDirection` da como resultado una foto orientada hacia atrás.
|
||||
|
||||
* Ignora el `allowEdit` parámetro.
|
||||
|
||||
* `Camera.PictureSourceType.PHOTOLIBRARY`y `Camera.PictureSourceType.SAVEDPHOTOALBUM` ambas muestran el mismo álbum de fotos.
|
||||
* `Camera.PictureSourceType.PHOTOLIBRARY` y `Camera.PictureSourceType.SAVEDPHOTOALBUM` Mostrar el mismo álbum de fotos.
|
||||
|
||||
### BlackBerry 10 rarezas
|
||||
|
||||
@@ -405,7 +405,7 @@ Elimina intermedio fotos tomadas por la cámara de almacenamiento temporal.
|
||||
|
||||
### Descripción
|
||||
|
||||
Elimina intermedio archivos de imagen que se mantienen en depósito temporal después de llamar `camera.getPicture` . Se aplica sólo cuando el valor de `Camera.sourceType` es igual a `Camera.PictureSourceType.CAMERA` y el `Camera.destinationType` es igual a`Camera.DestinationType.FILE_URI`.
|
||||
Elimina los archivos de imagen intermedia que se mantienen en depósito temporal después de llamar a `camera.getPicture`. Se aplica sólo cuando el valor de `Camera.sourceType` es igual a `Camera.PictureSourceType.CAMERA` y el `Camera.destinationType` es igual a `Camera.DestinationType.FILE_URI`.
|
||||
|
||||
### Plataformas soportadas
|
||||
|
||||
|
||||
12
doc/index.md
12
doc/index.md
@@ -19,11 +19,19 @@
|
||||
|
||||
# org.apache.cordova.camera
|
||||
|
||||
This plugin provides an API for taking pictures and for choosing images from
|
||||
This plugin defines a global `navigator.camera` object, which provides an API for taking pictures and for choosing images from
|
||||
the system's image library.
|
||||
|
||||
cordova plugin add org.apache.cordova.camera
|
||||
Although the object is attached to the global scoped `navigator`, it is not available until after the `deviceready` event.
|
||||
|
||||
document.addEventListener("deviceready", onDeviceReady, false);
|
||||
function onDeviceReady() {
|
||||
console.log(navigator.camera);
|
||||
}
|
||||
|
||||
## Installation
|
||||
|
||||
cordova plugin add org.apache.cordova.camera
|
||||
|
||||
## navigator.camera.getPicture
|
||||
|
||||
|
||||
136
doc/pl/index.md
136
doc/pl/index.md
@@ -39,17 +39,17 @@ Jeśli `Camera.sourceType` jest równe `Camera.PictureSourceType.PHOTOLIBRARY` l
|
||||
|
||||
Zwracana wartość jest wysyłana do funkcji zwrotnej `cameraSuccess` w jednym z następujących formatów, w zależności od określonego parametru `cameraOptions`:
|
||||
|
||||
* Jako `String` zawierający obraz zakodowany przy użyciu base64.
|
||||
* `String` zawierający obraz zakodowany przy pomocy base64.
|
||||
|
||||
* Jako `String` reprezentujący lokację pliku obrazu w lokalnym magazynie (domyślnie).
|
||||
* `String` reprezentujący lokalizację pliku obrazu w lokalnym magazynie (domyślnie).
|
||||
|
||||
Z zakodowanym obrazem lub URI możesz zrobić co zechcesz, na przykład:
|
||||
|
||||
* Przedstawia obraz w tagu `<img>`, jak w przykładzie poniżej
|
||||
* Przedstawić obraz w tagu `<img>`, jak w przykładzie poniżej
|
||||
|
||||
* Zapisuje dane lokalnie (`LocalStorage`, [Lawnchair][1], etc.)
|
||||
* Zapisać lokalnie dane (`LocalStorage`, [Lawnchair][1], etc.)
|
||||
|
||||
* Wysyła dane na zdalny serwer
|
||||
* Wysłać dane na zdalny serwer
|
||||
|
||||
[1]: http://brianleroux.github.com/lawnchair/
|
||||
|
||||
@@ -57,9 +57,9 @@ Z zakodowanym obrazem lub URI możesz zrobić co zechcesz, na przykład:
|
||||
|
||||
### Obsługiwane platformy
|
||||
|
||||
* Amazon ogień OS
|
||||
* Amazon Fire OS
|
||||
* Android
|
||||
* Jeżyna 10
|
||||
* BlackBerry 10
|
||||
* Przeglądarka
|
||||
* Firefox OS
|
||||
* iOS
|
||||
@@ -78,9 +78,9 @@ Z zakodowanym obrazem lub URI możesz zrobić co zechcesz, na przykład:
|
||||
|
||||
Amazon ogień OS używa intencje do rozpoczęcia działalności aparatu na urządzenie do przechwytywania obrazów, i na telefony z pamięci, Cordova aktywność może zostać zabity. W takim scenariuszu obrazy mogą nie być wyświetlane po przywróceniu aktywności Cordovy.
|
||||
|
||||
### Android dziwactwa
|
||||
### Dziwactwa Androida
|
||||
|
||||
Android używa intencje do rozpoczęcia działalności aparatu na urządzenie do przechwytywania obrazów, i na telefony z pamięci, Cordova aktywność może zostać zabity. W tym scenariuszu obraz mogą nie być wyświetlane po przywróceniu aktywności Cordova.
|
||||
Android używa Intencji (Intents) do uruchomienia aktywności aparatu i na urządzeniach z małą ilością dostępnej pamięci aktywność Cordova może zostać przerwana. W tym scenariuszu obraz mogą nie być wyświetlane po przywróceniu aktywności Cordova.
|
||||
|
||||
### Quirks przeglądarki
|
||||
|
||||
@@ -92,26 +92,26 @@ Aparat plugin jest obecnie implementowane za pomocą [Działania sieci Web][2].
|
||||
|
||||
[2]: https://hacks.mozilla.org/2013/01/introducing-web-activities/
|
||||
|
||||
### iOS dziwactwa
|
||||
### Dziwactwa iOS
|
||||
|
||||
Tym JavaScript `alert()` w jednej z wywołania zwrotnego funkcji może powodować problemy. Owinąć alert w `setTimeout()` umożliwia wybór obrazu iOS lub popover całkowicie zamknąć zanim wyświetli alert:
|
||||
Umieszczenie w funkcji zwrotnej wywołania `alert()` w JavaScript może powodować problemy. Aby umożliwić systemowi iOS na całkowite zamknięcie okna wyboru obrazu lub wyskakującego powiadomienia przed wyświetleniem alarmu należy opakować go w `setTimeout()`:
|
||||
|
||||
setTimeout(function() {
|
||||
// do your thing here!
|
||||
}, 0);
|
||||
|
||||
|
||||
### Windows Phone 7 dziwactwa
|
||||
### Dziwactwa Windows Phone 7
|
||||
|
||||
Wywoływanie aparat native aplikacji, podczas gdy urządzenie jest podłączone przez Zune nie działa i powoduje błąd wywołania zwrotnego.
|
||||
|
||||
### Osobliwości Tizen
|
||||
### Dziwactwa Tizen
|
||||
|
||||
Tizen obsługuje tylko `destinationType` z `Camera.DestinationType.FILE_URI` i `sourceType` z`Camera.PictureSourceType.PHOTOLIBRARY`.
|
||||
Tizen obsługuje tylko parametr `destinationType` jako `Camera.DestinationType.FILE_URI` oraz `sourceType` jako `Camera.PictureSourceType.PHOTOLIBRARY`.
|
||||
|
||||
### Przykład
|
||||
|
||||
Zrób zdjęcie i pobrać go jako kodowane algorytmem base64 obrazu:
|
||||
Zrobienie zdjęcia i pobranie go jako obraz zakodowany base64:
|
||||
|
||||
navigator.camera.getPicture(onSuccess, onFail, { quality: 50,
|
||||
destinationType: Camera.DestinationType.DATA_URL
|
||||
@@ -127,7 +127,7 @@ Zrób zdjęcie i pobrać go jako kodowane algorytmem base64 obrazu:
|
||||
}
|
||||
|
||||
|
||||
Zrób zdjęcie i pobrać lokalizacji pliku obrazu:
|
||||
Zrobienie zdjęcia i pobranie lokacji pliku obrazu:
|
||||
|
||||
navigator.camera.getPicture(onSuccess, onFail, { quality: 50,
|
||||
destinationType: Camera.DestinationType.FILE_URI });
|
||||
@@ -144,7 +144,7 @@ Zrób zdjęcie i pobrać lokalizacji pliku obrazu:
|
||||
|
||||
## CameraOptions
|
||||
|
||||
Opcjonalne parametry, aby dostosować ustawienia aparatu.
|
||||
Opcjonalne parametry dostosowania ustawień aparatu.
|
||||
|
||||
{ quality : 75,
|
||||
destinationType : Camera.DestinationType.DATA_URL,
|
||||
@@ -159,7 +159,7 @@ Opcjonalne parametry, aby dostosować ustawienia aparatu.
|
||||
|
||||
### Opcje
|
||||
|
||||
* **jakość**: jakość zapisany obraz, wyrażona jako zakres od 0 do 100, gdzie 100 jest zazwyczaj pełnej rozdzielczości bez utraty z kompresji plików. Wartością domyślną jest 50. *(Liczba)* (Należy zauważyć, że informacje o rozdzielczość kamery jest niedostępny).
|
||||
* **quality**: Jakość zapisywanego obrazu, wyrażona w przedziale 0-100, gdzie 100 zazwyczaj jest maksymalną rozdzielczością bez strat w czasie kompresji pliku. Wartością domyślną jest 50. *(Liczba)* (Pamiętaj, że informacja o rozdzielczości aparatu jest niedostępna.)
|
||||
|
||||
* **destinationType**: Wybierz format zwracanej wartości. Wartością domyślną jest FILE_URI. Zdefiniowane w `navigator.camera.DestinationType` *(numer)*
|
||||
|
||||
@@ -179,7 +179,7 @@ Opcjonalne parametry, aby dostosować ustawienia aparatu.
|
||||
};
|
||||
|
||||
|
||||
* **allowEdit**: umożliwia łatwą edycję obrazu przed zaznaczeniem. *(Wartość logiczna)*
|
||||
* **allowEdit**: Pozwala na prostą edycję obrazu przed zaznaczeniem. *(Boolean)*
|
||||
|
||||
* **encodingType**: Wybierz plik obrazu zwracany jest kodowanie. Domyślnie jest JPEG. Zdefiniowane w `navigator.camera.EncodingType` *(numer)*
|
||||
|
||||
@@ -189,68 +189,68 @@ Opcjonalne parametry, aby dostosować ustawienia aparatu.
|
||||
};
|
||||
|
||||
|
||||
* **targetWidth**: szerokość w pikselach na obraz skali. Musi być używany z **targetHeight**. Współczynnik proporcji pozostaje stała. *(Liczba)*
|
||||
* **targetWidth**: Szerokość w pikselach skalowanego obrazu. Musi być użyte z **targetHeight**. Współczynnik proporcji pozostaje stały. *(Liczba)*
|
||||
|
||||
* **targetHeight**: wysokość w pikselach na obraz skali. Musi być używany z **targetWidth**. Współczynnik proporcji pozostaje stała. *(Liczba)*
|
||||
* **targetHeight**: Wysokość w pikselach skalowanego obrazu. Musi być użyte z **targetWidth**. Współczynnik proporcji pozostaje stały. *(Liczba)*
|
||||
|
||||
* **mediaType**: zestaw typ nośnika, do wyboru. Działa tylko, gdy `PictureSourceType` jest `PHOTOLIBRARY` lub `SAVEDPHOTOALBUM` . Zdefiniowane w `nagivator.camera.MediaType` *(numer)*
|
||||
* **mediaType**: Ustawia typ nośnika, z którego będzie wybrany. Działa tylko wtedy, gdy `PictureSourceType` jest `PHOTOLIBRARY` lub `SAVEDPHOTOALBUM`. Zdefiniowane w `nagivator.camera.MediaType` *(Liczba)*
|
||||
|
||||
Camera.MediaType = {
|
||||
PICTURE: 0, // allow selection of still pictures only. DOMYŚLNIE. Will return format specified via DestinationType
|
||||
PICTURE: 0, // umożliwia wybór tylko zdjęcia. DOMYŚLNIE. Will return format specified via DestinationType
|
||||
VIDEO: 1, // allow selection of video only, WILL ALWAYS RETURN FILE_URI
|
||||
ALLMEDIA : 2 // allow selection from all media types
|
||||
};
|
||||
|
||||
|
||||
* **correctOrientation**: obracanie obrazu dla orientacji urządzenia podczas przechwytywania. *(Wartość logiczna)*
|
||||
* **correctOrientation**: Obraca obraz aby skorygować orientację urządzenia podczas przechwytywania. *(Boolean)*
|
||||
|
||||
* **saveToPhotoAlbum**: Zapisz obraz do albumu fotograficznego na urządzenie po przechwytywania. *(Wartość logiczna)*
|
||||
* **saveToPhotoAlbum**: Po przechwyceniu zapisuje na urządzeniu obraz w albumie na zdjęcia. *(Boolean)*
|
||||
|
||||
* **popoverOptions**: tylko do iOS opcje, które określają położenie popover w iPad. Zdefiniowane w`CameraPopoverOptions`.
|
||||
* **popoverOptions**: Opcja tylko dla platformy iOS, która określa położenie wyskakującego okna na iPadzie. Zdefiniowane w `CameraPopoverOptions`.
|
||||
|
||||
* **cameraDirection**: Wybierz aparat do korzystania (lub z powrotem przodem). Wartością domyślną jest z powrotem. Zdefiniowane w `navigator.camera.Direction` *(numer)*
|
||||
|
||||
Camera.Direction = {
|
||||
BACK : 0, // Use the back-facing camera
|
||||
FRONT : 1 // Use the front-facing camera
|
||||
BACK : 0, // Używa tylnej kamery
|
||||
FRONT : 1 // Używa przedniej kamery
|
||||
};
|
||||
|
||||
|
||||
### Amazon ogień OS dziwactwa
|
||||
|
||||
* Wszelkie `cameraDirection` wartość wyników w zdjęcie tyłu do kierunku jazdy.
|
||||
* Jakakolwiek wartość w `cameraDirection` skutkuje użyciem tylnej kamery.
|
||||
|
||||
* Ignoruje `allowEdit` parametr.
|
||||
* Parametr `allowEdit` jest ignorowany.
|
||||
|
||||
* `Camera.PictureSourceType.PHOTOLIBRARY`i `Camera.PictureSourceType.SAVEDPHOTOALBUM` wyświetlać ten sam album zdjęć.
|
||||
* Oba parametry `Camera.PictureSourceType.PHOTOLIBRARY` oraz `Camera.PictureSourceType.SAVEDPHOTOALBUM` wyświetlają ten sam album ze zdjęciami.
|
||||
|
||||
### Android dziwactwa
|
||||
### Dziwactwa Androida
|
||||
|
||||
* Wszelkie `cameraDirection` wartość wyników w zdjęcie tyłu do kierunku jazdy.
|
||||
* Jakakolwiek wartość w `cameraDirection` skutkuje użyciem tylnej kamery.
|
||||
|
||||
* Ignoruje `allowEdit` parametr.
|
||||
* Parametr `allowEdit` jest ignorowany.
|
||||
|
||||
* `Camera.PictureSourceType.PHOTOLIBRARY`i `Camera.PictureSourceType.SAVEDPHOTOALBUM` wyświetlać ten sam album zdjęć.
|
||||
* Oba parametry `Camera.PictureSourceType.PHOTOLIBRARY` oraz `Camera.PictureSourceType.SAVEDPHOTOALBUM` wyświetlają ten sam album ze zdjęciami.
|
||||
|
||||
### Jeżyna 10 dziwactwa
|
||||
|
||||
* Ignoruje `quality` parametr.
|
||||
* Parametr `quality` jest ignorowany.
|
||||
|
||||
* Ignoruje `allowEdit` parametr.
|
||||
* Parametr `allowEdit` jest ignorowany.
|
||||
|
||||
* `Camera.MediaType`nie jest obsługiwane.
|
||||
* Nie jest wspierane `Camera.MediaType`.
|
||||
|
||||
* Ignoruje `correctOrientation` parametr.
|
||||
* Parametr `correctOrientation` jest ignorowany.
|
||||
|
||||
* Ignoruje `cameraDirection` parametr.
|
||||
* Parametr `cameraDirection` jest ignorowany.
|
||||
|
||||
### Firefox OS dziwactwa
|
||||
|
||||
* Ignoruje `quality` parametr.
|
||||
* Parametr `quality` jest ignorowany.
|
||||
|
||||
* `Camera.DestinationType`jest ignorowane i jest równa `1` (plik obrazu URI)
|
||||
|
||||
* Ignoruje `allowEdit` parametr.
|
||||
* Parametr `allowEdit` jest ignorowany.
|
||||
|
||||
* Ignoruje `PictureSourceType` parametr (użytkownik wybiera go w oknie dialogowym)
|
||||
|
||||
@@ -258,31 +258,31 @@ Opcjonalne parametry, aby dostosować ustawienia aparatu.
|
||||
|
||||
* Ignoruje `targetWidth` i`targetHeight`
|
||||
|
||||
* `Camera.MediaType`nie jest obsługiwane.
|
||||
* Nie jest wspierane `Camera.MediaType`.
|
||||
|
||||
* Ignoruje `correctOrientation` parametr.
|
||||
* Parametr `correctOrientation` jest ignorowany.
|
||||
|
||||
* Ignoruje `cameraDirection` parametr.
|
||||
* Parametr `cameraDirection` jest ignorowany.
|
||||
|
||||
### iOS dziwactwa
|
||||
### Dziwactwa iOS
|
||||
|
||||
* Zestaw `quality` poniżej 50 do uniknięcia błędy pamięci na niektóre urządzenia.
|
||||
* Ustaw `quality` poniżej 50 aby uniknąć błędów pamięci na niektórych urządzeniach.
|
||||
|
||||
* Podczas korzystania z `destinationType.FILE_URI` , zdjęcia są zapisywane w katalogu tymczasowego stosowania. Zawartość katalogu tymczasowego stosowania jest usuwany po zakończeniu aplikacji.
|
||||
|
||||
### Osobliwości Tizen
|
||||
### Dziwactwa Tizen
|
||||
|
||||
* opcje nie są obsługiwane
|
||||
|
||||
* zawsze zwraca identyfikator URI pliku
|
||||
* zawsze zwraca FILE URI
|
||||
|
||||
### Windows Phone 7 i 8 dziwactwa
|
||||
|
||||
* Ignoruje `allowEdit` parametr.
|
||||
* Parametr `allowEdit` jest ignorowany.
|
||||
|
||||
* Ignoruje `correctOrientation` parametr.
|
||||
* Parametr `correctOrientation` jest ignorowany.
|
||||
|
||||
* Ignoruje `cameraDirection` parametr.
|
||||
* Parametr `cameraDirection` jest ignorowany.
|
||||
|
||||
* Ignoruje `saveToPhotoAlbum` parametr. Ważne: Wszystkie zdjęcia zrobione aparatem wp7/8 cordova API są zawsze kopiowane do telefonu w kamerze. W zależności od ustawień użytkownika może to też oznaczać że obraz jest automatycznie przesłane do ich OneDrive. Potencjalnie może to oznaczać, że obraz jest dostępne dla szerszego grona odbiorców niż Twoja aplikacja przeznaczona. Jeśli ten bloker aplikacji, trzeba będzie wdrożenie CameraCaptureTask, opisane na msdn: <http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh394006.aspx> można także komentarz lub górę głosowanie powiązanych kwestii w [śledzenia błędów][3]
|
||||
|
||||
@@ -292,7 +292,7 @@ Opcjonalne parametry, aby dostosować ustawienia aparatu.
|
||||
|
||||
## CameraError
|
||||
|
||||
funkcja wywołania zwrotnego PrzyBłędzie, która zawiera komunikat o błędzie.
|
||||
Funkcja zwrotna onError, która zawiera komunikat o błędzie.
|
||||
|
||||
function(message) {
|
||||
// Show a helpful message
|
||||
@@ -301,11 +301,11 @@ funkcja wywołania zwrotnego PrzyBłędzie, która zawiera komunikat o błędzie
|
||||
|
||||
### Parametry
|
||||
|
||||
* **wiadomość**: wiadomość jest świadczone przez urządzenie w kodzie macierzystym. *(String)*
|
||||
* **message**: Natywny kod komunikatu zapewniany przez urządzenie. *(Ciąg znaków)*
|
||||
|
||||
## cameraSuccess
|
||||
|
||||
onSuccess funkcji wywołania zwrotnego, który dostarcza dane obrazu.
|
||||
Funkcja zwrotna onSuccess, która dostarcza dane obrazu.
|
||||
|
||||
function(imageData) {
|
||||
// Do something with the image
|
||||
@@ -314,7 +314,7 @@ onSuccess funkcji wywołania zwrotnego, który dostarcza dane obrazu.
|
||||
|
||||
### Parametry
|
||||
|
||||
* **imageData**: kodowanie Base64 danych obrazu, *lub* plik obrazu URI, w zależności od `cameraOptions` w życie. *(String)*
|
||||
* **imageData**: Dane obrazu kodowane przy pomocy Base64 *lub* URI pliku obrazu, w zależności od użycia `cameraOptions`. *(Ciąg znaków)*
|
||||
|
||||
### Przykład
|
||||
|
||||
@@ -332,7 +332,7 @@ Uchwyt do okna dialogowego popover, stworzony przez`navigator.camera.getPicture`
|
||||
|
||||
### Metody
|
||||
|
||||
* **setPosition**: Ustaw pozycję popover.
|
||||
* **setPosition**: Ustawia pozycję wyskakującego okna.
|
||||
|
||||
### Obsługiwane platformy
|
||||
|
||||
@@ -340,11 +340,11 @@ Uchwyt do okna dialogowego popover, stworzony przez`navigator.camera.getPicture`
|
||||
|
||||
### setPosition
|
||||
|
||||
Ustaw pozycję popover.
|
||||
Ustawia pozycję wyskakującego okna.
|
||||
|
||||
**Parametry**:
|
||||
|
||||
* `cameraPopoverOptions`: `CameraPopoverOptions` , określ nowe położenie
|
||||
* `cameraPopoverOptions`: `CameraPopoverOptions`, która określa nową pozycję
|
||||
|
||||
### Przykład
|
||||
|
||||
@@ -363,7 +363,7 @@ Ustaw pozycję popover.
|
||||
|
||||
## CameraPopoverOptions
|
||||
|
||||
tylko do iOS parametrami, które określić kotwicy element lokalizacji i strzałka kierunku popover, przy wyborze zdjęć z iPad biblioteki lub album.
|
||||
Parametry dotyczące tylko platformy iOS, które określają pozycję zakotwiczenia elementu oraz kierunek strzałki wyskakującego okna podczas wybierania obrazów z biblioteki lub albumu iPada.
|
||||
|
||||
{ x : 0,
|
||||
y : 32,
|
||||
@@ -375,15 +375,15 @@ tylko do iOS parametrami, które określić kotwicy element lokalizacji i strza
|
||||
|
||||
### CameraPopoverOptions
|
||||
|
||||
* **x**: x współrzędnych pikseli ekran element na którym kotwica popover. *(Liczba)*
|
||||
* **x**: współrzędna piksela x elementu ekranu, na którym zakotwiczone jest wyskakujące okno. *(Liczba)*
|
||||
|
||||
* **y**: Współrzędna y pikseli ekran element na którym kotwica popover. *(Liczba)*
|
||||
* **y**: współrzędna piksela y elementu ekranu, na którym zakotwiczone jest wyskakujące okno. *(Liczba)*
|
||||
|
||||
* **szerokość**: szerokość w pikselach, ekran element na którym kotwica popover. *(Liczba)*
|
||||
* **width**: szerokość w pikselach elementu ekranu, na którym zakotwiczone jest wyskakujące okno. *(Liczba)*
|
||||
|
||||
* **wysokość**: wysokość w pikselach elementów ekranu na którym kotwica popover. *(Liczba)*
|
||||
* **height**: wysokość w pikselach elementu ekranu, na którym zakotwiczone jest wyskakujące okno. *(Liczba)*
|
||||
|
||||
* **arrowDir**: kierunek strzałki na popover powinien wskazywać. Zdefiniowane w `Camera.PopoverArrowDirection` *(numer)*
|
||||
* **arrowDir**: Kierunek, który powinna wskazywać strzałka na wyskakującym oknie. Zdefiniowane w `Camera.PopoverArrowDirection` *(Liczba)*
|
||||
|
||||
Camera.PopoverArrowDirection = {
|
||||
ARROW_UP : 1, // matches iOS UIPopoverArrowDirection constants
|
||||
@@ -394,18 +394,18 @@ tylko do iOS parametrami, które określić kotwicy element lokalizacji i strza
|
||||
};
|
||||
|
||||
|
||||
Należy pamiętać, że rozmiar popover może zmienić aby zmienić kierunek strzałki i orientacji ekranu. Upewnij się uwzględnić zmiany orientacji podczas określania położenia elementu kotwicy.
|
||||
Pamiętaj, że wielkość wyskakującego okna może ulec zmianie by dostosować się do kierunku strzałki oraz orientacji ekranu. Upewnij się co do zmiany orientacji podczas określania położenia zakotwiczenia elementu.
|
||||
|
||||
## Navigator.Camera.CleanUp
|
||||
|
||||
Usuwa pośrednie zdjęcia zrobione przez aparat z czasowego składowania.
|
||||
Usuwa pośrednie zdjęcia zrobione przez aparat z tymczasowego magazynu.
|
||||
|
||||
navigator.camera.cleanup( cameraSuccess, cameraError );
|
||||
|
||||
|
||||
### Opis
|
||||
|
||||
Usuwa pośrednie plików obrazów, które są przechowywane w pamięci tymczasowej po `camera.getPicture` . Stosuje się tylko wtedy, gdy wartość `Camera.sourceType` jest równa `Camera.PictureSourceType.CAMERA` i `Camera.destinationType` jest równa`Camera.DestinationType.FILE_URI`.
|
||||
Usuwa pośrednie pliki graficzne, które po wywołaniu `camera.getPicture` są przechowywane w tymczasowym magazynie. Ma zastosowanie tylko, gdy wartość `Camera.sourceType` jest równa `Camera.PictureSourceType.CAMERA` i `Camera.destinationType` jest równa `Camera.DestinationType.FILE_URI`.
|
||||
|
||||
### Obsługiwane platformy
|
||||
|
||||
|
||||
150
doc/ru/index.md
150
doc/ru/index.md
@@ -57,7 +57,7 @@
|
||||
|
||||
### Поддерживаемые платформы
|
||||
|
||||
* Amazon Fire ОС
|
||||
* Amazon Fire OS
|
||||
* Android
|
||||
* BlackBerry 10
|
||||
* Обозреватель
|
||||
@@ -74,42 +74,42 @@
|
||||
<preference name="CameraUsesGeolocation" value="false" />
|
||||
|
||||
|
||||
### Amazon Fire OS причуды
|
||||
### Особенности Amazon Fire OS
|
||||
|
||||
Amazon Fire OS используют намерения для запуска активности камеры на устройстве для съемки фотографий, и на устройствах с низким объемам памяти, активность Cordova может быть завершена. В этом случае изображение может не появиться при восстановлении активности Cordova.
|
||||
|
||||
### Android причуды
|
||||
### Особенности Android
|
||||
|
||||
Android использует намерения начать действие камеры на устройстве для захвата изображения, и на телефонах с низкой памяти, могут быть убиты Cordova деятельность. В этом случае изображение не может появиться, когда Кордова активность восстанавливается.
|
||||
Android используют намерения для запуска активности камеры на устройстве для съемки фотографий, и на устройствах с низким объемам памяти, активность Cordova может быть завершена. В этом случае изображение может не появиться при восстановлении активности Cordova.
|
||||
|
||||
### Браузер причуды
|
||||
|
||||
Может возвращать только фотографии как изображения в кодировке base64.
|
||||
|
||||
### Firefox OS причуды
|
||||
### Особенности Firefox OS
|
||||
|
||||
Модуль камеры в настоящее время реализуется с помощью [Веб деятельности][2].
|
||||
Плагин Camera на данный момент реализован с использованием [Web Activities][2].
|
||||
|
||||
[2]: https://hacks.mozilla.org/2013/01/introducing-web-activities/
|
||||
|
||||
### iOS причуды
|
||||
### Особенности iOS
|
||||
|
||||
Включая JavaScript `alert()` в любом из обратного вызова функции может вызвать проблемы. Оберните оповещение в `setTimeout()` выбора изображений iOS или пирог полностью закрыть прежде чем отображает оповещения:
|
||||
Включение функции JavaScript `alert()` в любой из функций обратного вызова функции может вызвать проблемы. Оберните вызов alert в `setTimeout()` для позволения окну выбора изображений iOS полностью закрыться перед отображение оповещения:
|
||||
|
||||
setTimeout(function() {/ / ваши вещи!}, 0);
|
||||
|
||||
|
||||
### Windows Phone 7 причуды
|
||||
### Особенности Windows Phone 7
|
||||
|
||||
Вызов приложения родной камеры, в то время как устройство подключается через Zune не работает и инициирует обратный вызов для ошибки.
|
||||
Вызов встроенного приложения камеры, в то время как устройство подключено к Zune не работает, и инициирует обратный вызов для ошибки.
|
||||
|
||||
### Причуды Tizen
|
||||
### Особенности Tizen
|
||||
|
||||
Tizen поддерживает только `destinationType` из `Camera.DestinationType.FILE_URI` и `sourceType` из`Camera.PictureSourceType.PHOTOLIBRARY`.
|
||||
Tizen поддерживает только значение `destinationType` равное `Camera.DestinationType.FILE_URI` и значение `sourceType` равное `Camera.PictureSourceType.PHOTOLIBRARY`.
|
||||
|
||||
### Пример
|
||||
|
||||
Сфотографироваться и получить его в виде изображения в кодировке base64:
|
||||
Сделайте фотографию и получите его как изображение в base64-кодировке:
|
||||
|
||||
navigator.camera.getPicture(onSuccess, onFail, { quality: 50,
|
||||
destinationType: Camera.DestinationType.DATA_URL
|
||||
@@ -125,7 +125,7 @@ Tizen поддерживает только `destinationType` из `Camera.Desti
|
||||
}
|
||||
|
||||
|
||||
Сфотографироваться и получить расположение файла изображения:
|
||||
Сделайте фотографию и получить расположение файла с изображением:
|
||||
|
||||
navigator.camera.getPicture(onSuccess, onFail, { quality: 50,
|
||||
destinationType: Camera.DestinationType.FILE_URI });
|
||||
@@ -157,50 +157,50 @@ Tizen поддерживает только `destinationType` из `Camera.Desti
|
||||
|
||||
### Параметры
|
||||
|
||||
* **качество**: качество сохраняемого изображения, выражается в виде диапазона 0-100, где 100 является обычно полным разрешением без потери от сжатия файлов. Значение по умолчанию — 50. *(Число)* (Обратите внимание, что информация о разрешение камеры недоступна.)
|
||||
* **quality**: качество сохраняемого изображения, выражается в виде числа в диапазоне от 0 до 100, где 100 является обычно полным изображением без потери качества при сжатии. Значение по умолчанию — 50. *(Число)* (Обратите внимание, что информация о разрешении камеры недоступна.)
|
||||
|
||||
* **параметр destinationType**: выберите формат возвращаемого значения. Значение по умолчанию — FILE_URI. Определяется в `navigator.camera.DestinationType` *(число)*
|
||||
|
||||
Camera.DestinationType = {
|
||||
DATA_URL : 0, // Return image as base64-encoded string
|
||||
FILE_URI : 1, // Return image file URI
|
||||
NATIVE_URI : 2 // Return image native URI (e.g., assets-library:// on iOS or content:// on Android)
|
||||
DATA_URL: 0, / / возвращение изображения в base64-кодировке строки
|
||||
FILE_URI: 1, / / возврат файла изображения URI
|
||||
NATIVE_URI: 2 / / возвращение образа собственного URI (например, Библиотека активов: / / на iOS или содержание: / / на андроиде)
|
||||
};
|
||||
|
||||
|
||||
* **тип источника**: установить источник рисунка. По умолчанию используется камера. Определяется в `navigator.camera.PictureSourceType` *(число)*
|
||||
|
||||
Camera.PictureSourceType = {
|
||||
PHOTOLIBRARY : 0,
|
||||
CAMERA : 1,
|
||||
SAVEDPHOTOALBUM : 2
|
||||
PHOTOLIBRARY: 0,
|
||||
CAMERA: 1,
|
||||
SAVEDPHOTOALBUM: 2
|
||||
};
|
||||
|
||||
|
||||
* **allowEdit**: позволяют простое редактирование изображения перед выбором. *(Логическое)*
|
||||
* **allowEdit**: позволит редактирование изображения средствами телефона перед окончательным выбором изображения. *(Логический)*
|
||||
|
||||
* **Тип_шифрования**: выберите возвращенный файл в кодировку. Значение по умолчанию — JPEG. Определяется в `navigator.camera.EncodingType` *(число)*
|
||||
|
||||
Camera.EncodingType = {
|
||||
JPEG : 0, // Return JPEG encoded image
|
||||
PNG : 1 // Return PNG encoded image
|
||||
JPEG: 0, // возвращает изображение в формате JPEG
|
||||
PNG: 1 // возвращает рисунок в формате PNG
|
||||
};
|
||||
|
||||
|
||||
* **targetWidth**: ширина до масштаба изображения в пикселях. Должен использоваться с **targetHeight**. Соотношение остается неизменным. *(Число)*
|
||||
* **targetWidth**: ширина изображения в пикселах к которой необходимо осуществить масштабирование. Это значение должно использоваться совместно с **targetHeight**. Пропорции изображения останутся неизменными. *(Число)*
|
||||
|
||||
* **targetHeight**: высота до масштаба изображения в пикселях. Должен использоваться с **targetWidth**. Соотношение остается неизменным. *(Число)*
|
||||
* **targetHeight**: высота изображения в пикселах к которой необходимо осуществить масштабирование. Это значение должно использоваться совместно с **targetWidth**. Пропорции изображения останутся неизменными. *(Число)*
|
||||
|
||||
* **тип носителя**: задать тип носителя, чтобы выбрать из. Работает только если `PictureSourceType` является `PHOTOLIBRARY` или `SAVEDPHOTOALBUM` . Определяется в `nagivator.camera.MediaType` *(число)*
|
||||
* **тип носителя**: Установите источник получения изображения, из которого надо выбрать изображение. Работает только если `PictureSourceType` равно `PHOTOLIBRARY` или `SAVEDPHOTOALBUM` . Определяется в `nagivator.camera.MediaType` *(число)*
|
||||
|
||||
Camera.MediaType = {
|
||||
PICTURE: 0, // allow selection of still pictures only. ПО УМОЛЧАНИЮ. Will return format specified via DestinationType
|
||||
PICTURE: 0, / / разрешить выбор только сохраненных изображений. DEFAULT. Will return format specified via DestinationType
|
||||
VIDEO: 1, // allow selection of video only, WILL ALWAYS RETURN FILE_URI
|
||||
ALLMEDIA : 2 // allow selection from all media types
|
||||
};
|
||||
|
||||
|
||||
* **correctOrientation**: поворот изображения исправить для ориентации устройства во время захвата. *(Логическое)*
|
||||
* **correctOrientation**: вращает изображение, чтобы внести исправления к ориентации устройства во время захвата. *(Логический)*
|
||||
|
||||
* **saveToPhotoAlbum**: сохранить изображение в фотоальбом на устройстве после захвата. *(Логическое)*
|
||||
|
||||
@@ -214,83 +214,83 @@ Tizen поддерживает только `destinationType` из `Camera.Desti
|
||||
};
|
||||
|
||||
|
||||
### Amazon Fire OS причуды
|
||||
### Особенности Amazon Fire OS
|
||||
|
||||
* Любой `cameraDirection` значение результатов на задней стороне фотографии.
|
||||
* Любое значение `cameraDirection` возвращает фотографию сделанную задней камерой.
|
||||
|
||||
* Игнорирует параметр `allowEdit`.
|
||||
|
||||
* Оба параметра `Camera.PictureSourceType.PHOTOLIBRARY` и `Camera.PictureSourceType.SAVEDPHOTOALBUM` отображают один и тот же фотоальбом.
|
||||
|
||||
### Android причуды
|
||||
### Особенности Android
|
||||
|
||||
* Любой `cameraDirection` значение результатов на задней стороне фотографии.
|
||||
* Любое значение `cameraDirection` возвращает фотографию сделанную задней камерой.
|
||||
|
||||
* Игнорирует `allowEdit` параметр.
|
||||
* Игнорирует параметр `allowEdit`.
|
||||
|
||||
* `Camera.PictureSourceType.PHOTOLIBRARY`и `Camera.PictureSourceType.SAVEDPHOTOALBUM` как отображение же фотоальбом.
|
||||
* Оба параметра `Camera.PictureSourceType.PHOTOLIBRARY` и `Camera.PictureSourceType.SAVEDPHOTOALBUM` отображают один и тот же фотоальбом.
|
||||
|
||||
### Причуды blackBerry 10
|
||||
### Особенности BlackBerry 10
|
||||
|
||||
* Игнорирует `quality` параметр.
|
||||
|
||||
* Игнорирует `allowEdit` параметр.
|
||||
* Игнорирует параметр `allowEdit`.
|
||||
|
||||
* `Camera.MediaType`не поддерживается.
|
||||
* `Camera.MediaType` не поддерживается.
|
||||
|
||||
* Игнорирует `correctOrientation` параметр.
|
||||
* Игнорирует параметр `correctOrientation`.
|
||||
|
||||
* Игнорирует `cameraDirection` параметр.
|
||||
* Игнорирует параметр `cameraDirection`.
|
||||
|
||||
### Firefox OS причуды
|
||||
### Особенности Firefox OS
|
||||
|
||||
* Игнорирует `quality` параметр.
|
||||
|
||||
* `Camera.DestinationType`игнорируется и равен `1` (URI файла изображения)
|
||||
* Значение `Camera.DestinationType` игнорируется и равно `1` (URI для файла изображения)
|
||||
|
||||
* Игнорирует `allowEdit` параметр.
|
||||
* Игнорирует параметр `allowEdit`.
|
||||
|
||||
* Игнорирует `PictureSourceType` параметр (пользователь выбирает его в диалоговом окне)
|
||||
* Игнорирует параметр `PictureSourceType` (пользователь выбирает его в диалоговом окне)
|
||||
|
||||
* Игнорирует`encodingType`
|
||||
* Игнорирует параметр `encodingType`
|
||||
|
||||
* Игнорирует `targetWidth` и`targetHeight`
|
||||
* Игнорирует `targetWidth` и `targetHeight`
|
||||
|
||||
* `Camera.MediaType`не поддерживается.
|
||||
* `Camera.MediaType` не поддерживается.
|
||||
|
||||
* Игнорирует `correctOrientation` параметр.
|
||||
* Игнорирует параметр `correctOrientation`.
|
||||
|
||||
* Игнорирует `cameraDirection` параметр.
|
||||
* Игнорирует параметр `cameraDirection`.
|
||||
|
||||
### iOS причуды
|
||||
### Особенности iOS
|
||||
|
||||
* Задать `quality` ниже 50, чтобы избежать ошибок памяти на некоторых устройствах.
|
||||
* Установите `quality` ниже 50, для того чтобы избежать ошибок памяти на некоторых устройствах.
|
||||
|
||||
* При использовании `destinationType.FILE_URI` , фотографии сохраняются во временном каталоге приложения. Содержимое приложения временного каталога удаляется при завершении приложения.
|
||||
|
||||
### Причуды Tizen
|
||||
### Особенности Tizen
|
||||
|
||||
* параметры, не поддерживаемые
|
||||
* options, не поддерживается
|
||||
|
||||
* всегда возвращает URI файла
|
||||
|
||||
### Windows Phone 7 и 8 причуды
|
||||
### Особенности Windows Phone 7 и 8
|
||||
|
||||
* Игнорирует `allowEdit` параметр.
|
||||
* Игнорирует параметр `allowEdit`.
|
||||
|
||||
* Игнорирует `correctOrientation` параметр.
|
||||
* Игнорирует параметр `correctOrientation`.
|
||||
|
||||
* Игнорирует `cameraDirection` параметр.
|
||||
* Игнорирует параметр `cameraDirection`.
|
||||
|
||||
* Игнорирует `saveToPhotoAlbum` параметр. Важно: Все изображения, снятые камерой wp7/8 cordova API всегда копируются в рулон камеры телефона. В зависимости от параметров пользователя это также может означать, что изображение автоматически загружены на их OneDrive. Потенциально это может означать, что этот образ доступен для более широкой аудитории, чем ваше приложение предназначено. Если этот блокатор для вашего приложения, вам нужно будет осуществить CameraCaptureTask, как описано на сайте msdn: <http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh394006.aspx> вы можете также комментарий или вверх голосование связанный с этим вопрос [отслеживания][3]
|
||||
|
||||
* Игнорирует `mediaType` свойство `cameraOptions` как Windows Phone SDK не обеспечивает способ выбора видео от PHOTOLIBRARY.
|
||||
* Игнорирует свойство `mediaType` объекта `cameraOptions` так как Windows Phone SDK не предоставляет способ выбрать видео из PHOTOLIBRARY.
|
||||
|
||||
[3]: https://issues.apache.org/jira/browse/CB-2083
|
||||
|
||||
## CameraError
|
||||
|
||||
Функция обратного вызова onError, который предоставляет сообщение об ошибке.
|
||||
Функция обратного вызова вызываемая в случае возникновения ошибки.
|
||||
|
||||
function(message) {
|
||||
// Show a helpful message
|
||||
@@ -299,11 +299,11 @@ Tizen поддерживает только `destinationType` из `Camera.Desti
|
||||
|
||||
### Параметры
|
||||
|
||||
* **сообщение**: сообщение обеспечивается устройства машинного кода. *(Строка)*
|
||||
* **сообщение**: сообщение об ошибке предоставляемое платформой устройства. *(Строка)*
|
||||
|
||||
## cameraSuccess
|
||||
|
||||
onSuccess обратного вызова функция, которая предоставляет данные изображения.
|
||||
Функция обратного вызова onSuccess, получающая данные изображения.
|
||||
|
||||
function(imageData) {
|
||||
// Do something with the image
|
||||
@@ -312,7 +312,7 @@ onSuccess обратного вызова функция, которая пре
|
||||
|
||||
### Параметры
|
||||
|
||||
* **imageData**: Base64 кодирование изображения данных, *или* файла изображения URI, в зависимости от `cameraOptions` в силу. *(Строка)*
|
||||
* **imageData**: Данные изображения в Base64 кодировке, *или* URI, в зависимости от применяемых параметров `cameraOptions`. *(Строка)*
|
||||
|
||||
### Пример
|
||||
|
||||
@@ -326,11 +326,11 @@ onSuccess обратного вызова функция, которая пре
|
||||
|
||||
## CameraPopoverHandle
|
||||
|
||||
Дескриптор диалогового окна инструмента, созданного`navigator.camera.getPicture`.
|
||||
Дескриптор диалогового окна инструмента, созданный `navigator.camera.getPicture`.
|
||||
|
||||
### Методы
|
||||
|
||||
* **setPosition**: установить положение инструмента.
|
||||
* **setPosition**: Задайте положение инструмента выбора изображения.
|
||||
|
||||
### Поддерживаемые платформы
|
||||
|
||||
@@ -338,11 +338,11 @@ onSuccess обратного вызова функция, которая пре
|
||||
|
||||
### setPosition
|
||||
|
||||
Задайте положение инструмента.
|
||||
Устанавливает положение инструмента выбора изображения.
|
||||
|
||||
**Параметры**:
|
||||
|
||||
* `cameraPopoverOptions`: `CameraPopoverOptions` , укажите новое положение
|
||||
* `cameraPopoverOptions`: Объект `CameraPopoverOptions`, определяющий новое положение
|
||||
|
||||
### Пример
|
||||
|
||||
@@ -361,22 +361,22 @@ onSuccess обратного вызова функция, которая пре
|
||||
|
||||
## CameraPopoverOptions
|
||||
|
||||
только для iOS параметры, указывающие якорь элемент расположение и стрелкой направление инструмента при выборе изображений из библиотеки iPad или альбома.
|
||||
Параметры только для iOS, которые определяют расположение элемента привязки и направление стрелки инструмента при выборе изображений из библиотеки изображений iPad или альбома.
|
||||
|
||||
{x: 0, y: 32, ширина: 320, высота: 480, arrowDir: Camera.PopoverArrowDirection.ARROW_ANY};
|
||||
|
||||
|
||||
### CameraPopoverOptions
|
||||
|
||||
* **x**: x координата пикселя элемента экрана, на который для закрепления инструмента. *(Число)*
|
||||
* **x**: x координата в пикселях элемента экрана, на котором закрепить инструмента. *(Число)*
|
||||
|
||||
* **y**: y координата пикселя элемента экрана, на который для закрепления инструмента. *(Число)*
|
||||
* **x**: y координата в пикселях элемента экрана, на котором закрепить инструмента. *(Число)*
|
||||
|
||||
* **Ширина**: ширина в пикселях экрана элемента, на который для закрепления инструмента. *(Число)*
|
||||
* **width**: ширина в пикселях элемента экрана, на котором закрепить инструмент выбора изображения. *(Число)*
|
||||
|
||||
* **рост**: высота в пикселях экрана элемента, на который для закрепления инструмента. *(Число)*
|
||||
* **height**: высота в пикселях элемента экрана, на котором закрепить инструмент выбора изображения. *(Число)*
|
||||
|
||||
* **arrowDir**: стрелка на пирог следует указывать направление. Определяется в `Camera.PopoverArrowDirection` *(число)*
|
||||
* **arrowDir**: Направление, куда должна указывать стрелка на инструменте. Определено в `Camera.PopoverArrowDirection` *(число)*
|
||||
|
||||
Camera.PopoverArrowDirection = {
|
||||
ARROW_UP : 1, // matches iOS UIPopoverArrowDirection constants
|
||||
@@ -387,18 +387,18 @@ onSuccess обратного вызова функция, которая пре
|
||||
};
|
||||
|
||||
|
||||
Обратите внимание, что размер инструмента может измениться для регулировки в направлении стрелки и ориентации экрана. Убедитесь в том, что для учета изменения ориентации при указании расположения элемента привязки.
|
||||
Обратите внимание, что размер инструмента может изменяться для корректировки в зависимости направлении стрелки и ориентации экрана. Убедитесь, что учитываете возможные изменения ориентации при указании расположения элемента привязки.
|
||||
|
||||
## navigator.camera.cleanup
|
||||
|
||||
Удаляет промежуточные фотографии, снятые на камеру от временного хранения.
|
||||
Удаляет промежуточные фотографии, сделанные камерой из временного хранилища.
|
||||
|
||||
navigator.camera.cleanup( cameraSuccess, cameraError );
|
||||
|
||||
|
||||
### Описание
|
||||
|
||||
Удаляет промежуточные файлы изображений, которые хранятся в временного хранения после вызова метода `camera.getPicture` . Применяется только тогда, когда значение `Camera.sourceType` равно `Camera.PictureSourceType.CAMERA` и `Camera.destinationType` равно`Camera.DestinationType.FILE_URI`.
|
||||
Удаляет промежуточные файлы изображений, которые хранятся во временном хранилище после вызова метода `camera.getPicture` . Применяется только тогда, когда значение `Camera.sourceType` равно `Camera.PictureSourceType.CAMERA` и `Camera.destinationType` равняется `Camera.DestinationType.FILE_URI`.
|
||||
|
||||
### Поддерживаемые платформы
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:rim="http://www.blackberry.com/ns/widgets"
|
||||
id="org.apache.cordova.camera"
|
||||
version="0.3.2">
|
||||
version="0.3.5">
|
||||
<name>Camera</name>
|
||||
<description>Cordova Camera Plugin</description>
|
||||
<license>Apache 2.0</license>
|
||||
@@ -133,6 +133,8 @@
|
||||
<clobbers target="CameraPopoverHandle" />
|
||||
</js-module>
|
||||
|
||||
<header-file src="src/ios/UIImage+CropScaleOrientation.h" />
|
||||
<source-file src="src/ios/UIImage+CropScaleOrientation.m" />
|
||||
<header-file src="src/ios/CDVCamera.h" />
|
||||
<source-file src="src/ios/CDVCamera.m" />
|
||||
<header-file src="src/ios/CDVJpegHeaderWriter.h" />
|
||||
|
||||
@@ -314,8 +314,10 @@ public class CameraLauncher extends CordovaPlugin implements MediaScannerConnect
|
||||
cropIntent.putExtra("aspectX", 1);
|
||||
cropIntent.putExtra("aspectY", 1);
|
||||
}
|
||||
// retrieve data on return
|
||||
cropIntent.putExtra("return-data", true);
|
||||
// create new file handle to get full resolution crop
|
||||
croppedUri = Uri.fromFile(new File(getTempDirectoryPath(), System.currentTimeMillis() + ".jpg"));
|
||||
cropIntent.putExtra("output", croppedUri);
|
||||
|
||||
// start the activity - we handle returning in onActivityResult
|
||||
|
||||
if (this.cordova != null) {
|
||||
@@ -345,6 +347,10 @@ public class CameraLauncher extends CordovaPlugin implements MediaScannerConnect
|
||||
exif.createInFile(getTempDirectoryPath() + "/.Pic.jpg");
|
||||
exif.readExifData();
|
||||
rotate = exif.getOrientation();
|
||||
} else if (this.encodingType == PNG) {
|
||||
exif.createInFile(getTempDirectoryPath() + "/.Pic.png");
|
||||
exif.readExifData();
|
||||
rotate = exif.getOrientation();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
@@ -580,36 +586,11 @@ private String ouputModifiedBitmap(Bitmap bitmap, Uri uri) throws IOException {
|
||||
// if camera crop
|
||||
if (requestCode == CROP_CAMERA) {
|
||||
if (resultCode == Activity.RESULT_OK) {
|
||||
// // get the returned data
|
||||
Bundle extras = intent.getExtras();
|
||||
// get the cropped bitmap
|
||||
Bitmap thePic = extras.getParcelable("data");
|
||||
if (thePic == null) {
|
||||
this.failPicture("Crop returned no data.");
|
||||
return;
|
||||
}
|
||||
|
||||
// now save the bitmap to a file
|
||||
OutputStream fOut = null;
|
||||
File temp_file = new File(getTempDirectoryPath(),
|
||||
System.currentTimeMillis() + ".jpg");
|
||||
try {
|
||||
temp_file.createNewFile();
|
||||
fOut = new FileOutputStream(temp_file);
|
||||
thePic.compress(Bitmap.CompressFormat.JPEG, this.mQuality,
|
||||
fOut);
|
||||
fOut.flush();
|
||||
fOut.close();
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// // Send Uri back to JavaScript for viewing image
|
||||
this.callbackContext
|
||||
.success(Uri.fromFile(temp_file).toString());
|
||||
|
||||
.success(croppedUri.toString());
|
||||
croppedUri = null;
|
||||
|
||||
}// If cancelled
|
||||
else if (resultCode == Activity.RESULT_CANCELED) {
|
||||
this.failPicture("Camera cancelled.");
|
||||
|
||||
@@ -42,22 +42,39 @@ enum CDVMediaType {
|
||||
};
|
||||
typedef NSUInteger CDVMediaType;
|
||||
|
||||
@interface CDVCameraPicker : UIImagePickerController
|
||||
{}
|
||||
@interface CDVPictureOptions : NSObject
|
||||
|
||||
@property (assign) NSInteger quality;
|
||||
@property (copy) NSString* callbackId;
|
||||
@property (copy) NSString* postUrl;
|
||||
@property (nonatomic) enum CDVDestinationType returnType;
|
||||
@property (nonatomic) enum CDVEncodingType encodingType;
|
||||
@property (strong) UIPopoverController* popoverController;
|
||||
@property (strong) NSNumber* quality;
|
||||
@property (assign) CDVDestinationType destinationType;
|
||||
@property (assign) UIImagePickerControllerSourceType sourceType;
|
||||
@property (assign) CGSize targetSize;
|
||||
@property (assign) bool correctOrientation;
|
||||
@property (assign) bool saveToPhotoAlbum;
|
||||
@property (assign) bool cropToSize;
|
||||
@property (strong) UIView* webView;
|
||||
@property (assign) CDVEncodingType encodingType;
|
||||
@property (assign) CDVMediaType mediaType;
|
||||
@property (assign) BOOL allowsEditing;
|
||||
@property (assign) BOOL correctOrientation;
|
||||
@property (assign) BOOL saveToPhotoAlbum;
|
||||
@property (strong) NSDictionary* popoverOptions;
|
||||
@property (assign) UIImagePickerControllerCameraDevice cameraDirection;
|
||||
|
||||
@property (assign) BOOL popoverSupported;
|
||||
@property (assign) BOOL usesGeolocation;
|
||||
@property (assign) BOOL cropToSize;
|
||||
|
||||
+ (instancetype) createFromTakePictureArguments:(CDVInvokedUrlCommand*)command;
|
||||
|
||||
@end
|
||||
|
||||
@interface CDVCameraPicker : UIImagePickerController
|
||||
|
||||
@property (strong) CDVPictureOptions* pictureOptions;
|
||||
|
||||
@property (copy) NSString* callbackId;
|
||||
@property (copy) NSString* postUrl;
|
||||
@property (strong) UIPopoverController* pickerPopoverController;
|
||||
@property (assign) BOOL cropToSize;
|
||||
@property (strong) UIView* webView;
|
||||
|
||||
+ (instancetype) createFromPictureOptions:(CDVPictureOptions*)options;
|
||||
|
||||
@end
|
||||
|
||||
@@ -92,9 +109,6 @@ typedef NSUInteger CDVMediaType;
|
||||
- (void)imagePickerController:(UIImagePickerController*)picker didFinishPickingImage:(UIImage*)image editingInfo:(NSDictionary*)editingInfo;
|
||||
- (void)imagePickerControllerDidCancel:(UIImagePickerController*)picker;
|
||||
- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated;
|
||||
- (UIImage*)imageByScalingAndCroppingForSize:(UIImage*)anImage toSize:(CGSize)targetSize;
|
||||
- (UIImage*)imageByScalingNotCroppingForSize:(UIImage*)anImage toSize:(CGSize)frameSize;
|
||||
- (UIImage*)imageCorrectedForCaptureOrientation:(UIImage*)anImage;
|
||||
|
||||
- (void)locationManager:(CLLocationManager*)manager didUpdateToLocation:(CLLocation*)newLocation fromLocation:(CLLocation*)oldLocation;
|
||||
- (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
29
src/ios/UIImage+CropScaleOrientation.h
Normal file
29
src/ios/UIImage+CropScaleOrientation.h
Normal file
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface UIImage (CropScaleOrientation)
|
||||
|
||||
- (UIImage*)imageByScalingAndCroppingForSize:(CGSize)targetSize;
|
||||
- (UIImage*)imageCorrectedForCaptureOrientation;
|
||||
- (UIImage*)imageCorrectedForCaptureOrientation:(UIImageOrientation)imageOrientation;
|
||||
- (UIImage*)imageByScalingNotCroppingForSize:(CGSize)targetSize;
|
||||
|
||||
@end
|
||||
175
src/ios/UIImage+CropScaleOrientation.m
Normal file
175
src/ios/UIImage+CropScaleOrientation.m
Normal file
@@ -0,0 +1,175 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
#import "UIImage+CropScaleOrientation.h"
|
||||
|
||||
@implementation UIImage (CropScaleOrientation)
|
||||
|
||||
- (UIImage*)imageByScalingAndCroppingForSize:(CGSize)targetSize
|
||||
{
|
||||
UIImage* sourceImage = self;
|
||||
UIImage* newImage = nil;
|
||||
CGSize imageSize = sourceImage.size;
|
||||
CGFloat width = imageSize.width;
|
||||
CGFloat height = imageSize.height;
|
||||
CGFloat targetWidth = targetSize.width;
|
||||
CGFloat targetHeight = targetSize.height;
|
||||
CGFloat scaleFactor = 0.0;
|
||||
CGFloat scaledWidth = targetWidth;
|
||||
CGFloat scaledHeight = targetHeight;
|
||||
CGPoint thumbnailPoint = CGPointMake(0.0, 0.0);
|
||||
|
||||
if (CGSizeEqualToSize(imageSize, targetSize) == NO) {
|
||||
CGFloat widthFactor = targetWidth / width;
|
||||
CGFloat heightFactor = targetHeight / height;
|
||||
|
||||
if (widthFactor > heightFactor) {
|
||||
scaleFactor = widthFactor; // scale to fit height
|
||||
} else {
|
||||
scaleFactor = heightFactor; // scale to fit width
|
||||
}
|
||||
scaledWidth = width * scaleFactor;
|
||||
scaledHeight = height * scaleFactor;
|
||||
|
||||
// center the image
|
||||
if (widthFactor > heightFactor) {
|
||||
thumbnailPoint.y = (targetHeight - scaledHeight) * 0.5;
|
||||
} else if (widthFactor < heightFactor) {
|
||||
thumbnailPoint.x = (targetWidth - scaledWidth) * 0.5;
|
||||
}
|
||||
}
|
||||
|
||||
UIGraphicsBeginImageContext(targetSize); // this will crop
|
||||
|
||||
CGRect thumbnailRect = CGRectZero;
|
||||
thumbnailRect.origin = thumbnailPoint;
|
||||
thumbnailRect.size.width = scaledWidth;
|
||||
thumbnailRect.size.height = scaledHeight;
|
||||
|
||||
[sourceImage drawInRect:thumbnailRect];
|
||||
|
||||
newImage = UIGraphicsGetImageFromCurrentImageContext();
|
||||
if (newImage == nil) {
|
||||
NSLog(@"could not scale image");
|
||||
}
|
||||
|
||||
// pop the context to get back to the default
|
||||
UIGraphicsEndImageContext();
|
||||
return newImage;
|
||||
}
|
||||
|
||||
- (UIImage*)imageCorrectedForCaptureOrientation:(UIImageOrientation)imageOrientation
|
||||
{
|
||||
float rotation_radians = 0;
|
||||
bool perpendicular = false;
|
||||
|
||||
switch (imageOrientation) {
|
||||
case UIImageOrientationUp :
|
||||
rotation_radians = 0.0;
|
||||
break;
|
||||
|
||||
case UIImageOrientationDown:
|
||||
rotation_radians = M_PI; // don't be scared of radians, if you're reading this, you're good at math
|
||||
break;
|
||||
|
||||
case UIImageOrientationRight:
|
||||
rotation_radians = M_PI_2;
|
||||
perpendicular = true;
|
||||
break;
|
||||
|
||||
case UIImageOrientationLeft:
|
||||
rotation_radians = -M_PI_2;
|
||||
perpendicular = true;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
UIGraphicsBeginImageContext(CGSizeMake(self.size.width, self.size.height));
|
||||
CGContextRef context = UIGraphicsGetCurrentContext();
|
||||
|
||||
// Rotate around the center point
|
||||
CGContextTranslateCTM(context, self.size.width / 2, self.size.height / 2);
|
||||
CGContextRotateCTM(context, rotation_radians);
|
||||
|
||||
CGContextScaleCTM(context, 1.0, -1.0);
|
||||
float width = perpendicular ? self.size.height : self.size.width;
|
||||
float height = perpendicular ? self.size.width : self.size.height;
|
||||
CGContextDrawImage(context, CGRectMake(-width / 2, -height / 2, width, height), [self CGImage]);
|
||||
|
||||
// Move the origin back since the rotation might've change it (if its 90 degrees)
|
||||
if (perpendicular) {
|
||||
CGContextTranslateCTM(context, -self.size.height / 2, -self.size.width / 2);
|
||||
}
|
||||
|
||||
UIImage* newImage = UIGraphicsGetImageFromCurrentImageContext();
|
||||
UIGraphicsEndImageContext();
|
||||
return newImage;
|
||||
}
|
||||
|
||||
- (UIImage*)imageCorrectedForCaptureOrientation
|
||||
{
|
||||
return [self imageCorrectedForCaptureOrientation:[self imageOrientation]];
|
||||
}
|
||||
|
||||
- (UIImage*)imageByScalingNotCroppingForSize:(CGSize)targetSize
|
||||
{
|
||||
UIImage* sourceImage = self;
|
||||
UIImage* newImage = nil;
|
||||
CGSize imageSize = sourceImage.size;
|
||||
CGFloat width = imageSize.width;
|
||||
CGFloat height = imageSize.height;
|
||||
CGFloat targetWidth = targetSize.width;
|
||||
CGFloat targetHeight = targetSize.height;
|
||||
CGFloat scaleFactor = 0.0;
|
||||
CGSize scaledSize = targetSize;
|
||||
|
||||
if (CGSizeEqualToSize(imageSize, targetSize) == NO) {
|
||||
CGFloat widthFactor = targetWidth / width;
|
||||
CGFloat heightFactor = targetHeight / height;
|
||||
|
||||
// opposite comparison to imageByScalingAndCroppingForSize in order to contain the image within the given bounds
|
||||
if (widthFactor > heightFactor) {
|
||||
scaleFactor = heightFactor; // scale to fit height
|
||||
} else {
|
||||
scaleFactor = widthFactor; // scale to fit width
|
||||
}
|
||||
scaledSize = CGSizeMake(MIN(width * scaleFactor, targetWidth), MIN(height * scaleFactor, targetHeight));
|
||||
}
|
||||
|
||||
// If the pixels are floats, it causes a white line in iOS8 and probably other versions too
|
||||
scaledSize.width = (int)scaledSize.width;
|
||||
scaledSize.height = (int)scaledSize.height;
|
||||
|
||||
UIGraphicsBeginImageContext(scaledSize); // this will resize
|
||||
|
||||
[sourceImage drawInRect:CGRectMake(0, 0, scaledSize.width, scaledSize.height)];
|
||||
|
||||
newImage = UIGraphicsGetImageFromCurrentImageContext();
|
||||
if (newImage == nil) {
|
||||
NSLog(@"could not scale image");
|
||||
}
|
||||
|
||||
// pop the context to get back to the default
|
||||
UIGraphicsEndImageContext();
|
||||
return newImage;
|
||||
}
|
||||
|
||||
@end
|
||||
1
tests/ios/.gitignore
vendored
Normal file
1
tests/ios/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
node_modules
|
||||
7
tests/ios/CDVCameraTest.xcworkspace/contents.xcworkspacedata
generated
Normal file
7
tests/ios/CDVCameraTest.xcworkspace/contents.xcworkspacedata
generated
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "container:CDVCameraTest/CDVCameraTest.xcodeproj">
|
||||
</FileRef>
|
||||
</Workspace>
|
||||
@@ -0,0 +1,41 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>IDESourceControlProjectFavoriteDictionaryKey</key>
|
||||
<false/>
|
||||
<key>IDESourceControlProjectIdentifier</key>
|
||||
<string>6BE9AD73-1B9F-4362-98D7-DC631BEC6185</string>
|
||||
<key>IDESourceControlProjectName</key>
|
||||
<string>CDVCameraTest</string>
|
||||
<key>IDESourceControlProjectOriginsDictionary</key>
|
||||
<dict>
|
||||
<key>729B5706E7BAF4E9EE7AEE3C003A08107411AB7C</key>
|
||||
<string>github.com:shazron/cordova-plugin-camera.git</string>
|
||||
</dict>
|
||||
<key>IDESourceControlProjectPath</key>
|
||||
<string>tests/ios/CDVCameraTest.xcworkspace</string>
|
||||
<key>IDESourceControlProjectRelativeInstallPathDictionary</key>
|
||||
<dict>
|
||||
<key>729B5706E7BAF4E9EE7AEE3C003A08107411AB7C</key>
|
||||
<string>../../..</string>
|
||||
</dict>
|
||||
<key>IDESourceControlProjectURL</key>
|
||||
<string>github.com:shazron/cordova-plugin-camera.git</string>
|
||||
<key>IDESourceControlProjectVersion</key>
|
||||
<integer>111</integer>
|
||||
<key>IDESourceControlProjectWCCIdentifier</key>
|
||||
<string>729B5706E7BAF4E9EE7AEE3C003A08107411AB7C</string>
|
||||
<key>IDESourceControlProjectWCConfigurations</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>IDESourceControlRepositoryExtensionIdentifierKey</key>
|
||||
<string>public.vcs.git</string>
|
||||
<key>IDESourceControlWCCIdentifierKey</key>
|
||||
<string>729B5706E7BAF4E9EE7AEE3C003A08107411AB7C</string>
|
||||
<key>IDESourceControlWCCName</key>
|
||||
<string>cordova-plugin-camera</string>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,77 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0610"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "D2AAC07D0554694100DB518D"
|
||||
BuildableName = "libCordova.a"
|
||||
BlueprintName = "CordovaLib"
|
||||
ReferencedContainer = "container:node_modules/cordova-ios/CordovaLib/CordovaLib.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
buildConfiguration = "Debug">
|
||||
<Testables>
|
||||
</Testables>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
buildConfiguration = "Debug"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
allowLocationSimulation = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "D2AAC07D0554694100DB518D"
|
||||
BuildableName = "libCordova.a"
|
||||
BlueprintName = "CordovaLib"
|
||||
ReferencedContainer = "container:node_modules/cordova-ios/CordovaLib/CordovaLib.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
buildConfiguration = "Release"
|
||||
debugDocumentVersioning = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "D2AAC07D0554694100DB518D"
|
||||
BuildableName = "libCordova.a"
|
||||
BlueprintName = "CordovaLib"
|
||||
ReferencedContainer = "container:node_modules/cordova-ios/CordovaLib/CordovaLib.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
498
tests/ios/CDVCameraTest/CDVCameraLibTests/CameraTest.m
Normal file
498
tests/ios/CDVCameraTest/CDVCameraLibTests/CameraTest.m
Normal file
@@ -0,0 +1,498 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import <XCTest/XCTest.h>
|
||||
#import "CDVCamera.h"
|
||||
#import "UIImage+CropScaleOrientation.h"
|
||||
#import <Cordova/NSArray+Comparisons.h>
|
||||
#import <Cordova/NSData+Base64.h>
|
||||
#import <Cordova/NSDictionary+Extensions.h>
|
||||
#import <MobileCoreServices/UTCoreTypes.h>
|
||||
|
||||
|
||||
@interface CameraTest : XCTestCase
|
||||
|
||||
@property (nonatomic, strong) CDVCamera* plugin;
|
||||
|
||||
@end
|
||||
|
||||
@interface CDVCamera ()
|
||||
|
||||
// expose private interface
|
||||
- (NSData*)processImage:(UIImage*)image info:(NSDictionary*)info options:(CDVPictureOptions*)options;
|
||||
- (UIImage*)retrieveImage:(NSDictionary*)info options:(CDVPictureOptions*)options;
|
||||
- (CDVPluginResult*)resultForImage:(CDVPictureOptions*)options info:(NSDictionary*)info;
|
||||
- (CDVPluginResult*)resultForVideo:(NSDictionary*)info;
|
||||
|
||||
@end
|
||||
|
||||
@implementation CameraTest
|
||||
|
||||
- (void)setUp {
|
||||
[super setUp];
|
||||
// Put setup code here. This method is called before the invocation of each test method in the class.
|
||||
|
||||
self.plugin = [[CDVCamera alloc] init];
|
||||
}
|
||||
|
||||
- (void)tearDown {
|
||||
// Put teardown code here. This method is called after the invocation of each test method in the class.
|
||||
[super tearDown];
|
||||
}
|
||||
|
||||
- (void) testPictureOptionsCreate
|
||||
{
|
||||
NSArray* args;
|
||||
CDVPictureOptions* options;
|
||||
NSDictionary* popoverOptions;
|
||||
|
||||
// No arguments, check whether the defaults are set
|
||||
args = @[];
|
||||
options = [CDVPictureOptions createFromTakePictureArguments:args];
|
||||
|
||||
XCTAssertEqual([options.quality intValue], 50);
|
||||
XCTAssertEqual(options.destinationType, (int)DestinationTypeFileUri);
|
||||
XCTAssertEqual(options.sourceType, (int)UIImagePickerControllerSourceTypeCamera);
|
||||
XCTAssertEqual(options.targetSize.width, 0);
|
||||
XCTAssertEqual(options.targetSize.height, 0);
|
||||
XCTAssertEqual(options.encodingType, (int)EncodingTypeJPEG);
|
||||
XCTAssertEqual(options.mediaType, (int)MediaTypePicture);
|
||||
XCTAssertEqual(options.allowsEditing, NO);
|
||||
XCTAssertEqual(options.correctOrientation, NO);
|
||||
XCTAssertEqual(options.saveToPhotoAlbum, NO);
|
||||
XCTAssertEqualObjects(options.popoverOptions, nil);
|
||||
XCTAssertEqual(options.cameraDirection, (int)UIImagePickerControllerCameraDeviceRear);
|
||||
XCTAssertEqual(options.popoverSupported, NO);
|
||||
XCTAssertEqual(options.usesGeolocation, NO);
|
||||
|
||||
// Set each argument, check whether they are set. different from defaults
|
||||
popoverOptions = @{ @"x" : @1, @"y" : @2, @"width" : @3, @"height" : @4 };
|
||||
|
||||
args = @[
|
||||
@(49),
|
||||
@(DestinationTypeDataUrl),
|
||||
@(UIImagePickerControllerSourceTypePhotoLibrary),
|
||||
@(120),
|
||||
@(240),
|
||||
@(EncodingTypePNG),
|
||||
@(MediaTypeVideo),
|
||||
@YES,
|
||||
@YES,
|
||||
@YES,
|
||||
popoverOptions,
|
||||
@(UIImagePickerControllerCameraDeviceFront),
|
||||
];
|
||||
options = [CDVPictureOptions createFromTakePictureArguments:args];
|
||||
|
||||
XCTAssertEqual([options.quality intValue], 49);
|
||||
XCTAssertEqual(options.destinationType, (int)DestinationTypeDataUrl);
|
||||
XCTAssertEqual(options.sourceType, (int)UIImagePickerControllerSourceTypePhotoLibrary);
|
||||
XCTAssertEqual(options.targetSize.width, 120);
|
||||
XCTAssertEqual(options.targetSize.height, 240);
|
||||
XCTAssertEqual(options.encodingType, (int)EncodingTypePNG);
|
||||
XCTAssertEqual(options.mediaType, (int)MediaTypeVideo);
|
||||
XCTAssertEqual(options.allowsEditing, YES);
|
||||
XCTAssertEqual(options.correctOrientation, YES);
|
||||
XCTAssertEqual(options.saveToPhotoAlbum, YES);
|
||||
XCTAssertEqualObjects(options.popoverOptions, popoverOptions);
|
||||
XCTAssertEqual(options.cameraDirection, (int)UIImagePickerControllerCameraDeviceFront);
|
||||
XCTAssertEqual(options.popoverSupported, NO);
|
||||
XCTAssertEqual(options.usesGeolocation, NO);
|
||||
}
|
||||
|
||||
- (void) testCameraPickerCreate
|
||||
{
|
||||
NSDictionary* popoverOptions;
|
||||
NSArray* args;
|
||||
CDVPictureOptions* pictureOptions;
|
||||
CDVCameraPicker* picker;
|
||||
|
||||
// Souce is Camera, and image type
|
||||
|
||||
popoverOptions = @{ @"x" : @1, @"y" : @2, @"width" : @3, @"height" : @4 };
|
||||
args = @[
|
||||
@(49),
|
||||
@(DestinationTypeDataUrl),
|
||||
@(UIImagePickerControllerSourceTypeCamera),
|
||||
@(120),
|
||||
@(240),
|
||||
@(EncodingTypePNG),
|
||||
@(MediaTypeAll),
|
||||
@YES,
|
||||
@YES,
|
||||
@YES,
|
||||
popoverOptions,
|
||||
@(UIImagePickerControllerCameraDeviceFront),
|
||||
];
|
||||
pictureOptions = [CDVPictureOptions createFromTakePictureArguments:args];
|
||||
|
||||
if ([UIImagePickerController isSourceTypeAvailable:pictureOptions.sourceType]) {
|
||||
picker = [CDVCameraPicker createFromPictureOptions:pictureOptions];
|
||||
|
||||
XCTAssertEqualObjects(picker.pictureOptions, pictureOptions);
|
||||
|
||||
XCTAssertEqual(picker.sourceType, pictureOptions.sourceType);
|
||||
XCTAssertEqual(picker.allowsEditing, pictureOptions.allowsEditing);
|
||||
XCTAssertEqualObjects(picker.mediaTypes, @[(NSString*)kUTTypeImage]);
|
||||
XCTAssertEqual(picker.cameraDevice, pictureOptions.cameraDirection);
|
||||
}
|
||||
|
||||
// Souce is not Camera, and all media types
|
||||
|
||||
args = @[
|
||||
@(49),
|
||||
@(DestinationTypeDataUrl),
|
||||
@(UIImagePickerControllerSourceTypePhotoLibrary),
|
||||
@(120),
|
||||
@(240),
|
||||
@(EncodingTypePNG),
|
||||
@(MediaTypeAll),
|
||||
@YES,
|
||||
@YES,
|
||||
@YES,
|
||||
popoverOptions,
|
||||
@(UIImagePickerControllerCameraDeviceFront),
|
||||
];
|
||||
pictureOptions = [CDVPictureOptions createFromTakePictureArguments:args];
|
||||
|
||||
if ([UIImagePickerController isSourceTypeAvailable:pictureOptions.sourceType]) {
|
||||
picker = [CDVCameraPicker createFromPictureOptions:pictureOptions];
|
||||
|
||||
XCTAssertEqualObjects(picker.pictureOptions, pictureOptions);
|
||||
|
||||
XCTAssertEqual(picker.sourceType, pictureOptions.sourceType);
|
||||
XCTAssertEqual(picker.allowsEditing, pictureOptions.allowsEditing);
|
||||
XCTAssertEqualObjects(picker.mediaTypes, [UIImagePickerController availableMediaTypesForSourceType:picker.sourceType]);
|
||||
}
|
||||
|
||||
// Souce is not Camera, and either Image or Movie media type
|
||||
|
||||
args = @[
|
||||
@(49),
|
||||
@(DestinationTypeDataUrl),
|
||||
@(UIImagePickerControllerSourceTypePhotoLibrary),
|
||||
@(120),
|
||||
@(240),
|
||||
@(EncodingTypePNG),
|
||||
@(MediaTypeVideo),
|
||||
@YES,
|
||||
@YES,
|
||||
@YES,
|
||||
popoverOptions,
|
||||
@(UIImagePickerControllerCameraDeviceFront),
|
||||
];
|
||||
pictureOptions = [CDVPictureOptions createFromTakePictureArguments:args];
|
||||
|
||||
if ([UIImagePickerController isSourceTypeAvailable:pictureOptions.sourceType]) {
|
||||
picker = [CDVCameraPicker createFromPictureOptions:pictureOptions];
|
||||
|
||||
XCTAssertEqualObjects(picker.pictureOptions, pictureOptions);
|
||||
|
||||
XCTAssertEqual(picker.sourceType, pictureOptions.sourceType);
|
||||
XCTAssertEqual(picker.allowsEditing, pictureOptions.allowsEditing);
|
||||
XCTAssertEqualObjects(picker.mediaTypes, @[(NSString*)kUTTypeMovie]);
|
||||
}
|
||||
}
|
||||
|
||||
- (UIImage*) createImage:(CGRect)rect orientation:(UIImageOrientation)imageOrientation {
|
||||
UIGraphicsBeginImageContext(rect.size);
|
||||
CGContextRef context = UIGraphicsGetCurrentContext();
|
||||
|
||||
CGContextSetFillColorWithColor(context, [[UIColor greenColor] CGColor]);
|
||||
CGContextFillRect(context, rect);
|
||||
|
||||
CGImageRef result = CGBitmapContextCreateImage(UIGraphicsGetCurrentContext());
|
||||
UIImage* image = [UIImage imageWithCGImage:result scale:1.0f orientation:imageOrientation];
|
||||
|
||||
UIGraphicsEndImageContext();
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
- (void) testImageScaleCropForSize {
|
||||
|
||||
UIImage *sourceImagePortrait, *sourceImageLandscape, *targetImage;
|
||||
CGSize targetSize = CGSizeZero;
|
||||
|
||||
sourceImagePortrait = [self createImage:CGRectMake(0, 0, 2448, 3264) orientation:UIImageOrientationUp];
|
||||
sourceImageLandscape = [self createImage:CGRectMake(0, 0, 3264, 2448) orientation:UIImageOrientationUp];
|
||||
|
||||
// test 640x480
|
||||
|
||||
targetSize = CGSizeMake(640, 480);
|
||||
|
||||
targetImage = [sourceImagePortrait imageByScalingAndCroppingForSize:targetSize];
|
||||
XCTAssertEqual(targetImage.size.width, targetSize.width);
|
||||
XCTAssertEqual(targetImage.size.height, targetSize.height);
|
||||
|
||||
targetImage = [sourceImageLandscape imageByScalingAndCroppingForSize:targetSize];
|
||||
XCTAssertEqual(targetImage.size.width, targetSize.width);
|
||||
XCTAssertEqual(targetImage.size.height, targetSize.height);
|
||||
|
||||
|
||||
// test 800x600
|
||||
|
||||
targetSize = CGSizeMake(800, 600);
|
||||
|
||||
targetImage = [sourceImagePortrait imageByScalingAndCroppingForSize:targetSize];
|
||||
XCTAssertEqual(targetImage.size.width, targetSize.width);
|
||||
XCTAssertEqual(targetImage.size.height, targetSize.height);
|
||||
|
||||
targetImage = [sourceImageLandscape imageByScalingAndCroppingForSize:targetSize];
|
||||
XCTAssertEqual(targetImage.size.width, targetSize.width);
|
||||
XCTAssertEqual(targetImage.size.height, targetSize.height);
|
||||
|
||||
// test 1024x768
|
||||
|
||||
targetSize = CGSizeMake(1024, 768);
|
||||
|
||||
targetImage = [sourceImagePortrait imageByScalingAndCroppingForSize:targetSize];
|
||||
XCTAssertEqual(targetImage.size.width, targetSize.width);
|
||||
XCTAssertEqual(targetImage.size.height, targetSize.height);
|
||||
|
||||
targetImage = [sourceImageLandscape imageByScalingAndCroppingForSize:targetSize];
|
||||
XCTAssertEqual(targetImage.size.width, targetSize.width);
|
||||
XCTAssertEqual(targetImage.size.height, targetSize.height);
|
||||
}
|
||||
|
||||
- (void) testImageScaleNoCropForSize {
|
||||
UIImage *sourceImagePortrait, *sourceImageLandscape, *targetImage;
|
||||
CGSize targetSize = CGSizeZero;
|
||||
|
||||
sourceImagePortrait = [self createImage:CGRectMake(0, 0, 2448, 3264) orientation:UIImageOrientationUp];
|
||||
sourceImageLandscape = [self createImage:CGRectMake(0, 0, 3264, 2448) orientation:UIImageOrientationUp];
|
||||
|
||||
// test 640x480
|
||||
|
||||
targetSize = CGSizeMake(640, 480);
|
||||
|
||||
targetImage = [sourceImagePortrait imageByScalingNotCroppingForSize:targetSize];
|
||||
XCTAssertEqual(targetImage.size.width, targetSize.width);
|
||||
XCTAssertEqual(targetImage.size.height, targetSize.height);
|
||||
|
||||
targetImage = [sourceImageLandscape imageByScalingNotCroppingForSize:targetSize];
|
||||
XCTAssertEqual(targetImage.size.width, targetSize.width);
|
||||
XCTAssertEqual(targetImage.size.height, targetSize.height);
|
||||
|
||||
|
||||
// test 800x600
|
||||
|
||||
targetSize = CGSizeMake(800, 600);
|
||||
|
||||
targetImage = [sourceImagePortrait imageByScalingNotCroppingForSize:targetSize];
|
||||
XCTAssertEqual(targetImage.size.width, targetSize.width);
|
||||
XCTAssertEqual(targetImage.size.height, targetSize.height);
|
||||
|
||||
targetImage = [sourceImageLandscape imageByScalingNotCroppingForSize:targetSize];
|
||||
XCTAssertEqual(targetImage.size.width, targetSize.width);
|
||||
XCTAssertEqual(targetImage.size.height, targetSize.height);
|
||||
|
||||
// test 1024x768
|
||||
|
||||
targetSize = CGSizeMake(1024, 768);
|
||||
|
||||
targetImage = [sourceImagePortrait imageByScalingNotCroppingForSize:targetSize];
|
||||
XCTAssertEqual(targetImage.size.width, targetSize.width);
|
||||
XCTAssertEqual(targetImage.size.height, targetSize.height);
|
||||
|
||||
targetImage = [sourceImageLandscape imageByScalingNotCroppingForSize:targetSize];
|
||||
XCTAssertEqual(targetImage.size.width, targetSize.width);
|
||||
XCTAssertEqual(targetImage.size.height, targetSize.height);
|
||||
}
|
||||
|
||||
- (void) testImageCorrectedForOrientation {
|
||||
UIImage *sourceImagePortrait, *sourceImageLandscape, *targetImage;
|
||||
CGSize targetSize = CGSizeZero;
|
||||
|
||||
sourceImagePortrait = [self createImage:CGRectMake(0, 0, 2448, 3264) orientation:UIImageOrientationDown];
|
||||
sourceImageLandscape = [self createImage:CGRectMake(0, 0, 3264, 2448) orientation:UIImageOrientationDown];
|
||||
|
||||
// PORTRAIT - image size should be unchanged
|
||||
|
||||
targetSize = CGSizeMake(2448, 3264);
|
||||
|
||||
targetImage = [sourceImagePortrait imageCorrectedForCaptureOrientation:UIImageOrientationUp];
|
||||
XCTAssertEqual(targetImage.size.width, targetSize.width);
|
||||
XCTAssertEqual(targetImage.size.height, targetSize.height);
|
||||
XCTAssertEqual(targetImage.imageOrientation, UIImageOrientationUp);
|
||||
|
||||
targetImage = [sourceImagePortrait imageCorrectedForCaptureOrientation:UIImageOrientationDown];
|
||||
XCTAssertEqual(targetImage.size.width, targetSize.width);
|
||||
XCTAssertEqual(targetImage.size.height, targetSize.height);
|
||||
XCTAssertEqual(targetImage.imageOrientation, UIImageOrientationUp);
|
||||
|
||||
targetImage = [sourceImagePortrait imageCorrectedForCaptureOrientation:UIImageOrientationRight];
|
||||
XCTAssertEqual(targetImage.size.width, targetSize.width);
|
||||
XCTAssertEqual(targetImage.size.height, targetSize.height);
|
||||
XCTAssertEqual(targetImage.imageOrientation, UIImageOrientationUp);
|
||||
|
||||
targetImage = [sourceImagePortrait imageCorrectedForCaptureOrientation:UIImageOrientationLeft];
|
||||
XCTAssertEqual(targetImage.size.width, targetSize.width);
|
||||
XCTAssertEqual(targetImage.size.height, targetSize.height);
|
||||
XCTAssertEqual(targetImage.imageOrientation, UIImageOrientationUp);
|
||||
|
||||
// LANDSCAPE - image size should be unchanged
|
||||
|
||||
targetSize = CGSizeMake(3264, 2448);
|
||||
|
||||
targetImage = [sourceImageLandscape imageCorrectedForCaptureOrientation:UIImageOrientationUp];
|
||||
XCTAssertEqual(targetImage.size.width, targetSize.width);
|
||||
XCTAssertEqual(targetImage.size.height, targetSize.height);
|
||||
|
||||
targetImage = [sourceImageLandscape imageCorrectedForCaptureOrientation:UIImageOrientationDown];
|
||||
XCTAssertEqual(targetImage.size.width, targetSize.width);
|
||||
XCTAssertEqual(targetImage.size.height, targetSize.height);
|
||||
|
||||
targetImage = [sourceImageLandscape imageCorrectedForCaptureOrientation:UIImageOrientationRight];
|
||||
XCTAssertEqual(targetImage.size.width, targetSize.width);
|
||||
XCTAssertEqual(targetImage.size.height, targetSize.height);
|
||||
|
||||
targetImage = [sourceImageLandscape imageCorrectedForCaptureOrientation:UIImageOrientationLeft];
|
||||
XCTAssertEqual(targetImage.size.width, targetSize.width);
|
||||
XCTAssertEqual(targetImage.size.height, targetSize.height);
|
||||
}
|
||||
|
||||
|
||||
- (void) testRetrieveImage
|
||||
{
|
||||
CDVPictureOptions* pictureOptions = [[CDVPictureOptions alloc] init];
|
||||
NSDictionary *infoDict1, *infoDict2;
|
||||
UIImage* resultImage;
|
||||
|
||||
UIImage* originalImage = [self createImage:CGRectMake(0, 0, 1024, 768) orientation:UIImageOrientationDown];
|
||||
UIImage* originalCorrectedForOrientation = [originalImage imageCorrectedForCaptureOrientation];
|
||||
|
||||
UIImage* editedImage = [self createImage:CGRectMake(0, 0, 800, 600) orientation:UIImageOrientationDown];
|
||||
UIImage* scaledImageWithCrop = [originalImage imageByScalingAndCroppingForSize:CGSizeMake(640, 480)];
|
||||
UIImage* scaledImageNoCrop = [originalImage imageByScalingNotCroppingForSize:CGSizeMake(640, 480)];
|
||||
|
||||
infoDict1 = @{
|
||||
UIImagePickerControllerOriginalImage : originalImage
|
||||
};
|
||||
|
||||
infoDict2 = @{
|
||||
UIImagePickerControllerOriginalImage : originalImage,
|
||||
UIImagePickerControllerEditedImage : editedImage
|
||||
};
|
||||
|
||||
// Original with no options
|
||||
|
||||
pictureOptions.allowsEditing = YES;
|
||||
pictureOptions.targetSize = CGSizeZero;
|
||||
pictureOptions.cropToSize = NO;
|
||||
pictureOptions.correctOrientation = NO;
|
||||
|
||||
resultImage = [self.plugin retrieveImage:infoDict1 options:pictureOptions];
|
||||
XCTAssertEqualObjects(resultImage, originalImage);
|
||||
|
||||
// Original with no options
|
||||
|
||||
pictureOptions.allowsEditing = YES;
|
||||
pictureOptions.targetSize = CGSizeZero;
|
||||
pictureOptions.cropToSize = NO;
|
||||
pictureOptions.correctOrientation = NO;
|
||||
|
||||
resultImage = [self.plugin retrieveImage:infoDict2 options:pictureOptions];
|
||||
XCTAssertEqualObjects(resultImage, editedImage);
|
||||
|
||||
// Original with corrected orientation
|
||||
|
||||
pictureOptions.allowsEditing = YES;
|
||||
pictureOptions.targetSize = CGSizeZero;
|
||||
pictureOptions.cropToSize = NO;
|
||||
pictureOptions.correctOrientation = YES;
|
||||
|
||||
resultImage = [self.plugin retrieveImage:infoDict1 options:pictureOptions];
|
||||
XCTAssertNotEqual(resultImage.imageOrientation, originalImage.imageOrientation);
|
||||
XCTAssertEqual(resultImage.imageOrientation, originalCorrectedForOrientation.imageOrientation);
|
||||
XCTAssertEqual(resultImage.size.width, originalCorrectedForOrientation.size.width);
|
||||
XCTAssertEqual(resultImage.size.height, originalCorrectedForOrientation.size.height);
|
||||
|
||||
// Original with targetSize, no crop
|
||||
|
||||
pictureOptions.allowsEditing = YES;
|
||||
pictureOptions.targetSize = CGSizeMake(640, 480);
|
||||
pictureOptions.cropToSize = NO;
|
||||
pictureOptions.correctOrientation = NO;
|
||||
|
||||
resultImage = [self.plugin retrieveImage:infoDict1 options:pictureOptions];
|
||||
XCTAssertEqual(resultImage.size.width, scaledImageNoCrop.size.width);
|
||||
XCTAssertEqual(resultImage.size.height, scaledImageNoCrop.size.height);
|
||||
|
||||
// Original with targetSize, plus crop
|
||||
|
||||
pictureOptions.allowsEditing = YES;
|
||||
pictureOptions.targetSize = CGSizeMake(640, 480);
|
||||
pictureOptions.cropToSize = YES;
|
||||
pictureOptions.correctOrientation = NO;
|
||||
|
||||
resultImage = [self.plugin retrieveImage:infoDict1 options:pictureOptions];
|
||||
XCTAssertEqual(resultImage.size.width, scaledImageWithCrop.size.width);
|
||||
XCTAssertEqual(resultImage.size.height, scaledImageWithCrop.size.height);
|
||||
}
|
||||
|
||||
- (void) testProcessImage
|
||||
{
|
||||
CDVPictureOptions* pictureOptions = [[CDVPictureOptions alloc] init];
|
||||
NSData* resultData;
|
||||
|
||||
UIImage* originalImage = [self createImage:CGRectMake(0, 0, 1024, 768) orientation:UIImageOrientationDown];
|
||||
NSData* originalImageDataPNG = UIImagePNGRepresentation(originalImage);
|
||||
NSData* originalImageDataJPEG = UIImageJPEGRepresentation(originalImage, 1.0);
|
||||
|
||||
// Original, PNG
|
||||
|
||||
pictureOptions.allowsEditing = YES;
|
||||
pictureOptions.targetSize = CGSizeZero;
|
||||
pictureOptions.cropToSize = NO;
|
||||
pictureOptions.correctOrientation = NO;
|
||||
pictureOptions.encodingType = EncodingTypePNG;
|
||||
|
||||
resultData = [self.plugin processImage:originalImage info:@{} options:pictureOptions];
|
||||
XCTAssertEqualObjects([resultData base64EncodedString], [originalImageDataPNG base64EncodedString]);
|
||||
|
||||
// Original, JPEG, full quality
|
||||
|
||||
pictureOptions.allowsEditing = NO;
|
||||
pictureOptions.targetSize = CGSizeZero;
|
||||
pictureOptions.cropToSize = NO;
|
||||
pictureOptions.correctOrientation = NO;
|
||||
pictureOptions.encodingType = EncodingTypeJPEG;
|
||||
|
||||
resultData = [self.plugin processImage:originalImage info:@{} options:pictureOptions];
|
||||
XCTAssertEqualObjects([resultData base64EncodedString], [originalImageDataJPEG base64EncodedString]);
|
||||
|
||||
// Original, JPEG, with quality value
|
||||
|
||||
pictureOptions.allowsEditing = YES;
|
||||
pictureOptions.targetSize = CGSizeZero;
|
||||
pictureOptions.cropToSize = NO;
|
||||
pictureOptions.correctOrientation = NO;
|
||||
pictureOptions.encodingType = EncodingTypeJPEG;
|
||||
pictureOptions.quality = @(57);
|
||||
|
||||
NSData* originalImageDataJPEGWithQuality = UIImageJPEGRepresentation(originalImage, [pictureOptions.quality floatValue]/ 100.f);
|
||||
resultData = [self.plugin processImage:originalImage info:@{} options:pictureOptions];
|
||||
XCTAssertEqualObjects([resultData base64EncodedString], [originalImageDataJPEGWithQuality base64EncodedString]);
|
||||
|
||||
// TODO: usesGeolocation is not tested
|
||||
}
|
||||
|
||||
@end
|
||||
24
tests/ios/CDVCameraTest/CDVCameraLibTests/Info.plist
Normal file
24
tests/ios/CDVCameraTest/CDVCameraLibTests/Info.plist
Normal file
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>org.apache.cordova.$(PRODUCT_NAME:rfc1034identifier)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>$(PRODUCT_NAME)</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>BNDL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
</dict>
|
||||
</plist>
|
||||
561
tests/ios/CDVCameraTest/CDVCameraTest.xcodeproj/project.pbxproj
Normal file
561
tests/ios/CDVCameraTest/CDVCameraTest.xcodeproj/project.pbxproj
Normal file
@@ -0,0 +1,561 @@
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 46;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
30486FEB1A40DC350065C233 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 30486FEA1A40DC350065C233 /* UIKit.framework */; };
|
||||
30486FED1A40DC3B0065C233 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 30486FEC1A40DC3A0065C233 /* Foundation.framework */; };
|
||||
30486FF91A40DCC70065C233 /* CDVCamera.m in Sources */ = {isa = PBXBuildFile; fileRef = 30486FF31A40DCC70065C233 /* CDVCamera.m */; };
|
||||
30486FFA1A40DCC70065C233 /* CDVJpegHeaderWriter.m in Sources */ = {isa = PBXBuildFile; fileRef = 30486FF61A40DCC70065C233 /* CDVJpegHeaderWriter.m */; };
|
||||
30486FFB1A40DCC70065C233 /* UIImage+CropScaleOrientation.m in Sources */ = {isa = PBXBuildFile; fileRef = 30486FF81A40DCC70065C233 /* UIImage+CropScaleOrientation.m */; };
|
||||
304870011A40DD620065C233 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 30486FFE1A40DD180065C233 /* CoreGraphics.framework */; };
|
||||
304870021A40DD860065C233 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 30486FFE1A40DD180065C233 /* CoreGraphics.framework */; };
|
||||
304870031A40DD8C0065C233 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 30486FEA1A40DC350065C233 /* UIKit.framework */; };
|
||||
304870051A40DD9A0065C233 /* MobileCoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 304870041A40DD9A0065C233 /* MobileCoreServices.framework */; };
|
||||
304870071A40DDAC0065C233 /* AssetsLibrary.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 304870061A40DDAC0065C233 /* AssetsLibrary.framework */; };
|
||||
304870091A40DDB90065C233 /* CoreLocation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 304870081A40DDB90065C233 /* CoreLocation.framework */; };
|
||||
3048700B1A40DDF30065C233 /* ImageIO.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3048700A1A40DDF30065C233 /* ImageIO.framework */; };
|
||||
308F59B11A4228730031A4D4 /* libCordova.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 7E9F519019DA0F8300DA31AC /* libCordova.a */; };
|
||||
7E9F51B119DA114400DA31AC /* CameraTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 7E9F51B019DA114400DA31AC /* CameraTest.m */; };
|
||||
7E9F51B919DA1B1600DA31AC /* libCDVCameraLib.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 7E9F519519DA102000DA31AC /* libCDVCameraLib.a */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
30486FFC1A40DCE80065C233 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 7E9F518B19DA0F8300DA31AC /* CordovaLib.xcodeproj */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = D2AAC07D0554694100DB518D;
|
||||
remoteInfo = CordovaLib;
|
||||
};
|
||||
7E9F518F19DA0F8300DA31AC /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 7E9F518B19DA0F8300DA31AC /* CordovaLib.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = 68A32D7114102E1C006B237C;
|
||||
remoteInfo = CordovaLib;
|
||||
};
|
||||
7E9F51AC19DA10DE00DA31AC /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 7E9F517219DA09CE00DA31AC /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 7E9F519419DA102000DA31AC;
|
||||
remoteInfo = CDVCameraLib;
|
||||
};
|
||||
/* End PBXContainerItemProxy section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
7E9F519319DA102000DA31AC /* CopyFiles */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = "include/$(PRODUCT_NAME)";
|
||||
dstSubfolderSpec = 16;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
30486FEA1A40DC350065C233 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk/System/Library/Frameworks/UIKit.framework; sourceTree = DEVELOPER_DIR; };
|
||||
30486FEC1A40DC3A0065C233 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; };
|
||||
30486FF21A40DCC70065C233 /* CDVCamera.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVCamera.h; sourceTree = "<group>"; };
|
||||
30486FF31A40DCC70065C233 /* CDVCamera.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDVCamera.m; sourceTree = "<group>"; };
|
||||
30486FF41A40DCC70065C233 /* CDVExif.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVExif.h; sourceTree = "<group>"; };
|
||||
30486FF51A40DCC70065C233 /* CDVJpegHeaderWriter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVJpegHeaderWriter.h; sourceTree = "<group>"; };
|
||||
30486FF61A40DCC70065C233 /* CDVJpegHeaderWriter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDVJpegHeaderWriter.m; sourceTree = "<group>"; };
|
||||
30486FF71A40DCC70065C233 /* UIImage+CropScaleOrientation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImage+CropScaleOrientation.h"; sourceTree = "<group>"; };
|
||||
30486FF81A40DCC70065C233 /* UIImage+CropScaleOrientation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImage+CropScaleOrientation.m"; sourceTree = "<group>"; };
|
||||
30486FFE1A40DD180065C233 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk/System/Library/Frameworks/CoreGraphics.framework; sourceTree = DEVELOPER_DIR; };
|
||||
304870041A40DD9A0065C233 /* MobileCoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MobileCoreServices.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk/System/Library/Frameworks/MobileCoreServices.framework; sourceTree = DEVELOPER_DIR; };
|
||||
304870061A40DDAC0065C233 /* AssetsLibrary.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AssetsLibrary.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk/System/Library/Frameworks/AssetsLibrary.framework; sourceTree = DEVELOPER_DIR; };
|
||||
304870081A40DDB90065C233 /* CoreLocation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreLocation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk/System/Library/Frameworks/CoreLocation.framework; sourceTree = DEVELOPER_DIR; };
|
||||
3048700A1A40DDF30065C233 /* ImageIO.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ImageIO.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk/System/Library/Frameworks/ImageIO.framework; sourceTree = DEVELOPER_DIR; };
|
||||
7E9F518B19DA0F8300DA31AC /* CordovaLib.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = CordovaLib.xcodeproj; path = "../node_modules/cordova-ios/CordovaLib/CordovaLib.xcodeproj"; sourceTree = "<group>"; };
|
||||
7E9F519519DA102000DA31AC /* libCDVCameraLib.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libCDVCameraLib.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
7E9F519F19DA102000DA31AC /* CDVCameraLibTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CDVCameraLibTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
7E9F51A219DA102000DA31AC /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
7E9F51B019DA114400DA31AC /* CameraTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CameraTest.m; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
7E9F519219DA102000DA31AC /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
308F59B11A4228730031A4D4 /* libCordova.a in Frameworks */,
|
||||
304870011A40DD620065C233 /* CoreGraphics.framework in Frameworks */,
|
||||
30486FED1A40DC3B0065C233 /* Foundation.framework in Frameworks */,
|
||||
30486FEB1A40DC350065C233 /* UIKit.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
7E9F519C19DA102000DA31AC /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
3048700B1A40DDF30065C233 /* ImageIO.framework in Frameworks */,
|
||||
304870091A40DDB90065C233 /* CoreLocation.framework in Frameworks */,
|
||||
304870071A40DDAC0065C233 /* AssetsLibrary.framework in Frameworks */,
|
||||
304870051A40DD9A0065C233 /* MobileCoreServices.framework in Frameworks */,
|
||||
304870031A40DD8C0065C233 /* UIKit.framework in Frameworks */,
|
||||
304870021A40DD860065C233 /* CoreGraphics.framework in Frameworks */,
|
||||
7E9F51B919DA1B1600DA31AC /* libCDVCameraLib.a in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
30486FF11A40DCC70065C233 /* CDVCameraLib */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
30486FF21A40DCC70065C233 /* CDVCamera.h */,
|
||||
30486FF31A40DCC70065C233 /* CDVCamera.m */,
|
||||
30486FF41A40DCC70065C233 /* CDVExif.h */,
|
||||
30486FF51A40DCC70065C233 /* CDVJpegHeaderWriter.h */,
|
||||
30486FF61A40DCC70065C233 /* CDVJpegHeaderWriter.m */,
|
||||
30486FF71A40DCC70065C233 /* UIImage+CropScaleOrientation.h */,
|
||||
30486FF81A40DCC70065C233 /* UIImage+CropScaleOrientation.m */,
|
||||
);
|
||||
name = CDVCameraLib;
|
||||
path = ../../../src/ios;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
308F59B01A4227A60031A4D4 /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
3048700A1A40DDF30065C233 /* ImageIO.framework */,
|
||||
304870081A40DDB90065C233 /* CoreLocation.framework */,
|
||||
304870061A40DDAC0065C233 /* AssetsLibrary.framework */,
|
||||
304870041A40DD9A0065C233 /* MobileCoreServices.framework */,
|
||||
30486FFE1A40DD180065C233 /* CoreGraphics.framework */,
|
||||
30486FEC1A40DC3A0065C233 /* Foundation.framework */,
|
||||
30486FEA1A40DC350065C233 /* UIKit.framework */,
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
7E9F517119DA09CE00DA31AC = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
7E9F518B19DA0F8300DA31AC /* CordovaLib.xcodeproj */,
|
||||
308F59B01A4227A60031A4D4 /* Frameworks */,
|
||||
30486FF11A40DCC70065C233 /* CDVCameraLib */,
|
||||
7E9F51A019DA102000DA31AC /* CDVCameraLibTests */,
|
||||
7E9F517D19DA0A0A00DA31AC /* Products */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
7E9F517D19DA0A0A00DA31AC /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
7E9F519519DA102000DA31AC /* libCDVCameraLib.a */,
|
||||
7E9F519F19DA102000DA31AC /* CDVCameraLibTests.xctest */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
7E9F518C19DA0F8300DA31AC /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
7E9F519019DA0F8300DA31AC /* libCordova.a */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
7E9F51A019DA102000DA31AC /* CDVCameraLibTests */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
7E9F51A119DA102000DA31AC /* Supporting Files */,
|
||||
7E9F51B019DA114400DA31AC /* CameraTest.m */,
|
||||
);
|
||||
path = CDVCameraLibTests;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
7E9F51A119DA102000DA31AC /* Supporting Files */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
7E9F51A219DA102000DA31AC /* Info.plist */,
|
||||
);
|
||||
name = "Supporting Files";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
7E9F519419DA102000DA31AC /* CDVCameraLib */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 7E9F51A319DA102000DA31AC /* Build configuration list for PBXNativeTarget "CDVCameraLib" */;
|
||||
buildPhases = (
|
||||
7E9F519119DA102000DA31AC /* Sources */,
|
||||
7E9F519219DA102000DA31AC /* Frameworks */,
|
||||
7E9F519319DA102000DA31AC /* CopyFiles */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
30486FFD1A40DCE80065C233 /* PBXTargetDependency */,
|
||||
);
|
||||
name = CDVCameraLib;
|
||||
productName = CDVCameraLib;
|
||||
productReference = 7E9F519519DA102000DA31AC /* libCDVCameraLib.a */;
|
||||
productType = "com.apple.product-type.library.static";
|
||||
};
|
||||
7E9F519E19DA102000DA31AC /* CDVCameraLibTests */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 7E9F51A619DA102000DA31AC /* Build configuration list for PBXNativeTarget "CDVCameraLibTests" */;
|
||||
buildPhases = (
|
||||
7E9F519B19DA102000DA31AC /* Sources */,
|
||||
7E9F519C19DA102000DA31AC /* Frameworks */,
|
||||
7E9F519D19DA102000DA31AC /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
7E9F51AD19DA10DE00DA31AC /* PBXTargetDependency */,
|
||||
);
|
||||
name = CDVCameraLibTests;
|
||||
productName = CDVCameraLibTests;
|
||||
productReference = 7E9F519F19DA102000DA31AC /* CDVCameraLibTests.xctest */;
|
||||
productType = "com.apple.product-type.bundle.unit-test";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
7E9F517219DA09CE00DA31AC /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 0610;
|
||||
TargetAttributes = {
|
||||
7E9F519419DA102000DA31AC = {
|
||||
CreatedOnToolsVersion = 6.0;
|
||||
};
|
||||
7E9F519E19DA102000DA31AC = {
|
||||
CreatedOnToolsVersion = 6.0;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = 7E9F517519DA09CE00DA31AC /* Build configuration list for PBXProject "CDVCameraTest" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
);
|
||||
mainGroup = 7E9F517119DA09CE00DA31AC;
|
||||
productRefGroup = 7E9F517D19DA0A0A00DA31AC /* Products */;
|
||||
projectDirPath = "";
|
||||
projectReferences = (
|
||||
{
|
||||
ProductGroup = 7E9F518C19DA0F8300DA31AC /* Products */;
|
||||
ProjectRef = 7E9F518B19DA0F8300DA31AC /* CordovaLib.xcodeproj */;
|
||||
},
|
||||
);
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
7E9F519419DA102000DA31AC /* CDVCameraLib */,
|
||||
7E9F519E19DA102000DA31AC /* CDVCameraLibTests */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXReferenceProxy section */
|
||||
7E9F519019DA0F8300DA31AC /* libCordova.a */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = archive.ar;
|
||||
path = libCordova.a;
|
||||
remoteRef = 7E9F518F19DA0F8300DA31AC /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
/* End PBXReferenceProxy section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
7E9F519D19DA102000DA31AC /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
7E9F519119DA102000DA31AC /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
30486FF91A40DCC70065C233 /* CDVCamera.m in Sources */,
|
||||
30486FFB1A40DCC70065C233 /* UIImage+CropScaleOrientation.m in Sources */,
|
||||
30486FFA1A40DCC70065C233 /* CDVJpegHeaderWriter.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
7E9F519B19DA102000DA31AC /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
7E9F51B119DA114400DA31AC /* CameraTest.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXTargetDependency section */
|
||||
30486FFD1A40DCE80065C233 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
name = CordovaLib;
|
||||
targetProxy = 30486FFC1A40DCE80065C233 /* PBXContainerItemProxy */;
|
||||
};
|
||||
7E9F51AD19DA10DE00DA31AC /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = 7E9F519419DA102000DA31AC /* CDVCameraLib */;
|
||||
targetProxy = 7E9F51AC19DA10DE00DA31AC /* PBXContainerItemProxy */;
|
||||
};
|
||||
/* End PBXTargetDependency section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
7E9F517619DA09CE00DA31AC /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
7E9F517719DA09CE00DA31AC /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
7E9F51A419DA102000DA31AC /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"\"$(TARGET_BUILD_DIR)/usr/local/lib/include\"",
|
||||
"\"$(OBJROOT)/UninstalledProducts/include\"",
|
||||
"\"$(BUILT_PRODUCTS_DIR)\"",
|
||||
);
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = iphoneos;
|
||||
SKIP_INSTALL = YES;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
7E9F51A519DA102000DA31AC /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = YES;
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"\"$(TARGET_BUILD_DIR)/usr/local/lib/include\"",
|
||||
"\n\"$(OBJROOT)/UninstalledProducts/include\"\n\"$(BUILT_PRODUCTS_DIR)\"",
|
||||
);
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = iphoneos;
|
||||
SKIP_INSTALL = YES;
|
||||
VALIDATE_PRODUCT = YES;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
7E9F51A719DA102000DA31AC /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(SDKROOT)/Developer/Library/Frameworks",
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
INFOPLIST_FILE = CDVCameraLibTests/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
OTHER_LDFLAGS = (
|
||||
"$(inherited)",
|
||||
"-framework",
|
||||
XCTest,
|
||||
"-all_load",
|
||||
"-ObjC",
|
||||
);
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = iphoneos;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
7E9F51A819DA102000DA31AC /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = YES;
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(SDKROOT)/Developer/Library/Frameworks",
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
INFOPLIST_FILE = CDVCameraLibTests/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
OTHER_LDFLAGS = (
|
||||
"$(inherited)",
|
||||
"-framework",
|
||||
XCTest,
|
||||
"-all_load",
|
||||
"-ObjC",
|
||||
);
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = iphoneos;
|
||||
VALIDATE_PRODUCT = YES;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
7E9F517519DA09CE00DA31AC /* Build configuration list for PBXProject "CDVCameraTest" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
7E9F517619DA09CE00DA31AC /* Debug */,
|
||||
7E9F517719DA09CE00DA31AC /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
7E9F51A319DA102000DA31AC /* Build configuration list for PBXNativeTarget "CDVCameraLib" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
7E9F51A419DA102000DA31AC /* Debug */,
|
||||
7E9F51A519DA102000DA31AC /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
7E9F51A619DA102000DA31AC /* Build configuration list for PBXNativeTarget "CDVCameraLibTests" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
7E9F51A719DA102000DA31AC /* Debug */,
|
||||
7E9F51A819DA102000DA31AC /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 7E9F517219DA09CE00DA31AC /* Project object */;
|
||||
}
|
||||
7
tests/ios/CDVCameraTest/CDVCameraTest.xcodeproj/project.xcworkspace/contents.xcworkspacedata
generated
Normal file
7
tests/ios/CDVCameraTest/CDVCameraTest.xcodeproj/project.xcworkspace/contents.xcworkspacedata
generated
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "self:CDVCameraTest.xcodeproj">
|
||||
</FileRef>
|
||||
</Workspace>
|
||||
@@ -0,0 +1,41 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>IDESourceControlProjectFavoriteDictionaryKey</key>
|
||||
<false/>
|
||||
<key>IDESourceControlProjectIdentifier</key>
|
||||
<string>6BE9AD73-1B9F-4362-98D7-DC631BEC6185</string>
|
||||
<key>IDESourceControlProjectName</key>
|
||||
<string>CDVCameraTest</string>
|
||||
<key>IDESourceControlProjectOriginsDictionary</key>
|
||||
<dict>
|
||||
<key>BEF5A5D0FF64801E558286389440357A9233D7DB</key>
|
||||
<string>https://git-wip-us.apache.org/repos/asf/cordova-plugin-camera.git</string>
|
||||
</dict>
|
||||
<key>IDESourceControlProjectPath</key>
|
||||
<string>tests/ios/CDVCameraTest/CDVCameraTest.xcodeproj</string>
|
||||
<key>IDESourceControlProjectRelativeInstallPathDictionary</key>
|
||||
<dict>
|
||||
<key>BEF5A5D0FF64801E558286389440357A9233D7DB</key>
|
||||
<string>../../../../..</string>
|
||||
</dict>
|
||||
<key>IDESourceControlProjectURL</key>
|
||||
<string>https://git-wip-us.apache.org/repos/asf/cordova-plugin-camera.git</string>
|
||||
<key>IDESourceControlProjectVersion</key>
|
||||
<integer>111</integer>
|
||||
<key>IDESourceControlProjectWCCIdentifier</key>
|
||||
<string>BEF5A5D0FF64801E558286389440357A9233D7DB</string>
|
||||
<key>IDESourceControlProjectWCConfigurations</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>IDESourceControlRepositoryExtensionIdentifierKey</key>
|
||||
<string>public.vcs.git</string>
|
||||
<key>IDESourceControlWCCIdentifierKey</key>
|
||||
<string>BEF5A5D0FF64801E558286389440357A9233D7DB</string>
|
||||
<key>IDESourceControlWCCName</key>
|
||||
<string>cordova-plugin-camera</string>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,77 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0610"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "7E9F519419DA102000DA31AC"
|
||||
BuildableName = "libCDVCameraLib.a"
|
||||
BlueprintName = "CDVCameraLib"
|
||||
ReferencedContainer = "container:CDVCameraTest.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
buildConfiguration = "Debug">
|
||||
<Testables>
|
||||
</Testables>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
buildConfiguration = "Debug"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
allowLocationSimulation = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "7E9F519419DA102000DA31AC"
|
||||
BuildableName = "libCDVCameraLib.a"
|
||||
BlueprintName = "CDVCameraLib"
|
||||
ReferencedContainer = "container:CDVCameraTest.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
buildConfiguration = "Release"
|
||||
debugDocumentVersioning = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "7E9F519419DA102000DA31AC"
|
||||
BuildableName = "libCDVCameraLib.a"
|
||||
BlueprintName = "CDVCameraLib"
|
||||
ReferencedContainer = "container:CDVCameraTest.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
@@ -0,0 +1,96 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0610"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "NO"
|
||||
buildForArchiving = "NO"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "7E9F519E19DA102000DA31AC"
|
||||
BuildableName = "CDVCameraLibTests.xctest"
|
||||
BlueprintName = "CDVCameraLibTests"
|
||||
ReferencedContainer = "container:CDVCameraTest.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
buildConfiguration = "Debug">
|
||||
<Testables>
|
||||
<TestableReference
|
||||
skipped = "NO">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "7E9F519E19DA102000DA31AC"
|
||||
BuildableName = "CDVCameraLibTests.xctest"
|
||||
BlueprintName = "CDVCameraLibTests"
|
||||
ReferencedContainer = "container:CDVCameraTest.xcodeproj">
|
||||
</BuildableReference>
|
||||
</TestableReference>
|
||||
</Testables>
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "7E9F519E19DA102000DA31AC"
|
||||
BuildableName = "CDVCameraLibTests.xctest"
|
||||
BlueprintName = "CDVCameraLibTests"
|
||||
ReferencedContainer = "container:CDVCameraTest.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
buildConfiguration = "Debug"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
allowLocationSimulation = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "7E9F519E19DA102000DA31AC"
|
||||
BuildableName = "CDVCameraLibTests.xctest"
|
||||
BlueprintName = "CDVCameraLibTests"
|
||||
ReferencedContainer = "container:CDVCameraTest.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
buildConfiguration = "Release"
|
||||
debugDocumentVersioning = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "7E9F519E19DA102000DA31AC"
|
||||
BuildableName = "CDVCameraLibTests.xctest"
|
||||
BlueprintName = "CDVCameraLibTests"
|
||||
ReferencedContainer = "container:CDVCameraTest.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
21
tests/ios/README.md
Normal file
21
tests/ios/README.md
Normal file
@@ -0,0 +1,21 @@
|
||||
# iOS Tests for CDVCamera
|
||||
|
||||
You need to install `node.js` to pull in `cordova-ios`.
|
||||
|
||||
First install cordova-ios:
|
||||
|
||||
npm install
|
||||
|
||||
... in the current folder.
|
||||
|
||||
|
||||
# Testing from Xcode
|
||||
|
||||
1. Launch the `CDVCameraTest.xcworkspace` file.
|
||||
2. Choose "CDVCameraLibTests" from the scheme drop-down menu
|
||||
3. Click and hold on the `Play` button, and choose the `Wrench` icon to run the tests
|
||||
|
||||
|
||||
# Testing from the command line
|
||||
|
||||
npm test
|
||||
13
tests/ios/package.json
Normal file
13
tests/ios/package.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"name": "cordova-plugin-camera-test-ios",
|
||||
"version": "1.0.0",
|
||||
"description": "iOS Unit Tests for Camera Plugin",
|
||||
"author": "Apache Software Foundation",
|
||||
"license": "Apache Version 2.0",
|
||||
"dependencies": {
|
||||
"cordova-ios": "^3.7.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xcodebuild -scheme CordovaLib && xcodebuild test -scheme CDVCameraLibTests -destination 'platform=iOS Simulator,name=iPhone 5'"
|
||||
}
|
||||
}
|
||||
@@ -22,7 +22,7 @@
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:rim="http://www.blackberry.com/ns/widgets"
|
||||
id="org.apache.cordova.camera.tests"
|
||||
version="0.3.2">
|
||||
version="0.3.5">
|
||||
<name>Cordova Camera Plugin Tests</name>
|
||||
<license>Apache 2.0</license>
|
||||
|
||||
|
||||
@@ -135,7 +135,7 @@ exports.defineManualTests = function (contentEl, createActionButton) {
|
||||
}
|
||||
|
||||
function onGetPictureError(e) {
|
||||
log('Error getting picture: ' + e.code);
|
||||
log('Error getting picture: ' + (e.code || e));
|
||||
}
|
||||
|
||||
function getPictureWin(data) {
|
||||
|
||||
Reference in New Issue
Block a user