You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by pu...@apache.org on 2014/06/18 03:30:30 UTC

git commit: Removes File plugin dependency from windows8 code.

Repository: cordova-plugin-camera
Updated Branches:
  refs/heads/master ffd46c4ef -> 06ecc91fd


Removes File plugin dependency from windows8 code.


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/commit/06ecc91f
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/tree/06ecc91f
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/diff/06ecc91f

Branch: refs/heads/master
Commit: 06ecc91fd1430bf3261990315e7e6361a6bc5cad
Parents: ffd46c4
Author: Vladimir Kotikov <v-...@microsoft.com>
Authored: Mon Jun 16 10:51:45 2014 +0400
Committer: Vladimir Kotikov <v-...@microsoft.com>
Committed: Mon Jun 16 10:51:45 2014 +0400

----------------------------------------------------------------------
 plugin.xml                  |  1 -
 src/windows8/CameraProxy.js | 31 +++++++------------------------
 2 files changed, 7 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/blob/06ecc91f/plugin.xml
----------------------------------------------------------------------
diff --git a/plugin.xml b/plugin.xml
index e15de70..c76214c 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -202,7 +202,6 @@
     <!-- windows8 -->
     <platform name="windows8">
 
-        <dependency id="org.apache.cordova.file" />
         <config-file target="package.appxmanifest" parent="/Package/Capabilities">
             <Capability Name="picturesLibrary" />
             <DeviceCapability Name="webcam" />

http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/blob/06ecc91f/src/windows8/CameraProxy.js
----------------------------------------------------------------------
diff --git a/src/windows8/CameraProxy.js b/src/windows8/CameraProxy.js
index cad54df..7e6c21e 100644
--- a/src/windows8/CameraProxy.js
+++ b/src/windows8/CameraProxy.js
@@ -22,12 +22,8 @@
 /*global Windows:true, URL:true */
 
 
-
-var cordova = require('cordova'),
-    Camera = require('./Camera'),
-    FileEntry = require('org.apache.cordova.file.FileEntry'),
-    FileError = require('org.apache.cordova.file.FileError'),
-    FileReader = require('org.apache.cordova.file.FileReader');
+    var cordova = require('cordova'),
+        Camera = require('./Camera');
 
 module.exports = {
 
@@ -54,13 +50,6 @@ module.exports = {
         var mediaType = args[6];
         var saveToPhotoAlbum = args[9];
 
-        var pkg = Windows.ApplicationModel.Package.current;
-        var packageId = pkg.installedLocation;
-
-        var fail = function (fileError) {
-            errorCallback("FileError, code:" + fileError.code);
-        };
-
         // resize method :)
         var resizeImage = function (file) {
             var tempPhotoFileName = "";
@@ -164,9 +153,7 @@ module.exports = {
                             file.copyAsync(storageFolder, file.name, Windows.Storage.NameCollisionOption.replaceExisting).then(function (storageFile) {
                                 successCallback(URL.createObjectURL(storageFile));
                             }, function () {
-                                fail(FileError.INVALID_MODIFICATION_ERR);
-                            }, function () {
-                                errorCallback("Folder not access.");
+                                errorCallback("Can't access localStorage folder.");
                             });
 
                         }
@@ -228,7 +215,7 @@ module.exports = {
             cameraCaptureUI.captureFileAsync(Windows.Media.Capture.CameraCaptureUIMode.photo).then(function (picture) {
                 if (picture) {
                     // save to photo album successCallback
-                    var success = function (fileEntry) {
+                    var success = function () {
                         if (destinationType == Camera.DestinationType.FILE_URI) {
                             if (targetHeight > 0 && targetWidth > 0) {
                                 resizeImage(picture);
@@ -238,9 +225,7 @@ module.exports = {
                                 picture.copyAsync(storageFolder, picture.name, Windows.Storage.NameCollisionOption.replaceExisting).then(function (storageFile) {
                                     successCallback("ms-appdata:///local/" + storageFile.name);
                                 }, function () {
-                                    fail(FileError.INVALID_MODIFICATION_ERR);
-                                }, function () {
-                                    errorCallback("Folder not access.");
+                                    errorCallback("Can't access localStorage folder.");
                                 });
                             }
                         } else {
@@ -263,7 +248,7 @@ module.exports = {
                     if (saveToPhotoAlbum) {
                         Windows.Storage.StorageFile.getFileFromPathAsync(picture.path).then(function (storageFile) {
                             storageFile.copyAsync(Windows.Storage.KnownFolders.picturesLibrary, picture.name, Windows.Storage.NameCollisionOption.generateUniqueName).then(function (storageFile) {
-                                success(storageFile);
+                                success();
                             }, function () {
                                 fail();
                             });
@@ -280,9 +265,7 @@ module.exports = {
                                 picture.copyAsync(storageFolder, picture.name, Windows.Storage.NameCollisionOption.replaceExisting).then(function (storageFile) {
                                     successCallback("ms-appdata:///local/" + storageFile.name);
                                 }, function () {
-                                    fail(FileError.INVALID_MODIFICATION_ERR);
-                                }, function () {
-                                    errorCallback("Folder not access.");
+                                    errorCallback("Can't access localStorage folder.");
                                 });
                             }
                         } else {