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 2013/09/13 03:19:44 UTC
[09/31] Removed all plugin dependancies for 3.0.0 and updated
cordova.js
http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/8fc5c374/wp7/template/CordovaWP7AppProj.csproj
----------------------------------------------------------------------
diff --git a/wp7/template/CordovaWP7AppProj.csproj b/wp7/template/CordovaWP7AppProj.csproj
index 13b1192..882c2da 100644
--- a/wp7/template/CordovaWP7AppProj.csproj
+++ b/wp7/template/CordovaWP7AppProj.csproj
@@ -102,10 +102,11 @@
<Compile Include="cordovalib\PluginResult.cs" />
<Compile Include="cordovalib\ScriptCallback.cs" />
<Compile Include="cordovalib\XHRHelper.cs" />
+ <Compile Include="cordovalib\MimeTypeMapper.cs" />
+ <Compile Include="Plugins\DebugConsole.cs" />
<Compile Include="MainPage.xaml.cs">
<DependentUpon>MainPage.xaml</DependentUpon>
</Compile>
- <Compile Include="Plugins\Capture.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
@@ -170,56 +171,6 @@
<ItemGroup>
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
</ItemGroup>
- <ItemGroup>
- <Compile Include="Plugins\Accelerometer.cs" />
- <Compile Include="Plugins\AudioPlayer.cs" />
- <Compile Include="Plugins\Battery.cs" />
- <Compile Include="Plugins\Camera.cs" />
- <Compile Include="Plugins\Compass.cs" />
- <Compile Include="Plugins\Contacts.cs" />
- <Compile Include="Plugins\Device.cs" />
- <Compile Include="Plugins\File.cs" />
- <Compile Include="Plugins\FileTransfer.cs" />
- <Compile Include="Plugins\GeoLocation.cs" />
- <Compile Include="Plugins\Globalization.cs" />
- <Compile Include="Plugins\InAppBrowser.cs" />
- <Compile Include="Plugins\Media.cs" />
- <Compile Include="Plugins\MimeTypeMapper.cs" />
- <Compile Include="Plugins\NetworkStatus.cs" />
- <Compile Include="Plugins\Notification.cs" />
- <Compile Include="Plugins\UI\AudioCaptureTask.cs" />
- <Compile Include="Plugins\UI\AudioRecorder.xaml.cs">
- <DependentUpon>AudioRecorder.xaml</DependentUpon>
- </Compile>
- <Compile Include="Plugins\UI\ImageCapture.xaml.cs">
- <DependentUpon>ImageCapture.xaml</DependentUpon>
- </Compile>
- <Compile Include="Plugins\UI\NotificationBox.xaml.cs">
- <DependentUpon>NotificationBox.xaml</DependentUpon>
- </Compile>
- <Compile Include="Plugins\UI\VideoCaptureTask.cs" />
- <Compile Include="Plugins\UI\VideoRecorder.xaml.cs">
- <DependentUpon>VideoRecorder.xaml</DependentUpon>
- </Compile>
- </ItemGroup>
- <ItemGroup>
- <Page Include="Plugins\UI\AudioRecorder.xaml">
- <Generator>MSBuild:Compile</Generator>
- <SubType>Designer</SubType>
- </Page>
- <Page Include="Plugins\UI\ImageCapture.xaml">
- <Generator>MSBuild:Compile</Generator>
- <SubType>Designer</SubType>
- </Page>
- <Page Include="Plugins\UI\NotificationBox.xaml">
- <Generator>MSBuild:Compile</Generator>
- <SubType>Designer</SubType>
- </Page>
- <Page Include="Plugins\UI\VideoRecorder.xaml">
- <Generator>MSBuild:Compile</Generator>
- <SubType>Designer</SubType>
- </Page>
- </ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\Silverlight for Phone\$(TargetFrameworkVersion)\Microsoft.Silverlight.$(TargetFrameworkProfile).Overrides.targets" />
<Import Project="$(MSBuildExtensionsPath)\Microsoft\Silverlight for Phone\$(TargetFrameworkVersion)\Microsoft.Silverlight.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/8fc5c374/wp7/template/MainPage.xaml
----------------------------------------------------------------------
diff --git a/wp7/template/MainPage.xaml b/wp7/template/MainPage.xaml
index 8b1e84b..e066fa6 100644
--- a/wp7/template/MainPage.xaml
+++ b/wp7/template/MainPage.xaml
@@ -22,14 +22,6 @@
Margin="0,0,0,0"
x:Name="CordovaView"
VerticalAlignment="Stretch" />
- <Image Source="SplashScreenImage.jpg"
- x:Name="SplashImage"
- VerticalAlignment="Center"
- HorizontalAlignment="Stretch">
- <Image.Projection>
- <PlaneProjection x:Name="SplashProjector" CenterOfRotationX="0"/>
- </Image.Projection>
- </Image>
</Grid>
</phone:PhoneApplicationPage>
http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/8fc5c374/wp7/template/MainPage.xaml.cs
----------------------------------------------------------------------
diff --git a/wp7/template/MainPage.xaml.cs b/wp7/template/MainPage.xaml.cs
index b9ec7e1..187228c 100644
--- a/wp7/template/MainPage.xaml.cs
+++ b/wp7/template/MainPage.xaml.cs
@@ -48,25 +48,6 @@ namespace $safeprojectname$
private void CordovaView_Loaded(object sender, RoutedEventArgs e)
{
this.CordovaView.Loaded -= CordovaView_Loaded;
- // first time load will have an animation
- Storyboard _storyBoard = new Storyboard();
- DoubleAnimation animation = new DoubleAnimation()
- {
- From = 0,
- Duration = TimeSpan.FromSeconds(0.6),
- To = 90
- };
- Storyboard.SetTarget(animation, SplashProjector);
- Storyboard.SetTargetProperty(animation, new PropertyPath("RotationY"));
- _storyBoard.Children.Add(animation);
- _storyBoard.Begin();
- _storyBoard.Completed += Splash_Completed;
- }
-
- void Splash_Completed(object sender, EventArgs e)
- {
- (sender as Storyboard).Completed -= Splash_Completed;
- LayoutRoot.Children.Remove(SplashImage);
}
}
}
http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/8fc5c374/wp7/template/Properties/WMAppManifest.xml
----------------------------------------------------------------------
diff --git a/wp7/template/Properties/WMAppManifest.xml b/wp7/template/Properties/WMAppManifest.xml
index 96332e1..bea7076 100644
--- a/wp7/template/Properties/WMAppManifest.xml
+++ b/wp7/template/Properties/WMAppManifest.xml
@@ -9,20 +9,7 @@
<IconPath IsRelative="true" IsResource="false">ApplicationIcon.png</IconPath>
<Capabilities>
- <Capability Name="ID_CAP_IDENTITY_DEVICE" />
- <Capability Name="ID_CAP_IDENTITY_USER" />
- <Capability Name="ID_CAP_LOCATION" />
- <Capability Name="ID_CAP_NETWORKING" />
- <Capability Name="ID_CAP_WEBBROWSERCOMPONENT" />
- <Capability Name="ID_CAP_APPOINTMENTS"/>
- <Capability Name="ID_CAP_CONTACTS"/>
- <Capability Name="ID_CAP_ISV_CAMERA"/>
- <Capability Name="ID_CAP_MEDIALIB"/>
- <Capability Name="ID_CAP_MICROPHONE"/>
- <Capability Name="ID_CAP_PHONEDIALER"/>
- <Capability Name="ID_CAP_PUSH_NOTIFICATION"/>
- <Capability Name="ID_CAP_SENSORS"/>
- <Capability Name="ID_HW_FRONTCAMERA"/>
+ <Capability Name="ID_CAP_WEBBROWSERCOMPONENT" />
</Capabilities>
<Tasks>
http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/8fc5c374/wp7/template/config.xml
----------------------------------------------------------------------
diff --git a/wp7/template/config.xml b/wp7/template/config.xml
index 054d26f..616d7cc 100644
--- a/wp7/template/config.xml
+++ b/wp7/template/config.xml
@@ -20,68 +20,8 @@
#
-->
<widget>
-
- <features>
- <feature name="Device">
- <param name="wp-package" value="Device" onload="false"/>
- </feature>
+ <access origin="*"/>
<feature name="Logger">
<param name="wp-package" value="Logger"/>
</feature>
- <feature name="Compass">
- <param name="wp-package" value="Compass" />
- </feature>
- <feature name="Accelerometer">
- <param name="wp-package" value="Accelerometer"/>
- </feature>
- <feature name="Camera">
- <param name="wp-package" value="Camera"/>
- </feature>
- <feature name="NetworkStatus">
- <param name="wp-package" value="NetworkStatus"/>
- </feature>
- <feature name="Contacts">
- <param name="wp-package" value="Contacts"/>
- </feature>
- <feature name="Echo">
- <param name="wp-package" value="Echo"/>
- </feature>
- <feature name="File">
- <param name="wp-package" value="File"/>
- </feature>
- <feature name="FileTransfer">
- <param name="wp-package" value="FileTransfer"/>
- </feature>
- <feature name="Geolocation">
- <param name="wp-package" value="Geolocation"/>
- </feature>
- <feature name="Geolocation">
- <param name="wp-package" value="Geolocation"/>
- </feature>
- <feature name="Media">
- <param name="wp-package" value="Media"/>
- </feature>
- <feature name="Capture">
- <param name="wp-package" value="Capture"/>
- </feature>
- <feature name="SplashScreen">
- <param name="wp-package" value="SplashScreen"/>
- </feature>
- <feature name="Battery">
- <param name="wp-package" value="Battery"/>
- </feature>
- <feature name="Globalization">
- <param name="wp-package" value="Globalization"/>
- </feature>
- <feature name="InAppBrowser">
- <param name="wp-package" value="InAppBrowser"/>
- </feature>
- <feature name="Notification">
- <param name="wp-package" value="Notification"/>
- </feature>
- </features>
-
-
- <access origin="*"/>
-
</widget>
http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/8fc5c374/wp7/template/cordovalib/CordovaCommandCall.cs
----------------------------------------------------------------------
diff --git a/wp7/template/cordovalib/CordovaCommandCall.cs b/wp7/template/cordovalib/CordovaCommandCall.cs
index 810f5e2..facc991 100644
--- a/wp7/template/cordovalib/CordovaCommandCall.cs
+++ b/wp7/template/cordovalib/CordovaCommandCall.cs
@@ -44,6 +44,7 @@ namespace WPCordovaClassLib.Cordova
/// <returns>New class instance or null of string does not represent Cordova command</returns>
public static CordovaCommandCall Parse(string commandStr)
{
+ System.Diagnostics.Debug.WriteLine("CommandString : " + commandStr);
if (string.IsNullOrEmpty(commandStr))
{
return null;
http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/8fc5c374/wp7/template/cordovalib/MimeTypeMapper.cs
----------------------------------------------------------------------
diff --git a/wp7/template/cordovalib/MimeTypeMapper.cs b/wp7/template/cordovalib/MimeTypeMapper.cs
new file mode 100644
index 0000000..a2794f5
--- /dev/null
+++ b/wp7/template/cordovalib/MimeTypeMapper.cs
@@ -0,0 +1,101 @@
+/*
+ Licensed 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.
+*/
+
+using System.Collections.Generic;
+using System.IO;
+
+namespace WPCordovaClassLib.Cordova.Commands
+{
+ /// <summary>
+ /// Represents file extension to mime type mapper.
+ /// </summary>
+ public static class MimeTypeMapper
+ {
+ /// <summary>
+ /// For unknown type it is recommended to use 'application/octet-stream'
+ /// http://stackoverflow.com/questions/1176022/unknown-file-type-mime
+ /// </summary>
+ private static string DefaultMimeType = "application/octet-stream";
+
+ /// <summary>
+ /// Stores mime type for all necessary extension
+ /// </summary>
+ private static readonly Dictionary<string, string> MIMETypesDictionary = new Dictionary<string, string>
+ {
+ {"avi", "video/x-msvideo"},
+ {"bmp", "image/bmp"},
+ {"gif", "image/gif"},
+ {"html","text/html"},
+ {"jpe", "image/jpeg"},
+ {"jpeg", "image/jpeg"},
+ {"jpg", "image/jpeg"},
+ {"js","text/javascript"},
+ {"mov", "video/quicktime"},
+ {"mp2", "audio/mpeg"},
+ {"mp3", "audio/mpeg"},
+ {"mp4", "video/mp4"},
+ {"mpe", "video/mpeg"},
+ {"mpeg", "video/mpeg"},
+ {"mpg", "video/mpeg"},
+ {"mpga", "audio/mpeg"},
+ {"pbm", "image/x-portable-bitmap"},
+ {"pcm", "audio/x-pcm"},
+ {"pct", "image/pict"},
+ {"pgm", "image/x-portable-graymap"},
+ {"pic", "image/pict"},
+ {"pict", "image/pict"},
+ {"png", "image/png"},
+ {"pnm", "image/x-portable-anymap"},
+ {"pnt", "image/x-macpaint"},
+ {"pntg", "image/x-macpaint"},
+ {"ppm", "image/x-portable-pixmap"},
+ {"qt", "video/quicktime"},
+ {"ra", "audio/x-pn-realaudio"},
+ {"ram", "audio/x-pn-realaudio"},
+ {"ras", "image/x-cmu-raster"},
+ {"rgb", "image/x-rgb"},
+ {"snd", "audio/basic"},
+ {"txt", "text/plain"},
+ {"tif", "image/tiff"},
+ {"tiff", "image/tiff"},
+ {"wav", "audio/x-wav"},
+ {"wbmp", "image/vnd.wap.wbmp"},
+
+ };
+ /// <summary>
+ /// Gets mime type by file extension
+ /// </summary>
+ /// <param name="fileName">file name to extract extension</param>
+ /// <returns>mime type</returns>
+ public static string GetMimeType(string fileName)
+ {
+ string ext = Path.GetExtension(fileName);
+
+ // invalid extension
+ if (string.IsNullOrEmpty(ext) || !ext.StartsWith("."))
+ {
+ return DefaultMimeType;
+ }
+
+ ext = ext.Remove(0, 1);
+
+ if (MIMETypesDictionary.ContainsKey(ext))
+ {
+ return MIMETypesDictionary[ext];
+ }
+
+ return DefaultMimeType;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/8fc5c374/wp8/template/CordovaWP8AppProj.csproj
----------------------------------------------------------------------
diff --git a/wp8/template/CordovaWP8AppProj.csproj b/wp8/template/CordovaWP8AppProj.csproj
index 097d9a9..72aa388 100644
--- a/wp8/template/CordovaWP8AppProj.csproj
+++ b/wp8/template/CordovaWP8AppProj.csproj
@@ -133,12 +133,15 @@
<DependentUpon>CordovaView.xaml</DependentUpon>
</Compile>
<Compile Include="cordovalib\IBrowserDecorator.cs" />
+ <Compile Include="cordovalib\ImageExifHelper.cs" />
<Compile Include="cordovalib\JSON\JsonHelper.cs" />
<Compile Include="cordovalib\NativeExecution.cs" />
<Compile Include="cordovalib\OrientationHelper.cs" />
<Compile Include="cordovalib\PluginResult.cs" />
<Compile Include="cordovalib\ScriptCallback.cs" />
<Compile Include="cordovalib\XHRHelper.cs" />
+ <Compile Include="cordovalib\MimeTypeMapper.cs" />
+ <Compile Include="Plugins\DebugConsole.cs" />
<Compile Include="MainPage.xaml.cs">
<DependentUpon>MainPage.xaml</DependentUpon>
</Compile>
@@ -159,13 +162,7 @@
</Page>
</ItemGroup>
<ItemGroup>
- <Content Include="www\cordova.js" />
- <Content Include="www\css\index.css" />
- <Content Include="www\img\logo.png" />
- <Content Include="www\index.html">
- <SubType>Designer</SubType>
- </Content>
- <Content Include="www\js\index.js" />
+ <Content Include="www\**" />
<None Include="cordova\lib\build.js" />
<None Include="cordova\lib\clean.js" />
<None Include="cordova\lib\deploy.js" />
@@ -208,58 +205,6 @@
<ItemGroup>
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
</ItemGroup>
- <ItemGroup>
- <Compile Include="Plugins\Accelerometer.cs" />
- <Compile Include="Plugins\AudioPlayer.cs" />
- <Compile Include="Plugins\Battery.cs" />
- <Compile Include="Plugins\Camera.cs" />
- <Compile Include="Plugins\Capture.cs" />
- <Compile Include="Plugins\Compass.cs" />
- <Compile Include="Plugins\Contacts.cs" />
- <Compile Include="Plugins\Device.cs" />
- <Compile Include="Plugins\File.cs" />
- <Compile Include="Plugins\FileTransfer.cs" />
- <Compile Include="Plugins\GeoLocation.cs" />
- <Compile Include="Plugins\Globalization.cs" />
- <Compile Include="Plugins\ImageExifHelper.cs" />
- <Compile Include="Plugins\InAppBrowser.cs" />
- <Compile Include="Plugins\Media.cs" />
- <Compile Include="Plugins\MimeTypeMapper.cs" />
- <Compile Include="Plugins\NetworkStatus.cs" />
- <Compile Include="Plugins\Notification.cs" />
- <Compile Include="Plugins\UI\AudioCaptureTask.cs" />
- <Compile Include="Plugins\UI\AudioRecorder.xaml.cs">
- <DependentUpon>AudioRecorder.xaml</DependentUpon>
- </Compile>
- <Compile Include="Plugins\UI\ImageCapture.xaml.cs">
- <DependentUpon>ImageCapture.xaml</DependentUpon>
- </Compile>
- <Compile Include="Plugins\UI\NotificationBox.xaml.cs">
- <DependentUpon>NotificationBox.xaml</DependentUpon>
- </Compile>
- <Compile Include="Plugins\UI\VideoCaptureTask.cs" />
- <Compile Include="Plugins\UI\VideoRecorder.xaml.cs">
- <DependentUpon>VideoRecorder.xaml</DependentUpon>
- </Compile>
- </ItemGroup>
- <ItemGroup>
- <Page Include="Plugins\UI\AudioRecorder.xaml">
- <Generator>MSBuild:Compile</Generator>
- <SubType>Designer</SubType>
- </Page>
- <Page Include="Plugins\UI\ImageCapture.xaml">
- <Generator>MSBuild:Compile</Generator>
- <SubType>Designer</SubType>
- </Page>
- <Page Include="Plugins\UI\NotificationBox.xaml">
- <Generator>MSBuild:Compile</Generator>
- <SubType>Designer</SubType>
- </Page>
- <Page Include="Plugins\UI\VideoRecorder.xaml">
- <Generator>MSBuild:Compile</Generator>
- <SubType>Designer</SubType>
- </Page>
- </ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\$(TargetFrameworkIdentifier)\$(TargetFrameworkVersion)\Microsoft.$(TargetFrameworkIdentifier).$(TargetFrameworkVersion).Overrides.targets" />
<Import Project="$(MSBuildExtensionsPath)\Microsoft\$(TargetFrameworkIdentifier)\$(TargetFrameworkVersion)\Microsoft.$(TargetFrameworkIdentifier).CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/8fc5c374/wp8/template/MainPage.xaml
----------------------------------------------------------------------
diff --git a/wp8/template/MainPage.xaml b/wp8/template/MainPage.xaml
index db0d8e6..8b85fb6 100644
--- a/wp8/template/MainPage.xaml
+++ b/wp8/template/MainPage.xaml
@@ -39,14 +39,6 @@
Margin="0,0,0,0"
x:Name="CordovaView"
VerticalAlignment="Stretch" />
- <Image Source="SplashScreenImage.jpg"
- x:Name="SplashImage"
- VerticalAlignment="Center"
- HorizontalAlignment="Stretch">
- <Image.Projection>
- <PlaneProjection x:Name="SplashProjector" CenterOfRotationX="0"/>
- </Image.Projection>
- </Image>
</Grid>
</phone:PhoneApplicationPage>
http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/8fc5c374/wp8/template/MainPage.xaml.cs
----------------------------------------------------------------------
diff --git a/wp8/template/MainPage.xaml.cs b/wp8/template/MainPage.xaml.cs
index b9ec7e1..187228c 100644
--- a/wp8/template/MainPage.xaml.cs
+++ b/wp8/template/MainPage.xaml.cs
@@ -48,25 +48,6 @@ namespace $safeprojectname$
private void CordovaView_Loaded(object sender, RoutedEventArgs e)
{
this.CordovaView.Loaded -= CordovaView_Loaded;
- // first time load will have an animation
- Storyboard _storyBoard = new Storyboard();
- DoubleAnimation animation = new DoubleAnimation()
- {
- From = 0,
- Duration = TimeSpan.FromSeconds(0.6),
- To = 90
- };
- Storyboard.SetTarget(animation, SplashProjector);
- Storyboard.SetTargetProperty(animation, new PropertyPath("RotationY"));
- _storyBoard.Children.Add(animation);
- _storyBoard.Begin();
- _storyBoard.Completed += Splash_Completed;
- }
-
- void Splash_Completed(object sender, EventArgs e)
- {
- (sender as Storyboard).Completed -= Splash_Completed;
- LayoutRoot.Children.Remove(SplashImage);
}
}
}
http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/8fc5c374/wp8/template/Properties/WMAppManifest.xml
----------------------------------------------------------------------
diff --git a/wp8/template/Properties/WMAppManifest.xml b/wp8/template/Properties/WMAppManifest.xml
index 36f2330..9b724a1 100644
--- a/wp8/template/Properties/WMAppManifest.xml
+++ b/wp8/template/Properties/WMAppManifest.xml
@@ -7,21 +7,7 @@
<App xmlns="" ProductID="{$guid1$}" Title="$safeprojectname$" RuntimeType="Silverlight" Version="1.0.0.0" Genre="apps.normal" Author="$safeprojectname$ author" BitsPerPixel="32" Description="Apache Cordova for Windows Phone" Publisher="$safeprojectname$" PublisherID="{db093ed5-53b1-45f7-af72-751e8f36ab80}">
<IconPath IsRelative="true" IsResource="false">ApplicationIcon.png</IconPath>
<Capabilities>
- <Capability Name="ID_CAP_IDENTITY_DEVICE" />
- <Capability Name="ID_CAP_IDENTITY_USER" />
- <Capability Name="ID_CAP_LOCATION" />
- <Capability Name="ID_CAP_NETWORKING" />
<Capability Name="ID_CAP_WEBBROWSERCOMPONENT" />
- <Capability Name="ID_CAP_APPOINTMENTS" />
- <Capability Name="ID_CAP_CONTACTS" />
- <Capability Name="ID_CAP_ISV_CAMERA" />
- <Capability Name="ID_CAP_MICROPHONE" />
- <Capability Name="ID_CAP_PHONEDIALER" />
- <Capability Name="ID_CAP_PUSH_NOTIFICATION" />
- <Capability Name="ID_CAP_SENSORS" />
- <Capability Name="ID_CAP_MEDIALIB_AUDIO" />
- <Capability Name="ID_CAP_MEDIALIB_PHOTO" />
- <Capability Name="ID_CAP_MEDIALIB_PLAYBACK" />
</Capabilities>
<Tasks>
<DefaultTask Name="_default" NavigationPage="MainPage.xaml" />
http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/8fc5c374/wp8/template/config.xml
----------------------------------------------------------------------
diff --git a/wp8/template/config.xml b/wp8/template/config.xml
index 054d26f..616d7cc 100644
--- a/wp8/template/config.xml
+++ b/wp8/template/config.xml
@@ -20,68 +20,8 @@
#
-->
<widget>
-
- <features>
- <feature name="Device">
- <param name="wp-package" value="Device" onload="false"/>
- </feature>
+ <access origin="*"/>
<feature name="Logger">
<param name="wp-package" value="Logger"/>
</feature>
- <feature name="Compass">
- <param name="wp-package" value="Compass" />
- </feature>
- <feature name="Accelerometer">
- <param name="wp-package" value="Accelerometer"/>
- </feature>
- <feature name="Camera">
- <param name="wp-package" value="Camera"/>
- </feature>
- <feature name="NetworkStatus">
- <param name="wp-package" value="NetworkStatus"/>
- </feature>
- <feature name="Contacts">
- <param name="wp-package" value="Contacts"/>
- </feature>
- <feature name="Echo">
- <param name="wp-package" value="Echo"/>
- </feature>
- <feature name="File">
- <param name="wp-package" value="File"/>
- </feature>
- <feature name="FileTransfer">
- <param name="wp-package" value="FileTransfer"/>
- </feature>
- <feature name="Geolocation">
- <param name="wp-package" value="Geolocation"/>
- </feature>
- <feature name="Geolocation">
- <param name="wp-package" value="Geolocation"/>
- </feature>
- <feature name="Media">
- <param name="wp-package" value="Media"/>
- </feature>
- <feature name="Capture">
- <param name="wp-package" value="Capture"/>
- </feature>
- <feature name="SplashScreen">
- <param name="wp-package" value="SplashScreen"/>
- </feature>
- <feature name="Battery">
- <param name="wp-package" value="Battery"/>
- </feature>
- <feature name="Globalization">
- <param name="wp-package" value="Globalization"/>
- </feature>
- <feature name="InAppBrowser">
- <param name="wp-package" value="InAppBrowser"/>
- </feature>
- <feature name="Notification">
- <param name="wp-package" value="Notification"/>
- </feature>
- </features>
-
-
- <access origin="*"/>
-
</widget>
http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/8fc5c374/wp8/template/cordovalib/CordovaCommandCall.cs
----------------------------------------------------------------------
diff --git a/wp8/template/cordovalib/CordovaCommandCall.cs b/wp8/template/cordovalib/CordovaCommandCall.cs
index a8851fd..facc991 100644
--- a/wp8/template/cordovalib/CordovaCommandCall.cs
+++ b/wp8/template/cordovalib/CordovaCommandCall.cs
@@ -44,7 +44,7 @@ namespace WPCordovaClassLib.Cordova
/// <returns>New class instance or null of string does not represent Cordova command</returns>
public static CordovaCommandCall Parse(string commandStr)
{
- //System.Diagnostics.Debug.WriteLine("CommandString : " + commandStr);
+ System.Diagnostics.Debug.WriteLine("CommandString : " + commandStr);
if (string.IsNullOrEmpty(commandStr))
{
return null;
http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/8fc5c374/wp8/template/cordovalib/ImageExifHelper.cs
----------------------------------------------------------------------
diff --git a/wp8/template/cordovalib/ImageExifHelper.cs b/wp8/template/cordovalib/ImageExifHelper.cs
new file mode 100644
index 0000000..62b6462
--- /dev/null
+++ b/wp8/template/cordovalib/ImageExifHelper.cs
@@ -0,0 +1,209 @@
+/*
+ Licensed 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.
+
+*/
+
+using System;
+using System.Diagnostics;
+using System.IO;
+using System.Windows.Media.Imaging;
+
+namespace WPCordovaClassLib.Cordova.Commands
+{
+ public class ImageExifOrientation
+ {
+ public const int Portrait = 1;
+ public const int PortraitUpsideDown = 3;
+ public const int LandscapeLeft = 6;
+ public const int LandscapeRight = 8;
+ }
+
+ public class ImageExifHelper
+ {
+
+ public static Stream RotateStream(Stream stream, int angle)
+ {
+ stream.Position = 0;
+ if (angle % 90 != 0 || angle < 0)
+ {
+ throw new ArgumentException();
+ }
+ if (angle % 360 == 0)
+ {
+ return stream;
+ }
+
+ angle = angle % 360;
+
+ BitmapImage bitmap = new BitmapImage();
+ bitmap.SetSource(stream);
+ WriteableBitmap wbSource = new WriteableBitmap(bitmap);
+
+ WriteableBitmap wbTarget = null;
+
+ int srcPixelWidth = wbSource.PixelWidth;
+ int srcPixelHeight = wbSource.PixelHeight;
+
+ if (angle % 180 == 0)
+ {
+ wbTarget = new WriteableBitmap(srcPixelWidth, srcPixelHeight);
+ }
+ else
+ {
+ wbTarget = new WriteableBitmap(srcPixelHeight, srcPixelWidth);
+ }
+
+ int destPixelWidth = wbTarget.PixelWidth;
+ int[] srcPxls = wbSource.Pixels;
+ int[] destPxls = wbTarget.Pixels;
+
+ // this ugly if/else is to avoid a conditional check for every pixel
+ if (angle == 90)
+ {
+ for (int x = 0; x < srcPixelWidth; x++)
+ {
+ for (int y = 0; y < srcPixelHeight; y++)
+ {
+ destPxls[(srcPixelHeight - y - 1) + (x * destPixelWidth)] = srcPxls[x + y * srcPixelWidth];
+ }
+ }
+ }
+ else if (angle == 180)
+ {
+ for (int x = 0; x < srcPixelWidth; x++)
+ {
+ for (int y = 0; y < srcPixelHeight; y++)
+ {
+ destPxls[(srcPixelWidth - x - 1) + (srcPixelHeight - y - 1) * srcPixelWidth] = srcPxls[x + y * srcPixelWidth];
+ }
+ }
+ }
+ else if (angle == 270)
+ {
+ for (int x = 0; x < srcPixelWidth; x++)
+ {
+ for (int y = 0; y < srcPixelHeight; y++)
+ {
+ destPxls[y + (srcPixelWidth - x - 1) * destPixelWidth] = srcPxls[x + y * srcPixelWidth];
+ }
+ }
+ }
+
+ MemoryStream targetStream = new MemoryStream();
+ wbTarget.SaveJpeg(targetStream, destPixelWidth, wbTarget.PixelHeight, 0, 100);
+ return targetStream;
+ }
+
+ public static int getImageOrientationFromStream(Stream imgStream)
+ {
+
+ // 0xFFD8 : jpgHeader
+ // 0xFFE1 :
+ // 0x???? : length of exif data
+ // 0x????, 0x???? : Chars 'E','x','i','f'
+ // 0x0000 : 2 empty bytes
+ // <== mark beginning of tags SIZE:ID:VALUE
+ // 0x???? : 'II' or 'MM' for Intel or Motorola ( always getting II on my WP7 devices ), determines littleEndian-ness
+ // 0x002A : marker value
+ // 0x???? : offset to the Image File Data
+
+ // XXXX possible space before actual tag data ... we skip to mark + offset
+
+ // 0x???? number of exif tags present
+
+ // make sure we are at the beginning
+ imgStream.Seek(0, SeekOrigin.Begin);
+ BinaryReader reader = new BinaryReader(imgStream);
+
+ byte[] jpgHdr = reader.ReadBytes(2); // always (0xFFD8)
+
+ byte start = reader.ReadByte(); // 0xFF
+ byte index = reader.ReadByte(); // 0xE1
+
+ while (start == 0xFF && index != 0xE1) // This never seems to happen, todo: optimize
+ {
+ // Get the data length
+ ushort dLen = BitConverter.ToUInt16(reader.ReadBytes(2), 0);
+ // skip along
+ reader.ReadBytes(dLen - 2);
+ start = reader.ReadByte();
+ index = reader.ReadByte();
+ }
+
+ // It's only success if we found the 0xFFE1 marker
+ if (start != 0xFF || index != 0xE1)
+ {
+ // throw new Exception("Could not find Exif data block");
+ Debug.WriteLine("Did not find EXIF data");
+ return 0;
+ }
+
+ // read 2 byte length of EXIF data
+ ushort exifLen = BitConverter.ToUInt16(reader.ReadBytes(2), 0);
+ String exif = ""; // build the string
+ for (var n = 0; n < 4; n++)
+ {
+ exif += reader.ReadChar();
+ }
+ if (exif != "Exif")
+ {
+ // did not find exif data ...
+ Debug.WriteLine("Did not find EXIF data");
+ return 0;
+ }
+
+ // read 2 empty bytes
+ //ushort emptyBytes = BitConverter.ToUInt16(reader.ReadBytes(2), 0);
+ reader.ReadBytes(2);
+
+ long headerMark = reader.BaseStream.Position; // where are we now <==
+
+ //bool isLEndian = (reader.ReadChar() + "" + reader.ReadChar()) == "II";
+ reader.ReadBytes(2); // 'II' or 'MM', but we don't care
+
+ if (0x002A != BitConverter.ToUInt16(reader.ReadBytes(2), 0))
+ {
+ Debug.WriteLine("Error in data != 0x002A");
+ return 0;
+ }
+
+ // Get the offset to the IFD (image file directory)
+ ushort imgOffset = BitConverter.ToUInt16(reader.ReadBytes(2), 0);
+
+ imgStream.Position = headerMark + imgOffset;
+ ushort tagCount = BitConverter.ToUInt16(reader.ReadBytes(2), 0);
+ for (ushort x = 0; x < tagCount; x++)
+ {
+ // Orientation = 0x112, aka 274
+ if (0x112 == BitConverter.ToUInt16(reader.ReadBytes(2), 0))
+ {
+ ushort dType = BitConverter.ToUInt16(reader.ReadBytes(2), 0);
+ // don't care ..
+ uint comps = reader.ReadUInt32();
+ byte[] tagData = reader.ReadBytes(4);
+ int orientation = (int)tagData[0];
+ Debug.WriteLine("orientation = " + orientation.ToString());
+ return orientation;
+ // 6 means rotate clockwise 90 deg
+ // 8 means rotate counter-clockwise 90 deg
+ // 1 means all is good
+ // 3 means flip vertical
+ }
+ // skip to the next item, 12 bytes each
+ reader.BaseStream.Seek(10, SeekOrigin.Current);
+ }
+ return 0;
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/8fc5c374/wp8/template/cordovalib/MimeTypeMapper.cs
----------------------------------------------------------------------
diff --git a/wp8/template/cordovalib/MimeTypeMapper.cs b/wp8/template/cordovalib/MimeTypeMapper.cs
new file mode 100644
index 0000000..a2794f5
--- /dev/null
+++ b/wp8/template/cordovalib/MimeTypeMapper.cs
@@ -0,0 +1,101 @@
+/*
+ Licensed 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.
+*/
+
+using System.Collections.Generic;
+using System.IO;
+
+namespace WPCordovaClassLib.Cordova.Commands
+{
+ /// <summary>
+ /// Represents file extension to mime type mapper.
+ /// </summary>
+ public static class MimeTypeMapper
+ {
+ /// <summary>
+ /// For unknown type it is recommended to use 'application/octet-stream'
+ /// http://stackoverflow.com/questions/1176022/unknown-file-type-mime
+ /// </summary>
+ private static string DefaultMimeType = "application/octet-stream";
+
+ /// <summary>
+ /// Stores mime type for all necessary extension
+ /// </summary>
+ private static readonly Dictionary<string, string> MIMETypesDictionary = new Dictionary<string, string>
+ {
+ {"avi", "video/x-msvideo"},
+ {"bmp", "image/bmp"},
+ {"gif", "image/gif"},
+ {"html","text/html"},
+ {"jpe", "image/jpeg"},
+ {"jpeg", "image/jpeg"},
+ {"jpg", "image/jpeg"},
+ {"js","text/javascript"},
+ {"mov", "video/quicktime"},
+ {"mp2", "audio/mpeg"},
+ {"mp3", "audio/mpeg"},
+ {"mp4", "video/mp4"},
+ {"mpe", "video/mpeg"},
+ {"mpeg", "video/mpeg"},
+ {"mpg", "video/mpeg"},
+ {"mpga", "audio/mpeg"},
+ {"pbm", "image/x-portable-bitmap"},
+ {"pcm", "audio/x-pcm"},
+ {"pct", "image/pict"},
+ {"pgm", "image/x-portable-graymap"},
+ {"pic", "image/pict"},
+ {"pict", "image/pict"},
+ {"png", "image/png"},
+ {"pnm", "image/x-portable-anymap"},
+ {"pnt", "image/x-macpaint"},
+ {"pntg", "image/x-macpaint"},
+ {"ppm", "image/x-portable-pixmap"},
+ {"qt", "video/quicktime"},
+ {"ra", "audio/x-pn-realaudio"},
+ {"ram", "audio/x-pn-realaudio"},
+ {"ras", "image/x-cmu-raster"},
+ {"rgb", "image/x-rgb"},
+ {"snd", "audio/basic"},
+ {"txt", "text/plain"},
+ {"tif", "image/tiff"},
+ {"tiff", "image/tiff"},
+ {"wav", "audio/x-wav"},
+ {"wbmp", "image/vnd.wap.wbmp"},
+
+ };
+ /// <summary>
+ /// Gets mime type by file extension
+ /// </summary>
+ /// <param name="fileName">file name to extract extension</param>
+ /// <returns>mime type</returns>
+ public static string GetMimeType(string fileName)
+ {
+ string ext = Path.GetExtension(fileName);
+
+ // invalid extension
+ if (string.IsNullOrEmpty(ext) || !ext.StartsWith("."))
+ {
+ return DefaultMimeType;
+ }
+
+ ext = ext.Remove(0, 1);
+
+ if (MIMETypesDictionary.ContainsKey(ext))
+ {
+ return MIMETypesDictionary[ext];
+ }
+
+ return DefaultMimeType;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/8fc5c374/wp8/template/cordovalib/NativeExecution.cs
----------------------------------------------------------------------
diff --git a/wp8/template/cordovalib/NativeExecution.cs b/wp8/template/cordovalib/NativeExecution.cs
index 4eb7c33..45ed7aa 100644
--- a/wp8/template/cordovalib/NativeExecution.cs
+++ b/wp8/template/cordovalib/NativeExecution.cs
@@ -146,7 +146,6 @@ namespace WPCordovaClassLib.Cordova
// new Thread(methodInvokation).Start();
//}
-
}
catch (Exception ex)
{