cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From an-s...@apache.org
Subject cordova-plugin-camera git commit: CB-9622 Windows Phone 8 Camera Option destinationType:NATIVE_URI is a NO-OP
Date Wed, 09 Sep 2015 10:01:57 GMT
Repository: cordova-plugin-camera
Updated Branches:
  refs/heads/master dca8bd194 -> 454a6f518


CB-9622 Windows Phone 8 Camera Option destinationType:NATIVE_URI is a NO-OP

•	WP8 proxy now supports NATIVE_URI param
•	Treat NATIVE_URI same way as FILE_URI (similar to Android).

This closes #119


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/454a6f51
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/tree/454a6f51
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/diff/454a6f51

Branch: refs/heads/master
Commit: 454a6f518c444188cca4c2e351db6641db5f5cc2
Parents: dca8bd1
Author: sgrebnov <v-segreb@microsoft.com>
Authored: Tue Sep 8 15:25:20 2015 +0300
Committer: Vladimir Kotikov <v-vlkoti@microsoft.com>
Committed: Wed Sep 9 13:01:48 2015 +0300

----------------------------------------------------------------------
 src/wp/Camera.cs | 22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/blob/454a6f51/src/wp/Camera.cs
----------------------------------------------------------------------
diff --git a/src/wp/Camera.cs b/src/wp/Camera.cs
index f4df7fc..264a205 100644
--- a/src/wp/Camera.cs
+++ b/src/wp/Camera.cs
@@ -47,6 +47,11 @@ namespace WPCordovaClassLib.Cordova.Commands
         private const int FILE_URI = 1;
 
         /// <summary>
+        /// Return native uri
+        /// </summary>
+        private const int NATIVE_URI = 2;
+
+        /// <summary>
         /// Choose image from picture library
         /// </summary>
         private const int PHOTOLIBRARY = 0;
@@ -214,10 +219,17 @@ namespace WPCordovaClassLib.Cordova.Commands
                 return;
             }
 
-            if(cameraOptions.DestinationType != Camera.FILE_URI && cameraOptions.DestinationType
!= Camera.DATA_URL )
+            // Api supports FILE_URI, DATA_URL, NATIVE_URI destination types.
+            // Treat all other destination types as an error.
+            switch (cameraOptions.DestinationType)
             {
-                DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, "Incorrect
option: destinationType"));
-                return;
+                case Camera.FILE_URI:
+                case Camera.DATA_URL:
+                case Camera.NATIVE_URI:
+                    break;
+                default:
+                    DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, "Incorrect
option: destinationType"));
+                    return;
             }
 
             ChooserBase<PhotoResult> chooserTask = null;
@@ -304,7 +316,7 @@ namespace WPCordovaClassLib.Cordova.Commands
                                 {
                                     imagePathOrContent = GetImageContent(rotImageStream);
                                 }
-                                else   // FILE_URL
+                                else   // FILE_URL or NATIVE_URI (both use the same resultant
uri format)
                                 {
                                     imagePathOrContent = SaveImageToLocalStorage(rotImageStream,
Path.GetFileName(e.OriginalFileName));
                                 }
@@ -316,7 +328,7 @@ namespace WPCordovaClassLib.Cordova.Commands
                             {
                                 imagePathOrContent = GetImageContent(e.ChosenPhoto);
                             }
-                            else  // FILE_URL
+                            else  // FILE_URL or NATIVE_URI (both use the same resultant
uri format)
                             {
                                 imagePathOrContent = SaveImageToLocalStorage(e.ChosenPhoto,
Path.GetFileName(e.OriginalFileName));
                             }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


Mime
View raw message