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
This commit is contained in:
sgrebnov 2015-09-08 15:25:20 +03:00 committed by Vladimir Kotikov
parent dca8bd1943
commit 454a6f518c

View File

@ -46,6 +46,11 @@ namespace WPCordovaClassLib.Cordova.Commands
/// </summary> /// </summary>
private const int FILE_URI = 1; private const int FILE_URI = 1;
/// <summary>
/// Return native uri
/// </summary>
private const int NATIVE_URI = 2;
/// <summary> /// <summary>
/// Choose image from picture library /// Choose image from picture library
/// </summary> /// </summary>
@ -214,8 +219,15 @@ namespace WPCordovaClassLib.Cordova.Commands
return; 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)
{ {
case Camera.FILE_URI:
case Camera.DATA_URL:
case Camera.NATIVE_URI:
break;
default:
DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, "Incorrect option: destinationType")); DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, "Incorrect option: destinationType"));
return; return;
} }
@ -304,7 +316,7 @@ namespace WPCordovaClassLib.Cordova.Commands
{ {
imagePathOrContent = GetImageContent(rotImageStream); 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)); imagePathOrContent = SaveImageToLocalStorage(rotImageStream, Path.GetFileName(e.OriginalFileName));
} }
@ -316,7 +328,7 @@ namespace WPCordovaClassLib.Cordova.Commands
{ {
imagePathOrContent = GetImageContent(e.ChosenPhoto); 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)); imagePathOrContent = SaveImageToLocalStorage(e.ChosenPhoto, Path.GetFileName(e.OriginalFileName));
} }