Skip to content
Permalink
Browse files
CB-5114 Windows 8.1 - Use a new proxy as old geolocation methods is d…
…eprecated

* Added separate section for Windows Univeral Apps
* Made GeolocationProxy compatible with windows8.0 and 8.1 api versions
  • Loading branch information
sgrebnov committed Jul 11, 2014
1 parent e9eaa78 commit 4137f9dd4c83c118912a582a3bb414c1167ed6cb
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 174 deletions.
@@ -191,24 +191,55 @@ xmlns:android="http://schemas.android.com/apk/res/android"
<config-file target="package.appxmanifest" parent="/Package/Capabilities">
<DeviceCapability Name="location" />
</config-file>

<js-module src="src/windows/GeolocationProxy.js" name="GeolocationProxy">
<runs />
</js-module>

<js-module src="www/Coordinates.js" name="Coordinates">
<clobbers target="Coordinates" />
</js-module>

<js-module src="www/PositionError.js" name="PositionError">
<clobbers target="PositionError" />
</js-module>
<js-module src="src/windows8/GeolocationProxy.js" name="GeolocationProxy">
<merges target="" />

<js-module src="www/Position.js" name="Position">
<clobbers target="Position" />
</js-module>

<js-module src="www/geolocation.js" name="geolocation">
<clobbers target="navigator.geolocation" />
</js-module>
</platform>

<!-- windows81 -->
<platform name="windows81">
<config-file target="package.appxmanifest" parent="/Package/Capabilities">
<DeviceCapability Name="location" />
</config-file>
<js-module src="src/windows81/GeolocationProxy.js" name="GeolocationProxy">
<merges target="" />
</js-module>
</platform>
<!-- windows universal apps (Windows 8.1, Windows Phone 8.1, Windows 8.0) -->
<platform name="windows">
<config-file target="package.appxmanifest" parent="/Package/Capabilities">
<DeviceCapability Name="location" />
</config-file>

<js-module src="src/windows/GeolocationProxy.js" name="GeolocationProxy">
<runs />
</js-module>

<js-module src="www/Coordinates.js" name="Coordinates">
<clobbers target="Coordinates" />
</js-module>

<js-module src="www/PositionError.js" name="PositionError">
<clobbers target="PositionError" />
</js-module>

<js-module src="www/Position.js" name="Position">
<clobbers target="Position" />
</js-module>

<js-module src="www/geolocation.js" name="geolocation">
<clobbers target="navigator.geolocation" />
</js-module>
</platform>

<!-- firefoxos -->
<platform name="firefoxos">
<config-file target="config.xml" parent="/*">
@@ -49,16 +49,25 @@ function createErrorCode() {
}
}
function createResult(pos) {
return {
latitude: pos.coordinate.point.position.latitude,
longitude: pos.coordinate.point.position.longitude,
altitude: pos.coordinate.point.position.altitude,
var res = {
accuracy: pos.coordinate.accuracy,
heading: pos.coordinate.heading,
velocity: pos.coordinate.speed,
altitudeAccuracy: pos.coordinate.altitudeAccuracy,
timestamp: pos.coordinate.timestamp
};
}

if (pos.coordinate.point) {
res.latitude = pos.coordinate.point.position.latitude;
res.longitude = pos.coordinate.point.position.longitude;
res.altitude = pos.coordinate.point.position.altitude;
} else { // compatibility with old windows8.0 api
res.latitude = pos.coordinate.latitude;
res.longitude = pos.coordinate.longitude;
res.altitude = pos.coordinate.altitude;
}

return res;
}

module.exports = {
@@ -154,4 +163,4 @@ module.exports = {
}
};

require("cordova/windows8/commandProxy").add("Geolocation", module.exports);
require("cordova/exec/proxy").add("Geolocation", module.exports);

This file was deleted.

0 comments on commit 4137f9d

Please sign in to comment.