mirror of
https://github.com/apache/cordova-plugin-camera.git
synced 2025-01-19 03:42:52 +08:00
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:
parent
dca8bd1943
commit
454a6f518c
@ -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,10 +219,17 @@ 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)
|
||||||
{
|
{
|
||||||
DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, "Incorrect option: destinationType"));
|
case Camera.FILE_URI:
|
||||||
return;
|
case Camera.DATA_URL:
|
||||||
|
case Camera.NATIVE_URI:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, "Incorrect option: destinationType"));
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ChooserBase<PhotoResult> chooserTask = null;
|
ChooserBase<PhotoResult> chooserTask = null;
|
||||||
@ -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));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user